Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Hilbert II - JAVA-Packages - Principia Mathematica II
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.meyling.principia.argument
Class AbstractArgument

    java.lang.Object
      com.meyling.principia.argument.AbstractArgument

All Implemented Interfaces:
  Argument

Direct Known Subclasses:
  AbstractArgumentAtom, AbstractArgumentList, AbstractDynamicArgumentList, PatternVariable

public abstract class AbstractArgument
extends Object
implements Argument

Every Operator must inherit from this class. Its main function is to provide the standard implemention of `equals(java.lang.Object)`, `matches(com.meyling.principia.argument.Argument, com.meyling.principia.argument.PatternVariables)` and `hashCode()`.

Version:
  $Revision: 1.8 $
Author:
  Michael Meyling

Constructor Summary
`AbstractArgument()`

Method Summary
`boolean` | `containsPatternVariables()` Does this argument contain any PatternVariable?
`abstract Argument` | `create(Argument[] arguments)` Create a new Argument with given arguments.
`boolean` | `equals(Object object)` Is this object equal to the given one?
`abstract Argument` | `getArgument(int i)` Get the requested argument.
`abstract int` | `getArgumentSize()` Get the number of arguments.
`static int` | `getHighestNumber(Argument argument)` Find the highest value for a `Counter` in this argument.
`PatternVariables` | `getPatternVariables()` Get all pattern variables that occur in this argument.
`void` | `getReplacementParents(Enumerator counter, int occurance, Argument searchPattern, Argument replacePattern)` Get a children parents list for the `occurrence`-th occurence of `searchPattern` replaced by `replacementPattern`.
`void` | `getSearchParents(Enumerator counter, int occurance, 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 `Argument.copy()` of `replacement`.
`Argument` | `replace(Enumerator counter, int occurance, 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`.
`abstract String` | `toString()` Get the argument in `String` form.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Methods inherited from interface com.meyling.principia.argument.Argument
`copy`

Constructor Detail

### AbstractArgument

    public AbstractArgument()

Method Detail

### getArgumentSize

    public abstract int getArgumentSize()

  Description copied from interface: `Argument`
  Get the number of arguments.

  Specified by:
    `getArgumentSize` in interface `Argument`
  Returns:
    number of arguments

### getArgument

    public abstract Argument getArgument(int i)
                                  throws IllegalArgumentException

  Description copied from interface: `Argument`
  Get the requested argument.

  Specified by:
    `getArgument` in interface `Argument`
  Parameters:
    `i` - number of argument (starting with `0`)
  Returns:
    `i`-th part formula
  Throws:
    `IllegalArgumentException` - if `i` is not inbetween `0` and ``Argument.getArgumentSize()` - 1`

### equals

    public boolean equals(Object object)

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

  Specified by:
    `equals` in interface `Argument`

### hashCode

    public int hashCode()

  Description copied from interface: `Argument`
  Calculates the hashcode. Returns the hashcode of the representing string.

  Specified by:
    `hashCode` in interface `Argument`

### replace

    public final Argument replace(Argument search,
                                  Argument replacement)
                           throws ArgumentException

  Description copied from interface: `Argument`
  Creates and returns a copy of this object, but replaces anything that `Argument.equals(java.lang.Object)` `argument` with a `Argument.copy()` of `replacement`.

  Specified by:
    `replace` in interface `Argument`
  Parameters:
    `search` - check for occurrence of this
    `replacement` - replace with this
  Returns:
    copy with replacements
  Throws:
    `ArgumentException` - if creation failed

### replace

    public final Argument replace(PatternVariables variables)
                           throws ArgumentException

  Description copied from interface: `Argument`
  Replace every pattern variable that occurs in `variables` with its content.

  Specified by:
    `replace` in interface `Argument`
  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 final Argument replace(Enumerator counter,
                                  int occurance,
                                  Argument searchPattern,
                                  Argument replacePattern)
                           throws ArgumentException

  Description copied from interface: `Argument`
  Replace the `occurrence`-th occurence of `searchPattern` with `replacePattern`.

  Specified by:
    `replace` in interface `Argument`
  Parameters:
    `counter` - number of matches so far
    `occurance` - 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 final void getSearchParents(Enumerator counter,
                                       int occurance,
                                       Argument searchPattern)
                                throws FoundException

  Description copied from interface: `Argument`
  Get a children parents list for the `occurrence`-th occurence of `searchPattern`.

  Specified by:
    `getSearchParents` in interface `Argument`
  Parameters:
    `counter` - number of matches so far
    `searchPattern` - pattern for matching
  Throws:
    `FoundException` - if creation succeded

### getReplacementParents

    public final void getReplacementParents(Enumerator counter,
                                            int occurance,
                                            Argument searchPattern,
                                            Argument replacePattern)
                                     throws FoundException,
                                            ArgumentException

  Description copied from interface: `Argument`
  Get a children parents list for the `occurrence`-th occurence of `searchPattern` replaced by `replacementPattern`.

  Specified by:
    `getReplacementParents` in interface `Argument`
  Parameters:
    `counter` - number of matches so far
    `searchPattern` - pattern for matching
    `replacePattern` - replacement pattern
  Throws:
    `FoundException` - if creation succeded
    `ArgumentException`

### replaceMatches

    public final Argument replaceMatches(Argument searchPattern,
                                         Argument replacePattern)
                                  throws ArgumentException

  Description copied from interface: `Argument`
  Replace all occurrences of `searchPattern` with `replacePattern`.

  Specified by:
    `replaceMatches` in interface `Argument`
  Parameters:
    `searchPattern` - pattern for matching
    `replacePattern` - pattern for replacing matched pattern with
  Returns:
    replaced argument
  Throws:
    `ArgumentException` - if creation failed

### matches

    public final boolean matches(Argument pattern,
                                 PatternVariables variables)
                          throws IllegalArgumentException

  Description copied from interface: `Argument`
  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.

  Specified by:
    `matches` in interface `Argument`
  Parameters:
    `pattern` - argument build of pattern variables
    `variables` - already known pattern variables
  Returns:
    successfull matching
  Throws:
    `IllegalArgumentException`

### matches

    public final boolean matches(Argument pattern)

  Description copied from interface: `Argument`
  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".

  Specified by:
    `matches` in interface `Argument`
  Parameters:
    `pattern` - argument build of pattern variables
  Returns:
    successfull matching somewhere

### containsPatternVariables

    public boolean containsPatternVariables()

  Description copied from interface: `Argument`
  Does this argument contain any PatternVariable?

  Specified by:
    `containsPatternVariables` in interface `Argument`
  Returns:
    this standard implementation returns always false

### getPatternVariables

    public PatternVariables getPatternVariables()

  Description copied from interface: `Argument`
  Get all pattern variables that occur in this argument.

  Specified by:
    `getPatternVariables` in interface `Argument`
  Returns:
    all pattern variables

### create

    public abstract Argument create(Argument[] arguments)
                             throws ArgumentException

  Description copied from interface: `Argument`
  Create a new Argument with given arguments.

  Specified by:
    `create` in interface `Argument`
  Parameters:
    `arguments` - with these arguments the operator should be created
  Returns:
    new constructed Argument
  Throws:
    `ArgumentException` - if creation failed

### toString

    public abstract String toString()

  Description copied from interface: `Argument`
  Get the argument in `String` form.

  Specified by:
    `toString` in interface `Argument`

### getHighestNumber

    public static final int getHighestNumber(Argument argument)
                                      throws ArgumentException

  Find the highest value for a `Counter` in this argument.

  Parameters:
    `argument` - search this argument
  Returns:
    maximum
  Throws:
    `ArgumentException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Hilbert II - JAVA-Packages - Principia Mathematica II
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

©left GNU General Public Licence All Rights Reserved.