net.sf.jabb.util.col
Class LongArray

java.lang.Object
  extended by net.sf.jabb.util.col.LongArray
All Implemented Interfaces:
Serializable, Comparable<Object>

public class LongArray
extends Object
implements Comparable<Object>, Serializable

Encapsulates multiple int type values into one object, which is suitable to be used as key object of Map.
把多个int类型的值封装在这一个对象里,适合用来作为Map的key。

It supports hashCode(), toString(), equals(), compareTo() methods.

它支持hashCode(), toString(), equals(), compareTo()方法。

Author:
Zhengmao HU (James)
See Also:
Serialized Form

Field Summary
protected  long[] values
           
 
Constructor Summary
LongArray(long... values)
          Constructs an LongArray that encapsulates specified long values.
创建一个包含这些长整型值的实例
 
Method Summary
 int compareTo(Object obj)
          Compare.
比较。
 boolean equals(Object obj)
           
 int getIntValue(int index)
          Gets the value in specified position.
获得指定位置的值。
 long getLongValue(int index)
          Gets the value in specified position.
获得指定位置的值。
 long getValue(int index)
          Gets the value in specified position.
获得指定位置的值。
 long[] getValues()
          Gets all the values encapsulated in this object.
获得所有值。
 int hashCode()
          Gets the calculated hash code.
获得计算得到的hash值。
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

values

protected long[] values
Constructor Detail

LongArray

public LongArray(long... values)
Constructs an LongArray that encapsulates specified long values.
创建一个包含这些长整型值的实例

Parameters:
values - long values that will be encapsulated.
一批将被封装的长整型值
Method Detail

getValues

public long[] getValues()
Gets all the values encapsulated in this object.
获得所有值。

Returns:
array of values encapsulated.

getValue

public long getValue(int index)
Gets the value in specified position.
获得指定位置的值。

Parameters:
index - position (position of the first one is 0)
Returns:
the value

getLongValue

public long getLongValue(int index)
Gets the value in specified position.
获得指定位置的值。

Parameters:
index - position (position of the first one is 0)
Returns:
the value as long

getIntValue

public int getIntValue(int index)
Gets the value in specified position.
获得指定位置的值。

Parameters:
index - position (position of the first one is 0)
Returns:
the value as int

hashCode

public int hashCode()
Gets the calculated hash code.
获得计算得到的hash值。

Overrides:
hashCode in class Object

compareTo

public int compareTo(Object obj)
Compare.
比较。

Specified by:
compareTo in interface Comparable<Object>
Parameters:
obj - The object to be compared with
Returns:
-1 if little than obj, 0 if equals, 1 if greater than.

equals

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012. All Rights Reserved.