Class OpContainer

    • Field Detail

      • opFZ

        private Op opFZ
      • opZF

        private Op opZF
      • opZFZ

        private Op opZFZ
      • numberAtContainer

        private int numberAtContainer
    • Constructor Detail

      • OpContainer

        private OpContainer​(Op operator)
      • OpContainer

        private OpContainer​(java.lang.String text,
                            Op fz,
                            Op zf,
                            Op zfz)
    • Method Detail

      • make

        public static OpContainer make​(Op operator)
        Create new container based on operator name.
        Parameters:
        operator - operator which name will be used and which will be added to the new container
        Returns:
        generated container with the operator
      • make

        public static OpContainer make​(java.lang.String text,
                                       Op fz,
                                       Op zf,
                                       Op zfz)
      • add

        public boolean add​(Op operator)
        Add operator into the container.
        Parameters:
        operator - the operator to be added
        Returns:
        true if the operator has been added, false if it was impossible because similar operator already presented
        Throws:
        java.lang.IllegalArgumentException - if operator has different name
      • clear

        public void clear()
        Remove all saved operators.
      • findForArity

        public Op findForArity​(int arity)
        Find operator with arity in the container
        Parameters:
        arity - arity to be used (1..2)
        Returns:
        found operator or null
      • remove

        public boolean remove​(Op op)
        Remove operator from the container
        Parameters:
        op - operator to be removed
        Returns:
        true if operator was removed, false otherwise
        Throws:
        java.lang.IllegalArgumentException - if operator name is not compatible with the container
      • getType

        public TermType getType()
        Description copied from class: PrologTerm
        Get term type.
        Specified by:
        getType in class PrologTerm
        Returns:
        term type, must not be null
      • getArity

        public int getArity()
        Description copied from class: PrologTerm
        Arity of element.
        Overrides:
        getArity in class PrologTerm
        Returns:
        arity of element, make sense for compound terms, for primitive terms is 1
      • size

        public int size()
        Get current size of the container.
        Returns:
        size of the container
      • getIfSingle

        public Op getIfSingle()
        Get operator if it is only one in the container
        Returns:
        the found only operator, null if there are severe operators
      • findSimilar

        public Op findSimilar​(boolean hasLeftArg,
                              boolean hasRightArg)
        Find operator for presented arguments.
        Parameters:
        hasLeftArg - should have left argument
        hasRightArg - should have right argument
        Returns:
        operator for needed condition, null if not found
      • findForType

        public Op findForType​(OpAssoc type)
        Find operator for its type
        Parameters:
        type - type of needed operator
        Returns:
        found operator, null if not found
      • findSimilar

        public Op findSimilar​(OpAssoc type)
        Find operator with similar type. For instance FX is similar to FY and XF is similar to YF.
        Parameters:
        type - type of operator to find
        Returns:
        operator with similar type or null if not found
      • removeForType

        public boolean removeForType​(OpAssoc type)
        Remove operator for type
        Parameters:
        type - type of removing operator
        Returns:
        true if removed, false if not found
      • getPrecedence

        public int getPrecedence()
        Description copied from class: PrologTerm
        Get precedence of the term.
        Overrides:
        getPrecedence in class PrologTerm
        Returns:
        precedence, must not be negative