jildt
Class Functions

java.lang.Object
  extended by jildt.Functions

public class Functions
extends java.lang.Object

Class that implements generic functions for being used in different internal actions.

Author:
Carlos Alberto González-Alarcón, Alejandro Guerra-Hernández, Francisco Grimaldo-Moreno

Constructor Summary
Functions()
           
 
Method Summary
static java.lang.String agentName(jason.asSemantics.Agent ag)
          Gets the name of an agent.
static jason.asSyntax.Term cleanTerm(jason.asSyntax.Term query)
          Cleans a Term from anonymous variables to variables. e.g., if the term clear(_89X), is given, the function will return the term clear(X).
static void collectBoundedVars(jason.asSyntax.Term Qn, java.util.HashSet<jason.asSyntax.Term> vars)
          Find the bounded variables in a query.
static java.lang.String getNewVar(java.util.HashSet<jason.asSyntax.Term> used)
          Selects a new variable.
static jason.bb.DefaultBeliefBase joinBB(jason.asSyntax.ListTerm beliefs, java.util.ArrayList<jason.asSyntax.Term> background)
          Joins a belief base (ListTerm) and a background belief base.
static boolean logicalConsequence(jason.asSyntax.LogicalFormula form, jason.bb.BeliefBase bb)
          Asks if a formula is logical consequence of a belief base plus a background belief base.
static jason.asSyntax.LogicalFormula parseConjCtxt(jason.asSyntax.ListTerm terms)
          Parses a ListTerm to a conjunctive logical formula.
static jason.asSyntax.LogicalFormula parseDisyCtxt(jason.asSyntax.ListTerm terms)
          Parses a ListTerm to a disjunctive logical formula.
static java.util.logging.Level traceLevel(Learner agent)
          Specify the logging level for tracing, accordingly the agent attribute for trace.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Functions

public Functions()
Method Detail

cleanTerm

public static jason.asSyntax.Term cleanTerm(jason.asSyntax.Term query)
Cleans a Term from anonymous variables to variables. e.g., if the term clear(_89X), is given, the function will return the term clear(X).

Parameters:
query - The term to be cleaned.
Returns:
A cleaned term.

agentName

public static java.lang.String agentName(jason.asSemantics.Agent ag)
Gets the name of an agent.

Parameters:
ag - The agent.
Returns:
A String with the agent name.

parseConjCtxt

public static jason.asSyntax.LogicalFormula parseConjCtxt(jason.asSyntax.ListTerm terms)
                                                   throws jason.asSyntax.parser.ParseException
Parses a ListTerm to a conjunctive logical formula.

Parameters:
terms - the ListTerm to be parsed.
Returns:
A logical formula with operator and.
Throws:
jason.asSyntax.parser.ParseException

parseDisyCtxt

public static jason.asSyntax.LogicalFormula parseDisyCtxt(jason.asSyntax.ListTerm terms)
                                                   throws jason.asSyntax.parser.ParseException
Parses a ListTerm to a disjunctive logical formula.

Parameters:
terms - the ListTerm to be parsed.
Returns:
A logical formula with operator or.
Throws:
jason.asSyntax.parser.ParseException

joinBB

public static jason.bb.DefaultBeliefBase joinBB(jason.asSyntax.ListTerm beliefs,
                                                java.util.ArrayList<jason.asSyntax.Term> background)
Joins a belief base (ListTerm) and a background belief base.

Parameters:
beliefs - The belief base
background - The background belief base
Returns:
A joined belief base.

logicalConsequence

public static boolean logicalConsequence(jason.asSyntax.LogicalFormula form,
                                         jason.bb.BeliefBase bb)
Asks if a formula is logical consequence of a belief base plus a background belief base.

Parameters:
form - The logical formula to be tested.
bb - The belief base the formula will be evaluated for.
Returns:
True if the formula is logical consequence. False otherwise.

collectBoundedVars

public static void collectBoundedVars(jason.asSyntax.Term Qn,
                                      java.util.HashSet<jason.asSyntax.Term> vars)
                               throws jason.asSyntax.parser.ParseException
Find the bounded variables in a query.

Parameters:
Qn - The nth element of a query Q.
vars - A set to store the vars found.
Throws:
jason.asSyntax.parser.ParseException

getNewVar

public static java.lang.String getNewVar(java.util.HashSet<jason.asSyntax.Term> used)
Selects a new variable.

Parameters:
used - A set with the variables that cannot be used.
Returns:
A new variable that does not belong to vars.

traceLevel

public static java.util.logging.Level traceLevel(Learner agent)
Specify the logging level for tracing, accordingly the agent attribute for trace.

Parameters:
agent - The agent that knows if an internal action is traceable.
Returns:
A logging level.