model
Class DistanceEntity

java.lang.Object
  extended by model.DistanceEntity

public class DistanceEntity
extends java.lang.Object

Class for storing qualitative distance relations between different entities.


Nested Class Summary
 class DistanceEntity.DistanceFact
          Class for storing relations added to this entity.
 
Field Summary
private  DistanceSystem.DistSystem distanceSystem
          the distance system of this entity
private  java.util.ArrayList<DistanceEntity.DistanceFact> facts
          a list of fasts added to this entity
private  java.lang.String name
          the entity name
private  java.util.HashMap<java.lang.String,java.util.ArrayList<DistanceEntity>> relations
          a mapping of the distance ranges to the entities at each range
 
Constructor Summary
DistanceEntity(java.lang.String name, DistanceSystem.DistSystem system)
          Constructs a distance entity with the specified distance system.
 
Method Summary
 void addDistanceRelation(java.lang.String distanceName, DistanceEntity entity)
          Adds a distance relation to this entity.
 java.lang.String getDistance(DistanceEntity entity)
          Returns the distance relation to the specified entity.
 DistanceSystem.DistSystem getDistanceSystem()
          Gets the distance system.
 java.util.ArrayList<DistanceEntity.DistanceFact> getFacts()
          Gets the factboard for this entity.
 java.lang.String getName()
          Gets the entity name.
 java.util.HashMap<java.lang.String,java.util.ArrayList<DistanceEntity>> getRelations()
          Gets the mapping of distances to related entities.
 boolean relatedTo(DistanceEntity entity)
          Returns true if the specified entity is related to this entity.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

name

private java.lang.String name
the entity name


distanceSystem

private DistanceSystem.DistSystem distanceSystem
the distance system of this entity


relations

private java.util.HashMap<java.lang.String,java.util.ArrayList<DistanceEntity>> relations
a mapping of the distance ranges to the entities at each range


facts

private java.util.ArrayList<DistanceEntity.DistanceFact> facts
a list of fasts added to this entity

Constructor Detail

DistanceEntity

public DistanceEntity(java.lang.String name,
                      DistanceSystem.DistSystem system)
Constructs a distance entity with the specified distance system.

Parameters:
system - - the distance system
Method Detail

addDistanceRelation

public void addDistanceRelation(java.lang.String distanceName,
                                DistanceEntity entity)
Adds a distance relation to this entity. If the granularity of the new distance is less than the current granularity, then it is mapped to the granularity of this entity. If the granularity of the new distance is greater than the current granularity, then the distance system of this entity is mapped into the granularity of the new distance.

Parameters:
distanceName - - the distance name
entity - - the related entity

relatedTo

public boolean relatedTo(DistanceEntity entity)
Returns true if the specified entity is related to this entity.


getDistance

public java.lang.String getDistance(DistanceEntity entity)
Returns the distance relation to the specified entity.

Parameters:
entity - - the related entity
Returns:
- the distance relation or null if the entities are not related

getRelations

public java.util.HashMap<java.lang.String,java.util.ArrayList<DistanceEntity>> getRelations()
Gets the mapping of distances to related entities.


getDistanceSystem

public DistanceSystem.DistSystem getDistanceSystem()
Gets the distance system.


getName

public java.lang.String getName()
Gets the entity name.


getFacts

public java.util.ArrayList<DistanceEntity.DistanceFact> getFacts()
Gets the factboard for this entity.