public class DefaultSemanticNetwork extends java.lang.Object implements SemanticNetwork
| Constructor and Description |
|---|
DefaultSemanticNetwork()
Creates a new instance of DefaultSemanticNetwork
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNode(SemanticLabel nodeLabel)
Adds a node to the semantic network.
|
double |
getAssociation(SemanticLabel from,
SemanticLabel to)
Gets the association between two nodes in the network.
|
java.util.Collection<SemanticLabel> |
getNodes()
Gets the nodes that are in the network.
|
int |
getNumNodes()
Gets the total number of nodes in the network.
|
java.util.Collection<SemanticLabel> |
getOutLinks(SemanticLabel nodeLabel)
Gets the outgoing links from a given node.
|
boolean |
isNode(SemanticLabel label)
Returns true if the given SemanticLabel is a node in the
SemanticNetwork.
|
void |
removeNode(SemanticLabel nodeLabel)
Removes a node from the semantic network including all of the incoming
and outgoing links of the node.
|
void |
setAssociation(SemanticLabel from,
SemanticLabel to,
double weight)
Sets the association between two nodes in the network.
|
public DefaultSemanticNetwork()
public int getNumNodes()
getNumNodes in interface SemanticNetworkpublic boolean isNode(SemanticLabel label)
isNode in interface SemanticNetworklabel - The label to evaluate.public java.util.Collection<SemanticLabel> getNodes()
getNodes in interface SemanticNetworkpublic java.util.Collection<SemanticLabel> getOutLinks(SemanticLabel nodeLabel)
getOutLinks in interface SemanticNetworknodeLabel - The node to get the outgoing links frompublic double getAssociation(SemanticLabel from, SemanticLabel to)
getAssociation in interface SemanticNetworkfrom - The node the association is fromto - The node the association is topublic void addNode(SemanticLabel nodeLabel)
nodeLabel - The semantic label of the node.public void removeNode(SemanticLabel nodeLabel)
nodeLabel - The node to remove from the network.public void setAssociation(SemanticLabel from, SemanticLabel to, double weight)
from - The node that the link is from.to - The node that the link is to.weight - The weight of the association.java.lang.IllegalArgumentException - Thrown if either the from or to node
is not in the network.