com.meyling.principia.logic.basic
Class BasicFormulaPatternVariable
java.lang.Object
|
+--com.meyling.principia.argument.AbstractArgument
|
+--com.meyling.principia.argument.PatternVariable
|
+--com.meyling.principia.logic.basic.BasicPatternVariable
|
+--com.meyling.principia.logic.basic.BasicFormulaPatternVariable
- All Implemented Interfaces:
- Argument, CounterMarker, Formula
- public class BasicFormulaPatternVariable
- extends BasicPatternVariable
- implements Formula
Pattern variable, for matching purposes.
- Version:
- $Revision 0.00.50$
- Author:
- Michael Meyling
| Methods inherited from class com.meyling.principia.argument.AbstractArgument |
equals, getHighestNumber, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches |
| Methods inherited from interface com.meyling.principia.argument.Argument |
containsPatternVariables, copy, equals, getArgument, getArgumentSize, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches, toString |
number
private final Counter number
- number of pattern variable
argument
private Argument argument
- assignment of pattern variable
BasicFormulaPatternVariable
public BasicFormulaPatternVariable(Argument[] arguments)
throws ArgumentException
- Constructs a pattern variable.
- Parameters:
arguments - first argument is number of this pattern
variable- Throws:
ArgumentException - if there is not exactly one
argument that is an instance of Counter
getPartFormulaSize
public final int getPartFormulaSize()
- Description copied from interface:
Formula
- Get the number of part formulas that this formula contains.
- Specified by:
getPartFormulaSize in interface Formula
- Returns:
- always 0
getPartFormula
public final Formula getPartFormula(int i)
throws IllegalArgumentException
- Description copied from interface:
Formula
- Get the requested part formula
- Specified by:
getPartFormula in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Parameters:
i - number of part formula (starting with 0)- Returns:
i-th part formula- Throws:
IllegalArgumentException - if i is not inbetween
0 and Formula.getPartFormulaSize() - 1
getFreeSubjectVariables
public final SubjectVariables getFreeSubjectVariables()
- Description copied from interface:
Formula
- Get all free subject variables.
- Specified by:
getFreeSubjectVariables in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Returns:
- all free subject variables
getBoundSubjectVariables
public final SubjectVariables getBoundSubjectVariables()
- Description copied from interface:
Formula
- Get all bounded subject variables.
- Specified by:
getBoundSubjectVariables in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Returns:
- all bounded subject variables
getSubjectVariables
public final SubjectVariables getSubjectVariables()
- Description copied from interface:
Formula
- Get all subject variables that occur in this formula.
- Specified by:
getSubjectVariables in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Returns:
- all subject variables
getPatternVariables
public final PatternVariables getPatternVariables()
- Description copied from interface:
Argument
- Get all pattern variables that occur in this argument.
- Specified by:
getPatternVariables in interface Argument- Overrides:
getPatternVariables in class AbstractArgument
- Following copied from interface:
com.meyling.principia.argument.Argument
- Returns:
- all pattern variables
isMatching
public boolean isMatching(Argument argument)
- Is the argument matching the pattern variable?
Here always true is returned.
- Overrides:
isMatching in class PatternVariable
- Parameters:
argument - argument to match pattern variable- Returns:
true
replaceBoundSubjectVariable
public final Formula replaceBoundSubjectVariable(Enumerator counter,
int occurance,
SubjectVariable search,
SubjectVariable replacement)
- Description copied from interface:
Formula
- Replace the
occurrence-th occurence of a bound
SubjectVariable by another one.
- Specified by:
replaceBoundSubjectVariable in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Parameters:
counter - number of matches so faroccurrence - number of matches to act onsearch - subject variable to look forreplacement - replacement subject variable- Returns:
- replaced formula
- Throws:
ArgumentException - if creating replacement failed
replaceBoundSubjectVariables
public final Formula replaceBoundSubjectVariables(Enumerator counter)
- Description copied from interface:
Formula
- Replace every bound SubjectVariable by a
BasicSubjectVariablePatternVariable
- Specified by:
replaceBoundSubjectVariables in interface Formula
- Following copied from interface:
com.meyling.principia.logic.basic.Formula
- Parameters:
counter - contains starting number for
replacement pattern variable, is increased
after one complete replacement- Throws:
ArgumentException -
create
public final Argument create(Argument[] arguments)
throws ArgumentException
- Description copied from interface:
Argument
- Create a new Argument with given arguments.
- Specified by:
create in interface Argument- Overrides:
create in class BasicPatternVariable
- Following copied from interface:
com.meyling.principia.argument.Argument
- Parameters:
arguments - with these arguments the operator should
be created- Returns:
- new constructed Argument
- Throws:
ArgumentException - if creation failed