Commit fc937400 authored by Jonathan Mace's avatar Jonathan Mace

Update dependencies in poms and move code between packages

parent d04485cf
......@@ -6,8 +6,8 @@ import java.util.Collections;
import java.util.List;
import java.util.concurrent.atomic.AtomicIntegerFieldUpdater;
import brown.tracingplane.BaggageContext;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.ProtobufVarint;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.ProtobufVarint;
/**
* <p>
......
......@@ -15,25 +15,17 @@
<dependencies>
<dependency>
<groupId>brown.tracingplane</groupId>
<artifactId>baggagecontext-staticapi</artifactId>
<artifactId>baggagecontext-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
......
......@@ -3,7 +3,6 @@ package brown.tracingplane.atomlayer;
import java.nio.ByteBuffer;
import java.util.ArrayList;
import java.util.List;
import brown.tracingplane.lexicographic.Lexicographic;
/**
* Contains static methods for trimming baggage atoms to size extents.
......
......@@ -10,9 +10,8 @@ import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import brown.tracingplane.atomlayer.AtomLayerOverflow.TrimExtent;
import brown.tracingplane.lexicographic.ProtobufVarint;
import brown.tracingplane.lexicographic.ProtobufVarint.EndOfStreamException;
import brown.tracingplane.lexicographic.ProtobufVarint.MalformedVarintException;
import brown.tracingplane.atomlayer.ProtobufVarint.EndOfStreamException;
import brown.tracingplane.atomlayer.ProtobufVarint.MalformedVarintException;
/**
* <p>
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.nio.ByteBuffer;
import java.util.Comparator;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.nio.ByteBuffer;
import java.util.ArrayList;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.util.ArrayList;
import java.util.Comparator;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.util.Comparator;
import java.util.Iterator;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.io.IOException;
import java.io.InputStream;
......
package brown.tracingplane.atomlayer;
import java.util.List;
/**
* Want to avoid having apache commons as a dependency, so implement any functions used here
*/
public class StringUtils {
public static String join(List<?> objects, String separator) {
if (objects == null) return "";
StringBuilder b = new StringBuilder();
boolean first = true;
for (Object s : objects) {
if (!first) {
b.append(separator);
} else {
first = false;
}
b.append(String.valueOf(s));
}
return b.toString();
}
}
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.nio.ByteBuffer;
import java.util.ArrayList;
......@@ -50,7 +50,7 @@ public class TypeUtils {
for (int i = atom.position(); i < atom.limit(); i++) {
binaryStrings.add(toBinaryString(atom.get(i)));
}
return String.format("[%s]", join(binaryStrings, ", "));
return String.format("[%s]", StringUtils.join(binaryStrings, ", "));
}
public static String toHexString(ByteBuffer atom) {
......@@ -58,7 +58,7 @@ public class TypeUtils {
for (int i = atom.position(); i < atom.limit(); i++) {
hexStrings.add(toHexString(atom.get(i)));
}
return String.format("%s", join(hexStrings, ""));
return String.format("%s", StringUtils.join(hexStrings, ""));
}
public static String toBinaryString(Iterable<ByteBuffer> atoms) {
......@@ -66,7 +66,7 @@ public class TypeUtils {
for (ByteBuffer atom : atoms) {
binaryStrings.add(toBinaryString(atom));
}
return String.format("[%s]", join(binaryStrings, ", "));
return String.format("[%s]", StringUtils.join(binaryStrings, ", "));
}
public static String toHexString(Iterable<ByteBuffer> atoms) {
......@@ -78,7 +78,7 @@ public class TypeUtils {
for (ByteBuffer atom : atoms) {
hexStrings.add(toHexString(atom));
}
return String.format("%s", join(hexStrings, atomSeparator));
return String.format("%s", StringUtils.join(hexStrings, atomSeparator));
}
public static String toHexString(byte[] serialize) {
......@@ -90,7 +90,7 @@ public class TypeUtils {
for (byte b : s.getBytes()) {
hexStrings.add("`" + toHexString(b) + "`");
}
return join(hexStrings, ",");
return StringUtils.join(hexStrings, ",");
}
public static void main(String[] args) {
......@@ -101,19 +101,4 @@ public class TypeUtils {
// System.out.println(toHexString("a"));
}
private static String join(List<?> objects, String separator) {
if (objects == null) return "";
StringBuilder b = new StringBuilder();
boolean first = true;
for (Object s : objects) {
if (!first) {
b.append(separator);
} else {
first = false;
}
b.append(String.valueOf(s));
}
return b.toString();
}
}
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import java.nio.ByteBuffer;
import java.nio.ByteOrder;
......
/**
*
* <p>
* <code>brown.tracingplane.atomlayer</code> contains some of the core atom-based functions of the Tracing Plane,
* including implementations of lexicographic comparison and lexicographic merge.
* </p>
*
* <p>
* In general, this code uses {@link ByteBuffer}s to represent atoms.
* </p>
*
* <p>
* This package also contains functions for encoding lexicographically consistent variable length integers.
* </p>
*
* <p>
* The Atom Layer provides an underlying representation for {@link BaggageContext} based on <i>atoms</i>. Other layers
* of the tracing plane use atoms to construct data structures like sets and maps. Since the Atom Layer is an inner
......
/**
* <p>
* <code>brown.tracingplane.lexicographic</code> contains some of the core atom-based functions of the Tracing Plane,
* including implementations of lexicographic comparison and lexicographic merge.
* </p>
*
* <p>
* In general, this code uses {@link ByteBuffer}s to represent atoms.
* </p>
*
* <p>
* This package also contains functions for encoding lexicographically consistent variable length integers.
* </p>
*/
package brown.tracingplane.lexicographic;
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import java.nio.BufferOverflowException;
......@@ -7,6 +7,7 @@ import java.util.Random;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import brown.tracingplane.atomlayer.ByteBuffers;
public class TestByteBuffers {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.List;
import org.junit.Test;
import com.google.common.collect.Lists;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.TypeUtils;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.TypeUtils;
public class TestMerge {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
......@@ -10,7 +10,6 @@ import java.util.List;
import java.util.Random;
import org.junit.Test;
import com.google.common.collect.Lists;
import brown.tracingplane.lexicographic.MergeIterator;
public class TestMergeIterator {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
......@@ -8,7 +8,7 @@ import java.util.List;
import java.util.Random;
import org.junit.Test;
import com.google.common.collect.Lists;
import brown.tracingplane.lexicographic.MergeTwoIterator;
import brown.tracingplane.atomlayer.MergeTwoIterator;
public class TestMergeTwoIterator {
......
package brown.tracingplane;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.Test;
import brown.tracingplane.lexicographic.ProtobufVarint.MalformedVarintException;
import brown.tracingplane.atomlayer.ProtobufVarint;
import brown.tracingplane.atomlayer.ProtobufVarint.MalformedVarintException;
public class TestProtobufVarint {
......
package brown.tracingplane;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import java.nio.ByteBuffer;
import org.junit.Test;
import brown.tracingplane.lexicographic.SignedLexVarint;
import brown.tracingplane.lexicographic.UnsignedLexVarint;
import brown.tracingplane.atomlayer.SignedLexVarint;
import brown.tracingplane.atomlayer.UnsignedLexVarint;
public class TestSerializedSize {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.Comparator;
import org.junit.Test;
import brown.tracingplane.lexicographic.TypeUtils;
import brown.tracingplane.lexicographic.UnsignedByteBuffer;
import brown.tracingplane.lexicographic.UnsignedByteBuffer.LexicographicalComparatorHolder;
import brown.tracingplane.lexicographic.UnsignedByteBuffer.LexicographicalComparatorHolder.PureJavaComparator;
import brown.tracingplane.lexicographic.UnsignedByteBuffer.LexicographicalComparatorHolder.UnsafeComparator;
import brown.tracingplane.atomlayer.TypeUtils;
import brown.tracingplane.atomlayer.UnsignedByteBuffer;
public class TestUnsignedByteBuffer {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.Test;
import brown.tracingplane.lexicographic.AtomLayerException;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.SignedLexVarint;
import brown.tracingplane.lexicographic.TypeUtils;
import brown.tracingplane.atomlayer.AtomLayerException;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.SignedLexVarint;
import brown.tracingplane.atomlayer.TypeUtils;
public class TestXSignedVarint32 {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.Test;
import brown.tracingplane.lexicographic.AtomLayerException;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.SignedLexVarint;
import brown.tracingplane.lexicographic.TypeUtils;
import brown.tracingplane.atomlayer.AtomLayerException;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.SignedLexVarint;
import brown.tracingplane.atomlayer.TypeUtils;
public class TestXSignedVarint64 {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
......@@ -7,10 +7,10 @@ import java.nio.BufferUnderflowException;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.Test;
import brown.tracingplane.lexicographic.AtomLayerException;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.TypeUtils;
import brown.tracingplane.lexicographic.UnsignedLexVarint;
import brown.tracingplane.atomlayer.AtomLayerException;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.TypeUtils;
import brown.tracingplane.atomlayer.UnsignedLexVarint;
public class TestXUnsignedVarint32 {
......
package brown.tracingplane.lexicographic;
package brown.tracingplane.atomlayer;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.Random;
import org.junit.Test;
import brown.tracingplane.lexicographic.AtomLayerException;
import brown.tracingplane.lexicographic.Lexicographic;
import brown.tracingplane.lexicographic.UnsignedLexVarint;
import brown.tracingplane.atomlayer.AtomLayerException;
import brown.tracingplane.atomlayer.Lexicographic;
import brown.tracingplane.atomlayer.UnsignedLexVarint;
public class TestXUnsignedVarint64 {
......
......@@ -23,10 +23,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>com.typesafe</groupId>
<artifactId>config</artifactId>
......
......@@ -22,7 +22,6 @@ public class DefaultBaggageProvider {
private final BaggageProvider<? extends BaggageContext> provider;
private final BaggageProvider<BaggageContext> wrappedProvider;
@SuppressWarnings("unchecked")
private DefaultBaggageProvider() {
Config config = ConfigFactory.load();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment