/[fenfire]/fenfire/org/fenfire/swamp/makeswamp.py
ViewVC logotype

Diff of /fenfire/org/fenfire/swamp/makeswamp.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.4 by tjl, Tue Apr 15 10:39:40 2003 UTC revision 1.5 by tjl, Tue Apr 15 11:51:07 2003 UTC
# Line 130  public interface ConstGraph { Line 130  public interface ConstGraph {
130      ConstGraph getObservedConstGraph(org.fenfire.Obs o);      ConstGraph getObservedConstGraph(org.fenfire.Obs o);
131      void close();      void close();
132    
133        boolean contains(Object e0, Object e1, Object e2);
134        boolean contains(Object e0, Object e1, Object e2, Obs o);
135    
136      %(nonobs_findprotos)s      %(nonobs_findprotos)s
137      %(obs_findprotos)s      %(obs_findprotos)s
138    
# Line 167  abstract public class AbstractConstGraph Line 170  abstract public class AbstractConstGraph
170          return new StdObservedConstGraph(this, obs);          return new StdObservedConstGraph(this, obs);
171      }      }
172      public void close() { }      public void close() { }
173        public boolean contains(Object e0, Object e1, Object e2) {
174            return contains(e0, e1, e2, null);
175        }
176    
177      %(nonobs_callobs)s      %(nonobs_callobs)s
178    
# Line 198  public class StdObservedConstGraph imple Line 204  public class StdObservedConstGraph imple
204    
205      public void close() { }      public void close() { }
206    
207        public boolean contains(Object e0, Object e1, Object e2) {
208            return constgraph.contains(e0, e1, e2, obs);
209        }
210        public boolean contains(Object e0, Object e1, Object e2, Obs o) {
211            throw new Error("DoubleObs");
212        }
213    
214      %(const_nonobs_callother)s      %(const_nonobs_callother)s
215      %(const_obs_nodouble)s      %(const_obs_nodouble)s
216    
# Line 395  def makeHashGraph(): Line 408  def makeHashGraph():
408              add(subject, predicate, object);              add(subject, predicate, object);
409          }          }
410    
411            public boolean contains(Object e0, Object e1, Object e2, Obs o) {
412                if(o != null) observer.addObs(e0, e1, e2, o);
413    
414                HashMap hash1 = (HashMap) ind_012.get(e0);
415                if(hash1 == null) return false;
416            
417                HashSet hash2 = (HashSet) hash1.get(e1);
418                if(hash2 == null) return false;
419            
420                HashSet resSet = hash2;
421                return resSet.contains(e2);
422                
423            }
424    
425          //////////////////          //////////////////
426          // Finds          // Finds

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.5

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26