Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats.element
Class LongElement

java.lang.Object
  extended by com.jivesoftware.base.stats.Element
      extended by com.jivesoftware.base.stats.element.LongElement
All Implemented Interfaces:
java.lang.Comparable
Direct Known Subclasses:
CyclicElement

public class LongElement
extends Element

An implementation of Element that wraps a Long.


Constructor Summary
LongElement(long n)
          Generates a new LongElement given an initial long value
LongElement(java.lang.Long n)
          Generates a new LongElement given an initial Long value.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares the value of the given object to the value stored in this object.
 boolean equals(java.lang.Object o)
          Returns true if the given object is also a LongElement object and their values are equal, false otherwise.
 Element getInstance(long n)
          Retuns an instance of this class with the given long as its value.
 java.lang.Object getValue()
          Get the embedded Long
 int hashCode()
          Generates a hashCode using the Long's hashcode so we can use LongElements with hash tables.
protected  void setLongElement(java.lang.Long longElement)
          Sets the long element value.
 java.lang.Long toLong()
          Returns this element's value as a long primitive.
 java.lang.String toString()
          Returns a String representation of this Element.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LongElement

public LongElement(long n)
Generates a new LongElement given an initial long value

Parameters:
n - the long value we're wrapping

LongElement

public LongElement(java.lang.Long n)
Generates a new LongElement given an initial Long value.

Method Detail

getValue

public java.lang.Object getValue()
Get the embedded Long

Specified by:
getValue in class Element
Returns:
the internal object we're wrapping.

setLongElement

protected void setLongElement(java.lang.Long longElement)
Sets the long element value.

Parameters:
longElement - the new value for this element.

toLong

public java.lang.Long toLong()
Returns this element's value as a long primitive.

Overrides:
toLong in class Element
Returns:
the value of this element as a Long or null if the element can not be converted to a Long.

getInstance

public Element getInstance(long n)
Retuns an instance of this class with the given long as its value.

Specified by:
getInstance in class Element
Parameters:
n - a long this element should wrap.
Returns:
an instance of this class with the given long as its value.

toString

public java.lang.String toString()
Returns a String representation of this Element.

Overrides:
toString in class Element
Returns:
the value of this element as a String.

compareTo

public int compareTo(java.lang.Object o)
Compares the value of the given object to the value stored in this object. This method calls the compareTo() method of Long if both objects are Longs.


equals

public boolean equals(java.lang.Object o)
Returns true if the given object is also a LongElement object and their values are equal, false otherwise.

Overrides:
equals in class java.lang.Object
Returns:
true if the given object is also a LongElement object and their values are equal, false otherwise.

hashCode

public int hashCode()
Generates a hashCode using the Long's hashcode so we can use LongElements with hash tables.

Overrides:
hashCode in class java.lang.Object

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.