org.pf.tools.cda.base.model.workset
Class VariablePool

java.lang.Object
  extended by org.pf.textx.GlobalLocalVariables
      extended by org.pf.textx.GlobalLocalPlaceholderReplacement
          extended by org.pf.tools.cda.base.model.workset.VariablePool
All Implemented Interfaces:
org.pf.textx.VariableContainer, org.pf.textx.VariableResolver

public class VariablePool
extends org.pf.textx.GlobalLocalPlaceholderReplacement

The container for all variables. Particularly it replaces variables in a given text more than once. That is, variables can contain other placeholders.

Version:
1.0
Author:
Manfred Duchrow

Constructor Summary
VariablePool()
          Initialize the new instance with default values.
 
Method Summary
 VariablePool copy()
          Returns a copy of the local variables which ensures that changes to it won't effect the original variables.
 java.lang.String fillInVariables(java.lang.String text)
          Replaces all text fragments by variable definitions as they can be found in this variable pool.
 Variables getGlobalVariables()
          Returns the globally defined key/value pairs
 Variables getLocalVariables()
          Returns the locally defined key/value pairs
 boolean isEqual(VariablePool varPool)
          Returns true if the given variable pool contains the same variables as this one.
 java.lang.String replace(java.lang.String text)
          Replace all variables in the given text
 
Methods inherited from class org.pf.textx.GlobalLocalPlaceholderReplacement
getFunctionResolver, getTextEngine, setFunctionResolver
 
Methods inherited from class org.pf.textx.GlobalLocalVariables
getValue, isKnownVariable, knownVariableNames, newGlobalContext, newLocalContext, removeVariable, set, setGlobal, setGlobalFrom, setGlobalObject, setLocal, setLocalFrom, setLocalObject, setValue, setValueFor
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VariablePool

public VariablePool()
Initialize the new instance with default values.

Method Detail

replace

public java.lang.String replace(java.lang.String text)
                         throws org.pf.textx.TextReplacementException
Replace all variables in the given text

Overrides:
replace in class org.pf.textx.GlobalLocalPlaceholderReplacement
Throws:
org.pf.textx.TextReplacementException

getLocalVariables

public Variables getLocalVariables()
Returns the locally defined key/value pairs


getGlobalVariables

public Variables getGlobalVariables()
Returns the globally defined key/value pairs


copy

public VariablePool copy()
Returns a copy of the local variables which ensures that changes to it won't effect the original variables. The reference to the global variables will be identical.


isEqual

public boolean isEqual(VariablePool varPool)
Returns true if the given variable pool contains the same variables as this one.


fillInVariables

public java.lang.String fillInVariables(java.lang.String text)
Replaces all text fragments by variable definitions as they can be found in this variable pool.