private static synchronized GRIBTNode getChild(int AS, GRIBTNode parent) { GRIBTNode child = null; TLinkedList childs = parent.getChilds(); if (childs != null && !childs.isEmpty()) { for (int i = 0; i < childs.size(); i++) { if (((GRIBTNode) childs.get(i)).AS == AS) child = (GRIBTNode) childs.get(i); } } return child; }
public static synchronized void decreaseRefCount(GRIBTNode node) { if (phaseOne) { --(node.refCount); GRIBTNode parent = node.parent; while (parent != root) { --(parent.refCount); parent = parent.parent; } --root.refCount; if (node.refCount == 0 && node.getChilds().isEmpty() && node != root) removeChild(node.parent, node); } }
/** Check if this entry exist in a certain parent tree */ public static boolean isChild(GRIBTNode parent, GRIBTNode child) { if (parent.getChilds().contains(child)) return true; else return false; }
/** Remove an existing child from a certain parent tree */ private static synchronized void removeChild(GRIBTNode parent, GRIBTNode child) { if (parent == null) System.out.println("Null"); parent.getChilds().remove(child); }
/** Add a new child to a certain parent tree */ private static synchronized void addChild(GRIBTNode parent, GRIBTNode child) { parent.getChilds().add(child); }