Jive Forums API (5.5.20.2-oracle) Developer Javadocs

com.jivesoftware.base.stats.element
Class InfiniteElement

java.lang.Object
  extended by com.jivesoftware.base.stats.Element
      extended by com.jivesoftware.base.stats.element.InfiniteElement
All Implemented Interfaces:
java.lang.Comparable

public class InfiniteElement
extends Element

InfiniteElement is a special Element used to represent the largest and smallest possible elements. The only two instances of InfiniteElement are two static objects, INFINITY and MINUS_INFINITY. Each of these objects are exposed as InfiniteElement.INFINITY and InfiniteElement.MINUS_INFINITY. The compareTo function handles comparisons between the InfiniteElements and other Elements. Other elements should defer to the InfiniteElement compareTo when comparing to an InfiniteElement.


Field Summary
static Element INFINITY
           
static Element MINUS_INFINITY
           
 
Method Summary
 int compareTo(java.lang.Object obj)
          Compare an InifiniteElement to another Element.
 boolean equals(java.lang.Object o)
          Returns true if the given object equals this object, false otherwise.
 Element getInstance(long n)
          Generates a new instance of InfiniteElement.
 java.lang.Object getValue()
          Returns the internal object we're wrapping.
 int hashCode()
          Generates a hashCode so we can use InfiniteElements in hash tables
 java.lang.Long toLong()
          Alwyas returns null for an InfiniteElement.
 java.lang.String toString()
          Converts an InfiniteElement to a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

INFINITY

public static final Element INFINITY

MINUS_INFINITY

public static final Element MINUS_INFINITY
Method Detail

toLong

public java.lang.Long toLong()
Alwyas returns null for an InfiniteElement.

Overrides:
toLong in class Element
Returns:
null for this Element.

getValue

public java.lang.Object getValue()
Description copied from class: Element
Returns the internal object we're wrapping.

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

getInstance

public Element getInstance(long n)
Generates a new instance of InfiniteElement. This is disallowed, so return null.

Specified by:
getInstance in class Element
Parameters:
n - a long this element should wrap.
Returns:
null since creating a new instance for this element is disallowed.

toString

public java.lang.String toString()
Converts an InfiniteElement to a string.

Overrides:
toString in class Element
Returns:
a String representation of this element.

compareTo

public int compareTo(java.lang.Object obj)
Compare an InifiniteElement to another Element. Other Elements should include the following in their compareTo functions: if (o instanceof InfiniteElement) { return -((InfiniteElement)o).compareTo(this); }

Returns:
0 if this object and the given object are both MINUS_INFINITY or INFINITY, or -1 if this object is MINUS_INFINITY or 1 is this object is INFINITY.

hashCode

public int hashCode()
Generates a hashCode so we can use InfiniteElements in hash tables

Overrides:
hashCode in class java.lang.Object
Returns:
an int representing the hash code for this object.

equals

public boolean equals(java.lang.Object o)
Returns true if the given object equals this object, false otherwise.

Overrides:
equals in class java.lang.Object
Returns:
true if this object equals the given object, false otherwise.

Jive Forums Project Page

Copyright © 1999-2006 Jive Software.