Hilbert II - JAVA-Packages - Principia Mathematica II

com.meyling.principia.argument
Interface Argument

All Known Subinterfaces:
CounterMarker, Formula, Labeled, ParagraphCheck, Rule, SubjectVariableMarker, Textable
All Known Implementing Classes:
Abbreviation, AbstractArgument, AbstractArgumentAtom, AbstractArgumentList, AbstractDynamicArgumentList, AbstractFormula, AddAxiom, AddSentence, ApplyAxiom, ApplySentence, Author, AuthorList, Axiom, BasicFormulaPatternVariable, BasicPatternVariable, BasicPredicateVariablePatternVariable, BasicSubjectVariablePatternVariable, ConjunctionRule, Counter, Description, ElementaryEquivalence, Email, Generalization, Header, Headline, HypotheticalSyllogism, Import, ImportList, LeftAddition, LeftAdditionConjunction, LeftAdditionEquivalence, LeftAdditionImplication, LinkLabel, LinkReference, Location, LocationList, LogicalOperatorWithTwoFormulas, Module, ModusPonens, Name, Negation, Paragraph, ParagraphList, Particularization, PatternVariable, PredicateVariable, ProofLine, ProofLineList, Proposition, PropositionVariable, Quantifier, RegularArgumentList, RenameBoundSubjectVariable, RenameFreeSubjectVariable, ReplacePredicateVariable, ReplacePropositionVariable, ReverseAbbreviation, ReverseImplication, RightAddition, RightAdditionConjunction, RightAdditionEquivalence, RightAdditionImplication, RuleDeclaration, Sentence, Specification, SubjectVariable, SubstLine, Text, UseAbbreviation, UsedbyList, VariableList, Version

public interface Argument

Every Operator must implement this interface. Each operator deals with arguments. These arguments form an ordered list. So there is the number of arguments, which is told by getArgumentSize() and the i-th argument, accessible by getArgument(int).

Version:
$Revision: 1.6 $
Author:
Michael Meyling

Method Summary
 boolean containsPatternVariables()
          Does this argument contain any PatternVariable?
 Argument copy()
          Returns an identical object (maybe "this").
 Argument create(Argument[] arguments)
          Create a new Argument with given arguments.
 boolean equals(Object object)
          Is this object equal to the given one?
 Argument getArgument(int i)
          Get the requested argument.
 int getArgumentSize()
          Get the number of arguments.
 PatternVariables getPatternVariables()
          Get all pattern variables that occur in this argument.
 void getReplacementParents(Enumerator counter, int occurence, Argument searchPattern, Argument replacementPattern)
          Get a children parents list for the occurrence-th occurence of searchPattern replaced by replacementPattern.
 void getSearchParents(Enumerator counter, int occurence, Argument searchPattern)
          Get a children parents list for the occurrence-th occurence of searchPattern.
 int hashCode()
          Calculates the hashcode.
 boolean matches(Argument pattern)
          Does any part of this argument match the pattern?
 boolean matches(Argument pattern, PatternVariables variables)
          Does this argument match the pattern?
 Argument replace(Argument search, Argument replacement)
          Creates and returns a copy of this object, but replaces anything that equals(java.lang.Object) argument with a copy() of replacement.
 Argument replace(Enumerator counter, int occurrence, Argument searchPattern, Argument replacePattern)
          Replace the occurrence-th occurence of searchPattern with replacePattern.
 Argument replace(PatternVariables variables)
          Replace every pattern variable that occurs in variables with its content.
 Argument replaceMatches(Argument searchPattern, Argument replacePattern)
          Replace all occurrences of searchPattern with replacePattern.
 String toString()
          Get the argument in String form.
 

Method Detail

getArgumentSize

public int getArgumentSize()
Get the number of arguments.

Returns:
number of arguments

getArgument

public Argument getArgument(int i)
                     throws IllegalArgumentException
Get the requested argument.

Parameters:
i - number of argument (starting with 0)
Returns:
i-th part formula
Throws:
IllegalArgumentException - if i is not inbetween 0 and getArgumentSize() - 1

equals

public boolean equals(Object object)
Is this object equal to the given one? This is true iff object is an instance of Argument and both arguments have the same getArgumentSize() and each getArgument(int) equals(java.lang.Object).

Parameters:
object - to compare with
Returns:
is object equal to this one?

hashCode

public int hashCode()
Calculates the hashcode. Returns the hashcode of the representing string.

Returns:
hashcode of this object

copy

public Argument copy()
Returns an identical object (maybe "this").

Returns:
copy of this object

replace

public Argument replace(Argument search,
                        Argument replacement)
                 throws ArgumentException
Creates and returns a copy of this object, but replaces anything that equals(java.lang.Object) argument with a copy() of replacement.

Parameters:
search - check for occurrence of this
replacement - replace with this
Returns:
copy with replacements
Throws:
ArgumentException - if creation failed

replace

public Argument replace(PatternVariables variables)
                 throws ArgumentException
Replace every pattern variable that occurs in variables with its content.

Parameters:
variables - List of (filled) pattern variables
Returns:
argument, where all pattern variables (in variables) are replaced with its content
Throws:
ArgumentException - if creation failed

replace

public Argument replace(Enumerator counter,
                        int occurrence,
                        Argument searchPattern,
                        Argument replacePattern)
                 throws ArgumentException
Replace the occurrence-th occurence of searchPattern with replacePattern.

Parameters:
counter - number of matches so far
occurrence - number of matches to act on
searchPattern - pattern for matching
replacePattern - pattern for replacing matched pattern with
Returns:
replaced argument
Throws:
ArgumentException - if creation failed

getSearchParents

public void getSearchParents(Enumerator counter,
                             int occurence,
                             Argument searchPattern)
                      throws FoundException
Get a children parents list for the occurrence-th occurence of searchPattern.

Parameters:
counter - number of matches so far
searchPattern - pattern for matching
Throws:
FoundException - if creation succeded

getReplacementParents

public void getReplacementParents(Enumerator counter,
                                  int occurence,
                                  Argument searchPattern,
                                  Argument replacementPattern)
                           throws FoundException,
                                  ArgumentException
Get a children parents list for the occurrence-th occurence of searchPattern replaced by replacementPattern.

Parameters:
counter - number of matches so far
searchPattern - pattern for matching
replacementPattern - replacement pattern
Throws:
FoundException - if creation succeded
ArgumentException

replaceMatches

public Argument replaceMatches(Argument searchPattern,
                               Argument replacePattern)
                        throws ArgumentException
Replace all occurrences of searchPattern with replacePattern.

Parameters:
searchPattern - pattern for matching
replacePattern - pattern for replacing matched pattern with
Returns:
replaced argument
Throws:
ArgumentException - if creation failed

matches

public boolean matches(Argument pattern,
                       PatternVariables variables)
Does this argument match the pattern? For example: "A1 n A1" matches the pattern "@0 n @1" with resulting variables . Be carefull, after an unsuccessful matching, some pattern variables could have been found, so variables might contain some filled pattern variables.

Parameters:
pattern - argument build of pattern variables
variables - already known pattern variables
Returns:
successfull matching

matches

public boolean matches(Argument pattern)
Does any part of this argument match the pattern? For example: "A1 n A1" matches the pattern "@0 n @1", "A1 v A2 matches the pattern "A2".

Parameters:
pattern - argument build of pattern variables
Returns:
successfull matching somewhere

containsPatternVariables

public boolean containsPatternVariables()
Does this argument contain any PatternVariable?

Returns:
does one part of this argument is an PatternVariable

getPatternVariables

public PatternVariables getPatternVariables()
Get all pattern variables that occur in this argument.

Returns:
all pattern variables

create

public Argument create(Argument[] arguments)
                throws ArgumentException
Create a new Argument with given arguments.

Parameters:
arguments - with these arguments the operator should be created
Returns:
new constructed Argument
Throws:
ArgumentException - if creation failed

toString

public String toString()
Get the argument in String form.

Returns:
readable formula

Hilbert II - JAVA-Packages - Principia Mathematica II

©left GNU General Public Licence
All Rights Reserved.