aboutsummaryrefslogtreecommitdiffstats
path: root/vespajlib/src/main/java/com/yahoo/slime/Value.java
diff options
context:
space:
mode:
Diffstat (limited to 'vespajlib/src/main/java/com/yahoo/slime/Value.java')
-rw-r--r--vespajlib/src/main/java/com/yahoo/slime/Value.java80
1 files changed, 0 insertions, 80 deletions
diff --git a/vespajlib/src/main/java/com/yahoo/slime/Value.java b/vespajlib/src/main/java/com/yahoo/slime/Value.java
index 985fed6c6bb..1943e77663f 100644
--- a/vespajlib/src/main/java/com/yahoo/slime/Value.java
+++ b/vespajlib/src/main/java/com/yahoo/slime/Value.java
@@ -2,7 +2,6 @@
package com.yahoo.slime;
import java.io.ByteArrayOutputStream;
-import java.util.Arrays;
import java.util.function.Consumer;
/**
@@ -91,83 +90,4 @@ abstract class Value implements Cursor {
return "null";
}
}
-
- private static class Equal {
- protected final Inspector rhsInspector;
-
- protected boolean equal = true;
-
- public Equal(Inspector rhsInspector) { this.rhsInspector = rhsInspector; }
-
- public boolean isEqual() { return equal; }
- }
-
- private static class EqualArray extends Equal implements ArrayTraverser {
- public EqualArray(Inspector rhsInspector) { super(rhsInspector); }
-
- @Override
- public void entry(int idx, Inspector inspector) {
- if (equal) {
- equal = inspector.equalTo(rhsInspector.entry(idx));
- }
- }
- }
-
- private static class EqualObject extends Equal implements ObjectTraverser {
- public EqualObject(Inspector rhsInspector) { super(rhsInspector); }
-
- @Override
- public void field(String name, Inspector inspector) {
- if (equal) {
- equal = inspector.equalTo(rhsInspector.field(name));
- }
- }
- }
-
- @Override
- public boolean equalTo(Inspector that) {
- boolean equal = type() == that.type();
-
- if (equal) {
- switch (type()) {
- case NIX:
- equal = valid() == that.valid();
- break;
- case BOOL:
- equal = asBool() == that.asBool();
- break;
- case LONG:
- equal = asLong() == that.asLong();
- break;
- case DOUBLE:
- equal = Double.compare(asDouble(), that.asDouble()) == 0;
- break;
- case STRING:
- equal = asString().equals(that.asString());
- break;
- case DATA:
- equal = Arrays.equals(asData(), that.asData());
- break;
- case ARRAY:
- {
- var traverser = new EqualArray(that);
- traverse(traverser);
- equal = traverser.isEqual() && (entries() == that.entries());
- }
- break;
- case OBJECT:
- {
- var traverser = new EqualObject(that);
- traverse(traverser);
- equal = traverser.isEqual() && (fields() == that.fields());
- }
- break;
- default:
- assert(false);
- break;
- }
- }
-
- return equal;
- }
}