org.jclarion.clarion
Class ClarionNumber

java.lang.Object
  extended by org.jclarion.clarion.ClarionMemoryModel
      extended by org.jclarion.clarion.ClarionObject
          extended by org.jclarion.clarion.ClarionNumber
All Implemented Interfaces:
Threaded

public class ClarionNumber
extends ClarionObject

Model number. Internally stored as java primitive 'int'

Author:
barney

Nested Class Summary
static class ClarionNumber.State
           
 
Field Summary
static int BYTE
           
static int DATE
           
static int LONG
           
static int SHORT
           
static int SIGNED
           
static int TIME
           
static int ULONG
           
static int UNSIGNED
           
static int USHORT
           
 
Constructor Summary
ClarionNumber()
          Create 0 number
ClarionNumber(ClarionNumber base, java.lang.Thread lock)
           
ClarionNumber(int number)
          Create number of specified value
ClarionNumber(java.lang.String value)
          Create number of specified value
 
Method Summary
 ClarionNumber abs()
          Return absolute value for this object
 ClarionObject add(ClarionObject object)
          Do a numeric add.
 boolean boolValue()
          Return boolen representation of the object
 void clear(int method)
          Clear object value.
 int compareTo(ClarionObject object)
          Do a Comparison.
 void concatSegment(java.lang.StringBuilder target)
           
 void deserialize(java.io.InputStream is)
          Read object from memory as clarion would represent object in memory
 ClarionNumber[] dim(int size)
          return 1d array clone of the object based on size.
 ClarionNumber[][] dim(int s1, int s2)
          return 2d array clone of the object based on size.
 ClarionNumber[][][] dim(int s1, int s2, int s3)
          return 3d array clone of the object based on size.
 ClarionObject divide(ClarionObject object)
          Do a numeric divide.
 ClarionObject genericLike()
           
 ClarionBool getBool()
          Convert to bool object
 ClarionDecimal getDecimal()
          Convert to decimal object
 int getEncoding()
           
 java.lang.Object getLockedObject(java.lang.Thread t)
           
 ClarionNumber getNumber()
          Convert to number object
 ClarionReal getReal()
          Convert to real object
 int getSize()
          Return max size of the object when represented as a string Used mainly by ASCII file driver
 ClarionString getString()
          Convert to string object
 void initThread()
           
 int intValue()
          Return integer representation of the object
 boolean isConstrained()
           
 ClarionNumber like()
          Clone number
 ClarionObject modulus(ClarionObject object)
          Do a numeric modulus.
 ClarionObject multiply(ClarionObject object)
          Do a numeric multiply.
 ClarionObject negate()
          Do a numeric negation.
 ClarionObject power(ClarionObject object)
          Do a numeric power.
 void serialize(java.io.OutputStream os)
          Write java object to memory as clarion would represent object in memory
 ClarionNumber setEncoding(int encoding)
          Set memory encoding.
 ClarionNumber setName(java.lang.String name)
          Set external name for object - used by SQL drivers etc
 ClarionNumber setOver(ClarionMemoryModel o)
          Overlay this object on another objects memory model
 ClarionNumber[] setOverAndDim(ClarionObject over, int size)
           
 ClarionNumber setThread()
           
 void setValue(ClarionObject object)
          Set object to given value
static int shift(int value, int shiftval)
          Bit shift a number.
 ClarionObject subtract(ClarionObject object)
          Do a numeric subtract.
 java.lang.String toString()
           
 
Methods inherited from class org.jclarion.clarion.ClarionObject
add, clear, clearNull, compareTo, concat, decrement, decrement, divide, doSetName, doSetOver, doSetOver, equals, gcd, getName, getOwner, getValue, increment, increment, isDecimal, modulus, multiply, power, setNull, setOver, setOwner, setValue, stringAt, stringAt, stringAt, stringAt, subtract
 
Methods inherited from class org.jclarion.clarion.ClarionMemoryModel
addChangeListener, addChangeListener, castTo, getListenerCount, isAnyoneInterestedInChange, isThreaded, lock, notifyChange, removeChangeListener
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SIGNED

public static final int SIGNED
See Also:
Constant Field Values

BYTE

public static final int BYTE
See Also:
Constant Field Values

LONG

public static final int LONG
See Also:
Constant Field Values

ULONG

public static final int ULONG
See Also:
Constant Field Values

USHORT

public static final int USHORT
See Also:
Constant Field Values

SHORT

public static final int SHORT
See Also:
Constant Field Values

UNSIGNED

public static final int UNSIGNED
See Also:
Constant Field Values

DATE

public static final int DATE
See Also:
Constant Field Values

TIME

public static final int TIME
See Also:
Constant Field Values
Constructor Detail

ClarionNumber

public ClarionNumber(ClarionNumber base,
                     java.lang.Thread lock)

ClarionNumber

public ClarionNumber()
Create 0 number


ClarionNumber

public ClarionNumber(int number)
Create number of specified value

Parameters:
number -

ClarionNumber

public ClarionNumber(java.lang.String value)
Create number of specified value

Parameters:
value -
Method Detail

initThread

public void initThread()
Specified by:
initThread in interface Threaded
Overrides:
initThread in class ClarionMemoryModel

setThread

public ClarionNumber setThread()

getLockedObject

public java.lang.Object getLockedObject(java.lang.Thread t)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

concatSegment

public void concatSegment(java.lang.StringBuilder target)
Overrides:
concatSegment in class ClarionObject

like

public ClarionNumber like()
Clone number

Returns:

add

public ClarionObject add(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric add. Result is returned as a new object

Specified by:
add in class ClarionObject
Returns:

setValue

public void setValue(ClarionObject object)
Description copied from class: ClarionObject
Set object to given value

Specified by:
setValue in class ClarionObject

compareTo

public int compareTo(ClarionObject object)
Description copied from class: ClarionObject
Do a Comparison. Comparison type is preferentially numeric but if either object is a non numeric string then comparsion is a lexical comparison

Specified by:
compareTo in class ClarionObject
Returns:

intValue

public int intValue()
Description copied from class: ClarionObject
Return integer representation of the object

Specified by:
intValue in class ClarionObject
Returns:

multiply

public ClarionObject multiply(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric multiply. Result is returned as a new object

Specified by:
multiply in class ClarionObject
Returns:

dim

public ClarionNumber[] dim(int size)
return 1d array clone of the object based on size. Note java object array returned is one larger than specified as clarion starts arrays at offset '1' whilst java as offset '0'


setOverAndDim

public ClarionNumber[] setOverAndDim(ClarionObject over,
                                     int size)

dim

public ClarionNumber[][] dim(int s1,
                             int s2)
return 2d array clone of the object based on size. Note java object array returned is one larger than specified as clarion starts arrays at offset '1' whilst java as offset '0'


dim

public ClarionNumber[][][] dim(int s1,
                               int s2,
                               int s3)
return 3d array clone of the object based on size. Note java object array returned is one larger than specified as clarion starts arrays at offset '1' whilst java as offset '0'


setName

public ClarionNumber setName(java.lang.String name)
Set external name for object - used by SQL drivers etc

Parameters:
name -
Returns:

setEncoding

public ClarionNumber setEncoding(int encoding)
Set memory encoding. A multiple of options for this object type

Parameters:
encoding -
Returns:

getEncoding

public int getEncoding()

getBool

public ClarionBool getBool()
Description copied from class: ClarionObject
Convert to bool object

Specified by:
getBool in class ClarionObject
Returns:

getNumber

public ClarionNumber getNumber()
Description copied from class: ClarionObject
Convert to number object

Specified by:
getNumber in class ClarionObject
Returns:

getReal

public ClarionReal getReal()
Description copied from class: ClarionObject
Convert to real object

Specified by:
getReal in class ClarionObject
Returns:

getString

public ClarionString getString()
Description copied from class: ClarionObject
Convert to string object

Specified by:
getString in class ClarionObject
Returns:

divide

public ClarionObject divide(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric divide. Result is returned as a new object

Specified by:
divide in class ClarionObject
Returns:

modulus

public ClarionObject modulus(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric modulus. Result is returned as a new object

Specified by:
modulus in class ClarionObject
Returns:

power

public ClarionObject power(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric power. Result is returned as a new object

Specified by:
power in class ClarionObject
Returns:

subtract

public ClarionObject subtract(ClarionObject object)
Description copied from class: ClarionObject
Do a numeric subtract. Result is returned as a new object

Specified by:
subtract in class ClarionObject
Returns:

boolValue

public boolean boolValue()
Description copied from class: ClarionObject
Return boolen representation of the object

Specified by:
boolValue in class ClarionObject
Returns:

clear

public void clear(int method)
Description copied from class: ClarionObject
Clear object value.

Specified by:
clear in class ClarionObject

negate

public ClarionObject negate()
Description copied from class: ClarionObject
Do a numeric negation. Result is returned as a new object

Specified by:
negate in class ClarionObject
Returns:

getDecimal

public ClarionDecimal getDecimal()
Description copied from class: ClarionObject
Convert to decimal object

Specified by:
getDecimal in class ClarionObject
Returns:

abs

public ClarionNumber abs()
Return absolute value for this object

Returns:

setOver

public ClarionNumber setOver(ClarionMemoryModel o)
Overlay this object on another objects memory model


shift

public static int shift(int value,
                        int shiftval)
Bit shift a number.

Parameters:
value - number to shift
shiftval - +ve shift left. -ve = shift right.
Returns:
resultant value

deserialize

public void deserialize(java.io.InputStream is)
                 throws java.io.IOException
Description copied from class: ClarionMemoryModel
Read object from memory as clarion would represent object in memory

Specified by:
deserialize in class ClarionMemoryModel
Throws:
java.io.IOException

serialize

public void serialize(java.io.OutputStream os)
               throws java.io.IOException
Description copied from class: ClarionMemoryModel
Write java object to memory as clarion would represent object in memory

Specified by:
serialize in class ClarionMemoryModel
Throws:
java.io.IOException

genericLike

public ClarionObject genericLike()
Specified by:
genericLike in class ClarionObject

isConstrained

public boolean isConstrained()
Specified by:
isConstrained in class ClarionObject

getSize

public int getSize()
Description copied from class: ClarionObject
Return max size of the object when represented as a string Used mainly by ASCII file driver

Specified by:
getSize in class ClarionObject
Returns:


Copyright © 2010. All Rights Reserved.