This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
magik-demo:developer:class:core:atom [2013/07/18 14:17] alex [parseAtoms] |
magik-demo:developer:class:core:atom [2017/07/06 15:24] (current) |
||
|---|---|---|---|
| Line 5: | Line 5: | ||
| Class for the definition an Atom. Atom managing all the functions for atoms.\\ | Class for the definition an Atom. Atom managing all the functions for atoms.\\ | ||
| + | |||
| + | {{ :magik-demo:developer:schema2.png?nolink&600 |}} | ||
| + | |||
| ===== Class Attributes ===== | ===== Class Attributes ===== | ||
| Line 14: | Line 17: | ||
| </code> | </code> | ||
| - | ===== Class Constructor ===== | + | ===== Class Constructors ===== |
| ==== Atom ==== | ==== Atom ==== | ||
| Line 186: | Line 189: | ||
| ---- | ---- | ||
| - | ==== isVariable ==== | + | |
| + | ==== getArity ==== | ||
| <code java> | <code java> | ||
| - | public static boolean isVariable () | + | public int getArity () |
| </code> | </code> | ||
| - | Check if the term is a variable.\\ | + | |
| + | Calculate the arity of the atom | ||
| **Returns:** | **Returns:** | ||
| - | * //true//, if the term is a variable, //false// otherwise | + | * arity of the atom |
| ---- | ---- | ||
| - | ==== isConstant ==== | + | ==== getConstants ==== |
| <code java> | <code java> | ||
| - | public static boolean isConstant () | + | public java.util.ArrayList<Term> getConstants() |
| </code> | </code> | ||
| - | Check if the term is a constant.\\ | + | |
| + | Gives all constants that occur in the atom | ||
| **Returns:** | **Returns:** | ||
| - | * //true//, if the term is a constant, //false// otherwise | + | * 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|Back to Top]] | [[magik-demo:start|Back to Home Page]] | ||