src/java/isac/util/tactics/StringListTactic.java
branchjava_rename_format
changeset 3922 fcd5648113ca
equal deleted inserted replaced
963:b4896ce4d1b0 3922:fcd5648113ca
       
     1 /*
       
     2  * Created on Oct 9, 2003
       
     3  *
       
     4  * To change the template for this generated file go to
       
     5  * Window>Preferences>Java>Code Generation>Code and Comments
       
     6  */
       
     7 package isac.util.tactics;
       
     8 
       
     9 import java.util.Iterator;
       
    10 import java.util.Vector;
       
    11 
       
    12 /**
       
    13  * @author rgradisc
       
    14  * 
       
    15  * To change the template for this generated type comment go to
       
    16  * Window>Preferences>Java>Code Generation>Code and Comments
       
    17  */
       
    18 public class StringListTactic extends Tactic {
       
    19 
       
    20     private Vector string_list_ = new Vector();
       
    21 
       
    22     public StringListTactic() {
       
    23     }
       
    24 
       
    25     public StringListTactic(String name) {
       
    26         this.name_ = name;
       
    27     }
       
    28 
       
    29     public StringListTactic(String name, Vector keyList) {
       
    30         this.name_ = name;
       
    31         this.string_list_ = keyList;
       
    32     }
       
    33 
       
    34     public void addKey(String key) {
       
    35         this.string_list_.add(key);
       
    36     }
       
    37 
       
    38     public String toSMLString() {
       
    39         StringBuffer sb = new StringBuffer();
       
    40         sb.append(name_);
       
    41         if (string_list_.size() > 0) {
       
    42             sb.append(" [");
       
    43             Iterator it = string_list_.iterator();
       
    44             while (it.hasNext()) {
       
    45                 sb.append("\"" + it.next() + "\",");
       
    46             }
       
    47             sb.deleteCharAt(sb.length() - 1); // remove last ","
       
    48             sb.append("]");
       
    49         }
       
    50         return sb.toString();
       
    51     }
       
    52 
       
    53 }