public class DeweyNumber extends Object implements Serializable
A dewey number consists of a sequence of digits d1.d2.d3. ... .dn. A dewey number v is compatible to v' iff v contains v' as a prefix or if both dewey number differ only in the last digit and the last digit of v is greater than v'.
Modifier and Type | Class and Description |
---|---|
static class |
DeweyNumber.DeweyNumberSerializer
A
TypeSerializer for the DeweyNumber which serves as a version number. |
Constructor and Description |
---|
DeweyNumber(DeweyNumber number) |
DeweyNumber(int start) |
Modifier and Type | Method and Description |
---|---|
DeweyNumber |
addStage()
Creates a new dewey number from this such that a 0 is appended as new last digit.
|
boolean |
equals(Object obj) |
static DeweyNumber |
fromString(String deweyNumberString)
Creates a dewey number from a string representation.
|
int |
getRun() |
int |
hashCode() |
DeweyNumber |
increase()
Creates a new dewey number from this such that its last digit is increased by one.
|
DeweyNumber |
increase(int times)
Creates a new dewey number from this such that its last digit is increased by the supplied
number.
|
boolean |
isCompatibleWith(DeweyNumber other)
Checks whether this dewey number is compatible to the other dewey number.
|
int |
length() |
String |
toString() |
public DeweyNumber(int start)
public DeweyNumber(DeweyNumber number)
public boolean isCompatibleWith(DeweyNumber other)
True iff this contains other as a prefix or iff they differ only in the last digit whereas the last digit of this is greater than the last digit of other.
other
- The other dewey number to check compatibility againstpublic int getRun()
public int length()
public DeweyNumber increase()
public DeweyNumber increase(int times)
times
- how many times to increase the Dewey numberpublic DeweyNumber addStage()
public static DeweyNumber fromString(String deweyNumberString)
deweyNumberString
- Dot separated string of integersCopyright © 2014–2021 The Apache Software Foundation. All rights reserved.