/** 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; }
/** * 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; }
/** * 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; }
public String getReleaseUrl() { return releaseUrl.getValue(); }
@Override protected Integer visitStringNode(StringNode node) { return node.getValue().hashCode(); }
@Override protected Boolean visitStringNode(StringNode node) { return node.getValue().equals(((StringNode) other).getValue()); }