예제 #1
0
  /** Add a new StringNode to the list */
  public StringNode addStringNode(StringNode stringNode) {
    StringNode newStringNode = stringNode;

    // check if it's is an array
    if (stringNode.isArray()) {
      StringArray stringArray = findStringArray(stringNode.getKey());
      int position = -1;
      // if (stringNode.getKey().contains("_"))
      if (StringArray.isArrayItem(stringNode.getKey())) {
        // position =
        // Integer.parseInt(stringNode.getKey().split("_")[1]);
        position = StringArray.findItemPosition(stringNode.getKey());
      }
      newStringNode =
          stringArray.addValue(stringNode.getValue(), ((position != -1) ? position : null));
    }

    newStringNode.setLocalizationFile(this);
    stringNodes.add(newStringNode);
    stringNodesMap.put(newStringNode.getKey(), newStringNode);

    this.setDirty(true);

    return newStringNode;
  }
예제 #2
0
  /**
   * Retrieves the values contained in this array as a list of Strings
   *
   * @return
   */
  public List<String> getStringValues() {
    LinkedList<String> result = new LinkedList<String>();

    for (StringNode node : this.values) {
      result.add(node.getValue());
    }

    return result;
  }
예제 #3
0
  /**
   * Remove blank array items
   *
   * @param nodes all nodes
   * @return only non blank array items
   */
  private List<StringNode> removeBlankArrayItems(List<StringNode> nodes) {
    List<StringNode> noBlankArrayItems = new ArrayList<StringNode>();

    for (StringNode node : nodes) {
      if (node.isArray()) {
        if (!node.getValue().equals("")) {
          noBlankArrayItems.add(node);
        }
      } else {
        noBlankArrayItems.add(node);
      }
    }
    return noBlankArrayItems;
  }
예제 #4
0
 public String getReleaseUrl() {
   return releaseUrl.getValue();
 }
예제 #5
0
 @Override
 protected Integer visitStringNode(StringNode node) {
   return node.getValue().hashCode();
 }
예제 #6
0
 @Override
 protected Boolean visitStringNode(StringNode node) {
   return node.getValue().equals(((StringNode) other).getValue());
 }