@Override public boolean insert(int index, String key, Object value) throws ExpressionException { int len = size(); if (index < 1 || index > len) throw new ExpressionException( "invalid index to insert a value to argument scope", len == 0 ? "can't insert in a empty argument scope" : "valid index goes from 1 to " + (len - 1)); // remove all upper LinkedHashMap lhm = new LinkedHashMap(); Collection.Key[] keys = keys(); Collection.Key k; for (int i = 1; i <= keys.length; i++) { if (i < index) continue; k = keys[i - 1]; lhm.put(k.getString(), get(k, null)); removeEL(k); } // set new value setEL(key, value); // reset upper values Iterator it = lhm.entrySet().iterator(); Map.Entry entry; while (it.hasNext()) { entry = (Entry) it.next(); setEL(KeyImpl.toKey(entry.getKey()), entry.getValue()); } return true; }
@Override public Entry<Key, Object> next() { Key key = KeyImpl.toKey(keys.next(), null); return new EntryImpl(objs, key); }
@Override public Key toKey(Object obj, Key defaultValue) { return KeyImpl.toKey(obj, defaultValue); }
@Override public Key toKey(Object obj) throws PageException { return KeyImpl.toKey(obj); }