Class IntDomain

java.lang.Object
org.jacop.core.Domain
org.jacop.core.IntDomain
Direct Known Subclasses:
BoundDomain, IntervalDomain, SmallDenseDomain

public abstract class IntDomain extends Domain
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    It specifies the constant for ANY event.
    static final int
    It specifies the constant for BOUND event.
    static final int
    Unique identifier for a bound domain type.
    static final IntDomain
    It specifies an empty integer domain.
    (package private) static final int[][]
    It specifies for each event what other events are subsumed by this event.
    private static final Random
     
    static final int
    It specifies the constant for GROUND event.
    static final int
    Unique identifier for an interval domain type.
    static final int
    It specifies the maximum element in the domain.
    static final int
    It specifies the minimum element in the domain.
    It specifies the previous domain which was used by this domain.
    static final int
    Unique identifier for a small dense domain type.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addDom(IntDomain domain)
    It adds values as specified by the parameter to the domain.
    static int
    addInt(int x, int y)
    Returns the sum of its arguments, if the result overflows MaxInt or MinInt is returned.
    abstract IntDomain
    It clones the domain object.
    abstract IntDomain
    It clones the domain object, only data responsible for encoding domain values is cloned.
    abstract IntDomain
    It creates a complement of a domain.
    boolean
    contains(int value)
    It checks if value belongs to the domain.
    abstract boolean
    contains(int min, int max)
    It checks if an interval min..max belongs to the domain.
    boolean
    It specifies if the current domain contains the domain given as a parameter.
    static final Interval
    divBounds(int a, int b, int c, int d)
     
    static final Interval
    divIntBounds(int a, int b, int c)
     
    static final Interval
    divIntBounds(int a, int b, int c, int d)
     
    static int
    divRoundDown(int a, int b)
     
    static long
    divRoundDown(long a, long b)
     
    static int
    divRoundUp(int a, int b)
     
    static long
    divRoundUp(long a, long b)
     
    int
    It returns the number of elements smaller than el.
    boolean
    eq(IntDomain domain)
    It specifies if the other int domain is equal to this one.
    abstract int
    getElementAt(int index)
    It access the element at the specified position.
    int[]
    getEventsInclusion(int pruningEvent)
    It helps to specify what events should be executed if a given event occurs.
    abstract Interval
    getInterval(int position)
    It returns required interval.
    abstract IntDomain
    It returns domain at earlier level at which the change has occurred.
    int
    It returns a random value from the domain.
    abstract int
    It returns the size of the domain.
    abstract void
    in(int storeLevel, Var var, int min, int max)
    It updates the domain to have values only within the interval min..max.
    void
    in(int level, Var var, Domain domain)
    It enforces that this domain is included within the specified domain.
    void
    in(int storeLevel, Var var, IntDomain domain)
    It updates the domain to have values only within the domain.
    void
    inComplement(int storeLevel, Var var, int complement)
    It updates the domain to not contain the value complement.
    abstract void
    inComplement(int storeLevel, Var var, int min, int max)
    It updates the domain so it does not contain the supplied interval.
    void
    inMax(int storeLevel, Var var, int max)
    It updates the domain according to the maximum value and stamp value.
    void
    inMin(int storeLevel, Var var, int min)
    It updates the domain according to the minimum value and stamp value.
    abstract void
    inShift(int storeLevel, Var var, IntDomain domain, int shift)
    It updates the domain to contain the elements as specifed by the domain, which is shifted.
    abstract IntDomain
    intersect(int min, int max)
    In intersects current domain with the interval min..max.
    abstract IntDomain
    It intersects current domain with the one given as a parameter.
    abstract int
    intersectAdapt(int min, int max)
    It computes an intersection of this domain with an interval [min..max].
    abstract int
    It computes an intersection with a given domain and stores it in this domain.
    It returns interval enumeration of the domain values.
    void
    inValue(int level, IntVar var, int value)
    It reduces domain to a single value.
    abstract boolean
    isIntersecting(int min, int max)
    It checks if interval min..max intersects with current domain.
    boolean
    Checks if two domains intersect.
    int
    leftElement(int intervalNo)
    It returns the left most element of the given interval.
    int
    lex(IntDomain domain)
     
    abstract int
    max()
    It returns the maximum value in a domain.
    abstract int
    min()
    It returns the minimum value in a domain.
    static final Interval
    mulBounds(int a, int b, int c)
     
    static final Interval
    mulBounds(int a, int b, int c, int d)
     
    static int
    multiplyInt(int x, int y)
    Returns the product of the arguments, if the result overflows MaxInt or MinInt is returned.
    abstract int
    nextValue(int value)
    It gives next value in the domain from the given one (lexigraphical ordering).
    int
    It returns the number of constraints
    abstract int
    It returns number of intervals required to represent this domain.
    abstract int
    previousValue(int value)
    It gives previous value in the domain from the given one (lexigraphical ordering).
    void
    putModelConstraint(int storeLevel, Var var, Constraint c, int pruningEvent)
    It adds a constraint to a domain, it should only be called by putConstraint function of Variable object.
    void
    putSearchConstraint(int storeLevel, Var var, Constraint c)
    It adds a constraint to a domain, it should only be called by putConstraint function of Variable object.
    abstract IntDomain
    recentDomainPruning(int currentStoreLevel)
    It returns the values which have been removed at current store level.
    void
    removeModelConstraint(int storeLevel, Var var, Constraint c)
    It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object.
    void
    removeSearchConstraint(int storeLevel, Var var, int position, Constraint c)
    It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object.
    void
    removeSearchConstraint(int storeLevel, Var var, Constraint c)
    It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object.
    int
    rightElement(int intervalNo)
    It returns the right most element of the given interval.
    abstract void
    setDomain(int min, int max)
    It sets this domain to contain exactly all values between min and max.
    abstract void
    It sets the domain to the specified domain.
    boolean
    singleton(int c)
    It returns true if given domain has only one element equal c.
    boolean
    It returns true if given domain has only one element.
    int
    It computes the size of the intersection between this domain and the domain supplied as a parameter.
    static final Interval
    squareBounds(int a, int b)
     
    subtract(int value)
    It intersects with the domain which is a complement of value.
    abstract IntDomain
    subtract(int min, int max)
    It subtracts interval min..max.
    It subtracts domain from current domain and returns the result.
    abstract void
    subtractAdapt(int value)
    It removes value from the domain.
    abstract void
    subtractAdapt(int min, int max)
    It removes all values between min and max to the domain.
    static int
    subtractInt(int x, int y)
    Returns the difference of the arguments, if the result overflows MaxInt or MinInt is returned.
    int[]
    It constructs and int array containing all elements in the domain.
    union(int value)
    It computes union of this domain and value.
    union(int min, int max)
    It computes union of this domain and the interval.
    union(IntDomain domain)
    It computes union of the supplied domain with this domain.
    void
    unionAdapt(int value)
    It adds a values to the domain.
    abstract void
    unionAdapt(int min, int max)
    It adds all values between min and max to the domain.
    int
    It computes a union between this domain and the domain provided as a parameter.
    void
    It adds interval of values to the domain.
    int
    It returns the value to which this domain is grounded.
    It returns value enumeration of the domain values.

    Methods inherited from class java.lang.Object

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

    • MinInt

      public static final int MinInt
      It specifies the minimum element in the domain.
      See Also:
    • MaxInt

      public static final int MaxInt
      It specifies the maximum element in the domain.
      See Also:
    • GROUND

      public static final int GROUND
      It specifies the constant for GROUND event. It has to be smaller than the constant for events BOUND and ANY.
      See Also:
    • BOUND

      public static final int BOUND
      It specifies the constant for BOUND event. It has to be smaller than the constant for event ANY.
      See Also:
    • ANY

      public static final int ANY
      It specifies the constant for ANY event.
      See Also:
    • eventsInclusion

      static final int[][] eventsInclusion
      It specifies for each event what other events are subsumed by this event. Possibly implement this by bit flags in int.
    • IntervalDomainID

      public static final int IntervalDomainID
      Unique identifier for an interval domain type.
      See Also:
    • BoundDomainID

      public static final int BoundDomainID
      Unique identifier for a bound domain type.
      See Also:
    • SmallDenseDomainID

      public static final int SmallDenseDomainID
      Unique identifier for a small dense domain type.
      See Also:
    • emptyIntDomain

      public static final IntDomain emptyIntDomain
      It specifies an empty integer domain.
    • previousDomain

      public IntDomain previousDomain
      It specifies the previous domain which was used by this domain. The old domain is stored here and can be easily restored if necessary.
    • generator

      private static final Random generator
  • Constructor Details

    • IntDomain

      public IntDomain()
  • Method Details

    • getEventsInclusion

      public int[] getEventsInclusion(int pruningEvent)
      It helps to specify what events should be executed if a given event occurs.
      Specified by:
      getEventsInclusion in class Domain
      Parameters:
      pruningEvent - the pruning event for which we want to know what events it encompasses.
      Returns:
      an array specifying what events should be included given this event.
    • unionAdapt

      public void unionAdapt(Interval i)
      It adds interval of values to the domain.
      Parameters:
      i - Interval which needs to be added to the domain.
    • addDom

      public void addDom(IntDomain domain)
      It adds values as specified by the parameter to the domain.
      Parameters:
      domain - Domain which needs to be added to the domain.
    • unionAdapt

      public abstract void unionAdapt(int min, int max)
      It adds all values between min and max to the domain.
      Parameters:
      min - the left bound of the interval being added.
      max - the right bound of the interval being added.
    • unionAdapt

      public void unionAdapt(int value)
      It adds a values to the domain.
      Parameters:
      value - value being added to the domain.
    • isIntersecting

      public boolean isIntersecting(IntDomain domain)
      Checks if two domains intersect.
      Parameters:
      domain - the domain for which intersection is checked.
      Returns:
      true if domains are intersecting.
    • isIntersecting

      public abstract boolean isIntersecting(int min, int max)
      It checks if interval min..max intersects with current domain.
      Parameters:
      min - the left bound of the interval.
      max - the right bound of the interval.
      Returns:
      true if domain intersects with the specified interval.
    • contains

      public boolean contains(IntDomain domain)
      It specifies if the current domain contains the domain given as a parameter.
      Parameters:
      domain - for which we check if it is contained in the current domain.
      Returns:
      true if the supplied domain is cover by this domain.
    • contains

      public abstract boolean contains(int min, int max)
      It checks if an interval min..max belongs to the domain.
      Parameters:
      min - the minimum value of the interval being checked
      max - the maximum value of the interval being checked
      Returns:
      true if value belongs to the domain.
    • complement

      public abstract IntDomain complement()
      It creates a complement of a domain.
      Returns:
      it returns the complement of this domain.
    • contains

      public boolean contains(int value)
      It checks if value belongs to the domain.
      Parameters:
      value - which is checked if it exists in the domain.
      Returns:
      true if value belongs to the domain.
    • nextValue

      public abstract int nextValue(int value)
      It gives next value in the domain from the given one (lexigraphical ordering). If no value can be found then returns the same value.
      Parameters:
      value - it specifies the value after which a next value has to be found.
      Returns:
      next value after the specified one which belong to this domain.
    • previousValue

      public abstract int previousValue(int value)
      It gives previous value in the domain from the given one (lexigraphical ordering). If no value can be found then returns the same value.
      Parameters:
      value - before which a value is seeked for.
      Returns:
      it returns the value before the one specified as a parameter.
    • valueEnumeration

      public abstract ValueEnumeration valueEnumeration()
      It returns value enumeration of the domain values.
      Specified by:
      valueEnumeration in class Domain
      Returns:
      valueEnumeration which can be used to enumerate one by one value from this domain.
    • intervalEnumeration

      public abstract IntervalEnumeration intervalEnumeration()
      It returns interval enumeration of the domain values.
      Returns:
      intervalEnumeration which can be used to enumerate intervals in this domain.
    • getSize

      public abstract int getSize()
      It returns the size of the domain.
      Specified by:
      getSize in class Domain
      Returns:
      number of elements in this domain.
    • intersect

      public abstract IntDomain intersect(IntDomain dom)
      It intersects current domain with the one given as a parameter.
      Parameters:
      dom - domain with which the intersection needs to be computed.
      Returns:
      the intersection between supplied domain and this domain.
    • intersect

      public abstract IntDomain intersect(int min, int max)
      In intersects current domain with the interval min..max.
      Parameters:
      min - the left bound of the interval (inclusive)
      max - the right bound of the interval (inclusive)
      Returns:
      the intersection between the specified interval and this domain.
    • subtract

      public IntDomain subtract(int value)
      It intersects with the domain which is a complement of value.
      Parameters:
      value - the value for which the complement is computed
      Returns:
      the domain which does not contain specified value.
    • subtractAdapt

      public abstract void subtractAdapt(int value)
      It removes value from the domain. It adapts current (this) domain.
      Parameters:
      value - the value for which the complement is computed
    • subtractAdapt

      public abstract void subtractAdapt(int min, int max)
      It removes all values between min and max to the domain.
      Parameters:
      min - the left bound of the interval being removed.
      max - the right bound of the interval being removed.
    • max

      public abstract int max()
      It returns the maximum value in a domain.
      Returns:
      the largest value present in the domain.
    • min

      public abstract int min()
      It returns the minimum value in a domain.
      Returns:
      the smallest value present in the domain.
    • setDomain

      public abstract void setDomain(IntDomain domain)
      It sets the domain to the specified domain.
      Parameters:
      domain - the domain from which this domain takes all elements.
    • setDomain

      public abstract void setDomain(int min, int max)
      It sets this domain to contain exactly all values between min and max.
      Parameters:
      min - the left bound of the interval (inclusive).
      max - the right bound of the interval (inclusive).
    • singleton

      public boolean singleton(int c)
      It returns true if given domain has only one element equal c.
      Parameters:
      c - the value to which the only element should be equal to.
      Returns:
      true if the domain contains only one element c.
    • subtract

      public IntDomain subtract(IntDomain domain)
      It subtracts domain from current domain and returns the result.
      Parameters:
      domain - the domain which is subtracted from this domain.
      Returns:
      the result of the subtraction.
    • subtract

      public abstract IntDomain subtract(int min, int max)
      It subtracts interval min..max.
      Parameters:
      min - the left bound of the interval (inclusive).
      max - the right bound of the interval (inclusive).
      Returns:
      the result of the subtraction.
    • union

      public IntDomain union(IntDomain domain)
      It computes union of the supplied domain with this domain.
      Parameters:
      domain - the domain for which the union is computed.
      Returns:
      the union of this domain with the supplied one.
    • union

      public IntDomain union(int min, int max)
      It computes union of this domain and the interval.
      Parameters:
      min - the left bound of the interval (inclusive).
      max - the right bound of the interval (inclusive).
      Returns:
      the union of this domain and the interval.
    • union

      public IntDomain union(int value)
      It computes union of this domain and value.
      Parameters:
      value - it specifies the value which is being added.
      Returns:
      domain which is a union of this one and the value.
    • inMin

      public void inMin(int storeLevel, Var var, int min)
      It updates the domain according to the minimum value and stamp value. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      min - the minimum value to which the domain is updated.
    • inMax

      public void inMax(int storeLevel, Var var, int max)
      It updates the domain according to the maximum value and stamp value. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      max - the maximum value to which the domain is updated.
    • in

      public abstract void in(int storeLevel, Var var, int min, int max)
      It updates the domain to have values only within the interval min..max. The type of update is decided by the value of stamp. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      min - the minimum value to which the domain is updated.
      max - the maximum value to which the domain is updated.
    • inValue

      public void inValue(int level, IntVar var, int value)
      It reduces domain to a single value.
      Parameters:
      level - level of the store at which the update occurs.
      var - variable for which this domain is used.
      value - the value according to which the domain is updated.
    • in

      public void in(int storeLevel, Var var, IntDomain domain)
      It updates the domain to have values only within the domain. The type of update is decided by the value of stamp. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      domain - the domain according to which the domain is updated.
    • inComplement

      public void inComplement(int storeLevel, Var var, int complement)
      It updates the domain to not contain the value complement. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      complement - value which is removed from the domain if it belonged to the domain.
    • inComplement

      public abstract void inComplement(int storeLevel, Var var, int min, int max)
      It updates the domain so it does not contain the supplied interval. It informs the variable of a change if it occurred.
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      min - the left bound of the interval (inclusive).
      max - the right bound of the interval (inclusive).
    • noIntervals

      public abstract int noIntervals()
      It returns number of intervals required to represent this domain.
      Returns:
      the number of intervals in the domain.
    • getInterval

      public abstract Interval getInterval(int position)
      It returns required interval.
      Parameters:
      position - the position of the interval.
      Returns:
      the interval, or null if the required interval does not exist.
    • inShift

      public abstract void inShift(int storeLevel, Var var, IntDomain domain, int shift)
      It updates the domain to contain the elements as specifed by the domain, which is shifted. E.g. {1..4} + 3 = 4..7
      Parameters:
      storeLevel - level of the store at which the update occurs.
      var - variable for which this domain is used.
      domain - the domain according to which the domain is updated.
      shift - the shift which is used to shift the domain supplied as argument.
    • leftElement

      public int leftElement(int intervalNo)
      It returns the left most element of the given interval.
      Parameters:
      intervalNo - the interval number.
      Returns:
      the left bound of the specified interval.
    • rightElement

      public int rightElement(int intervalNo)
      It returns the right most element of the given interval.
      Parameters:
      intervalNo - the interval number.
      Returns:
      the right bound of the specified interval.
    • recentDomainPruning

      public abstract IntDomain recentDomainPruning(int currentStoreLevel)
      It returns the values which have been removed at current store level.
      Parameters:
      currentStoreLevel - the current store level.
      Returns:
      emptyDomain if domain did not change at current level, or the set of values which have been removed at current level.
    • getPreviousDomain

      public abstract IntDomain getPreviousDomain()
      It returns domain at earlier level at which the change has occurred.
      Returns:
      previous domain
    • eq

      public boolean eq(IntDomain domain)
      It specifies if the other int domain is equal to this one.
      Parameters:
      domain - the domain which is compared to this domain.
      Returns:
      true if both domains contain the same elements, false otherwise.
    • in

      public void in(int level, Var var, Domain domain)
      Description copied from class: Domain
      It enforces that this domain is included within the specified domain.
      Specified by:
      in in class Domain
      Parameters:
      level - store level at which this inclusion is enforced.
      var - variable which is informed of the change if any occurs.
      domain - the domain which restricts this domain.
    • singleton

      public boolean singleton(Domain value)
      Description copied from class: Domain
      It returns true if given domain has only one element.
      Specified by:
      singleton in class Domain
      Parameters:
      value - value represented as domain object to which the domain must be equal to.
      Returns:
      true if the domain contains only one element.
    • noConstraints

      public int noConstraints()
      Description copied from class: Domain
      It returns the number of constraints
      Specified by:
      noConstraints in class Domain
      Returns:
      the number of constraints attached to this domain.
    • putModelConstraint

      public void putModelConstraint(int storeLevel, Var var, Constraint c, int pruningEvent)
      It adds a constraint to a domain, it should only be called by putConstraint function of Variable object. putConstraint function from Variable must make a copy of a vector of constraints if vector was not cloned.
      Specified by:
      putModelConstraint in class Domain
      Parameters:
      storeLevel - the level at which the model constraint is to be added.
      var - variable to which the constraint is attached to.
      c - the constraint which is being attached to a variable.
      pruningEvent - the type of the prunning event required to check the consistency of the attached constraint.
    • removeModelConstraint

      public void removeModelConstraint(int storeLevel, Var var, Constraint c)
      Description copied from class: Domain
      It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object. It is called for example in a situation when a constraint is satisfied.
      Specified by:
      removeModelConstraint in class Domain
      Parameters:
      storeLevel - specifies the current level of the store, from which it should be removed.
      var - specifies variable for which the constraint is being removed.
      c - the constraint which is being removed.
    • putSearchConstraint

      public void putSearchConstraint(int storeLevel, Var var, Constraint c)
      It adds a constraint to a domain, it should only be called by putConstraint function of Variable object. putConstraint function from Variable must make a copy of a vector of constraints if vector was not cloned.
      Specified by:
      putSearchConstraint in class Domain
      Parameters:
      storeLevel - the level at which the search constraint is to be added.
      var - variable to which the constraint is attached to.
      c - the constraint which is being attached to a variable.
    • removeSearchConstraint

      public void removeSearchConstraint(int storeLevel, Var var, Constraint c)
      It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object.
      Parameters:
      storeLevel - the current level of the store.
      var - the variable for which the constraint is being removed.
      c - the constraint being removed.
    • removeSearchConstraint

      public void removeSearchConstraint(int storeLevel, Var var, int position, Constraint c)
      It removes a constraint from a domain, it should only be called by removeConstraint function of Variable object.
      Specified by:
      removeSearchConstraint in class Domain
      Parameters:
      storeLevel - specifies the current level of the store, from which it should be removed.
      var - specifies variable for which the constraint is being removed.
      position - specifies the position of the removed constraint.
      c - the constraint which is being removed.
    • clone

      public abstract IntDomain clone()
      Description copied from class: Domain
      It clones the domain object.
      Specified by:
      clone in class Domain
    • cloneLight

      public abstract IntDomain cloneLight()
      Description copied from class: Domain
      It clones the domain object, only data responsible for encoding domain values is cloned. All other fields must be set separately.
      Specified by:
      cloneLight in class Domain
      Returns:
      return a clone of the domain. It aims at getting domain of the proper class type.
    • lex

      public int lex(IntDomain domain)
    • elementsSmallerThan

      public int elementsSmallerThan(int el)
      It returns the number of elements smaller than el.
      Parameters:
      el - the element from which counted elements must be smaller than.
      Returns:
      the number of elements which are smaller than the provided element el.
    • intersectAdapt

      public abstract int intersectAdapt(IntDomain intersect)
      It computes an intersection with a given domain and stores it in this domain.
      Parameters:
      intersect - domain with which the intersection is being computed.
      Returns:
      type of event which has occurred due to the operation.
    • unionAdapt

      public int unionAdapt(IntDomain union)
      It computes a union between this domain and the domain provided as a parameter. This domain is changed to reflect the result.
      Parameters:
      union - the domain with is used for the union operation with this domain.
      Returns:
      it returns information about the pruning event which has occurred due to this operation.
    • intersectAdapt

      public abstract int intersectAdapt(int min, int max)
      It computes an intersection of this domain with an interval [min..max]. It adapts this domain to the result of the intersection.
      Parameters:
      min - the minimum value of the interval used in the intersection computation.
      max - the maximum value of the interval used in the intersection computation.
      Returns:
      it returns information about the pruning event which has occurred due to this operation.
    • sizeOfIntersection

      public int sizeOfIntersection(IntDomain domain)
      It computes the size of the intersection between this domain and the domain supplied as a parameter.
      Parameters:
      domain - the domain with which the intersection is computed.
      Returns:
      the size of the intersection.
    • getElementAt

      public abstract int getElementAt(int index)
      It access the element at the specified position.
      Parameters:
      index - the position of the element, indexing starts from 0.
      Returns:
      the value at a given position in the domain.
    • toIntArray

      public int[] toIntArray()
      It constructs and int array containing all elements in the domain. The array will have size equal to the number of elements in the domain.
      Returns:
      the int array containing all elements in a domain.
    • value

      public int value()
      It returns the value to which this domain is grounded. It assumes that a domain is a singleton domain.
      Returns:
      the only value remaining in the domain.
    • getRandomValue

      public int getRandomValue()
      It returns a random value from the domain.
      Returns:
      random value.
    • mulBounds

      public static final Interval mulBounds(int a, int b, int c, int d)
    • mulBounds

      public static final Interval mulBounds(int a, int b, int c)
    • squareBounds

      public static final Interval squareBounds(int a, int b)
    • divBounds

      public static final Interval divBounds(int a, int b, int c, int d)
    • divIntBounds

      public static final Interval divIntBounds(int a, int b, int c, int d)
    • divIntBounds

      public static final Interval divIntBounds(int a, int b, int c)
    • divRoundDown

      public static long divRoundDown(long a, long b)
    • divRoundUp

      public static long divRoundUp(long a, long b)
    • divRoundDown

      public static int divRoundDown(int a, int b)
    • divRoundUp

      public static int divRoundUp(int a, int b)
    • multiplyInt

      public static int multiplyInt(int x, int y)
      Returns the product of the arguments, if the result overflows MaxInt or MinInt is returned.
      Parameters:
      x - the first value
      y - the second value
      Returns:
      the result or MaxInt/MinInt if result causes overflow
    • addInt

      public static int addInt(int x, int y)
      Returns the sum of its arguments, if the result overflows MaxInt or MinInt is returned.
      Parameters:
      x - the first value
      y - the second value
      Returns:
      the result or MaxInt/MinInt if result causes overflow
    • subtractInt

      public static int subtractInt(int x, int y)
      Returns the difference of the arguments, if the result overflows MaxInt or MinInt is returned.
      Parameters:
      x - the first value
      y - the second value to subtract from the first
      Returns:
      the result or MaxInt/MinInt if result causes overflow