io.sirix.node.immutable.json.ImmutableNumberNode Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of sirix-core Show documentation
Show all versions of sirix-core Show documentation
SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.
package io.sirix.node.immutable.json;
import io.sirix.api.visitor.JsonNodeVisitor;
import io.sirix.api.visitor.VisitResult;
import io.sirix.node.NodeKind;
import io.sirix.node.interfaces.StructNode;
import net.openhft.chronicle.bytes.Bytes;
import io.sirix.node.json.NumberNode;
import java.nio.ByteBuffer;
import static java.util.Objects.requireNonNull;
/**
* Immutable NumberNode wrapper.
*
* @author Johannes Lichtenberger
*
*/
public final class ImmutableNumberNode extends AbstractImmutableJsonStructuralNode {
/** Mutable {@link NumberNode}. */
private final NumberNode node;
/**
* Private constructor.
*
* @param node {@link NumberNode} to wrap
*/
private ImmutableNumberNode(final NumberNode node) {
this.node = requireNonNull(node);
}
/**
* Get an immutable text node instance.
*
* @param node the mutable {@link NumberNode} to wrap
* @return immutable text node instance
*/
public static ImmutableNumberNode of(final NumberNode node) {
return new ImmutableNumberNode(node);
}
@Override
public VisitResult acceptVisitor(final JsonNodeVisitor visitor) {
return visitor.visit(this);
}
@Override
public StructNode structDelegate() {
return node.getStructNodeDelegate();
}
public Number getValue() {
return node.getValue();
}
@Override
public NodeKind getKind() {
return NodeKind.BOOLEAN_VALUE;
}
@Override
public long computeHash(Bytes bytes) {
return node.computeHash(bytes);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy