Loading pom.xml +14 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,20 @@ <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9.1</version> <executions> <execution> <phase>verify</phase> <goals> <goal>javadoc</goal> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <parent> Loading src/main/java/ca/mcscert/jtet/expression/VariableCollection.java +38 −0 Original line number Diff line number Diff line Loading @@ -34,9 +34,27 @@ import java.util.Map; import java.util.Set; /** * VariableCollection stores a set of variables for use by expression parsers. * <p> * Expression parsers need an easy way to find all the valid variables for a given expression. This class receives a * set of variables, which it then makes available. * <p> * It also provides an easy way to find all the enumeration constants available. It mixes this together with the * variables, allowing the parser to quickly check if a given name is valid. * * @author Matthew Dawson <matthew@mjdsystems.ca> */ final public class VariableCollection { /** * Constructs a VariableCollection with the given variables and enumerations. * <p> * The VariableCollection constructed here will have the variables given, along with all the enumeration constants * from the given set of enumerations. Note that all enumeration constants must not conflict with each other or * any given variable. * * @param variables This variables to store in this collection. * @param enumerationTypes The set of enumerations for which the constants should be extracted. May be null. */ public VariableCollection(Map<String, Variable> variables, Set<EnumerationVariableType> enumerationTypes) { m_variables = variables; if (m_variables != null) { Loading @@ -57,14 +75,34 @@ final public class VariableCollection { } } /** * Constructs a VariableCollection with the given variables and enumerations. * <p> * The VariableCollection constructed here will have the variables given. No enumerations will be stored. * * @param variables This variables to store in this collection. */ public VariableCollection(Map<String, Variable> variables) { this(variables, null); } /** * Returns a map containing all the known variables and enumeration constants. * <p> * Whatever is available at a given name, it is guaranteed to be a unique name. * * @return A map of variables and enumeration constants. */ public Map<String, Variable> getVariablesAndEnumeratedValues() { return Collections.unmodifiableMap(m_variablesAndEnumeratedValues); } /** * Returns a map containing only the variables. * <p> * This ignores all the enumeration constants present. * @return A map of variables. */ public Map<String, Variable> getVariables() { return Collections.unmodifiableMap(m_variables); } Loading Loading
pom.xml +14 −0 Original line number Diff line number Diff line Loading @@ -151,6 +151,20 @@ <artifactId>maven-surefire-plugin</artifactId> <version>2.17</version> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-javadoc-plugin</artifactId> <version>2.9.1</version> <executions> <execution> <phase>verify</phase> <goals> <goal>javadoc</goal> <goal>jar</goal> </goals> </execution> </executions> </plugin> </plugins> </build> <parent> Loading
src/main/java/ca/mcscert/jtet/expression/VariableCollection.java +38 −0 Original line number Diff line number Diff line Loading @@ -34,9 +34,27 @@ import java.util.Map; import java.util.Set; /** * VariableCollection stores a set of variables for use by expression parsers. * <p> * Expression parsers need an easy way to find all the valid variables for a given expression. This class receives a * set of variables, which it then makes available. * <p> * It also provides an easy way to find all the enumeration constants available. It mixes this together with the * variables, allowing the parser to quickly check if a given name is valid. * * @author Matthew Dawson <matthew@mjdsystems.ca> */ final public class VariableCollection { /** * Constructs a VariableCollection with the given variables and enumerations. * <p> * The VariableCollection constructed here will have the variables given, along with all the enumeration constants * from the given set of enumerations. Note that all enumeration constants must not conflict with each other or * any given variable. * * @param variables This variables to store in this collection. * @param enumerationTypes The set of enumerations for which the constants should be extracted. May be null. */ public VariableCollection(Map<String, Variable> variables, Set<EnumerationVariableType> enumerationTypes) { m_variables = variables; if (m_variables != null) { Loading @@ -57,14 +75,34 @@ final public class VariableCollection { } } /** * Constructs a VariableCollection with the given variables and enumerations. * <p> * The VariableCollection constructed here will have the variables given. No enumerations will be stored. * * @param variables This variables to store in this collection. */ public VariableCollection(Map<String, Variable> variables) { this(variables, null); } /** * Returns a map containing all the known variables and enumeration constants. * <p> * Whatever is available at a given name, it is guaranteed to be a unique name. * * @return A map of variables and enumeration constants. */ public Map<String, Variable> getVariablesAndEnumeratedValues() { return Collections.unmodifiableMap(m_variablesAndEnumeratedValues); } /** * Returns a map containing only the variables. * <p> * This ignores all the enumeration constants present. * @return A map of variables. */ public Map<String, Variable> getVariables() { return Collections.unmodifiableMap(m_variables); } Loading