it.unimi.dico.islab.idbs2.cloud
Class Cloud

java.lang.Object
  extended by it.unimi.dico.islab.idbs2.cloud.Cloud

public class Cloud
extends Object

Main class of the cloud framework, representation of a cloud graph. A cloud is formally a couple <N,E> where N is a set of nodes (each of them represented by the class CloudNode) and E is a set of edges (each of them represented by the class CloudEdge).

Author:
Vegeziel
See Also:
CloudEdge, CloudNode

Constructor Summary
Cloud(boolean isDirect)
          Only public constructor to generate a new Cloud object.
 
Method Summary
 void addEdge(CloudNode source, CloudNode target, double weight)
          Generates a new edge between two nodes owned by this cloud.
 CloudNode addNode()
          Generate and add a new node to this Cloud.
 Set<CloudEdge> getEdges()
          Get the set of all edges associated with this cloud.
 Integer getId()
          Get the id of the corresponding database persisted object.
 Set<CloudNode> getNodes()
          Get the set of all nodes associated with this cloud
 String getTargetEntity()
          Getter for the target entity string representing the focus topic of this cloud.
 boolean isDirect()
          Getter for the isDirect property of this class.
 void setTargetEntity(String targetEntity)
          Setter for the target entity string reprenting the focus topic of this cloud.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cloud

public Cloud(boolean isDirect)

Only public constructor to generate a new Cloud object.

Parameters:
isDirect - defines if the representation of this cloud structure should be a
  • true: directed
  • false: undirected
graph.
Method Detail

addNode

public CloudNode addNode()
Generate and add a new node to this Cloud.

Returns:
the generated node, already connected with this cloud.

addEdge

public void addEdge(CloudNode source,
                    CloudNode target,
                    double weight)

Generates a new edge between two nodes owned by this cloud.

If the current cloud is directed, parameters source and target represent the direction of the edge (as suggested by parameter names). Otherwise it is implicitly created a symmetric connection between the two given nodes.

N.B.: Reflexive edges are discarded by default without any error or warning massage.

Parameters:
source - Source node of the directed edge
target - Target node of the directed edge
weight - Weight of the edge
See Also:
Cloud(boolean)

getId

public Integer getId()

Get the id of the corresponding database persisted object.

Returns:
the identifier (primary key) of the corresponding row on the relational Hibernate-mapped relational database.

getNodes

public Set<CloudNode> getNodes()

Get the set of all nodes associated with this cloud

Returns:
a set of all nodes in this cloud instance.

getTargetEntity

public String getTargetEntity()

Getter for the target entity string representing the focus topic of this cloud.

Returns:
the target entity string

setTargetEntity

public void setTargetEntity(String targetEntity)

Setter for the target entity string reprenting the focus topic of this cloud.

Parameters:
targetEntity - the target entity string

isDirect

public boolean isDirect()

Getter for the isDirect property of this class.

Returns:
  • true: if this cloud is represented by a directed graph
  • false: if this cloud is represented by an undirected graph

getEdges

public Set<CloudEdge> getEdges()

Get the set of all edges associated with this cloud.

N.B.:If the cloud is undirected, the edges are repeated twice. For example, if there is an indirected edge between node A and node B it will be represented by two CloudEdge objects, the former A->B and the latter B->A.

Returns:
the set of all edges associated with this cloud instance.