[dna-commits] DNA SVN: r1188 - in trunk/dna-common/src: test/java/org/jboss/dna/common/text and 1 other directory.

dna-commits at lists.jboss.org dna-commits at lists.jboss.org
Wed Sep 2 14:59:05 EDT 2009


Author: rhauch
Date: 2009-09-02 14:59:05 -0400 (Wed, 02 Sep 2009)
New Revision: 1188

Modified:
   trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
   trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamBasicTokenizerTest.java
Log:
Minor fix to the new TokenStream class, plus multiple fixes for invalid use of @Override.

Modified: trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java
===================================================================
--- trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java	2009-09-02 18:58:39 UTC (rev 1187)
+++ trunk/dna-common/src/main/java/org/jboss/dna/common/text/TokenStream.java	2009-09-02 18:59:05 UTC (rev 1188)
@@ -1045,7 +1045,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#type()
          */
-        @Override
         public final int type() {
             return type;
         }
@@ -1055,7 +1054,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#startIndex()
          */
-        @Override
         public final int startIndex() {
             return startIndex;
         }
@@ -1065,7 +1063,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#endIndex()
          */
-        @Override
         public final int endIndex() {
             return endIndex;
         }
@@ -1075,9 +1072,8 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#length()
          */
-        @Override
         public final int length() {
-            return 0;
+            return endIndex - startIndex;
         }
 
         /**
@@ -1085,7 +1081,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#matches(char)
          */
-        @Override
         public final boolean matches( char expected ) {
             return length() == 1 && matchString().charAt(startIndex) == expected;
         }
@@ -1095,7 +1090,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#matches(java.lang.String)
          */
-        @Override
         public final boolean matches( String expected ) {
             return matchString().substring(startIndex, endIndex).equals(expected);
         }
@@ -1114,7 +1108,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Token#position()
          */
-        @Override
         public Position position() {
             return position;
         }
@@ -1162,7 +1155,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Tokens#addToken(org.jboss.dna.common.text.TokenStream.Position, int)
          */
-        @Override
         public void addToken( Position position,
                               int index ) {
             addToken(position, index, index + 1, 0);
@@ -1173,7 +1165,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Tokens#addToken(Position, int, int)
          */
-        @Override
         public final void addToken( Position position,
                                     int startIndex,
                                     int endIndex ) {
@@ -1192,9 +1183,8 @@
         /**
          * {@inheritDoc}
          * 
-         * @see org.jboss.dna.common.text.TokenStream.Tokens#addToken(Position,int, int, int)
+         * @see org.jboss.dna.common.text.TokenStream.TokenFactory#addToken(Position,int, int, int)
          */
-        @Override
         public void addToken( Position position,
                               int startIndex,
                               int endIndex,
@@ -1207,9 +1197,8 @@
         /**
          * {@inheritDoc}
          * 
-         * @see org.jboss.dna.common.text.TokenStream.Tokens#addToken(Position,int, int, int)
+         * @see org.jboss.dna.common.text.TokenStream.TokenFactory#addToken(Position,int, int, int)
          */
-        @Override
         public void addToken( Position position,
                               int startIndex,
                               int endIndex,
@@ -1236,7 +1225,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#hasNext()
          */
-        @Override
         public boolean hasNext() {
             return lastIndex < maxIndex;
         }
@@ -1246,7 +1234,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#index()
          */
-        @Override
         public int index() {
             return lastIndex;
         }
@@ -1256,7 +1243,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#position()
          */
-        @Override
         public Position position() {
             return new Position(lineNumber, columnNumber);
         }
@@ -1266,7 +1252,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#next()
          */
-        @Override
         public char next() {
             if (lastIndex >= maxIndex) {
                 throw new NoSuchElementException();
@@ -1290,7 +1275,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNext(char)
          */
-        @Override
         public boolean isNext( char c ) {
             int nextIndex = lastIndex + 1;
             return nextIndex <= maxIndex && content[nextIndex] == c;
@@ -1301,7 +1285,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNext(char, char)
          */
-        @Override
         public boolean isNext( char nextChar1,
                                char nextChar2 ) {
             int nextIndex1 = lastIndex + 1;
@@ -1314,7 +1297,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNext(char, char, char)
          */
-        @Override
         public boolean isNext( char nextChar1,
                                char nextChar2,
                                char nextChar3 ) {
@@ -1330,7 +1312,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNextAnyOf(char[])
          */
-        @Override
         public boolean isNextAnyOf( char[] characters ) {
             int nextIndex = lastIndex + 1;
             if (nextIndex <= maxIndex) {
@@ -1347,7 +1328,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNextAnyOf(java.lang.String)
          */
-        @Override
         public boolean isNextAnyOf( String characters ) {
             int nextIndex = lastIndex + 1;
             if (nextIndex <= maxIndex) {
@@ -1362,7 +1342,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.CharacterStream#isNextWhitespace()
          */
-        @Override
         public boolean isNextWhitespace() {
             int nextIndex = lastIndex + 1;
             return nextIndex <= maxIndex && Character.isWhitespace(content[nextIndex]);
@@ -1524,7 +1503,6 @@
          * 
          * @see org.jboss.dna.common.text.TokenStream.Tokenizer#tokenize(CharacterStream, Tokens)
          */
-        @Override
         public void tokenize( CharacterStream input,
                               Tokens tokens ) throws ParsingException {
             while (input.hasNext()) {

Modified: trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamBasicTokenizerTest.java
===================================================================
--- trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamBasicTokenizerTest.java	2009-09-02 18:58:39 UTC (rev 1187)
+++ trunk/dna-common/src/test/java/org/jboss/dna/common/text/TokenStreamBasicTokenizerTest.java	2009-09-02 18:59:05 UTC (rev 1188)
@@ -48,14 +48,12 @@
         tokenizer = TokenStream.basicTokenizer(true);
         final LinkedList<int[]> tokenValues = new LinkedList<int[]>();
         tokenFactory = new Tokens() {
-            @Override
             public void addToken( Position position,
                                   int index ) {
                 int[] token = new int[] {index, index + 1, 0};
                 tokenValues.add(token);
             }
 
-            @Override
             public void addToken( Position position,
                                   int startIndex,
                                   int endIndex ) {
@@ -63,7 +61,6 @@
                 tokenValues.add(token);
             }
 
-            @Override
             public void addToken( Position position,
                                   int startIndex,
                                   int endIndex,



More information about the dna-commits mailing list