Package jmri.jmrit.logixng.util
Class ReferenceUtil
java.lang.Object
jmri.jmrit.logixng.util.ReferenceUtil
Utility methods to handle references
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classReference to an integer. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetReference(SymbolTable symbolTable, String reference) protected static StringgetReference(SymbolTable symbolTable, String reference, int startIndex, ReferenceUtil.IntRef endIndex) Get the value of a referenceprotected static StringgetReferenceOrValue(SymbolTable symbolTable, String reference, int startIndex, ReferenceUtil.IntRef endIndex) Get the reference or the value.The value ends either with end of string, or with any of the characters comma, left square bracket, right square bracket or right curly bracket.protected static StringgetValue(String reference, int startIndex, ReferenceUtil.IntRef endIndex) Get the value.static booleanisReference(String value) Checks if the parameter is a reference or not.protected static StringunescapeString(String value, int startIndex, int endIndex)
-
Constructor Details
-
ReferenceUtil
public ReferenceUtil()
-
-
Method Details
-
isReference
Checks if the parameter is a reference or not.- Parameters:
value- the string to check- Returns:
- true if value has a reference. falsw otherwise
-
unescapeString
-
getValue
Get the value. The value ends either with end of string, or with any of the characters comma, left square bracket, right square bracket or right curly bracket. These characters may be escaped and should then be ignored.- Parameters:
reference- the referencestartIndex- where in the string the value starts, since the reference string may contain several references.endIndex- index of the end of the value. This is an output parameter.- Returns:
- the value
-
getReferenceOrValue
protected static String getReferenceOrValue(SymbolTable symbolTable, String reference, int startIndex, ReferenceUtil.IntRef endIndex) Get the reference or the value.The value ends either with end of string, or with any of the characters comma, left square bracket, right square bracket or right curly bracket. These characters may be escaped and should then be ignored.- Parameters:
symbolTable- the symbol tablereference- the referencestartIndex- where in the string the value starts, since the reference string may contain several references.endIndex- index of the end of the value. This is an output parameter.- Returns:
- the value
-
getReference
protected static String getReference(SymbolTable symbolTable, String reference, int startIndex, ReferenceUtil.IntRef endIndex) Get the value of a reference- Parameters:
symbolTable- the symbol tablereference- the referencestartIndex- where in the string the reference starts, since the reference string may contain several references.endIndex- index of the end of the reference. This is an output parameter.- Returns:
- the value of the reference
-
getReference
@CheckReturnValue @Nonnull public static String getReference(SymbolTable symbolTable, String reference)
-