Package edu.fiu.jtlex.data
Interface IGraph
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
Graph
Abstraction of a TimeML Graph data structure
-
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a link to the graph.booleanAdds a node to the graph.clone()Creates a clone of the graph.booleancontainsLink(ILink link) Checks if the graph contains a link.edu.fiu.jtlex.data.GraphTypeGets the Graph's type.getLinkById(int linkId) Gets a link by id.getLinks()Returns all the links in the graph.intReturns the number of links in the graph.Gets the link count per link type.getNodeById(int nodeId) Gets a node by id.getNodes()Returns all the nodes in the graph.intGets the number of nodes in a graph.removeLink(ILink link) Removes a link from the graph.removeNode(INode node) Removes a node from the graph.removeNodeById(int nodeId) Removes a node by id.voidsetGraphType(edu.fiu.jtlex.data.GraphType graphType) Changes the graph type.toJson()Returns the JSON (RFC 8259) representation of the graph.
-
Method Details
-
addLink
Adds a link to the graph.- Parameters:
link- The ILink to be added.- Returns:
- True if the link was added, or false if the link already exist.
- Since:
- Revision 750
-
addNode
Adds a node to the graph.- Parameters:
node- The node to add- Returns:
- True if the node was added, or False if the node already exists.
- Since:
- Revision 750
-
containsLink
Checks if the graph contains a link.- Parameters:
link- The ILink to check.- Returns:
- True if the link is in the graph, else false
- Since:
- Revision 750
-
getNodeById
Gets a node by id.- Parameters:
nodeId- The id of the node to retrieve.- Returns:
- The node with the given id, or null if no such node exist.
- Since:
- Revision 750
-
getLinkById
Gets a link by id.- Parameters:
linkId- The id of the link to retrieve.- Returns:
- The link with the given id, or null if no such link exist.
- Since:
- Revision 750
-
removeLink
Removes a link from the graph.- Parameters:
link- The ILink to remove.- Returns:
- The removed link, or null if the link is not in the graph.
- Since:
- Revision 750
-
removeNode
Removes a node from the graph.- Parameters:
node- The node to remove.- Returns:
- The removed node, or null if the node is not in the graph.
- Since:
- Revision 750
-
removeNodeById
Removes a node by id.- Parameters:
nodeId- The id of the node to remove.- Returns:
- The removed node, or null, if the node is not in the graph.
- Since:
- Revision 750
-
getNodes
Returns all the nodes in the graph.- Returns:
- A set of the nodes in the graph.
- Since:
- Revision 750
-
getLinks
Returns all the links in the graph.- Returns:
- A set of the links in the graph.
- Since:
- Revision 750
-
getLinksCount
int getLinksCount()Returns the number of links in the graph.- Returns:
- The number of links in the graph.
- Since:
- Revision 750
-
getNodesCount
int getNodesCount()Gets the number of nodes in a graph.- Returns:
- The number of nodes in the graph.
- Since:
- Revision 750
-
getLinkTypesCount
Gets the link count per link type.- Returns:
- A map containing the number of A-Link, S-Link, and T-Link.
- Since:
- Revision 750
-
getGraphType
edu.fiu.jtlex.data.GraphType getGraphType()Gets the Graph's type.- Returns:
- A
GraphTyperepresenting the graph type. - Since:
- Revision 750
-
setGraphType
void setGraphType(edu.fiu.jtlex.data.GraphType graphType) Changes the graph type.- Parameters:
graphType- TheGraphTypeenum.- Since:
- Revision 750
-
clone
IGraph clone()Creates a clone of the graph.- Returns:
- A deep copy of the graph.
- Since:
- Revision 750
-
toJson
String toJson()Returns the JSON (RFC 8259) representation of the graph.- Returns:
- A flattened JSON string of the graph.
- Since:
- Revision 750
-