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

## weka.gui.ensembleLibraryEditor.tree
Class NumberNode

    java.lang.Object
      javax.swing.tree.DefaultMutableTreeNode
          weka.gui.ensembleLibraryEditor.tree.NumberNode

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, javax.swing.tree.MutableTreeNode, javax.swing.tree.TreeNode

    public class NumberNode

extends javax.swing.tree.DefaultMutableTreeNode

This subclass is responsible for allowing users to specify either a minimum, maximum, or iterator value for Integer attributes. It stores a value that is of type java.lang.Number to accomodate the many different number types used by Weka classifiers.

Version:
  $Revision: 1.1 $
Author:
  Robert Jung (mrbobjung@gmail.com)
See Also:
  Serialized Form

Field Summary
`static double` | `epsilon` This is the maximum floating point value that we care about when testing for equality.
`static int` | `NOT_ITERATOR` the enumerated value indicating a node is not an iterator
`static int` | `PLUS_EQUAL` the enumerated value indicating a node is a += iterator
`static int` | `scale` this defines the number of decimal places we care about, we arbitrarily chose 7 thinking that anything beyond this is overkill
`static int` | `TIMES_EQUAL` the enumerated value indicating a node is a *= iterator

Fields inherited from class javax.swing.tree.DefaultMutableTreeNode
`EMPTY_ENUMERATION`

Constructor Summary
`NumberNode(java.lang.String text, java.lang.Number value, int iteratorType, boolean checkable, java.lang.String toolTipText)` The constructor simply initializes all of the member variables

Method Summary
`java.lang.Number` | `addNumbers(java.lang.Number a, java.lang.Number b)` adds two objects that are instances of one of the child classes of java.lang.Number
`boolean` | `equals(java.lang.Number a, java.lang.Number b)` tests for equality among two objects that are instances of one of the child classes of java.lang.Number
`boolean` | `getCheckable()` returns whether or not this node can be toggled on and off
`int` | `getIteratorType()` getter for this node's iteratorType which will be one of the three enumerated values
`java.text.NumberFormat` | `getNumberFormat()` A helper method to figure out what number format should be used to display the numbers value in a formatted text box.
`java.lang.Number` | `getOneValue()` figures out the class of this node's object and returns a new instance of it initialized with the value of "1".
`boolean` | `getSelected()` getter for the node selected state
`java.lang.String` | `getText()` returns the text to be displayed for this node
`java.lang.String` | `getToolTipText()` getter for the tooltip text
`java.lang.Number` | `getTwoValue()` figures out the class of this node's object and returns a new instance of it initialized with the value of "2".
`java.lang.Number` | `getValue()` getter for this node's object
`java.lang.Number` | `getZeroValue()` figures out the class of this node's object and returns a new instance of it initialized with the value of "0".
`boolean` | `lessThan(java.lang.Number a, java.lang.Number b)` tests if the first argument is greater than the second among two objects that are instances of one of the child classes of java.lang.Number
`java.lang.Number` | `multiplyNumbers(java.lang.Number a, java.lang.Number b)` multiplies two objects that are instances of one of the child classes of java.lang.Number
`static double` | `roundDouble(double a)` This method rounds a double to the number of decimal places defined by scale
`static float` | `roundFloat(float a)` This method rounds a float to the number of decimal places defined by scale
`void` | `setIteratorType(int newValue)` setter for this nodes iteratorType which should be one of the three enumerated values
`void` | `setSelected(boolean newValue)` setter for the node selected state
`void` | `setUserObject(java.lang.Object o)` this is a simple filter for the setUserObject method.
`void` | `setValue(java.lang.Number newValue)` setter for this nodes object
`java.lang.String` | `toString()` returns a string representation

Methods inherited from class javax.swing.tree.DefaultMutableTreeNode
`add, breadthFirstEnumeration, children, clone, depthFirstEnumeration, getAllowsChildren, getChildAfter, getChildAt, getChildBefore, getChildCount, getDepth, getFirstChild, getFirstLeaf, getIndex, getLastChild, getLastLeaf, getLeafCount, getLevel, getNextLeaf, getNextNode, getNextSibling, getParent, getPath, getPreviousLeaf, getPreviousNode, getPreviousSibling, getRoot, getSharedAncestor, getSiblingCount, getUserObject, getUserObjectPath, insert, isLeaf, isNodeAncestor, isNodeChild, isNodeDescendant, isNodeRelated, isNodeSibling, isRoot, pathFromAncestorEnumeration, postorderEnumeration, preorderEnumeration, remove, remove, removeAllChildren, removeFromParent, setAllowsChildren, setParent`

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

Field Detail

### NOT_ITERATOR

    public static final int NOT_ITERATOR

  the enumerated value indicating a node is not an iterator

  See Also:
    Constant Field Values

### TIMES_EQUAL

    public static final int TIMES_EQUAL

  the enumerated value indicating a node is a *= iterator

  See Also:
    Constant Field Values

### PLUS_EQUAL

    public static final int PLUS_EQUAL

  the enumerated value indicating a node is a += iterator

  See Also:
    Constant Field Values

### scale

    public static final int scale

  this defines the number of decimal places we care about, we arbitrarily chose 7 thinking that anything beyond this is overkill

  See Also:
    Constant Field Values

### epsilon

    public static final double epsilon

  This is the maximum floating point value that we care about when testing for equality.

  See Also:
    Constant Field Values

Constructor Detail

### NumberNode

    public NumberNode(java.lang.String text,
                      java.lang.Number value,
                      int iteratorType,
                      boolean checkable,
                      java.lang.String toolTipText)

  The constructor simply initializes all of the member variables

  Parameters:
    `text` - the name
    `value` - the actual value
    `iteratorType` - the iterator type
    `checkable` - true if it's checkable
    `toolTipText` - the tooltip to use

Method Detail

### roundDouble

    public static double roundDouble(double a)

  This method rounds a double to the number of decimal places defined by scale

  Parameters:
    `a` - the value to round
  Returns:
    the rounded value

### roundFloat

    public static float roundFloat(float a)

  This method rounds a float to the number of decimal places defined by scale

  Parameters:
    `a` - the value to round
  Returns:
    the rounded value

### getSelected

    public boolean getSelected()

  getter for the node selected state

  Returns:
    whether or not this node is selected

### setSelected

    public void setSelected(boolean newValue)

  setter for the node selected state

  Parameters:
    `newValue` - the new selected state

### getValue

    public java.lang.Number getValue()

  getter for this node's object

  Returns:
    the current value

### setValue

    public void setValue(java.lang.Number newValue)

  setter for this nodes object

  Parameters:
    `newValue` - the new value to use

### getIteratorType

    public int getIteratorType()

  getter for this node's iteratorType which will be one of the three enumerated values

  Returns:
    the iterator type

### setIteratorType

    public void setIteratorType(int newValue)

  setter for this nodes iteratorType which should be one of the three enumerated values

  Parameters:
    `newValue` - the new iterator type to use

### getCheckable

    public boolean getCheckable()

  returns whether or not this node can be toggled on and off

  Returns:
    true if it's checkable

### getText

    public java.lang.String getText()

  returns the text to be displayed for this node

  Returns:
    the name

### getToolTipText

    public java.lang.String getToolTipText()

  getter for the tooltip text

  Returns:
    tooltip text

### setUserObject

    public void setUserObject(java.lang.Object o)

  this is a simple filter for the setUserObject method. We basically don't want null values to be passed in.

  Specified by:
    `setUserObject` in interface `javax.swing.tree.MutableTreeNode`
  Overrides:
    `setUserObject` in class `javax.swing.tree.DefaultMutableTreeNode`
  Parameters:
    `o` - the user object

### toString

    public java.lang.String toString()

  returns a string representation

  Overrides:
    `toString` in class `javax.swing.tree.DefaultMutableTreeNode`
  Returns:
    a string representation

### getZeroValue

    public java.lang.Number getZeroValue()
                                  throws NumberClassNotFoundException

  figures out the class of this node's object and returns a new instance of it initialized with the value of "0".

  Returns:
    0 as object
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### getOneValue

    public java.lang.Number getOneValue()
                                 throws NumberClassNotFoundException

  figures out the class of this node's object and returns a new instance of it initialized with the value of "1".

  Returns:
    1 as object
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### getTwoValue

    public java.lang.Number getTwoValue()
                                 throws NumberClassNotFoundException

  figures out the class of this node's object and returns a new instance of it initialized with the value of "2".

  Returns:
    2 as object
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### addNumbers

    public java.lang.Number addNumbers(java.lang.Number a,
                                       java.lang.Number b)
                                throws NumberClassNotFoundException

  adds two objects that are instances of one of the child classes of java.lang.Number

  Parameters:
    `a` - the first number
    `b` - the second number
  Returns:
    the sum: a+b
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### multiplyNumbers

    public java.lang.Number multiplyNumbers(java.lang.Number a,
                                            java.lang.Number b)
                                     throws NumberClassNotFoundException

  multiplies two objects that are instances of one of the child classes of java.lang.Number

  Parameters:
    `a` - the first number
    `b` - the second number
  Returns:
    the product: a*b
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### lessThan

    public boolean lessThan(java.lang.Number a,
                            java.lang.Number b)
                     throws NumberClassNotFoundException

  tests if the first argument is greater than the second among two objects that are instances of one of the child classes of java.lang.Number

  Parameters:
    `a` - the first number
    `b` - the second number
  Returns:
    true if a is less than b
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### equals

    public boolean equals(java.lang.Number a,
                          java.lang.Number b)
                   throws NumberClassNotFoundException

  tests for equality among two objects that are instances of one of the child classes of java.lang.Number

  Parameters:
    `a` - the first number
    `b` - the second number
  Returns:
    true if the two values are equal
  Throws:
    `NumberClassNotFoundException` - if number class not supported

### getNumberFormat

    public java.text.NumberFormat getNumberFormat()
                                           throws NumberClassNotFoundException

  A helper method to figure out what number format should be used to display the numbers value in a formatted text box.

  Returns:
    the number format
  Throws:
    `NumberClassNotFoundException` - if number class not supported

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