    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.fopl.LitLObject

    java.lang.Object
       |
       +----JavaAgent.resource.Language
               |
               +----JavaAgent.resource.fopl.LitLObject

public class LitLObject
extends Language
implements Parsable, KRSentence

A LitLObject is a rather ugly side effect necessary to allow the inheritance from the JAT Language class. Literal cannot directly inherit from the Language class because a Literal is a Formula. Hence, this class, LitLObject, inherits from Language and contains only exactly one object, a Literal.

See Also:
  Language, Literal

##

theLit
  The Literal contained in this LitLObject.

##

LitLObject()
  This constructor creates an empty instance of a LitLObject.
LitLObject(String)
  This constructor for a LitLObject parses the given String and creates the according Literal.

##

clone()
  This function generates a copy of this LitLObject.
clone(Substitution)
  Returns a copy of this Literal with Variables replaced according to the given Substitution.
equals(Object)
  This function tests whether this and the given Object are equal.
getConjunction(Vector)
  This function returns a FOPLFormula that represents a conjunction of the Literals in the given Vector.
getFOPLFormula()
  This function returns a FOPLFormula that contains the Literal in this LitLObject.
getKBClass()
  This function returns the Class that implements KnowledgeBase for this KRSentence Class.
getLiteral()
  This function returns the Literal embedded in this LitLObject.
parse(InputStream)
  This function can be used to parse a given InputStream that represents a Literal.
parse(String)
  This function can be used to parse a given String that represents a LitLObject.
parseString(String)
  This function should only be used on empty instances of a LitLObject.
toString()
  This function returns the String that represents this LitLObject.

##

theLit

     protected Literal theLit

  The Literal contained in this LitLObject.

##

LitLObject

     public LitLObject()

  This constructor creates an empty instance of a LitLObject.

LitLObject

     public LitLObject(String input) throws ParseException

  This constructor for a LitLObject parses the given String and creates the according Literal.

  Parameters:
    input - The string to be parsed.
  Throws: ParseException
    An Exception can occur if parsing fails.

##

clone

     public Object clone()

  This function generates a copy of this LitLObject. The copy will contain a clone of the Literal contained in this one.

  Returns:
    an equal copy of this LitLObject
  Overrides:
    clone in class Object

clone

     public LitLObject clone(Substitution s) throws IllegalArgumentException

  Returns a copy of this Literal with Variables replaced according to the given Substitution. Symbols in the copy will be the same as the original ones but Variables will be repalced by the respective Terms in the given Substitution. A Variable not occurring in the Substitution will be replaced by a new (different) Variable with the same name. The given Substitution will be extended to include the mappings of old Variables to new ones.

  This function can also be used to generate a copy of this Literal that contains a new set of Variables. The given Substitution should be a new, empty Substitution in this case. Otherwise cloning can be seen as instantiating the Literal.

  Parameters:
    s - the Substitution that tells us how to replace Variables
  Returns:
    a new LitLObject that is an instance of this LitLObject; the Substitution `s` will be extended with any new Variable replacements introduced
  Throws: IllegalArgumentException
    An exception can occur if the given Substitution is null. In this case `clone()` (above) should be used.

getLiteral

     public Literal getLiteral()

  This function returns the Literal embedded in this LitLObject.

  Returns:
    the Literal embedded in this LitLObject

getConjunction

     public static KRSentence getConjunction(Vector conjuncts)

  This function returns a FOPLFormula that represents a conjunction of the Literals in the given Vector. Note that this is function does not return a LitLObject but a different kind of KRSentence.

  Parameters:
    conjuncts - a Vector of LitLObjects
  Returns:
    a FOPLFormula containing the conjunction of the given LitLObjects

getKBClass

     public static Class getKBClass()

  This function returns the Class that implements KnowledgeBase for this KRSentence Class. It could be something much simpler but for now it is FormulaSet.

getFOPLFormula

     public FOPLFormula getFOPLFormula()

  This function returns a FOPLFormula that contains the Literal in this LitLObject.

equals

     public boolean equals(Object otherLit)

  This function tests whether this and the given Object are equal. In general, two LitLObjecte are equal if they contain equal Literals.

  Parameters:
    otherLit - the LitLObject this one is to be compared to
  Returns:
    whether the given Object is equal to this one
  Overrides:
    equals in class Object

toString

     public String toString()

  This function returns the String that represents this LitLObject.

  Overrides:
    toString in class Object

parseString

     public void parseString(String input)

  This function should only be used on empty instances of a LitLObject. It will parse the given String and create the according Literal to be kept in this LitLObject.

  Parameters:
    input - The string to be parsed.
  Overrides:
    parseString in class Language

parse

     public static LitLObject parse(String s) throws IllegalArgumentException, ParseException

  This function can be used to parse a given String that represents a LitLObject. The syntax is as for a Literal.

  Throws: IllegalArgumentException
    An exception will occur if the supplied String is empty or null.
  Throws: ParseException
    An exception can occur if parsing failed. Potential reasons include a syntax error or an I/O problem.

parse

     public static LitLObject parse(InputStream ist) throws IllegalArgumentException, IOException, ParseException

  This function can be used to parse a given InputStream that represents a Literal. The syntax is as for a Literal.

    All Packages  Class Hierarchy  This Package  Previous  Next  Index