public boolean isNameUnique(String name) { for (int i = 0, limit = scripts.size(); i < limit; i++) { if (name.equals(get(i).getName())) { return false; } } return true; }
public int indexOf(String name) { for (int i = 0, limit = scripts.size(); i < limit; i++) { Script script = get(i); if (script.getName().equals(name)) { return i; } } return -1; }
// Add/Insert public int add(Script script) { // Find the correct spot to add it alphabetically int i, limit; for (i = 0, limit = scripts.size(); i < limit; i++) { Script scriptTemp = (Script) scripts.get(i); if (scriptTemp.getName().compareTo(script.getName()) >= 0) { break; } } scripts.add(i, script); // Update the table fireTableRowsInserted(i, i); return i; }
// Misc Accessors public int getSize() { return scripts.size(); }