From: <an...@us...> - 2008-07-18 23:40:12
|
Revision: 6839 http://smartfrog.svn.sourceforge.net/smartfrog/?rev=6839&view=rev Author: anfarr Date: 2008-07-18 23:40:10 +0000 (Fri, 18 Jul 2008) Log Message: ----------- SFOS-922: Momentary retract Modified Paths: -------------- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Context.java trunk/core/smartfrog/src/org/smartfrog/sfcore/common/ContextImpl.java Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Context.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Context.java 2008-07-18 23:39:52 UTC (rev 6838) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/Context.java 2008-07-18 23:40:10 UTC (rev 6839) @@ -24,9 +24,7 @@ import java.util.Enumeration; import java.util.Iterator; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; - /** * Defines the context interface used by Components. Context implementations * need to respect the ordering and copying requirements imposed by Components. @@ -63,7 +61,8 @@ * @see Enumeration */ public Enumeration elements(); - + + /** * Returns object stored under given key, null if not found. * @@ -274,33 +273,5 @@ public Object sfResolveAttribute(Object name) throws SmartFrogContextException; - /** - * Sets originating description for context. Used in constraint solving. - * @param originatingDescription - */ - public void setOriginatingDescr(ComponentDescription originatingDescription); - - /** - * Gets the originating description for context. Used in constraint solving. - * @return ComponentDescription originating description - */ - public ComponentDescription getOriginatingDescr(); - - /** - * Verifies that comp is a sub-type of this context, based on context being a prefix of comp in terms of keys - * @return Whether sub-type - */ - public boolean ofType(ComponentDescription comp); - - /** - * Returns the key at index idx in context - * @return key for given index, or null if index not valid - */ - public Object getKey(int idx); - /** - * Returns the value at index idx in context - * @return value for given key index, or null if index not valid - */ - public Object getVal(int idx); } Modified: trunk/core/smartfrog/src/org/smartfrog/sfcore/common/ContextImpl.java =================================================================== --- trunk/core/smartfrog/src/org/smartfrog/sfcore/common/ContextImpl.java 2008-07-18 23:39:52 UTC (rev 6838) +++ trunk/core/smartfrog/src/org/smartfrog/sfcore/common/ContextImpl.java 2008-07-18 23:40:10 UTC (rev 6839) @@ -34,10 +34,7 @@ import java.util.Set; import java.util.Vector; -import org.smartfrog.sfcore.componentdescription.ComponentDescription; -import org.smartfrog.sfcore.languages.sf.constraints.CoreSolver; - /** * Implements the context interface. This implementation relies on the * OrderedHashtable class in the Utilities, but another class can be used. The @@ -67,7 +64,7 @@ public ContextImpl(int cap, float load) { super(cap, load); } - + /** * Returns the first key for which the value is the given one (==). * @param value value to look up @@ -731,8 +728,6 @@ Object r = super.remove(key); attributeTags.remove(key); attributeTagsWrappers.remove(key); - - CoreSolver.getInstance().addUndo(this, key, r); return r; } @@ -795,7 +790,6 @@ public Object clone() { Object ret = super.clone(); - Map m = new HashMap(); Map w = new HashMap(); for (Iterator i = attributeTags.keySet().iterator(); i.hasNext(); ) { @@ -869,76 +863,4 @@ return result; } - /** - * Add an object to the hashtable. - * - * @param key key for association - * @param value value for hashtable - * - * @return previous value for key or null if none - */ - public Object put(Object key, Object value) { - Object oldValue = super.put(key, value); - - CoreSolver.getInstance().addUndo(this, key, oldValue); - return oldValue; - } - - - /** - * Sets originating description for context. Used in constraint solving. - * @param originatingDescr originating ComponentDescription for context - */ - public void setOriginatingDescr(ComponentDescription originatingDescr) { - this.originatingDescr=originatingDescr; - ((ContextImpl)originatingDescr.sfContext()).originatingDescr=originatingDescr; - } - - /** - * Gets the originating description for context. Used in constraint solving. - * @return ComponentDescription originating description - */ - public ComponentDescription getOriginatingDescr() { return originatingDescr; } - - /** The originating component description of this context. */ - private ComponentDescription originatingDescr; - - /** - * Verifies that comp is a sub-type of this context, based on context being a prefix of comp in terms of keys - * @return Whether sub-type - */ - public boolean ofType(ComponentDescription comp){ - ContextImpl comp_cxt = (ContextImpl) comp.sfContext(); - - Iterator comp_iter = comp_cxt.orderedAttributes(); - Iterator my_iter = orderedAttributes(); - - while(my_iter.hasNext()){ - if (!comp_iter.hasNext()) return false; - String akey = (String) my_iter.next(); - String ckey = (String) comp_iter.next(); - if (!akey.equals(ckey)) return false; - } - return true; - } - - /** - * Returns the key at index idx in context - * @return key for given index, or null if index not valid - */ - public Object getKey(int idx){ - return orderedKeys.get(idx); - } - - /** - * Returns the value at index idx in context - * @return value for given key index, or null if index not valid - */ - public Object getVal(int idx){ - Object key = getKey(idx); - if (key!=null) return get(key); - else return null; - } - - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |