Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## info.bioinfweb.treegraph.document
Class TextElementData

    java.lang.Object
      info.bioinfweb.treegraph.document.TextElementData

All Implemented Interfaces:
  java.lang.Cloneable

    public class TextElementData

extends java.lang.Object
implements java.lang.Cloneable

This class is used to store data of tree elements which can either be a string or a decimal value.

Author:
  Ben Stöver

Field Summary
`private double` | `decimal`
`private java.lang.String` | `text`

Constructor Summary
`TextElementData()`
`TextElementData(double decimal)`
`TextElementData(java.lang.String string)`

Method Summary
`void` | `assign(TextElementData other)`
`void` | `clear()` Clears this object.
`TextElementData` | `clone()`
`boolean` | `equals(java.lang.Object other)`
`static java.lang.String` | `formatTextElement(TextElement element)` Returns the formatted value of the given text element.
`java.lang.String` | `formatValue(java.text.DecimalFormat format)` Return the contained string or the contained formated decimal value or an empty string is the object contains no data.
`double` | `getDecimal()` Return the stored decimal value or `Double.NaN` is no decimal is stored.
`java.lang.String` | `getText()` Returns the stored string value or `null` is no string is stored.
`boolean` | `isDecimal()` Return whether this object contains a decimal value.
`boolean` | `isEmpty()` Return whether this object is empty.
`boolean` | `isString()` Return whether this object contains a string value.
`void` | `setDecimal(double doubleValue)`
`void` | `setText(java.lang.String stringValue)`
`java.lang.String` | `toString()` Returns either the stored string, the decimal value as a sting or `null` if the object is empty.

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### text

    private java.lang.String text

### decimal

    private double decimal

Constructor Detail

### TextElementData

    public TextElementData()

### TextElementData

    public TextElementData(java.lang.String string)

### TextElementData

    public TextElementData(double decimal)

Method Detail

### getDecimal

    public double getDecimal()

  Return the stored decimal value or `Double.NaN` is no decimal is stored.

  Returns:

### setDecimal

    public void setDecimal(double doubleValue)

### getText

    public java.lang.String getText()

  Returns the stored string value or `null` is no string is stored.

  Returns:

### setText

    public void setText(java.lang.String stringValue)

### clear

    public void clear()

  Clears this object. If a string or a decimal value are stored they will be deleted.

  See Also:
    `isEmpty()`

### isString

    public boolean isString()

  Return whether this object contains a string value. Not that the return of `false` does not necessarily mean that a decimal value is contained. This object could also be empty.

  Returns:
    `true` if the stored value is a string
  See Also:
    `isDecimal()`, `isEmpty()`

### isDecimal

    public boolean isDecimal()

  Return whether this object contains a decimal value. Not that the return of `false` does not necessarily mean that a string value is contained. This object could also be empty.

  Returns:
    `true` if the stored value is a decimnal
  See Also:
    `isString()`, `isEmpty()`

### isEmpty

    public boolean isEmpty()

  Return whether this object is empty. It that case is neither contains a string nor a decimal.

  Returns:
    `true` if there is no value stored
  See Also:
    `isDecimal()`, `isString()`

### formatValue

    public java.lang.String formatValue(java.text.DecimalFormat format)

  Return the contained string or the contained formated decimal value or an empty string is the object contains no data.

  Parameters:
    `format` - - the format-object to format a possibly contained decimal value
  Returns:
    the (formatted) string representation of the stored value

### formatTextElement

    public static java.lang.String formatTextElement(TextElement element)

  Returns the formatted value of the given text element.

  Parameters:
    `element` - - the element to be formatted
  Returns:

### toString

    public java.lang.String toString()

  Returns either the stored string, the decimal value as a sting or `null` if the object is empty.

  Overrides:
    `toString` in class `java.lang.Object`
  See Also:
    `Object.toString()`

### assign

    public void assign(TextElementData other)

### equals

    public boolean equals(java.lang.Object other)

  Overrides:
    `equals` in class `java.lang.Object`

### clone

    public TextElementData clone()

  Overrides:
    `clone` in class `java.lang.Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD