pl.edu.agh.cast.model.base
Class TimedRelation

java.lang.Object
  extended by pl.edu.agh.cast.model.mapper.AbstractMappable
      extended by pl.edu.agh.cast.model.base.Relation
          extended by pl.edu.agh.cast.model.base.TimedRelation
All Implemented Interfaces:
Serializable, Cloneable, IRelation, ITimedRelation, Mappable

@Mapping
public class TimedRelation
extends Relation
implements ITimedRelation

The timed relation represents relation with assigned date. The date might be used to order relations in time-line editor.

Author:
AGH CAST Team
See Also:
Serialized Form

Field Summary
protected  Date date
          The date of the relation.
 
Fields inherited from class pl.edu.agh.cast.model.base.Relation
dataSets, source, target
 
Fields inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
id
 
Constructor Summary
TimedRelation()
          Default constructor.
TimedRelation(IEntity src, IEntity dst, Date newDate)
          Parameterized constructor.
 
Method Summary
 boolean equals(Object other)
          Two Timed relations are equal if their source and target nodes have the same id and their dates are equal.
 boolean fixedEquals(ITimedRelation relation)
          Checks if given timed relation is equal in terms of timed relation not the domain-specific sense, to the given timed relation.
 Date getDate()
          Get the date of the relation.
 int getFixedHashCode()
          Remark: the hash code of the id of the TimedRelation is dependent on all the data which are checked in the equals method, because the id is constructed of the source and target nodes IDs and the date.
 ITimedRelation getTimedRelation()
          Returns object of class TimedRelation no matter if the object is of class ITimedRelation or class which inherits from it.
 int hashCode()
          
 void setDate(Date newDate)
          Set the date of the relation.
protected  void updateId()
           
 
Methods inherited from class pl.edu.agh.cast.model.base.Relation
addDataSet, clone, getDataSets, getSource, getTarget, setDataSets, setSource, setTarget, toString
 
Methods inherited from class pl.edu.agh.cast.model.mapper.AbstractMappable
getAttribute, getAttributeNames, getAttributeType, getId, getMid, getType, setAttribute, setId, setMid
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface pl.edu.agh.cast.model.base.IRelation
addDataSet, getDataSets, getId, getSource, getTarget, setDataSets, setId, setSource, setTarget
 
Methods inherited from interface pl.edu.agh.cast.model.mapper.Mappable
clone, getAttribute, getAttributeNames, getAttributeType, getMid, getType, setAttribute, setMid
 

Field Detail

date

protected Date date
The date of the relation.

Constructor Detail

TimedRelation

public TimedRelation()
Default constructor.


TimedRelation

public TimedRelation(IEntity src,
                     IEntity dst,
                     Date newDate)
Parameterized constructor.

Parameters:
src - The source of the relation
dst - The target of the relations
newDate - The date of occurrence of the relation.
Method Detail

getDate

@MapAttribute(typeName="Date")
public Date getDate()
Get the date of the relation.

Specified by:
getDate in interface ITimedRelation
Returns:
The date.

setDate

public void setDate(Date newDate)
Set the date of the relation.

Parameters:
newDate - the date to set

updateId

protected void updateId()
Overrides:
updateId in class Relation

equals

public boolean equals(Object other)
Two Timed relations are equal if their source and target nodes have the same id and their dates are equal.

Overrides:
equals in class Relation
Parameters:
other - object to check
Returns:
true if the other relation is equal to this relation.

hashCode

public int hashCode()

Overrides:
hashCode in class Relation
See Also:
Relation.hashCode()

getTimedRelation

public final ITimedRelation getTimedRelation()
Returns object of class TimedRelation no matter if the object is of class ITimedRelation or class which inherits from it.

Specified by:
getTimedRelation in interface ITimedRelation
Returns:
The object of class TimedRelation.

getFixedHashCode

public final int getFixedHashCode()
Remark: the hash code of the id of the TimedRelation is dependent on all the data which are checked in the equals method, because the id is constructed of the source and target nodes IDs and the date.

Specified by:
getFixedHashCode in interface ITimedRelation
Returns:
The hash code of the timed relation.

fixedEquals

public final boolean fixedEquals(ITimedRelation relation)
Checks if given timed relation is equal in terms of timed relation not the domain-specific sense, to the given timed relation.

Specified by:
fixedEquals in interface ITimedRelation
Parameters:
relation - The relation which is checked for equality.
Returns:
True if source, target and the date of both relations are equal.
See Also:
ITimedRelation.fixedEquals(pl.edu.agh.cast.model.base.ITimedRelation)


Copyright © 2007-2009 IISG AGH-UST Krakow, Poland. All Rights Reserved.