org.apache.commons.lang.math
クラス Range

java.lang.Object
  拡張org.apache.commons.lang.math.Range
直系の既知のサブクラス:
DoubleRange, FloatRange, IntRange, LongRange, NumberRange

public abstract class Range
extends Object

Range represents a range of numbers of the same type.

Specific subclasses hold the range values as different types. Each subclass should be immutable and Serializable if possible.

導入されたバージョン:
2.0
バージョン:
$Id: Range.java,v 1.1.1.1 2004/02/13 10:02:05 hioki Exp $
作成者:
Stephen Colebourne

コンストラクタの概要
Range()
          Constructs a new range.
 
メソッドの概要
 boolean containsDouble(double value)
          Tests whether the specified double occurs within this range using double comparison.
 boolean containsDouble(Number value)
          Tests whether the specified Number occurs within this range using double comparison..
 boolean containsFloat(float value)
          Tests whether the specified float occurs within this range using float comparison.
 boolean containsFloat(Number value)
          Tests whether the specified Number occurs within this range using float comparison.
 boolean containsInteger(int value)
          Tests whether the specified int occurs within this range using int comparison.
 boolean containsInteger(Number value)
          Tests whether the specified Number occurs within this range using int comparison..
 boolean containsLong(long value)
          Tests whether the specified long occurs within this range using long comparison.
 boolean containsLong(Number value)
          Tests whether the specified Number occurs within this range using long comparison..
abstract  boolean containsNumber(Number number)
          Tests whether the specified Number occurs within this range.
 boolean containsRange(Range range)
          Tests whether the specified range occurs entirely within this range.
 boolean equals(Object obj)
          Compares this range to another object to test if they are equal.
 double getMaximumDouble()
          Gets the maximum number in this range as a double.
 float getMaximumFloat()
          Gets the maximum number in this range as a float.
 int getMaximumInteger()
          Gets the maximum number in this range as a int.
 long getMaximumLong()
          Gets the maximum number in this range as a long.
abstract  Number getMaximumNumber()
          Gets the maximum number in this range.
 double getMinimumDouble()
          Gets the minimum number in this range as a double.
 float getMinimumFloat()
          Gets the minimum number in this range as a float.
 int getMinimumInteger()
          Gets the minimum number in this range as a int.
 long getMinimumLong()
          Gets the minimum number in this range as a long.
abstract  Number getMinimumNumber()
          Gets the minimum number in this range.
 int hashCode()
          Gets a hashCode for the range.
 boolean overlapsRange(Range range)
          Tests whether the specified range overlaps with this range.
 String toString()
          Gets the range as a String.
 
クラス java.lang.Object から継承したメソッド
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

コンストラクタの詳細

Range

public Range()

Constructs a new range.

メソッドの詳細

getMinimumNumber

public abstract Number getMinimumNumber()

Gets the minimum number in this range.

戻り値:
the minimum number in this range

getMinimumLong

public long getMinimumLong()

Gets the minimum number in this range as a long.

This implementation uses the getMinimumNumber() method. Subclasses may be able to optimise this.

戻り値:
the minimum number in this range

getMinimumInteger

public int getMinimumInteger()

Gets the minimum number in this range as a int.

This implementation uses the getMinimumNumber() method. Subclasses may be able to optimise this.

戻り値:
the minimum number in this range

getMinimumDouble

public double getMinimumDouble()

Gets the minimum number in this range as a double.

This implementation uses the getMinimumNumber() method. Subclasses may be able to optimise this.

戻り値:
the minimum number in this range

getMinimumFloat

public float getMinimumFloat()

Gets the minimum number in this range as a float.

This implementation uses the getMinimumNumber() method. Subclasses may be able to optimise this.

戻り値:
the minimum number in this range

getMaximumNumber

public abstract Number getMaximumNumber()

Gets the maximum number in this range.

戻り値:
the maximum number in this range

getMaximumLong

public long getMaximumLong()

Gets the maximum number in this range as a long.

This implementation uses the getMaximumNumber() method. Subclasses may be able to optimise this.

戻り値:
the maximum number in this range

getMaximumInteger

public int getMaximumInteger()

Gets the maximum number in this range as a int.

This implementation uses the getMaximumNumber() method. Subclasses may be able to optimise this.

戻り値:
the maximum number in this range

getMaximumDouble

public double getMaximumDouble()

Gets the maximum number in this range as a double.

This implementation uses the getMaximumNumber() method. Subclasses may be able to optimise this.

戻り値:
the maximum number in this range

getMaximumFloat

public float getMaximumFloat()

Gets the maximum number in this range as a float.

This implementation uses the getMaximumNumber() method. Subclasses may be able to optimise this.

戻り値:
the maximum number in this range

containsNumber

public abstract boolean containsNumber(Number number)

Tests whether the specified Number occurs within this range.

The exact comparison implementation varies by subclass. It is intended that an int specific subclass will compare using int comparison.

null is handled and returns false.

パラメータ:
number - the number to test, may be null
戻り値:
true if the specified number occurs within this range
例外:
IllegalArgumentException - if the Number cannot be compared

containsLong

public boolean containsLong(Number value)

Tests whether the specified Number occurs within this range using long comparison..

null is handled and returns false.

This implementation forwards to the containsLong(long) method.

パラメータ:
value - the long to test, may be null
戻り値:
true if the specified number occurs within this range by long comparison

containsLong

public boolean containsLong(long value)

Tests whether the specified long occurs within this range using long comparison.

This implementation uses the getMinimumLong() and getMaximumLong() methods and should be good for most uses.

パラメータ:
value - the long to test
戻り値:
true if the specified number occurs within this range by long comparison

containsInteger

public boolean containsInteger(Number value)

Tests whether the specified Number occurs within this range using int comparison..

null is handled and returns false.

This implementation forwards to the containsInteger(int) method.

パラメータ:
value - the integer to test, may be null
戻り値:
true if the specified number occurs within this range by int comparison

containsInteger

public boolean containsInteger(int value)

Tests whether the specified int occurs within this range using int comparison.

This implementation uses the getMinimumInteger() and getMaximumInteger() methods and should be good for most uses.

パラメータ:
value - the int to test
戻り値:
true if the specified number occurs within this range by int comparison

containsDouble

public boolean containsDouble(Number value)

Tests whether the specified Number occurs within this range using double comparison..

null is handled and returns false.

This implementation forwards to the containsDouble(double) method.

パラメータ:
value - the double to test, may be null
戻り値:
true if the specified number occurs within this range by double comparison

containsDouble

public boolean containsDouble(double value)

Tests whether the specified double occurs within this range using double comparison.

This implementation uses the getMinimumDouble() and getMaximumDouble() methods and should be good for most uses.

パラメータ:
value - the double to test
戻り値:
true if the specified number occurs within this range by double comparison

containsFloat

public boolean containsFloat(Number value)

Tests whether the specified Number occurs within this range using float comparison.

null is handled and returns false.

This implementation forwards to the containsFloat(float) method.

パラメータ:
value - the float to test, may be null
戻り値:
true if the specified number occurs within this range by float comparison

containsFloat

public boolean containsFloat(float value)

Tests whether the specified float occurs within this range using float comparison.

This implementation uses the getMinimumFloat() and getMaximumFloat() methods and should be good for most uses.

パラメータ:
value - the float to test
戻り値:
true if the specified number occurs within this range by float comparison

containsRange

public boolean containsRange(Range range)

Tests whether the specified range occurs entirely within this range.

The exact comparison implementation varies by subclass. It is intended that an int specific subclass will compare using int comparison.

null is handled and returns false.

This implementation uses the containsNumber(Number) method. Subclasses may be able to optimise this.

パラメータ:
range - the range to test, may be null
戻り値:
true if the specified range occurs entirely within this range; otherwise, false
例外:
IllegalArgumentException - if the Range cannot be compared

overlapsRange

public boolean overlapsRange(Range range)

Tests whether the specified range overlaps with this range.

The exact comparison implementation varies by subclass. It is intended that an int specific subclass will compare using int comparison.

null is handled and returns false.

This implementation uses the containsNumber(Number) and containsRange(Range) methods. Subclasses may be able to optimise this.

パラメータ:
range - the range to test, may be null
戻り値:
true if the specified range overlaps with this range; otherwise, false
例外:
IllegalArgumentException - if the Range cannot be compared

equals

public boolean equals(Object obj)

Compares this range to another object to test if they are equal.

.

To be equal, the class, minimum and maximum must be equal.

This implementation uses the getMinimumNumber() and getMaximumNumber() methods. Subclasses may be able to optimise this.

パラメータ:
obj - the reference object with which to compare
戻り値:
true if this object is equal

hashCode

public int hashCode()

Gets a hashCode for the range.

This implementation uses the getMinimumNumber() and getMaximumNumber() methods. Subclasses may be able to optimise this.

戻り値:
a hash code value for this object

toString

public String toString()

Gets the range as a String.

The format of the String is 'Range[min,max]'.

This implementation uses the getMinimumNumber() and getMaximumNumber() methods. Subclasses may be able to optimise this.

戻り値:
the String representation of this range


このドキュメントは、Ja-Jakartaにより訳されました。 コメントがある場合は report@jajakarta.orgまでお願いします。
Translated into Japanese by jajakarta.org. The original page is here.
Copyright (c) 2002-2003 - Apache Software Foundation