summaryrefslogtreecommitdiff
path: root/src/main/java/IChannelNode.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/IChannelNode.java')
-rw-r--r--src/main/java/IChannelNode.java10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main/java/IChannelNode.java b/src/main/java/IChannelNode.java
index a6446f1..cc1d3e8 100644
--- a/src/main/java/IChannelNode.java
+++ b/src/main/java/IChannelNode.java
@@ -3,9 +3,9 @@ import java.util.Map;
3 3
4public interface IChannelNode extends Comparable<IChannelNode> { 4public interface IChannelNode extends Comparable<IChannelNode> {
5 enum Direction { 5 enum Direction {
6 INCOMING(1), // Users incoming from outside channel (aka: other channel forwarded this channel's post) 6 INCOMING(1 << 0), // Users incoming from outside channel (aka: other channel forwarded this channel's post)
7 OUTGOING(2), // Users outgoing from this channel (aka: this channel forwarded someone else's post) 7 OUTGOING(1 << 1), // Users outgoing from this channel (aka: this channel forwarded someone else's post)
8 BOTH(3); // Modify both incoming and outgoing counts at once 8 BOTH(INCOMING.val | OUTGOING.val); // Modify both incoming and outgoing counts at once
9 9
10 private final int val; 10 private final int val;
11 Direction(int val) {this.val = val;} 11 Direction(int val) {this.val = val;}
@@ -22,7 +22,7 @@ public interface IChannelNode extends Comparable<IChannelNode> {
22 22
23 // For each direction in the map, check that the given direction is gte, and if so run the callback 23 // For each direction in the map, check that the given direction is gte, and if so run the callback
24 for(Direction cdir: cmap.keySet()) 24 for(Direction cdir: cmap.keySet())
25 if(dir.getVal() >= cdir.getVal()) 25 if((dir.getVal() & cdir.getVal()) > 0)
26 cmap.get(cdir).cb(); 26 cmap.get(cdir).cb();
27 } 27 }
28 // This is hilariously overengineered because java fucking sucks my entire cock and balls 28 // This is hilariously overengineered because java fucking sucks my entire cock and balls
@@ -35,7 +35,7 @@ public interface IChannelNode extends Comparable<IChannelNode> {
35 void addConnections(Iterable<IChannelNode> nodes, Direction dir); 35 void addConnections(Iterable<IChannelNode> nodes, Direction dir);
36 void removeConnection(IChannelNode node, Direction dir); 36 void removeConnection(IChannelNode node, Direction dir);
37 void removeConnections(Iterable<IChannelNode> nodes, Direction dir); 37 void removeConnections(Iterable<IChannelNode> nodes, Direction dir);
38 void clearConnections(Direction dir); 38 void clearConnections();
39 39
40 boolean connectionExists(IChannelNode node, Direction dir); 40 boolean connectionExists(IChannelNode node, Direction dir);
41 int getNumConnections(Direction dir); 41 int getNumConnections(Direction dir);