JaCoP.constraints
Class ProfileItem

java.lang.Object
  extended by JaCoP.constraints.ProfileItem

public class ProfileItem
extends java.lang.Object

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:
3.1
Author:
Krzysztof Kuchcinski and Radoslaw Szymanek

Field Summary
 int max
          It specifies the ending point of the profile item.
 int min
          It specifies the starting point of the profile item.
 int value
          It specifies the amount by which this profile item contributes in the profile.
 
Constructor Summary
ProfileItem()
          It 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
 int 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.
 java.lang.String toString()
           
 int value()
          It returns the amount which is being contributed by this profile item to the profile.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

min

public int min
It specifies the starting point of the profile item.


max

public int max
It specifies the ending point of the profile item.


value

public int value
It specifies the amount by which this profile item contributes in the profile.

Constructor Detail

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 Detail

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

public void overlap(ProfileItem a,
                    ProfileItem left,
                    ProfileItem overlap,
                    ProfileItem right)
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 -

setMin

public void setMin(int a)
It sets the starting point of the profile item.

Parameters:
a -

setValue

public void setValue(int val)
It sets the amount by which this profile item is contributing towards the profile.

Parameters:
val -

subtract

public void subtract(ProfileItem a,
                     ProfileItem left,
                     ProfileItem right)
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

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

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.