ucot.model.object
Class Entity

java.lang.Object
  extended by ucot.model.object.Entity
All Implemented Interfaces:
java.io.Serializable

public class Entity
extends java.lang.Object
implements java.io.Serializable

This class represents entity in analyze model.

Author:
pajumasu
See Also:
Serialized Form

Field Summary
private  java.util.Map<java.lang.String,Attribute> attributes
          Maps attribute names and attributes.
private  java.util.Set<Entity> childEntities
          The child entities.
(package private)  boolean deleted
          Marks if this entity is deleted or not.
private  java.util.Map<java.lang.String,Method> methods
          Maps method names and methods.
private  java.lang.String name
          The name of this entity.
private  java.util.Set<Entity> parentEntities
          The parent entities.
static long serialVersionUID
           
private  java.lang.String type
          The type of the entity.
 
Constructor Summary
Entity(java.lang.String name)
          Creates the entity.
 
Method Summary
 void addAttribute(Attribute attribute)
          Adds attribute.
 void addAttribute(java.lang.String name, Attribute attribute)
          Adds attribute for this entity
 void addChild(Entity entity)
          Adds child and adds this entity as a parent of the given entity if nessesary
 void addMethod(Method method)
          Adds method.
 void addMethod(java.lang.String methodName)
          Creates and adds method using given name.
 void addParent(Entity entity)
          Adds parent and adds this entity as a child of the given entity if nessesary
private  void checkEntityCollection(java.util.Collection<Entity> col)
           
 Attribute getAttribute(java.lang.String name)
          Gets attribute called name.
 java.util.Set<Attribute> getAttributes()
          Get all the attributes.
 java.util.Set<Entity> getChildren()
          Returns the children of this entity.
 Method getMethod(java.lang.String methodName)
          Return method.
 java.util.Set<java.lang.String> getMethodNames()
          Returns the names of the methods.
 java.util.Set<Method> getMethods()
          Get all the methods.
 java.lang.String getName()
          Returns the name of this entity.
 java.util.Set<Entity> getParents()
          Returns the parent entities of this entity.
 java.lang.String getType()
          Return the type of the entity.
 void removeAttribute(Attribute toBeRemoved)
          Removes given attribute.
 void removeAttribute(java.lang.String name)
          Removes attribute called name.
 void removeChild(Entity entity)
          Removes child and removes this entity from the parent list of a given entity if nessesary.
 void removeMethod(java.lang.String methodName)
          Removes method.
 void removeParent(Entity entity)
          Removes parent and removes this entity from the child list of a given entity if nessesary.
protected  void setName(java.lang.String name)
          Sets the name of the entity.
 void setType(java.lang.String type)
          Sets the tyoe of the entity.
private  void updateAttributes()
          Removes deleted entities from the attribute list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

serialVersionUID

public static final long serialVersionUID
See Also:
Constant Field Values

attributes

private java.util.Map<java.lang.String,Attribute> attributes
Maps attribute names and attributes. Attribute names are not in use currently.


methods

private java.util.Map<java.lang.String,Method> methods
Maps method names and methods.


childEntities

private java.util.Set<Entity> childEntities
The child entities.


parentEntities

private java.util.Set<Entity> parentEntities
The parent entities.


name

private java.lang.String name
The name of this entity.


type

private java.lang.String type
The type of the entity.


deleted

boolean deleted
Marks if this entity is deleted or not. Because there are many references to entities inside the model it is easier to mark entity deletet when its is removed from the model and the unnessesary references are removed when they are needed. This way we dont need to know all the places for the references and remove them on site when entity is deleted.

Constructor Detail

Entity

public Entity(java.lang.String name)
Creates the entity. The name is modified so that the first letter is always an uppercase letter.

Parameters:
name -
Method Detail

setName

protected void setName(java.lang.String name)
Sets the name of the entity. The name is modified so that the first letter is always an uppercase letter.

Parameters:
name -

updateAttributes

private void updateAttributes()
Removes deleted entities from the attribute list.


addAttribute

public void addAttribute(java.lang.String name,
                         Attribute attribute)
Adds attribute for this entity

Parameters:
name -
attribute -

getAttribute

public Attribute getAttribute(java.lang.String name)
Gets attribute called name.

Parameters:
name -

getAttributes

public java.util.Set<Attribute> getAttributes()
Get all the attributes.

Returns:
set of arguments

removeAttribute

public void removeAttribute(java.lang.String name)
Removes attribute called name.

Parameters:
name -

removeAttribute

public void removeAttribute(Attribute toBeRemoved)
Removes given attribute.

Parameters:
toBeRemoved -

addAttribute

public void addAttribute(Attribute attribute)
Adds attribute. Attributes name is set basend on the name of the entity defined in attribute.

Parameters:
attribute - attribute to add

getName

public java.lang.String getName()
Returns the name of this entity.

Returns:
name of this entity.

checkEntityCollection

private void checkEntityCollection(java.util.Collection<Entity> col)

getParents

public java.util.Set<Entity> getParents()
Returns the parent entities of this entity.

Returns:
parent entities of this entity

getChildren

public java.util.Set<Entity> getChildren()
Returns the children of this entity.

Returns:
set of children

addParent

public void addParent(Entity entity)
Adds parent and adds this entity as a child of the given entity if nessesary

Parameters:
entity -

addChild

public void addChild(Entity entity)
Adds child and adds this entity as a parent of the given entity if nessesary

Parameters:
entity -

removeParent

public void removeParent(Entity entity)
Removes parent and removes this entity from the child list of a given entity if nessesary.

Parameters:
entity -

removeChild

public void removeChild(Entity entity)
Removes child and removes this entity from the parent list of a given entity if nessesary.

Parameters:
entity -

getMethod

public Method getMethod(java.lang.String methodName)
Return method.

Parameters:
methodName -
Returns:
method

addMethod

public void addMethod(java.lang.String methodName)
Creates and adds method using given name.

Parameters:
methodName - name to use

addMethod

public void addMethod(Method method)
Adds method.

Parameters:
method - to add

removeMethod

public void removeMethod(java.lang.String methodName)
Removes method.

Parameters:
methodName -

getMethodNames

public java.util.Set<java.lang.String> getMethodNames()
Returns the names of the methods.

Returns:
names of the methods

getType

public java.lang.String getType()
Return the type of the entity.

Returns:
The type.

setType

public void setType(java.lang.String type)
Sets the tyoe of the entity.

Parameters:
type - The type

getMethods

public java.util.Set<Method> getMethods()
Get all the methods.

Returns:
set of methods.