final IndexItemImpl findItem(TableFieldDefineImpl field) { for (int i = 0, c = this.items.size(); i < c; i++) { IndexItemImpl item = this.items.get(i); if (item.getField() == field) { return item; } } return null; }
@Override final void assignFrom(Object sample) { super.assignFrom(sample); IndexDefineImpl index = (IndexDefineImpl) sample; this.unique = index.unique; for (int i = 0, c = index.items.size(); i < c; i++) { IndexItemImpl from = index.items.get(i); TableFieldDefineImpl f = this.owner.fields.get(from.field.name); IndexItemImpl to = this.findItem(f); if (to == null) { to = from.clone(this); this.items.add(i, to); } else { this.items.ensureElementAt(to, i); to.assignFrom(from); } } this.items.trunc(index.items.size()); }