    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class JavaAgent.resource.fopl.FOPLFormula

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

public class FOPLFormula
extends Language
implements Parsable, KRSentence

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

See Also:
  Language, Formula

##

theForm
  The Formula contained in this FOPLFormula.

##

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

##

clone()
  This function generates a copy of this FOPLFormula.
clone(Substitution)
  Returns a copy of this Formula with Variables replaced according to the given Substitution.
equals(Object)
  This function tests whether this and the given Object are equal.
getConclusion()
  This function returns the conclusion of this implication.
getConjunction(Vector)
  This function returns a FOPLFormula that represents a conjunction of the KRSentences in the given Vector.
getFormula()
  This function returns the Formula embedded in this FOPLFormula.
getKBClass()
  This function returns the Class that implements KnowledgeBase for this KRSentence Class.
getPremise()
  This function returns the premise of this implication.
parse(InputStream)
  This function can be used to parse a given InputStream that represents a Formula.
parse(String)
  This function can be used to parse a given String that represents a FOPLFormula.
parseString(String)
  This function should only be used on empty instances of a FOPLFormula.
toString()
  This function returns the String that represents this FOPLFormula.

##

theForm

     protected Formula theForm

  The Formula contained in this FOPLFormula.

##

FOPLFormula

     public FOPLFormula()

  This constructor creates an empty instance of a FOPLFormula.

FOPLFormula

     public FOPLFormula(String input) throws ParseException

  This constructor for a FOPLFormula parses the given String and creates the according Formula.

  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 FOPLFormula. The copy will contain a clone of the Formula contained in this one.

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

clone

     public FOPLFormula clone(Substitution s) throws IllegalArgumentException

  Returns a copy of this Formula 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 Formula 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 Formula.

  Parameters:
    s - the Substitution that tells us how to replace Variables
  Returns:
    a new FOPLFormula that is an instance of this FOPLFormula; 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.

getFormula

     protected Formula getFormula()

  This function returns the Formula embedded in this FOPLFormula.

  Returns:
    the Formula embedded in this FOPLFormula

equals

     public boolean equals(Object otherForm)

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

  Parameters:
    otherForm - the FOPLFormula 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 FOPLFormula.

  Overrides:
    toString in class Object

getConjunction

     public static KRSentence getConjunction(Vector conjuncts)

  This function returns a FOPLFormula that represents a conjunction of the KRSentences in the given Vector.

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

getKBClass

     public static Class getKBClass()

  This function returns the Class that implements KnowledgeBase for this KRSentence Class.

getPremise

     public FOPLFormula getPremise()

  This function returns the premise of this implication.

getConclusion

     public FOPLFormula getConclusion()

  This function returns the conclusion of this implication.

parseString

     public void parseString(String input)

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

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

parse

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

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

  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 FOPLFormula parse(InputStream ist) throws IllegalArgumentException, IOException, ParseException

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

    All Packages  Class Hierarchy  This Package  Previous  Next  Index