org.norther.tammi.acorn.lang
Class Multiword

java.lang.Object
  extended by java.lang.Number
      extended by org.norther.tammi.acorn.lang.Multiword
All Implemented Interfaces:
Serializable, Comparable<Number>
Direct Known Subclasses:
Location

public class Multiword
extends Number
implements Comparable<Number>

A number of multiple words.

Version:
$Id: Multiword.java,v 1.4 2009/09/28 15:08:49 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static int MAX_SIZE
          The max number of bits in one word.
 
Constructor Summary
Multiword(byte... bb)
          Constucts a multi-byte.
Multiword(int... ib)
          Constucts a multi-int.
Multiword(long mw)
          Constructs a long.
Multiword(long mw, int size)
          Constructs a multiword from a long.
Multiword(Number mw, int size)
          Constructs a multiword from a number.
Multiword(short... sb)
          Constucts a multi-short.
 
Method Summary
 byte byteValue(int index)
          Returns the indexed byte value starting from the high order word.
 int compareTo(Number another)
           
 double doubleValue()
           
 double doubleValue(int index)
          Returns the indexed double value starting from the high order word.
 boolean equals(Object obj)
           
 float floatValue()
           
 float floatValue(int index)
          Returns the indexed float value starting from the high order word.
 int hashCode()
           
 int intValue()
           
 int intValue(int index)
          Returns the indexed int value starting from the high order word.
 int length()
          Returns the number of words in this multiword.
 long longValue()
           
 long longValue(int index)
          Returns the indexed long value starting from the high order word.
 short shortValue(int index)
          Returns the indexed short value starting from the high order word.
 int size()
          Returns the number of bits in one word of this multiword.
 String toString()
           
 long wordValue(int index)
          Returns the indexed word value starting from the high order word.
 
Methods inherited from class java.lang.Number
byteValue, shortValue
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_SIZE

public static final int MAX_SIZE
The max number of bits in one word.

See Also:
Constant Field Values
Constructor Detail

Multiword

public Multiword(byte... bb)
Constucts a multi-byte.

Parameters:
bb - the byte buffer.

Multiword

public Multiword(short... sb)
Constucts a multi-short.

Parameters:
sb - the short buffer.

Multiword

public Multiword(int... ib)
Constucts a multi-int.

Parameters:
ib - the int buffer.

Multiword

public Multiword(long mw)
Constructs a long.

Parameters:
mw - the long.

Multiword

public Multiword(long mw,
                 int size)
Constructs a multiword from a long.

Parameters:
mw - the long.
size - the size of one word.

Multiword

public Multiword(Number mw,
                 int size)
Constructs a multiword from a number.

Parameters:
mw - the number.
size - the size of one word.
Method Detail

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

compareTo

public int compareTo(Number another)
Specified by:
compareTo in interface Comparable<Number>

toString

public String toString()
Overrides:
toString in class Object

intValue

public int intValue()
Specified by:
intValue in class Number

longValue

public long longValue()
Specified by:
longValue in class Number

floatValue

public float floatValue()
Specified by:
floatValue in class Number

doubleValue

public double doubleValue()
Specified by:
doubleValue in class Number

byteValue

public byte byteValue(int index)
Returns the indexed byte value starting from the high order word.

Parameters:
index - the index.
Returns:
the value.

shortValue

public short shortValue(int index)
Returns the indexed short value starting from the high order word.

Parameters:
index - the index.
Returns:
the value.

intValue

public int intValue(int index)
Returns the indexed int value starting from the high order word.

Parameters:
index - the index.
Returns:
the value.

longValue

public long longValue(int index)
Returns the indexed long value starting from the high order word.

Parameters:
index - the index.
Returns:
the value.

floatValue

public float floatValue(int index)
Returns the indexed float value starting from the high order word.

The value returned is that of the indexed word of this multiword.

Parameters:
index - the index.
Returns:
the value.

doubleValue

public double doubleValue(int index)
Returns the indexed double value starting from the high order word.

The value returned is that of the indexed word of this multiword.

Parameters:
index - the index.
Returns:
the value.

wordValue

public long wordValue(int index)
Returns the indexed word value starting from the high order word.

Parameters:
index - the index.
Returns:
the value.

length

public int length()
Returns the number of words in this multiword.

Returns:
the length.

size

public int size()
Returns the number of bits in one word of this multiword.

Returns:
the size.


Copyright © 2004 The Norther Organization. All rights reserved.