1 4 package org.jboss.cache; 5 6 import java.util.Map ; 7 8 13 public abstract class AbstractNode implements Node 14 { 15 protected boolean deleted; 16 protected Map <Object , Node> children; 17 protected Fqn fqn; 18 19 public boolean isDeleted() 20 { 21 return deleted; 22 } 23 24 public void markAsDeleted(boolean marker) 25 { 26 markAsDeleted(marker, false); 27 } 28 29 public void markAsDeleted(boolean marker, boolean recursive) 30 { 31 deleted = marker; 32 if (recursive && children != null) 33 { 34 synchronized (this) 35 { 36 for (Node child : children.values()) 37 { 38 ((AbstractNode) child).markAsDeleted(marker, true); 39 } 40 } 41 } 42 } 43 44 public boolean equals(Object another) 45 { 46 if (another instanceof AbstractNode) 47 { 48 AbstractNode anotherNode = (AbstractNode) another; 49 return fqn == null && anotherNode.fqn == null || !(fqn == null || anotherNode.fqn == null) && fqn.equals(anotherNode.fqn); 50 } 51 return false; 52 } 53 54 public int hashCode() 55 { 56 return fqn.hashCode(); 57 } 58 } 59 | Popular Tags |