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

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

public class Variables
extends java.lang.Object
implements org.pf.textx.VariableContainer

This is a specialized container for variables (placeholders).

Version:
2.0
Author:
Manfred Duchrow

Constructor Summary
Variables()
          Initialize the new instance with default values.
 
Method Summary
 void add(org.pf.util.NamedText namedText)
           
 void addFrom(java.util.Map vars)
          Adds all key value pairs from the given map to the variables, if the key is a String.
 java.util.Map<java.lang.String,java.lang.String> asHashMap()
           
 Variables copy()
          Returns a copy of the variables which ensures that changes to it won't effect the original variables.
 java.lang.String getValue(java.lang.String varName)
           
 java.lang.String getValueOf(java.lang.String varName)
          Returns the current value of the variable with the given name or null if the variable is not set.
 java.lang.String[] getVariableNames()
          Returns all variable names.
 boolean isKnownVariable(java.lang.String varName)
           
 java.util.Set knownVariableNames()
          Returns all variable names as set.
 java.lang.Object[] namedTextArray()
           
 org.pf.util.NamedText namedTextAt(int index)
           
 void remove(org.pf.util.NamedText varDef)
           
 void removeAll(java.util.Collection coll)
           
 void removeVariable(java.lang.String varName)
           
 void setNamedTextAt(int index, org.pf.util.NamedText namedText)
           
 void setValue(java.lang.String varName, java.lang.String value)
           
 void setValueFor(java.lang.String varName, java.lang.Object value)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Variables

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

Method Detail

copy

public Variables copy()
Returns a copy of the variables which ensures that changes to it won't effect the original variables.


removeVariable

public void removeVariable(java.lang.String varName)
Specified by:
removeVariable in interface org.pf.textx.VariableContainer

setValue

public void setValue(java.lang.String varName,
                     java.lang.String value)
Specified by:
setValue in interface org.pf.textx.VariableContainer

setValueFor

public void setValueFor(java.lang.String varName,
                        java.lang.Object value)
Specified by:
setValueFor in interface org.pf.textx.VariableContainer

getValue

public java.lang.String getValue(java.lang.String varName)
                          throws org.pf.textx.UnknownVariableException
Specified by:
getValue in interface org.pf.textx.VariableResolver
Throws:
org.pf.textx.UnknownVariableException

isKnownVariable

public boolean isKnownVariable(java.lang.String varName)
Specified by:
isKnownVariable in interface org.pf.textx.VariableResolver

knownVariableNames

public java.util.Set knownVariableNames()
Returns all variable names as set.

Specified by:
knownVariableNames in interface org.pf.textx.VariableResolver

getValueOf

public java.lang.String getValueOf(java.lang.String varName)
Returns the current value of the variable with the given name or null if the variable is not set. Does not throw UnknownVariableException!

See Also:
getValue(String)

addFrom

public void addFrom(java.util.Map vars)
Adds all key value pairs from the given map to the variables, if the key is a String.


getVariableNames

public java.lang.String[] getVariableNames()
Returns all variable names.


size

public int size()

asHashMap

public java.util.Map<java.lang.String,java.lang.String> asHashMap()

add

public void add(org.pf.util.NamedText namedText)

remove

public void remove(org.pf.util.NamedText varDef)

removeAll

public void removeAll(java.util.Collection coll)

namedTextAt

public org.pf.util.NamedText namedTextAt(int index)

setNamedTextAt

public void setNamedTextAt(int index,
                           org.pf.util.NamedText namedText)

namedTextArray

public java.lang.Object[] namedTextArray()