/** * Return this dictionary as a String in JSON format. */ public String toJSON() { StringList temp = new StringList(); for (String item : this) { temp.append(JSONObject.quote(item)); } return "[ " + temp.join(", ") + " ]"; }
public String pop() { if (count == 0) { throw new RuntimeException("Can't call pop() on an empty list"); } String value = get(count-1); data[--count] = null; // avoid leak return value; }
StringList extraStatements = new StringList(); extraStatements.append(smoothContents[0]); if (extraStatements.size() != 0) { throw new SketchException(context.getResources().getString(R.string.preproc_smooth_and_nosmooth)); } else { extraStatements.append(noContents[0]); extraStatements.append(pixelDensityContents[0]); } else { pixelDensityContents = matchDensityMess(searchArea); if (pixelDensityContents != null) { extraStatements.append(pixelDensityContents[0]); String rendererArg = (args.size() >= 3) ? args.get(2).trim() : null; String widthArg = (args.size() >= 1) ? args.get(0).trim() : null; String heightArg = (args.size() >= 2) ? args.get(1).trim() : null; setPrivateSurfaceInfoField(info, "height", heightArg); setPrivateSurfaceInfoField(info, "renderer", rendererArg); setPrivateSurfaceInfoField(info, "path", (args.size() >= 4) ? args.get(3).trim() : null); if (args.size() > 0) { // might have no args String args0 = args.get(0).trim(); if (args.size() == 1) { } else if (args.size() == 2) {
/** * Return this dictionary as a String in JSON format. */ public String toJSON() { StringList items = new StringList(); for (int i = 0; i < count; i++) { items.append(JSONObject.quote(keys[i])+ ": " + values[i]); } return "{ " + items.join(", ") + " }"; }
public StringList copy() { StringList outgoing = new StringList(data); outgoing.count = count; return outgoing; }
/** * Create from something iterable, for instance: * StringList list = new StringList(hashMap.keySet()); * * @nowebref */ public StringList(Iterable<String> iter) { this(10); for (String s : iter) { append(s); } }
StringList outgoing = new StringList(); if (c == ',') { if (current.length() != 0) { outgoing.append(current.toString()); current.setLength(0); outgoing.append(current.toString());
public String[] getUnique(int column) { StringList list = new StringList(getStringColumn(column)); return list.getUnique(); }
public IntDict getOrder(int column) { StringList list = new StringList(getStringColumn(column)); return list.getOrder(); }
public IntDict getTally(int column) { StringList list = new StringList(getStringColumn(column)); return list.getTally(); }
/** * Create a dictionary that maps between column titles and cell entries * in a TableRow. If two columns have the same name, the later column's * values will override the earlier values. */ public StringDict(TableRow row) { this(row.getColumnCount()); String[] titles = row.getColumnTitles(); if (titles == null) { titles = new StringList(IntList.fromRange(row.getColumnCount())).array(); } for (int col = 0; col < row.getColumnCount(); col++) { set(titles[col], row.getString(col)); } // remove unused and overwritten entries crop(); }
public void print() { for (int i = 0; i < size(); i++) { System.out.format("[%d] %s%n", i, data[i]); } }
/** * Returns the actual array being used to store the data. Suitable for * iterating with a for() loop, but modifying the list could cause terrible * things to happen. */ public String[] values() { crop(); return data; }
/** * Create a new array with a copy of all the values. * * @return an array sized by the length of the list with each of the values. * @webref stringlist:method * @brief Create a new array with a copy of all the values */ public String[] array() { return array(null); }
/** Get a list of all unique entries. */ public String[] getUnique() { return getTally().keyArray(); }
public StringList getSubset(int start) { return getSubset(start, count - start); }
/** * Return this dictionary as a String in JSON format. */ public String toJSON() { StringList items = new StringList(); for (int i = 0; i < count; i++) { items.append(JSONObject.quote(keys[i])+ ": " + values[i]); } return "{ " + items.join(", ") + " }"; }