-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNodes.java
More file actions
executable file
·155 lines (145 loc) · 2.49 KB
/
Nodes.java
File metadata and controls
executable file
·155 lines (145 loc) · 2.49 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
import java.util.*;
public class Nodes
{
ArrayList<String> neighbors = new ArrayList<String>();
ArrayList<AUnit> units = new ArrayList<AUnit>();
private int Nodevalue = 0;
private String name = "";
private Player owner;
private String SpecialAbility = "";
private int streakers;
private int drunks;
private int athletes;
private int freshmen;
private int engineers;
private TransButton button;
public Nodes(String node, List<String> nbrs, List<AUnit> unit, String Special, int Value, Player own){
// Creates a node name node, neighbors nbr, units unit, ability code Special, owner own, and value Value
neighbors.addAll(nbrs);
units.addAll(unit);
Nodevalue = Value;
name = node;
owner = own;
SpecialAbility = Special;
for(AUnit i:unit)
{
if(i instanceof Streaker)
{
streakers ++;
}
else if(i instanceof Drunks)
{
drunks ++;
}
else if(i instanceof Athlete)
{
athletes ++;
}
else if(i instanceof Engineers)
{
engineers ++;
}
else
{
freshmen ++;
}
}
}
public void setNeighbors(List<String> N){
neighbors.addAll(N);
}
public void setButton(TransButton b){
button = b;
}
public TransButton getButton(){
return button;
}
public ArrayList<String> getNeighbors(){
return neighbors;
}
public void addUnit(AUnit i){
units.add(i);
if(i instanceof Streaker)
{
streakers ++;
}
else if(i instanceof Drunks)
{
drunks ++;
}
else if(i instanceof Athlete)
{
athletes ++;
}
else if(i instanceof Engineers)
{
engineers ++;
}
else
{
freshmen ++;
}
}
public void removeUnit(AUnit i){
units.remove(i);
if(i instanceof Streaker)
{
streakers --;
}
else if(i instanceof Drunks)
{
drunks --;
}
else if(i instanceof Athlete)
{
athletes --;
}
else if(i instanceof Engineers)
{
engineers --;
}
else
{
freshmen --;
}
}
public ArrayList<AUnit> getUnits(){
return units;
}
public int getValue(){
return Nodevalue;
}
public String getSpecialAbility(){
return SpecialAbility;
}
public void setOwner(Player own){
owner = own;
button.setBackground(own.getColor());
}
public Player getOwner(){
return owner;
}
public int getStreakers()
{
return streakers;
}
public int getAthletes()
{
return athletes;
}
public int getFreshmen()
{
return freshmen;
}
public int getDrunks()
{
return drunks;
}
public int getEngineers()
{
return engineers;
}
public String getName(){
return name;
}
}