Home / Development / Documentation / 2.0.44 / Labels
TreeGraph 2
 


info.bioinfweb.treegraph.document
Class Labels

java.lang.Object
  extended by info.bioinfweb.treegraph.document.Labels
All Implemented Interfaces:
Cloneable

public class Labels
extends Object
implements Cloneable

This class stores the Labels of a Node and provides infomation about whole rows and columns.

Author:
BenStoever

Field Summary
private static int CAPACITY_INCREMENT
           
private  Branch holdingBranch
           
private static int INITIAL_CAPACITY
           
private  List<LabelLine> labelLinesAbove
           
private  List<LabelLine> labelLinesBelow
           
 
Constructor Summary
Labels(Branch holdingBranch)
           
 
Method Summary
 int add(Label label)
          Adds a label to the List.
private  void addLabelBlock(List<Label> list, boolean above, boolean textLabel, boolean iconLabel, boolean pieChart)
           
 void clear()
           
 Labels clone()
          Returns a deep copy of this Labels-object (including copys of all LabelLine-objects and their Labels.
private  void cloneLabelBlock(boolean above, Labels target)
           
 boolean contains(boolean above, Label label)
          Tests if the specified label is contained in the specified block (above or below the branch).
 boolean contains(Label label)
          Tests if the specified label is contained in this object.
 boolean containsSameID(Labels other)
           
private  boolean containsSameID(Labels other, boolean above)
           
 Label get(boolean above, int lineNo, int lineIndex)
          Returns the label at the specified position
 Label get(String id)
           
 Label getAbove(boolean above, int lineNo, int lineIndex)
           
 Label getBelow(boolean above, int lineNo, int lineIndex)
           
 Branch getHoldingBranch()
           
 int getLineIndex(boolean above, int lineNo, Label label)
          Returns the index of the specified label in its line.
 int getLineIndex(boolean above, Label label)
          Returns the index of the specified label in its line.
 int getLineIndex(Label label)
           
 int getLineNo(boolean above, Label label)
          Returns the line number this label is located in.
private  List<LabelLine> getLines(boolean above)
           
private  Label getNext(List<LabelLine> lines, int addend, int lineNo, int lineIndex)
           
 boolean isEmpty()
          Tests if any labels are present
 int labelCount(boolean above, int lineNo)
          Returns the number of labels in the specified line.
private  List<Label> labelList(boolean textLabel, boolean iconLabel, boolean pieChart)
           
 int lineCount(boolean above)
           
private  void reduceLabelLineVectors()
           
 boolean reinsert(Label label)
           
 boolean remove(Label label)
           
private  Label searchByID(String id, boolean above)
           
 void setHoldingBranch(Branch holdingBranch)
           
 IconLabel[] toIconLabelArray()
           
 Label[] toLabelArray()
           
 Label[] toLabelArray(boolean textLabel, boolean iconLabel, boolean pieChart)
           
 PieChartLabel[] toPieChartLabelArray()
           
 TextLabel[] toTextLabelArray()
           
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIAL_CAPACITY

private static final int INITIAL_CAPACITY
See Also:
Constant Field Values

CAPACITY_INCREMENT

private static final int CAPACITY_INCREMENT
See Also:
Constant Field Values

holdingBranch

private Branch holdingBranch

labelLinesAbove

private List<LabelLine> labelLinesAbove

labelLinesBelow

private List<LabelLine> labelLinesBelow
Constructor Detail

Labels

public Labels(Branch holdingBranch)
Method Detail

getHoldingBranch

public Branch getHoldingBranch()

setHoldingBranch

public void setHoldingBranch(Branch holdingBranch)

reduceLabelLineVectors

private void reduceLabelLineVectors()

getLines

private List<LabelLine> getLines(boolean above)

add

public int add(Label label)
Adds a label to the List.

Parameters:
label - the label to add
Returns:
the index the label has in its line

remove

public boolean remove(Label label)

reinsert

public boolean reinsert(Label label)

get

public Label get(boolean above,
                 int lineNo,
                 int lineIndex)
Returns the label at the specified position

Parameters:
above - indicates wheather the label is above the branch
lineNo - the number of the line the label in located in (below or above the branch) The first line has the index 0.
lineIndex - the position in the line counted from the left (Does not equal the linePosition value.)
Returns:
the label at the specified position

getNext

private Label getNext(List<LabelLine> lines,
                      int addend,
                      int lineNo,
                      int lineIndex)

getAbove

public Label getAbove(boolean above,
                      int lineNo,
                      int lineIndex)

getBelow

public Label getBelow(boolean above,
                      int lineNo,
                      int lineIndex)

searchByID

private Label searchByID(String id,
                         boolean above)

get

public Label get(String id)

contains

public boolean contains(boolean above,
                        Label label)
Tests if the specified label is contained in the specified block (above or below the branch).

Parameters:
above -
label -
Returns:
true if the label is contained

contains

public boolean contains(Label label)
Tests if the specified label is contained in this object.

Parameters:
label -
Returns:
true if the label is contained

getLineNo

public int getLineNo(boolean above,
                     Label label)
Returns the line number this label is located in.

Parameters:
above - specifies the labels block
label -
Returns:
the line number or -1 if the label is not contained in the specified label block at all

getLineIndex

public int getLineIndex(Label label)

getLineIndex

public int getLineIndex(boolean above,
                        Label label)
Returns the index of the specified label in its line.

Parameters:
above -
label -
Returns:
the index or -1

getLineIndex

public int getLineIndex(boolean above,
                        int lineNo,
                        Label label)
Returns the index of the specified label in its line. This method is fater than getLineIndex(boolean, Label).

Parameters:
above -
lineNo -
label -
Returns:
the index or -1

clear

public void clear()

isEmpty

public boolean isEmpty()
Tests if any labels are present

Returns:
true if labels are present

lineCount

public int lineCount(boolean above)

labelCount

public int labelCount(boolean above,
                      int lineNo)
Returns the number of labels in the specified line.


containsSameID

private boolean containsSameID(Labels other,
                               boolean above)

containsSameID

public boolean containsSameID(Labels other)

addLabelBlock

private void addLabelBlock(List<Label> list,
                           boolean above,
                           boolean textLabel,
                           boolean iconLabel,
                           boolean pieChart)

labelList

private List<Label> labelList(boolean textLabel,
                              boolean iconLabel,
                              boolean pieChart)

toLabelArray

public Label[] toLabelArray(boolean textLabel,
                            boolean iconLabel,
                            boolean pieChart)

toLabelArray

public Label[] toLabelArray()

toTextLabelArray

public TextLabel[] toTextLabelArray()

toIconLabelArray

public IconLabel[] toIconLabelArray()

toPieChartLabelArray

public PieChartLabel[] toPieChartLabelArray()

cloneLabelBlock

private void cloneLabelBlock(boolean above,
                             Labels target)

clone

public Labels clone()
Returns a deep copy of this Labels-object (including copys of all LabelLine-objects and their Labels. Note that the holding branch is still the same as in the original Labels-object.

Overrides:
clone in class Object