Package edu.fiu.jtlex.timeml.graph
Interface ITimeMLGraph
- All Superinterfaces:
Cloneable
- All Known Implementing Classes:
TimeMLGraph
Abstraction of a TimeML Graph data structure
- Since:
- jTLEX 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumRefers to the different possible graph types. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddEvent(ITimeMLEvent event) Adds an event to the graph.booleanaddLink(ITimeMLLink link) Adds the provided link to the graph.booleanaddNode(ITimeMLNode node) Adds a node to the graph.booleanaddSignal(ITimeMLSignal signal) Adds an signal to the graph.clone()Creates a clone of the graph by first cloning the nodes and links and then returning them inside a new Graph object.booleanChecks if this graph equals an object.getEventById(String eventId) Gets a event by id.Returns a snapshot of all the events currently in the graph.Gets the Graph's type.Each link has a node at its beginning and end.getLinkById(int linkId) Gets a link by id.getLinks()Returns a snapshot of all the links currently in the graph.static Map<Class<? extends ITimeMLLink.ITimeMLLinkType>,Integer> getLinkTypesCount(ITimeMLGraph graph) Gets the link count per link type.getNodeById(String nodeId) Gets a node by id.getNodes()Returns a snapshot of all the nodes currently in the graph.Each link has a node at its beginning and end.Gets the Graph's Parent Graph.getSignalById(String signalId) Gets a signal by id.Returns a snapshot of all the signals currently in the graph.inthashCode()Generates a hash code for the graph, based of its nodes and edges.booleanremoveEvent(ITimeMLEvent event) Removes a provided event from the graph.booleanremoveEventById(String eventId) Removes an event by id.booleanremoveLink(ITimeMLLink link) Removes a provided link from the graph.booleanremoveLinkById(int linkId) Removes a link by id.booleanremoveNode(ITimeMLNode node) Removes a provided node from the graph.booleanremoveNodeById(String nodeId) Removes a node by id.booleanremoveSignal(ITimeMLSignal signal) Removes a provided signal from the graph.booleanremoveSignalById(String signalId) Removes a signal by id.Creates a sub graph.toJson()Returns the JSON (RFC 8259) representation of the graph.
-
Method Details
-
addLink
Adds the provided link to the graph. The endpoints of the link and it's signal must already be present in the Graph.- Parameters:
link- The ILink to be added.- Returns:
- True if the link was added, otherwise it returns false if the link already exists or if the nodes/signal were not in the graph, and as a result, the link is not added.
- Throws:
NullPointerException- if the link is null.IllegalArgumentException- if nodes are not in graph before link is added.- Since:
- jTLEX 1.0
-
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.
- Throws:
NullPointerException- if the node is null.- Since:
- jTLEX 1.0
-
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:
- jTLEX 1.0
-
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:
- jTLEX 1.0
-
getEventById
Gets a event by id.- Parameters:
eventId- The id of the event to retrieve.- Returns:
- The event with the given id, or null if no such event exists.
- Since:
- jTLEX 1.0
-
getSignalById
Gets a signal by id.- Parameters:
signalId- The id of the signal to retrieve.- Returns:
- The signal with the given id, or null if no such signal exists.
- Since:
- jTLEX 1.0
-
removeLink
Removes a provided link from the graph.- Parameters:
link- The ILink to remove.- Returns:
- true if removed, false if not removed or null input.
- Throws:
NullPointerException- if the ILink is null.- Since:
- jTLEX 1.0
-
removeNode
Removes a provided node from the graph. Removes links it is involved with as well.- Parameters:
node- The node to remove.- Returns:
- True if removed, false if not removed or null input.
- Throws:
NullPointerException- if the node is null.- Since:
- jTLEX 1.0
-
removeNodeById
Removes a node by id. Removes links it is involved with as well.- Parameters:
nodeId- The id of the node to remove.- Returns:
- True if removed, false if not removed.
- Since:
- jTLEX 1.0
-
removeLinkById
boolean removeLinkById(int linkId) Removes a link by id.- Parameters:
linkId- The id of the link to remove.- Returns:
- True if removed, false if not removed or null input.
- Since:
- jTLEX 1.0
-
addEvent
Adds an event to the graph.- Parameters:
event- The event to add- Returns:
- True if the event was added, or False if the event already exists.
- Throws:
NullPointerException- If the node is null- Since:
- jTLEX 1.0
-
removeEvent
Removes a provided event from the graph. Removes instances it is involved with as well.- Parameters:
event- The event to remove.- Returns:
- True if removed, false if not removed or null input.
- Throws:
NullPointerException- if the node is null.- Since:
- jTLEX 1.0
-
removeEventById
Removes an event by id. Removes instances it is involved with as well.- Parameters:
eventId- The id of the event to remove.- Returns:
- True if removed, false if not removed.
- Since:
- jTLEX 1.0
-
addSignal
Adds an signal to the graph.- Parameters:
signal- The signal to add- Returns:
- True if the signal was added, or False if the signal already exists.
- Throws:
NullPointerException- If the signal is null- Since:
- jTLEX 1.0
-
removeSignal
Removes a provided signal from the graph. Removes links it is involved with as well.- Parameters:
signal- The signal to remove.- Returns:
- True if removed, false if not removed or null input.
- Throws:
NullPointerException- if the node is null.- Since:
- jTLEX 1.0
-
removeSignalById
Removes a signal by id. Removes links it is involved with as well.- Parameters:
signalId- The id of the event to remove.- Returns:
- True if removed, false if not removed, null.
- Since:
- jTLEX 1.0
-
getSignals
Set<ITimeMLSignal> getSignals()Returns a snapshot of all the signals currently in the graph. Modifying this set won't modify the actual graph's signal set.- Returns:
- A set containing the signals currently in the graph.
- Since:
- jTLEX 1.0
-
getNodes
Set<ITimeMLNode> getNodes()Returns a snapshot of all the nodes currently in the graph. Modifying this set won't modify the actual graph's node set.- Returns:
- A set containing the nodes currently in the graph.
- Since:
- jTLEX 1.0
-
getLinks
Set<ITimeMLLink> getLinks()Returns a snapshot of all the links currently in the graph. Modifying this set won't modify the actual graph's link set.- Returns:
- A set containing the links currently in the graph.
- Since:
- jTLEX 1.0
-
getEvents
Set<ITimeMLEvent> getEvents()Returns a snapshot of all the events currently in the graph. Modifying this set won't modify the actual graph's event set.- Returns:
- A set containing the events currently in the graph.
- Since:
- jTLEX 1.0
-
getOutLinks
Map<String,Set<ITimeMLLink>> getOutLinks()Each link has a node at its beginning and end. As such, each node can have an incoming link or an outgoing link. This method is used to track each outgoing link from each node.- Returns:
- A map with all the nodes in the graph and their outgoing links.
- Since:
- jTLEX 1.0
-
getInLinks
Map<String,Set<ITimeMLLink>> getInLinks()Each link has a node at its beginning and end. As such, each node can have an incoming link or an outgoing link. This method is used to track each incoming link from each node.- Returns:
- A map with all the nodes in the graph and their incoming links.
- Since:
- jTLEX 1.0
-
getGraphType
ITimeMLGraph.GraphType getGraphType()Gets the Graph's type.- Returns:
- A
ITimeMLGraph.GraphTyperepresenting the graph type. - Since:
- jTLEX 1.0
-
getParent
ITimeMLGraph getParent()Gets the Graph's Parent Graph. Used for obtaining the parent graph from Subordination Graphs.- Returns:
- A TimeMLGraph representing the parent, or null if it is not a subordination graph, meaning there is no parent.
- Since:
- jTLEX 1.0
-
clone
ITimeMLGraph clone()Creates a clone of the graph by first cloning the nodes and links and then returning them inside a new Graph object.- Returns:
- A field-by-field copy of the graph.
- Since:
- jTLEX 1.0
-
toJson
String toJson()Returns the JSON (RFC 8259) representation of the graph.- Returns:
- A flattened JSON string of the graph.
- Since:
- jTLEX 1.0
-
hashCode
int hashCode()Generates a hash code for the graph, based of its nodes and edges. -
equals
Checks if this graph equals an object.- Overrides:
equalsin classObject- Parameters:
o- The object to compare against.- Returns:
- True if both graphs are equal, i.e. same set of nodes and links, or else false.
- Throws:
NullPointerException- If the object to compare against is false.- Since:
- jTLEX 1.0
-
subGraph
ITimeMLGraph subGraph(Set<String> nodeIDs, Set<Integer> linkIDs, Set<String> eventIDs, Set<String> signalIDs) throws IllegalArgumentException Creates a sub graph.- Parameters:
nodeIDs- The set ofITimeMLNode.linkIDs- The set ofITimeMLLink.eventIDs- The set ofITimeMLEvent.signalIDs- The set ofITimeMLSignal.- Returns:
- an ITimeMLGraph that is the subgraph.
- Throws:
IllegalArgumentException- if the nodes, events, links, or signals are not inside the graph.- Since:
- jTLEX 1.0
-
getLinkTypesCount
static Map<Class<? extends ITimeMLLink.ITimeMLLinkType>,Integer> getLinkTypesCount(ITimeMLGraph graph) Gets the link count per link type.- Parameters:
graph- the TimeML Graph to count the links from.- Returns:
- A map containing the number of A-Link, S-Link, and T-Link.
- Since:
- jTLEX 1.0
-