JanosVM v1.0 API

edu.utah.janosvm.kit.comm.jsi
Class JSIPair

java.lang.Object
  |
  +--edu.utah.janosvm.kit.comm.jsi.JSIPair

public class JSIPair
extends java.lang.Object

A simple class used to couple an identifier string and a byte array value (Usually a string).


Field Summary
private static byte[] emptyArray
           
private  java.lang.String tag
          The identifier.
private  byte[] value
          The value.
 
Constructor Summary
JSIPair(java.lang.String tag, byte[] value)
          Construct an identifier/value pair with the given values.
JSIPair(java.lang.String tag, char value)
          Construct an identifier/value pair with the given values.
JSIPair(java.lang.String tag, double value)
          Construct an identifier/value pair with the given values.
JSIPair(java.lang.String tag, JSIPropertyInfo pi)
          Construct an identifier/value pair with the given values.
JSIPair(java.lang.String tag, long value)
          Construct an identifier/value pair with the given values.
JSIPair(java.lang.String tag, java.lang.String value)
          Construct an identifier/value pair with the given values.
 
Method Summary
 boolean equals(java.lang.Object obj)
           
 byte[] getByteArrayFromHexValue()
           
 char getCharValue()
           
 double getFloatValue()
           
 long getIntValue()
           
 JSIPropertyInfo getPropertyInfoValue()
           
 java.lang.String getStringValue()
           
 java.lang.String getTag()
           
 byte[] getValue()
           
 int hashCode()
           
(package private)  int length()
           
(package private)  void marshal(JSIMessage dst)
          Marshal this pair into the given message.
 void setTag(java.lang.String tag)
           
 void setValue(byte[] value)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait, wait0
 

Field Detail

emptyArray

private static final byte[] emptyArray

tag

private java.lang.String tag
The identifier.

value

private byte[] value
The value.
Constructor Detail

JSIPair

public JSIPair(java.lang.String tag,
               byte[] value)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The byte array value.

JSIPair

public JSIPair(java.lang.String tag,
               java.lang.String value)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The string value.

JSIPair

public JSIPair(java.lang.String tag,
               char value)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The character value that is downcasted to a single byte.

JSIPair

public JSIPair(java.lang.String tag,
               long value)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The long value that is stored as a decimal string.

JSIPair

public JSIPair(java.lang.String tag,
               double value)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The double value that is stored as a decimal string.

JSIPair

public JSIPair(java.lang.String tag,
               JSIPropertyInfo pi)
Construct an identifier/value pair with the given values.
Parameters:
tag - The identifer
value - The property info value to be stored in its own custom
value - format.
Method Detail

setTag

public void setTag(java.lang.String tag)
Parameters:
tag - The identifier

getTag

public java.lang.String getTag()
Returns:
The identifier

setValue

public void setValue(byte[] value)
Parameters:
value - The value

getValue

public byte[] getValue()
Parameters:
value - The value

getCharValue

public char getCharValue()
Returns:
The first byte in the value.

getIntValue

public long getIntValue()
                 throws java.lang.NumberFormatException
Returns:
The long as parsed from the string value.
Throws:
Throws - NumberFormatException if the string in the value
isn't - a valid integer.

getFloatValue

public double getFloatValue()
                     throws java.lang.NumberFormatException
Returns:
The double as parsed from the string value.
Throws:
Throws - NumberFormatException if the string in the value
isn't - a valid flaot.

getStringValue

public java.lang.String getStringValue()
Returns:
The value as a string.

getByteArrayFromHexValue

public byte[] getByteArrayFromHexValue()
                                throws java.lang.NumberFormatException
Returns:
The value as a byte array decoded from a hex string.

getPropertyInfoValue

public JSIPropertyInfo getPropertyInfoValue()
Returns:
The value as a property info.

length

int length()
Returns:
The aligned length of the marshalled pair.

marshal

void marshal(JSIMessage dst)
Marshal this pair into the given message.
Parameters:
dst - The message this pair should be added to.

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

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

JanosVM v1.0 API

This documentation is Copyright (C) 2000-2003 The University of Utah. All Rights Reserved. See the documentation license for distribution terms and restrictions.
Documentation, software, and mailing lists for the JanosVM can be found at the Janos Project web page: http://www.cs.utah.edu/flux/janos/
Generated on Feb 13, 2003