T - the type of the timeline objectsS - the time granularitypublic abstract class AbstractConstraint<T,S extends IGranularity> extends DefaultRelationship<T> implements IConstraint<T,S>
SimpleGranularity and TimeGranularity.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConstraint(TimelineObjectPath<T> sourcePath,
TimelineObjectPath<T> targetPath)
Constructs a new constraint.
|
protected |
AbstractConstraint(TimelineObjectPath<T> sourcePath,
TimelineObjectPath<T> targetPath,
RelationshipType type)
Constructs a new constraint.
|
| Modifier and Type | Method and Description |
|---|---|
int |
getBufferDuration()
Returns the duration of the buffer.
|
S |
getBufferGranularity()
Returns the buffer granularity (days, hours, weeks).
|
BufferType |
getBufferType()
Returns the buffer type (=, <=, <, >, >=).
|
ConstraintType |
getConstraintType()
Returns the
ConstraintType which determines if the constraint is
a hard or a soft constraint. |
protected abstract double |
getDelta(long time1,
long time2,
S granularity)
Calculates the difference between the two time points for the given
granularity.
|
Violation |
getViolation(long time1,
long time2)
Checks whether a violation of the constraint exists for the given two
time points.
|
void |
setBufferDuration(int bufferDuration)
Sets the duration of the buffer.
|
void |
setBufferGranularity(S granularity)
Sets the buffer granularity (days, hours, weeks).
|
void |
setBufferType(BufferType type)
Sets the buffer type (=, <=, <, >, >=).
|
void |
setConstraintType(ConstraintType type)
Sets the
ConstraintType which determines if the constraint is a
hard or a soft constraint. |
String |
toString() |
getLabel, getPopupObject, getPopupTitleObject, getSourcePath, getTargetPath, getType, isDeletable, isSelectable, setDeletable, setLabel, setPopupObject, setPopupTitleObject, setSelectable, setSourcePath, setTargetPath, setTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetLabel, getPopupObject, getPopupTitleObject, getSourcePath, getTargetPath, getType, isDeletable, isSelectable, setSourcePath, setTargetPath, setTypeprotected AbstractConstraint(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath)
sourcePath - the path to the source timeline objecttargetPath - the path to the target timeline objectprotected AbstractConstraint(TimelineObjectPath<T> sourcePath, TimelineObjectPath<T> targetPath, RelationshipType type)
sourcePath - the path to the source timeline objecttargetPath - the path to the target timeline objecttype - the relationship type (S-E, E-S, S-S, E-E)public Violation getViolation(long time1, long time2)
IConstraintRelationshipType.END_TO_START then
time1will be the end time of the first timeline
object and time2 will be the start time of the second
timeline object.RelationshipType.END_TO_END then
time1will be the end time of the first timeline
object and time2 will be the end time of the second
timeline object.RelationshipType.START_TO_START then
time1will be the start time of the first timeline
object and time2 will be the start time of the second
timeline object.RelationshipType.START_TO_END then
time1will be the start time of the first timeline
object and time2 will be the end time of the second
timeline object.getViolation in interface IConstraint<T,S extends IGranularity>protected abstract double getDelta(long time1,
long time2,
S granularity)
time1 - the relevant time point of the first timeline object (might be
start or end time)time2 - the relevant time point of the second timeline object (might
be start or end time)granularity - the time granularity (e.g. HOURS, DAYS, ...)public void setBufferType(BufferType type)
IConstraintsetBufferType in interface IConstraint<T,S extends IGranularity>type - the buffer typepublic BufferType getBufferType()
IConstraintgetBufferType in interface IConstraint<T,S extends IGranularity>public void setConstraintType(ConstraintType type)
IConstraintConstraintType which determines if the constraint is a
hard or a soft constraint.setConstraintType in interface IConstraint<T,S extends IGranularity>type - the constraint typepublic ConstraintType getConstraintType()
IConstraintConstraintType which determines if the constraint is
a hard or a soft constraint.getConstraintType in interface IConstraint<T,S extends IGranularity>public int getBufferDuration()
IConstraintgetBufferDuration in interface IConstraint<T,S extends IGranularity>public void setBufferDuration(int bufferDuration)
IConstraintsetBufferDuration in interface IConstraint<T,S extends IGranularity>bufferDuration - the buffer durationpublic S getBufferGranularity()
IConstraintgetBufferGranularity in interface IConstraint<T,S extends IGranularity>public void setBufferGranularity(S granularity)
IConstraintsetBufferGranularity in interface IConstraint<T,S extends IGranularity>granularity - the buffer granularitypublic String toString()
toString in class DefaultRelationship<T>Copyright © 2006–2020 Dirk Lemmermann Software & Consulting. All rights reserved.