package edu.stanford.rt.datatype; /** * @author Ninghui Li, Sandra Qiu
* A TreeValueSet object contains a TreeValue and can be used to express the concept such as including all the sub-directories of the current directory by specifying whether the current value is included, the children of the current value or the descendant of the current value are included. */ public class TreeValueSet extends ValueSet { /** tree value */ private TreeValue value; /** is current tree value included?*/ private boolean currentIncluded; /** is the children included?*/ private boolean childrenIncluded; /** is the descendant incuded? If it is true, then childrenIncluded is also true.*/ private boolean descendantIncluded; /** * Constructor of TreeValueSet */ public TreeValueSet( TreeType type, TreeValue value, boolean currentIncluded, boolean childrenIncluded, boolean descendantIncluded) { super(type); this.value = value; this.currentIncluded = currentIncluded; this.childrenIncluded = childrenIncluded; if (descendantIncluded && !childrenIncluded) throw new IllegalArgumentException("descendantIncluded implicits childrenIncluded."); this.descendantIncluded = descendantIncluded; } /* (non-Javadoc) * @see edu.stanford.rt.datatype.ValueSet#toString(String) */ public String toString(String indent) { String thisIndent = indent + " "; StringBuffer sb = new StringBuffer(); sb.append(thisIndent).append("TreeValueSet: \n"); sb.append(thisIndent + " ").append( getType().toString()).append( "\n"); sb.append(thisIndent + " ").append(value.toString()).append( "\n"); sb .append(thisIndent) .append("currentIncluded=") .append(currentIncluded) .append(" ") .append("childrenIncluded=") .append(childrenIncluded) .append(" ") .append("descendantIncluded=") .append(descendantIncluded) .append("\n"); return sb.toString(); } }