Package skyview.test
Class HCounter
- java.lang.Object
-
- skyview.test.HCounter
-
public class HCounter extends Object
This class defines a hierarchical counter that is may be used to index a hierarchy of objects (tests, version, ...). The counter is simply a string of integers connected with dots. The user can increment the current level or a higher level in the hierarchy.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
after(String input)
IS the current value after (or equal to) this input?boolean
before(String input)
Is the current value before (or equal to) this input?int
compare(String input)
Does the given string come before or after the current value.void
down()
Add a new level to the counter hierarchy starting at 1.void
down(int i)
Add a new level to the counter hierarcy starting at a specified value.void
increment()
Increment the deepest level of the countervoid
increment(int level)
Increment a specific level of the counter.int
levels()
How many levels in the hierarchy currently in the counter?static void
main(String[] args)
Run some simple tests.String
toString()
What is the current value of the counter expressed as a string?void
up()
Discard a level in the hierarchy.
-
-
-
Method Detail
-
levels
public int levels()
How many levels in the hierarchy currently in the counter?
-
toString
public String toString()
What is the current value of the counter expressed as a string?
-
increment
public void increment()
Increment the deepest level of the counter
-
increment
public void increment(int level)
Increment a specific level of the counter. If this is not the deepest level of the counter the counter will lose the deeper levels.- Parameters:
level
-
-
down
public void down()
Add a new level to the counter hierarchy starting at 1.
-
down
public void down(int i)
Add a new level to the counter hierarcy starting at a specified value.
-
up
public void up()
Discard a level in the hierarchy.
-
before
public boolean before(String input)
Is the current value before (or equal to) this input?
-
after
public boolean after(String input)
IS the current value after (or equal to) this input?
-
compare
public int compare(String input)
Does the given string come before or after the current value. The following sequence is increasing: 1 1.1 1.2 1.2.1 1.2.2 1.3. Returns -1 if the current value comes before the input string, 0 if they are equal or 1 if the current value comes after the input.
-
main
public static void main(String[] args)
Run some simple tests.
-
-