Class Compound

java.lang.Object
com.semedy.reasoner.api.logic.Compound
All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
Function, Literal

public class Compound extends Object implements Cloneable, Serializable
Represents a predicate or a function.
The symbol (predicate or function symbol) is a long.
The corresponding symbol may be found in the symbol table.
The arguments are either longs for codes, variables or objects
Author:
angele
See Also:
  • Constructor Details

    • Compound

      public Compound(String symbol, long code, Object[] args)
    • Compound

      public Compound(long code, Object[] args, boolean ground)
    • Compound

      public Compound(long code)
    • Compound

      public Compound(long code, Object[] args)
  • Method Details

    • getInternalBuffer

      public long[] getInternalBuffer()
    • clearInternalBuffer

      public void clearInternalBuffer()
    • getVariables

      public final List<Variable> getVariables()
      Return all variables in compound
      Returns:
    • getVariablesAsBits

      public final BitSet getVariablesAsBits()
      Return all variable positions in a bitset
      Returns:
    • getVariableOccurrences

      public Map<Variable,Integer> getVariableOccurrences()
      returns for each variable how often it occurs in compound
      Returns:
    • getSymbol

      public long getSymbol()
      Return the symbol of the compound
      Returns:
    • getSymbolAsString

      public String getSymbolAsString()
      Return the symbol of the compound
      Returns:
    • getArgument

      public Object getArgument(int i)
      Return the argument at index i
      Parameters:
      i -
      Returns:
    • isArgumentGround

      public boolean isArgumentGround(int i)
    • getSubstitutedArgument

      public Object getSubstitutedArgument(int i)
      Return the substituted argument at index i
      Parameters:
      i -
      Returns:
    • isGround

      public boolean isGround()
      Is the compound ground (has no variables)
      Returns:
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • getArity

      public int getArity()
      Get the arity of the compound
      Returns:
    • getNormalized

      public Compound getNormalized()
      Get a normalized version (all variables are renamed to Xi)
      Returns:
    • clone

      public Compound clone()
      Get a clone
      Returns:
      clone of the compound
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • getArguments

      public Object[] getArguments()
      Get all arguments. The arguments are NOT cloned
      Returns:
    • boundArguments

      public BitSet boundArguments(BitSet boundvars)
      Returns bound arguments if variables are bound
      Parameters:
      boundvars -
      Returns: