target stringlengths 20 113k | src_fm stringlengths 11 86.3k | src_fm_fc stringlengths 21 86.4k | src_fm_fc_co stringlengths 30 86.4k | src_fm_fc_ms stringlengths 42 86.8k | src_fm_fc_ms_ff stringlengths 43 86.8k |
|---|---|---|---|---|---|
@Test(expected = IndexOutOfBoundsException.class) public void splitOverUpperBound() throws Exception { InvariantSpan span = new InvariantSpan(100, 10, documentHash); span.split(15); } | @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= leftPartitionWidth) { throw new Index... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... |
@Test public void hashBlock() throws Exception { DocumentFile.Builder builder = new DocumentFile.Builder("fakeHash"); builder.previousHashBlock("sadasdsad"); DocumentFile file = builder.build(); assertEquals("sadasdsad", file.getHashPreviousBlock()); } | public String getHashPreviousBlock() { return hashPreviousBlock; } | DocumentFile { public String getHashPreviousBlock() { return hashPreviousBlock; } } | DocumentFile { public String getHashPreviousBlock() { return hashPreviousBlock; } private DocumentFile(); } | DocumentFile { public String getHashPreviousBlock() { return hashPreviousBlock; } private DocumentFile(); static org.oulipo.streams.Compiler<DocumentFile> compiler(); static Decompiler<DocumentFile> decompiler(); Map<Integer, String> get(); String getDocumentHash(); String getEncyptedInvariantStream(); String getGenes... | DocumentFile { public String getHashPreviousBlock() { return hashPreviousBlock; } private DocumentFile(); static org.oulipo.streams.Compiler<DocumentFile> compiler(); static Decompiler<DocumentFile> decompiler(); Map<Integer, String> get(); String getDocumentHash(); String getEncyptedInvariantStream(); String getGenes... |
@Test(expected = IndexOutOfBoundsException.class) public void splitStart() throws Exception { InvariantSpan span = new InvariantSpan(1, 4, documentHash); span.split(0); } | @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= leftPartitionWidth) { throw new Index... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... | InvariantSpan implements Invariant { @Override public StreamElementPartition<InvariantSpan> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IndexOutOfBoundsException( "Partition width must be greater than 0, partitionWidth = " + leftPartitionWidth); } if (width <= ... |
@Test public void root() throws Exception { assertTrue(new Node<InvariantSpan>(10).isRoot()); } | public boolean isRoot() { return parent == null; } | Node { public boolean isRoot() { return parent == null; } } | Node { public boolean isRoot() { return parent == null; } Node(long weight); Node(T value); } | Node { public boolean isRoot() { return parent == null; } Node(long weight); Node(T value); long characterCount(); boolean isLeaf(); boolean isRightNode(); boolean isRoot(); Node<T> split(long leftPartitionWidth); @Override String toString(); } | Node { public boolean isRoot() { return parent == null; } Node(long weight); Node(T value); long characterCount(); boolean isLeaf(); boolean isRightNode(); boolean isRoot(); Node<T> split(long leftPartitionWidth); @Override String toString(); public boolean isRed; public Node<T> left; public Node<T> parent; public Nod... |
@Test public void simpleSplit() throws Exception { Node<InvariantSpan> node = new Node<InvariantSpan>(new InvariantSpan(1, 10, documentHash)); Node<InvariantSpan> result = node.split(5); assertNotNull(result.left); assertNotNull(result.right); assertEquals(new InvariantSpan(1, 5, documentHash), result.left.value); asse... | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test public void split13() throws Exception { Node<InvariantSpan> result = getK().split(2); assertEquals(new InvariantSpan(300, 2, documentHash), result.left.value); assertEquals(new InvariantSpan(302, 2, documentHash), result.right.value); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test(expected = MalformedSpanException.class) public void splitBranch() throws Exception { new Node<InvariantSpan>(10).split(5); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test public void splitEdge() throws Exception { Node<InvariantSpan> result = getE().split(4); assertEquals(new InvariantSpan(100, 4, documentHash), result.left.value); assertEquals(new InvariantSpan(104, 2, documentHash), result.right.value); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test public void splitF() throws Exception { Node<InvariantSpan> result = getF().split(2); assertEquals(new InvariantSpan(200, 2, documentHash), result.left.value); assertEquals(new InvariantSpan(202, 1, documentHash), result.right.value); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test public void splitMinEdge() throws Exception { Node<InvariantSpan> result = getE().split(1); assertEquals(new InvariantSpan(100, 1, documentHash), result.left.value); assertEquals(new InvariantSpan(101, 5, documentHash), result.right.value); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test(expected = IllegalArgumentException.class) public void splitNegative() throws Exception { Node<InvariantSpan> node = new Node<InvariantSpan>(new InvariantSpan(1, 10, documentHash)); node.split(-1); } | public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartitionWidt... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... | Node { public Node<T> split(long leftPartitionWidth) throws MalformedSpanException { if (leftPartitionWidth < 1) { throw new IllegalArgumentException("leftPartitionWidth must be greater than 0"); } if (!isLeaf()) { throw new MalformedSpanException("Can only split a leaf node"); } Node<T> parent = new Node<T>(leftPartit... |
@Test public void streamLoadable() throws Exception { File file = new File("target/streams-junit/FileInvariantStream-" + System.currentTimeMillis() + ".txt"); InvariantStream stream = new FileInvariantStream(file, null, "fakeHash", null); stream.append("Hello"); stream.append("Xanadu"); } | @Override public InvariantSpan append(String text) throws IOException, MalformedSpanException { if (Strings.isNullOrEmpty(text)) { throw new MalformedSpanException("No text - span length is 0"); } FileLock lock = channel.lock(); try { InvariantSpan span = new InvariantSpan(channel.position() + 1, text.length(), documen... | FileInvariantStream implements InvariantStream { @Override public InvariantSpan append(String text) throws IOException, MalformedSpanException { if (Strings.isNullOrEmpty(text)) { throw new MalformedSpanException("No text - span length is 0"); } FileLock lock = channel.lock(); try { InvariantSpan span = new InvariantSp... | FileInvariantStream implements InvariantStream { @Override public InvariantSpan append(String text) throws IOException, MalformedSpanException { if (Strings.isNullOrEmpty(text)) { throw new MalformedSpanException("No text - span length is 0"); } FileLock lock = channel.lock(); try { InvariantSpan span = new InvariantSp... | FileInvariantStream implements InvariantStream { @Override public InvariantSpan append(String text) throws IOException, MalformedSpanException { if (Strings.isNullOrEmpty(text)) { throw new MalformedSpanException("No text - span length is 0"); } FileLock lock = channel.lock(); try { InvariantSpan span = new InvariantSp... | FileInvariantStream implements InvariantStream { @Override public InvariantSpan append(String text) throws IOException, MalformedSpanException { if (Strings.isNullOrEmpty(text)) { throw new MalformedSpanException("No text - span length is 0"); } FileLock lock = channel.lock(); try { InvariantSpan span = new InvariantSp... |
@Test public void addEncryptedTextCompile() throws Exception { KeyPairGenerator keyGen = KeyPairGenerator.getInstance("RSA"); keyGen.initialize(2056); KeyPair pair = keyGen.generateKeyPair(); DocumentFile.Builder builder = new DocumentFile.Builder("fakeHash"); builder.appendEncryptedText("Xanadu"); builder.appendEncryp... | @Override public String compileEncrypted(DocumentFile doc, ECKey ecKey, Key key) throws Exception { if (ecKey == null) { throw new IllegalArgumentException("ECKey is null"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new DataOutputStream(baos); String publicKeyHash = URLDecoder.de... | DocumentFileCompiler implements Compiler<DocumentFile> { @Override public String compileEncrypted(DocumentFile doc, ECKey ecKey, Key key) throws Exception { if (ecKey == null) { throw new IllegalArgumentException("ECKey is null"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new Dat... | DocumentFileCompiler implements Compiler<DocumentFile> { @Override public String compileEncrypted(DocumentFile doc, ECKey ecKey, Key key) throws Exception { if (ecKey == null) { throw new IllegalArgumentException("ECKey is null"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new Dat... | DocumentFileCompiler implements Compiler<DocumentFile> { @Override public String compileEncrypted(DocumentFile doc, ECKey ecKey, Key key) throws Exception { if (ecKey == null) { throw new IllegalArgumentException("ECKey is null"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new Dat... | DocumentFileCompiler implements Compiler<DocumentFile> { @Override public String compileEncrypted(DocumentFile doc, ECKey ecKey, Key key) throws Exception { if (ecKey == null) { throw new IllegalArgumentException("ECKey is null"); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream os = new Dat... |
@Test public void createNodeParitionAlongRightCut() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 10, documentHash)); Node<InvariantSpan> right = new Node<>(new InvariantSpan(1, 20, documentHash)); Node<InvariantSpan> root = new Node.Builder<InvariantSpan>(10).left(left).right(right).bui... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionLeafRoot() throws Exception { Node<InvariantSpan> root = new Node<InvariantSpan>(new InvariantSpan(1, 10, documentHash)); NodePartition<InvariantSpan> part = Partitioner.createNodePartition(5, root); assertEquals(new InvariantSpan(1, 5, documentHash), part.left.value); assertEquals(... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionLinearList() throws Exception { Node<InvariantSpan> a = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> b = new Node<>(new InvariantSpan(2, 1, documentHash)); Node<InvariantSpan> c = new Node<>(new InvariantSpan(3, 1, documentHash)); Node<InvariantSpan> d = ne... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionLinearList2() throws Exception { Node<InvariantSpan> a = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> b = new Node<>(new InvariantSpan(2, 1, documentHash)); Node<InvariantSpan> c = new Node<>(new InvariantSpan(3, 1, documentHash)); Node<InvariantSpan> d = n... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void createNodePartitionMiddle() throws Exception { Node<InvariantSpan> a = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> b = new Node<>(new InvariantSpan(2, 1, documentHash)); Node<InvariantSpan> c = new Node<>(new InvariantSpan(3, 1, documentHash)); Node<InvariantSpan> d = new No... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionRootBadPosition() throws Exception { NodePartition<InvariantSpan> part = Partitioner.createNodePartition(0, new Node<InvariantSpan>(new InvariantSpan(1, 10, documentHash))); assertEquals(new InvariantSpan(1, 10, documentHash), part.right.value); assertNull(part.left); } | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionRootBeyondRangePutLeft() throws Exception { NodePartition<InvariantSpan> part = Partitioner.createNodePartition(12, new Node<InvariantSpan>(new InvariantSpan(1, 10, documentHash))); assertEquals(new InvariantSpan(1, 10, documentHash), part.left.value); assertNull(part.right); } | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createNodePartitionWithRightLeaningIndexNode() throws Exception { Node<InvariantSpan> a = new Node<>(new InvariantSpan(2, 1, documentHash)); Node<InvariantSpan> b = new Node<>(new InvariantSpan(3, 1, documentHash)); Node<InvariantSpan> c = new Node<>(new InvariantSpan(4, 1, documentHash)); Node<Invari... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void createPartition() throws Exception { Node<InvariantSpan> A = new Node<InvariantSpan>(2); Node<InvariantSpan> B = new Node<>(1); Node<InvariantSpan> C = new Node<>(new InvariantSpan(4, 1, documentHash)); Node<InvariantSpan> D = new Node<>(new InvariantSpan(2, 1, documentHash)); Node<InvariantSpan> E = ... | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test(expected = IllegalStateException.class) public void partitionNullNode() throws Exception { Partitioner.createNodePartition(2, null); } | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void encodeDecode() throws Exception { ToggleOverlayOp op = new ToggleOverlayOp(new VariantSpan(100, 1), 10); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.TOGGLE_OVERLAY, dis.readByte()); ToggleOverlayOp decoded = new ToggleOverlayOp(... | @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIndex); } os.flush(); return os... | ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIn... | ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIn... | ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIn... | ToggleOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.TOGGLE_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypeIn... |
@Test(expected = IllegalStateException.class) public void partitionNullRoot() throws Exception { Partitioner.createNodePartition(2, null); } | public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Width of left pa... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... | Partitioner { public static <T extends StreamElement> NodePartition<T> createNodePartition(long leftPartitionWidth, Node<T> x) throws MalformedSpanException { if (x == null) { throw new IllegalStateException("Attempting to partition a null node"); } if (leftPartitionWidth < 0) { throw new IndexOutOfBoundsException( "Wi... |
@Test public void prune() throws Exception { Node<InvariantSpan> a = new Node<>(new InvariantSpan(300, 4, documentHash)); Node<InvariantSpan> b = new Node<>(new InvariantSpan(350, 1, documentHash)); Node<InvariantSpan> c = new Node<>(new InvariantSpan(360, 1, documentHash)); Node<InvariantSpan> d = new Node<>(new Invar... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void prune11() throws Exception { Node<InvariantSpan> root = getA(); NodeIndex<InvariantSpan> j = RopeUtils.index(11, root, 0); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(j.node, 11, j.displacement); assertEquals(2, orphans.size()); assertEquals("K", orphans.get(0).tag); assertEquals("H... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void prune6() throws Exception { Node<InvariantSpan> root = getA(); NodeIndex<InvariantSpan> e = RopeUtils.index(6, root, 0); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(e.node, 6, e.displacement); assertEquals(2, orphans.size()); assertEquals("F", orphans.get(0).tag); assertEquals("D", ... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void prune9() throws Exception { Node<InvariantSpan> root = getA(); NodeIndex<InvariantSpan> f = RopeUtils.index(9, root, 0); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(f.node, 9, f.displacement); assertEquals(1, orphans.size()); assertEquals("D", orphans.get(0).tag); assertEquals(9, ro... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void pruneNullLeft() throws Exception { Node<InvariantSpan> right = new Node<>(new InvariantSpan(2, 1, documentHash)); new Node.Builder<InvariantSpan>(0).right(right).build(); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(right, 1, 0); assertEquals(0, orphans.size()); } | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void pruneNullRight() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 1, documentHash)); new Node.Builder<InvariantSpan>(1).left(left).build(); List<Node<InvariantSpan>> orphans = Partitioner.pruneIndexNode(left, 1, 0); assertEquals(0, orphans.size()); } | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void pruneRight() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> right = new Node<>(1); right.left = new Node<InvariantSpan>(new InvariantSpan(50, 1, documentHash)); right.right = new Node<InvariantSpan>(new InvariantSpan(100, 1, documen... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void pruneRight2() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 4, documentHash)); Node<InvariantSpan> right = new Node<>(new InvariantSpan(1, 20, documentHash)); new Node.Builder<InvariantSpan>(4).left(left).right(right).build(); List<Node<InvariantSpan>> orphans = Partiti... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void pruneRightWithNoChildLeft() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> right = new Node<>(1); right.right = new Node<InvariantSpan>(new InvariantSpan(100, 1, documentHash)); right.tag = "RGHT"; new Node.Builder<InvariantSpan>(1)... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void encode() throws Exception { ApplyOverlayOp op = new ApplyOverlayOp(new VariantSpan(1, 100), Sets.newHashSet(1, 10)); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.APPLY_OVERLAY, dis.read()); assertEquals(1, dis.readLong()); assert... | @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : link... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... |
@Test public void pruneSimpleRight() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> right = new Node<>(new InvariantSpan(2, 1, documentHash)); new Node.Builder<InvariantSpan>(1).left(left).right(right).build(); List<Node<InvariantSpan>> orphans = Par... | public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.parent.isRed = f... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... | Partitioner { public static <S extends StreamElement> List<Node<S>> pruneIndexNode(Node<S> indexNode, long leftPartitionWidth, long displacement) { if (indexNode.isRightNode()) { if (indexNode.parent.parent != null) { if (indexNode.parent.left != null) { displacement -= indexNode.parent.left.weight; indexNode.parent.pa... |
@Test public void copy() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); stream.copy(2, new VariantSpan(12, 3)); List<InvariantSpan> spans = stream.getStreamElements(); assertEquals(new InvariantSpan(100, 1, documentHash), spans.get(0)); assertEquals(new Invariant... | @Override public void copy(long characterPosition, VariantSpan variantSpan) throws MalformedSpanException, IOException { putElements(characterPosition, getStreamElements(variantSpan)); } | RopeVariantStream implements VariantStream<T> { @Override public void copy(long characterPosition, VariantSpan variantSpan) throws MalformedSpanException, IOException { putElements(characterPosition, getStreamElements(variantSpan)); } } | RopeVariantStream implements VariantStream<T> { @Override public void copy(long characterPosition, VariantSpan variantSpan) throws MalformedSpanException, IOException { putElements(characterPosition, getStreamElements(variantSpan)); } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, Node<... | RopeVariantStream implements VariantStream<T> { @Override public void copy(long characterPosition, VariantSpan variantSpan) throws MalformedSpanException, IOException { putElements(characterPosition, getStreamElements(variantSpan)); } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, Node<... | RopeVariantStream implements VariantStream<T> { @Override public void copy(long characterPosition, VariantSpan variantSpan) throws MalformedSpanException, IOException { putElements(characterPosition, getStreamElements(variantSpan)); } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, Node<... |
@Test public void delete() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); stream.delete(new VariantSpan(12, 4)); List<InvariantSpan> spans = stream.getStreamElements(); assertEquals(new InvariantSpan(100, 6, documentHash), spans.get(0)); assertEquals(new Invarian... | @Override public void delete(VariantSpan variantSpan) throws MalformedSpanException { if (variantSpan == null) { throw new MalformedSpanException("Variant span is null for delete operation"); } deleteRange(variantSpan); } | RopeVariantStream implements VariantStream<T> { @Override public void delete(VariantSpan variantSpan) throws MalformedSpanException { if (variantSpan == null) { throw new MalformedSpanException("Variant span is null for delete operation"); } deleteRange(variantSpan); } } | RopeVariantStream implements VariantStream<T> { @Override public void delete(VariantSpan variantSpan) throws MalformedSpanException { if (variantSpan == null) { throw new MalformedSpanException("Variant span is null for delete operation"); } deleteRange(variantSpan); } RopeVariantStream(String documentHash); RopeVaria... | RopeVariantStream implements VariantStream<T> { @Override public void delete(VariantSpan variantSpan) throws MalformedSpanException { if (variantSpan == null) { throw new MalformedSpanException("Variant span is null for delete operation"); } deleteRange(variantSpan); } RopeVariantStream(String documentHash); RopeVaria... | RopeVariantStream implements VariantStream<T> { @Override public void delete(VariantSpan variantSpan) throws MalformedSpanException { if (variantSpan == null) { throw new MalformedSpanException("Variant span is null for delete operation"); } deleteRange(variantSpan); } RopeVariantStream(String documentHash); RopeVaria... |
@Test public void getInvariantSpan() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash); List<InvariantSpan> spans = Arrays.asList(new InvariantSpan(1, 11, documentHash)); stream.putElements(1, spans); List<InvariantSpan> results = stream.getStreamElements(new VariantSpan(5, ... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansBeyondWidthOk() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(10, 700)); assertEquals(new InvariantSpan(250, 2, documentHash), spans.get(0)); assertEquals(new... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansMiddle() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(10, 7)); assertEquals(new InvariantSpan(250, 2, documentHash), spans.get(0)); assertEquals(new Invarian... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansMiddle2() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(10, 6, documentHash)); assertEquals(new InvariantSpan(250, 2, documentHash), spans.get(0)); assertEqua... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansRangeEdgeLeft() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(1, 14)); assertEquals(new InvariantSpan(100, 6, documentHash), spans.get(0)); assertEquals(new I... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansSmallWidthLeft() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(1, 1)); assertEquals(new InvariantSpan(100, 1, documentHash), spans.get(0)); } | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void getInvariantSpansSmallWidthRight() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); List<InvariantSpan> spans = stream.getStreamElements(new VariantSpan(21, 1)); assertEquals(new InvariantSpan(365, 1, documentHash), spans.get(0)); } | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void encodeDecode() throws Exception { ApplyOverlayOp op = new ApplyOverlayOp(new VariantSpan(1, 100), Sets.newHashSet(1, 10)); byte[] data = op.encode(); DataInputStream dis = new DataInputStream(new ByteArrayInputStream(data)); assertEquals(Op.APPLY_OVERLAY, dis.readByte()); ApplyOverlayOp decoded = new ... | @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.size()); for (Integer i : link... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... | ApplyOverlayOp extends Op { @Override public byte[] encode() throws IOException { ByteArrayOutputStream os = new ByteArrayOutputStream(); try (DataOutputStream dos = new DataOutputStream(os)) { dos.writeByte(Op.APPLY_OVERLAY); dos.writeLong(variantSpan.start); dos.writeLong(variantSpan.width); dos.writeInt(linkTypes.si... |
@Test public void getVariantSpansTwoIntersect() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash); List<InvariantSpan> spans = Arrays.asList(new InvariantSpan(7, 5, documentHash), new InvariantSpan(4, 3, documentHash), new InvariantSpan(1, 3, documentHash)); stream.putElemen... | @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i); long targetStart = targetSpan.getStart(); lon... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... |
@Test public void getVariantSpansTwoIntersect2() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash); List<InvariantSpan> spans = Arrays.asList(new InvariantSpan(7, 5, documentHash), new InvariantSpan(4, 3, documentHash), new InvariantSpan(1, 3, documentHash)); stream.putEleme... | @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i); long targetStart = targetSpan.getStart(); lon... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... | RopeVariantStream implements VariantStream<T> { @Override public List<VariantSpan> getVariantSpans(InvariantSpan targetSpan) throws MalformedSpanException { long index = 1; List<VariantSpan> vspans = new ArrayList<>(); List<T> spans = getStreamElements(); for (int i = 0; i < spans.size(); i++) { T element = spans.get(i... |
@Test public void index() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); InvariantSpan span = stream.index(12); assertEquals(new InvariantSpan(300, 4, documentHash), span); } | @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... |
@Test public void index11() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); InvariantSpan span = stream.index(11); assertEquals(new InvariantSpan(250, 2, documentHash), span); span = stream.index(10); assertEquals(new InvariantSpan(250, 2, documentHash), span); } | @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... |
@Test(expected = IndexOutOfBoundsException.class) public void indexNull() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); InvariantSpan span = stream.index(100); assertNull(span); } | @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } } | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... | RopeVariantStream implements VariantStream<T> { @Override public T index(long characterPosition) { if (root == null) { throw new IllegalStateException("Stream is empty"); } return RopeUtils.index(characterPosition, root, 0).node.value; } RopeVariantStream(String documentHash); RopeVariantStream(String documentHash, No... |
@Test public void put() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); stream.put(12, new InvariantSpan(500, 34, documentHash)); List<InvariantSpan> spans = stream.getStreamElements(); assertEquals(new InvariantSpan(100, 6, documentHash), spans.get(0)); assertEqu... | @Override public void put(long characterPosition, T val) throws MalformedSpanException { if (val == null) { throw new IllegalArgumentException("invariant span is null"); } if (characterPosition < 1) { throw new IndexOutOfBoundsException("put position must be greater than 0"); } if (val.getWidth() < 1) { throw new Malfo... | RopeVariantStream implements VariantStream<T> { @Override public void put(long characterPosition, T val) throws MalformedSpanException { if (val == null) { throw new IllegalArgumentException("invariant span is null"); } if (characterPosition < 1) { throw new IndexOutOfBoundsException("put position must be greater than ... | RopeVariantStream implements VariantStream<T> { @Override public void put(long characterPosition, T val) throws MalformedSpanException { if (val == null) { throw new IllegalArgumentException("invariant span is null"); } if (characterPosition < 1) { throw new IndexOutOfBoundsException("put position must be greater than ... | RopeVariantStream implements VariantStream<T> { @Override public void put(long characterPosition, T val) throws MalformedSpanException { if (val == null) { throw new IllegalArgumentException("invariant span is null"); } if (characterPosition < 1) { throw new IndexOutOfBoundsException("put position must be greater than ... | RopeVariantStream implements VariantStream<T> { @Override public void put(long characterPosition, T val) throws MalformedSpanException { if (val == null) { throw new IllegalArgumentException("invariant span is null"); } if (characterPosition < 1) { throw new IndexOutOfBoundsException("put position must be greater than ... |
@Test public void putSpans() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash); List<InvariantSpan> spans = Arrays.asList(new InvariantSpan(7, 5, documentHash), new InvariantSpan(4, 3, documentHash), new InvariantSpan(1, 3, documentHash)); stream.putElements(1, spans); List<... | @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return elements; } | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... | RopeVariantStream implements VariantStream<T> { @Override public List<T> getStreamElements() throws MalformedSpanException { List<T> elements = new ArrayList<>(); Iterator<Node<T>> it = getAllLeafNodes(); while (it.hasNext()) { Node<T> node = it.next(); if (node.value != null) { elements.add(node.value); } } return ele... |
@Test public void swap() throws Exception { VariantStream<InvariantSpan> stream = new RopeVariantStream<>(documentHash, getA()); stream.swap(new VariantSpan(1, 3), new VariantSpan(12, 3)); List<InvariantSpan> spans = stream.getStreamElements(); assertEquals(new InvariantSpan(300, 3, documentHash), spans.get(0)); assert... | @Override public void swap(VariantSpan v1, VariantSpan v2) throws MalformedSpanException { Node<T> from = deleteRange(v1); from.parent = null; long startV2 = v2.start - v1.width; Node<T> to = deleteRange(new VariantSpan(startV2, v2.width)); to.parent = null; insert(v1.start, to); insert(v2.start, from); } | RopeVariantStream implements VariantStream<T> { @Override public void swap(VariantSpan v1, VariantSpan v2) throws MalformedSpanException { Node<T> from = deleteRange(v1); from.parent = null; long startV2 = v2.start - v1.width; Node<T> to = deleteRange(new VariantSpan(startV2, v2.width)); to.parent = null; insert(v1.sta... | RopeVariantStream implements VariantStream<T> { @Override public void swap(VariantSpan v1, VariantSpan v2) throws MalformedSpanException { Node<T> from = deleteRange(v1); from.parent = null; long startV2 = v2.start - v1.width; Node<T> to = deleteRange(new VariantSpan(startV2, v2.width)); to.parent = null; insert(v1.sta... | RopeVariantStream implements VariantStream<T> { @Override public void swap(VariantSpan v1, VariantSpan v2) throws MalformedSpanException { Node<T> from = deleteRange(v1); from.parent = null; long startV2 = v2.start - v1.width; Node<T> to = deleteRange(new VariantSpan(startV2, v2.width)); to.parent = null; insert(v1.sta... | RopeVariantStream implements VariantStream<T> { @Override public void swap(VariantSpan v1, VariantSpan v2) throws MalformedSpanException { Node<T> from = deleteRange(v1); from.parent = null; long startV2 = v2.start - v1.width; Node<T> to = deleteRange(new VariantSpan(startV2, v2.width)); to.parent = null; insert(v1.sta... |
@Test public void addWeightsOfRightLeaningChildNodesChained() throws Exception { Node<InvariantSpan> right = new Node<>(new InvariantSpan(1, 10, documentHash)); Node<InvariantSpan> right2 = new Node<>(new InvariantSpan(1, 20, documentHash)); right.right = right2; Node<InvariantSpan> x = new Node.Builder<InvariantSpan>(... | public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaning... | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaning... |
@Test public void addWeightsOfRightLeaningChildNodesLeftOnly() throws Exception { Node<InvariantSpan> left = new Node<>(new InvariantSpan(1, 1, documentHash)); Node<InvariantSpan> x = new Node.Builder<InvariantSpan>(1).left(left).build(); assertEquals(0, RopeUtils.addWeightsOfRightLeaningChildNodes(x)); } | public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } } | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaning... | RopeUtils { public static <T extends StreamElement> long addWeightsOfRightLeaningChildNodes(Node<T> x) { if (x == null || x.right == null) { return 0; } return x.right.weight + addWeightsOfRightLeaningChildNodes(x.right); } static long addWeightsOfRightLeaningChildNodes(Node<T> x); static long addWeightsOfRightLeaning... |
@Test public void equalsLinkTypesFalse() throws Exception { ApplyOverlayOp op1 = new ApplyOverlayOp(new VariantSpan(1, 100), Sets.newHashSet(1)); ApplyOverlayOp op2 = new ApplyOverlayOp(new VariantSpan(1, 100), Sets.newHashSet(1, 10)); assertFalse(op1.equals(op2)); assertFalse(op2.equals(op1)); } | @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ApplyOverlayOp other = (ApplyOverlayOp) obj; if (!linkTypes.equals(other.linkTypes)) return false; if (!variantSpan.equals(other.variantSpan)) return false; r... | ApplyOverlayOp extends Op { @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ApplyOverlayOp other = (ApplyOverlayOp) obj; if (!linkTypes.equals(other.linkTypes)) return false; if (!variantSpan.equals(other.v... | ApplyOverlayOp extends Op { @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ApplyOverlayOp other = (ApplyOverlayOp) obj; if (!linkTypes.equals(other.linkTypes)) return false; if (!variantSpan.equals(other.v... | ApplyOverlayOp extends Op { @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ApplyOverlayOp other = (ApplyOverlayOp) obj; if (!linkTypes.equals(other.linkTypes)) return false; if (!variantSpan.equals(other.v... | ApplyOverlayOp extends Op { @Override public boolean equals(Object obj) { if (this == obj) return true; if (!super.equals(obj)) return false; if (getClass() != obj.getClass()) return false; ApplyOverlayOp other = (ApplyOverlayOp) obj; if (!linkTypes.equals(other.linkTypes)) return false; if (!variantSpan.equals(other.v... |
@Test public void testGranularityFromSlotKey() { Granularity expected = Granularity.MIN_5; Granularity myGranularity = SlotKeySerDes.granularityFromSlotKey(SlotKey.of(expected, 1, 1).toString()); Assert.assertNotNull(myGranularity); Assert.assertEquals(myGranularity, expected); myGranularity = SlotKeySerDes.granularity... | protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; } | SlotKeySerDes { protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; } } | SlotKeySerDes { protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; } } | SlotKeySerDes { protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; } static SlotKey deserialize(String stateStr); String serialize(SlotKey slotKey); String serialize... | SlotKeySerDes { protected static Granularity granularityFromSlotKey(String s) { String field = s.split(",", -1)[0]; for (Granularity g : Granularity.granularities()) if (g.name().startsWith(field)) return g; return null; } static SlotKey deserialize(String stateStr); String serialize(SlotKey slotKey); String serialize... |
@Test public void testGetLocatorsForReRollLowerLevelToStorageGranularity() throws IOException { boolean isReroll = true; SlotKey destSlotKey = SlotKey.of(Granularity.MIN_5, 0, TEST_SHARD); Granularity delayedMetricsRerollGranularity = Granularity.MIN_60; Granularity delayedMetricsStorageGranularity = Granularity.MIN_20... | protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && !getGranularity().isCoarser(delayedMetricsR... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... |
@Test public void testGetLocatorsForReRollSameAsStorageGranularity() throws IOException { boolean isReroll = true; SlotKey destSlotKey = SlotKey.of(Granularity.MIN_20, 0, TEST_SHARD); Granularity delayedMetricsRerollGranularity = Granularity.MIN_60; Granularity delayedMetricsStorageGranularity = Granularity.MIN_20; Loc... | protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && !getGranularity().isCoarser(delayedMetricsR... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... |
@Test public void testGetLocatorsForReRollHigherLevelToStorageGranularity() throws IOException { boolean isReroll = true; SlotKey destSlotKey = SlotKey.of(Granularity.MIN_60, 0, TEST_SHARD); Granularity delayedMetricsRerollGranularity = Granularity.MIN_60; Granularity delayedMetricsStorageGranularity = Granularity.MIN_... | protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && !getGranularity().isCoarser(delayedMetricsR... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... |
@Test public void testGetLocatorsForReRollHigherLevelToRerollGranularity() throws IOException { boolean isReroll = true; SlotKey destSlotKey = SlotKey.of(Granularity.MIN_240, 0, TEST_SHARD); Granularity delayedMetricsRerollGranularity = Granularity.MIN_60; Granularity delayedMetricsStorageGranularity = Granularity.MIN_... | protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && !getGranularity().isCoarser(delayedMetricsR... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... | LocatorFetchRunnable implements Runnable { protected Set<Locator> getLocators(RollupExecutionContext executionContext, boolean isReroll, Granularity delayedMetricsRerollGranularity, Granularity delayedMetricsStorageGranularity) { Set<Locator> locators = new HashSet<Locator>(); if (RECORD_DELAYED_METRICS && isReroll && ... |
@Test public void testOnce() { emitter.once(testEventName, listener); emitter.emit(testEventName, new RollupEvent(null, null, "payload1", "gran", 0)); Assert.assertEquals(store.size(), 1); store.clear(); emitter.emit(testEventName, new RollupEvent(null, null, "payload1", "gran", 0)); Assert.assertEquals(store.size(), 0... | public Emitter once(final String event, final Listener<T> fn) { Listener on = new Listener<T>() { @Override public void call(T... args) { Emitter.this.off(event, this); fn.call(args); } }; this.onceCallbacks.put(fn, on); this.on(event, on); return this; } | Emitter { public Emitter once(final String event, final Listener<T> fn) { Listener on = new Listener<T>() { @Override public void call(T... args) { Emitter.this.off(event, this); fn.call(args); } }; this.onceCallbacks.put(fn, on); this.on(event, on); return this; } } | Emitter { public Emitter once(final String event, final Listener<T> fn) { Listener on = new Listener<T>() { @Override public void call(T... args) { Emitter.this.off(event, this); fn.call(args); } }; this.onceCallbacks.put(fn, on); this.on(event, on); return this; } } | Emitter { public Emitter once(final String event, final Listener<T> fn) { Listener on = new Listener<T>() { @Override public void call(T... args) { Emitter.this.off(event, this); fn.call(args); } }; this.onceCallbacks.put(fn, on); this.on(event, on); return this; } Emitter on(String event, Listener fn); Emitter once(f... | Emitter { public Emitter once(final String event, final Listener<T> fn) { Listener on = new Listener<T>() { @Override public void call(T... args) { Emitter.this.off(event, this); fn.call(args); } }; this.onceCallbacks.put(fn, on); this.on(event, on); return this; } Emitter on(String event, Listener fn); Emitter once(f... |
@Test public void testOn() { emitter.on(testEventName, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName, event1); Assert.assertEquals(1, store.size()); Assert.assertSame(event1, store.get(0)); emitter.emit(testEventName, event2); Assert.assertEquals(2, store.size()); Assert.assertSame(event1,... | public Emitter on(String event, Listener fn) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); if (callbacks == null) { callbacks = new ConcurrentLinkedQueue<Listener>(); ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks); if (_callbacks != null) { callbacks... | Emitter { public Emitter on(String event, Listener fn) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); if (callbacks == null) { callbacks = new ConcurrentLinkedQueue<Listener>(); ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks); if (_callbacks != null) {... | Emitter { public Emitter on(String event, Listener fn) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); if (callbacks == null) { callbacks = new ConcurrentLinkedQueue<Listener>(); ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks); if (_callbacks != null) {... | Emitter { public Emitter on(String event, Listener fn) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); if (callbacks == null) { callbacks = new ConcurrentLinkedQueue<Listener>(); ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks); if (_callbacks != null) {... | Emitter { public Emitter on(String event, Listener fn) { ConcurrentLinkedQueue<Listener> callbacks = this.callbacks.get(event); if (callbacks == null) { callbacks = new ConcurrentLinkedQueue<Listener>(); ConcurrentLinkedQueue<Listener> _callbacks = this.callbacks.putIfAbsent(event, callbacks); if (_callbacks != null) {... |
@Test public void locatorGetsSetInConstructor() { Assert.assertSame(locator, event.getLocator()); } | public Locator getLocator() { return locator; } | RollupEvent { public Locator getLocator() { return locator; } } | RollupEvent { public Locator getLocator() { return locator; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); } | RollupEvent { public Locator getLocator() { return locator; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } | RollupEvent { public Locator getLocator() { return locator; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } |
@Test public void rollupGetsSetInConstructor() { Assert.assertSame(rollup, event.getRollup()); } | public Rollup getRollup() { return rollup; } | RollupEvent { public Rollup getRollup() { return rollup; } } | RollupEvent { public Rollup getRollup() { return rollup; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); } | RollupEvent { public Rollup getRollup() { return rollup; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } | RollupEvent { public Rollup getRollup() { return rollup; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } |
@Test public void unitGetsSetInConstructor() { Assert.assertEquals(unit, event.getUnit()); } | public String getUnit() { return unit; } | RollupEvent { public String getUnit() { return unit; } } | RollupEvent { public String getUnit() { return unit; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); } | RollupEvent { public String getUnit() { return unit; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } | RollupEvent { public String getUnit() { return unit; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } |
@Test public void granularityGetsSetInConstructor() { Assert.assertEquals(granularity, event.getGranularityName()); } | public String getGranularityName() { return granularityName; } | RollupEvent { public String getGranularityName() { return granularityName; } } | RollupEvent { public String getGranularityName() { return granularityName; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); } | RollupEvent { public String getGranularityName() { return granularityName; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } | RollupEvent { public String getGranularityName() { return granularityName; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } |
@Test public void firstTimeRetryOnWriteTimeout_shouldRetry() throws Exception { RetryNTimes retryPolicy = new RetryNTimes(3, 3, 3); Statement mockStatement = mock( Statement.class ); RetryPolicy.RetryDecision retryResult = retryPolicy.onWriteTimeout(mockStatement, ConsistencyLevel.LOCAL_ONE, WriteType.BATCH, 1, 0, 0); ... | @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, requiredResponse %d, " + "receivedRespo... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... |
@Test public void timestampGetsSetInConstructor() { Assert.assertEquals(timestamp, event.getTimestamp()); } | public long getTimestamp() { return timestamp; } | RollupEvent { public long getTimestamp() { return timestamp; } } | RollupEvent { public long getTimestamp() { return timestamp; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); } | RollupEvent { public long getTimestamp() { return timestamp; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } | RollupEvent { public long getTimestamp() { return timestamp; } RollupEvent(Locator loc, Rollup rollup, String unit, String gran, long ts); Rollup getRollup(); Locator getLocator(); String getUnit(); String getGranularityName(); long getTimestamp(); void setUnit(String unit); } |
@Test public void testConcurrentEmission() throws InterruptedException, ExecutionException { emitter.on(testEventName, listener); ThreadPoolExecutor executors = new ThreadPoolBuilder() .withCorePoolSize(2) .withMaxPoolSize(3) .build(); final CountDownLatch startLatch = new CountDownLatch(1); Future<Object> f1 = executo... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void testUnsubscription() { emitter.on(testEventName, listener); emitter.off(testEventName, listener); Assert.assertFalse(emitter.listeners(testEventName).contains(listener)); store.clear(); emitter.emit(testEventName, new RollupEvent(null, null, "payload3", "gran", 0)); Assert.assertTrue(store.isEmpty());... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void testOnce() throws ExecutionException, InterruptedException { emitter.once(testEventName, listener); Future f = emitter.emit(testEventName, event1); f.get(); Assert.assertEquals(store.size(), 1); store.clear(); emitter.emit(testEventName, event2); Assert.assertEquals(store.size(), 0); } | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void testOn() { emitter.on(testEventName, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName, event1); Assert.assertEquals(1, store.size()); Assert.assertSame(event1, store.get(0)); emitter.emit(testEventName, event2); Assert.assertEquals(2, store.size()); Assert.assertSame(event1,... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void offClearsRegularCallbacks() { emitter.on(testEventName, listener); Assert.assertEquals(0, store.size()); emitter.off(); emitter.emit(testEventName, event1); Assert.assertEquals(0, store.size()); } | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void offClearsOnceCallbacks() { emitter.once(testEventName, listener); Assert.assertEquals(0, store.size()); emitter.off(); emitter.emit(testEventName, event1); Assert.assertEquals(0, store.size()); } | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void emitOnlyTriggersForGivenEvent1() { emitter.on(testEventName, listener); emitter.on(testEventName2, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName, event1); Assert.assertEquals(1, store.size()); Assert.assertSame(event1, store.get(0)); } | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void emitOnlyTriggersForGivenEvent2() { emitter.on(testEventName, listener); emitter.on(testEventName2, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName2, event2); Assert.assertEquals(1, store.size()); Assert.assertSame(event2, store.get(0)); } | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void emitTriggersListenerInSameOrder1() { emitter.on(testEventName, listener); emitter.on(testEventName2, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName, event1); emitter.emit(testEventName2, event2); Assert.assertEquals(2, store.size()); Assert.assertSame(event1, store.get(0))... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void maxTimeRetryOnWriteTimeout_shouldRethrow() throws Exception { RetryNTimes retryPolicy = new RetryNTimes(3, 3, 3); Statement mockStatement = mock( Statement.class ); RetryPolicy.RetryDecision retryResult = retryPolicy.onWriteTimeout(mockStatement, ConsistencyLevel.LOCAL_ONE, WriteType.BATCH, 1, 0, 3); ... | @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, requiredResponse %d, " + "receivedRespo... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onWriteTimeout(Statement stmnt, ConsistencyLevel cl, WriteType wt, int requiredResponses, int receivedResponses, int wTime) { if (wTime < writeAttempts) { LOG.info(String.format("Retrying on WriteTimeout: stmnt %s, " + "consistency %s, writeType %s, re... |
@Test public void emitTriggersListenerInSameOrder2() { emitter.on(testEventName, listener); emitter.on(testEventName2, listener); Assert.assertEquals(0, store.size()); emitter.emit(testEventName2, event2); emitter.emit(testEventName, event1); Assert.assertEquals(2, store.size()); Assert.assertSame(event2, store.get(0))... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void offOnlyClearsForGivenEvent() { emitter.on(testEventName, listener); emitter.on(testEventName2, listener); Assert.assertEquals(0, store.size()); emitter.off(testEventName); emitter.emit(testEventName, event1); emitter.emit(testEventName2, event2); Assert.assertEquals(1, store.size()); Assert.assertSame... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void multipleAttachedListenersShouldAllBeTriggeredByOneEvent() { emitter.on(testEventName, listener); emitter.on(testEventName, listener2); Assert.assertEquals(0, store.size()); Assert.assertEquals(0, store2.size()); emitter.emit(testEventName, event1); Assert.assertEquals(1, store.size()); Assert.assertSa... | @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Override public Future call() { if (Util.shouldUseESForUn... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... | RollupEventEmitter extends Emitter<RollupEvent> { @Override public Future emit(final String event, final RollupEvent... eventPayload) { Future emitFuture = null; if(eventPayload[0].getRollup() instanceof BasicRollup && super.hasListeners(ROLLUP_EVENT_NAME)) { emitFuture = eventExecutors.submit(new Callable() { @Overrid... |
@Test public void testForCloseness() { int desiredPoints = 10; long start = Calendar.getInstance().getTimeInMillis(); Assert.assertEquals(Granularity.MIN_20, Granularity.granularityFromPointsInInterval("TENANTID1234",start, start + 10000000, desiredPoints)); Assert.assertEquals(Granularity.MIN_5, Granularity.granularit... | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... |
@Test public void testCommonPointRequests() { long HOUR = 3600000; long DAY = 24 * HOUR; Assert.assertEquals(Granularity.FULL, Granularity.granularityFromPointsInInterval("TENANTID1234",fromBaseMillis, fromBaseMillis+HOUR, 300)); Assert.assertEquals(Granularity.MIN_5, Granularity.granularityFromPointsInInterval("TENANT... | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... |
@Test public void coarserReturnsCoarser() throws GranularityException { Assert.assertSame(Granularity.MIN_5, Granularity.FULL.coarser()); Assert.assertSame(Granularity.MIN_20, Granularity.MIN_5.coarser()); Assert.assertSame(Granularity.MIN_60, Granularity.MIN_20.coarser()); Assert.assertSame(Granularity.MIN_240, Granul... | public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millis... | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millis... |
@Test(expected = GranularityException.class) public void testTooCoarse() throws Exception { Granularity.MIN_1440.coarser(); } | public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millis... | Granularity { public Granularity coarser() throws GranularityException { if (this == LAST) throw new GranularityException("Nothing coarser than " + name()); return granularities[index + 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millis... |
@Test public void finerReturnsFiner() throws GranularityException { Assert.assertSame(Granularity.FULL, Granularity.MIN_5.finer()); Assert.assertSame(Granularity.MIN_5, Granularity.MIN_20.finer()); Assert.assertSame(Granularity.MIN_20, Granularity.MIN_60.finer()); Assert.assertSame(Granularity.MIN_60, Granularity.MIN_2... | public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millisecon... | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millisecon... |
@Test(expected = GranularityException.class) public void testTooFine() throws Exception { Granularity.FULL.finer(); } | public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millisecon... | Granularity { public Granularity finer() throws GranularityException { if (this == FULL) throw new GranularityException("Nothing finer than " + name()); return granularities[index - 1]; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int millisecon... |
@Test(expected = RuntimeException.class) public void testToBeforeFromInterval() { Granularity.granularityFromPointsInInterval("TENANTID1234",fromBaseMillis+10000000, fromBaseMillis+0, 100); } | public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } } | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... | Granularity { public static Granularity granularityFromPointsInInterval(String tenantid, long from, long to, int points) { return granularityFromPointsInInterval(tenantid, from, to, points, GET_BY_POINTS_SELECTION_ALGORITHM, GET_BY_POINTS_ASSUME_INTERVAL, DEFAULT_TTL_COMPARISON_SOURCE); } private Granularity(String cf... |
@Test public void firstTimeRetryOnUnavailable_shouldRetry() throws Exception { RetryNTimes retryPolicy = new RetryNTimes(3, 3, 3); Statement mockStatement = mock( Statement.class ); RetryPolicy.RetryDecision retryResult = retryPolicy.onUnavailable(mockStatement, ConsistencyLevel.LOCAL_ONE, 1, 0, 0); RetryPolicy.RetryDe... | @Override public RetryDecision onUnavailable(Statement stmnt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, int uTime) { if (uTime < unavailableAttempts) { LOG.info(String.format("Retrying on unavailable: stmnt %s, consistency %s, " + "requiredResponse %d, receivedResponse %d, rTime %d", stmnt, cl,... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onUnavailable(Statement stmnt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, int uTime) { if (uTime < unavailableAttempts) { LOG.info(String.format("Retrying on unavailable: stmnt %s, consistency %s, " + "requiredResponse %d, recei... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onUnavailable(Statement stmnt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, int uTime) { if (uTime < unavailableAttempts) { LOG.info(String.format("Retrying on unavailable: stmnt %s, consistency %s, " + "requiredResponse %d, recei... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onUnavailable(Statement stmnt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, int uTime) { if (uTime < unavailableAttempts) { LOG.info(String.format("Retrying on unavailable: stmnt %s, consistency %s, " + "requiredResponse %d, recei... | RetryNTimes implements RetryPolicy { @Override public RetryDecision onUnavailable(Statement stmnt, ConsistencyLevel cl, int requiredResponses, int receivedResponses, int uTime) { if (uTime < unavailableAttempts) { LOG.info(String.format("Retrying on unavailable: stmnt %s, consistency %s, " + "requiredResponse %d, recei... |
@Test public void equalsWithSameValueReturnsTrue() { Assert.assertTrue(Granularity.FULL.equals(Granularity.FULL)); Assert.assertTrue(Granularity.MIN_5.equals(Granularity.MIN_5)); Assert.assertTrue(Granularity.MIN_20.equals(Granularity.MIN_20)); Assert.assertTrue(Granularity.MIN_60.equals(Granularity.MIN_60)); Assert.as... | @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... |
@Test public void equalsWithDifferentValueReturnsFalse() { Assert.assertFalse(Granularity.FULL.equals(Granularity.MIN_5)); Assert.assertFalse(Granularity.FULL.equals(Granularity.MIN_20)); Assert.assertFalse(Granularity.FULL.equals(Granularity.MIN_60)); Assert.assertFalse(Granularity.FULL.equals(Granularity.MIN_240)); A... | @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... |
@Test public void equalsWithNullReturnsFalse() { Assert.assertFalse(Granularity.FULL.equals(null)); Assert.assertFalse(Granularity.MIN_5.equals(null)); Assert.assertFalse(Granularity.MIN_20.equals(null)); Assert.assertFalse(Granularity.MIN_60.equals(null)); Assert.assertFalse(Granularity.MIN_240.equals(null)); Assert.a... | @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... |
@Test public void equalsWithNonGranularityObjectReturnsFalse() { Assert.assertFalse(Granularity.FULL.equals(new Object())); Assert.assertFalse(Granularity.MIN_5.equals(new Object())); Assert.assertFalse(Granularity.MIN_20.equals(new Object())); Assert.assertFalse(Granularity.MIN_60.equals(new Object())); Assert.assertF... | @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... | Granularity { @Override public boolean equals(Object obj) { if (!(obj instanceof Granularity)) return false; else return obj == this; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int numSlots(); Granularity coarser(); Granula... |
@Test public void fromStringFull() { String s = "metrics_full"; Granularity gran = Granularity.fromString(s); Assert.assertNotNull(gran); Assert.assertSame(Granularity.FULL, gran); } | public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... |
@Test public void fromString5m() { String s = "metrics_5m"; Granularity gran = Granularity.fromString(s); Assert.assertNotNull(gran); Assert.assertSame(Granularity.MIN_5, gran); } | public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... |
@Test public void fromString20m() { String s = "metrics_20m"; Granularity gran = Granularity.fromString(s); Assert.assertNotNull(gran); Assert.assertSame(Granularity.MIN_20, gran); } | public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... |
@Test public void fromString60m() { String s = "metrics_60m"; Granularity gran = Granularity.fromString(s); Assert.assertNotNull(gran); Assert.assertSame(Granularity.MIN_60, gran); } | public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... |
@Test public void fromString240m() { String s = "metrics_240m"; Granularity gran = Granularity.fromString(s); Assert.assertSame(Granularity.MIN_240, gran); } | public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); } | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... | Granularity { public static Granularity fromString(String s) { for (Granularity g : granularities) if (g.name().equals(s) || g.shortName().equals(s)) return g; return null; } private Granularity(String cf, int milliseconds, int numSlots, String shortName); String name(); String shortName(); int milliseconds(); int num... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.