User Tools

Site Tools


magik-demo:developer:class:core:atom

Atom

public class Atom
implements Serializable, Clonable, Comparable<Atom>

Class for the definition an Atom. Atom managing all the functions for atoms.

Class Attributes

private long atomId
private java.lang.String atomName
private java.util.ArrayList<Term> terms

Class Constructors

Atom

public Atom (java.lang.String atomName,
             java.util.Arraylist<Term> terms)

Constructor for an atom with terms.

Called by:

  • it.unibz.inf.magik.web.SessionControl
  • it.unibz.inf.magik.core.QueryMinimizer
  • it.unibz.inf.magik.additional.InvolvedVariableDetector
  • it.unibz.inf.magik.core.ProgramGenerator
  • it.unibz.inf.magik.core.Preprocessor
  • it.unibz.inf.magik.test.TestAtomClass
  • it.unibz.inf.magik.test.TestTCQCReasonerBlackWhiteExample
  • it.unibz.inf.magik.test.TestTCQCReasonerPlainCompanyEx
  • it.unibz.inf.magik.test.TestTCQCReasonerPlainSchoolEx
  • it.unibz.inf.magik.test.TestTermClass

Parameters:

  • atomName - name of the atom
  • terms - list of terms involved in the atom

Atom

public Atom (java.lang.String atomDef)

Constructor for an atom starting from the string version of the atom.

Called by:

  • it.unibz.inf.magik.core.ProgramGenerator
  • it.unibz.inf.magik.test.TestAtomClass
  • it.unibz.inf.magik.test.UnificationTest

Parameters:

  • atomDef - a string that contains a definition of an atom

Class Methods

applySubstitution

public static Atom applySubstiution (Atom atom, 
                                     java.util.HashMap<Term,Term> substitution) 

Apply to an atom some substitutions.
Parameters:

  • atom - original atom
  • substitution - terms that has to be substitute

Returns:

  • atom with substitutions

freeze

static Atom freeze (Atom atom, 
                    java.util.ArrayList<Term> freezingVars,
                    boolean semantics) 

Parameters:

  • atom - original atom
  • freezingVars - terms that has to be freezed
  • semantics -

Returns:

  • atom with some freezed terms

freeze

static Atom freeze (Atom atom, 
                    java.util.ArrayList<Term> freezingVars) 

Parameters:

  • atom - original atom
  • freezingVars - terms that has to be freezed

Returns:

  • atom with some freezed terms

groundAtom

static Atom groundAtom (Atom A) 

Generate the ground version of an atom

Parameters:

  • A - atom

Returns:

  • grounded version of the atom A

iterateAtom

public Atom iterateAtom (Atom atom,
                         java.util.ArrayList<Term> distinguised,
                         ILambda<Term,Term> changeDist,
                         ILambda<Term,Term> changeOther) 

Parameters:

  • atom - atom that we want to iterate
  • distinguised -
  • changeDist -
  • changeOther -

Returns:

  • iterated atom

parseAtom

public Atom parseAtom (java.lang.String atomDef) 

Create the Atom type from a string version of it

Parameters:

  • atomDef - string definition of an atom

Returns:

  • atom converted in Atom type

parseAtoms

public static java.util.ArrayList<Atom> parseAtoms (java.util.ArrayList<java.lang.String> arrAtomStr)
                                    throws ContextException 

Create a list of Atom from a list of string definition of atoms (defined has: relation:attr1,attr2)

Parameters:

  • arrAtomStr - list of string definition of atom

Returns:

  • list of Atom

Throws:

  • ContextException

parseAtoms

public static java.util.ArrayList<Atom> parseAtoms (java.lang.String Atoms)
                                                 throws ContextException 

Parses the string contains list of atoms separated by comma (e.g.: classes(Level,Code,'humanities'), pupil(Name,Level,Code)) and create the respective Atom class

Parameters:

  • Atoms - list of string definition of atoms

Returns:

  • list of Atom

Throws:

  • ContextException

getArity

public int getArity () 

Calculate the arity of the atom

Returns:

  • arity of the atom

getConstants

public java.util.ArrayList<Term> getConstants() 

Gives all constants that occur in the atom

Returns:

  • list of the constants

getVariables

public java.util.ArrayList<Term> getVariables() 

Gives all variables that occur in the atom

Returns:

  • list of the variables

isContainingTerm

public static boolean isContainingTerm (Term term) 

Check if the Atom contains a term.

Parameters:

  • term - term that we want to find

Returns:

  • true, if the atom contains the term , false otherwise

replaceTerm

public void replaceTerm(java.lang.String oldTerm, 
                        java.lang.String newTerm)

Replace term with a new string (if old string is found in the atom).

Parameters:

  • oldTerm - the term that is candidated to be replace
  • newTerm - the new term

clone

@Override
public Object clone () 

Returns:

  • cloned object (Atom type)

equals

@Override
public boolean equals (Object o) 

Implementation for checking the equality for Atom

Returns:

  • true if equal, false otherwise

toString

@Override
public String toString () 

Implementation for converting in String format Atom.

Returns:

  • String version of the atom

getters and setters methods

public long getAtomId()
public void setAtomId(long atomId) 
 
public java.lang.String getAtomName() 
public void setAtomName(java.lang.StringString atomName) 
 
public java.util.StringArrayList<Term> getTerms() 
public void setTerms(java.util.ArrayList<Term> terms)

Back to Top | Back to Home Page

magik-demo/developer/class/core/atom.txt · Last modified: 2017/07/06 15:24 (external edit)