com.lightdev.lib.holiday.client
Class Region

java.lang.Object
  extended by com.lightdev.lib.holiday.client.Region
All Implemented Interfaces:
HierarchicalItem, Serializable, Comparable

public class Region
extends Object
implements Serializable, HierarchicalItem, Comparable

Region for events

A region can be used to determine where a particular event is observed.

A special characteristic of a region in the context of the Light Development Holiday Library is that it may be any geographic area such as a continent, a country, a state, a city or county, etc. Regions are modeled hierarchical in the way that each region links to one superior region, e.g. Paris links to France, France links to Europe, Europe links to World.

Version:
2, 7.5.2006
Author:
Ulrich Hilger, Light Development, http://www.lightdev.com, info@lightdev.com, published under the terms and conditions of the BSD License, for details see file license.txt in the distribution package of this software
See Also:
Serialized Form

Constructor Summary
Region()
          constructor
Region(int id, String rName)
          construct a region object with a given id and name
 
Method Summary
 int compareTo(Object o)
           
 boolean equals(Object obj)
           
 Object getData()
           
 Object getId()
          get the id of this region
 String getName()
          get the name of this region
 Object getParentId()
           
 int getSuperiorId()
          get the id of the region superior to this region
 boolean isRoot()
           
 void setData(Object data)
           
 void setId(int id)
          set the unique id of this region
 void setId(Object id)
           
 void setName(String name)
          set the name of this region
 void setParentId(Object parentId)
           
 void setSuperiorId(int superiorId)
          set the id of the region superior to this region
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Region

public Region()
constructor


Region

public Region(int id,
              String rName)
construct a region object with a given id and name

Parameters:
id - int the id of the region
rName - String the name of the region
Method Detail

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

setId

public void setId(int id)
set the unique id of this region

Parameters:
id - int the region id

getId

public Object getId()
get the id of this region

Specified by:
getId in interface HierarchicalItem
Returns:
int the region id

setSuperiorId

public void setSuperiorId(int superiorId)
set the id of the region superior to this region

Parameters:
superiorId - int the superior region id

getSuperiorId

public int getSuperiorId()
get the id of the region superior to this region

Returns:
int the superior region id or -1 if not set

setName

public void setName(String name)
set the name of this region

Parameters:
name - String the region name to set

getName

public String getName()
get the name of this region

Returns:
String the region name

setData

public void setData(Object data)
Specified by:
setData in interface HierarchicalItem

getData

public Object getData()
Specified by:
getData in interface HierarchicalItem

setId

public void setId(Object id)
Specified by:
setId in interface HierarchicalItem

getParentId

public Object getParentId()
Specified by:
getParentId in interface HierarchicalItem

setParentId

public void setParentId(Object parentId)
Specified by:
setParentId in interface HierarchicalItem

isRoot

public boolean isRoot()
Specified by:
isRoot in interface HierarchicalItem

compareTo

public int compareTo(Object o)
Specified by:
compareTo in interface Comparable