public class DeweyDecimal
extends java.lang.Object
| Constructor and Description |
|---|
DeweyDecimal(int[] components)
Construct a DeweyDecimal from an array of integer components.
|
DeweyDecimal(java.lang.String string)
Construct a DeweyDecimal from string in DeweyDecimal format.
|
| Modifier and Type | Method and Description |
|---|---|
int |
get(int index)
Return the component at specified index.
|
int |
getSize()
Return number of components in
DeweyDecimal. |
boolean |
isEqual(DeweyDecimal other)
Return
true if this DeweyDecimal is
equal to the other DeweyDecimal. |
boolean |
isGreaterThan(DeweyDecimal other)
Return
true if this DeweyDecimal is
greater than the other DeweyDecimal. |
boolean |
isGreaterThanOrEqual(DeweyDecimal other)
Return
true if this DeweyDecimal is
greater than or equal to the other DeweyDecimal. |
boolean |
isLessThan(DeweyDecimal other)
Return
true if this DeweyDecimal is
less than the other DeweyDecimal. |
boolean |
isLessThanOrEqual(DeweyDecimal other)
Return
true if this DeweyDecimal is
less than or equal to the other DeweyDecimal. |
java.lang.String |
toString()
Return string representation of
DeweyDecimal. |
public DeweyDecimal(int[] components)
components - an array of integer components.public DeweyDecimal(java.lang.String string)
throws java.lang.NumberFormatException
string - the string in dewey decimal formatjava.lang.NumberFormatException - if string is malformedpublic int getSize()
DeweyDecimal.public int get(int index)
index - the index of componentspublic boolean isEqual(DeweyDecimal other)
true if this DeweyDecimal is
equal to the other DeweyDecimal.other - the other DeweyDecimalpublic boolean isLessThan(DeweyDecimal other)
true if this DeweyDecimal is
less than the other DeweyDecimal.other - the other DeweyDecimalpublic boolean isLessThanOrEqual(DeweyDecimal other)
true if this DeweyDecimal is
less than or equal to the other DeweyDecimal.other - the other DeweyDecimalpublic boolean isGreaterThan(DeweyDecimal other)
true if this DeweyDecimal is
greater than the other DeweyDecimal.other - the other DeweyDecimalpublic boolean isGreaterThanOrEqual(DeweyDecimal other)
true if this DeweyDecimal is
greater than or equal to the other DeweyDecimal.other - the other DeweyDecimalpublic java.lang.String toString()
DeweyDecimal.toString in class java.lang.Object