Platypus

platypus
Class UnitValue

java.lang.Object
  extended by platypus.UnitValue

public class UnitValue
extends java.lang.Object

Parses part of a command to determine the number of units and the type of units specified.


Field Summary
(package private)  int length
           
(package private)  int type
           
(package private)  float value
           
 
Constructor Summary
UnitValue(java.lang.String inputStr)
          Parses a string for the number of units and their type (e.g.
 
Method Summary
 void convertUnitsToPoints()
          converts type and value to points
 int FTO_getUnitType(java.lang.String text, int location)
          FTO prefix = for testing only.
 int getLength()
           
 int getType()
           
private  int getUnitType(java.lang.String s, int i)
          Figures out whether s[i..i+1] is a unit of measure
 float getValue()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

float value

type

int type

length

int length
Constructor Detail

UnitValue

public UnitValue(java.lang.String inputStr)
Parses a string for the number of units and their type (e.g. 2in, 36pt, 0li, etc. If there is an error, the type is set to PlatyConst.ERROR.

Parameters:
inputStr - the string to parse, consiting of the value digits and optionally the type, optionally followed by a closing ]
Method Detail

getUnitType

private int getUnitType(java.lang.String s,
                        int i)
Figures out whether s[i..i+1] is a unit of measure

Parameters:
s - string containing the possible unit of measure
i - where the unit of measure is expected in s.
Returns:
the type of unit of measure or PlatyConst.ERROR if unit of measure is invalid.

convertUnitsToPoints

public void convertUnitsToPoints()
converts type and value to points


getType

public int getType()

getValue

public float getValue()

getLength

public int getLength()

FTO_getUnitType

public int FTO_getUnitType(java.lang.String text,
                           int location)
FTO prefix = for testing only. Wrapper to getUnitType

Parameters:
text - see getUnitType()
location - see getUnitType()
Returns:
see getUnitType()

Platypus

Copyright © 2006-7 Pacific Data Works LLC. (http://platypus.pz.org)