pt.tumba.geoclass
Class Node

java.lang.Object
  extended by pt.tumba.geoclass.Node
All Implemented Interfaces:
java.lang.Comparable

public class Node
extends java.lang.Object
implements java.lang.Comparable

A Node in the probabilistic graphical model of geographical concepts.

Author:
Bruno Martins

Constructor Summary
Node()
          Constructor for an uninitialized Node
Node(java.lang.Integer id)
          Constructor for Node
Node(java.lang.Integer id, java.lang.String name, java.lang.String type, java.lang.Integer population)
          Constructor for Node.
 
Method Summary
 int compareTo(java.lang.Object o)
          Compares this Node with other nodes with basis on the ID for this geographical concept at the knowledge base (GKB).
 boolean equals(java.lang.Object o)
          Compares this Node with other nodes with basis on the ID for this geographical concept at the knowledge base (GKB).
 java.lang.Integer getID()
          Returns the ID for this geographical concept at the knowledge base (GKB).
 java.lang.String getName()
          Returns the Name associated with this geographical concept.
 java.lang.Integer getPopulation()
          Returns the number of habitants associated with this region, or -1 if the information is not available.
 java.lang.String getType()
          Returns the type of this geographical concept.
 int hashCode()
          Overrides the defult hashCode() method, instead calculating the hash code for this object with basis on the ID for this geographical concept at the knowledge base (GKB).
 boolean isType(java.lang.String t)
          Checks if this geographical concept is of a given type.
 java.lang.Integer setID(java.lang.Integer id)
          Sets the ID for this geographical concept at the knowledge base (GKB).
 java.lang.String setName(java.lang.String name)
          Associates a name with this geographic concept.
 java.lang.Integer setPopulation(java.lang.Integer population)
          Sets the number of habitants associated with this region.
 java.lang.String setType(java.lang.String type)
          Sets the type of this geographic concept.
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node()
Constructor for an uninitialized Node


Node

public Node(java.lang.Integer id)
Constructor for Node

Parameters:
id - The ID for this geographical concept at the knowledge base (GKB).

Node

public Node(java.lang.Integer id,
            java.lang.String name,
            java.lang.String type,
            java.lang.Integer population)
Constructor for Node.

Parameters:
id - The ID for this geographical concept at the knowledge base (GKB).
name - The Name associated with this geographical concept.
type - The type of this geographical concept.
population - Number of habitants associated with this region.
Method Detail

getName

public java.lang.String getName()
Returns the Name associated with this geographical concept.

Returns:
The Name associated with this geographical concept.

getID

public java.lang.Integer getID()
Returns the ID for this geographical concept at the knowledge base (GKB).

Returns:
The ID for this geographical concept at the knowledge base (GKB).

getPopulation

public java.lang.Integer getPopulation()
Returns the number of habitants associated with this region, or -1 if the information is not available.

Returns:
Number of habitants associated with this region.

getType

public java.lang.String getType()
Returns the type of this geographical concept.

Returns:
The type of this geographical concept.

isType

public boolean isType(java.lang.String t)
Checks if this geographical concept is of a given type.

Parameters:
t - A geographical concept type.
Returns:
true if this geographical concept is of the given type and false otherwise.

setName

public java.lang.String setName(java.lang.String name)
Associates a name with this geographic concept.

Parameters:
name - The Name associated with this geographical concept.
Returns:
The Name associated with this geographical concept.

setType

public java.lang.String setType(java.lang.String type)
Sets the type of this geographic concept.

Parameters:
type - The type of this geographical concept.
Returns:
The type of this geographical concept.

setID

public java.lang.Integer setID(java.lang.Integer id)
Sets the ID for this geographical concept at the knowledge base (GKB).

Parameters:
id - The ID for this geographical concept at the knowledge base (GKB).
Returns:
The ID for this geographical concept at the knowledge base (GKB).

setPopulation

public java.lang.Integer setPopulation(java.lang.Integer population)
Sets the number of habitants associated with this region.

Parameters:
population - Number of habitants associated with this region.
Returns:
Number of habitants associated with this region.

hashCode

public int hashCode()
Overrides the defult hashCode() method, instead calculating the hash code for this object with basis on the ID for this geographical concept at the knowledge base (GKB).

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object o)
               throws java.lang.ClassCastException
Compares this Node with other nodes with basis on the ID for this geographical concept at the knowledge base (GKB).

Overrides:
equals in class java.lang.Object
Parameters:
o - Another object (instance of Integer or Node)
Returns:
true if both IDs are equal, false otherwise.
Throws:
java.lang.ClassCastException

compareTo

public int compareTo(java.lang.Object o)
              throws java.lang.ClassCastException
Compares this Node with other nodes with basis on the ID for this geographical concept at the knowledge base (GKB).

Specified by:
compareTo in interface java.lang.Comparable
Parameters:
o - Another object (instance of Integer or Node)
Returns:
0 if both IDs are equal, a negative number if the ID from this object is smaller and a positive number if the ID from this object is greater.
Throws:
java.lang.ClassCastException