src/java/isac/util/tactics/StringListTactic.java
branchjava_rename_format
changeset 3922 fcd5648113ca
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/java/isac/util/tactics/StringListTactic.java	Wed Jun 15 18:31:02 2005 +0200
     1.3 @@ -0,0 +1,53 @@
     1.4 +/*
     1.5 + * Created on Oct 9, 2003
     1.6 + *
     1.7 + * To change the template for this generated file go to
     1.8 + * Window>Preferences>Java>Code Generation>Code and Comments
     1.9 + */
    1.10 +package isac.util.tactics;
    1.11 +
    1.12 +import java.util.Iterator;
    1.13 +import java.util.Vector;
    1.14 +
    1.15 +/**
    1.16 + * @author rgradisc
    1.17 + * 
    1.18 + * To change the template for this generated type comment go to
    1.19 + * Window>Preferences>Java>Code Generation>Code and Comments
    1.20 + */
    1.21 +public class StringListTactic extends Tactic {
    1.22 +
    1.23 +    private Vector string_list_ = new Vector();
    1.24 +
    1.25 +    public StringListTactic() {
    1.26 +    }
    1.27 +
    1.28 +    public StringListTactic(String name) {
    1.29 +        this.name_ = name;
    1.30 +    }
    1.31 +
    1.32 +    public StringListTactic(String name, Vector keyList) {
    1.33 +        this.name_ = name;
    1.34 +        this.string_list_ = keyList;
    1.35 +    }
    1.36 +
    1.37 +    public void addKey(String key) {
    1.38 +        this.string_list_.add(key);
    1.39 +    }
    1.40 +
    1.41 +    public String toSMLString() {
    1.42 +        StringBuffer sb = new StringBuffer();
    1.43 +        sb.append(name_);
    1.44 +        if (string_list_.size() > 0) {
    1.45 +            sb.append(" [");
    1.46 +            Iterator it = string_list_.iterator();
    1.47 +            while (it.hasNext()) {
    1.48 +                sb.append("\"" + it.next() + "\",");
    1.49 +            }
    1.50 +            sb.deleteCharAt(sb.length() - 1); // remove last ","
    1.51 +            sb.append("]");
    1.52 +        }
    1.53 +        return sb.toString();
    1.54 +    }
    1.55 +
    1.56 +}
    1.57 \ No newline at end of file