Package skyview.test
Class HCounter
- java.lang.Object
-
- skyview.test.HCounter
-
public class HCounter extends java.lang.ObjectThis 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 booleanafter(java.lang.String input)IS the current value after (or equal to) this input?booleanbefore(java.lang.String input)Is the current value before (or equal to) this input?intcompare(java.lang.String input)Does the given string come before or after the current value.voiddown()Add a new level to the counter hierarchy starting at 1.voiddown(int i)Add a new level to the counter hierarcy starting at a specified value.voidincrement()Increment the deepest level of the countervoidincrement(int level)Increment a specific level of the counter.intlevels()How many levels in the hierarchy currently in the counter?static voidmain(java.lang.String[] args)Run some simple tests.java.lang.StringtoString()What is the current value of the counter expressed as a string?voidup()Discard a level in the hierarchy.
-
-
-
Method Detail
-
levels
public int levels()
How many levels in the hierarchy currently in the counter?
-
toString
public java.lang.String toString()
What is the current value of the counter expressed as a string?- Overrides:
toStringin classjava.lang.Object
-
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(java.lang.String input)
Is the current value before (or equal to) this input?
-
after
public boolean after(java.lang.String input)
IS the current value after (or equal to) this input?
-
compare
public int compare(java.lang.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(java.lang.String[] args)
Run some simple tests.
-
-