Hilbert II - JAVA-Packages - Principia Mathematica II

com.meyling.principia.module
Class Module

java.lang.Object
  extended bycom.meyling.principia.argument.AbstractArgument
      extended bycom.meyling.principia.argument.AbstractDynamicArgumentList
          extended bycom.meyling.principia.module.Module
All Implemented Interfaces:
Argument

public class Module
extends AbstractDynamicArgumentList
implements Argument

Main data object of this project. A Module is like an chapter of a mathematical textbook. It is organized in Paragraphs that could contain Abbreviations, Axioms or Propositions. It could reference to other Modules.

Version:
$Revision: 1.19 $
Author:
Michael Meyling

Constructor Summary
Module(Argument[] arguments)
          Constructs a module.
Module(Argument[] arguments, ModuleAddress moduleAddress)
          Constructs a module and verifies it.
 
Method Summary
 void addAbbreviation(String abbreviationLabel, Abbreviation abbreviation, Module module)
          Add abbreviation with label abbreviationLabel.
 void addAxiom(String axiomLabel, Axiom axiom, Module module)
          Add axiom with label axiomLabel.
 void addReferencedModule(Module module)
          Add referenced module.
 void addRuleDeclaration(String ruleLabel, RuleDeclaration declaration, Module module)
          Declare a new rule.
 void addSentence(String sentenceLabel, Sentence sentence, Module module)
          Add sentence with label sentenceLabel.
 void check()
          Verifies this module.
 void checkLabel(String label)
          Test if label is already known.
 Argument create(Argument[] arguments)
          Create a new Argument with given arguments.
 Abbreviation getAbbreviation(String abbreviationLabel)
          Get the abbreviation with label abbreviationLabel.
 Axiom getAxiom(String axiomLabel)
          Get the axiom with label axiomLabel.
 ImportList getImports()
          Get all imports of this module.
 Argument getLabeledArgument(String label)
          Get the sentence or axiom with label label.
 Formula getLabeledFormula(String label)
          Get the sentence or axiom formula with label label.
 Module getLabelModule(String label)
          Get module the label was defined in.
 Map getLabels()
          Get a map of all known labels.
 ModuleAddress getModuleAddress()
          Get the ModuleAddress where this module is from.
 String getModuleFileName()
          Get the full module name, with version and rule version, but without path.
 ParagraphList getParagraphs()
          Get all paragraphs of this module.
 Proposition[] getPropositions()
          Get all propositions of this module.
 Map getReferencedModules()
          Get a map of all referenced modules.
 RuleDeclaration getRuleDeclaration(Class rule)
          Get the declaration for a rule.
 RuleDeclaration getRuleDeclaration(String ruleLabel)
          Get the declaration for a rule.
 String getRuleDeclarationLabel(Class rule)
          Get the declaration for a rule.
 Version getRuleVersion()
          Get the rule version this module could use maximal.
 Sentence getSentence(String sentenceLabel)
          Get the sentence with label sentenceLabel.
 UsedbyList getUsedby()
          Get all usedby references of this module.
 boolean isRuleDeclared(Class rule)
          Is a certain rule declared?
 void setModuleAddress(ModuleAddress moduleAddress)
          Set the URL where this module is from.
 void setRuleVersion(Version version)
          Set the rule version this module could use maximal.
 String toString()
          Get the argument in String form.
 
Methods inherited from class com.meyling.principia.argument.AbstractDynamicArgumentList
add, copy, getArgument, getArgumentSize, insert, remove, replace
 
Methods inherited from class com.meyling.principia.argument.AbstractArgument
containsPatternVariables, equals, getHighestNumber, getPatternVariables, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.meyling.principia.argument.Argument
containsPatternVariables, copy, equals, getArgument, getArgumentSize, getPatternVariables, getReplacementParents, getSearchParents, hashCode, matches, matches, replace, replace, replace, replaceMatches
 

Constructor Detail

Module

public Module(Argument[] arguments)
       throws ArgumentException
Constructs a module. This is the default constructor, that is not used if one wants a proof verified module. To construct a checked module see the next constructor.

Parameters:
arguments - see ArgumentException below
Throws:
ArgumentException - if the arguments are not of the form Header, ImportList?, UsedbyList? and (in this order, the question marks mark arguments as optional).

Module

public Module(Argument[] arguments,
              ModuleAddress moduleAddress)
       throws ArgumentException,
              ParsingException
Constructs a module and verifies it.

Parameters:
arguments - see ArgumentException below
moduleAddress - the URL where the module was loaded from
Throws:
ArgumentException - if the arguments are not of the form Header, ImportList?, UsedbyList? and (in this order, the question marks mark arguments as optional). Also thrown if the module has any mathematical verification problem.
ParsingException - if ModuleContext.loadModule() failed
Method Detail

check

public void check()
           throws ArgumentException,
                  ParsingException
Verifies this module. The module must have an address.

Throws:
ArgumentException - the module has any mathematical verification problem.
ParsingException - ModuleContext.loadModule() failed

getAbbreviation

public final Abbreviation getAbbreviation(String abbreviationLabel)
                                   throws IllegalArgumentException
Get the abbreviation with label abbreviationLabel.

Parameters:
abbreviationLabel - reference to abbreviation
Returns:
abbreviation
Throws:
IllegalArgumentException - if such an abbreviation doesn't exist

addReferencedModule

public final void addReferencedModule(Module module)
                               throws IllegalArgumentException
Add referenced module.

Parameters:
module - module
Throws:
IllegalArgumentException - if such an label already exists

addAbbreviation

public final void addAbbreviation(String abbreviationLabel,
                                  Abbreviation abbreviation,
                                  Module module)
                           throws IllegalArgumentException
Add abbreviation with label abbreviationLabel.

Parameters:
abbreviationLabel - reference to abbreviation
abbreviation - abbreviation
Throws:
IllegalArgumentException - if such an label already exists

getAxiom

public final Axiom getAxiom(String axiomLabel)
                     throws IllegalArgumentException
Get the axiom with label axiomLabel.

Parameters:
axiomLabel - reference to axiom
Returns:
axiom
Throws:
IllegalArgumentException - if such an axiom doesn't exist

addAxiom

public final void addAxiom(String axiomLabel,
                           Axiom axiom,
                           Module module)
                    throws IllegalArgumentException
Add axiom with label axiomLabel.

Parameters:
axiomLabel - reference to axiom
axiom - axiom
Throws:
IllegalArgumentException - if such an label already exists

getSentence

public final Sentence getSentence(String sentenceLabel)
                           throws IllegalArgumentException
Get the sentence with label sentenceLabel.

Parameters:
sentenceLabel - reference to sentence
Returns:
sentence
Throws:
IllegalArgumentException - if such an sentence doesn't exist

addSentence

public final void addSentence(String sentenceLabel,
                              Sentence sentence,
                              Module module)
                       throws IllegalArgumentException
Add sentence with label sentenceLabel.

Parameters:
sentenceLabel - reference to sentence
sentence - sentence
Throws:
IllegalArgumentException - if such an label already exists

getRuleDeclaration

public final RuleDeclaration getRuleDeclaration(Class rule)
                                         throws IllegalArgumentException
Get the declaration for a rule.

Parameters:
rule - look for this rule class
Returns:
declaration for this rule
Throws:
IllegalArgumentException - if such a declaration doesn't exist

getRuleDeclaration

public final RuleDeclaration getRuleDeclaration(String ruleLabel)
                                         throws IllegalArgumentException
Get the declaration for a rule.

Parameters:
ruleLabel - look for this rule
Returns:
declaration for this rule
Throws:
IllegalArgumentException - if such a declaration doesn't exist

getRuleDeclarationLabel

public final String getRuleDeclarationLabel(Class rule)
                                     throws IllegalArgumentException
Get the declaration for a rule.

Parameters:
rule - look for this rule class
Returns:
label for this rule
Throws:
IllegalArgumentException - if such a declaration doesn't exist

isRuleDeclared

public final boolean isRuleDeclared(Class rule)
Is a certain rule declared?

Parameters:
rule - look for this rule class
Returns:
is this rule already declared?

addRuleDeclaration

public final void addRuleDeclaration(String ruleLabel,
                                     RuleDeclaration declaration,
                                     Module module)
                              throws IllegalArgumentException,
                                     ArgumentException
Declare a new rule.

Parameters:
ruleLabel - label of this rule
declaration - declaration of a rule
module - in this module the rule is declared
Throws:
ArgumentException - if the check failed
IllegalArgumentException - if such an label already exists

getLabeledFormula

public final Formula getLabeledFormula(String label)
                                throws IllegalArgumentException
Get the sentence or axiom formula with label label.

Parameters:
label - reference to an axiom or a proposition
Returns:
axiom or sentence formula
Throws:
IllegalArgumentException - if such an reference doesn't exist

getLabeledArgument

public final Argument getLabeledArgument(String label)
                                  throws IllegalArgumentException
Get the sentence or axiom with label label.

Parameters:
label - reference to an axiom or a proposition
Returns:
axiom or sentence
Throws:
IllegalArgumentException - if such an reference doesn't exist

checkLabel

public final void checkLabel(String label)
                      throws IllegalArgumentException
Test if label is already known.

Returns:
is this label undeclared
Throws:
IllegalArgumentException - if such an label already exists

getLabelModule

public final Module getLabelModule(String label)
                            throws IllegalArgumentException
Get module the label was defined in.

Parameters:
label - reference name to look for
Throws:
IllegalArgumentException - if such an label already exists

setModuleAddress

public final void setModuleAddress(ModuleAddress moduleAddress)
                            throws ArgumentException
Set the URL where this module is from.

Throws:
ArgumentException - if URL doesn't end how the specification says

getModuleFileName

public final String getModuleFileName()
Get the full module name, with version and rule version, but without path.

Returns:
name of this module

getModuleAddress

public final ModuleAddress getModuleAddress()
Get the ModuleAddress where this module is from.

Returns:
address of this module

getLabels

public final Map getLabels()
Get a map of all known labels.

Returns:
known labels of this module

getImports

public final ImportList getImports()
Get all imports of this module.

Returns:
all imports of this module

getUsedby

public final UsedbyList getUsedby()
Get all usedby references of this module.

Returns:
all usedby references of this module

getParagraphs

public final ParagraphList getParagraphs()
Get all paragraphs of this module.

Returns:
all paragraphs of this module

getPropositions

public final Proposition[] getPropositions()
Get all propositions of this module.

Returns:
all propositions of this module

getRuleVersion

public final Version getRuleVersion()
Get the rule version this module could use maximal.

Returns:
maximal rule version

setRuleVersion

public final void setRuleVersion(Version version)
                          throws ArgumentException
Set the rule version this module could use maximal. After this method the module address is unknown.

Parameters:
version - maximal rule version
Throws:
ArgumentException - if setting failed

getReferencedModules

public final Map getReferencedModules()
Get a map of all referenced modules.

Returns:
map with all referenced modules. Key is the ModuleAddress, value is the Module itself.

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
Specified by:
create in class AbstractDynamicArgumentList
Throws:
ArgumentException

toString

public final String toString()
Description copied from interface: Argument
Get the argument in String form.

Specified by:
toString in interface Argument
Specified by:
toString in class AbstractDynamicArgumentList

Hilbert II - JAVA-Packages - Principia Mathematica II

©left GNU General Public Licence
All Rights Reserved.