Class ReferenceUtil


  • public class ReferenceUtil
    extends java.lang.Object
    Utility methods to handle references
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      protected static class  ReferenceUtil.IntRef
      Reference to an integer.
    • Constructor Summary

      Constructors 
      Constructor Description
      ReferenceUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getReference​(SymbolTable symbolTable, java.lang.String reference)  
      protected static java.lang.String getReference​(SymbolTable symbolTable, java.lang.String reference, int startIndex, ReferenceUtil.IntRef endIndex)
      Get the value of a reference
      protected static java.lang.String getReferenceOrValue​(SymbolTable symbolTable, java.lang.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 java.lang.String getValue​(java.lang.String reference, int startIndex, ReferenceUtil.IntRef endIndex)
      Get the value.
      static boolean isReference​(java.lang.String value)
      Checks if the parameter is a reference or not.
      protected static java.lang.String unescapeString​(java.lang.String value, int startIndex, int endIndex)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • isReference

        public static boolean isReference​(java.lang.String value)
        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

        protected static java.lang.String unescapeString​(java.lang.String value,
                                                         int startIndex,
                                                         int endIndex)
      • getValue

        protected static java.lang.String getValue​(java.lang.String reference,
                                                   int startIndex,
                                                   ReferenceUtil.IntRef endIndex)
        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 reference
        startIndex - 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 java.lang.String getReferenceOrValue​(SymbolTable symbolTable,
                                                              java.lang.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 table
        reference - the reference
        startIndex - 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 java.lang.String getReference​(SymbolTable symbolTable,
                                                       java.lang.String reference,
                                                       int startIndex,
                                                       ReferenceUtil.IntRef endIndex)
        Get the value of a reference
        Parameters:
        symbolTable - the symbol table
        reference - the reference
        startIndex - 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