org.pz.platypus
Class UserStrings

java.lang.Object
  extended by org.pz.platypus.UserStrings

public class UserStrings
extends java.lang.Object

Manages the user-defined strings (essentially macros w/out parameters, currently) System strings have the format of starting with: $ followed by an alphanumeric and then alphanumerics or the _ character They are defined with [def:$macro{meaning}]. They are printed by the command operator *, as in: [*$macro]

Author:
alb (Andrew Binstock)

Field Summary
private  java.util.TreeMap userStrings
           
 
Constructor Summary
UserStrings()
           
 
Method Summary
 int add(java.lang.String key, java.lang.String value)
          Add a string to user strings after validating they don't start with $_.
 java.lang.String dump(Literals lits)
          Returns a string containing all the keys and values formatted one-to-a-line for printing to console or document.
 int getSize()
          How many system Strings are defined
 java.lang.String getString(java.lang.String key)
          Returns the string associated to a given key
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

userStrings

private final java.util.TreeMap userStrings
Constructor Detail

UserStrings

public UserStrings()
Method Detail

add

public int add(java.lang.String key,
               java.lang.String value)
Add a string to user strings after validating they don't start with $_.

Parameters:
key - string that should not start with $_
value - where any legal string is OK except null
Returns:
Status.OK; on error: Status.INVALID_PARAM or Status.INVALID_PARAM_NULL

dump

public java.lang.String dump(Literals lits)
Returns a string containing all the keys and values formatted one-to-a-line for printing to console or document.

Parameters:
lits - literals to use in the dump output
Returns:
a printable/displayable string with all the strings, 1 per line.

getSize

public int getSize()
How many system Strings are defined

Returns:
number of key value pairs.

getString

public java.lang.String getString(java.lang.String key)
Returns the string associated to a given key

Parameters:
key - the key to use for the lookup
Returns:
the string; null, if an error occurs


Copyright © 2008-10 Pacific Data Works LLC