ucot.model.relation
Class RelationalAnalyzeModel

java.lang.Object
  extended by java.util.Observable
      extended by ucot.model.relation.RelationalAnalyzeModel
All Implemented Interfaces:
AnalyzeModel

public class RelationalAnalyzeModel
extends java.util.Observable
implements AnalyzeModel

This is the internal representation of analyzed use case. It is build up from two basic kind of objects: items and relations between them.

Author:
pajumasu

Field Summary
(package private)  ModelEditor editor
           
private  java.util.Set<Item> items
           
private  java.util.Set<Relation> relations
           
 
Constructor Summary
RelationalAnalyzeModel()
           
 
Method Summary
protected  void addItem(Item e)
          Adds item in to the model
protected  void addRelation(Relation relation)
          Adds relation to this model.
 void clear()
          Clears this analyze model
private  void extractEntities(Thing i)
          Extract entities from given thing.
 ModelEditor getEditor()
          return editor for this analyze model
 Entity getEntityByName(java.lang.String name)
          Returns entity by its name
 Item getItemByName(java.lang.String name)
          Returns spesific item by its name.
 java.util.Set<Item> getItemsType(java.lang.String typeName)
          Returns items which type name is equal to given type name.
 java.util.Set<Relation> getRelationsFrom(Thing item)
          Returns relations that originates from given thing.
 java.util.Set<Relation> getRelationsFrom(Thing thing1, Method method)
          Returns relations which mark method influence and originate from given thing.
 java.util.Set<Relation> getRelationsFrom(Thing item, RelationType type)
          Returns relations that are certain type and are originated from given item.
 java.util.Set<Relation> getRelationsFrom(Thing item, java.lang.String toType)
          Returns relations which point to thing of spesific type and are originated from given item.
 java.util.Set<Relation> getRelationsTo(Thing item)
          Returns relations that point to given thing.
 java.util.Set<Relation> getRelationsTo(Thing item, RelationType type)
          Returns relations that are certain type and targets given item.
 void readySignal()
          Signals all observers that this model is ready.
protected  void removeItem(Item item)
          Removes item from the model.
protected  void removeRelation(Relation relation)
          Removes given relation.
protected  void setChanged()
           
 void updationStartedSignal()
          Signals all observers that this model is beign modified.
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucot.model.AnalyzeModel
addObserver
 

Field Detail

items

private java.util.Set<Item> items

relations

private java.util.Set<Relation> relations

editor

ModelEditor editor
Constructor Detail

RelationalAnalyzeModel

public RelationalAnalyzeModel()
Method Detail

addItem

protected void addItem(Item e)
Adds item in to the model

Parameters:
e - Item to be added.

getEntityByName

public Entity getEntityByName(java.lang.String name)
Returns entity by its name

Parameters:
name - The name of the wanted entity.
Returns:

getItemByName

public Item getItemByName(java.lang.String name)
Returns spesific item by its name.

Parameters:
name -
Returns:

getItemsType

public java.util.Set<Item> getItemsType(java.lang.String typeName)
Returns items which type name is equal to given type name.

Parameters:
typeName - The type name we are searching for.
Returns:
Set if items that match the given type name.

extractEntities

private void extractEntities(Thing i)
Extract entities from given thing. If the thing is relation then all both to and from things are futher iteratively extracted. If the thing is item then the item is added to this model.

Parameters:
i - The thing to be investigated.

getRelationsTo

public java.util.Set<Relation> getRelationsTo(Thing item)
Returns relations that point to given thing.

Parameters:
item -
Returns:

getRelationsFrom

public java.util.Set<Relation> getRelationsFrom(Thing item)
Returns relations that originates from given thing.

Parameters:
item -
Returns:

getRelationsTo

public java.util.Set<Relation> getRelationsTo(Thing item,
                                              RelationType type)
Returns relations that are certain type and targets given item. getRelationsFrom(new Entity("user"), RelationType.CONTAINS); Returns all the relations that connect Things containded by the 'user' Entity. Which means methods, attributes and such.

Parameters:
item - The originator.
type - The RelationType we are looking for.
Returns:

getRelationsFrom

public java.util.Set<Relation> getRelationsFrom(Thing item,
                                                RelationType type)
Returns relations that are certain type and are originated from given item. getRelationsFrom(new Entity("user"), RelationType.CONTAINS); Returns all the relations that connect Things containded by the 'user' Entity. Which means methods, attributes and such.

Parameters:
item - The originator.
type - The RelationType we are looking for.
Returns:

getRelationsFrom

public java.util.Set<Relation> getRelationsFrom(Thing item,
                                                java.lang.String toType)
Returns relations which point to thing of spesific type and are originated from given item. getRelationsFrom(new Entity("user"), "method"); Returns all the relations that are originated from Entity called 'user' and are pointing to Thing of type 'method'. Simply this calls returns all the Relations that connects the methods of the 'user' Entity.

Parameters:
item - The originator.
toType - The type of the Thing relation points.
Returns:

getRelationsFrom

public java.util.Set<Relation> getRelationsFrom(Thing thing1,
                                                Method method)
Returns relations which mark method influence and originate from given thing.

Parameters:
thing1 -
method -
Returns:

removeItem

protected void removeItem(Item item)
Removes item from the model.

Parameters:
item - The item that is going to be removed

setChanged

protected void setChanged()
Overrides:
setChanged in class java.util.Observable

removeRelation

protected void removeRelation(Relation relation)
Removes given relation.

Parameters:
relation - Relation to be removed.

addRelation

protected void addRelation(Relation relation)
Adds relation to this model.

Parameters:
relation - The relation beign added.

getEditor

public ModelEditor getEditor()
Description copied from interface: AnalyzeModel
return editor for this analyze model

Specified by:
getEditor in interface AnalyzeModel
Returns:
ModelEditor

clear

public void clear()
Description copied from interface: AnalyzeModel
Clears this analyze model

Specified by:
clear in interface AnalyzeModel

readySignal

public void readySignal()
Description copied from interface: AnalyzeModel
Signals all observers that this model is ready.

Specified by:
readySignal in interface AnalyzeModel

updationStartedSignal

public void updationStartedSignal()
Description copied from interface: AnalyzeModel
Signals all observers that this model is beign modified.

Specified by:
updationStartedSignal in interface AnalyzeModel