Class KOccurTerm


  • public class KOccurTerm
    extends KTerm
    This class represent an expression of type occur(target,lvars) where target
    is the value for wich we want to restrict the number of occurence(s) in the
    lVars array of variables.

    Example :
    
    KProblem p(...);
    KIntVar countVar(...);
    KIntVarArray X(...);
    
    KOccurTerm occurTerm(3,X);
    
    // posting the constraint "the number of occurences of the value 3 in the
    // X variable array must be less than the value of countVar
    p.post(occurTerm <= countVar);
    // or
    p.post(occurTerm <= 5);
    

    Since:
    2016.1
    See Also:
    KOccurrence
    • Constructor Detail

      • KOccurTerm

        protected KOccurTerm​(long cPtr,
                             boolean cMemoryOwn)
      • KOccurTerm

        public KOccurTerm()
        Default constructor
      • KOccurTerm

        public KOccurTerm​(int target,
                          KIntVarArray lvars)
        Main constructor
      • KOccurTerm

        public KOccurTerm​(KOccurTerm toCopy,
                          int pb)
        Copy constructor for a specific instance
    • Method Detail

      • getCPtr

        protected static long getCPtr​(KOccurTerm obj)
      • finalize

        protected void finalize()
        Overrides:
        finalize in class KTerm
      • delete

        public void delete()
        Overrides:
        delete in class KTerm
      • getTarget

        public int getTarget()
        return the target value
      • getLvars

        public KIntVarArray getLvars()
        return the array of variables in wich we want to restrict the number of occurences of the target value