|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcdx.scorebot.util.translator.TypeTranslator<java.lang.Integer,java.lang.String>
cdx.scorebot.util.translator.TranslatorTimeString
public class TranslatorTimeString
Stores a value as a Integer and can translate to and from an String. The String may specify the unit of time using its last character. That String is resulting from the translation from an Integer will be in the base unit. The String may be specified as a Double, though any fraction of a second will be rounded to the nearest integer value.
Constructor Summary | |
---|---|
TranslatorTimeString()
Instantiates a translator with the base unit of one second |
|
TranslatorTimeString(int secondsInBaseUnit)
Instantiates a translator with the base unit of the specified number of seconds |
Method Summary | |
---|---|
java.lang.String |
translate1(java.lang.Integer valueToTranslate)
gets the String representation of the specified Integer |
java.lang.Integer |
translate2(java.lang.String valueToTranslate)
Gets the Integer representation of the specified String in terms of the seconds in the base unit. |
Methods inherited from class cdx.scorebot.util.translator.TypeTranslator |
---|
canTranslate1, canTranslate2, getLastException |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TranslatorTimeString()
public TranslatorTimeString(int secondsInBaseUnit)
Method Detail |
---|
public java.lang.String translate1(java.lang.Integer valueToTranslate)
translate1
in class TypeTranslator<java.lang.Integer,java.lang.String>
valueToTranslate
- some Integer
public java.lang.Integer translate2(java.lang.String valueToTranslate) throws TranslationFailedException
translate2
in class TypeTranslator<java.lang.Integer,java.lang.String>
valueToTranslate
- some String which may either be an Integer or a Double with some unit specification (e.g. 1.5h)
TranslationFailedException
- thrown if the value cannot be translated
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |