Class Literal
- java.lang.Object
-
- ai.libs.jaicore.logic.fol.structure.Literal
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<Literal>
- Direct Known Subclasses:
InterpretedLiteral
public class Literal extends java.lang.Object implements java.io.Serializable, java.lang.Comparable<Literal>
A literal defines a property over parameters. Note that literals can be cloned using the clone() methods.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Literal(Literal l, java.util.Map<? extends LiteralParam,? extends LiteralParam> map)Literal(java.lang.String pPropertyWithParams)Protected helper constructor.Literal(java.lang.String property2, boolean isPositive)Literal(java.lang.String property, LiteralParam parameter)Creates a monadic literal (with only one parameter).Literal(java.lang.String property, java.util.List<? extends LiteralParam> parameters)Creates a literal with a list of parameters.Literal(java.lang.String property2, java.util.List<? extends LiteralParam> parameters, boolean isPositive)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Literalclone()Literalclone(java.util.Map<? extends VariableParam,? extends LiteralParam> mapping)Creates a copy of this literal on which the given parameter mapping is applied.intcompareTo(Literal l)booleanequals(java.lang.Object obj)java.util.List<ConstantParam>getConstantParams()java.util.List<LiteralParam>getParameters()java.lang.StringgetProperty()Returns a String representation of the property stated by this literal.java.lang.StringgetPropertyName()Returns only the property name of this literal.java.util.List<VariableParam>getVariableParams()inthashCode()booleanhasVariableParams()booleanisGround()booleanisNegated()booleanisNegationOf(Literal l)booleanisPositive()LiteraltoggleNegation()java.lang.StringtoString()java.lang.StringtoString(boolean printTypesOfParams)
-
-
-
Constructor Detail
-
Literal
public Literal(Literal l, java.util.Map<? extends LiteralParam,? extends LiteralParam> map)
-
Literal
public Literal(java.lang.String property, LiteralParam parameter)Creates a monadic literal (with only one parameter).- Parameters:
property- The property defined by this literal.parameter- The parameter of this literal.
-
Literal
public Literal(java.lang.String property, java.util.List<? extends LiteralParam> parameters)Creates a literal with a list of parameters.- Parameters:
property- The property defined by this literal.parameter- The parameters of this literal defined as a list.
-
Literal
public Literal(java.lang.String pPropertyWithParams)
Protected helper constructor. Ensure the literal gets parameters!!
-
Literal
public Literal(java.lang.String property2, boolean isPositive)
-
Literal
public Literal(java.lang.String property2, java.util.List<? extends LiteralParam> parameters, boolean isPositive)
-
-
Method Detail
-
getProperty
public final java.lang.String getProperty()
Returns a String representation of the property stated by this literal.
-
getPropertyName
public final java.lang.String getPropertyName()
Returns only the property name of this literal.
-
getParameters
public final java.util.List<LiteralParam> getParameters()
- Returns:
- The parameters of this literal in an unmodifiable list.
-
isNegated
public final boolean isNegated()
-
toggleNegation
public Literal toggleNegation()
-
getVariableParams
public final java.util.List<VariableParam> getVariableParams()
- Returns:
- The variable parameters of this literal in an unmodifiable list.
-
getConstantParams
public final java.util.List<ConstantParam> getConstantParams()
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
clone
public Literal clone()
- Overrides:
clonein classjava.lang.Object
-
clone
public Literal clone(java.util.Map<? extends VariableParam,? extends LiteralParam> mapping)
Creates a copy of this literal on which the given parameter mapping is applied.- Parameters:
mapping- A mapping of parameters.- Returns:
- A copy of this literal on which the given parameter mapping is applied.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(boolean printTypesOfParams)
-
isNegationOf
public boolean isNegationOf(Literal l)
-
isPositive
public boolean isPositive()
-
hasVariableParams
public boolean hasVariableParams()
-
isGround
public final boolean isGround()
-
-