Purple Code

com.purpletech.graph
Class IntegerUnit

java.lang.Object
  |
  +--com.purpletech.graph.IntegerUnit
All Implemented Interfaces:
Unit

public class IntegerUnit
extends java.lang.Object
implements Unit

An IntegerUnit maps an int to a string representation. It also provides a natural interval (UnitInterval).

Version:
$Id: IntegerUnit.java,v 1.2 2001/10/30 12:20:51 alex Exp $
Author:
Alex

Field Summary
protected  java.lang.Object type
           
 
Constructor Summary
IntegerUnit()
           
 
Method Summary
protected  void checkType(java.lang.Object val)
           
 int fromObject(java.lang.Object val)
          converts from an Object representing an actual value in the real units to an int.
 int fromString(java.lang.String val)
          converts from a String representing an actual value in the real units to an int.
 UnitInterval getUnitInterval()
           
 java.lang.String toString(int val)
          converts from int to a String representation of this unit
 java.lang.String toString(java.lang.Object val)
          converts from some Object type to a String representation of this unit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

type

protected java.lang.Object type
Constructor Detail

IntegerUnit

public IntegerUnit()
Method Detail

toString

public java.lang.String toString(int val)
converts from int to a String representation of this unit

Specified by:
toString in interface Unit

toString

public java.lang.String toString(java.lang.Object val)
converts from some Object type to a String representation of this unit

Specified by:
toString in interface Unit
Parameters:
val - an object containing the value, usually a number wrapper

fromString

public int fromString(java.lang.String val)
converts from a String representing an actual value in the real units to an int.

Specified by:
fromString in interface Unit
Parameters:
val - a String representing an actual value in the real units
Returns:
an int in the abstract scale

fromObject

public int fromObject(java.lang.Object val)
converts from an Object representing an actual value in the real units to an int.

Specified by:
fromObject in interface Unit
Parameters:
val - a String representing an actual value in the real units
Returns:
an int in the abstract scale

getUnitInterval

public UnitInterval getUnitInterval()
Specified by:
getUnitInterval in interface Unit

checkType

protected void checkType(java.lang.Object val)

Documentation generated March 5 2003