Class SerializableNode
- java.lang.Object
-
- it.unive.lisa.outputs.serializableGraph.SerializableNode
-
- All Implemented Interfaces:
java.lang.Comparable<SerializableNode>
public class SerializableNode extends java.lang.Object implements java.lang.Comparable<SerializableNode>
A node of aSerializableGraph
, represented by a numeric id.
-
-
Constructor Summary
Constructors Constructor Description SerializableNode()
Builds an empty (invalid) node.SerializableNode(int id, java.util.List<java.lang.Integer> subNodes, java.lang.String text)
Builds a node.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(SerializableNode o)
boolean
equals(java.lang.Object obj)
int
getId()
Yields the id of this node.java.util.List<java.lang.Integer>
getSubNodes()
Yields the id of the nodes that are subnodes of this one, in the order they appear.java.lang.String
getText()
Yields the text of this node.int
hashCode()
java.util.Map<java.lang.String,java.lang.String>
otherFields()
Yields all fields that were unrecognized during deserialization.void
setOtherField(java.lang.String name, java.lang.String value)
Adds a field that was not recognized during deserialization.java.lang.String
toString()
-
-
-
Constructor Detail
-
SerializableNode
public SerializableNode()
Builds an empty (invalid) node.
-
SerializableNode
public SerializableNode(int id, java.util.List<java.lang.Integer> subNodes, java.lang.String text)
Builds a node.- Parameters:
id
- the id of the nodesubNodes
- the id of the nodes that are subnodes of this one, in the order they appeartext
- the text of this node
-
-
Method Detail
-
getId
public int getId()
Yields the id of this node.- Returns:
- the id
-
getSubNodes
public java.util.List<java.lang.Integer> getSubNodes()
Yields the id of the nodes that are subnodes of this one, in the order they appear. Note that if nodea
contains nodeb
, andb
contains nodec
, thena.getSubNodes()
returns onlyb
, that is, the list is not recursive.- Returns:
- the ids of the subnodes
-
getText
public java.lang.String getText()
Yields the text of this node.- Returns:
- the text
-
otherFields
public java.util.Map<java.lang.String,java.lang.String> otherFields()
Yields all fields that were unrecognized during deserialization.- Returns:
- the other fields
-
setOtherField
public void setOtherField(java.lang.String name, java.lang.String value)
Adds a field that was not recognized during deserialization.- Parameters:
name
- he name of the fieldvalue
- the value of the field
-
compareTo
public int compareTo(SerializableNode o)
- Specified by:
compareTo
in interfacejava.lang.Comparable<SerializableNode>
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-