jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Mueller <muel...@adobe.com>
Subject Re: svn commit: r1303867 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query: ./ ast/ index/
Date Thu, 22 Mar 2012 18:28:59 GMT
Hi,

Sorry, my commit was incomplete (now sure why). It should be fixed now.
Plus I removed the unnecessary System.out.

Regards,
Thomas

On 3/22/12 6:35 PM, "Michael Dürig" <mduerig@apache.org> wrote:

>
>This seems to break the build. Tom could you please check that
>everything compiles before you do a checkin?
>
>Michael
>
>On 22.3.12 16:08, thomasm@apache.org wrote:
>> Author: thomasm
>> Date: Thu Mar 22 16:08:44 2012
>> New Revision: 1303867
>>
>> URL: http://svn.apache.org/viewvc?rev=1303867&view=rev
>> Log:
>> OAK-28 Query implementation (Row.toString(), Filter.toString(),
>>ClassCastException for negative numbers)
>>
>> Removed:
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/PropertyType.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Value.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ValueFactory.java
>> Modified:
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Query.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/QueryEngine.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Row.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/SQL2Parser.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/AstElementFactory.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/BindVariableValueImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ColumnImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ComparisonImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/DynamicOperandImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/EquiJoinConditionImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/FullTextSearchScoreImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LengthImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LiteralImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LowerCaseImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeLocalNameImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeNameImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyExistenceImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyValueImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/SelectorImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/StaticOperandImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/UpperCaseImpl.java
>>
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/index/Filter.java
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Query.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/Query.java?rev=1303867&r1=1303866&r2=1303
>>867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Query.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Query.java Thu Mar 22 16:08:44 2012
>> @@ -18,6 +18,7 @@ import java.util.Arrays;
>>   import java.util.Collections;
>>   import java.util.HashMap;
>>   import java.util.Iterator;
>> +import java.util.List;
>>   import org.apache.jackrabbit.mk.api.MicroKernel;
>>   import org.apache.jackrabbit.oak.query.ast.AstVisitorBase;
>>   import org.apache.jackrabbit.oak.query.ast.BindVariableValueImpl;
>> @@ -52,17 +53,17 @@ public class Query {
>>
>>       final SourceImpl source;
>>       final ConstraintImpl constraint;
>> -    final HashMap<String, Value>  bindVariableMap = new
>>HashMap<String, Value>();
>> +    final HashMap<String, ScalarImpl>  bindVariableMap = new
>>HashMap<String, ScalarImpl>();
>>       final ArrayList<SelectorImpl>  selectors = new
>>ArrayList<SelectorImpl>();
>>
>>       private MicroKernel mk;
>>       private final OrderingImpl[] orderings;
>> -    private final ColumnImpl[] columns;
>> +    private ColumnImpl[] columns;
>>       private boolean explain;
>>       private long limit;
>>       private long offset;
>>       private boolean prepared;
>> -    private final ValueFactory valueFactory = new ValueFactory();
>> +    private final ScalarFactory valueFactory = new ScalarFactory();
>>
>>       Query(SourceImpl source, ConstraintImpl constraint,
>>OrderingImpl[] orderings,
>>               ColumnImpl[] columns) {
>> @@ -235,7 +236,7 @@ public class Query {
>>           return source;
>>       }
>>
>> -    void bindValue(String varName, Value value) {
>> +    void bindValue(String varName, ScalarImpl value) {
>>           bindVariableMap.put(varName, value);
>>       }
>>
>> @@ -251,7 +252,7 @@ public class Query {
>>           this.offset = offset;
>>       }
>>
>> -    public ValueFactory getValueFactory() {
>> +    public ScalarFactory getValueFactory() {
>>           return valueFactory;
>>       }
>>
>> @@ -263,7 +264,8 @@ public class Query {
>>           prepare();
>>           if (explain) {
>>               String plan = source.getPlan();
>> -            Row r = new Row(this, null, new Value[] {
>>valueFactory.createValue(plan) }, null);
>> +            columns = new ColumnImpl[] { new ColumnImpl("explain",
>>"plan", "plan")};
>> +            Row r = new Row(this, new String[0], new ScalarImpl[] {
>>valueFactory.createValue(plan) }, null);
>>               return Arrays.asList(r).iterator();
>>           }
>>           RowIterator it = new RowIterator(revisionId);
>> @@ -280,11 +282,11 @@ public class Query {
>>           return list.iterator();
>>       }
>>
>> -    public int compareRows(Value[] orderValues, Value[] orderValues2) {
>> +    public int compareRows(ScalarImpl[] orderValues, ScalarImpl[]
>>orderValues2) {
>>           int comp = 0;
>>           for (int i = 0, size = orderings.length; i<  size; i++) {
>> -            Value a = orderValues[i];
>> -            Value b = orderValues2[i];
>> +            ScalarImpl a = orderValues[i];
>> +            ScalarImpl b = orderValues2[i];
>>               if (a == null || b == null) {
>>                   if (a == b) {
>>                       comp = 0;
>> @@ -383,17 +385,17 @@ public class Query {
>>               paths[i] = s.currentPath();
>>           }
>>           int columnCount = columns.length;
>> -        Value[] values = new Value[columnCount];
>> +        ScalarImpl[] values = new ScalarImpl[columnCount];
>>           for (int i = 0; i<  columnCount; i++) {
>>               ColumnImpl c = columns[i];
>>               values[i] = c.currentValue();
>>           }
>> -        Value[] orderValues;
>> +        ScalarImpl[] orderValues;
>>           if (orderings == null) {
>>               orderValues = null;
>>           } else {
>>               int size = orderings.length;
>> -            orderValues = new Value[size];
>> +            orderValues = new ScalarImpl[size];
>>               for (int i = 0; i<  size; i++) {
>>                   orderValues[i] =
>>orderings[i].getOperand().currentValue();
>>               }
>> @@ -428,12 +430,16 @@ public class Query {
>>           return offset;
>>       }
>>
>> -    public Value getBindVariableValue(String bindVariableName) {
>> -        Value v = bindVariableMap.get(bindVariableName);
>> +    public ScalarImpl getBindVariableValue(String bindVariableName) {
>> +        ScalarImpl v = bindVariableMap.get(bindVariableName);
>>           if (v == null) {
>>               throw new RuntimeException("Bind variable value not set:
>>" + bindVariableName);
>>           }
>>           return v;
>>       }
>>
>> +    public List<SelectorImpl>  getSelectors() {
>> +        return Collections.unmodifiableList(selectors);
>> +    }
>> +
>>   }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/QueryEngine.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/QueryEngine.java?rev=1303867&r1=1303866&r
>>2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/QueryEngine.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/QueryEngine.java Thu Mar 22 16:08:44 2012
>> @@ -28,7 +28,7 @@ public class QueryEngine {
>>       public static final String SQL2 = "sql2";
>>
>>       private final MicroKernel mk;
>> -    private final ValueFactory vf = new ValueFactory();
>> +    private final ScalarFactory vf = new ScalarFactory();
>>       private final SQL2Parser parserSQL2;
>>
>>       private QueryEngine(MicroKernel mk) {
>> @@ -40,7 +40,7 @@ public class QueryEngine {
>>           return new QueryEngine(mk);
>>       }
>>
>> -    public Iterator<Row>  executeQuery(String language, String query,
>>Map<String, Value>  bindings) throws ParseException {
>> +    public Iterator<Row>  executeQuery(String language, String query,
>>Map<String, ScalarImpl>  bindings) throws ParseException {
>>           Query q;
>>           if (SQL2.equals(language)) {
>>               q = parserSQL2.parse(query);
>> @@ -53,7 +53,7 @@ public class QueryEngine {
>>           }
>>           q.setMicroKernel(mk);
>>           if (bindings != null) {
>> -            for (Entry<String, Value>  e : bindings.entrySet()) {
>> +            for (Entry<String, ScalarImpl>  e : bindings.entrySet()) {
>>                   q.bindValue(e.getKey(), e.getValue());
>>               }
>>           }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Row.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/Row.java?rev=1303867&r1=1303866&r2=130386
>>7&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Row.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/Row.java Thu Mar 22 16:08:44 2012
>> @@ -16,21 +16,25 @@
>>    */
>>   package org.apache.jackrabbit.oak.query;
>>
>> +import org.apache.jackrabbit.oak.query.ast.ColumnImpl;
>> +import org.apache.jackrabbit.oak.query.ast.SelectorImpl;
>> +
>>   /**
>>    * A query result row that keeps all data in memory.
>>    */
>>   public class Row implements Comparable<Row>  {
>>
>> -    private final Query qom;
>> +    private final Query query;
>>       private final String[] paths;
>> -    private final Value[] values;
>> -    private final Value[] orderValues;
>> +    private final ScalarImpl[] values;
>> +    private final ScalarImpl[] orderValues;
>>
>> -    Row(Query qom, String[] paths, Value[] values, Value[]
>>orderValues) {
>> -        this.qom = qom;
>> +    Row(Query query, String[] paths, ScalarImpl[] values, ScalarImpl[]
>>orderValues) {
>> +        this.query = query;
>>           this.paths = paths;
>>           this.values = values;
>>           this.orderValues = orderValues;
>> +        System.out.println(toString());
>>       }
>>
>>       public String getPath() {
>> @@ -41,22 +45,47 @@ public class Row implements Comparable<R
>>       }
>>
>>       public String getPath(String selectorName) {
>> -        return paths[qom.getSelectorIndex(selectorName)];
>> +        int index = query.getSelectorIndex(selectorName);
>> +        if (paths == null || index>= paths.length) {
>> +            return null;
>> +        }
>> +        return paths[index];
>>       }
>>
>> -    public Value getValue(String columnName) {
>> -        return values[qom.getColumnIndex(columnName)];
>> +    public ScalarImpl getValue(String columnName) {
>> +        return values[query.getColumnIndex(columnName)];
>>       }
>>
>> -    public Value[] getValues() {
>> -        Value[] v2 = new Value[values.length];
>> +    public ScalarImpl[] getValues() {
>> +        ScalarImpl[] v2 = new ScalarImpl[values.length];
>>           System.arraycopy(values, 0, v2, 0, v2.length);
>>           return v2;
>>       }
>>
>>       @Override
>>       public int compareTo(Row o) {
>> -        return qom.compareRows(orderValues, o.orderValues);
>> +        return query.compareRows(orderValues, o.orderValues);
>> +    }
>> +
>> +    @Override
>> +    public String toString() {
>> +        StringBuilder buff = new StringBuilder();
>> +        for (SelectorImpl s : query.getSelectors()) {
>> +            String n = s.getSelectorName();
>> +            String p = getPath(n);
>> +            if (p != null) {
>> +                buff.append(n).append(": ").append(p).append(" ");
>> +            }
>> +        }
>> +        ColumnImpl[] cols = query.getColumns();
>> +        for (int i = 0; i<  values.length; i++) {
>> +            ColumnImpl c = cols[i];
>> +            String n = c.getColumnName();
>> +            if (n != null) {
>> +                buff.append(n).append(": ").append(values[i]).append("
>>");
>> +            }
>> +        }
>> +        return buff.toString();
>>       }
>>
>>   }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/SQL2Parser.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/SQL2Parser.java?rev=1303867&r1=1303866&r2
>>=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/SQL2Parser.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/SQL2Parser.java Thu Mar 22 16:08:44 2012
>> @@ -61,7 +61,7 @@ public class SQL2Parser {
>>       private int currentTokenType;
>>       private String currentToken;
>>       private boolean currentTokenQuoted;
>> -    private Value currentValue;
>> +    private ScalarImpl currentValue;
>>       private ArrayList<String>  expected;
>>
>>       // The bind variables
>> @@ -75,14 +75,14 @@ public class SQL2Parser {
>>       private boolean allowNumberLiterals = true;
>>
>>       private final AstElementFactory factory = new AstElementFactory();
>> -    private final ValueFactory valueFactory;
>> +    private final ScalarFactory valueFactory;
>>
>>       /**
>>        * Create a new parser. A parser can be re-used, but it is not
>>thread safe.
>>        *
>>        * @param valueFactory the value factory
>>        */
>> -    public SQL2Parser(ValueFactory valueFactory) {
>> +    public SQL2Parser(ScalarFactory valueFactory) {
>>           this.valueFactory = valueFactory;
>>       }
>>
>> @@ -136,7 +136,7 @@ public class SQL2Parser {
>>       private String readName() throws ParseException {
>>           if (readIf("[")) {
>>               if (currentTokenType == VALUE) {
>> -                Value value = readString();
>> +                ScalarImpl value = readString();
>>                   read("]");
>>                   return value.getString();
>>               } else {
>> @@ -442,16 +442,16 @@ public class SQL2Parser {
>>               }
>>               int valueType = currentValue.getType();
>>               switch (valueType) {
>> -            case PropertyType.LONG:
>> +            case ScalarType.LONG:
>>                   currentValue =
>>valueFactory.createValue(-currentValue.getLong());
>>                   break;
>> -            case PropertyType.DOUBLE:
>> +            case ScalarType.DOUBLE:
>>                   currentValue =
>>valueFactory.createValue(-currentValue.getDouble());
>>                   break;
>> -            case PropertyType.BOOLEAN:
>> +            case ScalarType.BOOLEAN:
>>                   currentValue =
>>valueFactory.createValue(!currentValue.getBoolean());
>>                   break;
>> -            case PropertyType.DECIMAL:
>> +            case ScalarType.DECIMAL:
>>                   currentValue =
>>valueFactory.createValue(currentValue.getDecimal().negate());
>>                   break;
>>               default:
>> @@ -487,7 +487,7 @@ public class SQL2Parser {
>>                   throw getSyntaxError("literal");
>>               }
>>               LiteralImpl literal = (LiteralImpl) op;
>> -            Value value = literal.getLiteralValue();
>> +            ScalarImpl value = literal.getLiteralValue();
>>               read("AS");
>>               value = parseCastAs(value);
>>               read(")");
>> @@ -505,11 +505,11 @@ public class SQL2Parser {
>>        * @param value the original value
>>        * @return the literal
>>        */
>> -    private LiteralImpl getUncastLiteral(Value value) throws
>>ParseException {
>> +    private LiteralImpl getUncastLiteral(ScalarImpl value) throws
>>ParseException {
>>           return factory.literal(value);
>>       }
>>
>> -    private Value parseCastAs(Value value) throws ParseException {
>> +    private ScalarImpl parseCastAs(ScalarImpl value) throws
>>ParseException {
>>           if (readIf("STRING")) {
>>               return valueFactory.createValue(value.getString());
>>           } else if (readIf("BINARY")) {
>> @@ -525,15 +525,15 @@ public class SQL2Parser {
>>           } else if (readIf("BOOLEAN")) {
>>               return valueFactory.createValue(value.getBoolean());
>>           } else if (readIf("NAME")) {
>> -            return valueFactory.createValue(value.getString(),
>>PropertyType.NAME);
>> +            return valueFactory.createValue(value.getString(),
>>ScalarType.NAME);
>>           } else if (readIf("PATH")) {
>> -            return valueFactory.createValue(value.getString(),
>>PropertyType.PATH);
>> +            return valueFactory.createValue(value.getString(),
>>ScalarType.PATH);
>>           } else if (readIf("REFERENCE")) {
>> -            return valueFactory.createValue(value.getString(),
>>PropertyType.REFERENCE);
>> +            return valueFactory.createValue(value.getString(),
>>ScalarType.REFERENCE);
>>           } else if (readIf("WEAKREFERENCE")) {
>> -            return valueFactory.createValue(value.getString(),
>>PropertyType.WEAKREFERENCE);
>> +            return valueFactory.createValue(value.getString(),
>>ScalarType.WEAKREFERENCE);
>>           } else if (readIf("URI")) {
>> -            return valueFactory.createValue(value.getString(),
>>PropertyType.URI);
>> +            return valueFactory.createValue(value.getString(),
>>ScalarType.URI);
>>           } else {
>>               throw getSyntaxError("data type (STRING|BINARY|...)");
>>           }
>> @@ -654,11 +654,11 @@ public class SQL2Parser {
>>           return s;
>>       }
>>
>> -    private Value readString() throws ParseException {
>> +    private ScalarImpl readString() throws ParseException {
>>           if (currentTokenType != VALUE) {
>>               throw getSyntaxError("string value");
>>           }
>> -        Value value = currentValue;
>> +        ScalarImpl value = currentValue;
>>           read();
>>           return value;
>>       }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/AstElementFactory.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/AstElementFactory.java?rev=1303867&r1
>>=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/AstElementFactory.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/AstElementFactory.java Thu Mar 22 16:08:44 2012
>> @@ -13,7 +13,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>
>>   /**
>>    * A factory for syntax tree elements.
>> @@ -84,7 +84,7 @@ public class AstElementFactory {
>>           return new LengthImpl(propertyValue);
>>       }
>>
>> -    public LiteralImpl literal(Value literalValue) {
>> +    public LiteralImpl literal(ScalarImpl literalValue) {
>>           return new LiteralImpl(literalValue);
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/BindVariableValueImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/BindVariableValueImpl.java?rev=130386
>>7&r1=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/BindVariableValueImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/BindVariableValueImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>
>>   public class BindVariableValueImpl extends StaticOperandImpl {
>>
>> @@ -43,7 +43,7 @@ public class BindVariableValueImpl exten
>>       }
>>
>>       @Override
>> -    Value currentValue() {
>> +    ScalarImpl currentValue() {
>>           return query.getBindVariableValue(bindVariableName);
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ColumnImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/ColumnImpl.java?rev=1303867&r1=130386
>>6&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ColumnImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ColumnImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>
>>   public class ColumnImpl extends AstElement {
>>
>> @@ -58,7 +58,7 @@ public class ColumnImpl extends AstEleme
>>           }
>>       }
>>
>> -    public Value currentValue() {
>> +    public ScalarImpl currentValue() {
>>           if (propertyName == null) {
>>               // TODO for SELECT * FROM queries, currently return the
>>path (for testing only)
>>               String p = selector.currentPath();
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ComparisonImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/ComparisonImpl.java?rev=1303867&r1=13
>>03866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ComparisonImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/ComparisonImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,8 +18,8 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> -import org.apache.jackrabbit.oak.query.ValueFactory;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>> +import org.apache.jackrabbit.oak.query.ScalarFactory;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class ComparisonImpl extends ConstraintImpl {
>> @@ -48,8 +48,8 @@ public class ComparisonImpl extends Cons
>>
>>       @Override
>>       public boolean evaluate() {
>> -        Value v1 = operand1.currentValue();
>> -        Value v2 = operand2.currentValue();
>> +        ScalarImpl v1 = operand1.currentValue();
>> +        ScalarImpl v2 = operand2.currentValue();
>>           if (v1 == null || v2 == null) {
>>               // TODO comparison: what about (null<>  x) ?
>>               return false;
>> @@ -71,7 +71,7 @@ public class ComparisonImpl extends Cons
>>           return false;
>>       }
>>
>> -    private static boolean evaluateLike(Value v1, Value v2) {
>> +    private static boolean evaluateLike(ScalarImpl v1, ScalarImpl v2) {
>>           LikePattern like = new LikePattern(v2.getString());
>>           return like.matches(v1.getString());
>>       }
>> @@ -255,7 +255,7 @@ public class ComparisonImpl extends Cons
>>
>>       @Override
>>       public void apply(Filter f) {
>> -        Value v = operand2.currentValue();
>> +        ScalarImpl v = operand2.currentValue();
>>           if (v != null) {
>>               if (operator == Operator.LIKE) {
>>                   String pattern;
>> @@ -266,7 +266,7 @@ public class ComparisonImpl extends Cons
>>                   if (lowerBound == null&&  upperBound == null) {
>>                       // ignore
>>                   } else {
>> -                    ValueFactory vf = query.getValueFactory();
>> +                    ScalarFactory vf = query.getValueFactory();
>>                       if (lowerBound != null) {
>>                           operand1.apply(f, Operator.GREATER_OR_EQUAL,
>>vf.createValue(lowerBound));
>>                       }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/DynamicOperandImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/DynamicOperandImpl.java?rev=1303867&r
>>1=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/DynamicOperandImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/DynamicOperandImpl.java Thu Mar 22 16:08:44 2012
>> @@ -16,13 +16,13 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public abstract class DynamicOperandImpl extends AstElement {
>>
>> -    public abstract Value currentValue();
>> +    public abstract ScalarImpl currentValue();
>>
>> -    public abstract void apply(Filter f, Operator operator, Value v);
>> +    public abstract void apply(Filter f, Operator operator, ScalarImpl
>>v);
>>
>>   }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/EquiJoinConditionImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/EquiJoinConditionImpl.java?rev=130386
>>7&r1=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/EquiJoinConditionImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/EquiJoinConditionImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class EquiJoinConditionImpl extends JoinConditionImpl {
>> @@ -79,19 +79,19 @@ public class EquiJoinConditionImpl exten
>>
>>       @Override
>>       public boolean evaluate() {
>> -        Value v1 = selector1.currentProperty(property1Name);
>> +        ScalarImpl v1 = selector1.currentProperty(property1Name);
>>           if (v1 == null) {
>>               return false;
>>           }
>>           // TODO data type mapping
>> -        Value v2 = selector2.currentProperty(property2Name);
>> +        ScalarImpl v2 = selector2.currentProperty(property2Name);
>>           return v2 != null&&  v1.equals(v2);
>>       }
>>
>>       @Override
>>       public void apply(Filter f) {
>> -        Value v1 = selector1.currentProperty(property1Name);
>> -        Value v2 = selector2.currentProperty(property2Name);
>> +        ScalarImpl v1 = selector1.currentProperty(property1Name);
>> +        ScalarImpl v2 = selector2.currentProperty(property2Name);
>>           if (f.getSelector() == selector1&&  v2 != null) {
>>               f.restrictProperty(property1Name, Operator.EQUAL, v2);
>>           }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/FullTextSearchScoreImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/FullTextSearchScoreImpl.java?rev=1303
>>867&r1=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/FullTextSearchScoreImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/FullTextSearchScoreImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class FullTextSearchScoreImpl extends DynamicOperandImpl {
>> @@ -44,13 +44,13 @@ public class FullTextSearchScoreImpl ext
>>       }
>>
>>       @Override
>> -    public Value currentValue() {
>> +    public ScalarImpl currentValue() {
>>           // TODO support evaluating fulltext conditions (score)
>>           return null;
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // TODO support fulltext index conditions (score)
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LengthImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/LengthImpl.java?rev=1303867&r1=130386
>>6&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LengthImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LengthImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class LengthImpl extends DynamicOperandImpl {
>> @@ -44,8 +44,8 @@ public class LengthImpl extends DynamicO
>>       }
>>
>>       @Override
>> -    public Value currentValue() {
>> -        Value v = propertyValue.currentValue();
>> +    public ScalarImpl currentValue() {
>> +        ScalarImpl v = propertyValue.currentValue();
>>           if (v == null) {
>>               return null;
>>           }
>> @@ -55,7 +55,7 @@ public class LengthImpl extends DynamicO
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // ignore
>>           // TODO LENGTH(x) conditions: can use IS NOT NULL?
>>       }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LiteralImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/LiteralImpl.java?rev=1303867&r1=13038
>>66&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LiteralImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LiteralImpl.java Thu Mar 22 16:08:44 2012
>> @@ -19,18 +19,18 @@
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>>   import org.apache.jackrabbit.oak.query.SQL2Parser;
>> -import org.apache.jackrabbit.oak.query.PropertyType;
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>> +import org.apache.jackrabbit.oak.query.ScalarType;
>>
>>   public class LiteralImpl extends StaticOperandImpl {
>>
>> -    private final Value value;
>> +    private final ScalarImpl value;
>>
>> -    public LiteralImpl(Value value) {
>> +    public LiteralImpl(ScalarImpl value) {
>>           this.value = value;
>>       }
>>
>> -    public Value getLiteralValue() {
>> +    public ScalarImpl getLiteralValue() {
>>           return value;
>>       }
>>
>> @@ -42,28 +42,28 @@ public class LiteralImpl extends StaticO
>>       @Override
>>       public String toString() {
>>           switch (value.getType()) {
>> -        case PropertyType.BINARY:
>> +        case ScalarType.BINARY:
>>               return cast("BINARY");
>> -        case PropertyType.BOOLEAN:
>> +        case ScalarType.BOOLEAN:
>>               return cast("BOOLEAN");
>> -        case PropertyType.DATE:
>> +        case ScalarType.DATE:
>>               return cast("DATE");
>> -        case PropertyType.DECIMAL:
>> +        case ScalarType.DECIMAL:
>>               return cast("DECIMAL");
>> -        case PropertyType.DOUBLE:
>> -        case PropertyType.LONG:
>> +        case ScalarType.DOUBLE:
>> +        case ScalarType.LONG:
>>               return value.getString();
>> -        case PropertyType.NAME:
>> +        case ScalarType.NAME:
>>               return cast("NAME");
>> -        case PropertyType.PATH:
>> +        case ScalarType.PATH:
>>               return cast("PATH");
>> -        case PropertyType.REFERENCE:
>> +        case ScalarType.REFERENCE:
>>               return cast("REFERENCE");
>> -        case PropertyType.STRING:
>> +        case ScalarType.STRING:
>>               return escape();
>> -        case PropertyType.URI:
>> +        case ScalarType.URI:
>>               return cast("URI");
>> -        case PropertyType.WEAKREFERENCE:
>> +        case ScalarType.WEAKREFERENCE:
>>               return cast("WEAKREFERENCE");
>>           default:
>>               return escape();
>> @@ -79,7 +79,7 @@ public class LiteralImpl extends StaticO
>>       }
>>
>>       @Override
>> -    Value currentValue() {
>> +    ScalarImpl currentValue() {
>>           return value;
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LowerCaseImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/LowerCaseImpl.java?rev=1303867&r1=130
>>3866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LowerCaseImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/LowerCaseImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class LowerCaseImpl extends DynamicOperandImpl {
>> @@ -44,8 +44,8 @@ public class LowerCaseImpl extends Dynam
>>       }
>>
>>       @Override
>> -    public Value currentValue() {
>> -        Value v = operand.currentValue();
>> +    public ScalarImpl currentValue() {
>> +        ScalarImpl v = operand.currentValue();
>>           if (v == null) {
>>               return null;
>>           }
>> @@ -54,7 +54,7 @@ public class LowerCaseImpl extends Dynam
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // ignore
>>           // TODO UPPER(x) conditions: can use IS NOT NULL?
>>       }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeLocalNameImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/NodeLocalNameImpl.java?rev=1303867&r1
>>=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeLocalNameImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeLocalNameImpl.java Thu Mar 22 16:08:44 2012
>> @@ -19,7 +19,7 @@
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>>   import org.apache.jackrabbit.mk.util.PathUtils;
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class NodeLocalNameImpl extends DynamicOperandImpl {
>> @@ -53,7 +53,7 @@ public class NodeLocalNameImpl extends D
>>       }
>>
>>       @Override
>> -    public  Value currentValue() {
>> +    public  ScalarImpl currentValue() {
>>           String name = PathUtils.getName(selector.currentPath());
>>           int colon = name.indexOf(':');
>>           // TODO LOCALNAME: evaluation of local name might not be
>>correct
>> @@ -62,7 +62,7 @@ public class NodeLocalNameImpl extends D
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // TODO support LOCALNAME index conditions
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeNameImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/NodeNameImpl.java?rev=1303867&r1=1303
>>866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeNameImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/NodeNameImpl.java Thu Mar 22 16:08:44 2012
>> @@ -19,7 +19,7 @@
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>>   import org.apache.jackrabbit.mk.util.PathUtils;
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class NodeNameImpl extends DynamicOperandImpl {
>> @@ -53,13 +53,13 @@ public class NodeNameImpl extends Dynami
>>       }
>>
>>       @Override
>> -    public  Value currentValue() {
>> +    public  ScalarImpl currentValue() {
>>           String name = PathUtils.getName(selector.currentPath());
>>           return query.getValueFactory().createValue(name);
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // TODO support NAME(..) index conditions
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyExistenceImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/PropertyExistenceImpl.java?rev=130386
>>7&r1=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyExistenceImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyExistenceImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class PropertyExistenceImpl extends ConstraintImpl {
>> @@ -42,7 +42,7 @@ public class PropertyExistenceImpl exten
>>
>>       @Override
>>       public boolean evaluate() {
>> -        Value v = selector.currentProperty(propertyName);
>> +        ScalarImpl v = selector.currentProperty(propertyName);
>>           return v != null;
>>       }
>>
>> @@ -67,7 +67,7 @@ public class PropertyExistenceImpl exten
>>       @Override
>>       public void apply(Filter f) {
>>           if (f.getSelector() == selector) {
>> -            f.restrictProperty(propertyName, Operator.NOT_EQUAL,
>>(Value) null);
>> +            f.restrictProperty(propertyName, Operator.NOT_EQUAL,
>>(ScalarImpl) null);
>>           }
>>       }
>>
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyValueImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/PropertyValueImpl.java?rev=1303867&r1
>>=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyValueImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/PropertyValueImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class PropertyValueImpl extends DynamicOperandImpl {
>> @@ -52,7 +52,7 @@ public class PropertyValueImpl extends D
>>       }
>>
>>       @Override
>> -    public Value currentValue() {
>> +    public ScalarImpl currentValue() {
>>           return selector.currentProperty(propertyName);
>>       }
>>
>> @@ -64,7 +64,7 @@ public class PropertyValueImpl extends D
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           if (f.getSelector() == selector) {
>>               f.restrictProperty(propertyName, operator, v);
>>           }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/SelectorImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/SelectorImpl.java?rev=1303867&r1=1303
>>866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/SelectorImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/SelectorImpl.java Thu Mar 22 16:08:44 2012
>> @@ -22,7 +22,7 @@ import org.apache.jackrabbit.mk.api.Micr
>>   import org.apache.jackrabbit.mk.json.JsopTokenizer;
>>   import org.apache.jackrabbit.mk.simple.NodeImpl;
>>   import org.apache.jackrabbit.oak.query.Query;
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Cursor;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>   import org.apache.jackrabbit.oak.query.index.NodeReader;
>> @@ -30,6 +30,7 @@ import org.apache.jackrabbit.oak.query.i
>>
>>   public class SelectorImpl extends SourceImpl {
>>
>> +    // TODO jcr:path isn't an official feature, support it?
>>       private static final String PATH = "jcr:path";
>>
>>       protected NodeReader reader;
>> @@ -107,7 +108,7 @@ public class SelectorImpl extends Source
>>           return cursor == null ? null : cursor.currentNode();
>>       }
>>
>> -    public Value currentProperty(String propertyName) {
>> +    public ScalarImpl currentProperty(String propertyName) {
>>           if (propertyName.equals(PATH)) {
>>               String p = currentPath();
>>               return p == null ? null :
>>query.getValueFactory().createValue(p);
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/StaticOperandImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/StaticOperandImpl.java?rev=1303867&r1
>>=1303866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/StaticOperandImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/StaticOperandImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,10 +18,10 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>
>>   public abstract class StaticOperandImpl extends AstElement {
>>
>> -    abstract Value currentValue();
>> +    abstract ScalarImpl currentValue();
>>
>>   }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/UpperCaseImpl.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/ast/UpperCaseImpl.java?rev=1303867&r1=130
>>3866&r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/UpperCaseImpl.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/ast/UpperCaseImpl.java Thu Mar 22 16:08:44 2012
>> @@ -18,7 +18,7 @@
>>    */
>>   package org.apache.jackrabbit.oak.query.ast;
>>
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.index.Filter;
>>
>>   public class UpperCaseImpl extends DynamicOperandImpl {
>> @@ -44,8 +44,8 @@ public class UpperCaseImpl extends Dynam
>>       }
>>
>>       @Override
>> -    public Value currentValue() {
>> -        Value v = operand.currentValue();
>> +    public ScalarImpl currentValue() {
>> +        ScalarImpl v = operand.currentValue();
>>           if (v == null) {
>>               return null;
>>           }
>> @@ -54,7 +54,7 @@ public class UpperCaseImpl extends Dynam
>>       }
>>
>>       @Override
>> -    public void apply(Filter f, Operator operator, Value v) {
>> +    public void apply(Filter f, Operator operator, ScalarImpl v) {
>>           // ignore
>>           // TODO UPPER(x) conditions: can use IS NOT NULL?
>>       }
>>
>> Modified:
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/index/Filter.java
>> URL:
>>http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/
>>org/apache/jackrabbit/oak/query/index/Filter.java?rev=1303867&r1=1303866&
>>r2=1303867&view=diff
>>
>>=========================================================================
>>=====
>> ---
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/index/Filter.java (original)
>> +++
>>jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/que
>>ry/index/Filter.java Thu Mar 22 16:08:44 2012
>> @@ -19,8 +19,9 @@
>>   package org.apache.jackrabbit.oak.query.index;
>>
>>   import java.util.HashMap;
>> +import java.util.Map.Entry;
>>   import org.apache.jackrabbit.mk.util.PathUtils;
>> -import org.apache.jackrabbit.oak.query.Value;
>> +import org.apache.jackrabbit.oak.query.ScalarImpl;
>>   import org.apache.jackrabbit.oak.query.ast.Operator;
>>   import org.apache.jackrabbit.oak.query.ast.SelectorImpl;
>>
>> @@ -106,7 +107,7 @@ public class Filter {
>>           /**
>>            * The first value to read, or null to read from the
>>beginning.
>>            */
>> -        public Value first;
>> +        public ScalarImpl first;
>>
>>           /**
>>            * Whether values that match the first should be returned.
>> @@ -116,7 +117,7 @@ public class Filter {
>>           /**
>>            * The last value to read, or null to read until the end.
>>            */
>> -        public Value last;
>> +        public ScalarImpl last;
>>
>>           /**
>>            * Whether values that match the last should be returned.
>> @@ -228,14 +229,14 @@ public class Filter {
>>           }
>>       }
>>
>> -    public void restrictProperty(String propertyName, Operator op,
>>Value value) {
>> +    public void restrictProperty(String propertyName, Operator op,
>>ScalarImpl value) {
>>           PropertyRestriction x =
>>propertyRestrictions.get(propertyName);
>>           if (x == null) {
>>               x = new PropertyRestriction();
>>               x.propertyName = propertyName;
>>               propertyRestrictions.put(propertyName, x);
>>           }
>> -        Value oldFirst = x.first, oldLast = x.last;
>> +        ScalarImpl oldFirst = x.first, oldLast = x.last;
>>           switch (op) {
>>           case EQUAL:
>>               x.first = maxValue(oldFirst, value);
>> @@ -276,20 +277,33 @@ public class Filter {
>>           }
>>       }
>>
>> -    static Value maxValue(Value a, Value b) {
>> +    static ScalarImpl maxValue(ScalarImpl a, ScalarImpl b) {
>>           if (a == null) {
>>               return b;
>>           }
>>           return a.compareTo(b)<  0 ? b : a;
>>       }
>>
>> -    static Value minValue(Value a, Value b) {
>> +    static ScalarImpl minValue(ScalarImpl a, ScalarImpl b) {
>>           if (a == null) {
>>               return b;
>>           }
>>           return a.compareTo(b)<  0 ? a : b;
>>       }
>>
>> +    @Override
>> +    public String toString() {
>> +        StringBuilder buff = new StringBuilder();
>> +        if (alwaysFalse) {
>> +            return "(always false)";
>> +        }
>> +        buff.append("path:
>>").append(path).append(pathRestriction).append('\n');
>> +        for (Entry<String, PropertyRestriction>  p :
>>propertyRestrictions.entrySet()) {
>> +            buff.append("property ").append(p.getKey()).append(":
>>").append(p.getValue()).append('\n');
>> +        }
>> +        return buff.toString();
>> +    }
>> +
>>       public void restrictPath(String addedPath, PathRestriction
>>addedPathRestriction) {
>>           // calculating the intersection of path restrictions
>>           // this is ugly code, but I don't currently see a radically
>>simpler method
>>
>>


Mime
View raw message