diff options
| author | @syxhe <t.me/syxhe> | 2025-10-01 21:26:08 -0500 |
|---|---|---|
| committer | @syxhe <t.me/syxhe> | 2025-10-01 21:26:08 -0500 |
| commit | 7b84eb10c7c70dc83acd21afcc1ae631369428eb (patch) | |
| tree | ee8c2f776be1fa4d052ed42f80884f5a30015ee7 /src/main/java/IChannelNode.java | |
| parent | b95b043fd07f8e760b1863ff127bee2b1d2633c9 (diff) | |
Implement ChannelNode
Diffstat (limited to 'src/main/java/IChannelNode.java')
| -rw-r--r-- | src/main/java/IChannelNode.java | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/main/java/IChannelNode.java b/src/main/java/IChannelNode.java index 463f3ac..baf7572 100644 --- a/src/main/java/IChannelNode.java +++ b/src/main/java/IChannelNode.java | |||
| @@ -1,14 +1,19 @@ | |||
| 1 | import java.util.List; | 1 | import java.util.List; |
| 2 | import java.util.Map; | 2 | import java.util.Map; |
| 3 | 3 | ||
| 4 | public interface IChannelNode { | 4 | public interface IChannelNode extends Comparable<IChannelNode> { |
| 5 | enum Direction { | 5 | enum Direction { |
| 6 | INCOMING, | 6 | INCOMING(0), // Users incoming from outside channel (aka: other channel forwarded this channel's post) |
| 7 | OUTGOING, | 7 | OUTGOING(1), // Users outgoing from this channel (aka: this channel forwarded someone else's post) |
| 8 | BOTH | 8 | BOTH(2); // Modify both incoming and outgoing counts at once |
| 9 | |||
| 10 | private final int val; | ||
| 11 | Direction(int val) {this.val = val;} | ||
| 12 | public int getVal() {return this.val;} | ||
| 9 | } | 13 | } |
| 10 | 14 | ||
| 11 | void setConnections(Map<IChannelNode, Integer> conmap, Direction dir); | 15 | void setConnections(Map<IChannelNode, Integer> conmap, Direction dir); |
| 16 | void setNumConnections(IChannelNode node, Direction dir, int num); | ||
| 12 | void addConnection(IChannelNode node, Direction dir); | 17 | void addConnection(IChannelNode node, Direction dir); |
| 13 | void addConnections(Iterable<IChannelNode> nodes, Direction dir); | 18 | void addConnections(Iterable<IChannelNode> nodes, Direction dir); |
| 14 | void removeConnection(IChannelNode node, Direction dir); | 19 | void removeConnection(IChannelNode node, Direction dir); |
| @@ -16,6 +21,7 @@ public interface IChannelNode { | |||
| 16 | void clearConnections(Direction dir); | 21 | void clearConnections(Direction dir); |
| 17 | 22 | ||
| 18 | boolean connectionExists(IChannelNode node, Direction dir); | 23 | boolean connectionExists(IChannelNode node, Direction dir); |
| 24 | int getNumConnections(Direction dir); | ||
| 19 | Map<IChannelNode, Integer> getIncomingConnections(); | 25 | Map<IChannelNode, Integer> getIncomingConnections(); |
| 20 | Map<IChannelNode, Integer> getOutgoingConnections(); | 26 | Map<IChannelNode, Integer> getOutgoingConnections(); |
| 21 | List<Map<IChannelNode, Integer>> getConnections(Direction dir); | 27 | List<Map<IChannelNode, Integer>> getConnections(Direction dir); |
