User Tools

Site Tools


magik-demo:developer:class:core:atom

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

====== Atom ====== ''**public class Atom**'' \\ ''**implements Serializable, Clonable, Comparable<Atom>**''\\ Class for the definition an Atom. Atom managing all the functions for atoms.\\ {{ :magik-demo:developer:schema2.png?nolink&600 |}} ===== Class Attributes ===== <code java> private long atomId private java.lang.String atomName private java.util.ArrayList<Term> terms </code> ===== Class Constructor ===== ==== Atom ==== <code java> public Atom (java.lang.String atomName, java.util.Arraylist<Term> terms) </code> 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 ==== <code java> public Atom (java.lang.String atomDef) </code> 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 ==== <code java> public static Atom applySubstiution (Atom atom, java.util.HashMap<Term,Term> substitution) </code> Apply to an atom some substitutions.\\ **Parameters:** * atom - original atom * substitution - terms that has to be substitute **Returns:** * atom with substitutions ---- ==== freeze ==== <code java> static Atom freeze (Atom atom, java.util.ArrayList<Term> freezingVars, boolean semantics) </code> **Parameters:** * atom - original atom * freezingVars - terms that has to be freezed * semantics - **Returns:** * atom with some freezed terms ---- ==== freeze ==== <code java> static Atom freeze (Atom atom, java.util.ArrayList<Term> freezingVars) </code> **Parameters:** * atom - original atom * freezingVars - terms that has to be freezed **Returns:** * atom with some freezed terms ---- ==== groundAtom ==== <code java> static Atom groundAtom (Atom A) </code> Generate the ground version of an atom **Parameters:** * A - atom **Returns:** * grounded version of the atom A ---- ==== iterateAtom ==== <code java> public Atom iterateAtom (Atom atom, java.util.ArrayList<Term> distinguised, ILambda<Term,Term> changeDist, ILambda<Term,Term> changeOther) </code> **Parameters:** * atom - atom that we want to iterate * distinguised - * changeDist - * changeOther - **Returns:** * iterated atom ---- ==== parseAtom ==== <code java> public Atom parseAtom (java.lang.String atomDef) </code> Create the Atom type from a string version of it **Parameters:** * atomDef - string definition of an atom **Returns:** * atom converted in Atom type ---- ==== parseAtoms ==== <code java> public static java.util.ArrayList<Atom> parseAtoms (java.util.ArrayList<java.lang.String> arrAtomStr) throws ContextException </code> 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 ==== <code java> public static java.util.ArrayList<Atom> parseAtoms (java.lang.String Atoms) throws ContextException </code> 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 ==== <code java> public int getArity () </code> Calculate the arity of the atom **Returns:** * arity of the atom ---- ==== getConstants ==== <code java> public java.util.ArrayList<Term> getConstants() </code> Gives all constants that occur in the atom **Returns:** * list of the constants ---- ==== getVariables ==== <code java> public java.util.ArrayList<Term> getVariables() </code> Gives all variables that occur in the atom **Returns:** * list of the variables ---- ==== isContainingTerm ==== <code java> public static boolean isContainingTerm (Term term) </code> 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 ==== <code java> public void replaceTerm(java.lang.String oldTerm, java.lang.String newTerm) </code> 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 ==== <code java> @Override public Object clone () </code> **Returns:** * cloned object (Atom type) ---- ==== equals ==== <code java> @Override public boolean equals (Object o) </code> Implementation for checking the equality for Atom **Returns:** * //true// if equal, //false// otherwise ---- ==== toString ==== <code java> @Override public String toString () </code> Implementation for converting in String format Atom. **Returns:** * String version of the atom ---- ==== getters and setters methods ==== <code java> 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) </code>

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