Class NotItem

  • All Implemented Interfaces:

    public class NotItem
    extends CompositeItem
    A composite item where the first item is positive and the following items are negative items which should be excluded from the result.
    • Constructor Detail

      • NotItem

        public NotItem()
    • Method Detail

      • getItemType

        public Item.ItemType getItemType()
        Description copied from class: Item
        Return the enumerated type of this item.
        Specified by:
        getItemType in class Item
      • getName

        public java.lang.String getName()
        Description copied from class: Item
        Returns the name of this item
        Specified by:
        getName in class Item
      • addItem

        public void addItem​(Item item)
        Adds an item. The first item is the positive the rest is negative
        addItem in class CompositeItem
      • addNegativeItem

        public void addNegativeItem​(Item negative)
        Adds a negative item. Like addItem but skips the first position (position 0) if it is not already set.
      • negativeItems

        public java.util.List<Item> negativeItems()
        Returns the negative items of this: All child items except the first
      • getPositiveItem

        public Item getPositiveItem()
        Returns the positive item (the first subitem), or null if no positive items has been added
      • setPositiveItem

        public Item setPositiveItem​(Item item)
        Sets the positive item (the first item)
        the old positive item, or null if there was no items
      • addPositiveItem

        public void addPositiveItem​(Item item)
        Convenience method for adding a positive item. If a positive item is already present the positive item becomes an AndItem with the items added
      • removeItem

        public boolean removeItem​(Item item)
        Description copied from class: CompositeItem
        Removes the given item. Does nothing if the item is not present.
        removeItem in class CompositeItem
        item - the item to remove
        whether the item was removed
      • removeItem

        public Item removeItem​(int index)
        Description copied from class: CompositeItem
        Removes the item at the given index
        removeItem in class CompositeItem
        index - the index of the item to remove
        the removed item
      • appendHeadingString

        protected void appendHeadingString​(java.lang.StringBuilder buffer)
        Not items uses a empty heading instead of "NOT "
        appendHeadingString in class Item
      • appendBodyString

        protected void appendBodyString​(java.lang.StringBuilder buffer)
        Overridden to tolerate nulls and to append "+" to the first item and "-" to the rest
        appendBodyString in class CompositeItem
      • getTermCount

        public int getTermCount()
        Returns the number of actual *positive* terms in this
        getTermCount in class CompositeItem