[Mulgara-svn] r818 - branches/mgr-61-sparql/src/jar/query/java/org/mulgara/query

pag at mulgara.org pag at mulgara.org
Wed Apr 23 03:46:29 UTC 2008


Author: pag
Date: 2008-04-22 20:46:28 -0700 (Tue, 22 Apr 2008)
New Revision: 818

Modified:
   branches/mgr-61-sparql/src/jar/query/java/org/mulgara/query/ConstraintFilter.java
Log:
Updated to wrap a ConstraintExpression, rather than a Constraint

Modified: branches/mgr-61-sparql/src/jar/query/java/org/mulgara/query/ConstraintFilter.java
===================================================================
--- branches/mgr-61-sparql/src/jar/query/java/org/mulgara/query/ConstraintFilter.java	2008-04-23 03:37:25 UTC (rev 817)
+++ branches/mgr-61-sparql/src/jar/query/java/org/mulgara/query/ConstraintFilter.java	2008-04-23 03:46:28 UTC (rev 818)
@@ -28,7 +28,7 @@
  * @copyright &copy; 2008 <a href="http://www.topazproject.org/">The Topaz Project</a>
  * @licence <a href="{@docRoot}/../../LICENCE.txt">Open Software License v3.0</a>
  */
-public class ConstraintFilter implements Constraint {
+public class ConstraintFilter implements ConstraintExpression {
 
   @SuppressWarnings("unused")
   /** The logger */
@@ -43,20 +43,20 @@
   private static final long serialVersionUID = -816733883358318430L;
 
   /** The filtered expression. */
-  private Constraint constraint;
+  private ConstraintExpression constraintExpr;
 
   /** The filter construct. */
   private Filter filter;
 
   /**
    * Construct a filtered constraint.
-   * @param constraint a non-<code>null</code> constraint
+   * @param constraintExpr a non-<code>null</code> constraint
    * @throws IllegalArgumentException if <var>constraint</var> is <code>null</code>
    */
-  public ConstraintFilter(Constraint constraint, Filter filter) {
-    if (constraint == null) throw new IllegalArgumentException("Null \"constraint\" parameter");
+  public ConstraintFilter(ConstraintExpression constraintExpr, Filter filter) {
+    if (constraintExpr == null) throw new IllegalArgumentException("Null \"constraint expression\" parameter");
     if (filter == null) throw new IllegalArgumentException("Null \"filter\" parameter");
-    this.constraint = constraint;
+    this.constraintExpr = constraintExpr;
     this.filter = filter;
   }
   
@@ -73,49 +73,23 @@
    * Gets the constraint being filtered by this constraint.
    * @return The original constraint expression.
    */
-  public Constraint getUnfilteredConstraint() {
-    return constraint;
+  public ConstraintExpression getUnfilteredConstraint() {
+    return constraintExpr;
   }
 
-  /**
-   * @see org.mulgara.query.Constraint#isRepeating()
-   * Returns the same value as the underlying constraint.
-   */
-  public boolean isRepeating() {
-    return constraint.isRepeating();
-  }
-
-
   /** {@inheritDoc} */
-  public ConstraintElement getElement(int index) {
-    return constraint.getElement(index);
-  }
-
-  /** {@inheritDoc} */
-  public ConstraintElement getModel() {
-    return constraint.getModel();
-  }
-
-
-  /** {@inheritDoc} */
   public Set<Variable> getVariables() {
-    return constraint.getVariables();
+    return constraintExpr.getVariables();
   }
 
-
   /** {@inheritDoc} */
-  public boolean isInnerConstraintIs() {
-    return constraint instanceof ConstraintIs;
-  }
-
-  /** {@inheritDoc} */
   public String toString() {
-    return "filter " + constraint + " by ";
+    return "filter " + constraintExpr + " by ";
   }
 
   /** {@inheritDoc} */
   public int hashCode() {
-    return constraint.hashCode() * -1;
+    return constraintExpr.hashCode() * -1;
   }
 
   /** {@inheritDoc} */
@@ -128,6 +102,6 @@
     // check each element.
     ConstraintFilter other = (ConstraintFilter)object;
     // can't do an equals() on filter, as this evaluates the filter in context
-    return constraint.equals(other.constraint) && filter == other.filter;
+    return constraintExpr.equals(other.constraintExpr) && filter == other.filter;
   }
 }




More information about the Mulgara-svn mailing list