Package org.jacop.constraints
Class ProfileItem
java.lang.Object
org.jacop.constraints.ProfileItem
- Direct Known Subclasses:
ProfileItemCondition
Defines a basic structure used to update profile for cumulative constraint.
It consists if to time-points and a value denoting the interval [a, b) (a
belongs to it nad b does not) and the value.
- Version:
- 4.8
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionIt constructs a profile item.ProfileItem
(int a, int b, int val) It constructs a profile item which spans over interval (a, b) with a given amount specified by val.ProfileItem
(short type) It constructs the profile item with a given type.ProfileItem
(short type, int a, int b, int val) It constructs a profile item of a given type spanning across the given interval and contributing a given amount towards the profile. -
Method Summary
Modifier and TypeMethodDescriptionint
max()
It returns the ending point of the profile item.int
min()
It returns the starting point of the profile item.void
overlap
(ProfileItem a, ProfileItem left, ProfileItem overlap, ProfileItem right) It compute the overlap with the specified profile item.void
set
(int a, int b, int val) It sets the attributes of the profile item.void
setMax
(int b) It sets the ending point of the profile item.void
setMin
(int a) It sets the starting point of the profile item.void
setValue
(int val) It sets the amount by which this profile item is contributing towards the profile.void
subtract
(ProfileItem a, ProfileItem left, ProfileItem right) It computes subtraction of a given item and returns the result.toString()
int
value()
It returns the amount which is being contributed by this profile item to the profile.
-
Field Details
-
min
public int minIt specifies the starting point of the profile item. -
max
public int maxIt specifies the ending point of the profile item. -
value
public int valueIt specifies the amount by which this profile item contributes in the profile. -
type
short type
-
-
Constructor Details
-
ProfileItem
public ProfileItem()It constructs a profile item. By default it is a cumulative profile item. -
ProfileItem
public ProfileItem(int a, int b, int val) It constructs a profile item which spans over interval (a, b) with a given amount specified by val.- Parameters:
a
- starting point of the profile item.b
- ending point of the profile item.val
- the contribution of the item towards the profile.
-
ProfileItem
public ProfileItem(short type) It constructs the profile item with a given type.- Parameters:
type
- it specifies the type of the profile item.
-
ProfileItem
public ProfileItem(short type, int a, int b, int val) It constructs a profile item of a given type spanning across the given interval and contributing a given amount towards the profile.- Parameters:
type
- it specifies the type of the profile item.a
- it specifies the starting point of the profile item.b
- it specifies the ending point of the profile item.val
- it specifies how much this profile item contributes in the profile.
-
-
Method Details
-
max
public int max()It returns the ending point of the profile item.- Returns:
- the ending point of the profile item.
-
min
public int min()It returns the starting point of the profile item.- Returns:
- the starting point of the profile item.
-
overlap
It compute the overlap with the specified profile item. The results are given as profile items too.- Parameters:
a
- the object for which the overlap with current object is being computed.left
- the left part of this profile item which is not being overlapped.overlap
- the overlapped part.right
- the right part of this profile item which is not being overlapped.
-
set
public void set(int a, int b, int val) It sets the attributes of the profile item.- Parameters:
a
- the starting point of the profile item.b
- the ending point of the profile item.val
- the amount contributed towards a profile by this profile item.
-
setMax
public void setMax(int b) It sets the ending point of the profile item.- Parameters:
b
- the ending point of the profile item
-
setMin
public void setMin(int a) It sets the starting point of the profile item.- Parameters:
a
- the starting point of the profile item.
-
setValue
public void setValue(int val) It sets the amount by which this profile item is contributing towards the profile.- Parameters:
val
- amount by which this profile item is contributing towards the profile
-
subtract
It computes subtraction of a given item and returns the result.- Parameters:
a
- the item being subtracted from this profile item.left
- the left part remaining after subtraction.right
- the right part remaining after subtraction.
-
toString
-
value
public int value()It returns the amount which is being contributed by this profile item to the profile.- Returns:
- the amount contributed by this profile item to the profile.
-