forked from bferdinandus/SwitchBoard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathElement.pde
73 lines (60 loc) · 1.35 KB
/
Element.pde
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
public class Element
{
protected Integer _id, _x, _y;
protected Boolean _flip = false, _reverse = false, _isPositioned = false;
protected TerminalCircle _circle = new TerminalCircle();
protected Boolean _mouseOverSwitchTrack = false, _highlight = false;
public Element (Integer id) {
_id = id;
}
public void Display() {
// override this function in the sub classes
println("Element$display => function not overridden for element id: " + _id);
};
// functions
public Integer Id()
{
return _id;
}
public void XY(Map<String, Integer> xy) {
// set the start position for this element
_x = xy.get("x");
_y = xy.get("y");
_isPositioned = true;
}
public Map<String, Integer> XY()
{
Map<String, Integer> xy = new HashMap<String, Integer>();
xy.put("x", _x);
xy.put("y", _y);
return xy;
}
public Boolean Flip()
{
return _flip;
}
public void Flip(Boolean flip)
{
_flip = flip;
}
public Boolean Reverse()
{
return _reverse;
}
public void Reverse(Boolean reverse)
{
_reverse = reverse;
}
public void Highlight(Boolean highlight)
{
_highlight = highlight;
}
public Boolean IsPositioned()
{
return _isPositioned;
}
public Boolean MouseOverCheck(Integer x, Integer y) {
// override this function in the subclasses
return false;
}
}