private int getSenderLevel(Node sender) { for (int i = 0; i < levels.size(); i++) { for (Node n : levels.get(i)) { if (n.toString().equals(sender.toString())) { return i; } } } return -1; }
private Node getSender(Node receiver) { for (int i = 0; i < messages.size(); i++) { SenderReceiverPairs pair = messages.elementAt(i); if (pair.getReceiver().toString().equals(receiver.toString())) { return pair.getSender(); } } return null; }