From 3de3a9d4ca7b188abb0411c9e0a484ed2561a4b7 Mon Sep 17 00:00:00 2001 From: "@syxhe" Date: Thu, 2 Oct 2025 19:05:32 -0500 Subject: Wrangle with test cases --- src/main/java/IChannelNode.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/IChannelNode.java') 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; public interface IChannelNode extends Comparable { enum Direction { - INCOMING(1), // Users incoming from outside channel (aka: other channel forwarded this channel's post) - OUTGOING(2), // Users outgoing from this channel (aka: this channel forwarded someone else's post) - BOTH(3); // Modify both incoming and outgoing counts at once + INCOMING(1 << 0), // Users incoming from outside channel (aka: other channel forwarded this channel's post) + OUTGOING(1 << 1), // Users outgoing from this channel (aka: this channel forwarded someone else's post) + BOTH(INCOMING.val | OUTGOING.val); // Modify both incoming and outgoing counts at once private final int val; Direction(int val) {this.val = val;} @@ -22,7 +22,7 @@ public interface IChannelNode extends Comparable { // For each direction in the map, check that the given direction is gte, and if so run the callback for(Direction cdir: cmap.keySet()) - if(dir.getVal() >= cdir.getVal()) + if((dir.getVal() & cdir.getVal()) > 0) cmap.get(cdir).cb(); } // This is hilariously overengineered because java fucking sucks my entire cock and balls @@ -35,7 +35,7 @@ public interface IChannelNode extends Comparable { void addConnections(Iterable nodes, Direction dir); void removeConnection(IChannelNode node, Direction dir); void removeConnections(Iterable nodes, Direction dir); - void clearConnections(Direction dir); + void clearConnections(); boolean connectionExists(IChannelNode node, Direction dir); int getNumConnections(Direction dir); -- cgit v1.2.3