public class Network
extends java.lang.Object
Constructor and Description |
---|
Network()
Construct an empty network and inits the members
|
Network(Network network)
Copy constructor, will return a copy of the network with new objects
|
Network(java.lang.String tsvFile,
int numberOfLines)
Creates a network by reading a certain amount of lines from a tsv file.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addLinkToNetwork(Link link)
Adds a link to the network permanently, returns false if links already exists or if it is a self-regulating link
|
boolean |
addNonCommitalLinkToNetwork(Link a)
Adds a temporary link to the network
|
void |
commit()
Commits network by making all temporary modifications permanent.
|
boolean |
equals(java.lang.Object network)
Overrides equals.
|
int |
getLinkCount()
Returns the amount of nodes in the network (nodes have atleast one link) Ignores temporary changes to the network.
|
java.util.ArrayList<Link> |
getLinks() |
java.lang.String |
getName()
Getter for network name
|
int |
getNodeCount()
Returns the amount of nodes in the network (nodes have atleast one link) Ignores temporary changes to the network.
|
java.util.LinkedHashSet<Node> |
getNodes() |
java.util.ArrayList<Link> |
getNonCommitalAdded() |
java.util.ArrayList<Link> |
getNonCommittalDeleted() |
int |
hashCode()
Overwrites hash code for network, network is uniquely defined by name
|
boolean |
isEmpty()
Checks if the network is empty
|
void |
networkToTSV(java.io.File file)
Writes this network to a tsv file in the following format.
|
Link |
removeLinkFromNetwork(int index)
Removes a link at a certain index permanently in the network.
|
Link |
removeLinkFromNetwork(Link e)
Removes the link specified from the network permanently.
|
Link |
removeNonCommitalLinkToNetwork(Link a)
Removes a temporary link from the network
|
void |
revert()
Reverts network to original state.
|
void |
setLinks(java.util.ArrayList<Link> links) |
void |
setNodes(java.util.LinkedHashSet<Node> nodes) |
void |
sortNetworkNameLink()
Sorts the links by name
|
void |
sortNetworkPredictionRank()
Sorts the links by rank
|
void |
sortOriginalRankInterval(int interval,
int startPos,
int endPos)
Alters the current ranking by tie-breaking on the original ranking
|
public Network()
public Network(Network network)
network
- the network to be copiedpublic Network(java.lang.String tsvFile, int numberOfLines)
tsvFile
- string representation of file to read network fromnumberOfLines
- links/lines to read (for big files)public void networkToTSV(java.io.File file)
file
- file to write the network tonumberOfLines
- links/lines to read (for big files)public void sortNetworkPredictionRank()
public void sortNetworkNameLink()
public boolean addLinkToNetwork(Link link)
link
- the link to be addedpublic Link removeLinkFromNetwork(int index)
index
- the index at which the link is locatedpublic Link removeLinkFromNetwork(Link e)
e
- the link to removepublic int getNodeCount()
public int getLinkCount()
public boolean addNonCommitalLinkToNetwork(Link a)
public Link removeNonCommitalLinkToNetwork(Link a)
public boolean isEmpty()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object network)
equals
in class java.lang.Object
public void revert()
public void commit()
public void sortOriginalRankInterval(int interval, int startPos, int endPos)
interval
- Partition sizesstartPos
- Start of the ranking to be resortedendPos
- End of the ranking to be resortedpublic java.lang.String getName()
public java.util.ArrayList<Link> getLinks()
public void setLinks(java.util.ArrayList<Link> links)
public java.util.LinkedHashSet<Node> getNodes()
public void setNodes(java.util.LinkedHashSet<Node> nodes)
public java.util.ArrayList<Link> getNonCommittalDeleted()
public java.util.ArrayList<Link> getNonCommitalAdded()