jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1303863 - in /jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query: ScalarFactory.java ScalarImpl.java ScalarType.java
Date Thu, 22 Mar 2012 16:04:27 GMT
Author: thomasm
Date: Thu Mar 22 16:04:27 2012
New Revision: 1303863

URL: http://svn.apache.org/viewvc?rev=1303863&view=rev
Log:
OAK-33 Values in oak-core (within the query engine)

Added:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarFactory.java
      - copied, changed from r1302981, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ValueFactory.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarImpl.java
      - copied, changed from r1303394, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Value.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarType.java
      - copied, changed from r1302981, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/PropertyType.java

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarFactory.java
(from r1302981, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ValueFactory.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarFactory.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarFactory.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ValueFactory.java&r1=1302981&r2=1303863&rev=1303863&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ValueFactory.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarFactory.java
Thu Mar 22 16:04:27 2012
@@ -18,30 +18,30 @@ package org.apache.jackrabbit.oak.query;
 
 import java.math.BigDecimal;
 
-public class ValueFactory {
+public class ScalarFactory {
 
-    public Value createValue(String value) {
-        return new Value(value, PropertyType.STRING);
+    public ScalarImpl createValue(String value) {
+        return new ScalarImpl(value, ScalarType.STRING);
     }
 
-    public Value createValue(BigDecimal value) {
-        return new Value(value, PropertyType.DECIMAL);
+    public ScalarImpl createValue(BigDecimal value) {
+        return new ScalarImpl(value, ScalarType.DECIMAL);
     }
 
-    public Value createValue(double value) {
-        return new Value(value, PropertyType.DOUBLE);
+    public ScalarImpl createValue(double value) {
+        return new ScalarImpl(value, ScalarType.DOUBLE);
     }
 
-    public Value createValue(long value) {
-        return new Value(value, PropertyType.DECIMAL);
+    public ScalarImpl createValue(long value) {
+        return new ScalarImpl(value, ScalarType.LONG);
     }
 
-    public Value createValue(boolean value) {
-        return new Value(value, PropertyType.BOOLEAN);
+    public ScalarImpl createValue(boolean value) {
+        return new ScalarImpl(value, ScalarType.BOOLEAN);
     }
 
-    public Value createValue(String value, int type) {
-        return new Value(value, type);
+    public ScalarImpl createValue(String value, int type) {
+        return new ScalarImpl(value, type);
     }
 
 }

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarImpl.java
(from r1303394, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Value.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarImpl.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarImpl.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Value.java&r1=1303394&r2=1303863&rev=1303863&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/Value.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarImpl.java
Thu Mar 22 16:04:27 2012
@@ -16,17 +16,14 @@
  */
 package org.apache.jackrabbit.oak.query;
 
-import java.io.InputStream;
 import java.math.BigDecimal;
 
-import org.apache.jackrabbit.oak.api.Scalar;
-
-public class Value implements Scalar, Comparable<Value> {
+public class ScalarImpl implements Comparable<ScalarImpl> {
 
     private final Object value;
     private final int type;
 
-    public Value(Object value, int type) {
+    public ScalarImpl(Object value, int type) {
         this.value = value;
         this.type = type;
     }
@@ -64,10 +61,6 @@ public class Value implements Scalar, Co
         return value.toString();
     }
 
-    public InputStream getInputStream() {
-        throw new UnsupportedOperationException(); // TODO
-    }
-
     public String getDate() {
         // TODO convert?
         return value.toString();
@@ -83,15 +76,15 @@ public class Value implements Scalar, Co
         if (this == o) {
             return true;
         }
-        if (!(o instanceof Value)) {
+        if (!(o instanceof ScalarImpl)) {
             return false;
         }
-        Value v = (Value) o;
+        ScalarImpl v = (ScalarImpl) o;
         return type == v.type && value.equals(v.value);
     }
 
     @Override
-    public int compareTo(Value o) {
+    public int compareTo(ScalarImpl o) {
         if (this == o) {
             return 0;
         }
@@ -100,13 +93,13 @@ public class Value implements Scalar, Co
             return type - o.type;
         }
         switch (type) {
-        case PropertyType.LONG:
+        case ScalarType.LONG:
             return ((Long) value).compareTo((Long) o.value);
-        case PropertyType.DOUBLE:
+        case ScalarType.DOUBLE:
             return ((Double) value).compareTo((Double) o.value);
-        case PropertyType.DECIMAL:
+        case ScalarType.DECIMAL:
             return ((BigDecimal) value).compareTo((BigDecimal) o.value);
-        case PropertyType.BOOLEAN:
+        case ScalarType.BOOLEAN:
             return ((Boolean) value).compareTo((Boolean) o.value);
         }
         return value.toString().compareTo(o.toString());

Copied: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarType.java
(from r1302981, jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/PropertyType.java)
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarType.java?p2=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarType.java&p1=jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/PropertyType.java&r1=1302981&r2=1303863&rev=1303863&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/PropertyType.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/query/ScalarType.java
Thu Mar 22 16:04:27 2012
@@ -16,7 +16,10 @@
  */
 package org.apache.jackrabbit.oak.query;
 
-public class PropertyType {
+/**
+ * The data type of a scalar instance.
+ */
+public class ScalarType {
 
     public static final int UNDEFINED = 0;
     public static final int STRING = 1;



Mime
View raw message