Skip to content

Commit c889c87

Browse files
authored
Merge pull request #2 from kyildirim/feature/i-hate-my-life
Feature/i hate my life
2 parents c0d4dc1 + 68ce9f7 commit c889c87

10 files changed

+159
-19
lines changed

.classpath

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@
1515
<classpathentry kind="lib" path="lib/gs-ui-1.3-javadoc.jar"/>
1616
<classpathentry kind="lib" path="lib/gs-ui-1.3-sources.jar"/>
1717
<classpathentry kind="lib" path="lib/gs-ui-1.3.jar"/>
18-
<classpathentry kind="lib" path="org.eclipse.jdt.annotation_2.2.300.v20190328-1431.jar"/>
18+
<classpathentry kind="lib" path="lib/org.eclipse.jdt.annotation_2.2.300.v20190328-1431.jar"/>
1919
<classpathentry kind="output" path="bin"/>
2020
</classpath>

src/config/SimulationConfiguration.java

+18-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/**
44
* A class that stores the required variables to tune the simulation.
55
*
6-
* @author kyildirim
6+
* @author Kaan Yıldırım @kyildirim
77
*
88
*/
99
public class SimulationConfiguration {
@@ -28,5 +28,22 @@ public class SimulationConfiguration {
2828
* If <code>{@link SimulationConfiguration#USE_SINGLE_FALSE_POSITIVE_RATE USE_SINGLE_FALSE_POSITIVE_RATE}</code> is <code>true</code> this is the false positive rate.
2929
*/
3030
private static float FALSE_POSITIVE_RATE = 2f;
31+
/**
32+
* If <code>true</code>, then the simulation uses random attack throughput that are between <code>{@link SimulationConfiguration#ATTACK_THROUGHPUT_MINIMUM ATTACK_THROUGHPUT_MINIMUM}</code> and <code>{@link SimulationConfiguration#ATTACK_THROUGHPUT_MAXIMUM ATTACK_THROUGHPUT_MAXIMUM}</code>.
33+
*/
34+
private static boolean USE_VARYING_ATTACK_THROUGHPUT = false;
35+
/**
36+
* If <code>{@link SimulationConfiguration#USE_VARYING_ATTACK_THROUGHPUT USE_VARYING_ATTACK_THROUGHPUT}</code> is <code>true</code> this is the minimum attack throughput.
37+
*/
38+
private static float ATTACK_THROUGHPUT_MINIMUM = 1f;
39+
/**
40+
* If <code>{@link SimulationConfiguration#USE_VARYING_ATTACK_THROUGHPUT USE_VARYING_ATTACK_THROUGHPUT}</code> is <code>true</code> this is the maximum attack throughput.
41+
*/
42+
private static float ATTACK_THROUGHPUT_MAXIMUM = 3f;
43+
/**
44+
* If <code>{@link SimulationConfiguration#USE_VARYING_ATTACK_THROUGHPUT USE_VARYING_ATTACK_THROUGHPUT}</code> is <code>false</code> this is the attack throughput.
45+
*/
46+
private static float ATTACK_THROUGHPUT = 2f;
47+
3148

3249
}

src/network/Client.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package network;
22

3-
public class Client implements Routable {
3+
public class Client extends Routable {
44

55
//TODO Implement.
66

src/network/Domain.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
package network;
22

3-
public class Domain implements Routable{
3+
/**
4+
* @author Ahmet Uysal @ahmetuysal
5+
*
6+
*/
7+
public class Domain extends Routable{
48

59
//TODO Implement.
610

src/network/Packet.java

+89-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,94 @@
11
package network;
22

3+
import java.util.Stack;
4+
import java.util.UUID;
5+
6+
/**
7+
* An object that describes a packet that can be send between
8+
* <code>{@link Routable}</code> objects.
9+
*
10+
* @author Ahmet Uysal @ahmetuysal
11+
*
12+
*/
313
public class Packet {
414

5-
//TODO Implement.
6-
15+
/**
16+
* Universally unique identifier of the requested service.
17+
*/
18+
private UUID sid;
19+
20+
/**
21+
* Universally unique identifier of the packet source <code>Routable</code>.
22+
*/
23+
private UUID sourceId;
24+
25+
/**
26+
* Stack of <code>UUID</code> that represents <code>Route</code> objects that
27+
* this packet traveled through.
28+
*/
29+
private Stack<UUID> pidStack;
30+
31+
/**
32+
* @param _sid Universally unique identifier of the requested service.
33+
* @param _sourceId Universally unique identifier of the packet source
34+
* <code>Routable</code>.
35+
* @param _pidStack Stack of <code>UUID</code> that represents
36+
* <code>Route</code> objects that this packet traveled
37+
* through.
38+
*/
39+
public Packet(UUID _sid, UUID _sourceId, Stack<UUID> _pidStack) {
40+
this.sid = _sid;
41+
this.sourceId = _sourceId;
42+
this.pidStack = _pidStack;
43+
}
44+
45+
/**
46+
* @return the universally unique identifier of the requested service of this
47+
* <code>Packet</code>.
48+
*/
49+
public UUID getSid() {
50+
return this.sid;
51+
}
52+
53+
/**
54+
* @param _sid the universally unique identifier of the requested service of
55+
* this <code>Packet</code> to set.
56+
*/
57+
public void setSid(UUID _sid) {
58+
this.sid = _sid;
59+
}
60+
61+
/**
62+
* @return Universally unique identifier of the packet source
63+
* <code>Routable</code>.
64+
*/
65+
public UUID getSourceId() {
66+
return this.sourceId;
67+
}
68+
69+
/**
70+
* @param _sourceId Universally unique identifier of the packet source
71+
* <code>Routable</code> to set.
72+
*/
73+
public void setSourceId(UUID _sourceId) {
74+
this.sourceId = _sourceId;
75+
}
76+
77+
/**
78+
* @return Stack of <code>UUID</code> that represents <code>Route</code> objects
79+
* that this packet traveled through.
80+
*/
81+
public Stack<UUID> getPidStack() {
82+
return this.pidStack;
83+
}
84+
85+
/**
86+
* @param _pidStack Stack of <code>UUID</code> that represents
87+
* <code>Route</code> objects that this packet traveled through
88+
* to set.
89+
*/
90+
public void setPidStack(Stack<UUID> _pidStack) {
91+
this.pidStack = _pidStack;
92+
}
93+
794
}

src/network/ResourceManager.java

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package network;
2+
3+
/**
4+
* An object that represents resource manager.
5+
* @author Ahmet Uysal @ahmetuysal
6+
*
7+
*/
8+
public class ResourceManager extends Routable {
9+
10+
}

src/network/Routable.java

+19-4
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,31 @@
11
package network;
22

3+
import java.util.ArrayList;
4+
import java.util.UUID;
5+
36
/**
47
*
5-
* The interface that describes any object that can be routed to.
8+
* The abstract class that describes any object that can be routed to.
69
*
7-
* @author Kaan Yıldırım @kyildirim
10+
* @author Kaan Yıldırım @kyildirim, Ahmet Uysal @ahmetuysal, Ceren Kocaoğullar @ckocaogullar15
811
* @see Client
912
* @see Router
1013
*
1114
*/
12-
public interface Routable {
15+
public abstract class Routable {
1316

14-
//TODO Implement.
17+
/**
18+
* Universal unique identifier of this <code>Routable</code>.
19+
*/
20+
private UUID uuid;
21+
22+
/**
23+
* Domain of this <code>Routable</code>.
24+
*/
25+
private Domain domain;
1526

27+
/**
28+
* A list of <code>Route</code> objects that describe routes originated from this <code>Routable</code>.
29+
*/
30+
private ArrayList<Route> routeList;
1631
}

src/network/Route.java

+15-8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package network;
22

3+
import java.util.UUID;
4+
35
/**
46
* An object that describes a route between two <code>{@link Routable}</code> objects.
57
*
@@ -9,43 +11,48 @@
911
public class Route {
1012

1113
/**
12-
* <code>{@link Routable}</code> object that is the origin of this route.
14+
* Universal unique identifier of this <code>Route</code>.
15+
*/
16+
private UUID pid;
17+
18+
/**
19+
* <code>{@link Routable}</code> object that is the origin of this <code>Route</code>.
1320
*/
1421
private Routable origin;
1522
/**
16-
* <code>{@link Routable}</code> object that is the destination of this route.
23+
* <code>{@link Routable}</code> object that is the destination of this <code>Route</code>.
1724
*/
1825
private Routable destination;
1926
/**
20-
* Throughput that is through this route.
27+
* Throughput that is through this <code>Route</code>.
2128
*/
2229
private double throughput;
2330
/**
24-
* @return the <code>{@link Routable}</code> object that is the origin of this route.
31+
* @return the <code>{@link Routable}</code> object that is the origin of this <code>Route</code>.
2532
*/
2633
public Routable getOrigin() {
2734
return this.origin;
2835
}
2936
/**
30-
* @param _origin the <code>{@link Routable}</code> object to set as the origin of this route.
37+
* @param _origin the <code>{@link Routable}</code> object to set as the origin of this <code>Route</code>.
3138
*/
3239
public void setOrigin(Routable _origin) {
3340
this.origin = _origin;
3441
}
3542
/**
36-
* @return the <code>{@link Routable}</code> object that is the destination of this route.
43+
* @return the <code>{@link Routable}</code> object that is the destination of this <code>Route</code>.
3744
*/
3845
public Routable getDestination() {
3946
return this.destination;
4047
}
4148
/**
42-
* @param _destination <code>{@link Routable}</code> object to set as the destination of this route.
49+
* @param _destination <code>{@link Routable}</code> object to set as the destination of this <code>Route</code>.
4350
*/
4451
public void setDestination(Routable _destination) {
4552
this.destination = _destination;
4653
}
4754
/**
48-
* @return the throughput through this route.
55+
* @return the throughput through this <code>Route</code>.
4956
*/
5057
public double getThroughput() {
5158
return this.throughput;

src/network/Router.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package network;
22

3-
public class Router implements Routable {
3+
public class Router extends Routable {
44

55
//TODO Implement.
66

0 commit comments

Comments
 (0)