1 package de.congrace.exp4j;
3 import java.util.HashSet;
5 public class VariableSet extends HashSet<Variable> {
10 private static final long serialVersionUID = -4212803364398351279L;
12 public boolean add(Variable v){
13 Variable previous = getVariableNamed(v.getName());
14 if ( previous != null ){
15 this.remove( previous );
21 public Variable getVariableNamed(String name){
22 for (Variable var : this){
23 if (var.getName().equals(name) ){
30 public String[] getVariableNames(){
31 if (this.size() == 0){
34 String names[] = new String[this.size()];
36 for (Variable var : this){
37 names[i] = var.getName();