Class PSDictionary.Maker

  • Enclosing class:
    PSDictionary

    private static class PSDictionary.Maker
    extends java.lang.Object
    This class is used to parse dictionary strings.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      private static class  PSDictionary.Maker.Token
      Simple token holding class
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private static int ARRAY  
      private static java.lang.String[][] BRACES  
      private static int CLOSING  
      private static int DICTIONARY  
      private static int OPENING  
      private static int PROCEDURE  
      private static int STRING  
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private Maker()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private int indexOfMatchingBrace​(java.lang.String str, java.lang.String[] braces, int fromIndex)
      Returns the closing brace index from a given string searches from a given index
      protected PSDictionary.Maker.Token nextToken​(java.lang.String str, int fromIndex)
      Returns a Token containing the start, end index and value of the next token found in a given string
      PSDictionary parseDictionary​(java.lang.String str)
      Parses a dictionary string and provides a dictionary object
      private java.lang.String stripBraces​(java.lang.String str, java.lang.String[] braces)
      Strips braces from complex object string
      • Methods inherited from class java.lang.Object

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

      • Maker

        private Maker()
    • Method Detail

      • nextToken

        protected PSDictionary.Maker.Token nextToken​(java.lang.String str,
                                                     int fromIndex)
        Returns a Token containing the start, end index and value of the next token found in a given string
        Parameters:
        str - string to search
        fromIndex - search from index
        Returns:
        Token containing the start, end index and value of the next token
      • indexOfMatchingBrace

        private int indexOfMatchingBrace​(java.lang.String str,
                                         java.lang.String[] braces,
                                         int fromIndex)
                                  throws PSDictionaryFormatException
        Returns the closing brace index from a given string searches from a given index
        Parameters:
        str - string to search
        braces - string array of opening and closing brace
        fromIndex - searches from index
        Returns:
        matching brace index
        Throws:
        PSDictionaryFormatException - thrown in the event that a parsing error occurred
      • stripBraces

        private java.lang.String stripBraces​(java.lang.String str,
                                             java.lang.String[] braces)
                                      throws PSDictionaryFormatException
        Strips braces from complex object string
        Parameters:
        str - String to parse
        braces - String array containing opening and closing braces
        Returns:
        String with braces stripped
        Throws:
        PSDictionaryFormatException - thrown in the event that a parsing error occurred
      • parseDictionary

        public PSDictionary parseDictionary​(java.lang.String str)
                                     throws PSDictionaryFormatException
        Parses a dictionary string and provides a dictionary object
        Parameters:
        str - a dictionary string
        Returns:
        A postscript dictionary object
        Throws:
        PSDictionaryFormatException - thrown in the event that a parsing error occurred