mx.udlap.kjProtocol.packets
Class KInteger

java.lang.Object
  extended bymx.udlap.kjProtocol.packets.KInteger
Direct Known Subclasses:
KTime

public class KInteger
extends java.lang.Object

4 bytes Integer container

Author:
Oscar Medina Duarte

Field Summary
static int MAXVALUE
           
 byte[] value
          Value for this object
 
Constructor Summary
KInteger(byte[] value)
          Constructor for the KInteger object that takes a byte array as initial value
KInteger(byte msb, byte third, byte second, byte lsb)
          Constructor for the KInteger object that takes 4 bytes to form the initial value.
KInteger(int value)
          Constructor for the KInteger object that takes a int as initial value
 
Method Summary
 byte[] getBytes()
          Gets the bytes from the value.
 int getIntValue()
          Gets the integer value of the KInteger object
 byte[] getValue()
          Gets the value attribute of the KInteger object
static void main(java.lang.String[] args)
          Class testing
 void setValue(byte[] value)
          Sets the value attribute of the KInteger object
 void setValue(byte msb, byte third, byte second, byte lsb)
          Sets the value attribute of the KInteger object
 void setValue(int value)
          Sets the value attribute of the KInteger object it truncates the extra bytes
 java.lang.String toString()
          Description of the Method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAXVALUE

public static final int MAXVALUE
See Also:
Constant Field Values

value

public byte[] value
Value for this object

Constructor Detail

KInteger

public KInteger(int value)
Constructor for the KInteger object that takes a int as initial value

Parameters:
value - Value of this Object

KInteger

public KInteger(byte[] value)
Constructor for the KInteger object that takes a byte array as initial value

Parameters:
value - Byte array to taken as Integer in this Object, MSB is index 3, LSB is index 0.

KInteger

public KInteger(byte msb,
                byte third,
                byte second,
                byte lsb)
Constructor for the KInteger object that takes 4 bytes to form the initial value.

Parameters:
msb - Most significant byte
third - Third least significant byte
second - Second least significant byte
lsb - Least significant byte
Method Detail

setValue

public void setValue(byte[] value)
Sets the value attribute of the KInteger object

Parameters:
value - The new value value

setValue

public void setValue(byte msb,
                     byte third,
                     byte second,
                     byte lsb)
Sets the value attribute of the KInteger object

Parameters:
msb - Most significant byte
third - Third least significant byte
second - Second least significant byte
lsb - Least significant byte

setValue

public void setValue(int value)
Sets the value attribute of the KInteger object it truncates the extra bytes

Parameters:
value - The new value value

getValue

public byte[] getValue()
Gets the value attribute of the KInteger object

Returns:
The value value

getIntValue

public int getIntValue()
Gets the integer value of the KInteger object

Returns:
The intValue value

getBytes

public byte[] getBytes()
Gets the bytes from the value.

Returns:
The bytes value

toString

public java.lang.String toString()
Description of the Method

Returns:
Description of the Return Value

main

public static void main(java.lang.String[] args)
Class testing

Parameters:
args - Description of the Parameter