View Javadoc

1   package org.opensync.tools;
2   
3   import java.io.FileNotFoundException;
4   import java.io.IOException;
5   import java.util.Vector;
6   
7   import org.xml.sax.SAXException;
8   
9   
10  public class GroupFixedCriteria extends Object {
11  
12    private String label,keyWord,type;
13    private InputFixedCriteria inputs[];
14  //  private int inputsSize=0;
15  
16    /***
17     * Constructor
18     */
19    public GroupFixedCriteria(String k, String l, String t) {
20        label = l;
21        keyWord = k;
22        type = t;
23        //inputs = new Vector();
24    }
25  
26    public void initLabels(String lang) throws SAXException,FileNotFoundException,IOException {
27      label = DicoReader.getLabelDicoByKey(lang,keyWord);
28      for (int i=0;i<inputs.length;i++)
29        inputs[i].setLabel(DicoReader.getLabelDicoByKey(lang,inputs[i].getKeyWord()));
30      }
31  
32    // Methode Set
33    public void setKeyWord(String s) {
34      this.keyWord = s;
35      }
36    public void setLabel(String s) {
37      this.label = s;
38      }
39    public void setType(String s) {
40      this.type = s;
41      }
42    public void setInputs(Vector in) {
43      inputs = new InputFixedCriteria[in.size()];
44      in.toArray(inputs);
45      in.clear();
46      }
47    // Methode get
48    public String getKeyWord() {
49      return(keyWord);
50      }
51    public String getLabel() {
52      return(label);
53      }
54    public String getType() {
55      return(type);
56      }
57    // Methode get from inputs
58    public InputFixedCriteria[] getInputs() {
59      return (this.inputs);
60    }
61    public InputFixedCriteria getInputByIndex(int k) {
62      if (inputs.length<0) return null;
63      else return inputs[k];
64    }
65  
66    public InputFixedCriteria getInputByKey(String k) {
67      for (int i=0;i<inputs.length;i++)
68        if (inputs[i].equals(k)) return inputs[i];
69      return null;
70    }
71    public boolean equals(String s) {
72      return this.keyWord.equals(s);
73    }
74  }
75