public class Network extends Object implements Networked<Network>, Comparable<Network>, Identifiable<NetworkException>, IdContainer<NetworkException>, Storable, Named
| Modifier and Type | Class and Description |
|---|---|
static class |
Network.Field
This is set of fields for input/output to XML and JSON format
|
static class |
Network.ModificationLog
This is set of fields for input/output to XML and JSON format
|
| Modifier and Type | Method and Description |
|---|---|
int |
compareTo(Network o)
Compares this Network object to another based on the Id of this object.
|
protected static Network |
createNetwork(Model model,
org.json.JSONObject jsonNetwork)
Factory method to be called by a Model object that is trying to add a Network to itself.
|
protected static Network |
createNetwork(Model model,
org.json.JSONObject jsonNetwork,
boolean withTables)
Factory method to be called by a Model object that is trying to add a Network to itself.
|
protected static Network |
createNetwork(Model model,
String id,
String name)
Factory method to be called by a Model object that is trying to add a Network to itself.
|
Node |
createNode(org.json.JSONObject jsonNode)
Creates a Node from its JSONObject specification and adds it to this Network.
|
Node |
createNode(org.json.JSONObject jsonNode,
boolean withTables)
Creates a Node from its JSONObject specification and adds it to this Network.
|
Node |
createNode(String id,
Node.Type type)
Creates a Node and adds it to this Network.
|
Node |
createNode(String id,
String name,
Node.Type type)
Creates a Node and adds it to this Network.
|
boolean |
equals(Object obj)
Checks equality of a given object to this Network.
|
Set<Network> |
getChildren()
Builds and returns a set of Networks, which are children of this Network.
|
String |
getDescription()
Gets the description of this Network.
|
String |
getId()
Gets the ID of this Network.
|
Map<Id,? extends Identifiable> |
getIdMap(Class<? extends Identifiable> idClassType)
Deprecated.
For internal use only
|
List<Link> |
getLinksIn()
Returns a copy of the incoming Links list.
|
List<Link> |
getLinksOut()
Returns a copy of the outgoing Links list.
|
uk.co.agena.minerva.model.extendedbn.ExtendedBN |
getLogicNetwork()
Deprecated.
Will be made module-restricted in the future.
|
Model |
getModel()
Returns the Model that this Network belongs to.
|
String |
getName()
Gets the name of this Network.
|
Node |
getNode(String id)
Gets Node from the Network by its unique ID.
|
List<Node> |
getNodeList()
Returns Nodes of this Network as a list
|
Map<String,Node> |
getNodes()
Returns a copy of ID-Node map.
|
Set<Network> |
getParents()
Builds and returns a set of Networks, which are parents of this Network.
|
int |
hashCode()
Returns a hash code value for this object.
|
protected void |
regenerateNPTs()
Regenerates Node NPTs in the Network, in descending order of the number of ancestors a Node has, starting from the root(s) of the Network.
Skips simulated and input nodes. |
void |
removeNode(Node node)
Removes the provided node from the model, severing its links to other Nodes and then removing it from its Network.
|
void |
setDescription(String description)
Sets the description of this Network.
|
void |
setId(String id)
Changes the ID of this Network to the provided ID, if the new ID is not already taken.
|
protected void |
setLogicNetwork(uk.co.agena.minerva.model.extendedbn.ExtendedBN logicNetwork)
Links this Network to an underlying Minerva Network object.
|
void |
setName(String name)
Sets the name of this Network.
|
void |
throwIdExistsException(String id)
Deprecated.
For internal use only
|
void |
throwOldIdNullException(String id)
Deprecated.
For internal use only
|
org.json.JSONObject |
toJson()
Creates a JSON representing this Network, ready for file storage.
|
String |
toString()
Returns toStringExtra().
|
String |
toStringExtra()
Returns the ID of the underlying network surrounded by back ticks.
|
boolean |
unlink(Network network)
Removes all links (if any exist) between the two networks.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waithasAncestor, hasDescendantchangeContainedIdprotected static Network createNetwork(Model model, String id, String name)
model - the Model to add a Network toid - the ID of the Networkname - the name of the Networkprotected static Network createNetwork(Model model, org.json.JSONObject jsonNetwork) throws org.json.JSONException, NetworkException
setTable(JSONObject) after all nodes, states, intra and cross network links had been created.model - the Model to add a Network tojsonNetwork - JSONObject representing the network, including structure, tables, graphics etcorg.json.JSONException - if JSON configuration is incomplete or invalidNetworkException - if failed to load a network or node or if an object not foundNode.setTable(JSONObject)protected static Network createNetwork(Model model, org.json.JSONObject jsonNetwork, boolean withTables) throws org.json.JSONException, NetworkException
setTable(JSONObject) after all nodes, states, intra and cross network links had been created.model - the Model to add a Network tojsonNetwork - JSONObject representing the network, including structure, tables, graphics etcwithTables - whether to load node tables from JSONorg.json.JSONException - if JSON configuration is incomplete or invalidNetworkException - if failed to load a network or node or if an object not foundNode.setTable(JSONObject)public Node createNode(String id, String name, Node.Type type) throws NetworkException
id - ID of the Nodename - name of the Nodetype - type of the NodeNetworkException - if Node creation failedpublic Node createNode(String id, Node.Type type) throws NetworkException
id - ID of the Nodetype - type of the NodeNetworkException - if Node creation failedpublic Node createNode(org.json.JSONObject jsonNode, boolean withTables) throws NetworkException
setTable(JSONObject) after all nodes, states, intra and cross network links had been created.jsonNode - JSONObject with full Node's configurationwithTables - whether to load node tables from JSONNetworkException - if Node creation failed (Node with given ID already exists; or JSON configuration is missing required attributes)Node.setTable(JSONObject)public Node createNode(org.json.JSONObject jsonNode) throws NetworkException
setTable(JSONObject) after all nodes, states, intra and cross network links had been created.jsonNode - JSONObject with full Node's configurationNetworkException - if Node creation failed (Node with given ID already exists; or JSON configuration is missing required attributes)Node.setTable(JSONObject)public final String getId()
getId in interface Identifiable<NetworkException>public final void setId(String id) throws NetworkException
setId in interface Identifiable<NetworkException>id - the new IDNetworkException - if fails to change IDpublic final uk.co.agena.minerva.model.extendedbn.ExtendedBN getLogicNetwork()
public final Model getModel()
public int compareTo(Network o)
compareTo in interface Comparable<Network>o - another Network objectId.compareTo(Id)public boolean equals(Object obj)
public int hashCode()
public String toString()
public String toStringExtra()
public Set<Network> getParents()
getParents in interface Networked<Network>public Set<Network> getChildren()
getChildren in interface Networked<Network>public List<Link> getLinksIn()
getLinksIn in interface Networked<Network>public List<Link> getLinksOut()
getLinksOut in interface Networked<Network>public boolean unlink(Network network)
@Deprecated public Map<Id,? extends Identifiable> getIdMap(Class<? extends Identifiable> idClassType) throws NetworkException
IdContainergetIdMap in interface IdContainer<NetworkException>idClassType - the class of identifiable objectNetworkException - when invalid type requested@Deprecated public void throwIdExistsException(String id) throws NetworkException
IdContainerthrowIdExistsException in interface IdContainer<NetworkException>id - ID of the existing objectNetworkException - when invoked@Deprecated public void throwOldIdNullException(String id) throws NetworkException
IdContainerthrowOldIdNullException in interface IdContainer<NetworkException>id - ID of the existing objectNetworkException - when invokedpublic Node getNode(String id)
id - the ID of the Nodepublic Map<String,Node> getNodes()
public List<Node> getNodeList()
public org.json.JSONObject toJson()
public void setName(String name)
public String getName()
public void setDescription(String description)
setDescription in interface Nameddescription - new descriptionpublic String getDescription()
getDescription in interface Namedprotected void setLogicNetwork(uk.co.agena.minerva.model.extendedbn.ExtendedBN logicNetwork)
logicNetwork - the logical networkpublic void removeNode(Node node) throws NodeException
node - Node to removeNodeException - if the operation failsprotected void regenerateNPTs()
throws NetworkException
NetworkException - if regeneration fails in the logicCopyright © 2021. All rights reserved.