accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ctubb...@apache.org
Subject svn commit: r1479448 - in /accumulo/trunk: core/src/main/java/org/apache/accumulo/core/client/lexicoder/ core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ core/src/main/java/org/apache/accumulo/core/util/ core/src/test/java/org/apache/...
Date Mon, 06 May 2013 01:51:13 GMT
Author: ctubbsii
Date: Mon May  6 01:51:12 2013
New Revision: 1479448

URL: http://svn.apache.org/r1479448
Log:
ACCUMULO-1382 Make PairLexicoder use a ComparablePair, so the Comparable-ness of its parameters
can be enforced. Also fixed javadocs, header comments, formatting, and warnings introduced
by ACCUMULO-1336.

Added:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ComparablePair.java
Modified:
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Encoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Lexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/LongLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ByteUtils.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/FixedByteArrayOutputStream.java
    accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Pair.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
    accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
    accumulo/trunk/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -22,8 +22,8 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.math.BigInteger;
 
-import org.apache.accumulo.core.iterators.ValueFormatException;
 import org.apache.accumulo.core.client.lexicoder.util.FixedByteArrayOutputStream;
+import org.apache.accumulo.core.iterators.ValueFormatException;
 
 /**
  * 
@@ -51,13 +51,13 @@ public class BigIntegerLexicoder impleme
       
       dos.writeInt(len);
       dos.write(bytes);
+      dos.close();
       
       return ret;
     } catch (IOException ioe) {
       throw new RuntimeException(ioe);
     }
     
-
   }
   
   @Override

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/BytesLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DateLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Encoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Encoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Encoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Encoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Lexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Lexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Lexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/Lexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ListLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/LongLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/LongLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/LongLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/LongLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/PairLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -21,9 +21,9 @@ import static org.apache.accumulo.core.c
 import static org.apache.accumulo.core.client.lexicoder.util.ByteUtils.split;
 import static org.apache.accumulo.core.client.lexicoder.util.ByteUtils.unescape;
 
-import org.apache.accumulo.core.util.Pair;
+import org.apache.accumulo.core.util.ComparablePair;
 
-public class PairLexicoder<A,B> implements Lexicoder<Pair<A,B>> {
+public class PairLexicoder<A extends Comparable<A>,B extends Comparable<B>>
implements Lexicoder<ComparablePair<A,B>> {
   
   private Lexicoder<A> firstLexicoder;
   private Lexicoder<B> secondLexicoder;
@@ -34,19 +34,19 @@ public class PairLexicoder<A,B> implemen
   }
   
   @Override
-  public byte[] encode(Pair<A,B> data) {
+  public byte[] encode(ComparablePair<A,B> data) {
     return concat(escape(firstLexicoder.encode(data.getFirst())), escape(secondLexicoder.encode(data.getSecond())));
   }
   
   @Override
-  public Pair<A,B> decode(byte[] data) {
+  public ComparablePair<A,B> decode(byte[] data) {
     
     byte[][] fields = split(data);
     if (fields.length != 2) {
       throw new RuntimeException("Data does not have 2 fields, it has " + fields.length);
     }
     
-    return new Pair<A,B>(firstLexicoder.decode(unescape(fields[0])), secondLexicoder.decode(unescape(fields[1])));
+    return new ComparablePair<A,B>(firstLexicoder.decode(unescape(fields[0])), secondLexicoder.decode(unescape(fields[1])));
   }
   
 }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/StringLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/TextLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -45,7 +45,7 @@ public class UIntegerLexicoder implement
       ret[0] = (byte) (8 - ret[0]);
     
     return ret;
-
+    
   }
   
   @Override
@@ -53,7 +53,7 @@ public class UIntegerLexicoder implement
     
     if (data[0] < 0 || data[0] > 8)
       throw new IllegalArgumentException("Unexpected length " + (0xff & data[0]));
-
+    
     int i = 0;
     int shift = 0;
     

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -44,9 +44,9 @@ public class ULongLexicoder implements L
     
     if (l < 0)
       ret[0] = (byte) (16 - ret[0]);
-
+    
     return ret;
-
+    
   }
   
   @Override
@@ -54,10 +54,10 @@ public class ULongLexicoder implements L
     
     long l = 0;
     int shift = 0;
-
+    
     if (data[0] < 0 || data[0] > 16)
       throw new IllegalArgumentException("Unexpected length " + (0xff & data[0]));
-
+    
     for (int i = data.length - 1; i >= 1; i--) {
       l += (data[i] & 0xffl) << shift;
       shift += 8;
@@ -66,7 +66,7 @@ public class ULongLexicoder implements L
     // fill in 0xff prefix
     if (data[0] > 8)
       l |= -1l << ((16 - data[0]) << 3);
-
+    
     return l;
   }
 }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoder.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -22,8 +22,8 @@ import java.io.DataOutputStream;
 import java.io.IOException;
 import java.util.UUID;
 
-import org.apache.accumulo.core.iterators.ValueFormatException;
 import org.apache.accumulo.core.client.lexicoder.util.FixedByteArrayOutputStream;
+import org.apache.accumulo.core.iterators.ValueFormatException;
 
 public class UUIDLexicoder implements Lexicoder<UUID> {
   

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ByteUtils.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ByteUtils.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ByteUtils.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/ByteUtils.java
Mon May  6 01:51:12 2013
@@ -1,14 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 package org.apache.accumulo.core.client.lexicoder.util;
 
 import java.util.ArrayList;
 
 public class ByteUtils {
-
+  
   /**
    * Escapes 0x00 with 0x01 0x01 and 0x01 with 0x01 0x02
-   *
-   * @param in
-   * @return
    */
   public static byte[] escape(byte[] in) {
     int escapeCount = 0;
@@ -17,13 +30,13 @@ public class ByteUtils {
         escapeCount++;
       }
     }
-
+    
     if (escapeCount == 0)
       return in;
-
+    
     byte ret[] = new byte[escapeCount + in.length];
     int index = 0;
-
+    
     for (int i = 0; i < in.length; i++) {
       switch (in[i]) {
         case 0x00:
@@ -38,10 +51,10 @@ public class ByteUtils {
           ret[index++] = in[i];
       }
     }
-
+    
     return ret;
   }
-
+  
   public static byte[] unescape(byte[] in) {
     int escapeCount = 0;
     for (int i = 0; i < in.length; i++) {
@@ -50,12 +63,12 @@ public class ByteUtils {
         i++;
       }
     }
-
+    
     if (escapeCount == 0)
       return in;
-
+    
     byte ret[] = new byte[in.length - escapeCount];
-
+    
     int index = 0;
     for (int i = 0; i < in.length; i++) {
       if (in[i] == 0x01) {
@@ -64,53 +77,52 @@ public class ByteUtils {
       } else {
         ret[index++] = in[i];
       }
-
+      
     }
-
+    
     return ret;
   }
-
+  
   public static byte[][] split(byte[] data) {
     ArrayList<Integer> offsets = new ArrayList<Integer>();
-
+    
     for (int i = 0; i < data.length; i++) {
       if (data[i] == 0x00) {
         offsets.add(i);
       }
     }
-
+    
     offsets.add(data.length);
-
+    
     byte[][] ret = new byte[offsets.size()][];
-
+    
     int index = 0;
     for (int i = 0; i < offsets.size(); i++) {
       ret[i] = new byte[offsets.get(i) - index];
       System.arraycopy(data, index, ret[i], 0, ret[i].length);
       index = offsets.get(i) + 1;
     }
-
+    
     return ret;
   }
-
+  
   public static byte[] concat(byte[]... fields) {
     int len = 0;
     for (byte[] field : fields) {
       len += field.length;
     }
-
+    
     byte ret[] = new byte[len + fields.length - 1];
     int index = 0;
-
+    
     for (byte[] field : fields) {
       System.arraycopy(field, 0, ret, index, field.length);
       index += field.length;
       if (index < ret.length)
         ret[index++] = 0x00;
     }
-
+    
     return ret;
   }
-
-
+  
 }

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/FixedByteArrayOutputStream.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/FixedByteArrayOutputStream.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/FixedByteArrayOutputStream.java
(original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/client/lexicoder/util/FixedByteArrayOutputStream.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Added: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ComparablePair.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ComparablePair.java?rev=1479448&view=auto
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ComparablePair.java (added)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/ComparablePair.java Mon
May  6 01:51:12 2013
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.core.util;
+
+/**
+ * 
+ */
+public class ComparablePair<A extends Comparable<A>,B extends Comparable<B>>
extends Pair<A,B> implements Comparable<ComparablePair<A,B>> {
+  
+  public ComparablePair(A f, B s) {
+    super(f, s);
+  }
+  
+  @Override
+  public int compareTo(ComparablePair<A,B> abPair) {
+    int cmp = first.compareTo(abPair.first);
+    if (cmp == 0) {
+      cmp = second.compareTo(abPair.second);
+    }
+    
+    return cmp;
+  }
+  
+}

Modified: accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Pair.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Pair.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Pair.java (original)
+++ accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/Pair.java Mon May  6 01:51:12
2013
@@ -16,7 +16,7 @@
  */
 package org.apache.accumulo.core.util;
 
-public class Pair<A,B> implements Comparable<Pair<A,B>> {
+public class Pair<A,B> {
   A first;
   B second;
   
@@ -60,18 +60,9 @@ public class Pair<A,B> implements Compar
     return second;
   }
   
+  @Override
   public String toString() {
     return "(" + first + "," + second + ")";
   }
-
-
-  @Override
-  public int compareTo(Pair<A, B> abPair) {
-    int cmp = ((Comparable<A>) first).compareTo(abPair.first);
-    if (cmp == 0) {
-      cmp = ((Comparable<B>) second).compareTo(abPair.second);
-    }
-
-    return cmp;
-  }
+  
 }

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/BigIntegerLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/DoubleLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/IntegerLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -23,7 +23,6 @@ import java.util.List;
 
 import junit.framework.TestCase;
 
-import org.apache.accumulo.core.client.lexicoder.Lexicoder;
 import org.apache.accumulo.core.util.TextUtil;
 import org.apache.hadoop.io.Text;
 

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ListLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/LongLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/PairLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -16,21 +16,23 @@
  */
 package org.apache.accumulo.core.client.lexicoder;
 
-import org.apache.accumulo.core.util.Pair;
+import org.apache.accumulo.core.util.ComparablePair;
 
 /**
  * 
  */
 public class PairLexicoderTest extends LexicoderTest {
+  @SuppressWarnings("unchecked")
   public void testSortOrder() {
     PairLexicoder<String,String> plexc = new PairLexicoder<String,String>(new
StringLexicoder(), new StringLexicoder());
     
-    assertSortOrder(plexc, new Pair<String,String>("a", "b"), new Pair<String,String>("a",
"bc"), new Pair<String,String>("a", "c"), new Pair<String,String>(
-        "ab", "c"), new Pair<String,String>("ab", ""), new Pair<String,String>("ab",
"d"), new Pair<String,String>("b", "f"), new Pair<String,String>("b", "a"));
+    assertSortOrder(plexc, new ComparablePair<String,String>("a", "b"), new ComparablePair<String,String>("a",
"bc"), new ComparablePair<String,String>("a",
+        "c"), new ComparablePair<String,String>("ab", "c"), new ComparablePair<String,String>("ab",
""), new ComparablePair<String,String>("ab", "d"),
+        new ComparablePair<String,String>("b", "f"), new ComparablePair<String,String>("b",
"a"));
     
     PairLexicoder<Long,String> plexc2 = new PairLexicoder<Long,String>(new LongLexicoder(),
new StringLexicoder());
     
-    assertSortOrder(plexc2, new Pair<Long,String>(0x100l, "a"), new Pair<Long,String>(0x100l,
"ab"), new Pair<Long,String>(0xf0l, "a"), new Pair<Long,String>(
-        0xf0l, "ab"));
+    assertSortOrder(plexc2, new ComparablePair<Long,String>(0x100l, "a"), new ComparablePair<Long,String>(0x100l,
"ab"), new ComparablePair<Long,String>(0xf0l,
+        "a"), new ComparablePair<Long,String>(0xf0l, "ab"));
   }
 }

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ReverseLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.
@@ -43,7 +43,7 @@ public class ReverseLexicoderTest extend
   @Test
   public void testReverseSortDates() throws UnsupportedEncodingException {
     
-    ReverseLexicoder revLex = new ReverseLexicoder(new DateLexicoder());
+    ReverseLexicoder<Date> revLex = new ReverseLexicoder<Date>(new DateLexicoder());
     
     Date date1 = new Date();
     Date date2 = new Date(System.currentTimeMillis() + 10000);
@@ -51,11 +51,11 @@ public class ReverseLexicoderTest extend
     
     Comparator<Date> comparator = Collections.reverseOrder();
     assertSortOrder(revLex, comparator, date1, date2, date3);
-
+    
     // truncate date to hours
     long time = System.currentTimeMillis() - (System.currentTimeMillis() % 3600000);
     Date date = new Date(time);
-
+    
     System.out.println(date);
     
   }

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UIntegerLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/ULongLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
(original)
+++ accumulo/trunk/core/src/test/java/org/apache/accumulo/core/client/lexicoder/UUIDLexicoderTest.java
Mon May  6 01:51:12 2013
@@ -1,4 +1,4 @@
-/**
+/*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
  * this work for additional information regarding copyright ownership.

Modified: accumulo/trunk/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java?rev=1479448&r1=1479447&r2=1479448&view=diff
==============================================================================
--- accumulo/trunk/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java
(original)
+++ accumulo/trunk/server/src/main/java/org/apache/accumulo/server/mini/MiniAccumuloConfig.java
Mon May  6 01:51:12 2013
@@ -61,7 +61,7 @@ public class MiniAccumuloConfig {
     this.dir = dir;
     this.rootPassword = rootPassword;
   }
-
+  
   /**
    * Set directories and fully populate site config
    */
@@ -141,21 +141,18 @@ public class MiniAccumuloConfig {
     this.numTservers = numTservers;
     return this;
   }
-
+  
   /**
    * Calling this method is optional. If not set, defaults to 'miniInstance'
-   * 
-   * @param instanceName
-   * @return
    */
   public MiniAccumuloConfig setInstanceName(String instanceName) {
     this.instanceName = instanceName;
     return this;
   }
-
+  
   /**
    * Calling this method is optional. If not set, it defaults to an empty map.
-   *
+   * 
    * @param siteConfig
    *          key/values that you normally put in accumulo-site.xml can be put here.
    */
@@ -163,40 +160,39 @@ public class MiniAccumuloConfig {
     this.siteConfig = new HashMap<String,String>(siteConfig);
     return this;
   }
-
+  
   /**
    * Calling this method is optional. A random port is generated by default
    * 
    * @param zooKeeperPort
    *          A valid (and unused) port to use for the zookeeper
-   * @return
    */
   public MiniAccumuloConfig setZooKeeperPort(int zooKeeperPort) {
     this.zooKeeperPort = zooKeeperPort;
     return this;
   }
-
+  
   /**
    * @return a copy of the site config
    */
   public Map<String,String> getSiteConfig() {
     return new HashMap<String,String>(siteConfig);
   }
-
+  
   /**
    * @return name of configured instance
    */
   public String getInstanceName() {
     return instanceName;
   }
-
+  
   /**
    * @return The configured zookeeper port
    */
   public int getZooKeeperPort() {
     return zooKeeperPort;
   }
-
+  
   public File getLibDir() {
     return libDir;
   }
@@ -227,45 +223,45 @@ public class MiniAccumuloConfig {
   public String getZooKeepers() {
     return siteConfig.get(Property.INSTANCE_ZK_HOST.getKey());
   }
-
+  
   /**
    * @return master client port
    */
   public String getMasterClientPort() {
     return siteConfig.get(Property.MASTER_CLIENTPORT.getKey());
   }
-
+  
   /**
    * @return trace port
    */
   public String getTracePort() {
     return siteConfig.get(Property.TRACE_PORT.getKey());
   }
-
+  
   /**
    * @return tablet server client port
    */
   public String getTabletServerClientPort() {
     return siteConfig.get(Property.TSERV_CLIENTPORT.getKey());
   }
-
+  
   /**
    * @return Has the current instance been initialized?
    */
   public boolean isInitialized() {
     return initialized;
   }
-
+  
   public File getDir() {
     return dir;
   }
-
+  
   public String getRootPassword() {
     return rootPassword;
   }
-
+  
   public int getNumTservers() {
     return numTservers;
   }
-
+  
 }



Mime
View raw message