예제 #1
0
 public void destroy() {
   name = null;
   receiver = null;
   description = null;
   stopIf = null;
   properties.getProperties().clear();
   properties = null;
 }
예제 #2
0
  /**
   * Creates an oredred list reading the command properties writed in format
   * "parameter[AN_INT_FROM_0_TO_999]" other properties format are ignored (not added to the
   * returned List) The indexs must be contiguous (1,2,3,...) for example:
   *
   * <p>
   * <li>parameter[0] = foo
   * <li>
   * <li>parameter[1] = bar
   * <li>parameter[3] = asd
   * <li>object = Light 1
   * <li>another-param = myValue
   *
   *     <p>The returned ArrayList<String> is
   * <li>[0]->foo
   * <li>[1]->bar because the index = 2 is missing.
   *
   * @return an ordered ArrayList<String> of command parameter values
   */
  public ArrayList<String> getParametersAsList() {
    ArrayList<String> output = new ArrayList<String>();

    // 99 is the max num of elements in list
    for (int i = 0; i < 99; i++) {
      String value = null;
      value = properties.getProperties().getProperty("parameter[" + i + "]");

      if (value != null) {
        // add to array
        output.add(value);
      } else {
        // if the elements are not contiguous return
        return output;
      }
    }

    return output;
  }