Home / Development / Documentation / 2.0.44 / LeafField
TreeGraph 2
 


info.bioinfweb.treegraph.document.undo.file.addsupportvalues
Class LeafField

java.lang.Object
  extended by info.bioinfweb.treegraph.document.undo.file.addsupportvalues.LeafField

public class LeafField
extends Object

Since:
2.0.33
Author:
Ben Stöver

Field Summary
private  boolean[] field
           
 
Constructor Summary
LeafField(int size)
           
 
Method Summary
 void addField(LeafField other)
           
 int compareTo(LeafField other, boolean complement)
          Compares this field or its complement to another.
 LeafField complement()
           
 boolean containsAnyAndOther(LeafField other, boolean complement)
          Tests if this field (or its complement) contains at least one element from the specified field and at least one which is not contained in other.
 boolean equals(Object other)
           
 boolean inSubtreeOf(LeafField other, boolean complement)
          Returns false if this field (or its complement) contains any terminal the specified field does not contain and this field (or its complement) contains at least one terminal less than the specified field.
 boolean isChild(int pos)
           
 void setChild(int pos, boolean value)
           
 int size()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

field

private boolean[] field
Constructor Detail

LeafField

public LeafField(int size)
Method Detail

isChild

public boolean isChild(int pos)

setChild

public void setChild(int pos,
                     boolean value)

size

public int size()

addField

public void addField(LeafField other)

compareTo

public int compareTo(LeafField other,
                     boolean complement)
Compares this field or its complement to another. Note that both fields have be of the same size.

Parameters:
other - the leaf field to be compared
complement - defines whether the original of this field or its complement shall be compared
Returns:
0 if exactly the same leafs are contained in both fields, -1 if the other field does not contain all leafs that this field contains (if so the complement of this field is tested before -1 is returned) or a value greater than 0 if the other field contains more leafs than this one including all leafs contained here. (The return value than indicated the additional number of leafs contained in the other fiels.)

inSubtreeOf

public boolean inSubtreeOf(LeafField other,
                           boolean complement)
Returns false if this field (or its complement) contains any terminal the specified field does not contain and this field (or its complement) contains at least one terminal less than the specified field. (Tests whether this field (or its complement) is in the subtree of the specified field.)

Parameters:
other -
complement -
Returns:

complement

public LeafField complement()

containsAnyAndOther

public boolean containsAnyAndOther(LeafField other,
                                   boolean complement)
Tests if this field (or its complement) contains at least one element from the specified field and at least one which is not contained in other.

Parameters:
other -
complement -
Returns:

equals

public boolean equals(Object other)
Overrides:
equals in class Object

toString

public String toString()
Overrides:
toString in class Object