cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1165660 - in /cassandra/trunk: src/java/org/apache/cassandra/cql/term/ src/java/org/apache/cassandra/db/marshal/ test/unit/org/apache/cassandra/db/marshal/
Date Tue, 06 Sep 2011 13:28:10 GMT
Author: jbellis
Date: Tue Sep  6 13:28:09 2011
New Revision: 1165660

URL: http://svn.apache.org/viewvc?rev=1165660&view=rev
Log:
remove ATerm.isCommutative and AType.toString
patch by jbellis; reviewed by eevans for CASSANDRA-2936

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/cql/term/AbstractTerm.java
    cassandra/trunk/src/java/org/apache/cassandra/cql/term/CounterColumnTerm.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BooleanType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DateType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DoubleType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/ReversedType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
    cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java
    cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/term/AbstractTerm.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/term/AbstractTerm.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/term/AbstractTerm.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/term/AbstractTerm.java Tue Sep  6 13:28:09
2011
@@ -36,9 +36,4 @@ public abstract class AbstractTerm<T>
     public abstract Class<T> getType();
     public abstract int getJdbcType();
     public abstract T compose(ByteBuffer bytes);
-    
-    public boolean isCommutative()
-    {
-        return false;
-    }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/cql/term/CounterColumnTerm.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/cql/term/CounterColumnTerm.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/cql/term/CounterColumnTerm.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/cql/term/CounterColumnTerm.java Tue Sep
 6 13:28:09 2011
@@ -5,9 +5,4 @@ public class CounterColumnTerm extends L
     public static final CounterColumnTerm instance = new CounterColumnTerm();
     
     CounterColumnTerm() {}
-    
-    public boolean isCommutative()
-    {
-        return true;
-    }
 }

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractCompositeType.java Tue
Sep  6 13:28:09 2011
@@ -229,11 +229,6 @@ public abstract class AbstractCompositeT
         return value;
     }
 
-    public String toString(ByteBuffer value)
-    {
-        return getString(value);
-    }
-
     abstract protected AbstractType getNextComparator(int i, ByteBuffer bb);
     abstract protected AbstractType getNextComparator(int i, ByteBuffer bb1, ByteBuffer bb2);
     abstract protected AbstractType getAndAppendNextComparator(int i, ByteBuffer bb, StringBuilder
sb);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AbstractType.java Tue Sep  6
13:28:09 2011
@@ -98,9 +98,6 @@ public abstract class AbstractType<T> im
     
     public abstract ByteBuffer decompose(T value);
 
-    /** get a string representation of a particular type. */
-    public abstract String toString(T t);
-
     /** get a string representation of the bytes suitable for log messages */
     public abstract String getString(ByteBuffer bytes);
 

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/AsciiType.java Tue Sep  6 13:28:09
2011
@@ -48,11 +48,6 @@ public class AsciiType extends AbstractT
         }
     }
 
-    public String toString(String s)
-    {
-        return AsciiTerm.instance.toString(s);
-    }
-
     public int compare(ByteBuffer o1, ByteBuffer o2)
     {
         return BytesType.bytesCompare(o1, o2);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BooleanType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BooleanType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BooleanType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BooleanType.java Tue Sep  6 13:28:09
2011
@@ -66,11 +66,6 @@ public class BooleanType extends Abstrac
       }
   }
 
-  public String toString(Boolean b)
-  {
-      return BooleanTerm.instance.toString(b);
-  }
-
   public ByteBuffer fromString(String source) throws MarshalException
   {
     

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/BytesType.java Tue Sep  6 13:28:09
2011
@@ -64,11 +64,6 @@ public class BytesType extends AbstractT
         return BytesTerm.instance.getString(bytes);
     }
 
-    public String toString(ByteBuffer byteBuffer)
-    {
-        return BytesTerm.instance.toString(byteBuffer);
-    }
-
     public ByteBuffer fromString(String source)
     {
         try

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/CounterColumnType.java Tue Sep
 6 13:28:09 2011
@@ -46,11 +46,6 @@ public class CounterColumnType extends A
         return ByteBufferUtil.bytesToHex(bytes);
     }
 
-    public String toString(Long l)
-    {
-        return l.toString();
-    }
-
     /**
      * create commutative column
      */

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DateType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DateType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DateType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DateType.java Tue Sep  6 13:28:09
2011
@@ -78,11 +78,6 @@ public class DateType extends AbstractTy
         }
     }
 
-    public String toString(Date d)
-    {
-        return DateTerm.instance.toString(d);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
       // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DoubleType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DoubleType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DoubleType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/DoubleType.java Tue Sep  6 13:28:09
2011
@@ -69,11 +69,6 @@ public class DoubleType extends Abstract
         }
     }
 
-    public String toString(Double d)
-    {
-        return DoubleTerm.instance.toString(d);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
       // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/FloatType.java Tue Sep  6 13:28:09
2011
@@ -70,11 +70,6 @@ public class FloatType extends AbstractT
         }
     }
 
-    public String toString(Float d)
-    {
-        return FloatTerm.instance.toString(d);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
       // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/IntegerType.java Tue Sep  6 13:28:09
2011
@@ -130,11 +130,6 @@ public final class IntegerType extends A
     {
         return IntegerTerm.instance.getString(bytes);
     }
-    
-    public String toString(BigInteger bi)
-    {
-        return IntegerTerm.instance.toString(bi);
-    }
 
     public ByteBuffer fromString(String source) throws MarshalException
     {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LexicalUUIDType.java Tue Sep
 6 13:28:09 2011
@@ -70,11 +70,6 @@ public class LexicalUUIDType extends Abs
         }
     }
 
-    public String toString(UUID uuid)
-    {
-        return LexicalUUIDTerm.instance.toString(uuid);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
         // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LocalByPartionerType.java Tue
Sep  6 13:28:09 2011
@@ -53,11 +53,6 @@ public class LocalByPartionerType<T exte
         return ByteBufferUtil.bytesToHex(bytes);
     }
 
-    public String toString(ByteBuffer bb)
-    {
-        return getString(bb);
-    }
-
     public ByteBuffer fromString(String source)
     {
         throw new NotImplementedException();

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/LongType.java Tue Sep  6 13:28:09
2011
@@ -74,11 +74,6 @@ public class LongType extends AbstractTy
         }
     }
 
-    public String toString(Long l)
-    {
-        return LongTerm.instance.toString(l);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
         // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/ReversedType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/ReversedType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/ReversedType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/ReversedType.java Tue Sep  6
13:28:09 2011
@@ -97,11 +97,6 @@ public class ReversedType<T> extends Abs
         return baseType.decompose(value);
     }
 
-    public String toString(T t)
-    {
-        return baseType.toString(t);
-    }
-
     @Override
     public String toString()
     {

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/TimeUUIDType.java Tue Sep  6
13:28:09 2011
@@ -109,11 +109,6 @@ public class TimeUUIDType extends Abstra
         }
     }
 
-    public String toString(UUID uuid)
-    {
-        return TimeUUIDTerm.instance.toString(uuid);
-    }
-
     public ByteBuffer fromString(String source) throws MarshalException
     {
         // Return an empty ByteBuffer for an empty string.

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UTF8Type.java Tue Sep  6 13:28:09
2011
@@ -60,11 +60,6 @@ public class UTF8Type extends AbstractTy
         }
     }
 
-    public String toString(String s)
-    {
-        return UTF8Term.instance.toString(s);
-    }
-
     public ByteBuffer fromString(String source)
     {
         return decompose(source);

Modified: cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/db/marshal/UUIDType.java Tue Sep  6 13:28:09
2011
@@ -165,11 +165,6 @@ public class UUIDType extends AbstractTy
         return UUIDTerm.instance.compose(bytes);
     }
 
-    public String toString(UUID uuid)
-    {
-        return UUIDTerm.instance.toString(uuid);
-    }
-
     public void validate(ByteBuffer bytes)
     {
         if ((bytes.remaining() != 0) && (bytes.remaining() != 16))

Modified: cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java?rev=1165660&r1=1165659&r2=1165660&view=diff
==============================================================================
--- cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java (original)
+++ cassandra/trunk/test/unit/org/apache/cassandra/db/marshal/RoundTripTest.java Tue Sep 
6 13:28:09 2011
@@ -22,6 +22,8 @@ package org.apache.cassandra.db.marshal;
 
 
 import com.google.common.base.Charsets;
+
+import org.apache.cassandra.cql.term.*;
 import org.apache.cassandra.utils.FBUtilities;
 import org.apache.cassandra.utils.UUIDGen;
 import org.junit.Test;
@@ -43,7 +45,7 @@ public class RoundTripTest
         assert IntegerType.instance.fromString(IntegerType.instance.getString(ByteBuffer.wrap(bi.toByteArray())))
                 .equals(ByteBuffer.wrap(bi.toByteArray()));
         assert IntegerType.instance.compose(ByteBuffer.wrap(bi.toByteArray())).equals(bi);
-        assert IntegerType.instance.toString(bi).equals("1");
+        assert IntegerTerm.instance.toString(bi).equals("1");
     }
     
     @Test
@@ -54,7 +56,7 @@ public class RoundTripTest
         assert LongType.instance.fromString(LongType.instance.getString(ByteBuffer.wrap(v)))
                 .equals(ByteBuffer.wrap(v));
         assert LongType.instance.compose(ByteBuffer.wrap(v)) == 1L;
-        assert LongType.instance.toString(1L).equals("1");
+        assert LongTerm.instance.toString(1L).equals("1");
     }
     
     @Test
@@ -65,31 +67,31 @@ public class RoundTripTest
         assert AsciiType.instance.fromString(AsciiType.instance.getString(ByteBuffer.wrap(abc)))
                 .equals(ByteBuffer.wrap(abc));
         assert AsciiType.instance.compose(ByteBuffer.wrap(abc)).equals("abc");
-        assert AsciiType.instance.toString("abc").equals("abc");
+        assert AsciiTerm.instance.toString("abc").equals("abc");
     }
     
     @Test
     public void testBytes()
     {
         byte[] v = new byte[] {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
-        assert BytesType.instance.toString(BytesType.instance.fromString(FBUtilities.bytesToHex(v)))
+        assert BytesTerm.instance.toString(BytesType.instance.fromString(FBUtilities.bytesToHex(v)))
                 .equals(FBUtilities.bytesToHex(v));
-        assert BytesType.instance.fromString(BytesType.instance.toString(ByteBuffer.wrap(v)))
+        assert BytesType.instance.fromString(BytesTerm.instance.toString(ByteBuffer.wrap(v)))
                 .equals(ByteBuffer.wrap(v));
         assert BytesType.instance.compose(ByteBuffer.wrap(v)).equals(ByteBuffer.wrap(v));
-        assert BytesType.instance.toString(ByteBuffer.wrap(v)).equals(FBUtilities.bytesToHex(v));
+        assert BytesTerm.instance.toString(ByteBuffer.wrap(v)).equals(FBUtilities.bytesToHex(v));
     }
     
     @Test
     public void testLexicalUUID()
     {
         UUID uuid = UUIDGen.makeType1UUIDFromHost(FBUtilities.getBroadcastAddress());
-        assert LexicalUUIDType.instance.getString(LexicalUUIDType.instance.fromString(uuid.toString()))
+        assert LexicalUUIDTerm.instance.getString(LexicalUUIDType.instance.fromString(uuid.toString()))
                 .equals(uuid.toString());
         assert LexicalUUIDType.instance.fromString(LexicalUUIDType.instance.getString(ByteBuffer.wrap(UUIDGen.decompose(uuid))))
                 .equals(ByteBuffer.wrap(UUIDGen.decompose(uuid)));
         assert LexicalUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid);
-        assert LexicalUUIDType.instance.toString(uuid).equals(uuid.toString());
+        assert LexicalUUIDTerm.instance.toString(uuid).equals(uuid.toString());
     }
     
     @Test
@@ -103,7 +105,7 @@ public class RoundTripTest
         assert TimeUUIDType.instance.compose(ByteBuffer.wrap(UUIDGen.decompose(uuid))).equals(uuid);
         
         assert uuid.equals(TimeUUIDType.instance.compose(TimeUUIDType.instance.fromString(uuid.toString())));
-        assert TimeUUIDType.instance.toString(uuid).equals(uuid.toString());
+        assert TimeUUIDTerm.instance.toString(uuid).equals(uuid.toString());
         
         TimeZone.setDefault(TimeZone.getTimeZone("America/New_York"));
         Calendar c = Calendar.getInstance();
@@ -140,6 +142,6 @@ public class RoundTripTest
         assert UTF8Type.instance.fromString(UTF8Type.instance.getString(ByteBuffer.wrap(v.getBytes(Charsets.UTF_8))))
                 .equals(ByteBuffer.wrap(v.getBytes(Charsets.UTF_8)));
         assert UTF8Type.instance.compose(ByteBuffer.wrap(v.getBytes(Charsets.UTF_8))).equals(v);
-        assert UTF8Type.instance.toString(v).equals(v);
+        assert UTF8Term.instance.toString(v).equals(v);
     }
 }



Mime
View raw message