Class ProfileItem

java.lang.Object
org.jacop.constraints.ProfileItem
Direct Known Subclasses:
ProfileItemCondition

public class ProfileItem extends 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:
4.9
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
    It specifies the ending point of the profile item.
    int
    It specifies the starting point of the profile item.
    (package private) short
     
    int
    It specifies the amount by which this profile item contributes in the profile.
  • Constructor Summary

    Constructors
    Constructor
    Description
    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

    Modifier and Type
    Method
    Description
    int
    max()
    It returns the ending point of the profile item.
    int
    min()
    It returns the starting point of the profile item.
    void
    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
    It computes subtraction of a given item and returns the result.
     
    int
    It returns the amount which is being contributed by this profile item to the profile.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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.
    • 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

      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 - 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

      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 String toString()
      Overrides:
      toString in class 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.