jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thom...@apache.org
Subject svn commit: r1330799 - in /jackrabbit/oak/trunk/oak-mk/src: main/java/org/apache/jackrabbit/mk/core/ main/java/org/apache/jackrabbit/mk/json/ test/java/org/apache/jackrabbit/mk/ test/java/org/apache/jackrabbit/mk/json/ test/java/org/apache/jackrabbit/m...
Date Thu, 26 Apr 2012 12:11:23 GMT
Author: thomasm
Date: Thu Apr 26 12:11:22 2012
New Revision: 1330799

URL: http://svn.apache.org/viewvc?rev=1330799&view=rev
Log:
OAK-73 JsopReader and JsopWriter lack javadocs

Modified:
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopReader.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
    jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopWriter.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteIT.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
    jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/core/MicroKernelImpl.java
Thu Apr 26 12:11:22 2012
@@ -23,6 +23,7 @@ import java.util.List;
 import org.apache.jackrabbit.mk.api.MicroKernel;
 import org.apache.jackrabbit.mk.api.MicroKernelException;
 import org.apache.jackrabbit.mk.json.JsopBuilder;
+import org.apache.jackrabbit.mk.json.JsopReader;
 import org.apache.jackrabbit.mk.json.JsopTokenizer;
 import org.apache.jackrabbit.mk.model.ChildNodeEntry;
 import org.apache.jackrabbit.mk.model.Commit;
@@ -60,7 +61,7 @@ public class MicroKernelImpl implements 
 
     /**
      * Alternate constructor, used for testing.
-     * 
+     *
      * @param rep repository, already initialized
      */
     public MicroKernelImpl(Repository rep) {
@@ -94,10 +95,10 @@ public class MicroKernelImpl implements 
         }
         return getHeadRevisionId().toString();
     }
-    
+
     /**
      * Same as {@code getHeadRevisionId}, with typed {@code Id} return value instead of string.
-     * 
+     *
      * @see #getHeadRevision()
      */
     private Id getHeadRevisionId() throws MicroKernelException {
@@ -244,7 +245,7 @@ public class MicroKernelImpl implements 
             throw new MicroKernelException(e);
         }
     }
-    
+
     public boolean nodeExists(String path, String revisionId) throws MicroKernelException
{
         if (rep == null) {
             throw new IllegalStateException("this instance has already been disposed");
@@ -319,7 +320,7 @@ public class MicroKernelImpl implements 
             CommitBuilder cb = rep.getCommitBuilder(revId, message);
             while (true) {
                 int r = t.read();
-                if (r == JsopTokenizer.END) {
+                if (r == JsopReader.END) {
                     break;
                 }
                 int pos; // used for error reporting
@@ -338,7 +339,7 @@ public class MicroKernelImpl implements 
                             cb.addNode(parentPath, nodeName, parseNode(t));
                         } else {
                             String value;
-                            if (t.matches(JsopTokenizer.NULL)) {
+                            if (t.matches(JsopReader.NULL)) {
                                 value = null;
                             } else {
                                 value = t.readRawValue().trim();
@@ -368,7 +369,7 @@ public class MicroKernelImpl implements 
                         String subPath = t.readString();
                         t.read(':');
                         String value;
-                        if (t.matches(JsopTokenizer.NULL)) {
+                        if (t.matches(JsopReader.NULL)) {
                             value = null;
                         } else {
                             value = t.readRawValue().trim();
@@ -521,7 +522,7 @@ public class MicroKernelImpl implements 
             }
         }
     }
-    
+
     NodeTree parseNode(JsopTokenizer t) throws Exception {
         NodeTree node = new NodeTree();
         if (!t.matches('}')) {

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopBuilder.java
Thu Apr 26 12:11:22 2012
@@ -16,7 +16,6 @@
  */
 package org.apache.jackrabbit.mk.json;
 
-
 /**
  * A builder for Json and Jsop strings. It encodes string values, and knows when
  * a comma is needed. A comma is appended before '{', '[', a value, or a key;
@@ -337,7 +336,7 @@ public class JsopBuilder implements Jsop
         JsopTokenizer t = new JsopTokenizer(jsop);
         while (true) {
             prettyPrint(buff, t, "  ");
-            if (t.getTokenType() == JsopTokenizer.END) {
+            if (t.getTokenType() == JsopReader.END) {
                 return buff.toString();
             }
         }
@@ -349,17 +348,17 @@ public class JsopBuilder implements Jsop
         while (true) {
             int token = t.read();
             switch (token) {
-                case JsopTokenizer.END:
+                case JsopReader.END:
                     return buff.toString();
-                case JsopTokenizer.STRING:
+                case JsopReader.STRING:
                     buff.append('\"').append(t.getEscapedToken()).append('\"');
                     break;
-                case JsopTokenizer.NUMBER:
-                case JsopTokenizer.TRUE:
-                case JsopTokenizer.FALSE:
-                case JsopTokenizer.NULL:
-                case JsopTokenizer.IDENTIFIER:
-                case JsopTokenizer.ERROR:
+                case JsopReader.NUMBER:
+                case JsopReader.TRUE:
+                case JsopReader.FALSE:
+                case JsopReader.NULL:
+                case JsopReader.IDENTIFIER:
+                case JsopReader.ERROR:
                     buff.append(t.getEscapedToken());
                     break;
                 case '{':

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopReader.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopReader.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopReader.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopReader.java
Thu Apr 26 12:11:22 2012
@@ -16,22 +16,111 @@
  */
 package org.apache.jackrabbit.mk.json;
 
+/**
+ * A reader for Json and Jsop strings.
+ */
 public interface JsopReader {
 
+    /**
+     * The token type that signals the end of the stream.
+     */
+    public static final int END = 0;
+
+    /**
+     * The token type of a string value.
+     */
+    public static final int STRING = 1;
+
+    /**
+     * The token type of a number value.
+     */
+    public static final int NUMBER = 2;
+
+    /**
+     * The token type of the value "true".
+     */
+    public static final int TRUE = 3;
+
+    /**
+     * The token type of the value "false".
+     */
+    public static final int FALSE = 4;
+
+    /**
+     * The token type of "null".
+     */
+    public static final int NULL = 5;
+
+    /**
+     * The token type of a parse error.
+     */
+    public static final int ERROR = 6;
+
+    /**
+     * The token type of an identifier (an unquoted string), if supported by the reader.
+     */
+    public static final int IDENTIFIER = 7;
+
+    /**
+     * The token type of a comment, if supported by the reader.
+     */
+    public static final int COMMENT = 8;
+
+    /**
+     * Read a token which must match a given token type.
+     *
+     * @param type the token type
+     * @return the token (a null object when reading a null value)
+     * @throws IllegalStateException if the token type doesn't match
+     */
     String read(int type);
 
+    /**
+     * Read a string.
+     *
+     * @return the de-escaped string
+     * @throws IllegalStateException if the token type doesn't match
+     */
     String readString();
 
+    /**
+     * Read a token and return the token type.
+     *
+     * @return the token type
+     */
     int read();
 
+    /**
+     * Read a token which must match a given token type.
+     *
+     * @param type the token type
+     * @return true if there was a match
+     */
     boolean matches(int type);
 
     String readRawValue();
 
+    /**
+     * Get the last token value if the the token type was STRING or NUMBER. For
+     * STRING, the text is decoded; for NUMBER, it is returned as parsed. In all
+     * other cases the result is undefined.
+     *
+     * @return the token
+     */
     String getToken();
 
+    /**
+     * Get the token type of the last token. The token type is one of the known
+     * types (END, STRING, NUMBER,...), or, for Jsop tags such as "+", "-",
+     * it is the Unicode character code of the tag.
+     *
+     * @return the token type
+     */
     int getTokenType();
 
+    /**
+     * Reset the position to 0, so that to restart reading.
+     */
     void resetReader();
 
 }

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopStream.java
Thu Apr 26 12:11:22 2012
@@ -33,10 +33,10 @@ public class JsopStream implements JsopR
         for (int i = s.pos; i < s.len; i++) {
             int token = s.tokens[i];
             switch (token & 255) {
-            case JsopTokenizer.STRING:
-            case JsopTokenizer.NUMBER:
-            case JsopTokenizer.IDENTIFIER:
-            case JsopTokenizer.COMMENT:
+            case JsopReader.STRING:
+            case JsopReader.NUMBER:
+            case JsopReader.IDENTIFIER:
+            case JsopReader.COMMENT:
                 Object o = s.values[token >> 8];
                 addToken((token & 255) + addValue(o));
                 break;
@@ -89,7 +89,7 @@ public class JsopStream implements JsopR
 
     public JsopStream encodedValue(String raw) {
         optionalComma();
-        addToken(JsopTokenizer.COMMENT + addValue(raw));
+        addToken(JsopReader.COMMENT + addValue(raw));
         needComma = true;
         return this;
     }
@@ -108,7 +108,7 @@ public class JsopStream implements JsopR
 
     public JsopStream key(String key) {
         optionalComma();
-        addToken(JsopTokenizer.STRING + addValue(key));
+        addToken(JsopReader.STRING + addValue(key));
         addToken(':');
         needComma = false;
         return this;
@@ -129,9 +129,9 @@ public class JsopStream implements JsopR
     public JsopStream value(String value) {
         optionalComma();
         if (value == null) {
-            addToken(JsopTokenizer.NULL);
+            addToken(JsopReader.NULL);
         } else {
-            addToken(JsopTokenizer.STRING + addValue(value));
+            addToken(JsopReader.STRING + addValue(value));
         }
         needComma = true;
         return this;
@@ -139,14 +139,14 @@ public class JsopStream implements JsopR
 
     public JsopStream value(long x) {
         optionalComma();
-        addToken(JsopTokenizer.NUMBER + addValue(Long.valueOf(x)));
+        addToken(JsopReader.NUMBER + addValue(Long.valueOf(x)));
         needComma = true;
         return this;
     }
 
     public JsopStream value(boolean b) {
         optionalComma();
-        addToken(b ? JsopTokenizer.TRUE : JsopTokenizer.FALSE);
+        addToken(b ? JsopReader.TRUE : JsopReader.FALSE);
         needComma = true;
         return this;
     }
@@ -175,16 +175,16 @@ public class JsopStream implements JsopR
     public String getToken() {
         int x = tokens[lastPos];
         switch (x & 255) {
-        case JsopTokenizer.STRING:
-        case JsopTokenizer.NUMBER:
-        case JsopTokenizer.IDENTIFIER:
-        case JsopTokenizer.COMMENT:
+        case JsopReader.STRING:
+        case JsopReader.NUMBER:
+        case JsopReader.IDENTIFIER:
+        case JsopReader.COMMENT:
             return values[x >> 8].toString();
-        case JsopTokenizer.TRUE:
+        case JsopReader.TRUE:
             return "true";
-        case JsopTokenizer.FALSE:
+        case JsopReader.FALSE:
             return "false";
-        case JsopTokenizer.NULL:
+        case JsopReader.NULL:
             return "null";
         }
         return Character.toString((char) (x & 255));
@@ -236,17 +236,17 @@ public class JsopStream implements JsopR
         int x = tokens[pos];
         lastPos = pos++;
         switch (x & 255) {
-        case JsopTokenizer.COMMENT:
-        case JsopTokenizer.NUMBER:
-        case JsopTokenizer.IDENTIFIER:
+        case JsopReader.COMMENT:
+        case JsopReader.NUMBER:
+        case JsopReader.IDENTIFIER:
             return values[x >> 8].toString();
-        case JsopTokenizer.STRING:
+        case JsopReader.STRING:
             return JsopBuilder.encode(values[x >> 8].toString());
-        case JsopTokenizer.TRUE:
+        case JsopReader.TRUE:
             return "true";
-        case JsopTokenizer.FALSE:
+        case JsopReader.FALSE:
             return "false";
-        case JsopTokenizer.NULL:
+        case JsopReader.NULL:
             return "null";
         case '[':
             StringBuilder buff = new StringBuilder();
@@ -264,7 +264,7 @@ public class JsopStream implements JsopR
     }
 
     public String readString() {
-        return read(JsopTokenizer.STRING);
+        return read(JsopReader.STRING);
     }
 
     public String toString() {
@@ -284,21 +284,21 @@ public class JsopStream implements JsopR
             case ']':
                 buff.endArray();
                 break;
-            case JsopTokenizer.STRING:
+            case JsopReader.STRING:
                 buff.value(values[x >> 8].toString());
                 break;
-            case JsopTokenizer.TRUE:
+            case JsopReader.TRUE:
                 buff.value(true);
                 break;
-            case JsopTokenizer.FALSE:
+            case JsopReader.FALSE:
                 buff.value(false);
                 break;
-            case JsopTokenizer.NULL:
+            case JsopReader.NULL:
                 buff.value(null);
                 break;
-            case JsopTokenizer.IDENTIFIER:
-            case JsopTokenizer.NUMBER:
-            case JsopTokenizer.COMMENT:
+            case JsopReader.IDENTIFIER:
+            case JsopReader.NUMBER:
+            case JsopReader.COMMENT:
                 buff.encodedValue(values[x >> 8].toString());
                 break;
             default:

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopTokenizer.java
Thu Apr 26 12:11:22 2012
@@ -21,9 +21,6 @@ package org.apache.jackrabbit.mk.json;
  */
 public class JsopTokenizer implements JsopReader {
 
-    public static final int END = 0, STRING = 1, NUMBER = 2, TRUE = 3, FALSE = 4, NULL =
5;
-    public static final int ERROR = 6, IDENTIFIER = 7, COMMENT = 8;
-
     private static final String[] TYPE = {
             "end", "string", "number", "true", "false", "null", "error"
     };

Modified: jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopWriter.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopWriter.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopWriter.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/main/java/org/apache/jackrabbit/mk/json/JsopWriter.java
Thu Apr 26 12:11:22 2012
@@ -16,34 +16,118 @@
  */
 package org.apache.jackrabbit.mk.json;
 
+/**
+ * A builder for Json and Json diff strings. It knows when a comma is needed. A
+ * comma is appended before '{', '[', a value, or a key; but only if the last
+ * appended token was '}', ']', or a value. There is no limit to the number of
+ * nesting levels.
+ */
 public interface JsopWriter {
 
+    /**
+     * Append '['. A comma is appended first if needed.
+     *
+     * @return this
+     */
     JsopWriter array();
 
+    /**
+     * Append '{'. A comma is appended first if needed.
+     *
+     * @return this
+     */
     JsopWriter object();
 
+    /**
+     * Append the key (in quotes) plus a colon. A comma is appended first if
+     * needed.
+     *
+     * @param name the key
+     * @return this
+     */
     JsopWriter key(String key);
 
+    /**
+     * Append a string or null. A comma is appended first if needed.
+     *
+     * @param value the value
+     * @return this
+     */
     JsopWriter value(String value);
 
+    /**
+     * Append an already encoded value. A comma is appended first if needed.
+     *
+     * @param value the value
+     * @return this
+     */
     JsopWriter encodedValue(String raw);
 
+    /**
+     * Append '}'.
+     *
+     * @return this
+     */
     JsopWriter endObject();
 
+    /**
+     * Append ']'.
+     *
+     * @return this
+     */
     JsopWriter endArray();
 
+    /**
+     * Append a Jsop tag character.
+     *
+     * @param tag the string to append
+     * @return this
+     */
     JsopWriter tag(char tag);
 
+    /**
+     * Append all entries of the given buffer.
+     *
+     * @param buffer the buffer
+     * @return this
+     */
     JsopWriter append(JsopWriter diff);
 
+    /**
+     * Append a number. A comma is appended first if needed.
+     *
+     * @param value the value
+     * @return this
+     */
     JsopWriter value(long x);
 
+    /**
+     * Append the boolean value 'true' or 'false'. A comma is appended first if
+     * needed.
+     *
+     * @param value the value
+     * @return this
+     */
     JsopWriter value(boolean b);
 
+    /**
+     * Append a newline character.
+     *
+     * @return this
+     */
     JsopWriter newline();
 
+    /**
+     * Resets this instance, so that all data is discarded.
+     */
     void resetWriter();
 
-    void setLineLength(int i);
+    /**
+     * Set the line length, after which a newline is added (to improve
+     * readability).
+     *
+     * @param length the length
+     */
+    void setLineLength(int length);
 
 }

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteIT.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteIT.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteIT.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/ConcurrentWriteIT.java
Thu Apr 26 12:11:22 2012
@@ -52,7 +52,7 @@ public class ConcurrentWriteIT extends T
             assertFalse(mk.nodeExists(TEST_PATH + "/" + thread.getName(), null));
         }
 
-        long t0 = System.currentTimeMillis();
+        // long t0 = System.currentTimeMillis();
 
         for (TestThread t : threads) {
             if (t != null) {
@@ -61,7 +61,7 @@ public class ConcurrentWriteIT extends T
             }
         }
 
-        long t1 = System.currentTimeMillis();
+        // long t1 = System.currentTimeMillis();
         // System.out.println("duration: " + (t1 - t0) + "ms");
 
         for (Thread t : threads) {

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopStreamTest.java
Thu Apr 26 12:11:22 2012
@@ -34,7 +34,7 @@ public class JsopStreamTest extends Test
                     w.resetWriter();
                 }
             }
-            // System.out.println(w.getClass() + ": " + timer.seconds());
+            System.out.println(w.getClass() + ": " + timer.seconds());
         }
         // JsopStream: 20
         // JsopBuilder: 1150
@@ -60,14 +60,14 @@ public class JsopStreamTest extends Test
         for (int i = 0; i < 3; i++) {
             assertFalse(s.matches('-'));
             assertTrue(s.matches('+'));
-            assertEquals("x", s.read(JsopTokenizer.STRING));
+            assertEquals("x", s.read(JsopReader.STRING));
             s.read(':');
             assertEquals("{", s.read('{'));
             assertEquals("y", s.readString());
             s.read(':');
             assertEquals("[1,[],2]", s.readRawValue());
             s.read('}');
-            s.read(JsopTokenizer.END);
+            s.read(JsopReader.END);
             s.resetReader();
         }
     }
@@ -83,7 +83,7 @@ public class JsopStreamTest extends Test
         assertEquals("+\"x\":{\"y\":1,\"n\":\"\",\"z\":n10}", s.toString());
         assertFalse(s.matches('-'));
         assertTrue(s.matches('+'));
-        assertEquals("x", s.read(JsopTokenizer.STRING));
+        assertEquals("x", s.read(JsopReader.STRING));
         try {
             s.read('}');
             fail();
@@ -134,7 +134,7 @@ public class JsopStreamTest extends Test
         StringBuilder buff = new StringBuilder();
         while (true) {
             prettyPrint(buff, t, "  ");
-            if (t.getTokenType() == JsopTokenizer.END) {
+            if (t.getTokenType() == JsopReader.END) {
                 return buff.toString();
             }
         }
@@ -146,17 +146,17 @@ public class JsopStreamTest extends Test
         while (true) {
             int token = t.read();
             switch (token) {
-                case JsopTokenizer.END:
+                case JsopReader.END:
                     return buff.toString();
-                case JsopTokenizer.STRING:
+                case JsopReader.STRING:
                     buff.append(JsopBuilder.encode(t.getToken()));
                     break;
-                case JsopTokenizer.NUMBER:
-                case JsopTokenizer.TRUE:
-                case JsopTokenizer.FALSE:
-                case JsopTokenizer.NULL:
-                case JsopTokenizer.IDENTIFIER:
-                case JsopTokenizer.ERROR:
+                case JsopReader.NUMBER:
+                case JsopReader.TRUE:
+                case JsopReader.FALSE:
+                case JsopReader.NULL:
+                case JsopReader.IDENTIFIER:
+                case JsopReader.ERROR:
                     buff.append(t.getToken());
                     break;
                 case '{':

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/JsopTest.java
Thu Apr 26 12:11:22 2012
@@ -35,7 +35,7 @@ public class JsopTest extends TestCase {
             for (int i = 0; i < 10000000; i++) {
                 t2 += JsopBuilder.encode(s).length();
             }
-            // System.out.println(timer.seconds());
+            System.out.println(timer.seconds());
         }
         // old: not escaped: 5691 ms; escaped: 10609 ms
         // new: not escaped: 3931 ms; escaped: 11001 ms
@@ -64,7 +64,7 @@ public class JsopTest extends TestCase {
 
     public void testNull() {
         JsopTokenizer t = new JsopTokenizer("null");
-        assertEquals(null, t.read(JsopTokenizer.NULL));
+        assertEquals(null, t.read(JsopReader.NULL));
     }
 
     public void testLineLength() {
@@ -82,17 +82,17 @@ public class JsopTest extends TestCase {
 
     public void testNumber() {
         JsopTokenizer t = new JsopTokenizer("9/3:-3-:-/- 3");
-        assertEquals("9", t.read(JsopTokenizer.NUMBER));
+        assertEquals("9", t.read(JsopReader.NUMBER));
         t.read('/');
-        assertEquals("3", t.read(JsopTokenizer.NUMBER));
+        assertEquals("3", t.read(JsopReader.NUMBER));
         t.read(':');
-        assertEquals("-3", t.read(JsopTokenizer.NUMBER));
+        assertEquals("-3", t.read(JsopReader.NUMBER));
         t.read('-');
         t.read(':');
         t.read('-');
         t.read('/');
         t.read('-');
-        t.read(JsopTokenizer.NUMBER);
+        t.read(JsopReader.NUMBER);
     }
 
     public void testRawValue() {
@@ -183,7 +183,7 @@ public class JsopTest extends TestCase {
             assertEquals("{}123[*] expected: '+'", e.getMessage());
         }
         try {
-            t.read(JsopTokenizer.STRING);
+            t.read(JsopReader.STRING);
             fail();
         } catch (IllegalArgumentException e) {
             assertEquals("{}123[*] expected: string", e.getMessage());
@@ -201,7 +201,7 @@ public class JsopTest extends TestCase {
         JsopTokenizer t = new JsopTokenizer(jsop);
         while (true) {
             prettyPrint(buff, t, "");
-            if (t.getTokenType() == JsopTokenizer.END) {
+            if (t.getTokenType() == JsopReader.END) {
                 return buff.toString();
             }
         }
@@ -212,30 +212,30 @@ public class JsopTest extends TestCase {
         boolean inArray = false;
         while (true) {
             switch (t.read()) {
-                case JsopTokenizer.END:
+                case JsopReader.END:
                     return buff.toString();
-                case JsopTokenizer.STRING:
+                case JsopReader.STRING:
                     buff.append(JsopBuilder.encode(t.getToken()));
                     break;
-                case JsopTokenizer.NUMBER:
+                case JsopReader.NUMBER:
                     buff.append(t.getToken());
                     break;
-                case JsopTokenizer.TRUE:
+                case JsopReader.TRUE:
                     buff.append("true");
                     break;
-                case JsopTokenizer.FALSE:
+                case JsopReader.FALSE:
                     buff.append("false");
                     break;
-                case JsopTokenizer.NULL:
+                case JsopReader.NULL:
                     buff.append("null");
                     break;
-                case JsopTokenizer.ERROR:
+                case JsopReader.ERROR:
                     buff.append("/error/");
                     break;
-                case JsopTokenizer.IDENTIFIER:
+                case JsopReader.IDENTIFIER:
                     buff.append("/id:").append(t.getToken()).append('/');
                     break;
-                case JsopTokenizer.COMMENT:
+                case JsopReader.COMMENT:
                     buff.append("/*").append(t.getToken()).append("*/ ");
                     break;
                 case '{':

Modified: jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java?rev=1330799&r1=1330798&r2=1330799&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
(original)
+++ jackrabbit/oak/trunk/oak-mk/src/test/java/org/apache/jackrabbit/mk/json/fast/JsopObjectTest.java
Thu Apr 26 12:11:22 2012
@@ -42,7 +42,7 @@ public class JsopObjectTest extends Test
                 JsopObject o = (JsopObject) Jsop.parse(jsop);
                 assertEquals(data, o.get("child99"));
             }
-            // System.out.println(timer.seconds() + " lengthIndex=" + lengthIndex);
+            System.out.println(timer.seconds() + " lengthIndex=" + lengthIndex);
         }
     }
 



Mime
View raw message