You can subscribe to this list here.
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(35) |
Dec
(10) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(10) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <js...@us...> - 2008-05-17 10:45:27
|
Revision: 55
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=55&view=rev
Author: jstuyts
Date: 2008-05-17 03:45:25 -0700 (Sat, 17 May 2008)
Log Message:
-----------
Major cleanup. Let's hope I did not break anything.
Modified Paths:
--------------
trunk/site/contractInheritance.html
trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java
trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java
trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java
trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java
trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java
trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java
trunk/source/java/net/sf/jcontracts/antlr/Alternative.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java
trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java
trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java
trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/CommonAST.java
trunk/source/java/net/sf/jcontracts/antlr/CommonToken.java
trunk/source/java/net/sf/jcontracts/antlr/DefaultToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/DefineGrammarSymbols.java
trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/DumpASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionHandler.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionSpec.java
trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java
trunk/source/java/net/sf/jcontracts/antlr/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAtom.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarElement.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/JavaBlockFinishingInfo.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/LLkAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkGrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParser.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParserNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/LexerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/Lookahead.java
trunk/source/java/net/sf/jcontracts/antlr/MakeGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java
trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java
trunk/source/java/net/sf/jcontracts/antlr/OneOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/OptionalBlock.java
trunk/source/java/net/sf/jcontracts/antlr/Parser.java
trunk/source/java/net/sf/jcontracts/antlr/ParserException.java
trunk/source/java/net/sf/jcontracts/antlr/ParserGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/RuleBlock.java
trunk/source/java/net/sf/jcontracts/antlr/RuleEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java
trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java
trunk/source/java/net/sf/jcontracts/antlr/SimpleTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/SynPredBlock.java
trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/Token.java
trunk/source/java/net/sf/jcontracts/antlr/TokenBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/TokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/TokenQueue.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/Tokenizer.java
trunk/source/java/net/sf/jcontracts/antlr/Tool.java
trunk/source/java/net/sf/jcontracts/antlr/ToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/TreeBlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/TreeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TreeParser.java
trunk/source/java/net/sf/jcontracts/antlr/TreeSpecifierNode.java
trunk/source/java/net/sf/jcontracts/antlr/TreeWalkerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/WildcardElement.java
trunk/source/java/net/sf/jcontracts/antlr/ZeroOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexerTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/collections/AST.java
trunk/source/java/net/sf/jcontracts/antlr/collections/ASTEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Enumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/List.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Stack.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTArray.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/BitSet.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/IndexedVector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLCell.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LList.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/Vector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/GrammarFile.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Option.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Preprocessor.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Rule.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java
trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java
trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Class.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/codeparser/Interface.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaTokenTypes.java
trunk/source/java/net/sf/jcontracts/codeparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/Method.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/codeparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/TypeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Variable.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
trunk/source/java/net/sf/jcontracts/icontract/AllOption.java
trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/Constants.java
trunk/source/java/net/sf/jcontracts/icontract/DefaultExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java
trunk/source/java/net/sf/jcontracts/icontract/IContracted.java
trunk/source/java/net/sf/jcontracts/icontract/Interface.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheck.java
trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
trunk/source/java/net/sf/jcontracts/icontract/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/icontract/Option.java
trunk/source/java/net/sf/jcontracts/icontract/OutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/ParameterOption.java
trunk/source/java/net/sf/jcontracts/icontract/PrePostCheck.java
trunk/source/java/net/sf/jcontracts/icontract/ProcessingOption.java
trunk/source/java/net/sf/jcontracts/icontract/Repository.java
trunk/source/java/net/sf/jcontracts/icontract/RepositoryOutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java
trunk/source/java/net/sf/jcontracts/icontract/Target.java
trunk/source/java/net/sf/jcontracts/icontract/Tool.java
trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java
trunk/source/java/net/sf/jcontracts/icontract/Variable.java
Added Paths:
-----------
trunk/source/java/net/sf/jcontracts/argparser/ArgumentsParser.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/MultipleCompilationUnitState.java
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java
trunk/source/java/net/sf/jcontracts/argparser/Option.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/argparser/Target.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeBody.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeMetaclassVisitor.java
Modified: trunk/site/contractInheritance.html
===================================================================
--- trunk/site/contractInheritance.html 2008-05-09 17:31:07 UTC (rev 54)
+++ trunk/site/contractInheritance.html 2008-05-17 10:45:25 UTC (rev 55)
@@ -48,7 +48,13 @@
<p>Each of these extensions is described below.</p>
- <h2><a name="inheritingMultipleTimes" />Inheriting the same method from multiple types</h2>
+ <h2><a name="inheritingMultipleTimes" />Inheriting contracts from multiple types</h2>
+
+ <p>This section explains a number of issues with contract inheritance when the same method is
+ inherited from multiple base types. Because of these issues inheritance of the same method from
+ multiple types is not allowed.</p>
+
+ <h3>Methods</h3>
<p>When the same method is inherited from multiple types it is impossible to generate correct pre-
and postconditions for the overriding method. The combination of preconditions (the same effect as
@@ -58,8 +64,6 @@
rejected. It is even possible that all return values are rejected because no value can satisfy the
combination of postconditions.</p>
- <p>Because of this issue inheritance of the same method from multiple types is not allowed.</p>
-
<p>Here is an example showing how the combination of pre- and postconditions would lead to unwanted
results. This is the method declaration from the first base type:</p>
@@ -96,7 +100,14 @@
equal to zero it contains a bug, but this bug cannot detected.</p>
<p>The combination of postconditions prevents this method from returning any result at all as there is no
- integer that is both less than or equal to zero, and greater than one hundred.</p>
+ integer that is both less than or equal to zero, and greater than one hundred.</p>
+
+ <h3>Invariants</h3>
+
+ <p>The problems with inheriting multiple postconditions for the same method also applies to invariants. If
+ multiple inherited invariants have assertions about the return values of the same method, the combination
+ of these invariants will cause valid return values for base types to become invalid, with the possiblity
+ of invalidating all values.</p>
<h2><a name="weakening" />Weakening preconditions</h2>
@@ -128,7 +139,9 @@
<p>Clients of a method that invoke strengthened methods will only receive a subset of the possible results of the
original method. This means you cannot test your client with all possible return values, so bugs (instead of
- contract violations) might surface if the implementation is changed to one that does return all possible values.</p>
+ contract violations) might surface if the implementation is changed to one that does return all possible values.</p>
+
+ <p>To prevent issues with postconditions it is best to not strengthen them.</p>
<h2>Invariants</h2>
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2008-05-09 17:31:07 UTC (rev 54)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2008-05-17 10:45:25 UTC (rev 55)
@@ -1,6 +1,7 @@
/*
* Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
+ * Copyright 2006 John Swapceinski
+ * Copyright 2006, 2008 Johan Stuyts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java 2008-05-09 17:31:07 UTC (rev 54)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java 2008-05-17 10:45:25 UTC (rev 55)
@@ -1,6 +1,7 @@
/*
* Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
+ * Copyright 2006 John Swapceinski
+ * Copyright 2006, 2008 Johan Stuyts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,101 +21,99 @@
public interface ANTLRGrammarParseBehavior
{
+ void abortGrammar();
- public abstract void abortGrammar();
+ void beginAlt(boolean flag);
- public abstract void beginAlt(boolean flag);
+ void beginChildList();
- public abstract void beginChildList();
+ void beginExceptionGroup();
- public abstract void beginExceptionGroup();
+ void beginExceptionSpec(Token token);
- public abstract void beginExceptionSpec(Token token);
+ void beginSubRule(Token token, int i, boolean flag);
- public abstract void beginSubRule(Token token, int i, boolean flag);
+ void beginTree(int i) throws SemanticException;
- public abstract void beginTree(int i) throws SemanticException;
+ void defineRuleName(Token token, String s, boolean flag) throws SemanticException;
- public abstract void defineRuleName(Token token, String s, boolean flag) throws SemanticException;
+ void endAlt();
- public abstract void endAlt();
+ void endChildList();
- public abstract void endChildList();
+ void endExceptionGroup();
- public abstract void endExceptionGroup();
+ void endExceptionSpec();
- public abstract void endExceptionSpec();
+ void endGrammar();
- public abstract void endGrammar();
+ void endOptions();
- public abstract void endOptions();
+ void endRule(String s);
- public abstract void endRule(String s);
+ void endSubRule();
- public abstract void endSubRule();
+ void endTree();
- public abstract void endTree();
+ void hasError();
- public abstract void hasError();
+ void noASTSubRule();
- public abstract void noASTSubRule();
+ void oneOrMoreSubRule();
- public abstract void oneOrMoreSubRule();
+ void optionalSubRule();
- public abstract void optionalSubRule();
+ void refAction(Token token);
- public abstract void refAction(Token token);
+ void refArgAction(Token token);
- public abstract void refArgAction(Token token);
+ void refCharLiteral(Token token, Token token1, boolean flag, int i, boolean flag1);
- public abstract void refCharLiteral(Token token, Token token1, boolean flag, int i, boolean flag1);
+ void refCharRange(Token token, Token token1, Token token2, int i, boolean flag);
- public abstract void refCharRange(Token token, Token token1, Token token2, int i, boolean flag);
+ void refExceptionHandler(Token token, String s);
- public abstract void refExceptionHandler(Token token, String s);
+ void refHeaderAction(Token token);
- public abstract void refHeaderAction(Token token);
+ void refInitAction(Token token);
- public abstract void refInitAction(Token token);
+ void refMemberAction(Token token);
- public abstract void refMemberAction(Token token);
+ void refPreambleAction(Token token);
- public abstract void refPreambleAction(Token token);
+ void refReturnAction(Token token);
- public abstract void refReturnAction(Token token);
+ void refRule(Token token, Token token1, Token token2, Token token3, int i);
- public abstract void refRule(Token token, Token token1, Token token2, Token token3, int i);
+ void refSemPred(Token token);
- public abstract void refSemPred(Token token);
+ void refStringLiteral(Token token, Token token1, int i, boolean flag);
- public abstract void refStringLiteral(Token token, Token token1, int i, boolean flag);
+ void refToken(Token token, Token token1, Token token2, Token token3, boolean flag, int i, boolean flag1);
- public abstract void refToken(Token token, Token token1, Token token2, Token token3, boolean flag, int i,
- boolean flag1);
+ void refTokenRange(Token token, Token token1, Token token2, int i, boolean flag);
- public abstract void refTokenRange(Token token, Token token1, Token token2, int i, boolean flag);
+ void refTreeSpecifier(Token token);
- public abstract void refTreeSpecifier(Token token);
+ void refWildcard(Token token, Token token1, int i);
- public abstract void refWildcard(Token token, Token token1, int i);
+ void setArgOfRuleRef(Token token);
- public abstract void setArgOfRuleRef(Token token);
+ void setCharVocabulary(BitSet bitset);
- public abstract void setCharVocabulary(BitSet bitset);
+ void setFileOption(Token token, Token token1);
- public abstract void setFileOption(Token token, Token token1);
+ void setGrammarOption(Token token, Token token1);
- public abstract void setGrammarOption(Token token, Token token1);
+ void setRuleOption(Token token, Token token1);
- public abstract void setRuleOption(Token token, Token token1);
+ void startLexer(Token token, String s);
- public abstract void startLexer(Token token, String s);
+ void startParser(Token token, String s);
- public abstract void startParser(Token token, String s);
+ void startTreeWalker(Token token, String s);
- public abstract void startTreeWalker(Token token, String s);
+ void synPred();
- public abstract void synPred();
-
- public abstract void zeroOrMoreSubRule();
+ void zeroOrMoreSubRule();
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2008-05-09 17:31:07 UTC (rev 54)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2008-05-17 10:45:25 UTC (rev 55)
@@ -1,6 +1,7 @@
/*
* Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
+ * Copyright 2006 John Swapceinski
+ * Copyright 2006, 2008 Johan Stuyts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,24 +22,24 @@
public ANTLRHashString(char buf[], int length, CharScanner lexer)
{
- this.lexer = lexer;
+ lexer_ = lexer;
setBuffer(buf, length);
}
public ANTLRHashString(CharScanner lexer)
{
- this.lexer = lexer;
+ lexer_ = lexer;
}
public ANTLRHashString(String s, CharScanner lexer)
{
- this.lexer = lexer;
+ lexer_ = lexer;
setString(s);
}
private final char charAt(int index)
{
- return s == null ? buf[index] : s.charAt(index);
+ return s_ == null ? buf_[index] : s_.charAt(index);
}
public boolean equals(Object o)
@@ -50,7 +51,7 @@
ANTLRHashString s;
if (o instanceof String)
{
- s = new ANTLRHashString((String) o, lexer);
+ s = new ANTLRHashString((String) o, lexer_);
}
else
{
@@ -61,7 +62,7 @@
{
return false;
}
- if (lexer.getCaseSensitiveLiterals())
+ if (lexer_.getCaseSensitiveLiterals())
{
for (int i = 0; i < l; i++)
{
@@ -76,7 +77,7 @@
{
for (int i = 0; i < l; i++)
{
- if (lexer.toLower(charAt(i)) != lexer.toLower(s.charAt(i)))
+ if (lexer_.toLower(charAt(i)) != lexer_.toLower(s.charAt(i)))
{
return false;
}
@@ -90,7 +91,7 @@
{
int hashval = 0;
int l = length();
- if (lexer.getCaseSensitiveLiterals())
+ if (lexer_.getCaseSensitiveLiterals())
{
for (int i = 0; i < l; i++)
{
@@ -102,7 +103,7 @@
{
for (int i = 0; i < l; i++)
{
- hashval = hashval * 151 + lexer.toLower(charAt(i));
+ hashval = hashval * 151 + lexer_.toLower(charAt(i));
}
}
@@ -111,27 +112,27 @@
private final int length()
{
- return s == null ? len : s.length();
+ return s_ == null ? len : s_.length();
}
public void setBuffer(char buf[], int length)
{
- this.buf = buf;
+ buf_ = buf;
len = length;
- s = null;
+ s_ = null;
}
public void setString(String s)
{
- this.s = s;
- buf = null;
+ s_ = s;
+ buf_ = null;
}
- private String s;
+ private String s_;
- private char buf[];
+ private char buf_[];
private int len;
- private CharScanner lexer;
+ private CharScanner lexer_;
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2008-05-09 17:31:07 UTC (rev 54)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2008-05-17 10:45:25 UTC (rev 55)
@@ -1,6 +1,7 @@
/*
* Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
+ * Copyright 2006 John Swapceinski
+ * Copyright 2006, 2008 Johan Stuyts
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,24 +28,24 @@
public ANTLRLexer(CharBufferNoBacktrackingNoInteractive cb)
{
super(cb);
- super.literals = new Hashtable();
- super.literals.put(new ANTLRHashString("Parser", this), new Integer(30));
- super.literals.put(new ANTLRHashString("catch", this), new Integer(38));
- super.literals.put(new ANTLRHashString("Lexer", this), new Integer(9));
- super.literals.put(new ANTLRHashString("exception", this), new Integer(37));
- super.literals.put(new ANTLRHashString("class", this), new Integer(7));
- super.literals.put(new ANTLRHashString("lexclass", this), new Integer(6));
- super.literals.put(new ANTLRHashString("public", this), new Integer(32));
- super.literals.put(new ANTLRHashString("header", this), new Integer(4));
- super.literals.put(new ANTLRHashString("tokens", this), new Integer(26));
- super.literals.put(new ANTLRHashString("charVocabulary", this), new Integer(17));
- super.literals.put(new ANTLRHashString("options", this), new Integer(11));
- super.literals.put(new ANTLRHashString("returns", this), new Integer(36));
- super.literals.put(new ANTLRHashString("TreeParser", this), new Integer(10));
- super.literals.put(new ANTLRHashString("private", this), new Integer(33));
- super.literals.put(new ANTLRHashString("protected", this), new Integer(31));
- super.literals.put(new ANTLRHashString("extends", this), new Integer(8));
- super.caseSensitiveLiterals = true;
+ literals_ = new Hashtable();
+ literals_.put(new ANTLRHashString("Parser", this), new Integer(30));
+ literals_.put(new ANTLRHashString("catch", this), new Integer(38));
+ literals_.put(new ANTLRHashString("Lexer", this), new Integer(9));
+ literals_.put(new ANTLRHashString("exception", this), new Integer(37));
+ literals_.put(new ANTLRHashString("class", this), new Integer(7));
+ literals_.put(new ANTLRHashString("lexclass", this), new Integer(6));
+ literals_.put(new ANTLRHashString("public", this), new Integer(32));
+ literals_.put(new ANTLRHashString("header", this), new Integer(4));
+ literals_.put(new ANTLRHashString("tokens", this), new Integer(26));
+ literals_.put(new ANTLRHashString("charVocabulary", this), new Integer(17));
+ literals_.put(new ANTLRHashString("options", this), new Integer(11));
+ literals_.put(new ANTLRHashString("returns", this), new Integer(36));
+ literals_.put(new ANTLRHashString("TreeParser", this), new Integer(10));
+ literals_.put(new ANTLRHashString("private", this), new Integer(33));
+ literals_.put(new ANTLRHashString("protected", this), new Integer(31));
+ literals_.put(new ANTLRHashString("extends", this), new Integer(8));
+ caseSensitiveLiterals_ = true;
}
public ANTLRLexer(Reader in)
@@ -93,11 +94,8 @@
{
return 0;
}
- else
- {
- return Character.digit(cs.charAt(3), 16) * 16 * 16 * 16 + Character.digit(cs.charAt(4), 16) * 16
- * 16 + Character.digit(cs.charAt(5), 16) * 16 + Character.digit(cs.charAt(6), 16);
- }
+ return Character.digit(cs.charAt(3), 16) * 16 * 16 * 16 + Character.digit(cs.charAt(4), 16) * 16 * 16
+ + Character.digit(cs.charAt(5), 16) * 16 + Character.digit(cs.charAt(6), 16);
case 48: // '0'
case 49: // '1'
@@ -111,10 +109,7 @@
{
return (cs.charAt(2) - 48) * 8 + (cs.charAt(3) - 48);
}
- else
- {
- return cs.charAt(2) - 48;
- }
+ return cs.charAt(2) - 48;
case 52: // '4'
case 53: // '5'
@@ -124,10 +119,7 @@
{
return (cs.charAt(2) - 48) * 8 + (cs.charAt(3) - 48);
}
- else
- {
- return cs.charAt(2) - 48;
- }
+ return cs.charAt(2) - 48;
}
return 0;
}
@@ -135,11 +127,11 @@
public final void mACTION(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 5;
int actionLine = getLine();
mNESTED_ACTION(false);
- if (super.la_1 == '?')
+ if (la_1 == '?')
{
match('?');
_ttype = 40;
@@ -153,78 +145,78 @@
setText(Tool.stripFrontBack(getText(), "{", "}?"));
}
setLine(actionLine);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mARG_ACTION(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 35;
mNESTED_ARG_ACTION(false);
setText(Tool.stripFrontBack(getText(), "[", "]"));
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mASSIGN(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 14;
match('=');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mBANG(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 34;
match('!');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mCARET(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 46;
match('^');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mCHAR_LITERAL(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 19;
match('\'');
- switch (super.la_1)
+ switch (la_1)
{
case 92: // '\\'
mESC(false);
@@ -359,38 +351,38 @@
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
match('\'');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mCOLON(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 12;
match(':');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mCOMMENT(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 49;
- if (super.la_1 == '/' && super.la_2 == '/')
+ if (la_1 == '/' && la_2 == '/')
{
mSL_COMMENT(false);
}
- else if (super.la_1 == '/' && super.la_2 == '*')
+ else if (la_1 == '/' && la_2 == '*')
{
mML_COMMENT(false);
}
@@ -399,35 +391,35 @@
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
_ttype = -1;
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mDIGIT(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 53;
matchRange('0', '9');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mESC(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 52;
match('\\');
- switch (super.la_1)
+ switch (la_1)
{
case 110: // 'n'
match('n');
@@ -466,10 +458,10 @@
case 50: // '2'
case 51: // '3'
matchRange('0', '3');
- if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '~')
{
mDIGIT(false);
- if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '~')
{
mDIGIT(false);
}
@@ -481,7 +473,7 @@
case 54: // '6'
case 55: // '7'
matchRange('4', '7');
- if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ if (la_1 >= '0' && la_1 <= '9' && la_2 >= '\003' && la_2 <= '~')
{
mDIGIT(false);
}
@@ -498,37 +490,37 @@
default:
throw new ScannerException("no viable alt for char: " + LA(1), getLine());
}
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mIMPLIES(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 45;
match("=>");
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mINT(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 20;
int _cnt = 0;
do
{
- if (super.la_1 >= '0' && super.la_1 <= '9')
+ if (la_1 >= '0' && la_1 <= '9')
{
matchRange('0', '9');
}
@@ -543,24 +535,24 @@
_cnt++;
}
while (true);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final int mINTERNAL_RULE_REF(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 58;
int t = 28;
matchRange('a', 'z');
do
{
- switch (super.la_1)
+ switch (la_1)
{
case 95: // '_'
match('_');
@@ -579,12 +571,12 @@
matchRange('0', '9');
continue;
}
- if (super.la_1 >= 'a' && super.la_1 <= 'z')
+ if (la_1 >= 'a' && la_1 <= 'z')
{
matchRange('a', 'z');
continue;
}
- if (super.la_1 < 'A' || super.la_1 > 'Z')
+ if (la_1 < 'A' || la_1 > 'Z')
{
break;
}
@@ -592,38 +584,38 @@
}
while (true);
t = testLiteralsTable(t);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
return t;
}
public final void mLPAREN(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 27;
match('(');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mML_COMMENT(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 51;
match("/*");
do
{
- switch (super.la_1)
+ switch (la_1)
{
case 10: // '\n'
match('\n');
@@ -755,7 +747,7 @@
match(_tokenSet_1);
continue;
}
- if (super.la_1 != '*' || super.la_2 < '\003' || super.la_2 > '~' || LA(2) == '/')
+ if (la_1 != '*' || la_2 < '\003' || la_2 > '~' || LA(2) == '/')
{
break;
}
@@ -763,23 +755,23 @@
}
while (true);
match("*/");
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mNESTED_ACTION(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 57;
match('{');
do
{
- switch (super.la_1)
+ switch (la_1)
{
case 10: // '\n'
match('\n');
@@ -798,17 +790,17 @@
mSTRING_LITERAL(false);
continue;
}
- if (super.la_1 == '/' && (super.la_2 == '*' || super.la_2 == '/') && (LA(2) == '/' || LA(2) == '*'))
+ if (la_1 == '/' && (la_2 == '*' || la_2 == '/') && (LA(2) == '/' || LA(2) == '*'))
{
mCOMMENT(false);
continue;
}
- if (super.la_1 == '/' && super.la_2 >= '\003' && super.la_2 <= '~')
+ if (la_1 == '/' && la_2 >= '\003' && la_2 <= '~')
{
match('/');
continue;
}
- if (!_tokenSet_2.member(super.la_1))
+ if (!_tokenSet_2.member(la_1))
{
break;
}
@@ -816,23 +808,23 @@
}
while (true);
match('}');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mNESTED_ARG_ACTION(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 56;
match('[');
label0: do
{
- switch (super.la_1)
+ switch (la_1)
{
case 91: // '['
mNESTED_ARG_ACTION(false);
@@ -979,140 +971,141 @@
}
}
while (true);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mNOT_OP(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 39;
match('~');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mOR(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 21;
match('|');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mPLUS(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 44;
match('+');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mPOINTER(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 60;
match("->");
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mQUESTION(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 42;
match('?');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mRANGE(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 22;
match("..");
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mRCURLY(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 16;
match('}');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mRPAREN(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 29;
match(')');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mRULE_REF(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 28;
int t = 0;
t = mINTERNAL_RULE_REF(false);
_ttype = t;
if (t == 11)
{
- for (; _tokenSet_3.member(super.la_1); mWS(false))
+ while (_tokenSet_3.member(la_1))
{
+ mWS(false);
}
- if (super.la_1 == '{')
+ if (la_1 == '{')
{
match('{');
_ttype = 13;
@@ -1120,79 +1113,81 @@
}
else if (t == 26)
{
- for (; _tokenSet_3.member(super.la_1); mWS(false))
+ while (_tokenSet_3.member(la_1))
{
+ mWS(false);
}
- if (super.la_1 == '{')
+ if (la_1 == '{')
{
match('{');
_ttype = 23;
}
}
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mSEMI(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 15;
match(';');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
protected final void mSL_COMMENT(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 50;
match("//");
- for (; _tokenSet_0.member(super.la_1); matchNot('\n'))
+ while (_tokenSet_0.member(la_1))
{
+ matchNot('\n');
}
match('\n');
newline();
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mSTAR(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 43;
match('*');
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mSTRING_LITERAL(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 18;
match('"');
label0: do
{
- switch (super.la_1)
+ switch (la_1)
{
case 92: // '\\'
mESC(false);
@@ -1329,23 +1324,23 @@
}
}
while (true);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mTOKEN_REF(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 24;
matchRange('A', 'Z');
do
{
- switch (super.la_1)
+ switch (la_1)
{
case 95: // '_'
match('_');
@@ -1364,12 +1359,12 @@
matchRange('0', '9');
continue;
}
- if (super.la_1 >= 'a' && super.la_1 <= 'z')
+ if (la_1 >= 'a' && la_1 <= 'z')
{
matchRange('a', 'z');
continue;
}
- if (super.la_1 < 'A' || super.la_1 > 'Z')
+ if (la_1 < 'A' || la_1 > 'Z')
{
break;
}
@@ -1377,32 +1372,32 @@
}
while (true);
_ttype = testLiteralsTable(_ttype);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mTREE_BEGIN(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 41;
match("#(");
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _begin, text.length() - _begin));
}
- super._returnToken = _token;
+ returnToken_ = _token;
}
public final void mTREE_SPECIFIER(boolean _createToken) throws ScannerException
{
Token _token = null;
- int _begin = super.text.length();
+ int _begin = text.length();
int _ttype = 59;
mPOINTER(false);
mWS_OPT(false);
@@ -1410,7 +1405,7 @@
int _cnt = 0;
do
{
- if (_tokenSet_4.member(super.la_1))
+ if (_tokenSet_4.member(la_1))
{
mTREE_SPECIFIER_TERM(false);
mWS_OPT(false);
@@ -1426,22 +1421,22 @@
_cnt++;
}
while (true);
- if (_createToken && _token == null)
+ if (_createToken)
{
_token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ _token.setText(new String(text.getBuffer(), _b...
[truncated message content] |
|
From: <js...@us...> - 2008-05-09 17:31:10
|
Revision: 54
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=54&view=rev
Author: jstuyts
Date: 2008-05-09 10:31:07 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed unused classes.
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/icontract/instruction/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:30:18
|
Revision: 53
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=53&view=rev
Author: jstuyts
Date: 2008-05-09 10:30:14 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed unused classes.
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/icontract/side/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:16:29
|
Revision: 50
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=50&view=rev
Author: jstuyts
Date: 2008-05-09 10:09:31 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Corrected project name.
Modified Paths:
--------------
trunk/build.xml
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2008-05-09 17:08:59 UTC (rev 49)
+++ trunk/build.xml 2008-05-09 17:09:31 UTC (rev 50)
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<project name="JcontractS" default="compile">
+<project name="JContractS" default="compile">
<property file="local.properties" />
<property file="project.properties" />
@@ -63,7 +63,7 @@
<copy todir="build/ant/binary-dist"
file="build/ant/${distribution.name}-${project.version}.jar" />
<copy todir="build/ant/binary-dist" file="LICENSE.txt" />
- <copy todir="build/ant/binary-dist" file="JcontractS.ico" />
+ <copy todir="build/ant/binary-dist" file="JContractS.ico" />
<mkdir dir="build/ant/binary-dist/documentation" />
<copy todir="build/ant/binary-dist/documentation">
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:15:47
|
Revision: 51
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=51&view=rev
Author: jstuyts
Date: 2008-05-09 10:12:24 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Created tag for v1.01.00b02.
Added Paths:
-----------
tags/v1.01.00b02/
Copied: tags/v1.01.00b02 (from rev 50, trunk)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:12:59
|
Revision: 52
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=52&view=rev
Author: jstuyts
Date: 2008-05-09 10:12:56 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Increased version number after release of v1.01.00b02.
Modified Paths:
--------------
trunk/project.properties
Modified: trunk/project.properties
===================================================================
--- trunk/project.properties 2008-05-09 17:12:24 UTC (rev 51)
+++ trunk/project.properties 2008-05-09 17:12:56 UTC (rev 52)
@@ -1,6 +1,6 @@
# Do not change the version number. The release manger is
# the only one allowed to change it.
-project.version=1.01.00b02-dev
+project.version=1.01.00b03-dev
distribution.name=jcontracts
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:09:03
|
Revision: 49
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=49&view=rev
Author: jstuyts
Date: 2008-05-09 10:08:59 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Added some documentation.
Modified Paths:
--------------
trunk/site/documentation.html
Added Paths:
-----------
trunk/site/addingContracts.html
trunk/site/building.html
trunk/site/contractInheritance.html
trunk/site/download.html
trunk/site/index.html
trunk/site/license.html
trunk/site/participate.html
trunk/site/resources/images/dataflow.gif
trunk/site/roadmap.html
Removed Paths:
-------------
trunk/site/download.html
trunk/site/index.html
trunk/site/license.html
trunk/site/participate.html
trunk/site/roadmap.html
Added: trunk/site/addingContracts.html
===================================================================
--- trunk/site/addingContracts.html (rev 0)
+++ trunk/site/addingContracts.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,217 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Documentation - Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu"><a href="index.html">Home</a></li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu"><a href="download.html">Download</a></li>
+
+ <li class="menu"><a href="license.html">License</a></li>
+ </ul>
+
+ <h1>Adding contracts</h1>
+
+ <h2>Basics</h2>
+
+ <p>Contracts are used to specify the client-visible behavior of an object without saying anything about how this
+ behavior is implemented. For JContractS contracts are specified as assertions attached to Javadoc tags in Javadoc
+ comments. There are three types of contracts: preconditions, postconditions and invariants. The purpose of each
+ type is explained below.</p>
+
+ <p>Multiple Javadoc tags of the same type are allowed. If you specify multiple tags, the tags of the same type
+ will be evaluated in the order specified. If an assertion fails the following assertions will not be evaluated.
+ This way assertions can be used that assume the conditions of preceding assertions hold. It works the same as
+ conditional logical operator where following terms can assume the preceding terms held.</p>
+
+ <p>The assertions are written using standard Java expression with some extensions. The extensions are explained in
+ following sections.</p>
+
+ <h3>Invariants</h3>
+
+ <p>An invariant describes what assertions must hold during the lifetime of an object. It describes the valid state
+ of an object. The assertions do not have to hold all the time, it is allowed for a method to temporarily change
+ the object to an invalid state. But after the method has finished, the object must have a state that is valid
+ according to the assertions of the invariant. More specifically, the invariant is checked after creation and after
+ invocation of a public method. This allows protected, package-visible and private methods to change the object as
+ they see fit.</p>
+
+ <p>The invariant is added to the Javadoc comment of the type. The assertions of an invariant are preceded by the
+ Javadoc tag <code>@inv</code>. Here is the invariant for a (simple) stack:</p>
+
+ <pre>/**
+ * @inv getSize() >= 0
+ */
+public interface Stack
+{
+ ...
+}</pre>
+
+ <p>This invariant states that the size will always be a non-negative integer.</p>
+
+ <h3>Preconditions</h3>
+
+ <p>A precondition is used to state when it is valid to invoke a method. It is used in addition to the invariant
+ which must hold for all methods. The precondition usually ensures that a method is only invoked when the object is
+ in the correct state for that method, and that the parameters passed are valid. A method only has to work
+ correctly when its precondition holds. If the precondition does not hold then the result of the method is
+ unpredictable.</p>
+
+ <p>Preconditions are added to the Javadoc comment of methods. They are preceded by the Javadoc tag
+ <code>@pre</code>. Here is the precondition for method <code>pop()</code> of a stack:</p>
+
+ <pre>/**
+ * @pre getSize() > 0
+ */
+Object pop();</pre>
+
+ <p>This preconditions states that it is only valid to invoke <code>pop()</code> when <code>getSize()</code>
+ returns a value greater than zero.</p>
+
+ <h3>Postconditions</h3>
+
+ <p>A postcondition states what the correct behavior of a method is. It is used in addition to the invariant which
+ must hold for all methods. The postcondition usually ensures that a method changes the state of an object
+ correctly, and that the return value is valid. If the method was called when the precondition held, the method is
+ required to ensure that its postcondition (and the invariant) will hold.</p>
+
+ <p>Just like preconditions, postconditions are added to the Javadoc comment of methods. Postconditions are
+ preceded by the Javadoc tag <code>@post</code>. Here is the postcondition of <code>pop()</code>:</p>
+
+ <pre>/**
+ * @post return != null
+ */
+Object pop();</pre>
+
+ <p>The postcondition states that <code>pop()</code> will never return a value that is <code>null</code>.</p>
+
+ <h3>Full example</h3>
+
+ <p>Here is the full source code for a simple stack interface:</p>
+
+ <pre>/**
+ * @inv getSize() >= 0
+ */
+public interface Stack
+{
+ /**
+ * @post return >= 0
+ */
+ int getSize();
+ /**
+ * @pre element != null
+ */
+ void push(Object element);
+ /**
+ * @pre getSize() > 0
+ * @post return != null
+ */
+ Object pop();
+}</pre>
+
+ <h2>Referencing old state</h2>
+
+ <p>It is often very useful to describe the new state of an object in postconditions in terms of its previous
+ state. Take the postcondition of <code>push(Object)</code> and <code>pop()</code> for example, in addition to the
+ postconditions that were specified above it is useful to add postconditions that state that the size of the stack
+ has increased and decreased respectively.</p>
+
+ <p>For this purpose a special expression is present that allows capturing the value of an expression from before
+ the method invocation. To capture the value of an expression, append <code>@pre</code> to it. Here is the new
+ postcondition of <code>push(Object)</code>:</p>
+
+ <pre>/**
+ * @post getSize() == getSize()@pre + 1
+ */
+void push(Object element)</pre>
+
+ <p>And here is the extended postcondition of <code>pop()</code>:</p>
+
+ <pre>/**
+ * @post return != null
+ * @post getSize() == getSize()@pre - 1
+ */
+Object pop()</pre>
+
+ <h2>Logical operators</h2>
+
+ <h3>Implies</h3>
+
+ <p>An operator that is very useful in assertions but is missing from Java is the <i>implies</i> operator. This
+ operator can be used to state that an expression <i>q</i>, must hold if expression <i>p</i> holds. But if <i>p</i>
+ does not hold, <i>q</i> is allowed to either hold or not.</p>
+
+ <p>Suppose you have an object that can either be enabled or disabled. When the object is disabled it must have a
+ reason why it was disabled. Using <i>implies</i> it is easy and intuitive to specify this in the precondition of
+ the method that changes the state.</p>
+
+ <pre>/**
+ * @pre !enable implies reason != null
+ */
+void setState(boolean enable, String reason);</pre>
+
+ <p>Although this operator can also be written as <code>!p || q</code>, it is very useful to have a separate
+ operator for it because it reveals the intention better. Compare the precondition above with its rewritten
+ version:</p>
+
+ <pre>/**
+ * @pre enable || reason != null
+ */
+void setState(boolean enable, String reason);</pre>
+
+ <h2>Quantifiers</h2>
+
+ <p>Besides single-value fields/parameters collections of values are also used. It must be possible to state
+ something about the values in these collections too. This requires iterating over a collection in an assertion. As
+ this is very cumbersome and verbose, additional operators have been added to JContractS to make this easier.</p>
+
+ <p>These operators are called quantifiers and there are two variants: <code>forall</code> and
+ <code>exists</code>.</p>
+
+ <h3>Forall</h3>
+
+ <p>A <code>forall</code> expression holds if an assertion holds for each and every element in the collection.</p>
+
+ <p>Suppose you have a method that only works on collections of non-negative integers. You can add an assertion to
+ the precondition that will verify that clients do not pass collections with negative integers:</p>
+
+ <pre>/**
+ * @pre forall Integer i in values | i.intValue() >= 0
+ */
+List squareRoots(List values);</pre>
+
+ <h3>Exists</h3>
+
+ <p>An <code>exists</code> expression holds if an assertion holds for at least one element in the collection.</p>
+
+ <p>Suppose you book groups of people into a hotel, but a group is only allowed to make a reservation if at
+ least one of them is an adult.</p>
+
+ <pre>/**
+ * @pre exists Person p in people | p.getAge() >= 18
+ */
+void book(Set people);</pre>
+
+ <hr />
+
+ <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
+ src="resources/images/sflogo.png" width="125" /></a></div>
+
+ <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JContractS at SourceForge.net</a></p>
+ </body>
+</html>
Added: trunk/site/building.html
===================================================================
--- trunk/site/building.html (rev 0)
+++ trunk/site/building.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,195 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Documentation - Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu"><a href="index.html">Home</a></li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu"><a href="download.html">Download</a></li>
+
+ <li class="menu"><a href="license.html">License</a></li>
+ </ul>
+
+ <h1>Building</h1>
+
+ <h2>Overview</h2>
+
+ <p>When you start using JContractS you have to add a few additional steps to your build process. This is because
+ JContractS and your other projects need differently built JAR files at different times. Below is a dataflow
+ diagram of how your Java sources are transformed to, in this case, four sets of compiled classes. Each set has its
+ own purpose:</p>
+
+ <p><img alt="Data flow from Java sources to multiple sets of compiled classes"
+ src="resources/images/dataflow.gif" /></p>
+
+ <p>The leftmost branch of the diagram represents the standard compilation of the Java sources. No changes are
+ needed here. You can use the result of this branch if you do not want to use contracts at all.</p>
+
+ <p>As you can see each configuration of enabled contracts (preconditions and/or postconditions and/or invariants)
+ needs its own branch of instrumented sources: the 2nd and fourth branches.</p>
+
+ <p>In addition a set of repository classes is generated. The repository classes are used by projects depending on
+ this project to read the contracts of superclasses without needing access to the source code. The repository
+ classes are the same for all configurations of enabled contracts.</p>
+
+ <h2>Steps</h2>
+
+ <p>The Java compiler and JContractS in the above diagram have to be applied in the following order:</p>
+
+ <ol>
+ <li>Java compiler: compile the Java sources to classes without contracts.</li>
+
+ <li>JContractS <i>config</i> (<i>n</i> times): generate the instrumented sources and repository sources.</li>
+
+ <li>Java compiler <i>config</i> (<i>n</i> times): compile the instrumented sources to classes with
+ contracts.</li>
+
+ <li>Java compiler repo: compile the repository sources to classes.</li>
+ </ol>
+
+ <h2>Classpaths</h2>
+
+ <p>Each step needs its own specific classpath. What is needed on the classpath is detailed below.</p>
+
+ <h3>Java compiler</h3>
+
+ <p>The following items must be on the classpath passed to the Java compiler:</p>
+
+ <ul>
+ <li>Classes without contracts of contract-enabled dependencies (the result of the leftmost branch of the
+ diagram).</li>
+
+ <li>Classes of regular dependencies.</li>
+
+ <li>Destination directory for classes without contracts.</li>
+ </ul>
+
+ <h3>JContractS <i>config</i></h3>
+
+ <p>The following items must be on the classpath used to run JContractS:</p>
+
+ <ul>
+ <li>JContractS and log4j.</li>
+
+ <li>Classes with <i>config</i> contracts of contract-enabled dependencies (the result of the 2nd or the 4th
+ branch of the diagram).</li>
+
+ <li>Repository classes of contract-enabled dependencies, (the result of the 3rd branch of the diagram).</li>
+
+ <li>Classes of regular dependencies.</li>
+
+ <li>Destination directory for classes without contracts.</li>
+ </ul>
+
+ <h3>Java compiler <i>config</i></h3>
+
+ <p>The following items must be on the classpath passed to the Java compiler:</p>
+
+ <ul>
+ <li>Classes with <i>config</i> contract of contract-enabled dependencies (the result of the 2nd or the 4th
+ branch of the diagram).</li>
+
+ <li>Classes of regular dependencies.</li>
+
+ <li>Destination directory for classes with <i>config</i> contracts.</li>
+ </ul>
+
+ <h3>Java compiler repo</h3>
+
+ <p>The following items must be on the classpath passed to the Java compiler:</p>
+
+ <ul>
+ <li>Repository classes of contract-enabled dependencies (the result of the 3rd branch of the diagram).</li>
+
+ <li>Destination directory for repository classes.</li>
+ </ul>
+
+ <h2>Example steps</h2>
+
+ <h3>Project without contract-enabled dependencies (prj1)</h3>
+
+ <p>Java compiler:</p>
+
+ <pre>javac -classpath somelib.jar;target\classes
+ -sourcepath src
+ -d target\classes
+ src\com\acme\prj1\*.java</pre>
+
+ <p>JContractS <i>config</i>:</p>
+
+ <pre>java -classpath jcontracts.jar;log4j.jar;somelib.jar;target\classes
+ net.sf.jcontracts.icontract.Tool
+ -m<i>enabled-contracts</i>
+ -otarget\<i>config</i>-src\@p\@f.java
+ -ktarget\repo-src\@p
+ src\*.java</pre>
+
+ <p>Java compiler <i>config</i>:</p>
+
+ <pre>javac -classpath somelib.jar;target\<i>config</i>-classes
+ -sourcepath target\<i>config</i>-src
+ -d target\<i>config</i>-classes
+ target\<i>config</i>-src\com\acme\prj1\*.java</pre>
+
+ <p>Java compiler repo:</p>
+
+ <pre>javac -classpath target\repo-classes
+ -sourcepath target\repo-src
+ -d target\repo-classes
+ target\repo-src\com\acme\prj1\*.java</pre>
+
+ <h3>Project with contract-enabled dependencies (prj2)</h3>
+
+ <p>Java compiler:</p>
+
+ <pre>javac -classpath prj1.jar;somelib.jar;target\classes
+ -sourcepath src
+ -d target\classes
+ src\com\acme\prj2\*.java</pre>
+
+ <p>JContractS <i>config</i>:</p>
+
+ <pre>java -classpath jcontract.jar;log4j.jar;prj1-<i>config</i>.jar;prj1-repo.jar;somelib.jar;target\classes
+ net.sf.jcontracts.icontract.Tool
+ -m<i>config</i>
+ -otarget\<i>config</i>-src\@p\@f.java
+ -ktarget\repo-src\@p
+ src\*.java</pre>
+
+ <p>Java compiler <i>config</i>:</p>
+
+ <pre>javac -classpath prj1-<i>config</i>.jar;somelib.jar;target\<i>config</i>-classes
+ -sourcepath target\<i>config</i>-src
+ -d target\<i>config</i>-classes
+ target\<i>config</i>-src\com\acme\prj2\*.java</pre>
+
+ <p>Java compiler repo:</p>
+
+ <pre>javac -classpath prj1-repo.jar;target\repo-classes
+ -sourcepath target\repo-src
+ -d target\repo-classes
+ target\repo-src\com\acme\prj2\*.java</pre>
+
+ <hr />
+
+ <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
+ src="resources/images/sflogo.png" width="125" /></a></div>
+
+ <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JContractS at SourceForge.net</a></p>
+ </body>
+</html>
Added: trunk/site/contractInheritance.html
===================================================================
--- trunk/site/contractInheritance.html (rev 0)
+++ trunk/site/contractInheritance.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,149 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Documentation - Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu"><a href="index.html">Home</a></li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu"><a href="download.html">Download</a></li>
+
+ <li class="menu"><a href="license.html">License</a></li>
+ </ul>
+
+ <h1>Contract inheritance</h1>
+
+ <h2>The basics</h2>
+
+ <p>The contracts of a base type are automatically inherited by suptypes. This is very straightforward:</p>
+
+ <ul>
+ <li>the preconditons of methods are inherited by overriding methods;</li>
+ <li>the postconditons of methods are inherited by overriding methods;</li>
+ <li>the invariant is inherited by the subtype.</li>
+ </ul>
+
+
+ <p>In addition, subtypes are allowed to extend the contracts of their base types. A subtype can:</p>
+
+ <ul>
+ <li>make the preconditons less strict (called <i>weakening</i>);</li>
+ <li>make the postconditons stricter (called <i>strengthening</i>);</li>
+ <li>extend the invariant with assertions about the new attributes.</li>
+ </ul>
+
+ <p>Each of these extensions is described below.</p>
+
+ <h2><a name="inheritingMultipleTimes" />Inheriting the same method from multiple types</h2>
+
+ <p>When the same method is inherited from multiple types it is impossible to generate correct pre-
+ and postconditions for the overriding method. The combination of preconditions (the same effect as
+ <a href="#weakening">weakening</a>, see below) makes the overriding method too permissive about
+ parameters passed by clients of the base types. And the combination of postconditions (the same effect
+ as <a href="#strengthening">strengthening</a>) can cause valid return values for a base type to be
+ rejected. It is even possible that all return values are rejected because no value can satisfy the
+ combination of postconditions.</p>
+
+ <p>Because of this issue inheritance of the same method from multiple types is not allowed.</p>
+
+ <p>Here is an example showing how the combination of pre- and postconditions would lead to unwanted
+ results. This is the method declaration from the first base type:</p>
+
+ <pre>/**
+ * @pre v >= 10
+ * @post return <= 0
+ */
+int someCalculation(int v);</pre>
+
+ <p>And this is the method declaration from the second base type:</p>
+
+ <pre>/**
+ * @pre v <= 0
+ * @post return > 100
+ */
+int someCalculation(int v);</pre>
+
+ <p>If a class is a subtype of both base types, simply combining the pre- and postconditions will
+ lead to the following pre- and postcondition:</p>
+
+ <pre>/**
+ * @pre (v >= 10) | (v <= 0)
+ * @post (return <= 0) & (return > 100)
+ */
+public int someCalculation(int v)
+{
+ ...
+}</pre>
+
+ <p>Due to the way the preconditions are combined, a client of the first base type that invokes
+ <code>someCalculation</code> cannot only pass values greater than or equal to 10, but can also pass values
+ less than or equal to zero without a problem. However the values less than or equal should not be accepted
+ because the contract of the first base type does not allow them. If the client does pass values less than or
+ equal to zero it contains a bug, but this bug cannot detected.</p>
+
+ <p>The combination of postconditions prevents this method from returning any result at all as there is no
+ integer that is both less than or equal to zero, and greater than one hundred.</p>
+
+ <h2><a name="weakening" />Weakening preconditions</h2>
+
+ <p>Preconditions of a base type and a subtype are combined using a logical <i>or</i> to construct the actual
+ precondition of the subtype. This makes the actual precondition less restrictive, hence the term
+ <i>weakening</i>:</p>
+
+ <pre>(precondition base type) | (precondition subtype)</pre>
+
+ <p>Weakening the preconditions of a base type can lead to unexpected results. Code that has been tested against
+ a weakened type could use parameter values that are not acceptable to the contracts of the base type. When the
+ implementation is changed to an unweakened one, new contract violations can be detected. For this reason, it is
+ advisable to never weaken preconditions. This is the same issue as inheriting preconditions from multiple base
+ types. See <a href="#inheritingMultipleTimes"><i>inheriting the same method from multiple types</i></a> above
+ for an example.</p>
+
+ <h2><a name="strengthening" />Strengthening postconditions</h2>
+
+ <p>The term <i>strengthening</i> is used because the way in which postconditions of a base type and a subtype are
+ combined makes the actual postcondition of the subtype more restrictive than the original two. Postconditions
+ are combined by using a logical <i>and</i>:</p>
+
+ <pre>(postcondition base type) & (postcondition subtype)</pre>
+
+ <p>When you strengthen a postcondition there are some things you have to take into account.</p>
+
+ <p>It is your responsibility to make sure postconditions in subtypes do not strengthen the postcondition in such a
+ way that all return values become invalid.</p>
+
+ <p>Clients of a method that invoke strengthened methods will only receive a subset of the possible results of the
+ original method. This means you cannot test your client with all possible return values, so bugs (instead of
+ contract violations) might surface if the implementation is changed to one that does return all possible values.</p>
+
+ <h2>Invariants</h2>
+
+ <p>Invariants are combined in the same way as postconditions: by using a logical <i>and</i>. However, the term
+ <i>strengthening</i> is not used for invariants because (in general) an invariant of a subtype only has assertions
+ about the attributes and methods introduced in that subtype. The restrictions on the members of the base type
+ are not altered:</p>
+
+ <pre>(invariant base type) & (invariant subtype)</pre>
+
+ <hr />
+
+ <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
+ src="resources/images/sflogo.png" width="125" /></a></div>
+
+ <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JContractS at SourceForge.net</a></p>
+ </body>
+</html>
Modified: trunk/site/documentation.html
===================================================================
--- trunk/site/documentation.html 2008-05-09 17:08:10 UTC (rev 48)
+++ trunk/site/documentation.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -27,8 +27,20 @@
<h1>Documentation</h1>
- <p>The documentation for the command-line tool and the reference of the contract syntax will appear here soon.</p>
+ <ul>
+ <li>
+ <a href="building.html">Building projects</a>
+ </li>
+ <li>
+ <a href="addingContracts.html">Adding contracts</a>
+ </li>
+
+ <li>
+ <a href="contractInheritance.html">Contract inheritance</a>
+ </li>
+ </ul>
+
<hr />
<div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
@@ -36,4 +48,4 @@
<p><a href="http://sourceforge.net/projects/jcontracts">The project page of JcontractS at SourceForge.net</a></p>
</body>
-</html>
\ No newline at end of file
+</html>
Deleted: trunk/site/download.html
===================================================================
--- trunk/site/download.html 2008-05-09 17:08:10 UTC (rev 48)
+++ trunk/site/download.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <title>Download - Java Contract Suite</title>
-
- <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
-
- <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
- </head>
-
- <body>
- <ul class="menu">
- <li class="menu"><a href="index.html">Home</a></li>
-
- <li class="menu"><a href="roadmap.html">Roadmap</a></li>
-
- <li class="menu"><a href="documentation.html">Documentation</a></li>
-
- <li class="menu"><a href="participate.html">Participate</a></li>
-
- <li class="menu">Download</li>
-
- <li class="menu"><a href="license.html">License</a></li>
- </ul>
-
- <h1>Download</h1>
-
- <p>The current release is v1.01.00b01. It is practically the same as the JAR compiled by John Swapceinski which is
- available from <a href="http://www.icontract2.org/">http://www.icontract2.org/</a>, but the classes have been
- moved to another package. You can download the release from the <a
- href="https://sourceforge.net/project/showfiles.php?group_id=175492">file releases page of the project</a>.</p>
-
- <p>At the same page you can also download the original JAR files (package <i>icontract</i>), the source code of
- the original JAR for JDK 1.2 which has been modified so it builds using a modern version of Java (package
- <i>icontract2</i>), and the JAR built from this source code (package <i>icontract2</i>).</p>
-
- <hr />
-
- <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
- src="resources/images/sflogo.png" width="125" /></a></div>
-
- <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JcontractS at SourceForge.net</a></p>
- </body>
-</html>
\ No newline at end of file
Added: trunk/site/download.html
===================================================================
--- trunk/site/download.html (rev 0)
+++ trunk/site/download.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Download - Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu"><a href="index.html">Home</a></li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu">Download</li>
+
+ <li class="menu"><a href="license.html">License</a></li>
+ </ul>
+
+ <h1>Download</h1>
+
+ <p>The current release is v1.01.00b02. It is a cleaned up version of the reverse engineered JAR with as much
+ functionality as possible removed to make the code simpler. The code also has been moved to another package.
+ You can download the release from the <a href="https://sourceforge.net/project/showfiles.php?group_id=175492">file
+ releases page of JContractS</a>.</p>
+
+ <p>At the same page you can also download the original JAR files (package <i>icontract</i>), the source code of
+ the original JAR for JDK 1.2 which has been modified so it builds using a modern version of Java (package
+ <i>icontract2</i>), and the JAR built from this source code (package <i>icontract2</i>).</p>
+
+ <hr />
+
+ <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
+ src="resources/images/sflogo.png" width="125" /></a></div>
+
+ <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JContractS at SourceForge.net</a></p>
+ </body>
+</html>
Deleted: trunk/site/index.html
===================================================================
--- trunk/site/index.html 2008-05-09 17:08:10 UTC (rev 48)
+++ trunk/site/index.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -1,81 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <title>Welcome to Java Contract Suite</title>
-
- <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
-
- <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
- </head>
-
- <body>
- <ul class="menu">
- <li class="menu">Home</li>
-
- <li class="menu"><a href="roadmap.html">Roadmap</a></li>
-
- <li class="menu"><a href="documentation.html">Documentation</a></li>
-
- <li class="menu"><a href="participate.html">Participate</a></li>
-
- <li class="menu"><a href="download.html">Download</a></li>
-
- <li class="menu"><a href="license.html">License</a></li>
- </ul>
-
- <h1>Introduction</h1>
-
- <p>Java Contract Suite (JcontractS) is a resurrection of the iContract tool originally developed by Reto Kramer of
- Reliable Systems. John Swapceinski started the resurrection by decompiling the original JAR files, and making the
- sources compile with JDK 1.4 and higher. The result of his work can be found on <a
- href="http://www.icontract2.org/">www.icontract2.org</a>.</p>
-
- <p>Johan Stuyts started the SourceForge.net project so proper further development of the project can take
- place.</p>
-
- <p>The project is being setup at the moment. More information will appear soon. If you cannot wait you can grab
- the source from the Subversion repository. Follow the instructions on the <a
- href="https://sourceforge.net/svn/?group_id=175492">Subversion page of the project</a>.</p>
-
- <h1>Goals</h1>
-
- <p>Java Contract Suite aims to be Design by Contract implementation for Java 1.4 source code. Support for source
- code of higher Java versions will be added in the future.</p>
-
- <p>Even though there have been a number of Design by Contract implementations in the past, the adoption of Design
- by Contract has been minimal. To accelerate adoption the project is available under the liberal Apache License
- Version 2.0, and will try to provide tasks/extensions/plugins for as many development tools as possible.</p>
-
- <h1>Why iContract?</h1>
-
- <p>There were other, more active Design by Contract implementations than iContract when it was resurrected. Below
- are the reasons for choosing iContract instead of another implementation.</p>
-
- <p>With iContract the code and the contracts are kept in the same location. The invariants, preconditions and
- postconditions are added to the Javadoc of the classes and methods. You don't have to switch between two files
- constantly during development.</p>
-
- <p>The syntax used by iContract is clean and terse. It is easy to read and understand for people who have never
- used iContract before.</p>
-
- <p>iContract supports Java 1.4. Some other implementations make use of annotations, which require Java 5 or
- higher.</p>
-
- <p>There is no need for JVM parameters, JVM agents, specific class loaders and/or specific frameworks. The classes
- built with iContract can be used as is in any deployment environment.</p>
-
- <h1>Other implementations</h1>
-
- <p>See the <a href="http://en.wikipedia.org/wiki/Design_by_contract">Design by Contract page at Wikipedia</a> for
- a list of Design by Contract implementations for Java (and other languages).</p>
-
- <hr />
-
- <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
- src="resources/images/sflogo.png" width="125" /></a></div>
-
- <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JcontractS at SourceForge.net</a></p>
- </body>
-</html>
\ No newline at end of file
Added: trunk/site/index.html
===================================================================
--- trunk/site/index.html (rev 0)
+++ trunk/site/index.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>Welcome to Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu">Home</li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu"><a href="download.html">Download</a></li>
+
+ <li class="menu"><a href="license.html">License</a></li>
+ </ul>
+
+ <h1>Introduction</h1>
+
+ <p>Java Contract Suite (JContractS) is a resurrection of the iContract tool originally developed by Reto Kramer of
+ Reliable Systems. John Swapceinski started the resurrection by decompiling the original JAR files, and making the
+ sources compile with JDK 1.4 and higher. The result of his work can be found on <a
+ href="http://www.icontract2.org/">www.icontract2.org</a>.</p>
+
+ <p>Johan Stuyts started the SourceForge.net project so proper further development of the project can take
+ place.</p>
+
+ <h1>Goals</h1>
+
+ <p>Java Contract Suite aims to be Design by Contract implementation for Java 1.4 source code. Support for source
+ code of higher Java versions will be added in the future.</p>
+
+ <p>Even though there have been a number of Design by Contract implementations in the past, the adoption of Design
+ by Contract has been minimal. To accelerate adoption the project is available under the liberal Apache License
+ Version 2.0, and will try to provide tasks/extensions/plugins for as many development tools as possible.</p>
+
+ <h1>Why iContract?</h1>
+
+ <p>There were other, more active Design by Contract implementations than iContract when it was resurrected. Below
+ are the reasons for choosing iContract instead of another implementation.</p>
+
+ <p>With iContract the code and the contracts are kept in the same location. The invariants, preconditions and
+ postconditions are added to the Javadoc of the classes and methods. You don't have to switch between two files
+ constantly during development.</p>
+
+ <p>The syntax used by iContract is clean and terse. It is easy to read and understand for people who have never
+ used iContract before.</p>
+
+ <p>iContract supports Java 1.4. Some other implementations make use of annotations, which require Java 5 or
+ higher.</p>
+
+ <p>There is no need for JVM parameters, JVM agents, specific class loaders and/or specific frameworks. The classes
+ built with iContract can be used as is in any deployment environment.</p>
+
+ <h1>Other implementations</h1>
+
+ <p>See the <a href="http://en.wikipedia.org/wiki/Design_by_contract">Design by Contract page at Wikipedia</a> for
+ a list of Design by Contract implementations for Java (and other languages).</p>
+
+ <hr />
+
+ <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
+ src="resources/images/sflogo.png" width="125" /></a></div>
+
+ <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JContractS at SourceForge.net</a></p>
+ </body>
+</html>
\ No newline at end of file
Deleted: trunk/site/license.html
===================================================================
--- trunk/site/license.html 2008-05-09 17:08:10 UTC (rev 48)
+++ trunk/site/license.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -1,167 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html>
- <head>
- <title>License - Java Contract Suite</title>
-
- <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
-
- <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
- </head>
-
- <body>
- <ul class="menu">
- <li class="menu"><a href="index.html">Home</a></li>
-
- <li class="menu"><a href="roadmap.html">Roadmap</a></li>
-
- <li class="menu"><a href="documentation.html">Documentation</a></li>
-
- <li class="menu"><a href="participate.html">Participate</a></li>
-
- <li class="menu"><a href="download.html">Download</a></li>
-
- <li class="menu">License</li>
- </ul>
-
- <h1>License</h1>
-
- <p class="licensetitle">Apache License<br />Version 2.0, January 2004<br />http://www.apache.org/licenses/</p>
-
- <p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
-
- <ol>
- <li><p>Definitions.</p><p>"License" shall mean the terms and conditions for use, reproduction, and distribution
- as defined by Sections 1 through 9 of this document.</p><p>"Licensor" shall mean the copyright owner or entity
- authorized by the copyright owner that is granting the License.</p><p>"Legal Entity" shall mean the union of the
- acting entity and all other entities that control, are controlled by, or are under common control with that
- entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent
- (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p><p>"You" (or "Your")
- shall mean an individual or Legal Entity exercising permissions granted by this License.</p><p>"Source" form
- shall mean the preferred form for making modifications, including but not limited to software source code,
- documentation source, and configuration files.</p><p>"Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but not limited to compiled object code, generated
- documentation, and conversions to other media types.</p><p>"Work" shall mean the work of authorship, whether in
- Source or Object form, made available under the License, as indicated by a copyright notice that is included in
- or attached to the work (an example is provided in the Appendix below).</p><p>"Derivative Works" shall mean any
- work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial
- revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of
- authorship. For the purposes of this License, Derivative Works shall not include works that remain separable
- from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works
- thereof.</p><p>"Contribution" shall mean any work of authorship, including the original version of the Work and
- any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
- Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
- submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
- electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
- limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
- that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner
- as "Not a Contribution."</p><p>"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of
- whom a Contribution has been received by Licensor and subsequently incorporated within the Work.</p></li>
-
- <li><p>Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby
- grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
- reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work
- and such Derivative Works in Source or Object form.</p></li>
-
- <li><p>Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby
- grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
- this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the
- Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily
- infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
- Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or
- counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes
- direct or contributory patent infringement, then any patent licenses granted to You under this License for that
- Work shall terminate as of the date such litigation is filed.</p></li>
-
- <li><p>Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any
- medium, with or without modifications, and in Source or Object form, provided that You meet the following
- conditions:</p><ol style="list-style-type: lower-latin;">
- <li><p>You must give any other recipients of the Work or Derivative Works a copy of this License;
- and</p></li>
-
- <li><p>You must cause any modified files to carry prominent notices stating that You changed the files;
- and</p></li>
-
- <li><p>You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
- patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do
- not pertain to any part of the Derivative Works; and</p></li>
-
- <li><p>If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
- You distribute must include a readable copy of the attribution notices contained within such NOTICE file,
- excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the
- following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source
- form or documentation, if provided along with the Derivative Works; or, within a display generated by the
- Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file
- are for informational purposes only and do not modify the License. You may add Your own attribution notices
- within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work,
- provided that such additional attribution notices cannot be construed as modifying the License.</p></li>
- </ol><p>You may add Your own copyright statement to Your modifications and may provide additional or different
- license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such
- Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies
- with the conditions stated in this License.</p></li>
-
- <li><p>Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally
- submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this
- License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede
- or modify the terms of any separate license agreement you may have executed with Licensor regarding such
- Contributions.</p></li>
-
- <li><p>Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or
- product names of the Licensor, except as required for reasonable and customary use in describing the origin of
- the Work and reproducing the content of the NOTICE file.</p></li>
-
- <li><p>Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the
- Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
- ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE,
- NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
- determining the appropriateness of using or redistributing the Work and assume any risks associated with Your
- exercise of permissions under this License.</p></li>
-
- <li><p>Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence),
- contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
- agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect,
- special, incidental, or consequential damages of any character arising as a result of this License or out of the
- use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage,
- computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.</p></li>
-
- <li><p>Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof,
- You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability
- obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You
- agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted
- against, such Contributor by reason of your accepting any such warranty or additional liability.</p></li>
- </ol>
-
- <p>END OF TERMS AND CONDITIONS</p>
-
- <p>APPENDIX: How to apply the Apache License to your work.</p>
-
- <p style="margin-left: 2em;">To apply the Apache License to your work, attach the following boilerplate notice,
- with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the
- brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend
- that a file or class name and description of purpose be included on the same "printed page" as the copyright
- notice for easier identification within third-party archives.</p>
-
- <p>Copyright [yyyy] [name of copyright owner]</p>
-
- <p>Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at</p>
-
- <p style="margin-left: 2em;">http://www.apache.org/licenses/LICENSE-2.0</p>
-
- <p>Unless required by applicable law or agreed to in writing, software distributed under the License is
- distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- License for the specific language governing permissions and limitations under the License.</p>
-
- <hr />
-
- <div class="sourceforge-logo"><a href="http://sourceforge.net"><img alt="SourceForge.net Logo" height="37"
- src="resources/images/sflogo.png" width="125" /></a></div>
-
- <p><a href="http://sourceforge.net/projects/jcontracts">The project page of JcontractS at SourceForge.net</a></p>
- </body>
-</html>
\ No newline at end of file
Added: trunk/site/license.html
===================================================================
--- trunk/site/license.html (rev 0)
+++ trunk/site/license.html 2008-05-09 17:08:59 UTC (rev 49)
@@ -0,0 +1,167 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html>
+ <head>
+ <title>License - Java Contract Suite</title>
+
+ <link href="resources/stylesheets/jcontracts.css" rel="stylesheet" type="text/css" />
+
+ <link href="favicon.ico" rel="shortcut icon" type="image/x-icon" />
+ </head>
+
+ <body>
+ <ul class="menu">
+ <li class="menu"><a href="index.html">Home</a></li>
+
+ <li class="menu"><a href="roadmap.html">Roadmap</a></li>
+
+ <li class="menu"><a href="documentation.html">Documentation</a></li>
+
+ <li class="menu"><a href="participate.html">Participate</a></li>
+
+ <li class="menu"><a href="download.html">Download</a></li>
+
+ <li class="menu">License</li>
+ </ul>
+
+ <h1>License</h1>
+
+ <p class="licensetitle">Apache License<br />Version 2.0, January 2004<br />http://www.apache.org/licenses/</p>
+
+ <p>TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION</p>
+
+ <ol>
+ <li><p>Definitions.</p><p>"License" shall mean the terms and conditions for use, reproduction, and distribution
+ as defined by Sections 1 through 9 of this document.</p><p>"Licensor" shall mean the copyright owner or entity
+ authorized by the copyright owner that is granting the License.</p><p>"Legal Entity" shall mean the union of the
+ acting entity and all other entities that control, are controlled by, or are under common control with that
+ entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent
+ (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.</p><p>"You" (or "Your")
+ shall mean an individual or Legal Entity exercising permissions granted by this License.</p><p>"Source" form
+ shall mean the preferred form for making modifications, including but not limited to software source code,
+ documentation source, and configuration files.</p><p>"Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but not limited to compiled object code, generated
+ documentation, and conversions to other media types.</p><p>"Work" shall mean the work of authorship, whether in
+ Source or Object form, made available under the License, as indicated by a copyright notice that is included in
+ or attached to the work (an example is provided in the Appendix below).</p><p>"Derivative Works" shall mean any
+ work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial
+ revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of
+ authorship. For the purposes of this License, Derivative Works shall not include works that remain separable
+ from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works
+ thereof.</p><p>"Contribution" shall mean any work of authorship, including the original version of the Work and
+ any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to
+ Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to
+ submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of
+ electronic, verbal, or written communication sent to the Licensor or its representatives, including but not
+ limited to communication on electronic mailing lists, source code control systems, and issue tracking systems
+ that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner
+ as "Not a Contribution."</p><p>"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of
+ whom a Contribution has been received by Licensor and subsequently incorporated within the Work.</p></li>
+
+ <li><p>Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to
+ reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work
+ and such Derivative Works in Source or Object form.</p></li>
+
+ <li><p>Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby
+ grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
+ this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the
+ Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily
+ infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such
+ Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or
+ counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes
+ direct or contributory patent infringement, then any patent licenses granted to You under this License for that
+ Work shall terminate as of the date such litigation is filed.</p></li>
+
+ <li><p>Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any
+ medium, with or without modifications, and in Source or Object form, provided that You meet the following
+ conditions:</p><ol style="list-style-type: lower-latin;">
+ <li><p>You must give any other recipients of the Work or Derivative Works a copy of this License;
+ and</p></li>
+
+ <li><p>You must cause any modified files to carry prominent notices stating that You changed the files;
+ and</p></li>
+
+ <li><p>You must retain, in the Source form of any Derivative Works that You distribute, all copyright,
+ patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do
+ not pertain to any part of the Derivative Works; and</p></li>
+
+ <li><p>If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that
+ You distribute must include a readable copy of the attribution notices contained within such NOTICE file,
+ excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the
+ following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source
+ form or documentation, if provided along with the Derivative Works; or, within a display generated by the
+ Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file
+ are for informational purposes only and do not modify the License. You may add Your own attribution notices
+ within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work,
+ provided that such additional attribution notices cannot be construed as modifying the License.</p></li>
+ </ol><p>You may add Your own copyright statement to Your modifications and may provide additional or different
+ license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such
+ Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies
+ with the conditions stated in this License.</p></li>
+
+ <li><p>Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally
+ submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this
+ License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede
+ or modify the terms of any separate license agreement you may have executed with Licensor regarding such
+ Contributions.</p></li>
+
+ <li><p>Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or
+ product names of the Licensor, except as required for reasonable and customary use in describing the origin of
+ the Work and reproducing the content of the NOTICE file.</p></li>
+
+ <li><p>Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the
+ Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
+ ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE,
+ NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for
+ determining the appropriateness of using or redistributing the Work and assume any risks associated with Your
+ exercise of permissions under this License.</p></li>
+
+ <li><p>Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence),
+ contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or
+ agreed to in writing, shall an...
[truncated message content] |
|
From: <js...@us...> - 2008-05-09 17:08:18
|
Revision: 48
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=48&view=rev
Author: jstuyts
Date: 2008-05-09 10:08:10 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed obsolote options.
Removed unused classes.
Some small code cleanups.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java
trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/icontract/Option.java
trunk/source/java/net/sf/jcontracts/icontract/Repository.java
trunk/source/java/net/sf/jcontracts/icontract/Tool.java
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java
trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
trunk/source/java/net/sf/jcontracts/icontract/Internal0Option.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheckCallOption.java
trunk/source/java/net/sf/jcontracts/icontract/NoInitialCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/NoRepositoryCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/OneOneOption.java
trunk/source/java/net/sf/jcontracts/icontract/QuietOption.java
trunk/source/java/net/sf/jcontracts/icontract/SourceCompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/VerboseOption.java
trunk/source/java/net/sf/jcontracts/icontract/WrapExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/XOption.java
trunk/source/java/net/sf/jcontracts/icontract/util/
trunk/source/java/net/sf/jcontracts/util/
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -185,7 +185,8 @@
Token j = null;
j = LT(1);
match(6);
- TargetMetaclass t = getMetaclassFactory().newTarget(j.getText());
+ String tokenText = j.getText();
+ TargetMetaclass t = getMetaclassFactory().newTarget(tokenText);
return t;
}
Modified: trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -34,30 +34,10 @@
{
o = new HelpOption(name, parameters);
}
- else if (name.compareTo("v") == 0)
- {
- o = new VerboseOption(name, parameters);
- }
- else if (name.compareTo("c") == 0)
- {
- o = new CompilerOption(name, parameters);
- }
- else if (name.compareTo("b") == 0)
- {
- o = new SourceCompilerOption(name, parameters);
- }
- else if (name.compareTo("n") == 0)
- {
- o = new NoRepositoryCompilationOption(name, parameters);
- }
else if (name.compareTo("o") == 0)
{
o = new OutputOption(name, parameters);
}
- else if (name.compareTo("y") == 0)
- {
- o = new OneOneOption(name, parameters);
- }
else if (name.compareTo("k") == 0)
{
o = new RepositoryOutputOption(name, parameters);
@@ -66,42 +46,14 @@
{
o = new DefaultExceptionOption(name, parameters);
}
- else if (name.compareTo("r") == 0)
- {
- o = new CleanOption(name, parameters);
- }
else if (name.compareTo("m") == 0)
{
o = new MergeOption(name, parameters);
}
- else if (name.compareTo("i") == 0)
- {
- o = new InvCheckCallOption(name, parameters);
- }
- else if (name.compareTo("w") == 0)
- {
- o = new WrapExceptionOption(name, parameters);
- }
- else if (name.compareTo("q") == 0)
- {
- o = new QuietOption(name, parameters);
- }
else if (name.compareTo("a") == 0)
{
o = new AllOption(name, parameters);
}
- else if (name.compareTo("x") == 0)
- {
- o = new XOption(name, parameters);
- }
- else if (name.compareTo("Z") == 0)
- {
- o = new Internal0Option(name, parameters);
- }
- else if (name.compareTo("j") == 0)
- {
- o = new NoInitialCompilationOption(name, parameters);
- }
else
{
throw new RuntimeException("Java Contract Suite: error: unknown option -" + name);
Modified: trunk/source/java/net/sf/jcontracts/icontract/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Class.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/Class.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -43,10 +43,6 @@
public static final char EXCEPTION_CLASS_MARKER = 35;
- public static boolean generateSuperCheckCallFlag = false;
-
- public static boolean doWrapExceptionOptionFlag = false;
-
public static String defaultExceptionClassName = "RuntimeException";
public Class(String name, String filename, int line_number)
@@ -335,10 +331,7 @@
throw new RuntimeException("Java Contract Suite:error: more than 4 arguments (" + f
+ ") not supported at the moment [991]. Easy to be added though.");
}
- else
- {
- return m;
- }
+ return m;
}
public Vector getAllNonImplementedMethods()
@@ -693,7 +686,7 @@
super_interfaces = new Vector();
}
boolean inv_check_method_exists = false;
- if (generateSuperCheckCallFlag && supercName != null)
+ if (supercName != null)
{
String invCheckMethodName = supercName.replace('.', '_');
invCheckMethodName = "__check_invariant____" + invCheckMethodName;
@@ -743,15 +736,8 @@
}
}
}
- if (generateSuperCheckCallFlag)
+ if (supercName != null && !inv_check_method_exists)
{
- if (supercName != null && !inv_check_method_exists)
- {
- super_interfaces.insertElementAt(supercName, 0);
- }
- }
- else if (supercName != null)
- {
super_interfaces.insertElementAt(supercName, 0);
}
if (getParent() != null)
@@ -844,10 +830,10 @@
Vector closure_source = new Vector();
for (int i = 0; i < inv_conds.size(); i++)
{
- if (!closure_conds.contains((String) inv_conds.elementAt(i)))
+ if (!closure_conds.contains(inv_conds.elementAt(i)))
{
- closure_conds.addElement((String) inv_conds.elementAt(i));
- closure_source.addElement((String) inv_source.elementAt(i));
+ closure_conds.addElement(inv_conds.elementAt(i));
+ closure_source.addElement(inv_source.elementAt(i));
}
else
{
@@ -894,35 +880,20 @@
String inst_var_decl = "// Keeps track of calling chain to avoid recursive invariant checks.\n";
inst_var_decl = inst_var_decl + "// Avoids inv checks in public methods that are called from private ones.\n";
inst_var_decl = inst_var_decl + "// Stores bookkeeping information -- key: thread, value: call level\n";
- boolean do_not_enforce_precompilation_of_source = Boolean
- .getBoolean("jcontracts.internal.do_not_enforce_precompilation_of_source");
- if (do_not_enforce_precompilation_of_source)
- {
- System.err
- .println("Java Contract Suite:SWITCH:jcontracts.internal.do_not_enforce_precompilation_of_source=true");
- }
boolean icl_already_defined = false;
- if (!do_not_enforce_precompilation_of_source)
+ try
{
- try
- {
- icl_already_defined = checkIfFieldExistsInSuperclassClosure(java.lang.Class.forName(getName()),
- "__icl_");
- }
- catch (ClassNotFoundException _ex)
- {
- throw new RuntimeException(
- getLocationDescription()
- + "Java Contract Suite: ERROR: could not find "
- + getName()
- + ". Please compile the sourcefile, see -j option (Java Contract Suite needs the compiled file to determine whether or not to create invariant bookkeeping variables (__icl_)). Exiting Java Contract Suite.",
- _ex);
- }
+ icl_already_defined = checkIfFieldExistsInSuperclassClosure(java.lang.Class.forName(getName()),
+ "__icl_");
}
- if (do_not_enforce_precompilation_of_source)
+ catch (ClassNotFoundException _ex)
{
- System.err
- .println("Java Contract Suite: SWITCH:invariant bookkeeping may NOT work correctly because the check for the existence of the __icl_ variable in superclasses was disables. This means that there is an __icl_ varaible at each level of the inheritance rather than one and one only per inheritance chain! THIS IS ONLY SUITABLE FOR CERTAIN SPECIAL TESTCASES. REMOVE the 'java -Djcontracts.internal.do_not_enforce_precompilation_of_source' property to make Java Contract Suite work in normal (correct) mode!");
+ throw new RuntimeException(
+ getLocationDescription()
+ + "Java Contract Suite: ERROR: could not find "
+ + getName()
+ + ". Please compile the sourcefile (Java Contract Suite needs the compiled file to determine whether or not to create invariant bookkeeping variables (__icl_)). Exiting Java Contract Suite.",
+ _ex);
}
if (!icl_already_defined)
{
@@ -1011,7 +982,7 @@
header = header + " {";
}
String code = "\n";
- if (generateSuperCheckCallFlag && supercName != null)
+ if (supercName != null)
{
if (inv_check_method_exists)
{
@@ -1117,14 +1088,7 @@
code = "try {" + code;
code = code + "}\n";
- if (!doWrapExceptionOptionFlag)
- {
- code = code + "catch ( " + "RuntimeException" + " ex ) {\n";
- }
- else
- {
- code = code + "catch ( Exception ex ) {\n";
- }
+ code = code + "catch ( Exception ex ) {\n";
code = code + " String msg = \"\";\n";
code = code
+ " if (ex.getClass()=="
@@ -1199,10 +1163,7 @@
{
return Void.TYPE;
}
- else
- {
- return null;
- }
+ return null;
}
public String getTypeOfValue(String value) throws UnableToDetermineTypeException
@@ -1699,9 +1660,9 @@
Vector closure_conds = new Vector();
for (int i = 0; i < inv_conds.size(); i++)
{
- if (!closure_conds.contains((String) inv_conds.elementAt(i)))
+ if (!closure_conds.contains(inv_conds.elementAt(i)))
{
- closure_conds.addElement((String) inv_conds.elementAt(i));
+ closure_conds.addElement(inv_conds.elementAt(i));
}
}
Deleted: trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -1,30 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.icontract;
-
-import java.util.Vector;
-
-public class CleanOption extends ParameterOption
-{
-
- public static final String NAME = "r";
-
- public CleanOption(String name, Vector arguments)
- {
- super(name, arguments);
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -1,239 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.icontract;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import org.apache.log4j.Logger;
-
-import sun.tools.javac.Main;
-
-public class CompilerOption extends ParameterOption
-{
- private static final Logger log = Logger.getLogger(CompilerOption.class);
-
- public static final String NAME = "c";
-
- public CompilerOption(String name, Vector arguments)
- {
- super(name, arguments);
- }
-
- boolean doCompile(Vector fileList, boolean useFilenameOnly)
- {
- boolean result = true;
- if (shallCompile() && fileList.size() > 0)
- {
- String comp = getCompiler();
- boolean useCallToCompiler = comp.startsWith(":");
- if (useCallToCompiler)
- {
- Vector options = new Vector();
- if (comp.indexOf(" ") != -1)
- {
- int lastsp = 1;
- for (int sp = 0; (sp = comp.indexOf(" ", lastsp)) != -1;)
- {
- options.addElement(comp.substring(lastsp, sp).trim());
- lastsp = sp + 1;
- }
-
- options.addElement(comp.substring(lastsp, comp.length()).trim());
- }
- else if (comp.length() > 1)
- {
- options.addElement(comp.substring(1, comp.length()).trim());
- }
- String fargs[] = new String[options.size() + fileList.size()];
- int pos = 0;
- String cmdstr = "";
- for (Enumeration oenum = options.elements(); oenum.hasMoreElements();)
- {
- String o = (String) oenum.nextElement();
- fargs[pos] = o;
- pos++;
- cmdstr = cmdstr + o + " ";
- }
-
- for (Enumeration fenum = fileList.elements(); fenum.hasMoreElements();)
- {
- String fn = (String) fenum.nextElement();
- if (useFilenameOnly)
- {
- File f = new File(fn);
- fn = f.getName();
- }
- fargs[pos] = fn;
- pos++;
- cmdstr = cmdstr + fn + " ";
- }
-
- log.info("javac (sun.tools.javac.Main) " + cmdstr);
- java.io.OutputStream javacout = new ByteArrayOutputStream(1024);
- try
- {
- java.lang.Class.forName("sun.tools.javac.Main");
- Main theCompiler = new Main(javacout, "");
- result = theCompiler.compile(fargs);
- if (!result)
- {
- System.err.println("\nJava Contract Suite: ERROR: compilation failed " + javacout.toString());
- }
- }
- catch (NoClassDefFoundError _ex)
- {
- throw new RuntimeException(
- "Attempt to perform in-process call to sun.tools.javac.Main failed because the class could not be found! In Java-2, make sure that the JDK's tools.jar (contain sun.tools.javac.*) is on your classpath!",
- _ex);
- }
- catch (ClassNotFoundException _ex)
- {
- throw new RuntimeException(
- "Attempt to perform in-process call to sun.tools.javac.Main failed because the class could not be found! In Java-2, make sure that the JDK's tools.jar (contain sun.tools.javac.*) is on your classpath!",
- _ex);
- }
- }
- else
- {
- String files = "";
- for (Enumeration fenum = fileList.elements(); fenum.hasMoreElements();)
- {
- String fn = (String) fenum.nextElement();
- if (useFilenameOnly)
- {
- File f = new File(fn);
- fn = f.getName();
- }
- files = files + fn + " ";
- }
-
- String cmd = getCompiler() + " -source 1.4 " + files;
- log.info(cmd);
- try
- {
- Process child = Runtime.getRuntime().exec(cmd);
- InputStreamReader err = new InputStreamReader(child.getErrorStream());
- StringBuffer errmsg = new StringBuffer();
- if (err != null)
- {
- for (char buffer[] = new char[1]; err.read(buffer, 0, 1) != -1; errmsg.append(buffer[0]))
- {
- }
- }
- else
- {
- errmsg.append(" <could not open err stream to compiler!>");
- }
- InputStreamReader out = new InputStreamReader(child.getInputStream());
- StringBuffer outmsg = new StringBuffer();
- if (out != null)
- {
- for (char buffer[] = new char[1]; out.read(buffer, 0, 1) != -1; outmsg.append(buffer[0]))
- {
- }
- }
- else
- {
- outmsg.append(" <could not open out stream of compiler!>");
- }
- if (child.waitFor() != 0)
- {
- System.err.println("\nJava Contract Suite: ERROR: compilation failed(error code: "
- + child.exitValue() + ") " + errmsg.toString() + " " + outmsg.toString());
- result = false;
- }
- }
- catch (InterruptedException _ex)
- {
- result = false;
- System.err.println("\nJava Contract Suite: ERROR: compilation failed.");
- }
- catch (IOException _ex)
- {
- result = false;
- System.err.println("\nJava Contract Suite: ERROR: compilation failed.");
- }
- }
- if (!result)
- {
- log.info("failed");
- }
- }
- if (!Internal0Option.isActive() && !result)
- {
- log
- .info("deleting instrumented files .java to ensure regeneration and recompilation at the next tool invocation.");
- for (Enumeration fenum = fileList.elements(); fenum.hasMoreElements();)
- {
- String fn = (String) fenum.nextElement();
- File f = new File(fn);
- File fcopy = new File(fn + "_TO_DEBUG");
- try
- {
- FileReader frSource = new FileReader(f);
- FileWriter fwTarget = new FileWriter(fcopy);
- char buffer[] = new char[2048];
- int len = 0;
- try
- {
- while ((len = frSource.read(buffer, 0, 2048)) != -1)
- {
- fwTarget.write(buffer, 0, len);
- }
- }
- finally
- {
- fwTarget.close();
- frSource.close();
- }
- log.info("file with errors copied for debugging: " + fn + "_TO_DEBUG");
- }
- catch (IOException e)
- {
- throw new RuntimeException("Problems copying file " + fn + " to the " + fn + "_TO_DEBUG", e);
- }
- boolean success = f.delete();
- if (!success)
- {
- throw new RuntimeException(
- "the deletion of the instrumented file ("
- + fn
- + ") failed although the tool just generated it a split second ago itself - were the permissions changed?");
- }
- }
-
- }
- return result;
- }
-
- String getCompiler()
- {
- return (String) getArguments().firstElement();
- }
-
- boolean shallCompile()
- {
- return getArguments().size() > 0;
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Darwin.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/Darwin.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -1,255 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.icontract;
-
-import java.lang.reflect.Constructor;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import net.sf.jcontracts.argparser.Parser;
-import net.sf.jcontracts.codeparser.CodeMetaclass;
-import net.sf.jcontracts.codeparser.CodeMetaclassCache;
-import net.sf.jcontracts.codeparser.DottyVisitor;
-import net.sf.jcontracts.codeparser.DottyVisitorConstants;
-import net.sf.jcontracts.codeparser.IDependencyFilter;
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-import org.apache.log4j.Logger;
-
-public class Darwin
-{
- private static final Logger log = Logger.getLogger(Darwin.class);
-
- public static boolean process(String args[], Vector specset, boolean layoutLR, boolean directed,
- String outputfilename, boolean check, int componentDetailLevel, boolean showPackages, Vector quietList,
- Vector allFiles, Vector changedFiles, String srcbase, boolean do_not_show_dependecy_details,
- IDependencyFilter filter) throws Exception
- {
- String recent_file = null;
- try
- {
- Vector options;
- Vector targets;
- if (args.length != 0)
- {
- String s = "";
- for (int i = 0; i < args.length; i++)
- {
- if (args[i].startsWith("-") && args[i].indexOf(" ") != -1)
- {
- s = s + args[i].substring(0, 2) + "\"" + args[i].substring(2, args[i].length()) + "\" ";
- }
- else
- {
- s = s + args[i] + " ";
- }
- }
-
- Parser argParser = new Parser(s);
- argParser.setMetaclassFactory(new ArgMetaclassFactory());
- argParser.doParse();
- options = argParser.getOptions();
- targets = argParser.getTargets();
- if (targets.isEmpty())
- {
- System.err.println("iDarwin: list of source files empty, reading from standard input.");
- targets.addElement(new SystemInTarget());
- }
- else
- {
- Vector newTargets = new Vector();
- for (int i = 0; i < targets.size(); i++)
- {
- Target ft = (Target) targets.elementAt(i);
- for (Enumeration e = ft.expand().elements(); e.hasMoreElements(); newTargets.addElement(e
- .nextElement()))
- {
- }
- }
-
- targets = newTargets;
- }
- }
- else
- {
- options = new Vector();
- options.addElement(new HelpOption("h", new Vector()));
- targets = new Vector();
- targets.addElement(new SystemInTarget());
- }
- for (int i = 0; i < options.size(); i++)
- {
- if (!((Option) options.elementAt(i)).doesProcessing())
- {
- ((ParameterOption) options.elementAt(i)).activateOnTargets(targets);
- }
- }
-
- log.info("iDarwin, Version 0.1a");
- log.info("Copyright (C) 1997-1999 Reto Kramer");
- log.info("Copyright (C) 2006 John Swapceinski, Johan\xA0Stuyts");
- log.info("options:" + options);
- log.info("all files:" + targets);
- if (targets.isEmpty())
- {
- throw new RuntimeException(
- "iDarwin: error list of source files is empty or no matches for pattern(s), no files to process!");
- }
- log.info("parsing input files to determine dependencies.");
- IArchitectureSpecification totalArchSpec = null;
- if (check)
- {
- boolean atleastone = false;
- for (Enumeration e = specset.elements(); e.hasMoreElements();)
- {
- String spec = (String) e.nextElement();
- if (!atleastone && spec.length() > 0)
- {
- atleastone = true;
- }
- int currentStart = spec.indexOf("<idarwin language=");
- String languageFactory = null;
- String body = null;
- while (currentStart != -1 && spec.indexOf("<idarwin language=", currentStart) != -1)
- {
- if (spec.indexOf("<idarwin language=", currentStart) != -1
- && spec.indexOf("</idarwin>", currentStart) == -1)
- {
- throw new RuntimeException("iDarwin: error missing tag: </idarwin> in\n" + spec);
- }
- int equalPos = spec.indexOf("<idarwin language=", currentStart) + "<idarwin language=".length();
- int closingPos = spec.indexOf(">", equalPos);
- if (closingPos == -1)
- {
- throw new RuntimeException(
- "iDarwin: error missing the closing '>' after the tag '<idarwin language=' in\n"
- + spec);
- }
- languageFactory = spec.substring(equalPos, closingPos);
- int end = spec.indexOf("</idarwin>", currentStart);
- if (end != -1)
- {
- body = spec.substring(closingPos + 1, end);
- currentStart = spec.indexOf("<idarwin language=", currentStart + 1);
- }
- else
- {
- throw new RuntimeException("iDarwin: error missing tag: </idarwin> in\n" + spec);
- }
- String mName = "newArchitectureSpecification";
- java.lang.Class cl = java.lang.Class.forName(languageFactory);
- java.lang.Class noArgArray[] = new java.lang.Class[0];
- Constructor theDefaultConstructor = cl.getConstructor(noArgArray);
- Object noinitargs[] = new Object[0];
- Object o = theDefaultConstructor.newInstance(noinitargs);
- java.lang.reflect.Method theMethod = cl.getMethod(mName, noArgArray);
- IArchitectureSpecification archspec = (IArchitectureSpecification) theMethod.invoke(o,
- noArgArray);
- if (archspec == null)
- {
- throw new RuntimeException(
- "iDarwin: error the architecture specification is null - error in the implementation of the language factory (newArchitectureSpecification() must not return null)");
- }
- archspec.parseFrom(body);
- if (totalArchSpec == null)
- {
- totalArchSpec = archspec;
- }
- else
- {
- totalArchSpec = totalArchSpec.composeWith(archspec);
- }
- }
- }
-
- }
- if (check)
- {
- totalArchSpec.prepareForCheck();
- }
- DottyVisitor dv = new DottyVisitor(totalArchSpec, outputfilename, "Title goes here ...", layoutLR,
- directed, componentDetailLevel, showPackages, quietList, check, do_not_show_dependecy_details,
- filter);
- try
- {
- new Vector();
- Hashtable anntable = new Hashtable();
- Vector annotations = (new CodeMetaclassCache()).getAnnotations(allFiles, changedFiles, srcbase);
- for (int j = 0; j < annotations.size(); j++)
- {
- CodeMetaclass cm = (CodeMetaclass) annotations.elementAt(j);
- String thisPackage = DottyVisitorConstants.extractPackage(cm.getName());
- if (!anntable.containsKey(thisPackage))
- {
- anntable.put(thisPackage, new Vector());
- }
- ((Vector) anntable.get(thisPackage)).addElement(cm);
- }
-
- Vector ann;
- for (Enumeration e = anntable.keys(); e.hasMoreElements(); ann.size())
- {
- String packagename = (String) e.nextElement();
- ann = (Vector) anntable.get(packagename);
- dv.startSubGraph();
- CodeMetaclass cm;
- for (Enumeration annenum = ann.elements(); annenum.hasMoreElements(); cm.accept(dv))
- {
- cm = (CodeMetaclass) annenum.nextElement();
- }
-
- dv.endSubGraph(packagename);
- }
-
- if (check)
- {
- dv.export("architecture-evolution-spec.dotty");
- String finalReport = totalArchSpec.reportAfterAllChecks();
- System.err.println();
- System.err.println(finalReport);
- System.err.println();
- System.err.println("\n" + dv.getNumberOfLinks() + " dependencies checked.");
- if (dv.getNumberOfErrors() > 0)
- {
- System.err.println(dv.getNumberOfErrors() + " errors found!");
- }
- else
- {
- System.err.println("No error found!");
- }
- System.err.println();
- }
- boolean flag = dv.getError();
- return flag;
- }
- finally
- {
- dv.close();
- log.info("done (file written: " + outputfilename + ")");
- }
- }
- catch (Exception e)
- {
- throw new RuntimeException("iDarwin: file being processed when the problem occured:\n" + recent_file, e);
- }
- }
-
- public Darwin()
- {
- }
-}
Modified: trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -18,11 +18,9 @@
import java.io.BufferedReader;
import java.io.File;
+import java.io.FileFilter;
import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.PrintWriter;
import java.io.Reader;
import java.util.Enumeration;
import java.util.Vector;
@@ -40,83 +38,25 @@
super(name);
}
- private void copyWithoutLinesStartingWith(FileReader is, PrintWriter os, String header) throws IOException
+ Vector enumerateFilesIn(File dir, FileFilter filter)
{
- char buf[] = new char[300];
- for (int ch = is.read(); ch != -1;)
- {
- int pos = 0;
- while (ch != -1 && (char) ch != '\n')
- {
- buf[pos] = (char) ch;
- pos++;
- ch = is.read();
- if ((char) ch == '\r')
- {
- ch = is.read();
- }
- }
- if ((char) ch == '\n')
- {
- ch = is.read();
- if ((char) ch == '\r')
- {
- ch = is.read();
- }
- String strb = new String(buf, 0, pos);
- if (!strb.trim().startsWith(header))
- {
- os.println(strb);
- }
- }
- }
-
- }
-
- protected Reader createStreamForCodeParsing() throws IOException
- {
- FileReader is = null;
- PrintWriter os = null;
- try
- {
- is = new FileReader(getName());
- os = new PrintWriter(new FileWriter(getName() + ".clean"));
- copyWithoutLinesStartingWith(is, os, "/*|*/");
- }
- finally
- {
- if (is != null)
- {
- is.close();
- }
- if (os != null)
- {
- os.close();
- }
- }
- return new FileReader(getName() + ".clean");
- }
-
- Vector enumerateFilesIn(String dir, FilenameFilter filter)
- {
Vector fs = new Vector();
- File localroot = new File(dir);
- String filenames[] = localroot.list(filter);
- if (filenames != null)
+ File[] files = dir.listFiles(filter);
+ if (files != null)
{
- for (int i = 0; i < filenames.length; i++)
+ for (int i = 0; i < files.length; i++)
{
- File f = new File(dir + File.separator + filenames[i]);
+ File f = files[i];
if (f.isDirectory())
{
- for (Enumeration e = enumerateFilesIn(dir + File.separator + filenames[i], filter).elements(); e
+ for (Enumeration e = enumerateFilesIn(f, filter).elements(); e
.hasMoreElements(); fs.addElement(e.nextElement()))
{
}
}
else
{
- fs.addElement(dir + File.separator + filenames[i]);
+ fs.addElement(f.getPath());
}
}
@@ -137,11 +77,26 @@
}
try
{
- BufferedReader f = new BufferedReader(new FileReader(fn));
- for (String line = null; (line = f.readLine()) != null;)
+ FileReader fileReader = new FileReader(fn);
+ try
{
- v.addElement(new FileTarget(line));
+ BufferedReader f = new BufferedReader(fileReader);
+ try
+ {
+ for (String line = null; (line = f.readLine()) != null;)
+ {
+ v.addElement(new FileTarget(line));
+ }
+ }
+ finally
+ {
+ f.close();
+ }
}
+ finally
+ {
+ fileReader.close();
+ }
}
catch (IOException _ex)
@@ -154,26 +109,21 @@
int pos = getName().indexOf("*");
final String pattern = getName().substring(pos, getName().length());
File dir = new File(getName());
- String tmp_parent = "";
+ File parent;
if (dir.getParent() == null)
{
- tmp_parent = ".";
+ parent = new File(".");
}
else
{
- dir = new File(dir.getParent());
- tmp_parent = dir.getName();
+ parent = dir.getParentFile();
}
- String parent = tmp_parent;
- Vector filenames = enumerateFilesIn(parent, new FilenameFilter()
+ Vector filenames = enumerateFilesIn(parent, new FileFilter()
{
-
- public boolean accept(File dir, String name)
+ public boolean accept(File file)
{
- File f = new File(dir + File.separator + name);
- return match(name, pattern) || f.isDirectory();
+ return match(file.getName(), pattern) || file.isDirectory();
}
-
});
for (Enumeration e = filenames.elements(); e.hasMoreElements(); v.addElement(new FileTarget((String) e
.nextElement())))
@@ -224,44 +174,36 @@
Vector process(Vector options) throws Exception
{
Vector fileList = new Vector();
- Reader is = null;
- CleanOption cleanOption = null;
- for (int i = 0; i < options.size(); i++)
+ Reader is = new FileReader(getName());
+ try
{
- if ("r".compareTo(((Option) options.elementAt(i)).getName()) == 0)
+ BufferedReader bufferedIs = new BufferedReader(is);
+ try
{
- cleanOption = (CleanOption) options.elementAt(i);
- }
- }
-
- if (cleanOption != null)
- {
- System.err
- .println("Java Contract Suite: -r option enabled -- create a file "
- + getName()
- + ".clean"
- + " with all instrumentation code from previous run removed. Also the cleaned file will be the input to the new instrumentation run.");
- is = createStreamForCodeParsing();
- }
- else
- {
- is = new FileReader(getName());
- }
- Parser parser = new Parser(is, getName());
- MetaclassFactory metaclassFactory = new MetaclassFactory(getName());
- parser.setMetaclassFactory(metaclassFactory);
- Vector intermediate = parser.getAnnotations();
- is.close();
- for (int i = 0; i < options.size(); i++)
- {
- if (((Option) options.elementAt(i)).doesProcessing())
- {
- Vector files = ((ProcessingOption) options.elementAt(i)).process(intermediate, options, getName());
- for (Enumeration e = files.elements(); e.hasMoreElements(); fileList.addElement(e.nextElement()))
+ Parser parser = new Parser(bufferedIs, getName());
+ MetaclassFactory metaclassFactory = new MetaclassFactory(getName());
+ parser.setMetaclassFactory(metaclassFactory);
+ Vector intermediate = parser.getAnnotations();
+ for (int i = 0; i < options.size(); i++)
{
+ if (((Option) options.elementAt(i)).doesProcessing())
+ {
+ Vector files = ((ProcessingOption) options.elementAt(i)).process(intermediate, options, getName());
+ for (Enumeration e = files.elements(); e.hasMoreElements(); fileList.addElement(e.nextElement()))
+ {
+ }
+ }
}
}
+ finally
+ {
+ bufferedIs.close();
+ }
}
+ finally
+ {
+ is.close();
+ }
return fileList;
}
Modified: trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java 2008-05-09 17:07:10 UTC (rev 47)
+++ trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java 2008-05-09 17:08:10 UTC (rev 48)
@@ -30,6 +30,14 @@
private static final String VERSION_RESOURCE_NAME = "version.txt";
+ private static final String LABEL_SPACES = " ";
+
+ private static final int INDENT_SIZE = LABEL_SPACES.length() + 1;
+
+ private static final int MAX_TOTAL_WIDTH = 79;
+
+ private static final int MAX_PARAGRAPH_WIDTH = MAX_TOTAL_WIDTH - INDENT_SIZE;
+
public static final String NAME = "h";
static
@@ -77,113 +85,139 @@
protected void activateOnTargets(Vector targets)
{
- System.out.println("NAME: Java Contract Suite, Version " + VERSION);
- System.out.println("AUTHOR: Copyright (C) 1997-1999 Reto Kramer");
- System.out.println(" Copyright (C) 2006 John Swapceinski, Johan Stuyts");
- System.out.println("SYNOPSIS: java net.sf.jcontracts.icontract.Tool {option} {file}");
- System.out.println("DESCRIPTION: Provides Java with full support for \"Design by Contract\".");
- System.out.println(" Instruments java source code files with checks to enforce:");
- System.out.println(" - method pre- and post-conditions");
- System.out.println(" - class/interface invariants");
- System.out.println(" based on comments in the code (@pre, @post, @invariant).");
- System.out.println(" Java Contract Suite operates on classes, interfaces, and methods.");
- System.out.println(" file: Is a list of java sourcecode files (space separated).");
- System.out.println(" If a name of the form @file is in the list, each line in file");
- System.out.println(" is interpreted as a filename.");
- System.out.println(" If a name is a pattern (e.g. ./x/*.java), all files in x and");
- System.out.println(" subdirectories thereof are searched for *.java files.");
- System.out.println(" {option}: Is a list of options, Java Contract Suite accepts the following options:");
- System.out.println(" (if no option is given, Java Contract Suite uses the -h option)");
- System.out.println("");
- System.out.println(" GENERAL:");
- System.out.println(" -h prints version, synopsis and a brief description.");
- System.out.println(" -vA,B,C control how much information is displayed.");
- System.out.println(" if -v is not present, errors and warnings are displayed.");
- System.out.println(" -v (no args) displays errors, warnings and progress information.");
- System.out.println(" A,B,C may be error*, warning*, note*, info*, progress* and debug*");
- System.out.println(" -a regenerates all files, even if the timestamps say that");
- System.out.println(" the instrumented version is up to date.");
- System.out.println("");
- System.out.println(" OUTPUT:");
- System.out.println(" -oF Store the instrumented code output into file F.");
- System.out.println(" F may include @p, @f and @e which will be substituted with path");
- System.out.println(" filename and file extension of the file being processed.");
- System.out.println(" NOTE: add that location to the classpath for -c compiler");
- System.out.println(" e.g. ... -c'java -classpath @p' ...");
- System.out.println("");
- System.out.println(" -jF Copy the original sourcefiles into file F before compilation.");
- System.out.println(" F may include @p, @f and @e which will be substituted with path");
- System.out.println(" filename and file extension of the file being processed.");
- System.out.println(" [useful if working with sourcefiles of extensions other than .java]");
- System.out.println(" NOTE: add that location to the classpath for -b compiler");
- System.out.println(" e.g. ... -b'java -classpath @p' ...");
- System.out.println("");
- System.out.println(" -kF Rewrite the repository filename using F (F=specific dir).");
- System.out.println(" F may include @p (neither @f nor @e) which will be substituted");
- System.out.println(" with the path of the file being processed.");
- System.out.println(" [useful if the repository shall be stored at a specific place]");
- System.out.println(" NOTE: add that location to the classpath for -n compiler");
- System.out.println(" e.g. ... -n'java -classpath @p' ...");
- System.out.println("");
- System.out.println(" COMPILERS:");
- System.out.println(" Note: C denotes the compiler command(e.g. javac). if the colon (:) is.");
- System.out.println(" used the sun.tools.javac.Main compiler is called in the same VM.");
- System.out.println(" For small files this results in speedups and lower mem consumtion");
- System.out.println(" -bC use compiler C to compile the sourcefiles BEFORE instrumentation.");
- System.out.println(" If the -jC option is missing (default), 'javac' is invoked.");
- System.out.println(" If -j (no C) is used, initial sourcefiles will not be compiled.");
- System.out.println(" [NOTE: the -j output option allow redirection of file-location]");
- System.out.println("");
- System.out.println(" -cC use compiler C to compile the sourcefiles AFTER instrumentation.");
- System.out.println(" If the -cC option is missing (default), 'javac' is invoked.");
- System.out.println(" If -c (no C) is used, instrumented sourcefiles will not be compiled.");
- System.out.println(" [NOTE: the -o output option allow redirection of file-location]");
- System.out.println("");
- System.out.println(" -y ensures that the -o/-c options work with JDK 1.1 by passing");
- System.out.println(" the filename (excl. dir prefix) to the -c compiler only.");
- System.out.println("");
- System.out.println(" -nC use compiler C to automatically compile the repository files.");
- System.out.println(" [useful if working with a non JDK compiler.]");
- System.out.println(" If the -nC option is missing (default), 'javac' is invoked.");
- System.out.println(" If -n (no C) is used, repositories will not be compiled.");
- System.out.println(" [NOTE: the -k output option allow redirection of file-location]");
- System.out.println("");
- System.out.println(" CONTROL:");
- System.out.println(" -mOPT{,OPT} Instruments the source code depending on the list of flags OPT:");
- System.out.println(" OPT can be either \"@<file>\", \"pre\", \"post\" or \"inv\"");
- System.out.println(" -mpre instruments only the method pre-conditions (@pre <bool expr>)");
- System.out.println(" -mpost instruments only the method post-conditions (@post <bool expr>)");
- System.out.println(" -minv instruments only the class invariants (@invariant <bool expr>)");
- System.out.println(" -m@file reads each line in file <package.type.method> <pre,post,inv>");
- System.out.println(" to allow fine control over what is instrumented.");
- System.out.println(" NOTE: -mpre,post,inv override @file entries!");
- System.out.println("");
- System.out.println(" -qA,B,C disables warnings related to contract propagation from");
- System.out.println(" classes A,B and C.");
- System.out.println(" A,B and C may be qualified (e.g. package.class)");
- System.out.println(" NOTE: Only the first warning related to a type will be displayed!");
- System.out.println(" The special name :all: (-q:all:,A,B) disables warning suppresion");
- System.out.println("");
- System.out.println(" -i (experimental) in subclasses instrument a call to the superclass'");
- System.out.println(" invariant check method to allow private fields to be part of the");
- System.out.println(" superclass invariant expression");
- System.out.println("");
- System.out.println(" -w generate code that ensures that pre/post/inv-checks do not throw");
- System.out.println(" checked exceptions - they will be 'converted' to RuntimeException.");
- System.out.println(" This option is not compatible with the -d option.");
- System.out.println(" -dE Use exception class E as the default exception throw for contract");
- System.out.println(" volation. E may be qualified (e.g. package.class).");
- System.out.println(" This option is not compatible with the -w option.");
- System.out.println("");
- System.out.println(" MISC:");
- System.out.println(" -r Before instrumenting, remove all instrumentation code in the");
- System.out.println(" source file (removes all lines starting with \"/*|*/\").");
- System.out.println(" Also creates a clean file <inputfile>.clean");
- System.out.println("");
- System.out.println(" PROBLEMS:");
- System.out.println(" Please enter problem reports and requests for new features in");
- System.out.println(" the issue tracker, which can be found at:");
- System.out.println(" https://sourceforge.net/tracker/?group_id=175492&atid=889550");
+ printParagraph("NAME:", "Java Contract Suite, Version " + VERSION);
+ System.out.println();
+
+ printParagraph("AUTHOR:", "Copyright (C) 1997-1999 Reto Kramer");
+ printParagraph("Copyright (C) 2006 John Swapceinski, Johan Stuyts");
+ System.out.println();
+
+ printParagraph("SYNOPSIS:", "java net.sf.jcontracts.icontract.Tool {options} {files}");
+ System.out.println();
+
+ printParagraph("DESCRIPTION:", "Provides Java with full support for \"Design by Contract\". " +
+ "Instruments java source code files with checks to enforce:");
+ printParagraph("- method pre- and post-conditions");
+ printParagraph("- class/interface invariants");
+ printParagraph("based on comments in the code (@pre, @post, @invariant). " +
+ "Java Contract Suite operates on classes, interfaces, and methods.");
+ System.out.println();
+
+ printParagraph("CLASSPATH:", "The following items need to be on the class path " +
+ "so Java Contract Suite can generate instrumented and repository sources " +
+ "for your project:");
+ printParagraph("- JAR files of Java Contract Suite and Log4j");
+ printParagraph("- JAR files containing instrumented classes of \"Design by Contract\" enabled dependencies");
+ printParagraph("- JAR files containing repository classes of \"Design by Contract\" enabled dependencies");
+ printParagraph("- JAR files of regular dependencies");
+ printParagraph("- uninstrumented classes of project");
+ System.out.println();
+
+ printLabel("PARAMETERS:");
+
+ printParagraph("files", "Is a list of java sourcecode files (space separated).");
+ System.out.println();
+ printParagraph("If a name of the form @file is in the list, each line in file " +
+ "is interpreted as a filename.");
+ System.out.println();
+ printParagraph("If a name is a pattern (e.g. ./x/*.java), all files in x and " +
+ "subdirectories thereof are searched for *.java files.");
+ System.out.println();
+
+ printParagraph("options", "Is a list of options, Java Contract Suite accepts the following " +
+ "options: (if no parameters are given, Java Contract Suite uses the -h " +
+ "option)");
+ System.out.println();
+
+ printLabel("GENERAL:");
+
+ printParagraph("-h", "prints version, synopsis and a brief description.");
+ System.out.println();
+
+ printParagraph("-a", "regenerates all files, even if the timestamps say that " +
+ "the instrumented version is up to date.");
+ System.out.println();
+
+ printLabel("OUTPUT:");
+
+ printParagraph("-oF", "Store the instrumented code output into file F. " +
+ "F may include @p, @f and @e which will be substituted with path, " +
+ "filename and file extension of the file being processed.");
+ System.out.println();
+
+ printParagraph("-kD", "Rewrite the repository filename using D (D=specific dir). " +
+ "D may include @p (neither @f nor @e) which will be substituted " +
+ "with the path of the file being processed.");
+ printParagraph("[useful if the repository shall be stored at a specific place]");
+ System.out.println();
+
+ printLabel("CONTROL:");
+
+ printParagraph("-mOPT,{OPT}", "Instruments the source code depending on the list of flags OPT. " +
+ "OPT can be either \"@<file>\", \"pre\", \"post\" or \"inv\".");
+ printParagraph("-mpre", "Instruments only the method pre-conditions (@pre <bool expr>).");
+ printParagraph("-mpost", "Instruments only the method post-conditions (@post <bool expr>).");
+ printParagraph("-minv", "Instruments only the class invariants (@invariant <bool expr>).");
+ printParagraph("-m@file", "Reads each line in file <package.type.method> <pre,post,inv> " +
+ "to allow fine control over what is instrumented.");
+ printParagraph("NOTE:", "-mpre,post,inv override @file entries!");
+ System.out.println();
+
+ printParagraph("-dE", "Use exception class E as the default exception thrown for contract " +
+ "volations. E may be qualified (e.g. package.class).");
+ System.out.println();
+
+ printParagraph("PROBLEMS:", "Please enter problem reports and requests for new features in " +
+ "the issue tracker, which can be found at:");
+ printParagraph("https://sourceforge.net/tracker/?group_id=175492&atid=889550");
+
System.exit(0);
}
+
+ private void printParagraph(String text)
+ {
+ printParagraph("", text);
+ }
+
+ private void printParagraph(String label, String text)
+ {
+ printLabelWithoutNewLine(label);
+ System.out.print(' ');
+ printParagraphText(text);
+ }
+
+ private void printLabel(String label)
+ {
+ printLabelWithoutNewLine(label);
+ System.out.println();
+ }
+
+ private void printLabelWithoutNewLine(String label)
+ {
+ System.out.print(LABEL_SPACES.substring(label.length()));
+ System.out.print(label);
+ }
+
+ private void printParagraphText(String text)
+ {
+ if (text.length() <= MAX_PARAGRAPH_WIDTH)
+ {
+ System.out.println(text);
+ }
+ else
+ {
+ int lastIndexOfSpaceWithinParagraphWidth = text.lastIndexOf(' ', MAX_PARAGRAPH_WIDTH);
+ if (lastIndexOfSpaceWithinParagraphWidth == -1)
+ {
+ System.out.println(text);
+ }
+ else
+ {
+ System.out.println(text.substring(0, lastIndexOfSpaceWithinParagraphWidth));
+ System.out.print(LABEL_SPACES);
+ System.out.print(' ');
+ printParagraphText(text.substring(lastIndexOfSpaceW...
[truncated message content] |
|
From: <js...@us...> - 2008-05-09 17:07:12
|
Revision: 47
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=47&view=rev
Author: jstuyts
Date: 2008-05-09 10:07:10 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed Dotty-related classes.
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,235 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureExporter;
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class DottyVisitor implements ICodeMetaclassVisitor
-{
-
- private PrintWriter ostream;
-
- public static final int TYPE_DETAIL_LEVEL = 2;
-
- public static final int PACKAGE_DETAIL_LEVEL = 1;
-
- private IDotty_Component_Level component;
-
- private boolean layoutLR;
-
- private boolean directed;
-
- private int cluster_index;
-
- private boolean boxPackages;
-
- private boolean do_not_show_dependecy_details;
-
- private IArchitectureSpecification specification;
-
- private IDependencyFilter filter;
-
- public DottyVisitor(IArchitectureSpecification spec, String filename, String title, boolean layoutLR,
- boolean directed, int componentVisitorDetailLevel, boolean showPackages, Vector quietList, boolean check,
- boolean do_not_show_dependecy_details, IDependencyFilter filter) throws IOException
- {
- ostream = null;
- this.layoutLR = false;
- this.directed = true;
- cluster_index = 1;
- specification = null;
- this.filter = null;
- specification = spec;
- if (componentVisitorDetailLevel == 2)
- {
- component = new Dotty_Component_TypeLevel(filter, check);
- }
- if (componentVisitorDetailLevel == 1)
- {
- component = new Dotty_Component_PackageLevel(filter, check);
- }
- this.directed = directed;
- boxPackages = showPackages;
- this.layoutLR = layoutLR;
- this.do_not_show_dependecy_details = do_not_show_dependecy_details;
- this.filter = filter;
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (filter == null)
- {
- writeHeader(ostream, title);
- }
- else
- {
- filter.writeHeader(ostream, title);
- }
- component.setIgnoranceList(quietList);
- }
-
- public void accept(CodeMetaclass codemetaclass)
- {
- }
-
- public void acceptMethod(CodeMetaclass item)
- {
- component.acceptMethod(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item)
- {
- component.acceptTypeMetaclass(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void acceptVariable(CodeMetaclass item)
- {
- component.acceptVariable(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
-
- public void close()
- {
- if (filter == null)
- {
- component.createErrorLinks(directed, ostream);
- ostream.println("\n}");
- }
- else
- {
- filter.writeTrailer(ostream);
- }
- ostream.close();
- }
-
- public void endSubGraph(String label)
- {
- if (boxPackages)
- {
- ostream.println("label=\"" + label + "\";");
- ostream.println("}");
- }
- }
-
- public void export(String filename)
- {
- IArchitectureExporter exporter = null;
- try
- {
- exporter = specification.newArchitectureExporter(filename);
- if (exporter == null)
- {
- throw new RuntimeException("iDarwin: error no exporter implemented for this specification language.");
- }
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error could not open " + filename + " to export specification (" + e
- + ").", e);
- }
- try
- {
- exporter.open();
- exporter.export(specification);
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error during specification export to " + filename + " (" + e + ").", e);
- }
- finally
- {
- if (exporter != null)
- {
- try
- {
- exporter.close();
- }
- catch (IOException e)
- {
- throw new RuntimeException("iDarwin: error attempt to close open stream " + filename + " failed ("
- + e + ").", e);
- }
- }
- }
- }
-
- public boolean getError()
- {
- return component.getError();
- }
-
- public int getNumberOfErrors()
- {
- return component.getNumberOfErrors();
- }
-
- public int getNumberOfLinks()
- {
- return component.getNumberOfLinks();
- }
-
- public void startSubGraph()
- {
- if (boxPackages)
- {
- ostream.println("subgraph cluster_" + cluster_index + " {");
- ostream.println("color=orange;");
- ostream.println("fontname=Helvetica;");
- ostream.println("fontsize=16;");
- cluster_index++;
- }
- }
-
- public void writeHeader(PrintWriter ostream, String title) throws IOException
- {
- if (directed)
- {
- ostream.println("digraph \"" + title + "\" {");
- }
- else
- {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR)
- {
- ostream.println("rankdir=LR;");
- }
- }
-
- public void writeHeader(String filename, String title) throws IOException
- {
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (directed)
- {
- ostream.println("digraph \"" + title + "\" {");
- }
- else
- {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR)
- {
- ostream.println("rankdir=LR;");
- }
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,96 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-public class DottyVisitorConstants
-{
-
- public static int FONT_SIZE = 12;
-
- public static int EDGE_LENGTH = 4;
-
- public static String FONT_NAME = "Helvetica";
-
- public static final String DEFAULT_PACKAGE = "PACKAGE_DEFAULT";
-
- public static String edgeLengthCommand(boolean directed)
- {
- String result = null;
- if (directed)
- {
- result = "minlen=" + getEdgeLength() + ",";
- }
- else
- {
- result = "len=" + getEdgeLength() + ",";
- }
- return result;
- }
-
- public static String extractPackage(String type)
- {
- String result = null;
- char tag = '.';
- if (type.indexOf('$') > type.indexOf('.'))
- {
- tag = '$';
- }
- if (type.indexOf(tag) == -1)
- {
- result = "PACKAGE_DEFAULT";
- }
- else
- {
- result = type.substring(0, type.lastIndexOf(tag));
- }
- return result;
- }
-
- public static String fontName()
- {
- return FONT_NAME;
- }
-
- public static int fontSize()
- {
- return FONT_SIZE;
- }
-
- public static int getEdgeLength()
- {
- return EDGE_LENGTH;
- }
-
- public static String linkSymbol(boolean directed)
- {
- String result = null;
- if (directed)
- {
- result = " -> ";
- }
- else
- {
- result = " -- ";
- }
- return result;
- }
-
- public DottyVisitorConstants()
- {
- }
-
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,494 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_CommonLevel
-{
-
- protected Vector previouslyCheckedlinks;
-
- protected Vector previouslyDisplayedlinks;
-
- protected Hashtable errorBook;
-
- protected boolean hideAllButPublic;
-
- protected boolean performChecks;
-
- protected static final int BELONGS_TO = 0;
-
- public static final int INTERFACE_EXTENSION = 1;
-
- public static final int CLASS_EXTENSION = 2;
-
- public static final int INTERFACE_IMPLEMENTATION = 3;
-
- public static final int RETURN = 4;
-
- public static final int PARAMETER = 5;
-
- public static final int VARIABLE = 6;
-
- public static final int NEWED = 7;
-
- public static final int LOCALVAR = 8;
-
- protected IDependencyFilter filter;
-
- public static final int STATICREF = 9;
-
- public static final int CAST = 10;
-
- private String colorLUT[] =
- {
- "gray", "black", "black", "black", "blue", "blue", "yellow", "green", "pink", "cyan", "orange"
- };
-
- public String relationNameLUT[] =
- {
- "belongs-to", "extends", "extends", "implements", "return", "parameter", "variable", "new", "local-var",
- "static", "cast"
- };
-
- public static Vector ignore = new Vector();
-
- private boolean containsErrors;
-
- private int numberofErrors;
-
- private int errorID;
-
- private int numberNumberOfLink;
-
- public void addDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
- boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
- boolean do_not_show_dependecy_details)
- {
- if (filter == null)
- {
- localAddDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
- do_not_show_dependecy_details);
- }
- else
- {
- filter.addDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- protected void addPackage(PrintWriter ostream, CodeMetaclass item)
- {
- if (filter == null)
- {
- localAddPackage(ostream, item);
- }
- else
- {
- filter.addPackage(ostream, item);
- }
- }
-
- protected void addType(PrintWriter ostream, CodeMetaclass item)
- {
- if (filter == null)
- {
- localAddType(ostream, item);
- }
- else
- {
- filter.addType(ostream, item);
- }
- }
-
- private final boolean atomicMatch(String item, String pattern)
- {
- boolean result = false;
- if (item.equals(pattern))
- {
- result = true;
- }
- else if (pattern.equals("*"))
- {
- result = true;
- }
- else
- {
- int starPos = -1;
- if ((starPos = pattern.indexOf('*')) != -1)
- {
- if (pattern.endsWith("*") && pattern.startsWith("*"))
- {
- String subsection = pattern.substring(1, pattern.length() - 1);
- result = item.indexOf(subsection) != -1;
- }
- else if (pattern.endsWith("*"))
- {
- String b = pattern.substring(0, starPos);
- result = item.startsWith(b);
- }
- else if (pattern.startsWith("*"))
- {
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.endsWith(e);
- }
- else
- {
- pattern.substring(0, starPos);
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.startsWith(e) && item.endsWith(e);
- }
- }
- }
- return result;
- }
-
- public void createErrorLinks(boolean directed, PrintWriter ostream)
- {
- String ms;
- String mt;
- int fontSize;
- String fontName;
- String edgeLengthCommand;
- String linkSymbol;
- String color;
- String extra;
- for (Enumeration e = errorBook.keys(); e.hasMoreElements(); ostream.println(ms + linkSymbol + mt + " ["
- + edgeLengthCommand + extra + "color=" + color + ",fontsize=" + fontSize + ",fontname=\"" + fontName
- + "\",style=bold,fontcolor=red];"))
- {
- String key = (String) e.nextElement();
- Object o[] = (Object[]) errorBook.get(key);
- String label = (String) o[1];
- int num = 0;
- for (int pos = 0; (pos = label.indexOf("\\n", pos + 1)) != -1;)
- {
- num++;
- }
-
- num++;
- String s = key.substring(0, key.indexOf("&"));
- String t = key.substring(key.indexOf("&") + 1, key.lastIndexOf("&"));
- ms = mangle(s);
- mt = mangle(t);
- fontSize = DottyVisitorConstants.fontSize();
- fontName = DottyVisitorConstants.fontName();
- edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
- linkSymbol = DottyVisitorConstants.linkSymbol(directed);
- color = "red";
- extra = "label=\"" + num;
- if (num > 1)
- {
- extra = extra + " errors:\\n";
- }
- else
- {
- extra = extra + " error:\\n";
- }
- extra = extra + label + "\"";
- }
-
- }
-
- public boolean getError()
- {
- return containsErrors;
- }
-
- protected String getErrorTextForDisplay(String source, String target, String type, String rule)
- {
- return "label=\"" + type + " VIOLATES\\n" + rule + "\",style=bold,fontcolor=red,";
- }
-
- public int getNumberOfErrors()
- {
- return numberofErrors;
- }
-
- public int getNumberOfLinks()
- {
- return numberNumberOfLink;
- }
-
- protected String getVisibilityColorCode(CodeMetaclass item)
- {
- String color = "yellow";
- if (item.isPublic())
- {
- color = "green";
- }
- if (item.isPrivate())
- {
- color = "gray";
- }
- if (item.isProtected())
- {
- color = "blue";
- }
- return color;
- }
-
- public void localAddDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
- boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
- boolean do_not_show_dependecy_details)
- {
- if (!shall_hide(source_item, target_item))
- {
- numberNumberOfLink++;
- boolean checkPassed = true;
- String color = colorLUT[relationType];
- StringBuffer consoleErrorReportBuffer = new StringBuffer();
- StringBuffer displayErrorReportBuffer = new StringBuffer();
- String source = mangle(pruneToLevel(source_item));
- String target = mangle(pruneToLevel(target_item));
- if (performChecks)
- {
- String checkLinkID = source_item + "__" + target_item + "__" + relationType;
- if (!previouslyCheckedlinks.contains(checkLinkID))
- {
- String errorBookKey = null;
- net.sf.jcontracts.idarwin.specification.openapi.IDependency dependency = specification
- .newDependency(source_item, target_item, relationNameLUT[relationType], item
- .getLocationDescription());
- StringBuffer errorReporBbuffer = new StringBuffer();
- if (!specification.check(dependency, consoleErrorReportBuffer, displayErrorReportBuffer))
- {
- String errorText = errorReporBbuffer.toString();
- numberofErrors++;
- System.err.print("iDarwin: error " + errorID + " ");
- System.err.println(consoleErrorReportBuffer.toString());
- if (do_not_show_dependecy_details)
- {
- errorBookKey = source + "&" + target + "&";
- }
- else
- {
- errorBookKey = source + "&" + target + "&" + relationType;
- }
- if (!errorBook.containsKey(errorBookKey))
- {
- Object arr[] = new Object[2];
- arr[0] = new Integer(0);
- arr[1] = "";
- errorBook.put(errorBookKey, ((Object) (arr)));
- }
- Object entry[] = (Object[]) errorBook.get(errorBookKey);
- entry[0] = new Integer(((Integer) entry[0]).intValue() + 1);
- if (((String) entry[1]).length() > 0)
- {
- entry[1] = entry[1] + "\\n" + errorID + " (" + relationNameLUT[relationType] + ")";
- }
- else
- {
- entry[1] = "" + errorID + " (" + relationNameLUT[relationType] + ")";
- }
- errorID++;
- entry[1] = entry[1] + errorText;
- errorBook.put(errorBookKey, ((Object) (entry)));
- color = "red";
- String latestError = "error id: " + (String) entry[1] + "\\n(console)";
- extra = "label=\"" + latestError + "\",style=bold,fontcolor=red,";
- checkPassed = false;
- }
- previouslyCheckedlinks.addElement(checkLinkID);
- }
- }
- String displayLinkID = null;
- if (do_not_show_dependecy_details)
- {
- displayLinkID = source + "__" + target;
- if (checkPassed)
- {
- color = "black";
- }
- }
- else
- {
- displayLinkID = source + "__" + target + "__" + relationType;
- }
- if (checkPassed && !previouslyDisplayedlinks.contains(displayLinkID))
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
- String linkSymbol = DottyVisitorConstants.linkSymbol(directed);
- ostream.println(source + linkSymbol + target + " [" + edgeLengthCommand + extra + "color=" + color
- + ",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- previouslyDisplayedlinks.addElement(displayLinkID);
- }
- if (performChecks)
- {
- containsErrors = checkPassed;
- }
- else
- {
- containsErrors = false;
- }
- }
- }
-
- protected void localAddPackage(PrintWriter ostream, CodeMetaclass item)
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String name = item.getName();
- ostream.print(mangle(pruneToLevel(name)));
- ostream.print(" [label=\"<<package>>\\n" + pruneToLevel(name) + "\"");
- ostream.print(",shape=box");
- ostream.println(",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- }
-
- protected void localAddType(PrintWriter ostream, CodeMetaclass item)
- {
- int fontSize = DottyVisitorConstants.fontSize();
- String fontName = DottyVisitorConstants.fontName();
- String id = item.getName();
- ostream.print(mangle(id));
- if (item instanceof Class)
- {
- ostream.print(" [label=\"<<class>>\\n" + item.getName() + "\"");
- ostream.print(",shape=box,style=filled,color=" + getVisibilityColorCode(item));
- }
- else
- {
- ostream.print(" [label=\"<<interface>>\\n" + item.getName() + "\"");
- ostream.print(",shape=diamond,style=filled,color=" + getVisibilityColorCode(item));
- }
- ostream.println(",fontsize=" + fontSize + ",fontname=\"" + fontName + "\"];");
- }
-
- protected static String mangle(String name)
- {
- String newname = null;
- if (name.indexOf("Node") != -1 || name.indexOf("Graph") != -1)
- {
- newname = "_" + name;
- }
- else
- {
- newname = name;
- }
- newname = newname.replace('.', '_');
- newname = newname.replace('[', '_');
- newname = newname.replace(']', '_');
- newname = newname.replace('$', '_');
- newname = newname.replace('*', '_');
- newname = newname.replace('\\', '_');
- newname = newname.replace(' ', '_');
- return newname;
- }
-
- private boolean match(String item, String pattern)
- {
- boolean result = false;
- int pos = pattern.indexOf("\\");
- if (pos == -1)
- {
- result = atomicMatch(item, pattern);
- }
- else
- {
- String affermative = pattern.substring(0, pos);
- String negative = pattern.substring(pos + 1);
- if (match(item, affermative))
- {
- result = !atomicMatch(item, negative);
- }
- else
- {
- result = false;
- }
- }
- return result;
- }
-
- protected String pruneToLevel(String name)
- {
- return name;
- }
-
- public void setIgnoranceList(Vector quietList)
- {
- ignore = quietList;
- }
-
- private boolean shall_hide(String source_item, String target_item)
- {
- boolean hide = pruneToLevel(source_item).equals("PACKAGE_DEFAULT")
- || pruneToLevel(target_item).equals("PACKAGE_DEFAULT");
- if (!hide)
- {
- hide = target_item.indexOf("$") == -1 && target_item.indexOf("_") == -1 && target_item.indexOf(".") == -1;
- }
- return hide;
- }
-
- protected final boolean shallIgnore(String type)
- {
- if (type.equals("boolean") || type.equals("char") || type.equals("int") || type.equals("long")
- || type.equals("byte") || type.equals("float") || type.equals("PACKAGE_DEFAULT")
- || type.equals("double"))
- {
- return true;
- }
- for (int i = 0; i < ignore.size(); i++)
- {
- if (match(type, (String) ignore.elementAt(i)))
- {
- return true;
- }
- }
-
- return false;
- }
-
- protected String stripArray(String qualifiedName)
- {
- int start = qualifiedName.indexOf("[");
- String result = null;
- if (start == -1)
- {
- result = qualifiedName;
- }
- else
- {
- result = qualifiedName.substring(0, start);
- }
- return result;
- }
-
- public Dotty_Component_CommonLevel()
- {
- previouslyCheckedlinks = new Vector();
- previouslyDisplayedlinks = new Vector();
- errorBook = new Hashtable();
- hideAllButPublic = false;
- performChecks = true;
- filter = null;
- containsErrors = false;
- numberofErrors = 0;
- errorID = 1;
- numberNumberOfLink = 0;
- }
-
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,244 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_PackageLevel extends Dotty_Component_CommonLevel implements IDotty_Component_Level
-{
-
- public Dotty_Component_PackageLevel(IDependencyFilter filter, boolean performChecks)
- {
- super.performChecks = performChecks;
- super.filter = filter;
- }
-
- public Dotty_Component_PackageLevel(boolean performChecks)
- {
- super.performChecks = performChecks;
- }
-
- public void acceptMethod(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- Method m = (Method) item;
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(m.getParent().getName()))
- {
- String id = m.getParent().getName();
- String otherid = "";
- if (m.hasType())
- {
- otherid = m.getType();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 4, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- for (Enumeration e = m.getParameterNames().elements(); e.hasMoreElements();)
- {
- String t = m.getTypeOfParameter((String) e.nextElement());
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 5, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getNewedTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getLocalVarTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 8, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getCastedTypes().elements(); e.hasMoreElements();)
- {
- String t = (String) e.nextElement();
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(item.getName()))
- {
- addPackage(ostream, item);
- String id = item.getName();
- String superclassName = ((TypeMetaclass) item).getExtendedClassName();
- if (superclassName != null)
- {
- String otherid = superclassName;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 2, ostream, directed, "weight=10,style=bold,", specification, item,
- do_not_show_dependecy_details);
- }
- }
- Vector v = ((TypeMetaclass) item).getExtendedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 1, ostream, directed, "weight=3,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- v = ((TypeMetaclass) item).getImplementedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 3, ostream, directed, "weight=2,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- for (Enumeration e = ((ICodeBody) item).getNewedTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getCastedTypes().elements(); e.hasMoreElements();)
- {
- String sss = (String) e.nextElement();
- String otherid = sss;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptVariable(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- try
- {
- Variable v = (Variable) item;
- if (!super.hideAllButPublic || item.isPublic())
- {
- String t = stripArray(v.getType());
- if (!shallIgnore(t))
- {
- String id = t;
- String otherid = v.getParent().getName();
- if (!shallIgnore(otherid))
- {
- addDependency(otherid, id, 6, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- }
- }
- catch (ClassCastException e)
- {
- System.err.println(e + " during visiting " + item + "\ndelete internal cache file and restart.");
- throw e;
- }
- }
-
- protected String getErrorTextForDisplay(String source, String target, String type, String rule)
- {
- return "label=\"Dependency\\n" + source + "\\n-" + type + "->\\n" + target + "\\n" + "VIOLATES\\n" + rule
- + "\",style=bold,fontcolor=red,";
- }
-
- protected String pruneToLevel(String name)
- {
- return DottyVisitorConstants.extractPackage(name);
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,236 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Enumeration;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public class Dotty_Component_TypeLevel extends Dotty_Component_CommonLevel implements IDotty_Component_Level
-{
-
- public Dotty_Component_TypeLevel(IDependencyFilter filter, boolean performChecks)
- {
- super.performChecks = performChecks;
- super.filter = filter;
- }
-
- public Dotty_Component_TypeLevel(boolean performChecks)
- {
- super.performChecks = performChecks;
- }
-
- public void acceptMethod(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- Method m = (Method) item;
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(m.getParent().getName()))
- {
- String id = m.getParent().getName();
- String otherid = "";
- if (m.hasType())
- {
- otherid = m.getType();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 4, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- for (Enumeration e = m.getParameterNames().elements(); e.hasMoreElements();)
- {
- String t = m.getTypeOfParameter((String) e.nextElement());
- otherid = t;
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 5, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getNewedTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getLocalVarTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 8, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = m.getCastedTypes().elements(); e.hasMoreElements();)
- {
- otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptTypeMetaclass(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- if ((!super.hideAllButPublic || item.isPublic()) && !shallIgnore(item.getName()))
- {
- addType(ostream, item);
- String id = item.getName();
- String superclassName = ((TypeMetaclass) item).getExtendedClassName();
- if (superclassName != null)
- {
- String otherid = superclassName;
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 2, ostream, directed, "weight=10,style=bold,", specification, item,
- do_not_show_dependecy_details);
- }
- }
- Vector v = ((TypeMetaclass) item).getExtendedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 1, ostream, directed, "weight=3,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- v = ((TypeMetaclass) item).getImplementedInterfaces();
- if (v != null && !v.isEmpty())
- {
- for (Enumeration e = v.elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 3, ostream, directed, "weight=2,style=dotted,", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- for (Enumeration e = ((ICodeBody) item).getNewedTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 7, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getStaticRefTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 9, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- for (Enumeration e = ((ICodeBody) item).getCastedTypes().elements(); e.hasMoreElements();)
- {
- String otherid = (String) e.nextElement();
- otherid = stripArray(otherid);
- if (!shallIgnore(otherid))
- {
- addDependency(id, otherid, 10, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
-
- }
- }
-
- public void acceptVariable(CodeMetaclass item, PrintWriter ostream, boolean directed,
- IArchitectureSpecification specification, boolean do_not_show_dependecy_details)
- {
- try
- {
- DottyVisitorConstants.fontSize();
- DottyVisitorConstants.fontName();
- DottyVisitorConstants.edgeLengthCommand(directed);
- DottyVisitorConstants.linkSymbol(directed);
- Variable v = (Variable) item;
- if (!super.hideAllButPublic || item.isPublic())
- {
- String t = stripArray(v.getType());
- if (!shallIgnore(t))
- {
- String id = t;
- String otherid = v.getParent().getName();
- if (!shallIgnore(otherid))
- {
- addDependency(otherid, id, 6, ostream, directed, "", specification, item,
- do_not_show_dependecy_details);
- }
- }
- }
- }
- catch (ClassCastException e)
- {
- System.err.println(e + " during visiting " + item + "\ndelete internal cache file and restart.");
- throw e;
- }
- }
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,37 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public interface IDependencyFilter
-{
-
- public abstract void addDependency(String s, String s1, int i, PrintWriter printwriter, boolean flag, String s2,
- IArchitectureSpecification iarchitecturespecification, CodeMetaclass codemetaclass, boolean flag1);
-
- public abstract void addPackage(PrintWriter printwriter, CodeMetaclass codemetaclass);
-
- public abstract void addType(PrintWriter printwriter, CodeMetaclass codemetaclass);
-
- public abstract void writeHeader(PrintWriter printwriter, String s) throws IOException;
-
- public abstract void writeTrailer(PrintWriter printwriter);
-}
Deleted: trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java 2008-05-09 17:04:57 UTC (rev 46)
+++ trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java 2008-05-09 17:07:10 UTC (rev 47)
@@ -1,45 +0,0 @@
-/*
- * Copyright 1997-2000 Reto Kramer
- * Copyright 2006 John Swapceinski, Johan Stuyts
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package net.sf.jcontracts.codeparser;
-
-import java.io.PrintWriter;
-import java.util.Vector;
-
-import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-
-public interface IDotty_Component_Level
-{
-
- public abstract void acceptMethod(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void acceptTypeMetaclass(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void acceptVariable(CodeMetaclass codemetaclass, PrintWriter printwriter, boolean flag,
- IArchitectureSpecification iarchitecturespecification, boolean flag1);
-
- public abstract void createErrorLinks(boolean flag, PrintWriter printwriter);
-
- public abstract boolean getError();
-
- public abstract int getNumberOfErrors();
-
- public abstract int getNumberOfLinks();
-
- public abstract void setIgnoranceList(Vector vector);
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2008-05-09 17:05:03
|
Revision: 46
http://jcontracts.svn.sourceforge.net/jcontracts/?rev=46&view=rev
Author: jstuyts
Date: 2008-05-09 10:04:57 -0700 (Fri, 09 May 2008)
Log Message:
-----------
Removed iDarwin.
Removed Paths:
-------------
trunk/source/java/net/sf/jcontracts/idarwin/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-27 20:44:38
|
Revision: 45
http://svn.sourceforge.net/jcontracts/?rev=45&view=rev
Author: jstuyts
Date: 2006-12-27 12:44:35 -0800 (Wed, 27 Dec 2006)
Log Message:
-----------
Fixed package names.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-12-27 06:19:30 UTC (rev 44)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-12-27 20:44:35 UTC (rev 45)
@@ -126,7 +126,7 @@
is = new InputStreamReader(System.in);
}
ArgLexer lexer = new ArgLexer(is);
- lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
+ lexer.setTokenObjectClass("net.sf.jcontracts.argparser.ExtendedToken");
ArgParser parser = new ArgParser(lexer);
parser.cmdline();
System.out.println("OPTIONS:");
Modified: trunk/source/java/net/sf/jcontracts/argparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-12-27 06:19:30 UTC (rev 44)
+++ trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-12-27 20:44:35 UTC (rev 45)
@@ -33,7 +33,7 @@
{
StringReader is = new StringReader(s);
_lexer = new ArgLexer(is);
- _lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
+ _lexer.setTokenObjectClass("net.sf.jcontracts.argparser.ExtendedToken");
_argparser = new ArgParser(_lexer);
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-27 06:19:30 UTC (rev 44)
+++ trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-27 20:44:35 UTC (rev 45)
@@ -2772,7 +2772,7 @@
filename = "<System.in>";
}
JavaLexer lexer = new JavaLexer(is);
- lexer.setTokenObjectClass("net.sf.jcontracts.codeParser.ExtendedToken");
+ lexer.setTokenObjectClass("net.sf.jcontracts.codeparser.ExtendedToken");
JavaParser parser = new JavaParser(lexer);
MetaclassFactory metaclassFactory = new MetaclassFactory(filename);
parser.setMetaclassFactory(metaclassFactory);
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-27 06:19:30 UTC (rev 44)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-27 20:44:35 UTC (rev 45)
@@ -33,7 +33,7 @@
public Parser(Reader is, String filename)
{
_lexer = new JavaLexer(is);
- _lexer.setTokenObjectClass("net.sf.jcontracts.codeParser.ExtendedToken");
+ _lexer.setTokenObjectClass("net.sf.jcontracts.codeparser.ExtendedToken");
_javaparser = new JavaParser(_lexer);
_javaparser.setFilename(filename);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-27 06:19:31
|
Revision: 44
http://svn.sourceforge.net/jcontracts/?rev=44&view=rev
Author: jstuyts
Date: 2006-12-26 22:19:30 -0800 (Tue, 26 Dec 2006)
Log Message:
-----------
Added license for Log4j and attribution for ANTLR.
Added Paths:
-----------
trunk/legal/
trunk/legal/ATTRIBUTION-ANTLR.txt
trunk/legal/LICENSE-Log4j.txt
Added: trunk/legal/ATTRIBUTION-ANTLR.txt
===================================================================
--- trunk/legal/ATTRIBUTION-ANTLR.txt (rev 0)
+++ trunk/legal/ATTRIBUTION-ANTLR.txt 2006-12-27 06:19:30 UTC (rev 44)
@@ -0,0 +1,2 @@
+This project contains lexicalizers and parsers generated by ANTLR and ANTLR
+support classes. You can find ANTLR at: http://www.antlr.org/
Added: trunk/legal/LICENSE-Log4j.txt
===================================================================
--- trunk/legal/LICENSE-Log4j.txt (rev 0)
+++ trunk/legal/LICENSE-Log4j.txt 2006-12-27 06:19:30 UTC (rev 44)
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright 1999-2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-27 06:16:02
|
Revision: 43
http://svn.sourceforge.net/jcontracts/?rev=43&view=rev
Author: jstuyts
Date: 2006-12-26 22:16:00 -0800 (Tue, 26 Dec 2006)
Log Message:
-----------
Added license header to Java files.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java
trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java
trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java
trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java
trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java
trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java
trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java
trunk/source/java/net/sf/jcontracts/antlr/Alternative.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java
trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java
trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java
trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/CommonAST.java
trunk/source/java/net/sf/jcontracts/antlr/CommonToken.java
trunk/source/java/net/sf/jcontracts/antlr/DefaultToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/DefineGrammarSymbols.java
trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/DumpASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionHandler.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionSpec.java
trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java
trunk/source/java/net/sf/jcontracts/antlr/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAtom.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarElement.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/JavaBlockFinishingInfo.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/LLkAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkGrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParser.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParserNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/LexerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/Lookahead.java
trunk/source/java/net/sf/jcontracts/antlr/MakeGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java
trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java
trunk/source/java/net/sf/jcontracts/antlr/OneOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/OptionalBlock.java
trunk/source/java/net/sf/jcontracts/antlr/Parser.java
trunk/source/java/net/sf/jcontracts/antlr/ParserException.java
trunk/source/java/net/sf/jcontracts/antlr/ParserGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/RuleBlock.java
trunk/source/java/net/sf/jcontracts/antlr/RuleEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java
trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java
trunk/source/java/net/sf/jcontracts/antlr/SimpleTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/SynPredBlock.java
trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/Token.java
trunk/source/java/net/sf/jcontracts/antlr/TokenBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/TokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/TokenQueue.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/Tokenizer.java
trunk/source/java/net/sf/jcontracts/antlr/Tool.java
trunk/source/java/net/sf/jcontracts/antlr/ToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/TreeBlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/TreeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TreeParser.java
trunk/source/java/net/sf/jcontracts/antlr/TreeSpecifierNode.java
trunk/source/java/net/sf/jcontracts/antlr/TreeWalkerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/WildcardElement.java
trunk/source/java/net/sf/jcontracts/antlr/ZeroOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexerTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/collections/AST.java
trunk/source/java/net/sf/jcontracts/antlr/collections/ASTEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Enumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/List.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Stack.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTArray.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/BitSet.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/IndexedVector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLCell.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LList.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/Vector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/GrammarFile.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Option.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Preprocessor.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Rule.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java
trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/Option.java
trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/Target.java
trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Class.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeBody.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeMetaclassVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
trunk/source/java/net/sf/jcontracts/codeparser/Interface.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaTokenTypes.java
trunk/source/java/net/sf/jcontracts/codeparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/Method.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/codeparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/TypeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Variable.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
trunk/source/java/net/sf/jcontracts/icontract/AllOption.java
trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java
trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/Constants.java
trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
trunk/source/java/net/sf/jcontracts/icontract/DefaultExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java
trunk/source/java/net/sf/jcontracts/icontract/IContracted.java
trunk/source/java/net/sf/jcontracts/icontract/Interface.java
trunk/source/java/net/sf/jcontracts/icontract/Internal0Option.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheck.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheckCallOption.java
trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
trunk/source/java/net/sf/jcontracts/icontract/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/icontract/NoInitialCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/NoRepositoryCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/OneOneOption.java
trunk/source/java/net/sf/jcontracts/icontract/Option.java
trunk/source/java/net/sf/jcontracts/icontract/OutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/ParameterOption.java
trunk/source/java/net/sf/jcontracts/icontract/PrePostCheck.java
trunk/source/java/net/sf/jcontracts/icontract/ProcessingOption.java
trunk/source/java/net/sf/jcontracts/icontract/QuietOption.java
trunk/source/java/net/sf/jcontracts/icontract/Repository.java
trunk/source/java/net/sf/jcontracts/icontract/RepositoryOutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/SourceCompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java
trunk/source/java/net/sf/jcontracts/icontract/Target.java
trunk/source/java/net/sf/jcontracts/icontract/Tool.java
trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java
trunk/source/java/net/sf/jcontracts/icontract/Variable.java
trunk/source/java/net/sf/jcontracts/icontract/VerboseOption.java
trunk/source/java/net/sf/jcontracts/icontract/WrapExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/XOption.java
trunk/source/java/net/sf/jcontracts/icontract/instruction/DeclareReturnValueHolder.java
trunk/source/java/net/sf/jcontracts/icontract/instruction/Instruction.java
trunk/source/java/net/sf/jcontracts/icontract/instruction/InstructionBase.java
trunk/source/java/net/sf/jcontracts/icontract/side/MethodFront.java
trunk/source/java/net/sf/jcontracts/icontract/side/Side.java
trunk/source/java/net/sf/jcontracts/icontract/side/SideBase.java
trunk/source/java/net/sf/jcontracts/icontract/side/SideFactory.java
trunk/source/java/net/sf/jcontracts/icontract/util/Array.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecificationFilter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/CompositePattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Dependency.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraintExporter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DifferencePattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IdiomFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LanguageFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecTokenTypes.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Pattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingularPattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/xml/XMLRuleLanguage.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/xml/XMLRuleLanguageSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/with_rules/IArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/with_rules/IRule.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IArchitectureExporter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IArchitectureSpecificationFilter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IDependency.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/ILanguageFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IllFormedSpecificationException.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/RunData.java
trunk/source/java/net/sf/jcontracts/util/JavaEvaluator.java
trunk/source/java/net/sf/jcontracts/util/StringComparator.java
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public class ANTLRException extends Exception
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public class ANTLRHashString
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.Reader;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public class ANTLRStringBuffer
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.Reader;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public interface ANTLRTokdefParserTokenTypes
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public interface ANTLRTokenTypes
Modified: trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class ActionElement extends AlternativeElement
Modified: trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public class ActionTransInfo
Modified: trunk/source/java/net/sf/jcontracts/antlr/Alternative.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/Alternative.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/Alternative.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class Alternative
Modified: trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.impl.Vector;
Modified: trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
abstract class AlternativeElement extends GrammarElement
Modified: trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import net.sf.jcontracts.antlr.collections.AST;
Modified: trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class BlockContext
Modified: trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class BlockEndElement extends AlternativeElement
Modified: trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
abstract class BlockWithImpliedExitPath extends AlternativeBlock
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
public interface CharFormatter
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class CharLiteralElement extends GrammarAtom
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class CharQueue
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
class CharRangeElement extends AlternativeElement
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.util.Hashtable;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java 2006-12-05 07:25:30 UTC (rev 42)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java 2006-12-27 06:16:00 UTC (rev 43)
@@ -1,3 +1,19 @@
+/*
+ * Copyright 1997-2000 Reto Kramer
+ * Copyright 2006 John Swapceinski, Johan Stuyts
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
package net.sf.jcontracts.antlr;
import java.io.IOException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractiveNoCaseSensitive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktracki...
[truncated message content] |
|
From: <js...@us...> - 2006-12-05 07:25:31
|
Revision: 42
http://svn.sourceforge.net/jcontracts/?rev=42&view=rev
Author: jstuyts
Date: 2006-12-04 23:25:30 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Changed from deprecated to supported methods.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
Modified: trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java 2006-12-04 20:08:21 UTC (rev 41)
+++ trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java 2006-12-05 07:25:30 UTC (rev 42)
@@ -35,11 +35,11 @@
return;
}
int start;
- for (start = 0; start < s.length() && Character.isSpace(s.charAt(start)); start++)
+ for (start = 0; start < s.length() && Character.isWhitespace(s.charAt(start)); start++)
{
}
int end;
- for (end = s.length() - 1; end > start && Character.isSpace(s.charAt(end)); end--)
+ for (end = s.length() - 1; end > start && Character.isWhitespace(s.charAt(end)); end--)
{
}
char c = '\0';
@@ -52,7 +52,7 @@
case 10: // '\n'
currentOutput.println();
printTabs();
- for (; i <= end && Character.isSpace(s.charAt(i)); i++)
+ for (; i <= end && Character.isWhitespace(s.charAt(i)); i++)
{
}
break;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 20:08:26
|
Revision: 41
http://svn.sourceforge.net/jcontracts/?rev=41&view=rev
Author: jstuyts
Date: 2006-12-04 12:08:21 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Replaced input streams with readers.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/Tool.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.antlr;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
@@ -31,7 +31,7 @@
super.caseSensitiveLiterals = true;
}
- public ANTLRLexer(InputStream in)
+ public ANTLRLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.antlr;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.collections.impl.BitSet;
@@ -16,7 +16,7 @@
super.caseSensitiveLiterals = true;
}
- public ANTLRTokdefLexer(InputStream in)
+ public ANTLRTokdefLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,14 +1,14 @@
package net.sf.jcontracts.antlr;
import java.io.IOException;
-import java.io.InputStream;
+import java.io.Reader;
public class CharBufferNoBacktrackingNoInteractive
{
- public CharBufferNoBacktrackingNoInteractive(InputStream input_)
+ public CharBufferNoBacktrackingNoInteractive(Reader input_)
{
- readAheadBuffer = new byte[1024];
+ readAheadBuffer = new char[1024];
input = input_;
queue = new CharQueue(1024);
}
@@ -34,7 +34,7 @@
{
for (int i = 0; i < nbrRead; i++)
{
- queue.append((char) (readAheadBuffer[i] & 0xff));
+ queue.append(readAheadBuffer[i]);
}
}
@@ -50,11 +50,11 @@
return queue.elementAt(i - 1);
}
- transient InputStream input;
+ transient Reader input;
CharQueue queue;
static final int maxReadAhead = 1024;
- byte readAheadBuffer[];
+ char readAheadBuffer[];
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.antlr;
-import java.io.FileInputStream;
+import java.io.FileReader;
import java.io.IOException;
class TokdefTokenManager extends SimpleTokenManager
@@ -14,7 +14,7 @@
filename = filename_;
try
{
- FileInputStream fileIn = new FileInputStream(filename);
+ FileReader fileIn = new FileReader(filename);
ANTLRTokdefLexer tokdefLexer = new ANTLRTokdefLexer(fileIn);
ANTLRTokdefParser tokdefParser = new ANTLRTokdefParser(tokdefLexer);
tokdefParser.file(this);
Modified: trunk/source/java/net/sf/jcontracts/antlr/Tool.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/Tool.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/Tool.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,11 +1,13 @@
package net.sf.jcontracts.antlr;
-import java.io.DataInputStream;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
-import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import net.sf.jcontracts.antlr.collections.impl.Vector;
@@ -16,7 +18,7 @@
{
hasError = false;
genDiagnostics = false;
- f = System.in;
+ f = new InputStreamReader(System.in);
in = null;
errorHandler = new DefaultToolErrorHandler();
}
@@ -41,7 +43,6 @@
{
if (destination_file.isFile())
{
- new DataInputStream(System.in);
if (!destination_file.canWrite())
{
throw new FileCopyException("FileCopy: destination file is unwriteable: " + dest_name);
@@ -116,9 +117,9 @@
{
if (grammarFile != null)
{
- f = new FileInputStream(grammarFile);
+ f = new FileReader(grammarFile);
}
- in = new DataInputStream(f);
+ in = new BufferedReader(f);
}
catch (IOException _ex)
{
@@ -437,9 +438,9 @@
String grammarFile;
- transient InputStream f;
+ transient Reader f;
- transient DataInputStream in;
+ transient Reader in;
protected static String literalsPrefix = "LITERAL_";
Modified: trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -19,14 +19,14 @@
super.caseSensitiveLiterals = true;
}
- public ActionLexer(InputStream in)
+ public ActionLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
public ActionLexer(String s, RuleBlock currentRule, CodeGenerator generator, ActionTransInfo transInfo)
{
- this(((InputStream) (new StringBufferInputStream(s))));
+ this(new StringReader(s));
this.currentRule = currentRule;
this.generator = generator;
this.transInfo = transInfo;
Modified: trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -5,8 +5,8 @@
package net.sf.jcontracts.antlr.preprocessor;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
+import java.io.FileReader;
import java.util.Enumeration;
import java.util.Hashtable;
@@ -94,7 +94,7 @@
public void readGrammarFile(String file)
throws FileNotFoundException
{
- FileInputStream grStream = new FileInputStream(file);
+ FileReader grStream = new FileReader(file);
addGrammarFile(new GrammarFile(file));
PreprocessorLexer ppLexer = new PreprocessorLexer(grStream);
Preprocessor pp = new Preprocessor(ppLexer);
Modified: trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -5,7 +5,7 @@
package net.sf.jcontracts.antlr.preprocessor;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.*;
@@ -31,7 +31,7 @@
super.caseSensitiveLiterals = true;
}
- public PreprocessorLexer(InputStream in)
+ public PreprocessorLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.argparser;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.CharBufferNoBacktrackingNoInteractive;
@@ -72,7 +72,7 @@
super.caseSensitiveLiterals = true;
}
- public ArgLexer(InputStream in)
+ public ArgLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,8 @@
package net.sf.jcontracts.argparser;
-import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.Vector;
import net.sf.jcontracts.antlr.LLkParserNoInteractive;
@@ -98,14 +100,14 @@
{
try
{
- java.io.InputStream is;
+ Reader is;
if (args.length != 0)
{
- is = new FileInputStream(args[0]);
+ is = new FileReader(args[0]);
}
else
{
- is = System.in;
+ is = new InputStreamReader(System.in);
}
ArgLexer lexer = new ArgLexer(is);
lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
Modified: trunk/source/java/net/sf/jcontracts/argparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.argparser;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import java.util.Vector;
import net.sf.jcontracts.antlr.ParserException;
@@ -15,7 +15,7 @@
public Parser(String s)
{
- StringBufferInputStream is = new StringBufferInputStream(s);
+ StringReader is = new StringReader(s);
_lexer = new ArgLexer(is);
_lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
_argparser = new ArgParser(_lexer);
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,7 +1,7 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
import java.io.IOException;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import java.util.Enumeration;
import java.util.Vector;
@@ -351,7 +351,7 @@
{
for (int i = 0; i < specLines.length; i++)
{
- StringBufferInputStream is = new StringBufferInputStream(specLines[i]);
+ StringReader is = new StringReader(specLines[i]);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
try
@@ -393,7 +393,7 @@
{
for (int i = 0; i < gs.length; i++)
{
- StringBufferInputStream is = new StringBufferInputStream(gs[i]);
+ StringReader is = new StringReader(gs[i]);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
try
@@ -415,7 +415,7 @@
{
for (int i = 0; i < ids.length; i++)
{
- StringBufferInputStream is = new StringBufferInputStream(ids[i]);
+ StringReader is = new StringReader(ids[i]);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
try
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import java.util.Enumeration;
import java.util.Vector;
@@ -62,7 +62,7 @@
System.err.println("could resolve up to: " + c);
throw new RuntimeException("Could not reolve all group names.\n\nSee Console for details!");
}
- StringBufferInputStream is = new StringBufferInputStream(c);
+ StringReader is = new StringReader(c);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
Idiom idiom = null;
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import net.sf.jcontracts.antlr.ParserException;
@@ -17,7 +17,7 @@
{
Idiom newIdiom = substitute(spec.getGroups());
String patternString = newIdiom.toStringWithoutType();
- StringBufferInputStream is = new StringBufferInputStream(patternString);
+ StringReader is = new StringReader(patternString);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
Pattern p = null;
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import net.sf.jcontracts.antlr.ParserException;
@@ -17,7 +17,7 @@
{
Idiom newIdiom = substitute(spec.getGroups());
String patternString = newIdiom.toStringWithoutType();
- StringBufferInputStream is = new StringBufferInputStream(patternString);
+ StringReader is = new StringReader(patternString);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
Pattern p = null;
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.ANTLRHashString;
@@ -37,7 +37,7 @@
super.caseSensitiveLiterals = true;
}
- public PSpecLexer(InputStream in)
+ public PSpecLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import java.util.Vector;
import net.sf.jcontracts.antlr.LLkParserNoInteractive;
@@ -142,7 +142,7 @@
try
{
String s = "\"label 12 #\"a.*\\x.y.* may * b.*";
- StringBufferInputStream is = new StringBufferInputStream(s);
+ StringReader is = new StringReader(s);
PSpecLexer lexer = new PSpecLexer(is);
PSpecParser parser = new PSpecParser(lexer);
SingleDependencyConstraint r = parser.rule();
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import net.sf.jcontracts.antlr.ParserException;
@@ -11,7 +11,7 @@
public static Pattern createFrom(String p_expression) throws PatternSyntaxException
{
Pattern result = null;
- StringBufferInputStream is = new StringBufferInputStream(p_expression);
+ StringReader is = new StringReader(p_expression);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
try
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import java.util.Enumeration;
import java.util.Vector;
@@ -435,7 +435,7 @@
System.err.println("could resolve up to: " + c);
throw new IllFormedSpecificationException("Could not reolve all group names.\n\nSee Console for details!");
}
- StringBufferInputStream is = new StringBufferInputStream(c);
+ StringReader is = new StringReader(c);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
SingleDependencyConstraint r = null;
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java 2006-12-04 19:46:56 UTC (rev 40)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java 2006-12-04 20:08:21 UTC (rev 41)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
-import java.io.StringBufferInputStream;
+import java.io.StringReader;
import net.sf.jcontracts.antlr.ParserException;
@@ -17,7 +17,7 @@
{
Idiom newIdiom = substitute(spec.getGroups());
String patternString = newIdiom.toStringWithoutType();
- StringBufferInputStream is = new StringBufferInputStream(patternString);
+ StringReader is = new StringReader(patternString);
PSpecLexer speclexer = new PSpecLexer(is);
PSpecParser specparser = new PSpecParser(speclexer);
Pattern p = null;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 19:46:58
|
Revision: 40
http://svn.sourceforge.net/jcontracts/?rev=40&view=rev
Author: jstuyts
Date: 2006-12-04 11:46:56 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Replaced input streams with readers.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java
trunk/source/java/net/sf/jcontracts/icontract/Tool.java
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -3,6 +3,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
+import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
@@ -53,7 +54,7 @@
for (Enumeration e = recache.elements(); e.hasMoreElements();)
{
String fn = (String) e.nextElement();
- FileInputStream is = new FileInputStream(srcbase + fn);
+ FileReader is = new FileReader(srcbase + fn);
System.err.println("Upating cache entry for: " + fn.replace(File.separatorChar, '.'));
Parser parser = new Parser(is, fn);
parser.enableCaptureAllDependencies();
Modified: trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.codeparser;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import net.sf.jcontracts.antlr.ANTLRHashString;
@@ -141,7 +141,7 @@
super.caseSensitiveLiterals = true;
}
- public JavaLexer(InputStream in)
+ public JavaLexer(Reader in)
{
this(new CharBufferNoBacktrackingNoInteractive(in));
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -1,7 +1,9 @@
package net.sf.jcontracts.codeparser;
import java.io.File;
-import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
@@ -2741,16 +2743,16 @@
{
try
{
- java.io.InputStream is;
+ Reader is;
String filename;
if (args.length != 0)
{
- is = new FileInputStream(args[0]);
+ is = new FileReader(args[0]);
filename = args[0];
}
else
{
- is = System.in;
+ is = new InputStreamReader(System.in);
filename = "<System.in>";
}
JavaLexer lexer = new JavaLexer(is);
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -1,6 +1,6 @@
package net.sf.jcontracts.codeparser;
-import java.io.InputStream;
+import java.io.Reader;
import java.util.Hashtable;
import java.util.Vector;
@@ -14,7 +14,7 @@
private JavaLexer _lexer;
- public Parser(InputStream is, String filename)
+ public Parser(Reader is, String filename)
{
_lexer = new JavaLexer(is);
_lexer.setTokenObjectClass("net.sf.jcontracts.codeParser.ExtendedToken");
Modified: trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -2,13 +2,12 @@
import java.io.BufferedReader;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.FilenameFilter;
import java.io.IOException;
-import java.io.InputStream;
import java.io.PrintWriter;
+import java.io.Reader;
import java.util.Enumeration;
import java.util.Vector;
@@ -25,7 +24,7 @@
super(name);
}
- private void copyWithoutLinesStartingWith(FileInputStream is, PrintWriter os, String header) throws IOException
+ private void copyWithoutLinesStartingWith(FileReader is, PrintWriter os, String header) throws IOException
{
char buf[] = new char[300];
for (int ch = is.read(); ch != -1;)
@@ -58,13 +57,13 @@
}
- protected InputStream createStreamForCodeParsing() throws IOException
+ protected Reader createStreamForCodeParsing() throws IOException
{
- FileInputStream is = null;
+ FileReader is = null;
PrintWriter os = null;
try
{
- is = new FileInputStream(getName());
+ is = new FileReader(getName());
os = new PrintWriter(new FileWriter(getName() + ".clean"));
copyWithoutLinesStartingWith(is, os, "/*|*/");
}
@@ -79,7 +78,7 @@
os.close();
}
}
- return new FileInputStream(getName() + ".clean");
+ return new FileReader(getName() + ".clean");
}
Vector enumerateFilesIn(String dir, FilenameFilter filter)
@@ -209,7 +208,7 @@
Vector process(Vector options) throws Exception
{
Vector fileList = new Vector();
- InputStream is = null;
+ Reader is = null;
CleanOption cleanOption = null;
for (int i = 0; i < options.size(); i++)
{
@@ -230,7 +229,7 @@
}
else
{
- is = new FileInputStream(getName());
+ is = new FileReader(getName());
}
Parser parser = new Parser(is, getName());
MetaclassFactory metaclassFactory = new MetaclassFactory(getName());
Modified: trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -1,6 +1,7 @@
package net.sf.jcontracts.icontract;
-import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
import java.util.Vector;
public class SystemInTarget extends FileTarget
@@ -11,9 +12,9 @@
super("<system.in>");
}
- protected InputStream createStreamForCodeParsing()
+ protected Reader createStreamForCodeParsing()
{
- return System.in;
+ return new InputStreamReader(System.in);
}
Vector expand()
Modified: trunk/source/java/net/sf/jcontracts/icontract/Tool.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Tool.java 2006-12-04 19:21:15 UTC (rev 39)
+++ trunk/source/java/net/sf/jcontracts/icontract/Tool.java 2006-12-04 19:46:56 UTC (rev 40)
@@ -1,12 +1,12 @@
package net.sf.jcontracts.icontract;
import java.io.File;
-import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;
+import java.io.Reader;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Vector;
@@ -105,10 +105,10 @@
for (int i = 0; i < targets.size(); i++)
{
String fn = ((Target) targets.elementAt(i)).getName();
- FileInputStream is = null;
+ Reader is = null;
try
{
- is = new FileInputStream(fn);
+ is = new FileReader(fn);
}
catch (FileNotFoundException _ex)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 19:21:21
|
Revision: 39
http://svn.sourceforge.net/jcontracts/?rev=39&view=rev
Author: jstuyts
Date: 2006-12-04 11:21:15 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Removed duplicate code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-12-04 19:07:09 UTC (rev 38)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-12-04 19:21:15 UTC (rev 39)
@@ -140,7 +140,7 @@
return getModifiers().contains("static");
}
- String protectString(String str, char key)
+ protected String protectString(String str, char key)
{
if (str.length() == 0)
{
Modified: trunk/source/java/net/sf/jcontracts/icontract/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 19:07:09 UTC (rev 38)
+++ trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 19:21:15 UTC (rev 39)
@@ -1729,34 +1729,6 @@
return protectString(protectString(str, '\\'), '"');
}
- String protectString(String str, char key)
- {
- if (str.length() == 0)
- {
- return str;
- }
- if (str.indexOf(key) == -1)
- {
- return str;
- }
- StringBuffer buf = new StringBuffer();
- int last;
- int j;
- for (last = 0; (j = str.indexOf(key, last)) != -1; last = j + 1)
- {
- for (int i = last; i < str.indexOf(key, last); i++)
- {
- buf.append(str.charAt(i));
- }
-
- buf.append("\\");
- buf.append(key);
- }
-
- buf.append(str.substring(last, str.length()));
- return buf.toString();
- }
-
public String removedExceptionClassNames(String comment)
{
if (comment.indexOf('#') == -1)
Modified: trunk/source/java/net/sf/jcontracts/icontract/Method.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 19:07:09 UTC (rev 38)
+++ trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 19:21:15 UTC (rev 39)
@@ -2400,34 +2400,6 @@
return protectString(protectString(str, '\\'), '"');
}
- String protectString(String str, char key)
- {
- if (str.length() == 0)
- {
- return str;
- }
- if (str.indexOf(key) == -1)
- {
- return str;
- }
- StringBuffer buf = new StringBuffer();
- int last;
- int j;
- for (last = 0; (j = str.indexOf(key, last)) != -1; last = j + 1)
- {
- for (int i = last; i < str.indexOf(key, last); i++)
- {
- buf.append(str.charAt(i));
- }
-
- buf.append("\\");
- buf.append(key);
- }
-
- buf.append(str.substring(last, str.length()));
- return buf.toString();
- }
-
public String removedExceptionClassNames(String comment)
{
if (comment.indexOf('#') == -1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 19:07:12
|
Revision: 38
http://svn.sourceforge.net/jcontracts/?rev=38&view=rev
Author: jstuyts
Date: 2006-12-04 11:07:09 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Added serial version UID to serializable classes.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java
trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java
trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java
trunk/source/java/net/sf/jcontracts/antlr/ParserException.java
trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java
trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java
trunk/source/java/net/sf/jcontracts/codeparser/Class.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Interface.java
trunk/source/java/net/sf/jcontracts/codeparser/Method.java
trunk/source/java/net/sf/jcontracts/codeparser/Variable.java
trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/Interface.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java
trunk/source/java/net/sf/jcontracts/icontract/Variable.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IllFormedSpecificationException.java
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class ANTLRException extends Exception
{
+ private static final long serialVersionUID = 1L;
public ANTLRException(String s)
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -4,6 +4,7 @@
class FileCopyException extends IOException
{
+ private static final long serialVersionUID = 1L;
public FileCopyException(String msg)
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -4,6 +4,7 @@
public class MismatchedTokenException extends ParserException
{
+ private static final long serialVersionUID = 1L;
public MismatchedTokenException()
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class NoViableAltException extends ParserException
{
+ private static final long serialVersionUID = 1L;
public NoViableAltException()
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/ParserException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ParserException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/ParserException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class ParserException extends ANTLRException
{
+ private static final long serialVersionUID = 1L;
public ParserException()
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class ScannerException extends ANTLRException
{
+ private static final long serialVersionUID = 1L;
public ScannerException()
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class SemanticException extends ParserException
{
+ private static final long serialVersionUID = 1L;
public SemanticException(String s)
{
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Class.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Class.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -4,6 +4,7 @@
public class Class extends TypeMetaclass
{
+ private static final long serialVersionUID = 1L;
public Class(String name, String filename, int line_number)
{
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -7,6 +7,7 @@
class CodeComment implements Serializable
{
+ private static final long serialVersionUID = 1L;
private String _title;
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -7,6 +7,7 @@
{
class Name implements Serializable
{
+ private static final long serialVersionUID = 1L;
private String n_;
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Interface.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Interface.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Interface.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class Interface extends TypeMetaclass
{
+ private static final long serialVersionUID = 1L;
public Interface(String name, String filename, int line_number)
{
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Method.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Method.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Method.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -4,6 +4,7 @@
public class Method extends CodeMetaclass implements ICodeBody
{
+ private static final long serialVersionUID = 1L;
private Vector _parameterList;
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Variable.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Variable.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Variable.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class Variable extends CodeMetaclass
{
+ private static final long serialVersionUID = 1L;
private String _type;
Modified: trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class AllFilesUpToDateException extends RuntimeException
{
+ private static final long serialVersionUID = 1L;
public AllFilesUpToDateException()
{
Modified: trunk/source/java/net/sf/jcontracts/icontract/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -11,6 +11,8 @@
public class Class extends net.sf.jcontracts.codeparser.Class implements InvCheck, PrePostCheck
{
+ private static final long serialVersionUID = 1L;
+
private static final Logger log = Logger.getLogger(Class.class);
public static final String REP_PREFIX = "__REP_";
Modified: trunk/source/java/net/sf/jcontracts/icontract/Interface.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Interface.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/Interface.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -11,6 +11,8 @@
public class Interface extends net.sf.jcontracts.codeparser.Interface implements PrePostCheck, InvCheck
{
+ private static final long serialVersionUID = 1L;
+
private static final Logger log = Logger.getLogger(Interface.class);
public static final String REP_PREFIX = "__REP_";
Modified: trunk/source/java/net/sf/jcontracts/icontract/Method.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -11,8 +11,10 @@
public class Method extends net.sf.jcontracts.codeparser.Method implements InvCheck, PrePostCheck
{
- private static final Logger log = Logger.getLogger(Method.class);
+ private static final long serialVersionUID = 1L;
+private static final Logger log = Logger.getLogger(Method.class);
+
public static final String REP_PREFIX = "__REP_";
public static final String RETURN_VALUE_HOLDER_NAME = "__return_value_holder_";
Modified: trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class UnableToDetermineTypeException extends Exception
{
+ private static final long serialVersionUID = 1L;
public UnableToDetermineTypeException()
{
Modified: trunk/source/java/net/sf/jcontracts/icontract/Variable.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Variable.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/icontract/Variable.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -4,6 +4,7 @@
public class Variable extends net.sf.jcontracts.codeparser.Variable implements PrePostCheck, InvCheck
{
+ private static final long serialVersionUID = 1L;
public Variable(String name, String filename, int line_number)
{
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class PatternSyntaxException extends Exception
{
+ private static final long serialVersionUID = 1L;
public PatternSyntaxException()
{
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IllFormedSpecificationException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IllFormedSpecificationException.java 2006-12-04 18:10:07 UTC (rev 37)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/openapi/IllFormedSpecificationException.java 2006-12-04 19:07:09 UTC (rev 38)
@@ -2,6 +2,7 @@
public class IllFormedSpecificationException extends Exception
{
+ private static final long serialVersionUID = 1L;
public IllFormedSpecificationException(String message)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 18:10:11
|
Revision: 37
http://svn.sourceforge.net/jcontracts/?rev=37&view=rev
Author: jstuyts
Date: 2006-12-04 10:10:07 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Removed unnecessary code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/Method.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
trunk/source/java/net/sf/jcontracts/icontract/Interface.java
trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -118,6 +118,4 @@
private int len;
private CharScanner lexer;
-
- private static final int prime = 151;
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -1750,87 +1750,70 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp = super._returnToken;
break;
case 47: // '/'
mCOMMENT(true);
- Token _tmp1 = super._returnToken;
break;
case 63: // '?'
mQUESTION(true);
- Token _tmp2 = super._returnToken;
break;
case 35: // '#'
mTREE_BEGIN(true);
- Token _tmp3 = super._returnToken;
break;
case 40: // '('
mLPAREN(true);
- Token _tmp4 = super._returnToken;
break;
case 41: // ')'
mRPAREN(true);
- Token _tmp5 = super._returnToken;
break;
case 58: // ':'
mCOLON(true);
- Token _tmp6 = super._returnToken;
break;
case 42: // '*'
mSTAR(true);
- Token _tmp7 = super._returnToken;
break;
case 43: // '+'
mPLUS(true);
- Token _tmp8 = super._returnToken;
break;
case 59: // ';'
mSEMI(true);
- Token _tmp9 = super._returnToken;
break;
case 94: // '^'
mCARET(true);
- Token _tmp10 = super._returnToken;
break;
case 33: // '!'
mBANG(true);
- Token _tmp11 = super._returnToken;
break;
case 124: // '|'
mOR(true);
- Token _tmp12 = super._returnToken;
break;
case 126: // '~'
mNOT_OP(true);
- Token _tmp13 = super._returnToken;
break;
case 125: // '}'
mRCURLY(true);
- Token _tmp14 = super._returnToken;
break;
case 39: // '\''
mCHAR_LITERAL(true);
- Token _tmp15 = super._returnToken;
break;
case 34: // '"'
mSTRING_LITERAL(true);
- Token _tmp16 = super._returnToken;
break;
case 48: // '0'
@@ -1844,17 +1827,14 @@
case 56: // '8'
case 57: // '9'
mINT(true);
- Token _tmp17 = super._returnToken;
break;
case 91: // '['
mARG_ACTION(true);
- Token _tmp18 = super._returnToken;
break;
case 123: // '{'
mACTION(true);
- Token _tmp19 = super._returnToken;
break;
case 65: // 'A'
@@ -1884,7 +1864,6 @@
case 89: // 'Y'
case 90: // 'Z'
mTOKEN_REF(true);
- Token _tmp20 = super._returnToken;
break;
case 97: // 'a'
@@ -1914,37 +1893,31 @@
case 121: // 'y'
case 122: // 'z'
mRULE_REF(true);
- Token _tmp21 = super._returnToken;
break;
case 45: // '-'
mTREE_SPECIFIER(true);
- Token _tmp22 = super._returnToken;
break;
default:
if (super.la_1 == '=' && super.la_2 == '>')
{
mIMPLIES(true);
- Token _tmp23 = super._returnToken;
break;
}
if (super.la_1 == '.' && super.la_2 == '.')
{
mRANGE(true);
- Token _tmp24 = super._returnToken;
break;
}
if (super.la_1 == '=')
{
mASSIGN(true);
- Token _tmp25 = super._returnToken;
break;
}
if (super.la_1 == '.')
{
mWILDCARD(true);
- Token _tmp26 = super._returnToken;
break;
}
if (LA(1) != '\uFFFF')
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -1673,8 +1673,6 @@
public static final String version = "2.20b7";
- private static final boolean DEBUG_PARSER = false;
-
ANTLRGrammarParseBehavior behavior;
Tool tool;
Modified: trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -798,27 +798,22 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp = super._returnToken;
break;
case 40: // '('
mLPAREN(true);
- Token _tmp1 = super._returnToken;
break;
case 41: // ')'
mRPAREN(true);
- Token _tmp2 = super._returnToken;
break;
case 61: // '='
mASSIGN(true);
- Token _tmp3 = super._returnToken;
break;
case 34: // '"'
mSTRING(true);
- Token _tmp4 = super._returnToken;
break;
case 65: // 'A'
@@ -874,7 +869,6 @@
case 121: // 'y'
case 122: // 'z'
mID(true);
- Token _tmp5 = super._returnToken;
break;
case 48: // '0'
@@ -888,20 +882,17 @@
case 56: // '8'
case 57: // '9'
mINT(true);
- Token _tmp6 = super._returnToken;
break;
default:
if (super.la_1 == '/' && super.la_2 == '/')
{
mSL_COMMENT(true);
- Token _tmp7 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '*')
{
mML_COMMENT(true);
- Token _tmp8 = super._returnToken;
break;
}
if (LA(1) != '\uFFFF')
Modified: trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -301,7 +301,6 @@
{
ActionLexer lexer = new ActionLexer(actionStr, currentRule, this, tInfo);
lexer.setLineOffset(line);
- lexer.setTool(tool);
try
{
lexer.mACTION(true);
@@ -414,6 +413,4 @@
protected int bitsetTestThreshold;
- private static boolean OLD_ACTION_TRANSLATOR = true;
-
}
Modified: trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -449,7 +449,6 @@
for (int i = 0; i < blk.alternatives.size(); i++)
{
Alternative alt = blk.getAlternativeAt(i);
- AlternativeElement _tmp = alt.head;
println("");
if (i != 0)
{
Modified: trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -80,8 +80,6 @@
}
}
- private int dummy;
-
private String filename;
private boolean noDefine;
Modified: trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -492,7 +492,6 @@
match('#');
super.text.setLength(_saveIndex);
mTREE(true);
- Token _tmp = super._returnToken;
} else
if(super.la_1 == '#' && _tokenSet_2.member(super.la_2))
{
@@ -519,7 +518,6 @@
match('#');
super.text.setLength(_saveIndex);
mAST_CONSTRUCTOR(true);
- Token _tmp1 = super._returnToken;
} else
if(super.la_1 == '#' && super.la_2 == '#')
{
@@ -1840,7 +1838,6 @@
int _begin = super.text.length();
int _ttype = 15;
mID(true);
- Token _tmp = super._returnToken;
if(_tokenSet_3.member(super.la_1) && _tokenSet_14.member(super.la_2))
{
int _saveIndex = super.text.length();
@@ -2272,7 +2269,6 @@
if(super.la_1 == '=' && _tokenSet_5.member(super.la_2))
{
match('=');
- char _tmp = super.la_1;
matchNot('=');
if(transInfo != null && transInfo.refRuleRoot != null)
{
@@ -2346,7 +2342,6 @@
try
{
mACTION(true);
- Token _tmp = super._returnToken;
_ttype = super._returnToken.getType();
if(_ttype != -1)
{
@@ -2372,15 +2367,9 @@
setLine(lineOffset);
}
- public void setTool(Tool tool)
- {
- this.tool = tool;
- }
-
protected RuleBlock currentRule;
protected CodeGenerator generator;
protected int lineOffset;
- private Tool tool;
ActionTransInfo transInfo;
private static final long _tokenSet_0_data_[] = {
0xffff7f63fffffbf8L, 0x7fffffffffffffffL, 0L, 0L
Modified: trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -5,8 +5,6 @@
package net.sf.jcontracts.antlr.collections;
-import java.io.PrintStream;
-
import net.sf.jcontracts.antlr.collections.impl.BitSet;
public class BitSetTest
Modified: trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -5,7 +5,6 @@
package net.sf.jcontracts.antlr.collections;
-import java.io.PrintStream;
import java.util.Enumeration;
import net.sf.jcontracts.antlr.collections.impl.LList;
Modified: trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -5,7 +5,6 @@
package net.sf.jcontracts.antlr.collections;
-import java.io.PrintStream;
import java.util.Enumeration;
import java.util.NoSuchElementException;
Modified: trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -1727,47 +1727,38 @@
{
case 58: // ':'
mRULE_BLOCK(true);
- Token _tmp = super._returnToken;
break;
case 40: // '('
mSUBRULE_BLOCK(true);
- Token _tmp1 = super._returnToken;
break;
case 47: // '/'
mCOMMENT(true);
- Token _tmp2 = super._returnToken;
break;
case 123: // '{'
mACTION(true);
- Token _tmp3 = super._returnToken;
break;
case 34: // '"'
mSTRING_LITERAL(true);
- Token _tmp4 = super._returnToken;
break;
case 39: // '\''
mCHAR_LITERAL(true);
- Token _tmp5 = super._returnToken;
break;
case 33: // '!'
mBANG(true);
- Token _tmp6 = super._returnToken;
break;
case 59: // ';'
mSEMI(true);
- Token _tmp7 = super._returnToken;
break;
case 125: // '}'
mRCURLY(true);
- Token _tmp8 = super._returnToken;
break;
case 65: // 'A'
@@ -1824,7 +1815,6 @@
case 121: // 'y'
case 122: // 'z'
mID_OR_KEYWORD(true);
- Token _tmp9 = super._returnToken;
break;
case 9: // '\t'
@@ -1832,17 +1822,14 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp10 = super._returnToken;
break;
case 61: // '='
mASSIGN_RHS(true);
- Token _tmp11 = super._returnToken;
break;
case 91: // '['
mARG_ACTION(true);
- Token _tmp12 = super._returnToken;
break;
default:
Modified: trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -7,7 +7,6 @@
import java.io.FileNotFoundException;
import java.io.IOException;
-import java.io.PrintStream;
import java.util.Enumeration;
import net.sf.jcontracts.antlr.collections.impl.Vector;
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -612,17 +612,14 @@
{
case 44: // ','
mCOMMA(true);
- Token _tmp = super._returnToken;
break;
case 34: // '"'
mDOUBLEQUOTE(true);
- Token _tmp1 = super._returnToken;
break;
case 39: // '\''
mQUOTE(true);
- Token _tmp2 = super._returnToken;
break;
case 9: // '\t'
@@ -630,32 +627,27 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp3 = super._returnToken;
break;
default:
if (super.la_1 == '/' && super.la_2 == '/' && LA(3) >= '\003' && LA(3) <= '\377')
{
mSL_COMMENT(true);
- Token _tmp4 = super._returnToken;
break;
}
if (super.la_1 == '-' && _tokenSet_0.member(super.la_2))
{
mOPTION_WITH_ARG(true);
- Token _tmp5 = super._returnToken;
break;
}
if (super.la_1 == '-')
{
mDASH(true);
- Token _tmp6 = super._returnToken;
break;
}
if (_tokenSet_1.member(super.la_1))
{
mIDENT(true);
- Token _tmp7 = super._returnToken;
break;
}
if (LA(1) != '\uFFFF')
Modified: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -33,8 +33,6 @@
private IDependencyFilter filter;
- private Vector unusedConstraints;
-
public DottyVisitor(IArchitectureSpecification spec, String filename, String title, boolean layoutLR,
boolean directed, int componentVisitorDetailLevel, boolean showPackages, Vector quietList, boolean check,
boolean do_not_show_dependecy_details, IDependencyFilter filter) throws IOException
@@ -45,7 +43,6 @@
cluster_index = 1;
specification = null;
this.filter = null;
- unusedConstraints = new Vector();
specification = spec;
if (componentVisitorDetailLevel == 2)
{
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -5,7 +5,6 @@
import java.util.Hashtable;
import java.util.Vector;
-import net.sf.jcontracts.icontract.QuietOption;
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
public class Dotty_Component_CommonLevel
@@ -145,7 +144,6 @@
}
}
}
- QuietOption _tmp = QuietOption.theQuietOption;
return result;
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -9,18 +9,14 @@
public class Dotty_Component_TypeLevel extends Dotty_Component_CommonLevel implements IDotty_Component_Level
{
- private Vector previouslinks;
-
public Dotty_Component_TypeLevel(IDependencyFilter filter, boolean performChecks)
{
- previouslinks = new Vector();
super.performChecks = performChecks;
super.filter = filter;
}
public Dotty_Component_TypeLevel(boolean performChecks)
{
- previouslinks = new Vector();
super.performChecks = performChecks;
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -21,8 +21,6 @@
private int _suspectedTokenStartPosition;
- private String _filename;
-
private int _last_newline_position;
private static final long _tokenSet_0_data_[] =
@@ -87,7 +85,6 @@
_data = null;
_position = 0;
_suspectedTokenStartPosition = 0;
- _filename = "?";
_last_newline_position = 0;
super.literals = new Hashtable();
super.literals.put(new ANTLRHashString("synchronized", this), new Integer(32));
@@ -165,11 +162,6 @@
return _suspectedTokenStartPosition - _last_newline_position;
}
- private String getFilename()
- {
- return _filename;
- }
-
int getPosition()
{
return _position;
@@ -2897,57 +2889,46 @@
{
case 63: // '?'
mQUESTION(true);
- Token _tmp = super._returnToken;
break;
case 40: // '('
mLPAREN(true);
- Token _tmp1 = super._returnToken;
break;
case 41: // ')'
mRPAREN(true);
- Token _tmp2 = super._returnToken;
break;
case 91: // '['
mLBRACK(true);
- Token _tmp3 = super._returnToken;
break;
case 93: // ']'
mRBRACK(true);
- Token _tmp4 = super._returnToken;
break;
case 123: // '{'
mLCURLY(true);
- Token _tmp5 = super._returnToken;
break;
case 125: // '}'
mRCURLY(true);
- Token _tmp6 = super._returnToken;
break;
case 58: // ':'
mCOLON(true);
- Token _tmp7 = super._returnToken;
break;
case 44: // ','
mCOMMA(true);
- Token _tmp8 = super._returnToken;
break;
case 126: // '~'
mBNOT(true);
- Token _tmp9 = super._returnToken;
break;
case 59: // ';'
mSEMI(true);
- Token _tmp10 = super._returnToken;
break;
case 9: // '\t'
@@ -2956,22 +2937,18 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp11 = super._returnToken;
break;
case 35: // '#'
mPREPROC_LINE(true);
- Token _tmp12 = super._returnToken;
break;
case 39: // '\''
mCHAR_LITERAL(true);
- Token _tmp13 = super._returnToken;
break;
case 34: // '"'
mSTRING_LITERAL(true);
- Token _tmp14 = super._returnToken;
break;
case 36: // '$'
@@ -3029,249 +3006,208 @@
case 121: // 'y'
case 122: // 'z'
mIDENT(true);
- Token _tmp15 = super._returnToken;
break;
default:
if (super.la_1 == '>' && super.la_2 == '>' && LA(3) == '>' && LA(4) == '=')
{
mBSR_ASSIGN(true);
- Token _tmp16 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '*' && LA(3) == '*' && LA(4) == '/')
{
mTRIV_COMMENT(true);
- Token _tmp17 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '*' && LA(3) == '*' && LA(4) >= '\003'
&& LA(4) <= '\377')
{
mCODE_COMMENT(true);
- Token _tmp18 = super._returnToken;
break;
}
if (super.la_1 == '>' && super.la_2 == '>' && LA(3) == '=')
{
mSR_ASSIGN(true);
- Token _tmp19 = super._returnToken;
break;
}
if (super.la_1 == '>' && super.la_2 == '>' && LA(3) == '>')
{
mBSR(true);
- Token _tmp20 = super._returnToken;
break;
}
if (super.la_1 == '<' && super.la_2 == '<' && LA(3) == '=')
{
mSL_ASSIGN(true);
- Token _tmp21 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '*' && _tokenSet_0.member(LA(3)))
{
mML_COMMENT(true);
- Token _tmp22 = super._returnToken;
break;
}
if (super.la_1 == '=' && super.la_2 == '=')
{
mEQUAL(true);
- Token _tmp23 = super._returnToken;
break;
}
if (super.la_1 == '!' && super.la_2 == '=')
{
mNOT_EQUAL(true);
- Token _tmp24 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '=')
{
mDIV_ASSIGN(true);
- Token _tmp25 = super._returnToken;
break;
}
if (super.la_1 == '+' && super.la_2 == '=')
{
mPLUS_ASSIGN(true);
- Token _tmp26 = super._returnToken;
break;
}
if (super.la_1 == '+' && super.la_2 == '+')
{
mINC(true);
- Token _tmp27 = super._returnToken;
break;
}
if (super.la_1 == '-' && super.la_2 == '=')
{
mMINUS_ASSIGN(true);
- Token _tmp28 = super._returnToken;
break;
}
if (super.la_1 == '-' && super.la_2 == '-')
{
mDEC(true);
- Token _tmp29 = super._returnToken;
break;
}
if (super.la_1 == '*' && super.la_2 == '=')
{
mSTAR_ASSIGN(true);
- Token _tmp30 = super._returnToken;
break;
}
if (super.la_1 == '%' && super.la_2 == '=')
{
mMOD_ASSIGN(true);
- Token _tmp31 = super._returnToken;
break;
}
if (super.la_1 == '>' && super.la_2 == '>')
{
mSR(true);
- Token _tmp32 = super._returnToken;
break;
}
if (super.la_1 == '>' && super.la_2 == '=')
{
mGE(true);
- Token _tmp33 = super._returnToken;
break;
}
if (super.la_1 == '<' && super.la_2 == '<')
{
mSL(true);
- Token _tmp34 = super._returnToken;
break;
}
if (super.la_1 == '<' && super.la_2 == '=')
{
mLE(true);
- Token _tmp35 = super._returnToken;
break;
}
if (super.la_1 == '^' && super.la_2 == '=')
{
mBXOR_ASSIGN(true);
- Token _tmp36 = super._returnToken;
break;
}
if (super.la_1 == '|' && super.la_2 == '=')
{
mBOR_ASSIGN(true);
- Token _tmp37 = super._returnToken;
break;
}
if (super.la_1 == '|' && super.la_2 == '|')
{
mLOR(true);
- Token _tmp38 = super._returnToken;
break;
}
if (super.la_1 == '&' && super.la_2 == '=')
{
mBAND_ASSIGN(true);
- Token _tmp39 = super._returnToken;
break;
}
if (super.la_1 == '&' && super.la_2 == '&')
{
mLAND(true);
- Token _tmp40 = super._returnToken;
break;
}
if (super.la_1 == '/' && super.la_2 == '/')
{
mSL_COMMENT(true);
- Token _tmp41 = super._returnToken;
break;
}
if (super.la_1 == '.')
{
mDOT(true);
- Token _tmp42 = super._returnToken;
break;
}
if (super.la_1 == '=')
{
mASSIGN(true);
- Token _tmp43 = super._returnToken;
break;
}
if (super.la_1 == '!')
{
mLNOT(true);
- Token _tmp44 = super._returnToken;
break;
}
if (super.la_1 == '/')
{
mDIV(true);
- Token _tmp45 = super._returnToken;
break;
}
if (super.la_1 == '+')
{
mPLUS(true);
- Token _tmp46 = super._returnToken;
break;
}
if (super.la_1 == '-')
{
mMINUS(true);
- Token _tmp47 = super._returnToken;
break;
}
if (super.la_1 == '*')
{
mSTAR(true);
- Token _tmp48 = super._returnToken;
break;
}
if (super.la_1 == '%')
{
mMOD(true);
- Token _tmp49 = super._returnToken;
break;
}
if (super.la_1 == '>')
{
mGT(true);
- Token _tmp50 = super._returnToken;
break;
}
if (super.la_1 == '<')
{
mLT(true);
- Token _tmp51 = super._returnToken;
break;
}
if (super.la_1 == '^')
{
mBXOR(true);
- Token _tmp52 = super._returnToken;
break;
}
if (super.la_1 == '|')
{
mBOR(true);
- Token _tmp53 = super._returnToken;
break;
}
if (super.la_1 == '&')
{
mBAND(true);
- Token _tmp54 = super._returnToken;
break;
}
if (_tokenSet_1.member(super.la_1))
{
mNUM_INT(true);
- Token _tmp55 = super._returnToken;
break;
}
if (LA(1) != '\uFFFF')
@@ -3307,10 +3243,4 @@
{
_data = o;
}
-
- void setFilename(String filename)
- {
- _filename = filename;
- }
-
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -30,8 +30,6 @@
private static String otherConst = "other";
- private boolean displayMissingTypeWarning;
-
private boolean captureAllDependencies;
private Vector _annotations;
@@ -485,7 +483,6 @@
protected JavaParser(TokenBuffer tokenBuf, int k)
{
super(tokenBuf, k);
- displayMissingTypeWarning = true;
captureAllDependencies = true;
_annotations = new Vector();
importList_ = new Vector();
@@ -508,7 +505,6 @@
protected JavaParser(Tokenizer lexer, int k)
{
super(lexer, k);
- displayMissingTypeWarning = true;
captureAllDependencies = true;
_annotations = new Vector();
importList_ = new Vector();
@@ -1531,11 +1527,6 @@
captureAllDependencies = false;
}
- void disableDisplayMissingTypeWarning()
- {
- displayMissingTypeWarning = false;
- }
-
public void enableCaptureAllDependencies()
{
captureAllDependencies = true;
@@ -1546,11 +1537,6 @@
captureAllDep = true;
}
- void enableDisplayMissingTypeWarning()
- {
- displayMissingTypeWarning = true;
- }
-
private void enterMethod(Method m)
{
currentMethod = m;
@@ -2768,7 +2754,6 @@
filename = "<System.in>";
}
JavaLexer lexer = new JavaLexer(is);
- lexer.setFilename(filename);
lexer.setTokenObjectClass("net.sf.jcontracts.codeParser.ExtendedToken");
JavaParser parser = new JavaParser(lexer);
MetaclassFactory metaclassFactory = new MetaclassFactory(filename);
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Method.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Method.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Method.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -21,8 +21,6 @@
private int _endOfConstructorSuperCall;
- private int _numberOfReturnStatements;
-
protected Vector newedTypes;
protected Vector castedTypes;
@@ -40,7 +38,6 @@
_body_indentation = 0;
_endOfLastStatement = 0;
_endOfConstructorSuperCall = 0;
- _numberOfReturnStatements = 0;
newedTypes = new Vector();
castedTypes = new Vector();
localVarTypes = new Vector();
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Parser.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -17,7 +17,6 @@
public Parser(InputStream is, String filename)
{
_lexer = new JavaLexer(is);
- _lexer.setFilename(filename);
_lexer.setTokenObjectClass("net.sf.jcontracts.codeParser.ExtendedToken");
_javaparser = new JavaParser(_lexer);
_javaparser.setFilename(filename);
@@ -45,7 +44,6 @@
public Vector getAnnotations() throws ParserException
{
- _javaparser.enableDisplayMissingTypeWarning();
_javaparser.compilationUnit();
return _javaparser.getAnnotations();
}
Modified: trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -134,11 +134,6 @@
return !found;
}
- private boolean isVisited()
- {
- return visited4marked_;
- }
-
public void mark(BooleanBlockWithNodeArg block)
{
if (!visited4marked_ && !marked_)
Modified: trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -373,7 +373,7 @@
{
String code = "";
String elementType = getElementType();
- String _tmp = "__" + getMangledValue(getElementVar()) + "_counter";
+ getMangledValue(getElementVar());
String elementVar = getElementVar();
String resultVar = "__result_" + getMangledValue(getElementVar());
String quantificationDomain = getQuantificationDomain();
@@ -707,7 +707,7 @@
{
String code = "";
String elementType = getElementType();
- String _tmp = "__" + getMangledValue(getElementVar()) + "_counter";
+ getMangledValue(getElementVar());
String elementVar = getElementVar();
String resultVar = "__result_" + getMangledValue(getElementVar());
String quantificationDomain = getQuantificationDomain();
Modified: trunk/source/java/net/sf/jcontracts/icontract/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/Class.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -15,12 +15,6 @@
public static final String REP_PREFIX = "__REP_";
- private static final String INV_GET_METHOD = "__JContractS__getInvariantList";
-
- private static final String INV_SO_GET_METHOD = "__JContractS__getInvariantSourceList";
-
- private static final String INVARIANT_TAG_NAME = "invariant";
-
public static final String INVARIANT_CHECK_METHOD_NAME = "__check_invariant__";
public static final String INVARIANT_CHECK_AT_ENTRY = "__inv_check_at_entry__";
@@ -31,10 +25,6 @@
public static final char EXCEPTION_CLASS_MARKER = 35;
- private static final String START_SEPARATION_STRING = "//#*#-------------------------------------------------------------------------------";
-
- private static final String END_SEPARATION_STRING = "//-------------------------------------------------------------------------------#*#";
-
public static boolean generateSuperCheckCallFlag = false;
public static boolean doWrapExceptionOptionFlag = false;
@@ -1804,7 +1794,7 @@
Method theIGMethod = c.getMethod("__JContractS__getInvariantList", noArgArray);
try
{
- Vector _tmp = (Vector) theIGMethod.invoke(c, noArgArray);
+ theIGMethod.invoke(c, noArgArray);
res = true;
}
catch (InvocationTargetException _ex)
Modified: trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Darwin.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/Darwin.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -19,10 +19,6 @@
{
private static final Logger log = Logger.getLogger(Darwin.class);
- private static final String LANGUAGE_START_TAG = "<idarwin language=";
-
- private static final String LANGUAGE_END_TAG = "</idarwin>";
-
public static boolean process(String args[], Vector specset, boolean layoutLR, boolean directed,
String outputfilename, boolean check, int componentDetailLevel, boolean showPackages, Vector quietList,
Vector allFiles, Vector changedFiles, String srcbase, boolean do_not_show_dependecy_details,
Modified: trunk/source/java/net/sf/jcontracts/icontract/Interface.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Interface.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/Interface.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -15,12 +15,6 @@
public static final String REP_PREFIX = "__REP_";
- private static final String INV_GET_METHOD = " __JContractS__getInvariantList";
-
- private static final String INV_SO_GET_METHOD = " __JContractS__getInvariantSourceList";
-
- private static final String INVARIANT_TAG_NAME = "invariant";
-
public Interface(String name, String filename, int line_number)
{
super(name, filename, line_number);
@@ -1001,7 +995,7 @@
Method theIGMethod = c.getMethod(" __JContractS__getInvariantList", noArgArray);
try
{
- Vector _tmp = (Vector) theIGMethod.invoke(c, noArgArray);
+ theIGMethod.invoke(c, noArgArray);
res = true;
}
catch (InvocationTargetException _ex)
Modified: trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -286,10 +286,6 @@
DefaultExceptionOption defaultExceptionOption = null;
for (int i = 0; i < options.size(); i++)
{
- if ("c".compareTo(((Option) options.elementAt(i)).getName()) == 0)
- {
- CompilerOption _tmp = (CompilerOption) options.elementAt(i);
- }
if ("n".compareTo(((Option) options.elementAt(i)).getName()) == 0)
{
noRepositoryCompilationOption = (NoRepositoryCompilationOption) options.elementAt(i);
@@ -314,7 +310,6 @@
}
if ("i".compareTo(((Option) options.elementAt(i)).getName()) == 0)
{
- InvCheckCallOption _tmp1 = (InvCheckCallOption) options.elementAt(i);
Class.generateSuperCheckCallFlag = true;
}
if ("w".compareTo(((Option) options.elementAt(i)).getName()) == 0)
Modified: trunk/source/java/net/sf/jcontracts/icontract/Method.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/icontract/Method.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -13,34 +13,14 @@
{
private static final Logger log = Logger.getLogger(Method.class);
- private static final String PRECONDITION_TAG_NAME_1 = "pre";
-
- private static final String PRECONDITION_TAG_NAME_2 = "require";
-
- private static final String POSTCONDITION_TAG_NAME_1 = "post";
-
- private static final String POSTCONDITION_TAG_NAME_2 = "ensure";
-
public static final String REP_PREFIX = "__REP_";
- private static final String PRE_GET_METHOD = " __JContractS__getPreList";
-
- private static final String POST_GET_METHOD = " __JContractS__getPostList";
-
- private static final char EXCEPTION_CLASS_MARKER = 35;
-
public static final String RETURN_VALUE_HOLDER_NAME = "__return_value_holder_";
- private static final String START_SEPARATION_STRING = "//#*#-------------------------------------------------------------------------------";
-
- private static final String END_SEPARATION_STRING = "//-------------------------------------------------------------------------------#*#";
-
public static boolean doWrapExceptionOptionFlag = false;
public static String defaultExceptionClassName = "RuntimeException";
- private static final String impli = "implies";
-
public Method(String name, Vector parameterList, String filename, int line_number)
{
super(name, parameterList, filename, line_number);
@@ -2485,7 +2465,7 @@
java.lang.reflect.Method theIGMethod = c.getMethod(mangleExpression(methodName), noArgArray);
try
{
- Vector _tmp = (Vector) theIGMethod.invoke(c, noArgArray);
+ theIGMethod.invoke(c, noArgArray);
res = true;
}
catch (InvocationTargetException _ex)
@@ -2528,7 +2508,7 @@
java.lang.reflect.Method theIGMethod = c.getMethod(mangleExpression(methodName), noArgArray);
try
{
- Vector _tmp = (Vector) theIGMethod.invoke(c, noArgArray);
+ theIGMethod.invoke(c, noArgArray);
res = true;
}
catch (InvocationTargetException _ex)
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -15,23 +15,6 @@
this.label = label;
}
- private String basicRemoveIfsubstitutedIn(String r)
- {
- StringBuffer buf = new StringBuffer();
- String tag = "[" + label + "]";
- String inset = "";
- int lastpos = 0;
- for (int pos = -1; (pos = r.indexOf(tag, lastpos)) != -1;)
- {
- buf.append(r.substring(lastpos, pos));
- buf.append(inset);
- lastpos = pos + tag.length();
- }
-
- buf.append(r.substring(lastpos, r.length()));
- return buf.toString();
- }
-
private String basicSubstituteIn(String r)
{
StringBuffer buf = new StringBuffer();
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -19,8 +19,6 @@
private int _position;
- private int _suspectedTokenStartPosition;
-
private static final long _tokenSet_0_data_[] =
{
-1032L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
@@ -33,7 +31,6 @@
super(cb);
_data = null;
_position = 0;
- _suspectedTokenStartPosition = 0;
super.literals = new Hashtable();
super.literals.put(new ANTLRHashString("mustnot", this), new Integer(6));
super.literals.put(new ANTLRHashString("may", this), new Integer(5));
@@ -700,22 +697,18 @@
{
case 92: // '\\'
mBACKSLASH(true);
- Token _tmp = super._returnToken;
break;
case 123: // '{'
mCBOPEN(true);
- Token _tmp1 = super._returnToken;
break;
case 125: // '}'
mCBCLOSE(true);
- Token _tmp2 = super._returnToken;
break;
case 44: // ','
mCOMMA(true);
- Token _tmp3 = super._returnToken;
break;
case 9: // '\t'
@@ -723,17 +716,14 @@
case 13: // '\r'
case 32: // ' '
mWS(true);
- Token _tmp4 = super._returnToken;
break;
case 47: // '/'
mSL_COMMENT(true);
- Token _tmp5 = super._returnToken;
break;
case 34: // '"'
mCOMMENT(true);
- Token _tmp6 = super._returnToken;
break;
case 36: // '$'
@@ -806,7 +796,6 @@
case 121: // 'y'
case 122: // 'z'
mIDENT(true);
- Token _tmp7 = super._returnToken;
break;
default:
@@ -836,7 +825,6 @@
{
super.resetText();
setData(null);
- _suspectedTokenStartPosition = getPosition();
}
protected void setData(Object o)
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java 2006-12-04 17:08:12 UTC (rev 36)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java 2006-12-04 18:10:07 UTC (rev 37)
@@ -63,28 +63,6 @@
return matchAny(s);
}
- private boolean matchAll(Pattern p)
- {
- boolean result = true;
- for (int i = 0; result && i < patterns.length; i++)
- {
- result = p.match(patterns[i]);
- }
-
- return result;
- }
-
- private boolean matchAll(String s)
- {
- boolean result = true;
- for (int i = 0; result && i < patterns.length; i++)
- {
- result = patterns[i].match(s);
- }
-
- return result;
- }
-
private boolean matchAny(Pattern p)
{
for (int i = 0; i < patterns.length; i++)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-12-04 17:08:25
|
Revision: 36
http://svn.sourceforge.net/jcontracts/?rev=36&view=rev
Author: jstuyts
Date: 2006-12-04 09:08:12 -0800 (Mon, 04 Dec 2006)
Log Message:
-----------
Moved ANTLR classes to another package so they do not collide with classes from other versions of ANTLR.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
trunk/source/java/net/sf/jcontracts/codeparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java
Added Paths:
-----------
trunk/source/java/net/sf/jcontracts/antlr/
trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRStringBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefLexer.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParser.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokdefParserTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ANTLRTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/ASTFactory.java
trunk/source/java/net/sf/jcontracts/antlr/ASTIterator.java
trunk/source/java/net/sf/jcontracts/antlr/ASTNULLType.java
trunk/source/java/net/sf/jcontracts/antlr/ASTPair.java
trunk/source/java/net/sf/jcontracts/antlr/ASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/AbstractParser.java
trunk/source/java/net/sf/jcontracts/antlr/ActionElement.java
trunk/source/java/net/sf/jcontracts/antlr/ActionTransInfo.java
trunk/source/java/net/sf/jcontracts/antlr/Alternative.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeBlock.java
trunk/source/java/net/sf/jcontracts/antlr/AlternativeElement.java
trunk/source/java/net/sf/jcontracts/antlr/BaseAST.java
trunk/source/java/net/sf/jcontracts/antlr/BlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/BlockEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/BlockWithImpliedExitPath.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharBufferNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/CharLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharQueue.java
trunk/source/java/net/sf/jcontracts/antlr/CharRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/CharScanner.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/CharScannerNoBacktrackingNoInteractiveNoCaseSensitive.java
trunk/source/java/net/sf/jcontracts/antlr/CodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/CommonAST.java
trunk/source/java/net/sf/jcontracts/antlr/CommonToken.java
trunk/source/java/net/sf/jcontracts/antlr/DefaultToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/DefineGrammarSymbols.java
trunk/source/java/net/sf/jcontracts/antlr/DiagnosticCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/DumpASTVisitor.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionHandler.java
trunk/source/java/net/sf/jcontracts/antlr/ExceptionSpec.java
trunk/source/java/net/sf/jcontracts/antlr/FileCopyException.java
trunk/source/java/net/sf/jcontracts/antlr/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarAtom.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarElement.java
trunk/source/java/net/sf/jcontracts/antlr/GrammarSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/JavaBlockFinishingInfo.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCharFormatter.java
trunk/source/java/net/sf/jcontracts/antlr/JavaCodeGenerator.java
trunk/source/java/net/sf/jcontracts/antlr/LLkAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkGrammarAnalyzer.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParser.java
trunk/source/java/net/sf/jcontracts/antlr/LLkParserNoInteractive.java
trunk/source/java/net/sf/jcontracts/antlr/LexerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/Lookahead.java
trunk/source/java/net/sf/jcontracts/antlr/MakeGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/MismatchedTokenException.java
trunk/source/java/net/sf/jcontracts/antlr/NoViableAltException.java
trunk/source/java/net/sf/jcontracts/antlr/OneOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/OptionalBlock.java
trunk/source/java/net/sf/jcontracts/antlr/Parser.java
trunk/source/java/net/sf/jcontracts/antlr/ParserException.java
trunk/source/java/net/sf/jcontracts/antlr/ParserGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/RuleBlock.java
trunk/source/java/net/sf/jcontracts/antlr/RuleEndElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/RuleSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/ScannerException.java
trunk/source/java/net/sf/jcontracts/antlr/SemanticException.java
trunk/source/java/net/sf/jcontracts/antlr/SimpleTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralElement.java
trunk/source/java/net/sf/jcontracts/antlr/StringLiteralSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/SynPredBlock.java
trunk/source/java/net/sf/jcontracts/antlr/TokdefTokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/Token.java
trunk/source/java/net/sf/jcontracts/antlr/TokenBuffer.java
trunk/source/java/net/sf/jcontracts/antlr/TokenManager.java
trunk/source/java/net/sf/jcontracts/antlr/TokenQueue.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRangeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenRefElement.java
trunk/source/java/net/sf/jcontracts/antlr/TokenSymbol.java
trunk/source/java/net/sf/jcontracts/antlr/Tokenizer.java
trunk/source/java/net/sf/jcontracts/antlr/Tool.java
trunk/source/java/net/sf/jcontracts/antlr/ToolErrorHandler.java
trunk/source/java/net/sf/jcontracts/antlr/TreeBlockContext.java
trunk/source/java/net/sf/jcontracts/antlr/TreeElement.java
trunk/source/java/net/sf/jcontracts/antlr/TreeParser.java
trunk/source/java/net/sf/jcontracts/antlr/TreeSpecifierNode.java
trunk/source/java/net/sf/jcontracts/antlr/TreeWalkerGrammar.java
trunk/source/java/net/sf/jcontracts/antlr/WildcardElement.java
trunk/source/java/net/sf/jcontracts/antlr/ZeroOrMoreBlock.java
trunk/source/java/net/sf/jcontracts/antlr/actions/
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexer.java
trunk/source/java/net/sf/jcontracts/antlr/actions/ActionLexerTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/collections/
trunk/source/java/net/sf/jcontracts/antlr/collections/AST.java
trunk/source/java/net/sf/jcontracts/antlr/collections/ASTEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/BitSetTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Enumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LLStackTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/LListTest.java
trunk/source/java/net/sf/jcontracts/antlr/collections/List.java
trunk/source/java/net/sf/jcontracts/antlr/collections/Stack.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTArray.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/ASTEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/BitSet.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/IndexedVector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLCell.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LLEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/LList.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/Vector.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumeration.java
trunk/source/java/net/sf/jcontracts/antlr/collections/impl/VectorEnumerator.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Grammar.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/GrammarFile.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Hierarchy.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Option.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Preprocessor.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorLexer.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/PreprocessorTokenTypes.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Rule.java
trunk/source/java/net/sf/jcontracts/antlr/preprocessor/Tool.java
Removed Paths:
-------------
trunk/classes/
Added: trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java (rev 0)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRException.java 2006-12-04 17:08:12 UTC (rev 36)
@@ -0,0 +1,10 @@
+package net.sf.jcontracts.antlr;
+
+public class ANTLRException extends Exception
+{
+
+ public ANTLRException(String s)
+ {
+ super(s);
+ }
+}
Added: trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java (rev 0)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRGrammarParseBehavior.java 2006-12-04 17:08:12 UTC (rev 36)
@@ -0,0 +1,104 @@
+package net.sf.jcontracts.antlr;
+
+import net.sf.jcontracts.antlr.collections.impl.BitSet;
+
+public interface ANTLRGrammarParseBehavior
+{
+
+ public abstract void abortGrammar();
+
+ public abstract void beginAlt(boolean flag);
+
+ public abstract void beginChildList();
+
+ public abstract void beginExceptionGroup();
+
+ public abstract void beginExceptionSpec(Token token);
+
+ public abstract void beginSubRule(Token token, int i, boolean flag);
+
+ public abstract void beginTree(int i) throws SemanticException;
+
+ public abstract void defineRuleName(Token token, String s, boolean flag) throws SemanticException;
+
+ public abstract void endAlt();
+
+ public abstract void endChildList();
+
+ public abstract void endExceptionGroup();
+
+ public abstract void endExceptionSpec();
+
+ public abstract void endGrammar();
+
+ public abstract void endOptions();
+
+ public abstract void endRule(String s);
+
+ public abstract void endSubRule();
+
+ public abstract void endTree();
+
+ public abstract void hasError();
+
+ public abstract void noASTSubRule();
+
+ public abstract void oneOrMoreSubRule();
+
+ public abstract void optionalSubRule();
+
+ public abstract void refAction(Token token);
+
+ public abstract void refArgAction(Token token);
+
+ public abstract void refCharLiteral(Token token, Token token1, boolean flag, int i, boolean flag1);
+
+ public abstract void refCharRange(Token token, Token token1, Token token2, int i, boolean flag);
+
+ public abstract void refExceptionHandler(Token token, String s);
+
+ public abstract void refHeaderAction(Token token);
+
+ public abstract void refInitAction(Token token);
+
+ public abstract void refMemberAction(Token token);
+
+ public abstract void refPreambleAction(Token token);
+
+ public abstract void refReturnAction(Token token);
+
+ public abstract void refRule(Token token, Token token1, Token token2, Token token3, int i);
+
+ public abstract void refSemPred(Token token);
+
+ public abstract void refStringLiteral(Token token, Token token1, int i, boolean flag);
+
+ public abstract void refToken(Token token, Token token1, Token token2, Token token3, boolean flag, int i,
+ boolean flag1);
+
+ public abstract void refTokenRange(Token token, Token token1, Token token2, int i, boolean flag);
+
+ public abstract void refTreeSpecifier(Token token);
+
+ public abstract void refWildcard(Token token, Token token1, int i);
+
+ public abstract void setArgOfRuleRef(Token token);
+
+ public abstract void setCharVocabulary(BitSet bitset);
+
+ public abstract void setFileOption(Token token, Token token1);
+
+ public abstract void setGrammarOption(Token token, Token token1);
+
+ public abstract void setRuleOption(Token token, Token token1);
+
+ public abstract void startLexer(Token token, String s);
+
+ public abstract void startParser(Token token, String s);
+
+ public abstract void startTreeWalker(Token token, String s);
+
+ public abstract void synPred();
+
+ public abstract void zeroOrMoreSubRule();
+}
Added: trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java (rev 0)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRHashString.java 2006-12-04 17:08:12 UTC (rev 36)
@@ -0,0 +1,123 @@
+package net.sf.jcontracts.antlr;
+
+public class ANTLRHashString
+{
+
+ public ANTLRHashString(char buf[], int length, CharScanner lexer)
+ {
+ this.lexer = lexer;
+ setBuffer(buf, length);
+ }
+
+ public ANTLRHashString(CharScanner lexer)
+ {
+ this.lexer = lexer;
+ }
+
+ public ANTLRHashString(String s, CharScanner lexer)
+ {
+ this.lexer = lexer;
+ setString(s);
+ }
+
+ private final char charAt(int index)
+ {
+ return s == null ? buf[index] : s.charAt(index);
+ }
+
+ public boolean equals(Object o)
+ {
+ if (!(o instanceof ANTLRHashString) && !(o instanceof String))
+ {
+ return false;
+ }
+ ANTLRHashString s;
+ if (o instanceof String)
+ {
+ s = new ANTLRHashString((String) o, lexer);
+ }
+ else
+ {
+ s = (ANTLRHashString) o;
+ }
+ int l = length();
+ if (s.length() != l)
+ {
+ return false;
+ }
+ if (lexer.getCaseSensitiveLiterals())
+ {
+ for (int i = 0; i < l; i++)
+ {
+ if (charAt(i) != s.charAt(i))
+ {
+ return false;
+ }
+ }
+
+ }
+ else
+ {
+ for (int i = 0; i < l; i++)
+ {
+ if (lexer.toLower(charAt(i)) != lexer.toLower(s.charAt(i)))
+ {
+ return false;
+ }
+ }
+
+ }
+ return true;
+ }
+
+ public int hashCode()
+ {
+ int hashval = 0;
+ int l = length();
+ if (lexer.getCaseSensitiveLiterals())
+ {
+ for (int i = 0; i < l; i++)
+ {
+ hashval = hashval * 151 + charAt(i);
+ }
+
+ }
+ else
+ {
+ for (int i = 0; i < l; i++)
+ {
+ hashval = hashval * 151 + lexer.toLower(charAt(i));
+ }
+
+ }
+ return hashval;
+ }
+
+ private final int length()
+ {
+ return s == null ? len : s.length();
+ }
+
+ public void setBuffer(char buf[], int length)
+ {
+ this.buf = buf;
+ len = length;
+ s = null;
+ }
+
+ public void setString(String s)
+ {
+ this.s = s;
+ buf = null;
+ }
+
+ private String s;
+
+ private char buf[];
+
+ private int len;
+
+ private CharScanner lexer;
+
+ private static final int prime = 151;
+}
Added: trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java (rev 0)
+++ trunk/source/java/net/sf/jcontracts/antlr/ANTLRLexer.java 2006-12-04 17:08:12 UTC (rev 36)
@@ -0,0 +1,2019 @@
+package net.sf.jcontracts.antlr;
+
+import java.io.InputStream;
+import java.util.Hashtable;
+
+import net.sf.jcontracts.antlr.collections.impl.BitSet;
+
+public class ANTLRLexer extends CharScannerNoBacktrackingNoInteractive implements ANTLRTokenTypes, Tokenizer
+{
+
+ public ANTLRLexer(CharBufferNoBacktrackingNoInteractive cb)
+ {
+ super(cb);
+ super.literals = new Hashtable();
+ super.literals.put(new ANTLRHashString("Parser", this), new Integer(30));
+ super.literals.put(new ANTLRHashString("catch", this), new Integer(38));
+ super.literals.put(new ANTLRHashString("Lexer", this), new Integer(9));
+ super.literals.put(new ANTLRHashString("exception", this), new Integer(37));
+ super.literals.put(new ANTLRHashString("class", this), new Integer(7));
+ super.literals.put(new ANTLRHashString("lexclass", this), new Integer(6));
+ super.literals.put(new ANTLRHashString("public", this), new Integer(32));
+ super.literals.put(new ANTLRHashString("header", this), new Integer(4));
+ super.literals.put(new ANTLRHashString("tokens", this), new Integer(26));
+ super.literals.put(new ANTLRHashString("charVocabulary", this), new Integer(17));
+ super.literals.put(new ANTLRHashString("options", this), new Integer(11));
+ super.literals.put(new ANTLRHashString("returns", this), new Integer(36));
+ super.literals.put(new ANTLRHashString("TreeParser", this), new Integer(10));
+ super.literals.put(new ANTLRHashString("private", this), new Integer(33));
+ super.literals.put(new ANTLRHashString("protected", this), new Integer(31));
+ super.literals.put(new ANTLRHashString("extends", this), new Integer(8));
+ super.caseSensitiveLiterals = true;
+ }
+
+ public ANTLRLexer(InputStream in)
+ {
+ this(new CharBufferNoBacktrackingNoInteractive(in));
+ }
+
+ public static int escapeCharValue(String cs)
+ {
+ if (cs.length() <= 3)
+ {
+ return 0;
+ }
+ if (cs.charAt(1) != '\\')
+ {
+ return 0;
+ }
+ switch (cs.charAt(2))
+ {
+ case 98: // 'b'
+ return 8;
+
+ case 114: // 'r'
+ return 13;
+
+ case 116: // 't'
+ return 9;
+
+ case 110: // 'n'
+ return 10;
+
+ case 102: // 'f'
+ return 12;
+
+ case 34: // '"'
+ return 34;
+
+ case 39: // '\''
+ return 39;
+
+ case 92: // '\\'
+ return 92;
+
+ case 117: // 'u'
+ if (cs.length() != 8)
+ {
+ return 0;
+ }
+ else
+ {
+ return Character.digit(cs.charAt(3), 16) * 16 * 16 * 16 + Character.digit(cs.charAt(4), 16) * 16
+ * 16 + Character.digit(cs.charAt(5), 16) * 16 + Character.digit(cs.charAt(6), 16);
+ }
+
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ if (cs.length() > 5 && Character.isDigit(cs.charAt(4)))
+ {
+ return (cs.charAt(2) - 48) * 8 * 8 + (cs.charAt(3) - 48) * 8 + (cs.charAt(4) - 48);
+ }
+ if (cs.length() > 4 && Character.isDigit(cs.charAt(3)))
+ {
+ return (cs.charAt(2) - 48) * 8 + (cs.charAt(3) - 48);
+ }
+ else
+ {
+ return cs.charAt(2) - 48;
+ }
+
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ if (cs.length() > 4 && Character.isDigit(cs.charAt(3)))
+ {
+ return (cs.charAt(2) - 48) * 8 + (cs.charAt(3) - 48);
+ }
+ else
+ {
+ return cs.charAt(2) - 48;
+ }
+ }
+ return 0;
+ }
+
+ public final void mACTION(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 5;
+ int actionLine = getLine();
+ mNESTED_ACTION(false);
+ if (super.la_1 == '?')
+ {
+ match('?');
+ _ttype = 40;
+ }
+ if (_ttype == 5)
+ {
+ setText(Tool.stripFrontBack(getText(), "{", "}"));
+ }
+ else
+ {
+ setText(Tool.stripFrontBack(getText(), "{", "}?"));
+ }
+ setLine(actionLine);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mARG_ACTION(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 35;
+ mNESTED_ARG_ACTION(false);
+ setText(Tool.stripFrontBack(getText(), "[", "]"));
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mASSIGN(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 14;
+ match('=');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mBANG(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 34;
+ match('!');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mCARET(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 46;
+ match('^');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mCHAR_LITERAL(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 19;
+ match('\'');
+ switch (super.la_1)
+ {
+ case 92: // '\\'
+ mESC(false);
+ break;
+
+ case 3: // '\003'
+ case 4: // '\004'
+ case 5: // '\005'
+ case 6: // '\006'
+ case 7: // '\007'
+ case 8: // '\b'
+ case 9: // '\t'
+ case 10: // '\n'
+ case 11: // '\013'
+ case 12: // '\f'
+ case 13: // '\r'
+ case 14: // '\016'
+ case 15: // '\017'
+ case 16: // '\020'
+ case 17: // '\021'
+ case 18: // '\022'
+ case 19: // '\023'
+ case 20: // '\024'
+ case 21: // '\025'
+ case 22: // '\026'
+ case 23: // '\027'
+ case 24: // '\030'
+ case 25: // '\031'
+ case 26: // '\032'
+ case 27: // '\033'
+ case 28: // '\034'
+ case 29: // '\035'
+ case 30: // '\036'
+ case 31: // '\037'
+ case 32: // ' '
+ case 33: // '!'
+ case 34: // '"'
+ case 35: // '#'
+ case 36: // '$'
+ case 37: // '%'
+ case 38: // '&'
+ case 40: // '('
+ case 41: // ')'
+ case 42: // '*'
+ case 43: // '+'
+ case 44: // ','
+ case 45: // '-'
+ case 46: // '.'
+ case 47: // '/'
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ case 58: // ':'
+ case 59: // ';'
+ case 60: // '<'
+ case 61: // '='
+ case 62: // '>'
+ case 63: // '?'
+ case 64: // '@'
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ case 91: // '['
+ case 93: // ']'
+ case 94: // '^'
+ case 95: // '_'
+ case 96: // '`'
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ case 123: // '{'
+ case 124: // '|'
+ case 125: // '}'
+ case 126: // '~'
+ matchNot('\'');
+ break;
+
+ default:
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ match('\'');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mCOLON(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 12;
+ match(':');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mCOMMENT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 49;
+ if (super.la_1 == '/' && super.la_2 == '/')
+ {
+ mSL_COMMENT(false);
+ }
+ else if (super.la_1 == '/' && super.la_2 == '*')
+ {
+ mML_COMMENT(false);
+ }
+ else
+ {
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ _ttype = -1;
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mDIGIT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 53;
+ matchRange('0', '9');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mESC(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 52;
+ match('\\');
+ switch (super.la_1)
+ {
+ case 110: // 'n'
+ match('n');
+ break;
+
+ case 114: // 'r'
+ match('r');
+ break;
+
+ case 116: // 't'
+ match('t');
+ break;
+
+ case 98: // 'b'
+ match('b');
+ break;
+
+ case 102: // 'f'
+ match('f');
+ break;
+
+ case 34: // '"'
+ match('"');
+ break;
+
+ case 39: // '\''
+ match('\'');
+ break;
+
+ case 92: // '\\'
+ match('\\');
+ break;
+
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ matchRange('0', '3');
+ if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ {
+ mDIGIT(false);
+ if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ {
+ mDIGIT(false);
+ }
+ }
+ break;
+
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ matchRange('4', '7');
+ if (super.la_1 >= '0' && super.la_1 <= '9' && super.la_2 >= '\003' && super.la_2 <= '~')
+ {
+ mDIGIT(false);
+ }
+ break;
+
+ case 117: // 'u'
+ match('u');
+ mXDIGIT(false);
+ mXDIGIT(false);
+ mXDIGIT(false);
+ mXDIGIT(false);
+ break;
+
+ default:
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mIMPLIES(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 45;
+ match("=>");
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mINT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 20;
+ int _cnt = 0;
+ do
+ {
+ if (super.la_1 >= '0' && super.la_1 <= '9')
+ {
+ matchRange('0', '9');
+ }
+ else
+ {
+ if (_cnt < 1)
+ {
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ break;
+ }
+ _cnt++;
+ }
+ while (true);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final int mINTERNAL_RULE_REF(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 58;
+ int t = 28;
+ matchRange('a', 'z');
+ do
+ {
+ switch (super.la_1)
+ {
+ case 95: // '_'
+ match('_');
+ continue;
+
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ matchRange('0', '9');
+ continue;
+ }
+ if (super.la_1 >= 'a' && super.la_1 <= 'z')
+ {
+ matchRange('a', 'z');
+ continue;
+ }
+ if (super.la_1 < 'A' || super.la_1 > 'Z')
+ {
+ break;
+ }
+ matchRange('A', 'Z');
+ }
+ while (true);
+ t = testLiteralsTable(t);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ return t;
+ }
+
+ public final void mLPAREN(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 27;
+ match('(');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mML_COMMENT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 51;
+ match("/*");
+ do
+ {
+ switch (super.la_1)
+ {
+ case 10: // '\n'
+ match('\n');
+ newline();
+ continue;
+
+ case 3: // '\003'
+ case 4: // '\004'
+ case 5: // '\005'
+ case 6: // '\006'
+ case 7: // '\007'
+ case 8: // '\b'
+ case 9: // '\t'
+ case 11: // '\013'
+ case 12: // '\f'
+ case 13: // '\r'
+ case 14: // '\016'
+ case 15: // '\017'
+ case 16: // '\020'
+ case 17: // '\021'
+ case 18: // '\022'
+ case 19: // '\023'
+ case 20: // '\024'
+ case 21: // '\025'
+ case 22: // '\026'
+ case 23: // '\027'
+ case 24: // '\030'
+ case 25: // '\031'
+ case 26: // '\032'
+ case 27: // '\033'
+ case 28: // '\034'
+ case 29: // '\035'
+ case 30: // '\036'
+ case 31: // '\037'
+ case 32: // ' '
+ case 33: // '!'
+ case 34: // '"'
+ case 35: // '#'
+ case 36: // '$'
+ case 37: // '%'
+ case 38: // '&'
+ case 39: // '\''
+ case 40: // '('
+ case 41: // ')'
+ case 43: // '+'
+ case 44: // ','
+ case 45: // '-'
+ case 46: // '.'
+ case 47: // '/'
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ case 58: // ':'
+ case 59: // ';'
+ case 60: // '<'
+ case 61: // '='
+ case 62: // '>'
+ case 63: // '?'
+ case 64: // '@'
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ case 91: // '['
+ case 92: // '\\'
+ case 93: // ']'
+ case 94: // '^'
+ case 95: // '_'
+ case 96: // '`'
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ case 123: // '{'
+ case 124: // '|'
+ case 125: // '}'
+ case 126: // '~'
+ match(_tokenSet_1);
+ continue;
+ }
+ if (super.la_1 != '*' || super.la_2 < '\003' || super.la_2 > '~' || LA(2) == '/')
+ {
+ break;
+ }
+ match('*');
+ }
+ while (true);
+ match("*/");
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mNESTED_ACTION(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 57;
+ match('{');
+ do
+ {
+ switch (super.la_1)
+ {
+ case 10: // '\n'
+ match('\n');
+ newline();
+ continue;
+
+ case 123: // '{'
+ mNESTED_ACTION(false);
+ continue;
+
+ case 39: // '\''
+ mCHAR_LITERAL(false);
+ continue;
+
+ case 34: // '"'
+ mSTRING_LITERAL(false);
+ continue;
+ }
+ if (super.la_1 == '/' && (super.la_2 == '*' || super.la_2 == '/') && (LA(2) == '/' || LA(2) == '*'))
+ {
+ mCOMMENT(false);
+ continue;
+ }
+ if (super.la_1 == '/' && super.la_2 >= '\003' && super.la_2 <= '~')
+ {
+ match('/');
+ continue;
+ }
+ if (!_tokenSet_2.member(super.la_1))
+ {
+ break;
+ }
+ matchNot('}');
+ }
+ while (true);
+ match('}');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mNESTED_ARG_ACTION(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 56;
+ match('[');
+ label0: do
+ {
+ switch (super.la_1)
+ {
+ case 91: // '['
+ mNESTED_ARG_ACTION(false);
+ break;
+
+ case 10: // '\n'
+ match('\n');
+ newline();
+ break;
+
+ case 39: // '\''
+ mCHAR_LITERAL(false);
+ break;
+
+ case 34: // '"'
+ mSTRING_LITERAL(false);
+ break;
+
+ case 3: // '\003'
+ case 4: // '\004'
+ case 5: // '\005'
+ case 6: // '\006'
+ case 7: // '\007'
+ case 8: // '\b'
+ case 9: // '\t'
+ case 11: // '\013'
+ case 12: // '\f'
+ case 13: // '\r'
+ case 14: // '\016'
+ case 15: // '\017'
+ case 16: // '\020'
+ case 17: // '\021'
+ case 18: // '\022'
+ case 19: // '\023'
+ case 20: // '\024'
+ case 21: // '\025'
+ case 22: // '\026'
+ case 23: // '\027'
+ case 24: // '\030'
+ case 25: // '\031'
+ case 26: // '\032'
+ case 27: // '\033'
+ case 28: // '\034'
+ case 29: // '\035'
+ case 30: // '\036'
+ case 31: // '\037'
+ case 32: // ' '
+ case 33: // '!'
+ case 35: // '#'
+ case 36: // '$'
+ case 37: // '%'
+ case 38: // '&'
+ case 40: // '('
+ case 41: // ')'
+ case 42: // '*'
+ case 43: // '+'
+ case 44: // ','
+ case 45: // '-'
+ case 46: // '.'
+ case 47: // '/'
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ case 58: // ':'
+ case 59: // ';'
+ case 60: // '<'
+ case 61: // '='
+ case 62: // '>'
+ case 63: // '?'
+ case 64: // '@'
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ case 92: // '\\'
+ case 94: // '^'
+ case 95: // '_'
+ case 96: // '`'
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ case 123: // '{'
+ case 124: // '|'
+ case 125: // '}'
+ case 126: // '~'
+ matchNot(']');
+ break;
+
+ default:
+ match(']');
+ break label0;
+ }
+ }
+ while (true);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mNOT_OP(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 39;
+ match('~');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mOR(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 21;
+ match('|');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mPLUS(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 44;
+ match('+');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mPOINTER(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 60;
+ match("->");
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mQUESTION(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 42;
+ match('?');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mRANGE(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 22;
+ match("..");
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mRCURLY(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 16;
+ match('}');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mRPAREN(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 29;
+ match(')');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mRULE_REF(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 28;
+ int t = 0;
+ t = mINTERNAL_RULE_REF(false);
+ _ttype = t;
+ if (t == 11)
+ {
+ for (; _tokenSet_3.member(super.la_1); mWS(false))
+ {
+ }
+ if (super.la_1 == '{')
+ {
+ match('{');
+ _ttype = 13;
+ }
+ }
+ else if (t == 26)
+ {
+ for (; _tokenSet_3.member(super.la_1); mWS(false))
+ {
+ }
+ if (super.la_1 == '{')
+ {
+ match('{');
+ _ttype = 23;
+ }
+ }
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mSEMI(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 15;
+ match(';');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mSL_COMMENT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 50;
+ match("//");
+ for (; _tokenSet_0.member(super.la_1); matchNot('\n'))
+ {
+ }
+ match('\n');
+ newline();
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mSTAR(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 43;
+ match('*');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mSTRING_LITERAL(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 18;
+ match('"');
+ label0: do
+ {
+ switch (super.la_1)
+ {
+ case 92: // '\\'
+ mESC(false);
+ break;
+
+ case 3: // '\003'
+ case 4: // '\004'
+ case 5: // '\005'
+ case 6: // '\006'
+ case 7: // '\007'
+ case 8: // '\b'
+ case 9: // '\t'
+ case 10: // '\n'
+ case 11: // '\013'
+ case 12: // '\f'
+ case 13: // '\r'
+ case 14: // '\016'
+ case 15: // '\017'
+ case 16: // '\020'
+ case 17: // '\021'
+ case 18: // '\022'
+ case 19: // '\023'
+ case 20: // '\024'
+ case 21: // '\025'
+ case 22: // '\026'
+ case 23: // '\027'
+ case 24: // '\030'
+ case 25: // '\031'
+ case 26: // '\032'
+ case 27: // '\033'
+ case 28: // '\034'
+ case 29: // '\035'
+ case 30: // '\036'
+ case 31: // '\037'
+ case 32: // ' '
+ case 33: // '!'
+ case 35: // '#'
+ case 36: // '$'
+ case 37: // '%'
+ case 38: // '&'
+ case 39: // '\''
+ case 40: // '('
+ case 41: // ')'
+ case 42: // '*'
+ case 43: // '+'
+ case 44: // ','
+ case 45: // '-'
+ case 46: // '.'
+ case 47: // '/'
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ case 58: // ':'
+ case 59: // ';'
+ case 60: // '<'
+ case 61: // '='
+ case 62: // '>'
+ case 63: // '?'
+ case 64: // '@'
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ case 91: // '['
+ case 93: // ']'
+ case 94: // '^'
+ case 95: // '_'
+ case 96: // '`'
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ case 123: // '{'
+ case 124: // '|'
+ case 125: // '}'
+ case 126: // '~'
+ matchNot('"');
+ break;
+
+ default:
+ match('"');
+ break label0;
+ }
+ }
+ while (true);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ ...
[truncated message content] |
|
From: <js...@us...> - 2006-11-27 20:15:59
|
Revision: 35
http://svn.sourceforge.net/jcontracts/?rev=35&view=rev
Author: jstuyts
Date: 2006-11-27 12:15:57 -0800 (Mon, 27 Nov 2006)
Log Message:
-----------
Formatted code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecificationFilter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/CompositePattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Dependency.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraintExporter.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DifferencePattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Idiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IdiomFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/IsolateIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LanguageFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/LayerIdiom.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecLexer.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecParser.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PSpecTokenTypes.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Pattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternFactory.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/PatternSyntaxException.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SetPattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingleDependencyConstraint.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/SingularPattern.java
trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/StrictlyLayerIdiom.java
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecification.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -14,414 +14,526 @@
import net.sf.jcontracts.util.JavaEvaluator;
import antlr.ParserException;
-public class ArchitectureSpecification
- implements IArchitectureSpecification {
+public class ArchitectureSpecification implements IArchitectureSpecification
+{
- protected Vector rules;
- protected Vector groups;
- protected Vector unusedRules;
+ protected Vector rules;
- public ArchitectureSpecification() {
- rules = new Vector();
- groups = new Vector();
- unusedRules = new Vector();
- }
+ protected Vector groups;
- public ArchitectureSpecification(Vector setOfRules) {
- rules = new Vector();
- groups = new Vector();
- unusedRules = new Vector();
- rules = setOfRules;
- sort();
- for (int k = 0; k < rules.size(); k++) {
- SingleDependencyConstraint d = (SingleDependencyConstraint)rules.elementAt(k);
- d.annotate("" + k);
- }
+ protected Vector unusedRules;
- }
+ public ArchitectureSpecification()
+ {
+ rules = new Vector();
+ groups = new Vector();
+ unusedRules = new Vector();
+ }
- public void addConstraint(SingleDependencyConstraint rule) {
- rules.addElement(rule);
- sort();
- for (int k = 0; k < rules.size(); k++) {
- SingleDependencyConstraint d = (SingleDependencyConstraint)rules.elementAt(k);
- if (d == rule) {
+ public ArchitectureSpecification(Vector setOfRules)
+ {
+ rules = new Vector();
+ groups = new Vector();
+ unusedRules = new Vector();
+ rules = setOfRules;
+ sort();
+ for (int k = 0; k < rules.size(); k++)
+ {
+ SingleDependencyConstraint d = (SingleDependencyConstraint) rules.elementAt(k);
d.annotate("" + k);
- }
- }
+ }
- }
+ }
- public boolean addGroup(Group g) {
- boolean found = false;
- String probe_name;
- for (Enumeration e = groups.elements(); !found && e.hasMoreElements(); found = probe_name.equals(g.getLabel())) {
- Group probe = (Group)e.nextElement();
- probe_name = probe.getLabel();
- }
+ public void addConstraint(SingleDependencyConstraint rule)
+ {
+ rules.addElement(rule);
+ sort();
+ for (int k = 0; k < rules.size(); k++)
+ {
+ SingleDependencyConstraint d = (SingleDependencyConstraint) rules.elementAt(k);
+ if (d == rule)
+ {
+ d.annotate("" + k);
+ }
+ }
- if (found) {
- throw new RuntimeException("iDarwin: error duplicate definition of group: " + g.getLabel() + " (" + g + ")");
- } else {
- groups.addElement(g);
- return !found;
- }
- }
+ }
- public boolean check(IDependency dependency, StringBuffer consoleErrorBuf, StringBuffer screenErrorBuf) {
- String source_item = dependency.getSource();
- String target_item = dependency.getTarget();
- String relationType = dependency.getType();
- boolean checkPassed = true;
- boolean passed = false;
- for (Enumeration e = rules.elements(); !passed && e.hasMoreElements();) {
- SingleDependencyConstraint c = (SingleDependencyConstraint)e.nextElement();
- if (!c.check(dependency)) {
- ruleWasUsed(c);
- checkPassed = false;
- screenErrorBuf.append(c.toStringForDottyErrorDisplay());
- consoleErrorBuf.append("in " + dependency.getLocation() + "\n");
- consoleErrorBuf.append("the dependency " + source_item + " -" + relationType + "-> " + target_item + "\n");
- consoleErrorBuf.append("violates the constraint " + c + "\n");
- } else
- if (c.match(dependency)) {
- passed = true;
- ruleWasUsed(c);
- }
- }
+ public boolean addGroup(Group g)
+ {
+ boolean found = false;
+ String probe_name;
+ for (Enumeration e = groups.elements(); !found && e.hasMoreElements(); found = probe_name.equals(g.getLabel()))
+ {
+ Group probe = (Group) e.nextElement();
+ probe_name = probe.getLabel();
+ }
- return checkPassed;
- }
+ if (found)
+ {
+ throw new RuntimeException("iDarwin: error duplicate definition of group: " + g.getLabel() + " (" + g + ")");
+ }
+ else
+ {
+ groups.addElement(g);
+ return !found;
+ }
+ }
- public net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification composeWith(net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification other) throws IllFormedSpecificationException {
- net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification result = null;
- if (other == null) {
- result = this;
- } else
- if (other instanceof ArchitectureSpecification) {
- ArchitectureSpecification spec = new ArchitectureSpecification();
- for (int i = 0; i < ((ArchitectureSpecification)other).getGroups().size(); i++) {
- boolean succ = spec.addGroup((Group)((ArchitectureSpecification)other).getGroups().elementAt(i));
- if (!succ) {
- throw new IllFormedSpecificationException("");
+ public boolean check(IDependency dependency, StringBuffer consoleErrorBuf, StringBuffer screenErrorBuf)
+ {
+ String source_item = dependency.getSource();
+ String target_item = dependency.getTarget();
+ String relationType = dependency.getType();
+ boolean checkPassed = true;
+ boolean passed = false;
+ for (Enumeration e = rules.elements(); !passed && e.hasMoreElements();)
+ {
+ SingleDependencyConstraint c = (SingleDependencyConstraint) e.nextElement();
+ if (!c.check(dependency))
+ {
+ ruleWasUsed(c);
+ checkPassed = false;
+ screenErrorBuf.append(c.toStringForDottyErrorDisplay());
+ consoleErrorBuf.append("in " + dependency.getLocation() + "\n");
+ consoleErrorBuf.append("the dependency " + source_item + " -" + relationType + "-> " + target_item
+ + "\n");
+ consoleErrorBuf.append("violates the constraint " + c + "\n");
}
- }
+ else if (c.match(dependency))
+ {
+ passed = true;
+ ruleWasUsed(c);
+ }
+ }
- for (int i = 0; i < groups.size(); i++) {
- boolean succ = spec.addGroup((Group)groups.elementAt(i));
- if (!succ) {
- throw new IllFormedSpecificationException("");
+ return checkPassed;
+ }
+
+ public net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification composeWith(
+ net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification other)
+ throws IllFormedSpecificationException
+ {
+ net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification result = null;
+ if (other == null)
+ {
+ result = this;
+ }
+ else if (other instanceof ArchitectureSpecification)
+ {
+ ArchitectureSpecification spec = new ArchitectureSpecification();
+ for (int i = 0; i < ((ArchitectureSpecification) other).getGroups().size(); i++)
+ {
+ boolean succ = spec.addGroup((Group) ((ArchitectureSpecification) other).getGroups().elementAt(i));
+ if (!succ)
+ {
+ throw new IllFormedSpecificationException("");
+ }
}
- }
- IRule rs[] = getRules();
- for (int i = 0; i < rs.length; i++) {
- spec.addConstraint((SingleDependencyConstraint)rs[i]);
- }
+ for (int i = 0; i < groups.size(); i++)
+ {
+ boolean succ = spec.addGroup((Group) groups.elementAt(i));
+ if (!succ)
+ {
+ throw new IllFormedSpecificationException("");
+ }
+ }
- rs = ((IArchitectureSpecification)other).getRules();
- for (int i = 0; i < rs.length; i++) {
- spec.addConstraint((SingleDependencyConstraint)rs[i]);
- }
+ IRule rs[] = getRules();
+ for (int i = 0; i < rs.length; i++)
+ {
+ spec.addConstraint((SingleDependencyConstraint) rs[i]);
+ }
- String wellFormedExpl = getWellFormedStatement();
- if (wellFormedExpl != null) {
- throw new IllFormedSpecificationException("The composition of two specifications leads to an ill formed result!\n" + wellFormedExpl);
- }
- result = spec;
- } else {
- throw new IllFormedSpecificationException("Incompatible architecture languages, can not be analysed together.");
- }
- return result;
- }
+ rs = ((IArchitectureSpecification) other).getRules();
+ for (int i = 0; i < rs.length; i++)
+ {
+ spec.addConstraint((SingleDependencyConstraint) rs[i]);
+ }
- public Vector getGroups() {
- return groups;
- }
+ String wellFormedExpl = getWellFormedStatement();
+ if (wellFormedExpl != null)
+ {
+ throw new IllFormedSpecificationException(
+ "The composition of two specifications leads to an ill formed result!\n" + wellFormedExpl);
+ }
+ result = spec;
+ }
+ else
+ {
+ throw new IllFormedSpecificationException(
+ "Incompatible architecture languages, can not be analysed together.");
+ }
+ return result;
+ }
- public IRule[] getRules() {
- IRule result[] = new DependencyConstraint[rules.size()];
- for (int i = 0; i < rules.size(); i++) {
- result[i] = (IRule)rules.elementAt(i);
- }
+ public Vector getGroups()
+ {
+ return groups;
+ }
- return result;
- }
+ public IRule[] getRules()
+ {
+ IRule result[] = new DependencyConstraint[rules.size()];
+ for (int i = 0; i < rules.size(); i++)
+ {
+ result[i] = (IRule) rules.elementAt(i);
+ }
- public IRule[] getUnusedRules() {
- IRule result[] = new DependencyConstraint[unusedRules.size()];
- for (int i = 0; i < unusedRules.size(); i++) {
- result[i] = (IRule)unusedRules.elementAt(i);
- }
+ return result;
+ }
- return result;
- }
+ public IRule[] getUnusedRules()
+ {
+ IRule result[] = new DependencyConstraint[unusedRules.size()];
+ for (int i = 0; i < unusedRules.size(); i++)
+ {
+ result[i] = (IRule) unusedRules.elementAt(i);
+ }
- public IRule[] getUsedRules() {
- IRule result[] = new DependencyConstraint[rules.size() - unusedRules.size()];
- int j = 0;
- for (int i = 0; i < rules.size(); i++) {
- IRule r = (IRule)rules.elementAt(i);
- if (!unusedRules.contains(r)) {
- result[j++] = r;
- }
- }
+ return result;
+ }
- return result;
- }
+ public IRule[] getUsedRules()
+ {
+ IRule result[] = new DependencyConstraint[rules.size() - unusedRules.size()];
+ int j = 0;
+ for (int i = 0; i < rules.size(); i++)
+ {
+ IRule r = (IRule) rules.elementAt(i);
+ if (!unusedRules.contains(r))
+ {
+ result[j++] = r;
+ }
+ }
- public String getWellFormedStatement() {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < rules.size() - 1; i++) {
- for (int j = i + 1; j < rules.size(); j++) {
- DependencyConstraint ri = (DependencyConstraint)rules.elementAt(i);
- DependencyConstraint rj = (DependencyConstraint)rules.elementAt(j);
- if (ri.isContradictionTo(rj)) {
- buf.append("Rule contradiction found among (sensitive to order of evaluation):\n " + ri + "\n " + rj);
- buf.append("\n");
+ return result;
+ }
+
+ public String getWellFormedStatement()
+ {
+ StringBuffer buf = new StringBuffer();
+ for (int i = 0; i < rules.size() - 1; i++)
+ {
+ for (int j = i + 1; j < rules.size(); j++)
+ {
+ DependencyConstraint ri = (DependencyConstraint) rules.elementAt(i);
+ DependencyConstraint rj = (DependencyConstraint) rules.elementAt(j);
+ if (ri.isContradictionTo(rj))
+ {
+ buf.append("Rule contradiction found among (sensitive to order of evaluation):\n " + ri + "\n "
+ + rj);
+ buf.append("\n");
+ }
}
- }
- }
+ }
- String result = buf.toString();
- if (result.equals("")) {
- result = null;
- }
- return result;
- }
+ String result = buf.toString();
+ if (result.equals(""))
+ {
+ result = null;
+ }
+ return result;
+ }
- public void idiomBlockOneWay(String label, String layers[]) {
- for (int i = 0; i < layers.length - 1; i++) {
- String below = "{";
- for (int j = i + 1; j < layers.length; j++) {
- below = below + layers[j];
- if (j < layers.length - 1) {
- below = below + ", ";
+ public void idiomBlockOneWay(String label, String layers[])
+ {
+ for (int i = 0; i < layers.length - 1; i++)
+ {
+ String below = "{";
+ for (int j = i + 1; j < layers.length; j++)
+ {
+ below = below + layers[j];
+ if (j < layers.length - 1)
+ {
+ below = below + ", ";
+ }
}
- }
- below = below + "}";
- addConstraint(SingleDependencyConstraint.newNeg(layers[i], below, label));
- }
+ below = below + "}";
+ addConstraint(SingleDependencyConstraint.newNeg(layers[i], below, label));
+ }
- }
+ }
- public void idiomIsolate(String label, String layers[]) {
- String reversedlayers[] = new String[layers.length];
- for (int i = 0; i < layers.length; i++) {
- reversedlayers[layers.length - i - 1] = layers[i];
- }
+ public void idiomIsolate(String label, String layers[])
+ {
+ String reversedlayers[] = new String[layers.length];
+ for (int i = 0; i < layers.length; i++)
+ {
+ reversedlayers[layers.length - i - 1] = layers[i];
+ }
- idiomBlockOneWay(label, layers);
- idiomBlockOneWay(label, reversedlayers);
- }
+ idiomBlockOneWay(label, layers);
+ idiomBlockOneWay(label, reversedlayers);
+ }
- public void idiomStrictlyLayer(String label, String layers[]) {
- idiomBlockOneWay(label, layers);
- for (int i = layers.length - 1; i >= 2; i--) {
- String below = "{";
- for (int j = i - 2; j >= 0; j--) {
- below = below + layers[j];
- if (j > 0) {
- below = below + ", ";
+ public void idiomStrictlyLayer(String label, String layers[])
+ {
+ idiomBlockOneWay(label, layers);
+ for (int i = layers.length - 1; i >= 2; i--)
+ {
+ String below = "{";
+ for (int j = i - 2; j >= 0; j--)
+ {
+ below = below + layers[j];
+ if (j > 0)
+ {
+ below = below + ", ";
+ }
}
- }
- below = below + "}";
- addConstraint(SingleDependencyConstraint.newNeg(layers[i], below, label));
- }
+ below = below + "}";
+ addConstraint(SingleDependencyConstraint.newNeg(layers[i], below, label));
+ }
- }
+ }
- public void idiomTransparent(String label, String layers[]) {
- String s = layers[0];
- for (int i = 1; i < layers.length; i++) {
- s = s + layers[i];
- }
+ public void idiomTransparent(String label, String layers[])
+ {
+ String s = layers[0];
+ for (int i = 1; i < layers.length; i++)
+ {
+ s = s + layers[i];
+ }
- for (int i = 0; i < layers.length - 1; i++) {
- for (int j = i + 1; j < layers.length; j++) {
- addConstraint(SingleDependencyConstraint.newPos(layers[i], layers[j], label + " (" + layers[i] + " may * " + layers[j] + ")"));
- }
+ for (int i = 0; i < layers.length - 1; i++)
+ {
+ for (int j = i + 1; j < layers.length; j++)
+ {
+ addConstraint(SingleDependencyConstraint.newPos(layers[i], layers[j], label + " (" + layers[i]
+ + " may * " + layers[j] + ")"));
+ }
- }
+ }
- for (int i = 0; i < layers.length - 1; i++) {
- for (int j = i + 1; j < layers.length; j++) {
- addConstraint(SingleDependencyConstraint.newPos(layers[j], layers[i], label + " (" + layers[j] + " may * " + layers[i] + ")"));
- }
+ for (int i = 0; i < layers.length - 1; i++)
+ {
+ for (int j = i + 1; j < layers.length; j++)
+ {
+ addConstraint(SingleDependencyConstraint.newPos(layers[j], layers[i], label + " (" + layers[j]
+ + " may * " + layers[i] + ")"));
+ }
- }
+ }
- }
+ }
- public boolean isEmpty() {
- return rules.isEmpty();
- }
+ public boolean isEmpty()
+ {
+ return rules.isEmpty();
+ }
- boolean isMoreSpecificThan(IRule other) {
- return false;
- }
+ boolean isMoreSpecificThan(IRule other)
+ {
+ return false;
+ }
- public IArchitectureExporter newArchitectureExporter(String filename) throws IOException {
- return new DependencyConstraintExporter(filename);
- }
+ public IArchitectureExporter newArchitectureExporter(String filename) throws IOException
+ {
+ return new DependencyConstraintExporter(filename);
+ }
- public IDependency newDependency(String source, String target, String type, String location) {
- return new Dependency(source, target, type, location);
- }
+ public IDependency newDependency(String source, String target, String type, String location)
+ {
+ return new Dependency(source, target, type, location);
+ }
- public IArchitectureSpecificationFilter newSpecificationFilter(String criteria[]) {
- return new ArchitectureSpecificationFilter(criteria);
- }
+ public IArchitectureSpecificationFilter newSpecificationFilter(String criteria[])
+ {
+ return new ArchitectureSpecificationFilter(criteria);
+ }
- public void parseFrom(String specLines[]) {
- for (int i = 0; i < specLines.length; i++) {
- StringBufferInputStream is = new StringBufferInputStream(specLines[i]);
- PSpecLexer speclexer = new PSpecLexer(is);
- PSpecParser specparser = new PSpecParser(speclexer);
- try {
- SingleDependencyConstraint rule = specparser.rule();
- addConstraint(rule);
- }
- catch (ParserException e) {
- System.err.println("Specification parser exception: " + e);
- System.err.println("\nin specification:\n" + specLines[i]);
- throw new RuntimeException(e.toString());
- }
- }
+ public void parseFrom(String specLines[])
+ {
+ for (int i = 0; i < specLines.length; i++)
+ {
+ StringBufferInputStream is = new StringBufferInputStream(specLines[i]);
+ PSpecLexer speclexer = new PSpecLexer(is);
+ PSpecParser specparser = new PSpecParser(speclexer);
+ try
+ {
+ SingleDependencyConstraint rule = specparser.rule();
+ addConstraint(rule);
+ }
+ catch (ParserException e)
+ {
+ System.err.println("Specification parser exception: " + e);
+ System.err.println("\nin specification:\n" + specLines[i]);
+ throw new RuntimeException(e.toString());
+ }
+ }
- }
+ }
- public void parseFrom(String specification) throws IllFormedSpecificationException {
- try {
- ArchitectureSpecification archspec = (ArchitectureSpecification)JavaEvaluator.evalWithPrefix(specification, "import net.sf.jcontracts.idarwin.specification.impl.primitive_language.ArchitectureSpecification;\n");
- IRule rs[] = archspec.getRules();
- for (int i = 0; i < rs.length; i++) {
- addConstraint((SingleDependencyConstraint)rs[i]);
- }
+ public void parseFrom(String specification) throws IllFormedSpecificationException
+ {
+ try
+ {
+ ArchitectureSpecification archspec = (ArchitectureSpecification) JavaEvaluator
+ .evalWithPrefix(specification,
+ "import net.sf.jcontracts.idarwin.specification.impl.primitive_language.ArchitectureSpecification;\n");
+ IRule rs[] = archspec.getRules();
+ for (int i = 0; i < rs.length; i++)
+ {
+ addConstraint((SingleDependencyConstraint) rs[i]);
+ }
- }
- catch (Exception _ex) {
- throw new RuntimeException(_ex);
- }
- }
+ }
+ catch (Exception _ex)
+ {
+ throw new RuntimeException(_ex);
+ }
+ }
- public void parseGroupsFrom(String gs[]) {
- for (int i = 0; i < gs.length; i++) {
- StringBufferInputStream is = new StringBufferInputStream(gs[i]);
- PSpecLexer speclexer = new PSpecLexer(is);
- PSpecParser specparser = new PSpecParser(speclexer);
- try {
- Group g = specparser.group();
- addGroup(g);
- }
- catch (ParserException e) {
- System.err.println("Specification parser exception: " + e);
- System.err.println("\nin group definition:\n" + gs[i]);
- throw new RuntimeException(e.toString());
- }
- }
+ public void parseGroupsFrom(String gs[])
+ {
+ for (int i = 0; i < gs.length; i++)
+ {
+ StringBufferInputStream is = new StringBufferInputStream(gs[i]);
+ PSpecLexer speclexer = new PSpecLexer(is);
+ PSpecParser specparser = new PSpecParser(speclexer);
+ try
+ {
+ Group g = specparser.group();
+ addGroup(g);
+ }
+ catch (ParserException e)
+ {
+ System.err.println("Specification parser exception: " + e);
+ System.err.println("\nin group definition:\n" + gs[i]);
+ throw new RuntimeException(e.toString());
+ }
+ }
- }
+ }
- public void parseIdiomsFrom(String ids[]) {
- for (int i = 0; i < ids.length; i++) {
- StringBufferInputStream is = new StringBufferInputStream(ids[i]);
- PSpecLexer speclexer = new PSpecLexer(is);
- PSpecParser specparser = new PSpecParser(speclexer);
- try {
- Idiom idiom = specparser.idiom();
- idiom.expand(this);
- }
- catch (ParserException e) {
- System.err.println("Specification parser exception: " + e);
- System.err.println("\nin idiom definition:\n" + ids[i]);
- throw new RuntimeException(e.toString());
- }
- }
+ public void parseIdiomsFrom(String ids[])
+ {
+ for (int i = 0; i < ids.length; i++)
+ {
+ StringBufferInputStream is = new StringBufferInputStream(ids[i]);
+ PSpecLexer speclexer = new PSpecLexer(is);
+ PSpecParser specparser = new PSpecParser(speclexer);
+ try
+ {
+ Idiom idiom = specparser.idiom();
+ idiom.expand(this);
+ }
+ catch (ParserException e)
+ {
+ System.err.println("Specification parser exception: " + e);
+ System.err.println("\nin idiom definition:\n" + ids[i]);
+ throw new RuntimeException(e.toString());
+ }
+ }
- }
+ }
- public void prepareForCheck() throws IllFormedSpecificationException {
- Vector substitutedrules = new Vector();
- SingleDependencyConstraint sdc;
- for (Enumeration e = rules.elements(); e.hasMoreElements(); unusedRules.addElement(sdc)) {
- sdc = (SingleDependencyConstraint)e.nextElement();
- try {
- substitutedrules.addElement(sdc.substitute(groups));
- }
- catch (IllFormedSpecificationException _ex) {
- throw new RuntimeException(_ex);
- }
- sdc = sdc.substitute(groups);
- }
+ public void prepareForCheck() throws IllFormedSpecificationException
+ {
+ Vector substitutedrules = new Vector();
+ SingleDependencyConstraint sdc;
+ for (Enumeration e = rules.elements(); e.hasMoreElements(); unusedRules.addElement(sdc))
+ {
+ sdc = (SingleDependencyConstraint) e.nextElement();
+ try
+ {
+ substitutedrules.addElement(sdc.substitute(groups));
+ }
+ catch (IllFormedSpecificationException _ex)
+ {
+ throw new RuntimeException(_ex);
+ }
+ sdc = sdc.substitute(groups);
+ }
- rules = substitutedrules;
- }
+ rules = substitutedrules;
+ }
- public String reportAfterAllChecks() {
- StringBuffer buf = new StringBuffer();
- if (unusedRules.size() > 0) {
- buf.append("The following " + unusedRules.size() + " out of " + rules.size() + " rules were not used:\n");
- for (Enumeration e = unusedRules.elements(); e.hasMoreElements(); buf.append("\n")) {
- DependencyConstraint t = (DependencyConstraint)e.nextElement();
- buf.append("- ");
- buf.append(t.toString());
- }
+ public String reportAfterAllChecks()
+ {
+ StringBuffer buf = new StringBuffer();
+ if (unusedRules.size() > 0)
+ {
+ buf.append("The following " + unusedRules.size() + " out of " + rules.size() + " rules were not used:\n");
+ for (Enumeration e = unusedRules.elements(); e.hasMoreElements(); buf.append("\n"))
+ {
+ DependencyConstraint t = (DependencyConstraint) e.nextElement();
+ buf.append("- ");
+ buf.append(t.toString());
+ }
- } else {
- buf.append("All rules were used at least once.");
- }
- return buf.toString();
- }
+ }
+ else
+ {
+ buf.append("All rules were used at least once.");
+ }
+ return buf.toString();
+ }
- private void ruleWasUsed(SingleDependencyConstraint c) {
- unusedRules.removeElement(c);
- }
+ private void ruleWasUsed(SingleDependencyConstraint c)
+ {
+ unusedRules.removeElement(c);
+ }
- private void sort() {
- SingleDependencyConstraint arr[] = new SingleDependencyConstraint[rules.size()];
- for (int k = 0; k < rules.size(); k++) {
- arr[k] = (SingleDependencyConstraint)rules.elementAt(k);
- }
+ private void sort()
+ {
+ SingleDependencyConstraint arr[] = new SingleDependencyConstraint[rules.size()];
+ for (int k = 0; k < rules.size(); k++)
+ {
+ arr[k] = (SingleDependencyConstraint) rules.elementAt(k);
+ }
- for (int i = 0; i < rules.size() - 1; i++) {
- boolean swapped = false;
- for (int j = i + 1; j < rules.size() && !swapped;) {
- if (arr[j].isMoreSpecificThan(arr[i])) {
- SingleDependencyConstraint tmp = arr[i];
- arr[i] = arr[j];
- arr[j] = tmp;
- swapped = true;
- i = -1;
- j = 0;
- } else {
- j++;
+ for (int i = 0; i < rules.size() - 1; i++)
+ {
+ boolean swapped = false;
+ for (int j = i + 1; j < rules.size() && !swapped;)
+ {
+ if (arr[j].isMoreSpecificThan(arr[i]))
+ {
+ SingleDependencyConstraint tmp = arr[i];
+ arr[i] = arr[j];
+ arr[j] = tmp;
+ swapped = true;
+ i = -1;
+ j = 0;
+ }
+ else
+ {
+ j++;
+ }
}
- }
- }
+ }
- rules = new Vector();
- for (int k = 0; k < arr.length; k++) {
- rules.addElement(arr[k]);
- }
+ rules = new Vector();
+ for (int k = 0; k < arr.length; k++)
+ {
+ rules.addElement(arr[k]);
+ }
- }
+ }
- public String toString() {
- StringBuffer buf = new StringBuffer();
- if (rules.size() <= 0) {
- buf.append("An empty specification (no rules)");
- buf.append("\n");
- } else {
- for (Enumeration e = rules.elements(); e.hasMoreElements(); buf.append("\n")) {
- buf.append(e.nextElement());
- }
+ public String toString()
+ {
+ StringBuffer buf = new StringBuffer();
+ if (rules.size() <= 0)
+ {
+ buf.append("An empty specification (no rules)");
+ buf.append("\n");
+ }
+ else
+ {
+ for (Enumeration e = rules.elements(); e.hasMoreElements(); buf.append("\n"))
+ {
+ buf.append(e.nextElement());
+ }
- }
- return buf.toString();
- }
+ }
+ return buf.toString();
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecificationFilter.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecificationFilter.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/ArchitectureSpecificationFilter.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -5,32 +5,41 @@
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecificationFilter;
import net.sf.jcontracts.idarwin.specification.openapi.IllFormedSpecificationException;
+public class ArchitectureSpecificationFilter implements IArchitectureSpecificationFilter
+{
-public class ArchitectureSpecificationFilter
- implements IArchitectureSpecificationFilter {
+ private String criteria[];
- private String criteria[];
+ ArchitectureSpecificationFilter(String criteria[])
+ {
+ this.criteria = null;
+ this.criteria = criteria;
+ }
- ArchitectureSpecificationFilter(String criteria[]) {
- this.criteria = null;
- this.criteria = criteria;
- }
-
- public net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification filter(net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification original) throws IllFormedSpecificationException {
- IArchitectureSpecification result = null;
- if (original instanceof IArchitectureSpecification) {
- ArchitectureSpecification spec = new ArchitectureSpecification();
- IRule rs[] = ((IArchitectureSpecification)original).getRules();
- for (int i = 0; i < rs.length; i++) {
- if (rs[i].talksAboutAnyOf(criteria)) {
- spec.addConstraint((SingleDependencyConstraint)rs[i]);
+ public net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification filter(
+ net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification original)
+ throws IllFormedSpecificationException
+ {
+ IArchitectureSpecification result = null;
+ if (original instanceof IArchitectureSpecification)
+ {
+ ArchitectureSpecification spec = new ArchitectureSpecification();
+ IRule rs[] = ((IArchitectureSpecification) original).getRules();
+ for (int i = 0; i < rs.length; i++)
+ {
+ if (rs[i].talksAboutAnyOf(criteria))
+ {
+ spec.addConstraint((SingleDependencyConstraint) rs[i]);
+ }
}
- }
- result = spec;
- } else {
- throw new IllFormedSpecificationException("Can only filter specification languages that implement net.sf.jcontracts.idarwin.specification.impl.with_rules.IArchitectureSpecification.");
- }
- return result;
- }
+ result = spec;
+ }
+ else
+ {
+ throw new IllFormedSpecificationException(
+ "Can only filter specification languages that implement net.sf.jcontracts.idarwin.specification.impl.with_rules.IArchitectureSpecification.");
+ }
+ return result;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/CompositePattern.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/CompositePattern.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/CompositePattern.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -1,8 +1,9 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
+abstract class CompositePattern extends Pattern
+{
-abstract class CompositePattern extends Pattern {
-
- CompositePattern() {
- }
+ CompositePattern()
+ {
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Dependency.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Dependency.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Dependency.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -2,38 +2,46 @@
import net.sf.jcontracts.idarwin.specification.openapi.IDependency;
-public class Dependency
- implements IDependency {
+public class Dependency implements IDependency
+{
- private String source;
- private String location;
- private String type;
- private String target;
+ private String source;
- public Dependency(String source, String target, String type, String location) {
- this.source = null;
- this.location = null;
- this.type = null;
- this.target = null;
- this.source = source;
- this.target = target;
- this.type = type;
- this.location = location;
- }
+ private String location;
- public String getLocation() {
- return location;
- }
+ private String type;
- public String getSource() {
- return source;
- }
+ private String target;
- public String getTarget() {
- return target;
- }
+ public Dependency(String source, String target, String type, String location)
+ {
+ this.source = null;
+ this.location = null;
+ this.type = null;
+ this.target = null;
+ this.source = source;
+ this.target = target;
+ this.type = type;
+ this.location = location;
+ }
- public String getType() {
- return type;
- }
+ public String getLocation()
+ {
+ return location;
+ }
+
+ public String getSource()
+ {
+ return source;
+ }
+
+ public String getTarget()
+ {
+ return target;
+ }
+
+ public String getType()
+ {
+ return type;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraint.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraint.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraint.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -5,51 +5,57 @@
import net.sf.jcontracts.idarwin.specification.impl.with_rules.IRule;
import net.sf.jcontracts.idarwin.specification.openapi.IDependency;
-public abstract class DependencyConstraint
- implements IRule {
+public abstract class DependencyConstraint implements IRule
+{
- protected String label;
+ protected String label;
- public boolean equals(Object obj) {
- boolean result = false;
- if (obj == null) {
- result = false;
- } else {
- result = toString().equals(obj.toString());
- }
- return result;
- }
+ public boolean equals(Object obj)
+ {
+ boolean result = false;
+ if (obj == null)
+ {
+ result = false;
+ }
+ else
+ {
+ result = toString().equals(obj.toString());
+ }
+ return result;
+ }
- protected abstract void export(StringBuffer stringbuffer);
+ protected abstract void export(StringBuffer stringbuffer);
- protected abstract void exportMarked(StringBuffer stringbuffer);
+ protected abstract void exportMarked(StringBuffer stringbuffer);
- protected abstract Pattern getConstraints();
+ protected abstract Pattern getConstraints();
- public String getLabel() {
- return label;
- }
+ public String getLabel()
+ {
+ return label;
+ }
- protected abstract Vector getPackageNodes();
+ protected abstract Vector getPackageNodes();
- protected abstract Pattern getSourcepattern();
+ protected abstract Pattern getSourcepattern();
- protected abstract Pattern getTargetpattern();
+ protected abstract Pattern getTargetpattern();
- protected abstract boolean isContradictionTo(DependencyConstraint dependencyconstraint);
+ protected abstract boolean isContradictionTo(DependencyConstraint dependencyconstraint);
- protected abstract boolean isPositive();
+ protected abstract boolean isPositive();
- public abstract String printLabel();
+ public abstract String printLabel();
- public abstract String toStringForDottyErrorDisplay();
+ public abstract String toStringForDottyErrorDisplay();
- public DependencyConstraint() {
- }
+ public DependencyConstraint()
+ {
+ }
- public abstract boolean isMoreSpecificThan(IRule irule);
+ public abstract boolean isMoreSpecificThan(IRule irule);
- public abstract boolean talksAboutAnyOf(String as[]);
+ public abstract boolean talksAboutAnyOf(String as[]);
- public abstract boolean check(IDependency idependency);
+ public abstract boolean check(IDependency idependency);
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraintExporter.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraintExporter.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DependencyConstraintExporter.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -9,159 +9,194 @@
import net.sf.jcontracts.idarwin.specification.impl.with_rules.IArchitectureSpecification;
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureExporter;
-public class DependencyConstraintExporter
- implements IArchitectureExporter {
+public class DependencyConstraintExporter implements IArchitectureExporter
+{
- private PrintWriter ostream;
- private String title;
- private int cluster_index;
- private boolean boxConstraints;
+ private PrintWriter ostream;
- public DependencyConstraintExporter(String filename) throws IOException {
- ostream = null;
- title = "Title goes here ...";
- cluster_index = 1;
- boxConstraints = true;
- ostream = new PrintWriter(new FileOutputStream(filename));
- }
+ private String title;
- public void close() {
- ostream.println("\n}");
- ostream.close();
- }
+ private int cluster_index;
- private void endSubGraph(String label) {
- if (boxConstraints) {
- ostream.println("label=\"" + label + "\";");
- ostream.println("}");
- }
- }
+ private boolean boxConstraints;
- private void export(DependencyConstraint dc) {
- StringBuffer buf = new StringBuffer();
- startSubGraph();
- dc.export(buf);
- ostream.println(buf.toString());
- endSubGraph(dc.getLabel());
- }
+ public DependencyConstraintExporter(String filename) throws IOException
+ {
+ ostream = null;
+ title = "Title goes here ...";
+ cluster_index = 1;
+ boxConstraints = true;
+ ostream = new PrintWriter(new FileOutputStream(filename));
+ }
- public void export(net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification specification) throws IOException {
- Vector dcs = new Vector();
- net.sf.jcontracts.idarwin.specification.impl.with_rules.IRule usedrules[] = ((IArchitectureSpecification)specification).getUsedRules();
- for (int i = 0; i < usedrules.length; i++) {
- dcs.addElement(usedrules[i]);
- export((DependencyConstraint)usedrules[i]);
- }
+ public void close()
+ {
+ ostream.println("\n}");
+ ostream.close();
+ }
- net.sf.jcontracts.idarwin.specification.impl.with_rules.IRule unusedrules[] = ((IArchitectureSpecification)specification).getUnusedRules();
- for (int i = 0; i < unusedrules.length; i++) {
- dcs.addElement(unusedrules[i]);
- exportMarked((DependencyConstraint)unusedrules[i]);
- }
+ private void endSubGraph(String label)
+ {
+ if (boxConstraints)
+ {
+ ostream.println("label=\"" + label + "\";");
+ ostream.println("}");
+ }
+ }
- export(dcs);
- }
+ private void export(DependencyConstraint dc)
+ {
+ StringBuffer buf = new StringBuffer();
+ startSubGraph();
+ dc.export(buf);
+ ostream.println(buf.toString());
+ endSubGraph(dc.getLabel());
+ }
- private void export(Vector dcs) {
- Vector allNodes = new Vector();
- for (Enumeration e = dcs.elements(); e.hasMoreElements();) {
- DependencyConstraint dc = (DependencyConstraint)e.nextElement();
- for (Enumeration enum2 = dc.getPackageNodes().elements(); enum2.hasMoreElements();) {
- Pattern el = (Pattern)enum2.nextElement();
- if (!allNodes.contains(el)) {
- allNodes.addElement(el);
- }
- }
+ public void export(net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification specification)
+ throws IOException
+ {
+ Vector dcs = new Vector();
+ net.sf.jcontracts.idarwin.specification.impl.with_rules.IRule usedrules[] = ((IArchitectureSpecification) specification)
+ .getUsedRules();
+ for (int i = 0; i < usedrules.length; i++)
+ {
+ dcs.addElement(usedrules[i]);
+ export((DependencyConstraint) usedrules[i]);
+ }
- }
+ net.sf.jcontracts.idarwin.specification.impl.with_rules.IRule unusedrules[] = ((IArchitectureSpecification) specification)
+ .getUnusedRules();
+ for (int i = 0; i < unusedrules.length; i++)
+ {
+ dcs.addElement(unusedrules[i]);
+ exportMarked((DependencyConstraint) unusedrules[i]);
+ }
- boolean show_package_subsumption = false;
- if (show_package_subsumption) {
- for (int i = 0; i < allNodes.size() - 1; i++) {
- Pattern pattern = (Pattern)allNodes.elementAt(i);
- for (int j = i + 1; j < allNodes.size(); j++) {
- Pattern element = (Pattern)allNodes.elementAt(j);
- if (pattern.match(element)) {
- ostream.println(element.mangle());
- ostream.println(" -> ");
- ostream.println(pattern.mangle());
- ostream.println(" [weight=20,color=black,style=dotted]\n");
- }
- if (element.match(pattern)) {
- ostream.println(pattern.mangle());
- ostream.println(" -> ");
- ostream.println(element.mangle());
- ostream.println(" [weight=20,color=black,style=dotted]\n");
- }
+ export(dcs);
+ }
+
+ private void export(Vector dcs)
+ {
+ Vector allNodes = new Vector();
+ for (Enumeration e = dcs.elements(); e.hasMoreElements();)
+ {
+ DependencyConstraint dc = (DependencyConstraint) e.nextElement();
+ for (Enumeration enum2 = dc.getPackageNodes().elements(); enum2.hasMoreElements();)
+ {
+ Pattern el = (Pattern) enum2.nextElement();
+ if (!allNodes.contains(el))
+ {
+ allNodes.addElement(el);
+ }
}
- }
+ }
- }
- for (int i = 0; i < dcs.size() - 1; i++) {
- SingleDependencyConstraint c1 = (SingleDependencyConstraint)dcs.elementAt(i);
- for (int j = i + 1; j < dcs.size(); j++) {
- SingleDependencyConstraint c2 = (SingleDependencyConstraint)dcs.elementAt(j);
- if (c1.isMoreSpecificThan(c2) && (c1.isPositive() && !c2.isPositive() || !c1.isPositive() && c2.isPositive())) {
- StringBuffer buf = new StringBuffer();
- c2.exportOperatorNode(buf);
- buf.append(" -> ");
- c1.exportOperatorNode(buf);
- buf.append(" [color=blue,label=\"except\"]\n");
- ostream.print(buf.toString());
+ boolean show_package_subsumption = false;
+ if (show_package_subsumption)
+ {
+ for (int i = 0; i < allNodes.size() - 1; i++)
+ {
+ Pattern pattern = (Pattern) allNodes.elementAt(i);
+ for (int j = i + 1; j < allNodes.size(); j++)
+ {
+ Pattern element = (Pattern) allNodes.elementAt(j);
+ if (pattern.match(element))
+ {
+ ostream.println(element.mangle());
+ ostream.println(" -> ");
+ ostream.println(pattern.mangle());
+ ostream.println(" [weight=20,color=black,style=dotted]\n");
+ }
+ if (element.match(pattern))
+ {
+ ostream.println(pattern.mangle());
+ ostream.println(" -> ");
+ ostream.println(element.mangle());
+ ostream.println(" [weight=20,color=black,style=dotted]\n");
+ }
+ }
+
}
- if (c2.isMoreSpecificThan(c1) && (c1.isPositive() && !c2.isPositive() || !c1.isPositive() && c2.isPositive())) {
- StringBuffer buf = new StringBuffer();
- c1.exportOperatorNode(buf);
- buf.append(" -> ");
- c2.exportOperatorNode(buf);
- buf.append(" [color=blue,label=\"except\"]\n");
- ostream.print(buf.toString());
+
+ }
+ for (int i = 0; i < dcs.size() - 1; i++)
+ {
+ SingleDependencyConstraint c1 = (SingleDependencyConstraint) dcs.elementAt(i);
+ for (int j = i + 1; j < dcs.size(); j++)
+ {
+ SingleDependencyConstraint c2 = (SingleDependencyConstraint) dcs.elementAt(j);
+ if (c1.isMoreSpecificThan(c2)
+ && (c1.isPositive() && !c2.isPositive() || !c1.isPositive() && c2.isPositive()))
+ {
+ StringBuffer buf = new StringBuffer();
+ c2.exportOperatorNode(buf);
+ buf.append(" -> ");
+ c1.exportOperatorNode(buf);
+ buf.append(" [color=blue,label=\"except\"]\n");
+ ostream.print(buf.toString());
+ }
+ if (c2.isMoreSpecificThan(c1)
+ && (c1.isPositive() && !c2.isPositive() || !c1.isPositive() && c2.isPositive()))
+ {
+ StringBuffer buf = new StringBuffer();
+ c1.exportOperatorNode(buf);
+ buf.append(" -> ");
+ c2.exportOperatorNode(buf);
+ buf.append(" [color=blue,label=\"except\"]\n");
+ ostream.print(buf.toString());
+ }
+ if (c1.isContradictionTo(c2))
+ {
+ StringBuffer buf = new StringBuffer();
+ c1.exportOperatorNode(buf);
+ buf.append(" -> ");
+ c2.exportOperatorNode(buf);
+ buf.append(" [color=orange,style=bold,label=\"ERROR\"]\n");
+ ostream.print(buf.toString());
+ }
+ if (c2.isContradictionTo(c1))
+ {
+ StringBuffer buf = new StringBuffer();
+ c1.exportOperatorNode(buf);
+ buf.append(" -> ");
+ c2.exportOperatorNode(buf);
+ buf.append(" [color=orange,style=bold,label=\"ERROR\"]\n");
+ ostream.print(buf.toString());
+ }
}
- if (c1.isContradictionTo(c2)) {
- StringBuffer buf = new StringBuffer();
- c1.exportOperatorNode(buf);
- buf.append(" -> ");
- c2.exportOperatorNode(buf);
- buf.append(" [color=orange,style=bold,label=\"ERROR\"]\n");
- ostream.print(buf.toString());
- }
- if (c2.isContradictionTo(c1)) {
- StringBuffer buf = new StringBuffer();
- c1.exportOperatorNode(buf);
- buf.append(" -> ");
- c2.exportOperatorNode(buf);
- buf.append(" [color=orange,style=bold,label=\"ERROR\"]\n");
- ostream.print(buf.toString());
- }
- }
- }
+ }
- }
+ }
- private void exportMarked(DependencyConstraint dc) {
- StringBuffer buf = new StringBuffer();
- startSubGraph();
- dc.exportMarked(buf);
- ostream.println(buf.toString());
- endSubGraph(dc.getLabel());
- }
+ private void exportMarked(DependencyConstraint dc)
+ {
+ StringBuffer buf = new StringBuffer();
+ startSubGraph();
+ dc.exportMarked(buf);
+ ostream.println(buf.toString());
+ endSubGraph(dc.getLabel());
+ }
- public void open() {
- new StringBuffer();
- ostream.println("digraph \"" + title + "\" {");
- ostream.println("fontsize=12;");
- ostream.println("fontname=\"Helvetica\"");
- }
+ public void open()
+ {
+ new StringBuffer();
+ ostream.println("digraph \"" + title + "\" {");
+ ostream.println("fontsize=12;");
+ ostream.println("fontname=\"Helvetica\"");
+ }
- private void startSubGraph() {
- if (boxConstraints) {
- ostream.println("subgraph cluster_" + cluster_index + " {");
- ostream.println("color=gray;");
- ostream.println("fontname=Helvetica;");
- ostream.println("fontsize=12;");
- cluster_index++;
- }
- }
+ private void startSubGraph()
+ {
+ if (boxConstraints)
+ {
+ ostream.println("subgraph cluster_" + cluster_index + " {");
+ ostream.println("color=gray;");
+ ostream.println("fontname=Helvetica;");
+ ostream.println("fontsize=12;");
+ cluster_index++;
+ }
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DifferencePattern.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DifferencePattern.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/DifferencePattern.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -1,58 +1,70 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
+class DifferencePattern extends CompositePattern
+{
-class DifferencePattern extends CompositePattern {
+ private Pattern positive;
- private Pattern positive;
- private Pattern negative;
+ private Pattern negative;
- DifferencePattern(Pattern positive, Pattern negative) {
- this.positive = null;
- this.negative = null;
- this.positive = positive;
- this.negative = negative;
- }
+ DifferencePattern(Pattern positive, Pattern negative)
+ {
+ this.positive = null;
+ this.negative = null;
+ this.positive = positive;
+ this.negative = negative;
+ }
- String mangle() {
- return positive.mangle() + "__" + negative.mangle();
- }
+ String mangle()
+ {
+ return positive.mangle() + "__" + negative.mangle();
+ }
- public boolean match(Pattern p) {
- boolean res = positive.match(p) && !negative.match(p);
- return res;
- }
+ public boolean match(Pattern p)
+ {
+ boolean res = positive.match(p) && !negative.match(p);
+ return res;
+ }
- public boolean match(String s) {
- return positive.match(s) && !negative.match(s);
- }
+ public boolean match(String s)
+ {
+ return positive.match(s) && !negative.match(s);
+ }
- boolean specifiesASingleType() {
- return false;
- }
+ boolean specifiesASingleType()
+ {
+ return false;
+ }
- public boolean talksAboutAnyOf(String criteria[]) {
- boolean found = false;
- if (criteria == null) {
- found = true;
- } else {
- found = negative.talksAboutAnyOf(criteria) || positive.talksAboutAnyOf(criteria);
- }
- return found;
- }
+ public boolean talksAboutAnyOf(String criteria[])
+ {
+ boolean found = false;
+ if (criteria == null)
+ {
+ found = true;
+ }
+ else
+ {
+ found = negative.talksAboutAnyOf(criteria) || positive.talksAboutAnyOf(criteria);
+ }
+ return found;
+ }
- public String toDisplayString() {
- StringBuffer sb = new StringBuffer();
- sb.append(positive.toDisplayString());
- sb.append("\\n\\\\n");
- sb.append(negative.toDisplayString());
- return sb.toString();
- }
+ public String toDisplayString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(positive.toDisplayString());
+ sb.append("\\n\\\\n");
+ sb.append(negative.toDisplayString());
+ return sb.toString();
+ }
- public String toString() {
- StringBuffer sb = new StringBuffer();
- sb.append(positive);
- sb.append(" \\ ");
- sb.append(negative);
- return sb.toString();
- }
+ public String toString()
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append(positive);
+ sb.append(" \\ ");
+ sb.append(negative);
+ return sb.toString();
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java 2006-11-27 20:14:50 UTC (rev 34)
+++ trunk/source/java/net/sf/jcontracts/idarwin/specification/impl/primitive_language/Group.java 2006-11-27 20:15:57 UTC (rev 35)
@@ -1,73 +1,85 @@
package net.sf.jcontracts.idarwin.specification.impl.primitive_language;
+public class Group
+{
-public class Group {
+ private Pattern pattern;
- private Pattern pattern;
- private String label;
+ private String label;
- public Group(String label, Pattern pattern) {
- this.pattern = null;
- this.label = null;
- this.pattern = pattern;
- this.label = label;
- }
+ public Group(String label, Pattern pattern)
+ {
+ this.pattern = null;
+ this.label = null;
+ this.pattern = pattern;
+ this.label = label;
+ }
- private String basicRemoveIfsubstitutedIn(String r) {
- StringBuffer buf = new StringBuffer();
- String tag = "[" + label + "]";
- String inset = "";
- int lastpos = 0;
- for (int pos = -1; (pos = r.indexOf(tag, lastpos)) != -1;) {
- buf.append(r.substring(lastpos, pos...
[truncated message content] |
|
From: <js...@us...> - 2006-11-27 20:14:52
|
Revision: 34
http://svn.sourceforge.net/jcontracts/?rev=34&view=rev
Author: jstuyts
Date: 2006-11-27 12:14:50 -0800 (Mon, 27 Nov 2006)
Log Message:
-----------
Formatted code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
trunk/source/java/net/sf/jcontracts/icontract/AllOption.java
trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
trunk/source/java/net/sf/jcontracts/icontract/Class.java
trunk/source/java/net/sf/jcontracts/icontract/CleanOption.java
trunk/source/java/net/sf/jcontracts/icontract/CompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/Constants.java
trunk/source/java/net/sf/jcontracts/icontract/Darwin.java
trunk/source/java/net/sf/jcontracts/icontract/DefaultExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/FileTarget.java
trunk/source/java/net/sf/jcontracts/icontract/HelpOption.java
trunk/source/java/net/sf/jcontracts/icontract/IContracted.java
trunk/source/java/net/sf/jcontracts/icontract/Interface.java
trunk/source/java/net/sf/jcontracts/icontract/Internal0Option.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheck.java
trunk/source/java/net/sf/jcontracts/icontract/InvCheckCallOption.java
trunk/source/java/net/sf/jcontracts/icontract/MergeOption.java
trunk/source/java/net/sf/jcontracts/icontract/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/icontract/Method.java
trunk/source/java/net/sf/jcontracts/icontract/NoInitialCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/NoRepositoryCompilationOption.java
trunk/source/java/net/sf/jcontracts/icontract/OneOneOption.java
trunk/source/java/net/sf/jcontracts/icontract/Option.java
trunk/source/java/net/sf/jcontracts/icontract/OutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/ParameterOption.java
trunk/source/java/net/sf/jcontracts/icontract/PrePostCheck.java
trunk/source/java/net/sf/jcontracts/icontract/ProcessingOption.java
trunk/source/java/net/sf/jcontracts/icontract/QuietOption.java
trunk/source/java/net/sf/jcontracts/icontract/Repository.java
trunk/source/java/net/sf/jcontracts/icontract/RepositoryOutputOption.java
trunk/source/java/net/sf/jcontracts/icontract/SourceCompilerOption.java
trunk/source/java/net/sf/jcontracts/icontract/SystemInTarget.java
trunk/source/java/net/sf/jcontracts/icontract/Target.java
trunk/source/java/net/sf/jcontracts/icontract/Tool.java
trunk/source/java/net/sf/jcontracts/icontract/UnableToDetermineTypeException.java
trunk/source/java/net/sf/jcontracts/icontract/Variable.java
trunk/source/java/net/sf/jcontracts/icontract/VerboseOption.java
trunk/source/java/net/sf/jcontracts/icontract/WrapExceptionOption.java
trunk/source/java/net/sf/jcontracts/icontract/XOption.java
Modified: trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java 2006-11-27 16:56:26 UTC (rev 33)
+++ trunk/source/java/net/sf/jcontracts/icontract/AllFilesUpToDateException.java 2006-11-27 20:14:50 UTC (rev 34)
@@ -1,11 +1,14 @@
package net.sf.jcontracts.icontract;
-
-public class AllFilesUpToDateException extends RuntimeException {
-
- public AllFilesUpToDateException() {
- }
-
- public AllFilesUpToDateException(String s) {
- super(s);
- }
-}
+
+public class AllFilesUpToDateException extends RuntimeException
+{
+
+ public AllFilesUpToDateException()
+ {
+ }
+
+ public AllFilesUpToDateException(String s)
+ {
+ super(s);
+ }
+}
Modified: trunk/source/java/net/sf/jcontracts/icontract/AllOption.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/AllOption.java 2006-11-27 16:56:26 UTC (rev 33)
+++ trunk/source/java/net/sf/jcontracts/icontract/AllOption.java 2006-11-27 20:14:50 UTC (rev 34)
@@ -1,12 +1,14 @@
package net.sf.jcontracts.icontract;
import java.util.Vector;
-
-public class AllOption extends ParameterOption {
-
- public static final String NAME = "a";
-
- public AllOption(String name, Vector arguments) {
- super(name, arguments);
- }
-}
+
+public class AllOption extends ParameterOption
+{
+
+ public static final String NAME = "a";
+
+ public AllOption(String name, Vector arguments)
+ {
+ super(name, arguments);
+ }
+}
Modified: trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java 2006-11-27 16:56:26 UTC (rev 33)
+++ trunk/source/java/net/sf/jcontracts/icontract/ArgMetaclassFactory.java 2006-11-27 20:14:50 UTC (rev 34)
@@ -5,80 +5,107 @@
import net.sf.jcontracts.argparser.OptionMetaclass;
import net.sf.jcontracts.argparser.ParserMetaclassFactory;
import net.sf.jcontracts.argparser.TargetMetaclass;
-
-public class ArgMetaclassFactory
- implements ParserMetaclassFactory {
-
- public OptionMetaclass newOption(String name, Vector parameters) {
- OptionMetaclass o = null;
- try {
- if (name.compareTo("h") == 0) {
- o = new HelpOption(name, parameters);
- } else
- if (name.compareTo("v") == 0) {
- o = new VerboseOption(name, parameters);
- } else
- if (name.compareTo("c") == 0) {
- o = new CompilerOption(name, parameters);
- } else
- if (name.compareTo("b") == 0) {
- o = new SourceCompilerOption(name, parameters);
- } else
- if (name.compareTo("n") == 0) {
- o = new NoRepositoryCompilationOption(name, parameters);
- } else
- if (name.compareTo("o") == 0) {
- o = new OutputOption(name, parameters);
- } else
- if (name.compareTo("y") == 0) {
- o = new OneOneOption(name, parameters);
- } else
- if (name.compareTo("k") == 0) {
- o = new RepositoryOutputOption(name, parameters);
- } else
- if (name.compareTo("d") == 0) {
- o = new DefaultExceptionOption(name, parameters);
- } else
- if (name.compareTo("r") == 0) {
- o = new CleanOption(name, parameters);
- } else
- if (name.compareTo("m") == 0) {
- o = new MergeOption(name, parameters);
- } else
- if (name.compareTo("i") == 0) {
- o = new InvCheckCallOption(name, parameters);
- } else
- if (name.compareTo("w") == 0) {
- o = new WrapExceptionOption(name, parameters);
- } else
- if (name.compareTo("q") == 0) {
- o = new QuietOption(name, parameters);
- } else
- if (name.compareTo("a") == 0) {
- o = new AllOption(name, parameters);
- } else
- if (name.compareTo("x") == 0) {
- o = new XOption(name, parameters);
- } else
- if (name.compareTo("Z") == 0) {
- o = new Internal0Option(name, parameters);
- } else
- if (name.compareTo("j") == 0) {
- o = new NoInitialCompilationOption(name, parameters);
- } else {
- throw new RuntimeException("Java Contract Suite: error: unknown option -" + name);
- }
- }
- catch (NoClassDefFoundError _ex) {
- throw new RuntimeException("Attempt to perform in-process call to sun.tools.javac.Main failed because the class could not be found! In Java-2, make sure that the JDK's tools.jar (contain sun.tools.javac.*) is on your classpath!", _ex);
- }
- return o;
- }
-
- public TargetMetaclass newTarget(String name) {
- return new FileTarget(name);
- }
-
- public ArgMetaclassFactory() {
- }
-}
+
+public class ArgMetaclassFactory implements ParserMetaclassFactory
+{
+
+ public OptionMetaclass newOption(String name, Vector parameters)
+ {
+ OptionMetaclass o = null;
+ try
+ {
+ if (name.compareTo("h") == 0)
+ {
+ o = new HelpOption(name, parameters);
+ }
+ else if (name.compareTo("v") == 0)
+ {
+ o = new VerboseOption(name, parameters);
+ }
+ else if (name.compareTo("c") == 0)
+ {
+ o = new CompilerOption(name, parameters);
+ }
+ else if (name.compareTo("b") == 0)
+ {
+ o = new SourceCompilerOption(name, parameters);
+ }
+ else if (name.compareTo("n") == 0)
+ {
+ o = new NoRepositoryCompilationOption(name, parameters);
+ }
+ else if (name.compareTo("o") == 0)
+ {
+ o = new OutputOption(name, parameters);
+ }
+ else if (name.compareTo("y") == 0)
+ {
+ o = new OneOneOption(name, parameters);
+ }
+ else if (name.compareTo("k") == 0)
+ {
+ o = new RepositoryOutputOption(name, parameters);
+ }
+ else if (name.compareTo("d") == 0)
+ {
+ o = new DefaultExceptionOption(name, parameters);
+ }
+ else if (name.compareTo("r") == 0)
+ {
+ o = new CleanOption(name, parameters);
+ }
+ else if (name.compareTo("m") == 0)
+ {
+ o = new MergeOption(name, parameters);
+ }
+ else if (name.compareTo("i") == 0)
+ {
+ o = new InvCheckCallOption(name, parameters);
+ }
+ else if (name.compareTo("w") == 0)
+ {
+ o = new WrapExceptionOption(name, parameters);
+ }
+ else if (name.compareTo("q") == 0)
+ {
+ o = new QuietOption(name, parameters);
+ }
+ else if (name.compareTo("a") == 0)
+ {
+ o = new AllOption(name, parameters);
+ }
+ else if (name.compareTo("x") == 0)
+ {
+ o = new XOption(name, parameters);
+ }
+ else if (name.compareTo("Z") == 0)
+ {
+ o = new Internal0Option(name, parameters);
+ }
+ else if (name.compareTo("j") == 0)
+ {
+ o = new NoInitialCompilationOption(name, parameters);
+ }
+ else
+ {
+ throw new RuntimeException("Java Contract Suite: error: unknown option -" + name);
+ }
+ }
+ catch (NoClassDefFoundError _ex)
+ {
+ throw new RuntimeException(
+ "Attempt to perform in-process call to sun.tools.javac.Main failed because the class could not be found! In Java-2, make sure that the JDK's tools.jar (contain sun.tools.javac.*) is on your classpath!",
+ _ex);
+ }
+ return o;
+ }
+
+ public TargetMetaclass newTarget(String name)
+ {
+ return new FileTarget(name);
+ }
+
+ public ArgMetaclassFactory()
+ {
+ }
+}
Modified: trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java 2006-11-27 16:56:26 UTC (rev 33)
+++ trunk/source/java/net/sf/jcontracts/icontract/AssertionExpression.java 2006-11-27 20:14:50 UTC (rev 34)
@@ -8,865 +8,1149 @@
import org.apache.log4j.Logger;
-class AssertionExpression {
- private static final Logger log = Logger.getLogger(AssertionExpression.class);
- private String expression_;
- private IContracted subject_;
+class AssertionExpression
+{
+ private static final Logger log = Logger.getLogger(AssertionExpression.class);
- AssertionExpression(String expr, IContracted subject) {
- expression_ = expr.trim();
- subject_ = subject;
- }
+ private String expression_;
- void addBoundVariablesTo(Hashtable vartab) {
- String elementType = getElementType();
- String elementVar = getElementVar();
- vartab.put(elementVar, elementType);
- String quantifiedExpression = getQuantifiedExpression();
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- subassert.addBoundVariablesTo(vartab);
- }
- }
+ private IContracted subject_;
- boolean containsImplies(String expr) {
- return expr.indexOf("implies") != -1;
- }
+ AssertionExpression(String expr, IContracted subject)
+ {
+ expression_ = expr.trim();
+ subject_ = subject;
+ }
- String getCheckCode() {
- String code = "";
- String resultVar = "__result_" + getMangledValue(getElementVar());
- code = code + getPartialCheckCode();
- String prefix = getUpToQuantifier();
- code = code + "if (!" + prefix + resultVar + ")\n";
- return code;
- }
+ void addBoundVariablesTo(Hashtable vartab)
+ {
+ String elementType = getElementType();
+ String elementVar = getElementVar();
+ vartab.put(elementVar, elementType);
+ String quantifiedExpression = getQuantifiedExpression();
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ subassert.addBoundVariablesTo(vartab);
+ }
+ }
- private String getElementType() {
- int f = expression_.indexOf("forall ");
- if (f == -1) {
- f = expression_.indexOf("exists ");
- }
- int start = expression_.indexOf(" ", f);
- int end = expression_.indexOf(" ", start + 1);
- return expression_.substring(start, end).trim();
- }
+ boolean containsImplies(String expr)
+ {
+ return expr.indexOf("implies") != -1;
+ }
- private String getElementVar() {
- int dummy = 0;
- int start = 0;
- int end = 0;
- String res = "";
- try {
- int f = expression_.indexOf("forall ");
- if (f == -1) {
+ String getCheckCode()
+ {
+ String code = "";
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ code = code + getPartialCheckCode();
+ String prefix = getUpToQuantifier();
+ code = code + "if (!" + prefix + resultVar + ")\n";
+ return code;
+ }
+
+ private String getElementType()
+ {
+ int f = expression_.indexOf("forall ");
+ if (f == -1)
+ {
f = expression_.indexOf("exists ");
- }
- dummy = expression_.indexOf(" ", f);
- start = expression_.indexOf(" ", dummy + 1);
- end = expression_.indexOf(" ", start + 1);
- res = expression_.substring(start, end).trim();
- }
- catch (StringIndexOutOfBoundsException _ex) {
- throw new RuntimeException("can not determine the variable name in expression " + expression_);
- }
- return res;
- }
+ }
+ int start = expression_.indexOf(" ", f);
+ int end = expression_.indexOf(" ", start + 1);
+ return expression_.substring(start, end).trim();
+ }
- private String getExistsCheckCode() {
- String code = "";
- String quantificationDomain = getQuantificationDomain();
- if (isRangeDomain(quantificationDomain)) {
- code = getExistsCheckCode_OverRange();
- } else
- if (isArrayDomain()) {
- code = getExistsCheckCode_OverArray();
- } else
- if (isIteratorDomain()) {
- code = getExistsCheckCode_OverIterator(false);
- } else
- if (isEnumerationDomain()) {
- code = getExistsCheckCode_OverEnumeration(false);
- } else {
- String d = getQuantificationDomain().trim();
- String type_of_domain = "";
- try {
- type_of_domain = subject_.getTypeOfValue(d).trim();
- if (type_of_domain.indexOf("[") != -1) {
- code = getExistsCheckCode_OverArray();
- } else
- if (type_of_domain.equals("java.util.Enumeration")) {
- code = getExistsCheckCode_OverEnumeration(false);
- } else
- if (type_of_domain.equals("java.util.Iterator")) {
- code = getExistsCheckCode_OverIterator(false);
- } else
- if (isImplementationOf("java.util.Iterator", type_of_domain)) {
- code = getExistsCheckCode_OverIterator(false);
- } else
- if (isImplementationOf("java.util.Enumeration", type_of_domain)) {
- code = getExistsCheckCode_OverEnumeration(false);
- } else
- if (hasImplementationOfMethod("elements", "java.util.Enumeration", type_of_domain)) {
- code = getExistsCheckCode_OverEnumeration(true);
- } else
- if (hasImplementationOfMethod("iterator", "java.util.Iterator", type_of_domain)) {
- code = getExistsCheckCode_OverIterator(true);
- } else {
- String dd = getQuantificationDomain().trim();
- log.warn("The type of " + dd + " in " + ((CodeMetaclass)subject_).getSignature() + " is " + type_of_domain + "\n" + "Complete assertion: " + subject_ + "\nQuantifier domains must be: Array, Range (e.g. a .. b [by c]), Enumeration, Iterator or implementation thereof or\nimplementors of 'Enumeration elements()' or 'Iterator iterator()' (e.g. the Java 2 Collections, JDK 1.1 Vector, etc.)\n" + "As a best effort will use java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
- code = getExistsCheckCode_OverEnumeration(false);
+ private String getElementVar()
+ {
+ int dummy = 0;
+ int start = 0;
+ int end = 0;
+ String res = "";
+ try
+ {
+ int f = expression_.indexOf("forall ");
+ if (f == -1)
+ {
+ f = expression_.indexOf("exists ");
}
- }
- catch (UnableToDetermineTypeException e) {
- String dd = getQuantificationDomain().trim();
- log.warn("Could not determine type of " + dd + " in " + ((CodeMetaclass)subject_).getSignature() + "\n" + "Complete assertion: " + subject_ + "\n" + "Using java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
- log.warn(e.getMessage());
+ dummy = expression_.indexOf(" ", f);
+ start = expression_.indexOf(" ", dummy + 1);
+ end = expression_.indexOf(" ", start + 1);
+ res = expression_.substring(start, end).trim();
+ }
+ catch (StringIndexOutOfBoundsException _ex)
+ {
+ throw new RuntimeException("can not determine the variable name in expression " + expression_);
+ }
+ return res;
+ }
+
+ private String getExistsCheckCode()
+ {
+ String code = "";
+ String quantificationDomain = getQuantificationDomain();
+ if (isRangeDomain(quantificationDomain))
+ {
+ code = getExistsCheckCode_OverRange();
+ }
+ else if (isArrayDomain())
+ {
+ code = getExistsCheckCode_OverArray();
+ }
+ else if (isIteratorDomain())
+ {
+ code = getExistsCheckCode_OverIterator(false);
+ }
+ else if (isEnumerationDomain())
+ {
code = getExistsCheckCode_OverEnumeration(false);
- }
- }
- return code;
- }
+ }
+ else
+ {
+ String d = getQuantificationDomain().trim();
+ String type_of_domain = "";
+ try
+ {
+ type_of_domain = subject_.getTypeOfValue(d).trim();
+ if (type_of_domain.indexOf("[") != -1)
+ {
+ code = getExistsCheckCode_OverArray();
+ }
+ else if (type_of_domain.equals("java.util.Enumeration"))
+ {
+ code = getExistsCheckCode_OverEnumeration(false);
+ }
+ else if (type_of_domain.equals("java.util.Iterator"))
+ {
+ code = getExistsCheckCode_OverIterator(false);
+ }
+ else if (isImplementationOf("java.util.Iterator", type_of_domain))
+ {
+ code = getExistsCheckCode_OverIterator(false);
+ }
+ else if (isImplementationOf("java.util.Enumeration", type_of_domain))
+ {
+ code = getExistsCheckCode_OverEnumeration(false);
+ }
+ else if (hasImplementationOfMethod("elements", "java.util.Enumeration", type_of_domain))
+ {
+ code = getExistsCheckCode_OverEnumeration(true);
+ }
+ else if (hasImplementationOfMethod("iterator", "java.util.Iterator", type_of_domain))
+ {
+ code = getExistsCheckCode_OverIterator(true);
+ }
+ else
+ {
+ String dd = getQuantificationDomain().trim();
+ log
+ .warn("The type of "
+ + dd
+ + " in "
+ + ((CodeMetaclass) subject_).getSignature()
+ + " is "
+ + type_of_domain
+ + "\n"
+ + "Complete assertion: "
+ + subject_
+ + "\nQuantifier domains must be: Array, Range (e.g. a .. b [by c]), Enumeration, Iterator or implementation thereof or\nimplementors of 'Enumeration elements()' or 'Iterator iterator()' (e.g. the Java 2 Collections, JDK 1.1 Vector, etc.)\n"
+ + "As a best effort will use java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
+ code = getExistsCheckCode_OverEnumeration(false);
+ }
+ }
+ catch (UnableToDetermineTypeException e)
+ {
+ String dd = getQuantificationDomain().trim();
+ log
+ .warn("Could not determine type of "
+ + dd
+ + " in "
+ + ((CodeMetaclass) subject_).getSignature()
+ + "\n"
+ + "Complete assertion: "
+ + subject_
+ + "\n"
+ + "Using java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
+ log.warn(e.getMessage());
+ code = getExistsCheckCode_OverEnumeration(false);
+ }
+ }
+ return code;
+ }
- private String getExistsCheckCode_OverArray() {
- String code = "";
- String elementType = getElementType();
- String elementVar = getElementVar();
- String indexVar = "__index_" + getMangledValue(getElementVar());
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=false;\n";
- code = code + "for ( int " + indexVar + "= 0; (" + indexVar + " < " + quantificationDomain + ".length) && !" + resultVar + "; " + indexVar + "++){\n";
- code = code + " " + elementType + " " + elementVar + "= " + quantificationDomain + "[" + indexVar + "];\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // amount to dc\n";
- code = code + "else {\n";
- code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
- }
- code = code + "} // loop\n";
- return code;
- }
+ private String getExistsCheckCode_OverArray()
+ {
+ String code = "";
+ String elementType = getElementType();
+ String elementVar = getElementVar();
+ String indexVar = "__index_" + getMangledValue(getElementVar());
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=false;\n";
+ code = code + "for ( int " + indexVar + "= 0; (" + indexVar + " < " + quantificationDomain + ".length) && !"
+ + resultVar + "; " + indexVar + "++){\n";
+ code = code + " " + elementType + " " + elementVar + "= " + quantificationDomain + "[" + indexVar + "];\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // amount to dc\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
+ }
+ code = code + "} // loop\n";
+ return code;
+ }
- private String getExistsCheckCode_OverEnumeration(boolean enumerationImpl) {
- String code = "";
- String elementType = getElementType();
- String castElementType = elementType;
- if (elementType.equals("int")) {
- castElementType = "Integer";
- }
- if (elementType.equals("float")) {
- castElementType = "Float";
- }
- if (elementType.equals("boolean")) {
- castElementType = "Boolean";
- }
- if (elementType.equals("byte")) {
- castElementType = "Byte";
- }
- if (elementType.equals("double")) {
- castElementType = "Double";
- }
- if (elementType.equals("long")) {
- castElementType = "Long";
- }
- if (elementType.equals("short")) {
- castElementType = "Short";
- }
- if (elementType.equals("char")) {
- castElementType = "Character";
- }
- String enumVar = "__" + getMangledValue(getElementVar()) + "_enum";
- String elementVar = getElementVar();
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=false;\n";
- String postfix = "";
- if (enumerationImpl) {
- postfix = ".elements()";
- }
- code = code + "for (java.util.Enumeration " + enumVar + "=" + quantificationDomain + postfix + ";\n";
- code = code + " " + enumVar + ".hasMoreElements() && !" + resultVar + "; ){\n";
- code = code + " " + castElementType + " " + elementVar + "=(";
- code = code + castElementType + ")(" + enumVar + ".nextElement());\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // amount to dc\n";
- code = code + "else {\n";
- code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
- }
- code = code + "} // loop\n";
- return code;
- }
+ private String getExistsCheckCode_OverEnumeration(boolean enumerationImpl)
+ {
+ String code = "";
+ String elementType = getElementType();
+ String castElementType = elementType;
+ if (elementType.equals("int"))
+ {
+ castElementType = "Integer";
+ }
+ if (elementType.equals("float"))
+ {
+ castElementType = "Float";
+ }
+ if (elementType.equals("boolean"))
+ {
+ castElementType = "Boolean";
+ }
+ if (elementType.equals("byte"))
+ {
+ castElementType = "Byte";
+ }
+ if (elementType.equals("double"))
+ {
+ castElementType = "Double";
+ }
+ if (elementType.equals("long"))
+ {
+ castElementType = "Long";
+ }
+ if (elementType.equals("short"))
+ {
+ castElementType = "Short";
+ }
+ if (elementType.equals("char"))
+ {
+ castElementType = "Character";
+ }
+ String enumVar = "__" + getMangledValue(getElementVar()) + "_enum";
+ String elementVar = getElementVar();
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=false;\n";
+ String postfix = "";
+ if (enumerationImpl)
+ {
+ postfix = ".elements()";
+ }
+ code = code + "for (java.util.Enumeration " + enumVar + "=" + quantificationDomain + postfix + ";\n";
+ code = code + " " + enumVar + ".hasMoreElements() && !" + resultVar + "; ){\n";
+ code = code + " " + castElementType + " " + elementVar + "=(";
+ code = code + castElementType + ")(" + enumVar + ".nextElement());\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // amount to dc\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
+ }
+ code = code + "} // loop\n";
+ return code;
+ }
- private String getExistsCheckCode_OverIterator(boolean iteratorImpl) {
- String code = "";
- String elementType = getElementType();
- String castElementType = elementType;
- if (elementType.equals("int")) {
- castElementType = "Integer";
- }
- if (elementType.equals("float")) {
- castElementType = "Float";
- }
- if (elementType.equals("boolean")) {
- castElementType = "Boolean";
- }
- if (elementType.equals("byte")) {
- castElementType = "Byte";
- }
- if (elementType.equals("double")) {
- castElementType = "Double";
- }
- if (elementType.equals("long")) {
- castElementType = "Long";
- }
- if (elementType.equals("short")) {
- castElementType = "Short";
- }
- if (elementType.equals("char")) {
- castElementType = "Character";
- }
- String enumVar = "__" + getMangledValue(getElementVar()) + "_iterator";
- String elementVar = getElementVar();
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=false;\n";
- String postfix = "";
- if (iteratorImpl) {
- postfix = ".iterator()";
- }
- code = code + "for (java.util.Iterator " + enumVar + "=" + quantificationDomain + postfix + ";\n";
- code = code + " " + enumVar + ".hasNext() && !" + resultVar + "; ){\n";
- code = code + " " + castElementType + " " + elementVar + "=(";
- code = code + castElementType + ")(" + enumVar + ".next());\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // amount to dc\n";
- code = code + "else {\n";
- code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
- }
- code = code + "} // loop\n";
- return code;
- }
+ private String getExistsCheckCode_OverIterator(boolean iteratorImpl)
+ {
+ String code = "";
+ String elementType = getElementType();
+ String castElementType = elementType;
+ if (elementType.equals("int"))
+ {
+ castElementType = "Integer";
+ }
+ if (elementType.equals("float"))
+ {
+ castElementType = "Float";
+ }
+ if (elementType.equals("boolean"))
+ {
+ castElementType = "Boolean";
+ }
+ if (elementType.equals("byte"))
+ {
+ castElementType = "Byte";
+ }
+ if (elementType.equals("double"))
+ {
+ castElementType = "Double";
+ }
+ if (elementType.equals("long"))
+ {
+ castElementType = "Long";
+ }
+ if (elementType.equals("short"))
+ {
+ castElementType = "Short";
+ }
+ if (elementType.equals("char"))
+ {
+ castElementType = "Character";
+ }
+ String enumVar = "__" + getMangledValue(getElementVar()) + "_iterator";
+ String elementVar = getElementVar();
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=false;\n";
+ String postfix = "";
+ if (iteratorImpl)
+ {
+ postfix = ".iterator()";
+ }
+ code = code + "for (java.util.Iterator " + enumVar + "=" + quantificationDomain + postfix + ";\n";
+ code = code + " " + enumVar + ".hasNext() && !" + resultVar + "; ){\n";
+ code = code + " " + castElementType + " " + elementVar + "=(";
+ code = code + castElementType + ")(" + enumVar + ".next());\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // amount to dc\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
+ }
+ code = code + "} // loop\n";
+ return code;
+ }
- private String getExistsCheckCode_OverRange() {
- String code = "";
- String elementType = getElementType();
- String _tmp = "__" + getMangledValue(getElementVar()) + "_counter";
- String elementVar = getElementVar();
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String rangeStart = getRangeStart(quantificationDomain);
- String rangeEnd = getRangeEnd(quantificationDomain);
- String step = getRangeStep(quantificationDomain);
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=false;\n";
- code = code + "for (" + elementType + " " + elementVar + "=" + rangeStart + "; ";
- String compare = "";
- if (step.startsWith("-")) {
- compare = " >= ";
- } else {
- compare = " <= ";
- }
- code = code + "(" + elementVar + compare + rangeEnd + ") && !" + resultVar + "; " + elementVar + "=" + elementVar + "+(" + elementType + ")" + step + " ){\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // amount to dc\n";
- code = code + "else {\n";
- code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
- }
- code = code + "} // loop\n";
- return code;
- }
+ private String getExistsCheckCode_OverRange()
+ {
+ String code = "";
+ String elementType = getElementType();
+ String _tmp = "__" + getMangledValue(getElementVar()) + "_counter";
+ String elementVar = getElementVar();
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String rangeStart = getRangeStart(quantificationDomain);
+ String rangeEnd = getRangeEnd(quantificationDomain);
+ String step = getRangeStep(quantificationDomain);
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=false;\n";
+ code = code + "for (" + elementType + " " + elementVar + "=" + rangeStart + "; ";
+ String compare = "";
+ if (step.startsWith("-"))
+ {
+ compare = " >= ";
+ }
+ else
+ {
+ compare = " <= ";
+ }
+ code = code + "(" + elementVar + compare + rangeEnd + ") && !" + resultVar + "; " + elementVar + "="
+ + elementVar + "+(" + elementType + ")" + step + " ){\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // amount to dc\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + " = " + getImplication(quantifiedExpression) + "; // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + quantifiedExpression + ";\n";
+ }
+ code = code + "} // loop\n";
+ return code;
+ }
- private String getForallCheckCode() {
- String code = "";
- String quantificationDomain = getQuantificationDomain();
- if (isRangeDomain(quantificationDomain)) {
- code = getForallCheckCode_OverRange();
- } else
- if (isArrayDomain()) {
- code = getForallCheckCode_OverArray();
- } else
- if (isIteratorDomain()) {
- code = getForallCheckCode_OverIterator(false);
- } else
- if (isEnumerationDomain()) {
- code = getForallCheckCode_OverEnumeration(false);
- } else {
- String d = getQuantificationDomain().trim();
- String type_of_domain = "";
- try {
- type_of_domain = subject_.getTypeOfValue(d).trim();
- if (type_of_domain.indexOf("[") != -1) {
- code = getForallCheckCode_OverArray();
- } else
- if (type_of_domain.equals("java.util.Enumeration")) {
- code = getForallCheckCode_OverEnumeration(false);
- } else
- if (type_of_domain.equals("java.util.Iterator")) {
- code = getForallCheckCode_OverIterator(false);
- } else
- if (isImplementationOf("java.util.Iterator", type_of_domain)) {
- code = getForallCheckCode_OverIterator(false);
- } else
- if (isImplementationOf("java.util.Enumeration", type_of_domain)) {
- code = getForallCheckCode_OverEnumeration(false);
- } else
- if (hasImplementationOfMethod("elements", "java.util.Enumeration", type_of_domain)) {
- code = getForallCheckCode_OverEnumeration(true);
- } else
- if (hasImplementationOfMethod("iterator", "java.util.Iterator", type_of_domain)) {
- code = getForallCheckCode_OverIterator(true);
- } else {
- String dd = getQuantificationDomain().trim();
- log.warn("The type of " + dd + " in " + ((CodeMetaclass)subject_).getSignature() + " is " + type_of_domain + "\n" + "Complete assertion: " + subject_ + "\nQuantifier domains must be: Array, Range (e.g. a .. b [by c]), Enumeration, Iterator or implementation thereof or\nimplementors of 'Enumeration elements()' or 'Iterator iterator()' (e.g. the Java 2 Collections, JDK 1.1 Vector, etc.)\n" + "As a best effort will use java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
- code = getForallCheckCode_OverEnumeration(false);
+ private String getForallCheckCode()
+ {
+ String code = "";
+ String quantificationDomain = getQuantificationDomain();
+ if (isRangeDomain(quantificationDomain))
+ {
+ code = getForallCheckCode_OverRange();
+ }
+ else if (isArrayDomain())
+ {
+ code = getForallCheckCode_OverArray();
+ }
+ else if (isIteratorDomain())
+ {
+ code = getForallCheckCode_OverIterator(false);
+ }
+ else if (isEnumerationDomain())
+ {
+ code = getForallCheckCode_OverEnumeration(false);
+ }
+ else
+ {
+ String d = getQuantificationDomain().trim();
+ String type_of_domain = "";
+ try
+ {
+ type_of_domain = subject_.getTypeOfValue(d).trim();
+ if (type_of_domain.indexOf("[") != -1)
+ {
+ code = getForallCheckCode_OverArray();
+ }
+ else if (type_of_domain.equals("java.util.Enumeration"))
+ {
+ code = getForallCheckCode_OverEnumeration(false);
+ }
+ else if (type_of_domain.equals("java.util.Iterator"))
+ {
+ code = getForallCheckCode_OverIterator(false);
+ }
+ else if (isImplementationOf("java.util.Iterator", type_of_domain))
+ {
+ code = getForallCheckCode_OverIterator(false);
+ }
+ else if (isImplementationOf("java.util.Enumeration", type_of_domain))
+ {
+ code = getForallCheckCode_OverEnumeration(false);
+ }
+ else if (hasImplementationOfMethod("elements", "java.util.Enumeration", type_of_domain))
+ {
+ code = getForallCheckCode_OverEnumeration(true);
+ }
+ else if (hasImplementationOfMethod("iterator", "java.util.Iterator", type_of_domain))
+ {
+ code = getForallCheckCode_OverIterator(true);
+ }
+ else
+ {
+ String dd = getQuantificationDomain().trim();
+ log
+ .warn("The type of "
+ + dd
+ + " in "
+ + ((CodeMetaclass) subject_).getSignature()
+ + " is "
+ + type_of_domain
+ + "\n"
+ + "Complete assertion: "
+ + subject_
+ + "\nQuantifier domains must be: Array, Range (e.g. a .. b [by c]), Enumeration, Iterator or implementation thereof or\nimplementors of 'Enumeration elements()' or 'Iterator iterator()' (e.g. the Java 2 Collections, JDK 1.1 Vector, etc.)\n"
+ + "As a best effort will use java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
+ code = getForallCheckCode_OverEnumeration(false);
+ }
}
- }
- catch (UnableToDetermineTypeException e) {
- String dd = getQuantificationDomain().trim();
- log.warn("Could not determine type of " + dd + " in " + ((CodeMetaclass)subject_).getSignature() + "\n" + "Complete assertion: " + subject_ + "\n" + "Using java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
- log.warn(e.getMessage());
- code = getForallCheckCode_OverEnumeration(false);
- }
- }
- return code;
- }
+ catch (UnableToDetermineTypeException e)
+ {
+ String dd = getQuantificationDomain().trim();
+ log
+ .warn("Could not determine type of "
+ + dd
+ + " in "
+ + ((CodeMetaclass) subject_).getSignature()
+ + "\n"
+ + "Complete assertion: "
+ + subject_
+ + "\n"
+ + "Using java.util.Enumeration by default. Use '.. inarray ..', '.. inrange ..' or '.. initerator ..' instead of '.. in ..' if required as a workaround.");
+ log.warn(e.getMessage());
+ code = getForallCheckCode_OverEnumeration(false);
+ }
+ }
+ return code;
+ }
- private String getForallCheckCode_OverArray() {
- String code = "";
- String elementType = getElementType();
- String elementVar = getElementVar();
- String indexVar = "__index_" + getMangledValue(getElementVar());
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=true;\n";
- code = code + "for ( int " + indexVar + "= 0; " + indexVar + " < " + quantificationDomain + ".length; " + indexVar + "++){\n";
- code = code + " " + elementType + " " + elementVar + "= " + quantificationDomain + "[" + indexVar + "];\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + resultVar + " && " + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // implication evaluates to true, does not affect return\n";
- code = code + "else {\n";
- code = code + " " + resultVar + "=" + resultVar + " && (" + getImplication(quantifiedExpression) + " ); // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + resultVar + " && (" + quantifiedExpression + ");\n";
- }
- code = code + "}\n";
- return code;
- }
+ private String getForallCheckCode_OverArray()
+ {
+ String code = "";
+ String elementType = getElementType();
+ String elementVar = getElementVar();
+ String indexVar = "__index_" + getMangledValue(getElementVar());
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=true;\n";
+ code = code + "for ( int " + indexVar + "= 0; " + indexVar + " < " + quantificationDomain + ".length; "
+ + indexVar + "++){\n";
+ code = code + " " + elementType + " " + elementVar + "= " + quantificationDomain + "[" + indexVar + "];\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + resultVar + " && " + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // implication evaluates to true, does not affect return\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + "=" + resultVar + " && (" + getImplication(quantifiedExpression)
+ + " ); // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + resultVar + " && (" + quantifiedExpression + ");\n";
+ }
+ code = code + "}\n";
+ return code;
+ }
- private String getForallCheckCode_OverEnumeration(boolean enumerationImpl) {
- String code = "";
- String elementType = getElementType();
- String castElementType = elementType;
- if (elementType.equals("int")) {
- castElementType = "Integer";
- }
- if (elementType.equals("float")) {
- castElementType = "Float";
- }
- if (elementType.equals("boolean")) {
- castElementType = "Boolean";
- }
- if (elementType.equals("byte")) {
- castElementType = "Byte";
- }
- if (elementType.equals("double")) {
- castElementType = "Double";
- }
- if (elementType.equals("long")) {
- castElementType = "Long";
- }
- if (elementType.equals("short")) {
- castElementType = "Short";
- }
- if (elementType.equals("char")) {
- castElementType = "Character";
- }
- String enumVar = "__" + getMangledValue(getElementVar()) + "_enum";
- String elementVar = getElementVar();
- String resultVar = "__result_" + getMangledValue(getElementVar());
- String quantificationDomain = getQuantificationDomain();
- String quantifiedExpression = getQuantifiedExpression();
- code = code + "boolean " + resultVar + "=true;\n";
- String postfix = "";
- if (enumerationImpl) {
- postfix = ".elements()";
- }
- code = code + "for (java.util.Enumeration " + enumVar + "=" + quantificationDomain + postfix + ";\n";
- code = code + " " + enumVar + ".hasMoreElements() && " + resultVar + "; ){\n";
- code = code + " " + castElementType + " " + elementVar + "=(";
- code = code + castElementType + ")(" + enumVar + ".nextElement());\n";
- AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
- if (subassert.includesQuantifier()) {
- code = code + subassert.getPartialCheckCode();
- String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
- code = code + resultVar + "=" + resultVar + " && " + subresultVar + ";\n";
- } else
- if (containsImplies(quantifiedExpression)) {
- code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression) + " )) // implication condition\n";
- code = code + " { } // implication evaluates to true, does not affect return\n";
- code = code + "else {\n";
- code = code + " " + resultVar + "=" + resultVar + " && (" + getImplication(quantifiedExpression) + " ); // the implication \n";
- code = code + "}\n";
- } else {
- code = code + " " + resultVar + "=" + resultVar + " && (" + quantifiedExpression + ");\n";
- }
- code = code + "}\n";
- return code;
- }
+ private String getForallCheckCode_OverEnumeration(boolean enumerationImpl)
+ {
+ String code = "";
+ String elementType = getElementType();
+ String castElementType = elementType;
+ if (elementType.equals("int"))
+ {
+ castElementType = "Integer";
+ }
+ if (elementType.equals("float"))
+ {
+ castElementType = "Float";
+ }
+ if (elementType.equals("boolean"))
+ {
+ castElementType = "Boolean";
+ }
+ if (elementType.equals("byte"))
+ {
+ castElementType = "Byte";
+ }
+ if (elementType.equals("double"))
+ {
+ castElementType = "Double";
+ }
+ if (elementType.equals("long"))
+ {
+ castElementType = "Long";
+ }
+ if (elementType.equals("short"))
+ {
+ castElementType = "Short";
+ }
+ if (elementType.equals("char"))
+ {
+ castElementType = "Character";
+ }
+ String enumVar = "__" + getMangledValue(getElementVar()) + "_enum";
+ String elementVar = getElementVar();
+ String resultVar = "__result_" + getMangledValue(getElementVar());
+ String quantificationDomain = getQuantificationDomain();
+ String quantifiedExpression = getQuantifiedExpression();
+ code = code + "boolean " + resultVar + "=true;\n";
+ String postfix = "";
+ if (enumerationImpl)
+ {
+ postfix = ".elements()";
+ }
+ code = code + "for (java.util.Enumeration " + enumVar + "=" + quantificationDomain + postfix + ";\n";
+ code = code + " " + enumVar + ".hasMoreElements() && " + resultVar + "; ){\n";
+ code = code + " " + castElementType + " " + elementVar + "=(";
+ code = code + castElementType + ")(" + enumVar + ".nextElement());\n";
+ AssertionExpression subassert = new AssertionExpression(quantifiedExpression, subject_);
+ if (subassert.includesQuantifier())
+ {
+ code = code + subassert.getPartialCheckCode();
+ String subresultVar = "__result_" + getMangledValue(subassert.getElementVar());
+ code = code + resultVar + "=" + resultVar + " && " + subresultVar + ";\n";
+ }
+ else if (containsImplies(quantifiedExpression))
+ {
+ code = code + "if (!( " + getImpliesConditionExpression(quantifiedExpression)
+ + " )) // implication condition\n";
+ code = code + " { } // implication evaluates to true, does not affect return\n";
+ code = code + "else {\n";
+ code = code + " " + resultVar + "=" + resultVar + " && (" + getImplication(quantifiedExpression)
+ + " ); // the implication \n";
+ code = code + "}\n";
+ }
+ else
+ {
+ code = code + " " + resultVar + "=" + resultVar + " && (" + quantifiedExpression + ");\n";
+ }
+ code = code + "}\n";
+ return code;
+ }
- private String getForallCheckCode_OverIterator(boolean iteratorImpl) {
- String code = "";
- String elementType = getElementType();
- String castElementType = elementType;
- if (elementType.equals("int")) {
- castElementType = "Integer";
- }
- if (elementType.equals("float")) {
- castElementType = "Float";
- }
- if (elementType.equals("boolean")) {
- castElementType = "Boolean";
- }
- if (elementType.equals("byte")) {
- castElementType = "Byte";
- }
- if (elementType.equals("double")) {
- castElementType = "Double";
- }
- if (elementType.equals("long")) {
- castElementType = "Long";
- }
- if (elementType.equals("short")) {
- castElementType = "Short";
- }
- if (elementType.equals("char")) {
- castEleme...
[truncated message content] |
|
From: <js...@us...> - 2006-11-27 16:56:29
|
Revision: 33
http://svn.sourceforge.net/jcontracts/?rev=33&view=rev
Author: jstuyts
Date: 2006-11-27 08:56:26 -0800 (Mon, 27 Nov 2006)
Log Message:
-----------
Formatted code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java
trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/Option.java
trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java
trunk/source/java/net/sf/jcontracts/argparser/Parser.java
trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/argparser/Target.java
trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgLexer.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -10,599 +10,685 @@
import antlr.Tokenizer;
import antlr.collections.impl.BitSet;
-public class ArgLexer extends CharScannerNoBacktrackingNoInteractive
- implements ArgTokenTypes, Tokenizer {
+public class ArgLexer extends CharScannerNoBacktrackingNoInteractive implements ArgTokenTypes, Tokenizer
+{
- private Object _data;
- private int _position;
- private int _suspectedTokenStartPosition;
- private static final long _tokenSet_0_data_[] = {
- 0L, 0x7fffffe07fffffeL, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
- private static final long _tokenSet_1_data_[] = {
- 0x7ffe41000000000L, 0x7fffffe97ffffffL, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
- private static final long _tokenSet_2_data_[] = {
- 0xffffff7ffffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
- private static final long _tokenSet_3_data_[] = {
- 0xfffffffbfffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
- private static final long _tokenSet_4_data_[] = {
- 0xffffeffefffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_4 = new BitSet(_tokenSet_4_data_);
- private static final long _tokenSet_5_data_[] = {
- -1032L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
- };
- public static final BitSet _tokenSet_5 = new BitSet(_tokenSet_5_data_);
+ private Object _data;
- public ArgLexer(CharBufferNoBacktrackingNoInteractive cb) {
- super(cb);
- _data = null;
- _position = 0;
- _suspectedTokenStartPosition = 0;
- super.literals = new Hashtable();
- super.caseSensitiveLiterals = true;
- }
+ private int _position;
- public ArgLexer(InputStream in) {
- this(new CharBufferNoBacktrackingNoInteractive(in));
- }
+ private int _suspectedTokenStartPosition;
- public void consume() {
- super.consume();
- _position++;
- }
+ private static final long _tokenSet_0_data_[] =
+ {
+ 0L, 0x7fffffe07fffffeL, 0L, 0L, 0L
+ };
- protected Object getData() {
- return _data;
- }
+ public static final BitSet _tokenSet_0 = new BitSet(_tokenSet_0_data_);
- int getPosition() {
- return _position;
- }
+ private static final long _tokenSet_1_data_[] =
+ {
+ 0x7ffe41000000000L, 0x7fffffe97ffffffL, 0L, 0L, 0L
+ };
- public Token makeToken(int t) {
- ExtendedToken tok = (ExtendedToken)super.makeToken(t);
- tok.setStartEnd(_suspectedTokenStartPosition, getPosition());
- tok.setData(getData());
- return tok;
- }
+ public static final BitSet _tokenSet_1 = new BitSet(_tokenSet_1_data_);
- protected final char mCHAR(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 10;
- switch (super.la_1) {
- case 97: // 'a'
- case 98: // 'b'
- case 99: // 'c'
- case 100: // 'd'
- case 101: // 'e'
- case 102: // 'f'
- case 103: // 'g'
- case 104: // 'h'
- case 105: // 'i'
- case 106: // 'j'
- case 107: // 'k'
- case 108: // 'l'
- case 109: // 'm'
- case 110: // 'n'
- case 111: // 'o'
- case 112: // 'p'
- case 113: // 'q'
- case 114: // 'r'
- case 115: // 's'
- case 116: // 't'
- case 117: // 'u'
- case 118: // 'v'
- case 119: // 'w'
- case 120: // 'x'
- case 121: // 'y'
- case 122: // 'z'
- matchRange('a', 'z');
- break;
+ private static final long _tokenSet_2_data_[] =
+ {
+ 0xffffff7ffffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
+ };
- case 65: // 'A'
- case 66: // 'B'
- case 67: // 'C'
- case 68: // 'D'
- case 69: // 'E'
- case 70: // 'F'
- case 71: // 'G'
- case 72: // 'H'
- case 73: // 'I'
- case 74: // 'J'
- case 75: // 'K'
- case 76: // 'L'
- case 77: // 'M'
- case 78: // 'N'
- case 79: // 'O'
- case 80: // 'P'
- case 81: // 'Q'
- case 82: // 'R'
- case 83: // 'S'
- case 84: // 'T'
- case 85: // 'U'
- case 86: // 'V'
- case 87: // 'W'
- case 88: // 'X'
- case 89: // 'Y'
- case 90: // 'Z'
- matchRange('A', 'Z');
- break;
+ public static final BitSet _tokenSet_2 = new BitSet(_tokenSet_2_data_);
- default:
- throw new ScannerException("no viable alt for char: " + LA(1), getLine());
- }
- char c = LA(0);
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- return c;
- }
+ private static final long _tokenSet_3_data_[] =
+ {
+ 0xfffffffbfffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
+ };
- public final void mCOMMA(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 5;
- match(',');
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ public static final BitSet _tokenSet_3 = new BitSet(_tokenSet_3_data_);
- public final void mDASH(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 7;
- match("-");
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ private static final long _tokenSet_4_data_[] =
+ {
+ 0xffffeffefffffff8L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
+ };
- protected final void mDIGIT(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 14;
- matchRange('0', '9');
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ public static final BitSet _tokenSet_4 = new BitSet(_tokenSet_4_data_);
- public final void mDOUBLEQUOTE(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 8;
- match('"');
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ private static final long _tokenSet_5_data_[] =
+ {
+ -1032L, -1L, -1L, -1L, 0L, 0L, 0L, 0L
+ };
- protected final void mESC(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 13;
- match('\\');
- switch (super.la_1) {
- case 110: // 'n'
- match('n');
- break;
+ public static final BitSet _tokenSet_5 = new BitSet(_tokenSet_5_data_);
- case 114: // 'r'
- match('r');
- break;
+ public ArgLexer(CharBufferNoBacktrackingNoInteractive cb)
+ {
+ super(cb);
+ _data = null;
+ _position = 0;
+ _suspectedTokenStartPosition = 0;
+ super.literals = new Hashtable();
+ super.caseSensitiveLiterals = true;
+ }
- case 116: // 't'
- match('t');
- break;
+ public ArgLexer(InputStream in)
+ {
+ this(new CharBufferNoBacktrackingNoInteractive(in));
+ }
- case 98: // 'b'
- match('b');
- break;
+ public void consume()
+ {
+ super.consume();
+ _position++;
+ }
- case 102: // 'f'
- match('f');
- break;
+ protected Object getData()
+ {
+ return _data;
+ }
- case 34: // '"'
- match('"');
- break;
+ int getPosition()
+ {
+ return _position;
+ }
- case 39: // '\''
- match('\'');
- break;
+ public Token makeToken(int t)
+ {
+ ExtendedToken tok = (ExtendedToken) super.makeToken(t);
+ tok.setStartEnd(_suspectedTokenStartPosition, getPosition());
+ tok.setData(getData());
+ return tok;
+ }
- case 92: // '\\'
- match('\\');
- break;
+ protected final char mCHAR(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 10;
+ switch (super.la_1)
+ {
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ matchRange('a', 'z');
+ break;
- case 48: // '0'
- case 49: // '1'
- case 50: // '2'
- case 51: // '3'
- matchRange('0', '3');
- if (super.la_1 >= '0' && super.la_1 <= '9') {
- mDIGIT(false);
- if (super.la_1 >= '0' && super.la_1 <= '9') {
- mDIGIT(false);
- }
- }
- break;
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ matchRange('A', 'Z');
+ break;
- case 52: // '4'
- case 53: // '5'
- case 54: // '6'
- case 55: // '7'
- matchRange('4', '7');
- if (super.la_1 >= '0' && super.la_1 <= '9') {
- mDIGIT(false);
- }
- break;
+ default:
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ char c = LA(0);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ return c;
+ }
- default:
- throw new ScannerException("no viable alt for char: " + LA(1), getLine());
- }
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ public final void mCOMMA(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 5;
+ match(',');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- public final void mIDENT(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 6;
- int _cnt = 0;
-label0:
- do {
- switch (super.la_1) {
- case 97: // 'a'
- case 98: // 'b'
- case 99: // 'c'
- case 100: // 'd'
- case 101: // 'e'
- case 102: // 'f'
- case 103: // 'g'
- case 104: // 'h'
- case 105: // 'i'
- case 106: // 'j'
- case 107: // 'k'
- case 108: // 'l'
- case 109: // 'm'
- case 110: // 'n'
- case 111: // 'o'
- case 112: // 'p'
- case 113: // 'q'
- case 114: // 'r'
- case 115: // 's'
- case 116: // 't'
- case 117: // 'u'
- case 118: // 'v'
- case 119: // 'w'
- case 120: // 'x'
- case 121: // 'y'
- case 122: // 'z'
- matchRange('a', 'z');
- break;
+ public final void mDASH(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 7;
+ match("-");
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- case 65: // 'A'
- case 66: // 'B'
- case 67: // 'C'
- case 68: // 'D'
- case 69: // 'E'
- case 70: // 'F'
- case 71: // 'G'
- case 72: // 'H'
- case 73: // 'I'
- case 74: // 'J'
- case 75: // 'K'
- case 76: // 'L'
- case 77: // 'M'
- case 78: // 'N'
- case 79: // 'O'
- case 80: // 'P'
- case 81: // 'Q'
- case 82: // 'R'
- case 83: // 'S'
- case 84: // 'T'
- case 85: // 'U'
- case 86: // 'V'
- case 87: // 'W'
- case 88: // 'X'
- case 89: // 'Y'
- case 90: // 'Z'
- matchRange('A', 'Z');
- break;
+ protected final void mDIGIT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 14;
+ matchRange('0', '9');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- case 95: // '_'
- match('_');
- break;
+ public final void mDOUBLEQUOTE(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 8;
+ match('"');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- case 48: // '0'
- case 49: // '1'
- case 50: // '2'
- case 51: // '3'
- case 52: // '4'
- case 53: // '5'
- case 54: // '6'
- case 55: // '7'
- case 56: // '8'
- case 57: // '9'
- matchRange('0', '9');
- break;
+ protected final void mESC(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 13;
+ match('\\');
+ switch (super.la_1)
+ {
+ case 110: // 'n'
+ match('n');
+ break;
- case 36: // '$'
- match('$');
- break;
+ case 114: // 'r'
+ match('r');
+ break;
- case 46: // '.'
- match('.');
- break;
+ case 116: // 't'
+ match('t');
+ break;
- case 45: // '-'
- match('-');
- break;
+ case 98: // 'b'
+ match('b');
+ break;
- case 92: // '\\'
- match('\\');
- break;
+ case 102: // 'f'
+ match('f');
+ break;
- case 47: // '/'
- match('/');
- break;
+ case 34: // '"'
+ match('"');
+ break;
- case 58: // ':'
- match(':');
- break;
+ case 39: // '\''
+ match('\'');
+ break;
- case 64: // '@'
- match('@');
- break;
+ case 92: // '\\'
+ match('\\');
+ break;
- case 42: // '*'
- match('*');
- break;
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ matchRange('0', '3');
+ if (super.la_1 >= '0' && super.la_1 <= '9')
+ {
+ mDIGIT(false);
+ if (super.la_1 >= '0' && super.la_1 <= '9')
+ {
+ mDIGIT(false);
+ }
+ }
+ break;
- default:
- if (_cnt < 1) {
- throw new ScannerException("no viable alt for char: " + LA(1), getLine());
- }
- break label0;
- }
- _cnt++;
- } while (true);
- _ttype = testLiteralsTable(_ttype);
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ matchRange('4', '7');
+ if (super.la_1 >= '0' && super.la_1 <= '9')
+ {
+ mDIGIT(false);
+ }
+ break;
- public final void mOPTION_WITH_ARG(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 4;
- char c4 = '\0';
- char c3 = '\0';
- char c2 = '\0';
- StringBuffer strbuf1 = new StringBuffer();
- StringBuffer strbuf2 = new StringBuffer();
- String compound[] = null;
- mDASH(false);
- char c1 = mCHAR(false);
- strbuf1.append(c1);
- if (super.la_1 == '\'' && super.la_2 >= '\003' && super.la_2 <= '\377') {
- match('\'');
- for (; _tokenSet_2.member(super.la_1); strbuf2.append(c4)) {
- c4 = super.la_1;
- matchNot('\'');
- }
+ default:
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- match('\'');
- } else
- if (super.la_1 == '"' && super.la_2 >= '\003' && super.la_2 <= '\377') {
- match('"');
- for (; _tokenSet_3.member(super.la_1); strbuf2.append(c3)) {
- c3 = super.la_1;
- matchNot('"');
- }
+ public final void mIDENT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 6;
+ int _cnt = 0;
+ label0: do
+ {
+ switch (super.la_1)
+ {
+ case 97: // 'a'
+ case 98: // 'b'
+ case 99: // 'c'
+ case 100: // 'd'
+ case 101: // 'e'
+ case 102: // 'f'
+ case 103: // 'g'
+ case 104: // 'h'
+ case 105: // 'i'
+ case 106: // 'j'
+ case 107: // 'k'
+ case 108: // 'l'
+ case 109: // 'm'
+ case 110: // 'n'
+ case 111: // 'o'
+ case 112: // 'p'
+ case 113: // 'q'
+ case 114: // 'r'
+ case 115: // 's'
+ case 116: // 't'
+ case 117: // 'u'
+ case 118: // 'v'
+ case 119: // 'w'
+ case 120: // 'x'
+ case 121: // 'y'
+ case 122: // 'z'
+ matchRange('a', 'z');
+ break;
- match('"');
- } else
- if (super.la_1 == ' ') {
- match(' ');
- } else {
- for (; _tokenSet_4.member(super.la_1); strbuf2.append(c2)) {
- c2 = super.la_1;
- match(_tokenSet_4);
- }
+ case 65: // 'A'
+ case 66: // 'B'
+ case 67: // 'C'
+ case 68: // 'D'
+ case 69: // 'E'
+ case 70: // 'F'
+ case 71: // 'G'
+ case 72: // 'H'
+ case 73: // 'I'
+ case 74: // 'J'
+ case 75: // 'K'
+ case 76: // 'L'
+ case 77: // 'M'
+ case 78: // 'N'
+ case 79: // 'O'
+ case 80: // 'P'
+ case 81: // 'Q'
+ case 82: // 'R'
+ case 83: // 'S'
+ case 84: // 'T'
+ case 85: // 'U'
+ case 86: // 'V'
+ case 87: // 'W'
+ case 88: // 'X'
+ case 89: // 'Y'
+ case 90: // 'Z'
+ matchRange('A', 'Z');
+ break;
- }
- compound = new String[2];
- compound[0] = strbuf1.toString();
- if (strbuf2.toString().length() > 0) {
- compound[1] = strbuf2.toString();
- } else {
- compound[1] = null;
- }
- setData(compound);
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 95: // '_'
+ match('_');
+ break;
- public final void mQUOTE(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 9;
- match('\'');
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 48: // '0'
+ case 49: // '1'
+ case 50: // '2'
+ case 51: // '3'
+ case 52: // '4'
+ case 53: // '5'
+ case 54: // '6'
+ case 55: // '7'
+ case 56: // '8'
+ case 57: // '9'
+ matchRange('0', '9');
+ break;
- public final void mSL_COMMENT(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 12;
- match("//");
- for (; _tokenSet_5.member(super.la_1); matchNot('\n')) { }
- match('\n');
- _ttype = -1;
- newline();
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 36: // '$'
+ match('$');
+ break;
- protected final void mVOCAB(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 15;
- matchRange('\003', '\377');
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 46: // '.'
+ match('.');
+ break;
- public final void mWS(boolean _createToken) throws ScannerException {
- Token _token = null;
- int _begin = super.text.length();
- int _ttype = 11;
- switch (super.la_1) {
- case 32: // ' '
- match(' ');
- break;
+ case 45: // '-'
+ match('-');
+ break;
- case 9: // '\t'
- match('\t');
- break;
+ case 92: // '\\'
+ match('\\');
+ break;
- case 10: // '\n'
- match('\n');
- newline();
- break;
+ case 47: // '/'
+ match('/');
+ break;
- case 13: // '\r'
- match('\r');
- break;
+ case 58: // ':'
+ match(':');
+ break;
- default:
- throw new ScannerException("no viable alt for char: " + LA(1), getLine());
- }
- _ttype = -1;
- if (_createToken && _token == null) {
- _token = makeToken(_ttype);
- _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
- }
- super._returnToken = _token;
- }
+ case 64: // '@'
+ match('@');
+ break;
- public Token nextToken() {
- do {
- int _ttype = 0;
- resetText();
- try {
- switch (super.la_1) {
- case 44: // ','
- mCOMMA(true);
- Token _tmp = super._returnToken;
- break;
+ case 42: // '*'
+ match('*');
+ break;
- case 34: // '"'
- mDOUBLEQUOTE(true);
- Token _tmp1 = super._returnToken;
- break;
+ default:
+ if (_cnt < 1)
+ {
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ break label0;
+ }
+ _cnt++;
+ }
+ while (true);
+ _ttype = testLiteralsTable(_ttype);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
- case 39: // '\''
- mQUOTE(true);
- Token _tmp2 = super._returnToken;
- break;
+ public final void mOPTION_WITH_ARG(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 4;
+ char c4 = '\0';
+ char c3 = '\0';
+ char c2 = '\0';
+ StringBuffer strbuf1 = new StringBuffer();
+ StringBuffer strbuf2 = new StringBuffer();
+ String compound[] = null;
+ mDASH(false);
+ char c1 = mCHAR(false);
+ strbuf1.append(c1);
+ if (super.la_1 == '\'' && super.la_2 >= '\003' && super.la_2 <= '\377')
+ {
+ match('\'');
+ for (; _tokenSet_2.member(super.la_1); strbuf2.append(c4))
+ {
+ c4 = super.la_1;
+ matchNot('\'');
+ }
+ match('\'');
+ }
+ else if (super.la_1 == '"' && super.la_2 >= '\003' && super.la_2 <= '\377')
+ {
+ match('"');
+ for (; _tokenSet_3.member(super.la_1); strbuf2.append(c3))
+ {
+ c3 = super.la_1;
+ matchNot('"');
+ }
+
+ match('"');
+ }
+ else if (super.la_1 == ' ')
+ {
+ match(' ');
+ }
+ else
+ {
+ for (; _tokenSet_4.member(super.la_1); strbuf2.append(c2))
+ {
+ c2 = super.la_1;
+ match(_tokenSet_4);
+ }
+
+ }
+ compound = new String[2];
+ compound[0] = strbuf1.toString();
+ if (strbuf2.toString().length() > 0)
+ {
+ compound[1] = strbuf2.toString();
+ }
+ else
+ {
+ compound[1] = null;
+ }
+ setData(compound);
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mQUOTE(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 9;
+ match('\'');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mSL_COMMENT(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 12;
+ match("//");
+ for (; _tokenSet_5.member(super.la_1); matchNot('\n'))
+ {
+ }
+ match('\n');
+ _ttype = -1;
+ newline();
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ protected final void mVOCAB(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 15;
+ matchRange('\003', '\377');
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public final void mWS(boolean _createToken) throws ScannerException
+ {
+ Token _token = null;
+ int _begin = super.text.length();
+ int _ttype = 11;
+ switch (super.la_1)
+ {
+ case 32: // ' '
+ match(' ');
+ break;
+
case 9: // '\t'
+ match('\t');
+ break;
+
case 10: // '\n'
+ match('\n');
+ newline();
+ break;
+
case 13: // '\r'
- case 32: // ' '
- mWS(true);
- Token _tmp3 = super._returnToken;
- break;
+ match('\r');
+ break;
default:
- if (super.la_1 == '/' && super.la_2 == '/' && LA(3) >= '\003' && LA(3) <= '\377') {
- mSL_COMMENT(true);
- Token _tmp4 = super._returnToken;
- break;
- }
- if (super.la_1 == '-' && _tokenSet_0.member(super.la_2)) {
- mOPTION_WITH_ARG(true);
- Token _tmp5 = super._returnToken;
- break;
- }
- if (super.la_1 == '-') {
- mDASH(true);
- Token _tmp6 = super._returnToken;
- break;
- }
- if (_tokenSet_1.member(super.la_1)) {
- mIDENT(true);
- Token _tmp7 = super._returnToken;
- break;
- }
- if (LA(1) != '\uFFFF') {
- throw new ScannerException("no viable alt for char: " + LA(1), getLine());
- }
- super._returnToken = makeToken(1);
- break;
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ _ttype = -1;
+ if (_createToken && _token == null)
+ {
+ _token = makeToken(_ttype);
+ _token.setText(new String(super.text.getBuffer(), _begin, super.text.length() - _begin));
+ }
+ super._returnToken = _token;
+ }
+
+ public Token nextToken()
+ {
+ do
+ {
+ int _ttype = 0;
+ resetText();
+ try
+ {
+ switch (super.la_1)
+ {
+ case 44: // ','
+ mCOMMA(true);
+ Token _tmp = super._returnToken;
+ break;
+
+ case 34: // '"'
+ mDOUBLEQUOTE(true);
+ Token _tmp1 = super._returnToken;
+ break;
+
+ case 39: // '\''
+ mQUOTE(true);
+ Token _tmp2 = super._returnToken;
+ break;
+
+ case 9: // '\t'
+ case 10: // '\n'
+ case 13: // '\r'
+ case 32: // ' '
+ mWS(true);
+ Token _tmp3 = super._returnToken;
+ break;
+
+ default:
+ if (super.la_1 == '/' && super.la_2 == '/' && LA(3) >= '\003' && LA(3) <= '\377')
+ {
+ mSL_COMMENT(true);
+ Token _tmp4 = super._returnToken;
+ break;
+ }
+ if (super.la_1 == '-' && _tokenSet_0.member(super.la_2))
+ {
+ mOPTION_WITH_ARG(true);
+ Token _tmp5 = super._returnToken;
+ break;
+ }
+ if (super.la_1 == '-')
+ {
+ mDASH(true);
+ Token _tmp6 = super._returnToken;
+ break;
+ }
+ if (_tokenSet_1.member(super.la_1))
+ {
+ mIDENT(true);
+ Token _tmp7 = super._returnToken;
+ break;
+ }
+ if (LA(1) != '\uFFFF')
+ {
+ throw new ScannerException("no viable alt for char: " + LA(1), getLine());
+ }
+ super._returnToken = makeToken(1);
+ break;
+ }
+ _ttype = super._returnToken.getType();
+ if (_ttype != -1)
+ {
+ return super._returnToken;
+ }
}
- _ttype = super._returnToken.getType();
- if (_ttype != -1) {
- return super._returnToken;
+ catch (ScannerException e)
+ {
+ consume();
+ reportError(e);
}
- }
- catch (ScannerException e) {
- consume();
- reportError(e);
- }
- } while (true);
- }
+ }
+ while (true);
+ }
- public void resetText() {
- super.resetText();
- setData(null);
- _suspectedTokenStartPosition = getPosition();
- }
+ public void resetText()
+ {
+ super.resetText();
+ setData(null);
+ _suspectedTokenStartPosition = getPosition();
+ }
- protected void setData(Object o) {
- _data = o;
- }
+ protected void setData(Object o)
+ {
+ _data = o;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgParser.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -9,136 +9,165 @@
import antlr.TokenBuffer;
import antlr.Tokenizer;
-public class ArgParser extends LLkParserNoInteractive
- implements ArgTokenTypes {
+public class ArgParser extends LLkParserNoInteractive implements ArgTokenTypes
+{
- private Vector _options;
- private Vector _targets;
- private ParserMetaclassFactory _metaclassFactory;
- public static final String _tokenNames[] = {
- "<0>", "EOF", "<epsilon>", "NULL_TREE_LOOKAHEAD", "OPTION_WITH_ARG", "COMMA", "IDENT", "DASH", "DOUBLEQUOTE", "QUOTE",
- "CHAR", "WS", "SL_COMMENT", "ESC", "DIGIT", "VOCAB"
- };
+ private Vector _options;
- public ArgParser(TokenBuffer tokenBuf) {
- this(tokenBuf, 3);
- }
+ private Vector _targets;
- protected ArgParser(TokenBuffer tokenBuf, int k) {
- super(tokenBuf, k);
- _options = new Vector();
- _targets = new Vector();
- _metaclassFactory = new MetaclassFactory();
- super.tokenNames = _tokenNames;
- }
+ private ParserMetaclassFactory _metaclassFactory;
- public ArgParser(Tokenizer lexer) {
- this(lexer, 3);
- }
+ public static final String _tokenNames[] =
+ {
+ "<0>", "EOF", "<epsilon>", "NULL_TREE_LOOKAHEAD", "OPTION_WITH_ARG", "COMMA", "IDENT", "DASH", "DOUBLEQUOTE",
+ "QUOTE", "CHAR", "WS", "SL_COMMENT", "ESC", "DIGIT", "VOCAB"
+ };
- protected ArgParser(Tokenizer lexer, int k) {
- super(lexer, k);
- _options = new Vector();
- _targets = new Vector();
- _metaclassFactory = new MetaclassFactory();
- super.tokenNames = _tokenNames;
- }
+ public ArgParser(TokenBuffer tokenBuf)
+ {
+ this(tokenBuf, 3);
+ }
- private void addOption(OptionMetaclass o) {
- _options.addElement(o);
- }
+ protected ArgParser(TokenBuffer tokenBuf, int k)
+ {
+ super(tokenBuf, k);
+ _options = new Vector();
+ _targets = new Vector();
+ _metaclassFactory = new MetaclassFactory();
+ super.tokenNames = _tokenNames;
+ }
- private void addTarget(TargetMetaclass t) {
- _targets.addElement(t);
- }
+ public ArgParser(Tokenizer lexer)
+ {
+ this(lexer, 3);
+ }
- public final void cmdline() throws ParserException {
- OptionMetaclass o = null;
- TargetMetaclass t = null;
- while (super.la_1 == 4) {
- o = option();
- addOption(o);
- }
- while (super.la_1 == 6) {
- t = target();
- addTarget(t);
- }
- }
+ protected ArgParser(Tokenizer lexer, int k)
+ {
+ super(lexer, k);
+ _options = new Vector();
+ _targets = new Vector();
+ _metaclassFactory = new MetaclassFactory();
+ super.tokenNames = _tokenNames;
+ }
- private ParserMetaclassFactory getMetaclassFactory() {
- return _metaclassFactory;
- }
+ private void addOption(OptionMetaclass o)
+ {
+ _options.addElement(o);
+ }
- Vector getOptions() {
- return _options;
- }
+ private void addTarget(TargetMetaclass t)
+ {
+ _targets.addElement(t);
+ }
- Vector getTargets() {
- return _targets;
- }
+ public final void cmdline() throws ParserException
+ {
+ OptionMetaclass o = null;
+ TargetMetaclass t = null;
+ while (super.la_1 == 4)
+ {
+ o = option();
+ addOption(o);
+ }
+ while (super.la_1 == 6)
+ {
+ t = target();
+ addTarget(t);
+ }
+ }
- public static void main(String args[]) throws Exception {
- try {
- java.io.InputStream is;
- if (args.length != 0) {
- is = new FileInputStream(args[0]);
- } else {
- is = System.in;
- }
- ArgLexer lexer = new ArgLexer(is);
- lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
- ArgParser parser = new ArgParser(lexer);
- parser.cmdline();
- System.out.println("OPTIONS:");
- Vector options = parser.getOptions();
- Vector targets = parser.getTargets();
- for (int i = 0; i < options.size(); i++) {
- System.out.println(options.elementAt(i));
- }
+ private ParserMetaclassFactory getMetaclassFactory()
+ {
+ return _metaclassFactory;
+ }
- System.out.println("TARGETS: ");
- for (int i = 0; i < targets.size(); i++) {
- System.out.println(targets.elementAt(i));
- }
+ Vector getOptions()
+ {
+ return _options;
+ }
- }
- catch (Exception e) {
- System.err.println("exception: " + e);
- throw e;
- }
- }
+ Vector getTargets()
+ {
+ return _targets;
+ }
- public final OptionMetaclass option() throws ParserException {
- Token o2 = null;
- Token j = null;
- Vector args = new Vector();
- String compound[] = null;
- o2 = LT(1);
- match(4);
- compound = (String[])((ExtendedToken)o2).getData();
- if (compound[1] != null) {
- args.addElement(compound[1]);
- }
- while (super.la_1 == 5) {
- match(5);
- j = LT(1);
- match(6);
- args.addElement(j.getText());
- }
- OptionMetaclass option = getMetaclassFactory().newOption(compound[0], args);
- return option;
- }
+ public static void main(String args[]) throws Exception
+ {
+ try
+ {
+ java.io.InputStream is;
+ if (args.length != 0)
+ {
+ is = new FileInputStream(args[0]);
+ }
+ else
+ {
+ is = System.in;
+ }
+ ArgLexer lexer = new ArgLexer(is);
+ lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
+ ArgParser parser = new ArgParser(lexer);
+ parser.cmdline();
+ System.out.println("OPTIONS:");
+ Vector options = parser.getOptions();
+ Vector targets = parser.getTargets();
+ for (int i = 0; i < options.size(); i++)
+ {
+ System.out.println(options.elementAt(i));
+ }
- void setMetaclassFactory(ParserMetaclassFactory metaclassFactory) {
- _metaclassFactory = metaclassFactory;
- }
+ System.out.println("TARGETS: ");
+ for (int i = 0; i < targets.size(); i++)
+ {
+ System.out.println(targets.elementAt(i));
+ }
- public final TargetMetaclass target() throws ParserException {
- Token j = null;
- j = LT(1);
- match(6);
- TargetMetaclass t = getMetaclassFactory().newTarget(j.getText());
- return t;
- }
+ }
+ catch (Exception e)
+ {
+ System.err.println("exception: " + e);
+ throw e;
+ }
+ }
+ public final OptionMetaclass option() throws ParserException
+ {
+ Token o2 = null;
+ Token j = null;
+ Vector args = new Vector();
+ String compound[] = null;
+ o2 = LT(1);
+ match(4);
+ compound = (String[]) ((ExtendedToken) o2).getData();
+ if (compound[1] != null)
+ {
+ args.addElement(compound[1]);
+ }
+ while (super.la_1 == 5)
+ {
+ match(5);
+ j = LT(1);
+ match(6);
+ args.addElement(j.getText());
+ }
+ OptionMetaclass option = getMetaclassFactory().newOption(compound[0], args);
+ return option;
+ }
+
+ void setMetaclassFactory(ParserMetaclassFactory metaclassFactory)
+ {
+ _metaclassFactory = metaclassFactory;
+ }
+
+ public final TargetMetaclass target() throws ParserException
+ {
+ Token j = null;
+ j = LT(1);
+ match(6);
+ TargetMetaclass t = getMetaclassFactory().newTarget(j.getText());
+ return t;
+ }
+
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/ArgTokenTypes.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -1,20 +1,33 @@
package net.sf.jcontracts.argparser;
+public interface ArgTokenTypes
+{
-public interface ArgTokenTypes {
+ public static final int EOF = 1;
- public static final int EOF = 1;
- public static final int NULL_TREE_LOOKAHEAD = 3;
- public static final int OPTION_WITH_ARG = 4;
- public static final int COMMA = 5;
- public static final int IDENT = 6;
- public static final int DASH = 7;
- public static final int DOUBLEQUOTE = 8;
- public static final int QUOTE = 9;
- public static final int CHAR = 10;
- public static final int WS = 11;
- public static final int SL_COMMENT = 12;
- public static final int ESC = 13;
- public static final int DIGIT = 14;
- public static final int VOCAB = 15;
+ public static final int NULL_TREE_LOOKAHEAD = 3;
+
+ public static final int OPTION_WITH_ARG = 4;
+
+ public static final int COMMA = 5;
+
+ public static final int IDENT = 6;
+
+ public static final int DASH = 7;
+
+ public static final int DOUBLEQUOTE = 8;
+
+ public static final int QUOTE = 9;
+
+ public static final int CHAR = 10;
+
+ public static final int WS = 11;
+
+ public static final int SL_COMMENT = 12;
+
+ public static final int ESC = 13;
+
+ public static final int DIGIT = 14;
+
+ public static final int VOCAB = 15;
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/ExtendedToken.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -2,51 +2,63 @@
import antlr.CommonToken;
-public class ExtendedToken extends CommonToken {
+public class ExtendedToken extends CommonToken
+{
- private Object _data;
- private int _start;
- private int _end;
+ private Object _data;
- public ExtendedToken() {
- _data = null;
- _end = 0;
- }
+ private int _start;
- public ExtendedToken(int t, String txt) {
- super(t, txt);
- _data = null;
- _end = 0;
- }
+ private int _end;
- public ExtendedToken(String s) {
- super(s);
- _data = null;
- _end = 0;
- }
+ public ExtendedToken()
+ {
+ _data = null;
+ _end = 0;
+ }
- Object getData() {
- return _data;
- }
+ public ExtendedToken(int t, String txt)
+ {
+ super(t, txt);
+ _data = null;
+ _end = 0;
+ }
- int getEnd() {
- return _end;
- }
+ public ExtendedToken(String s)
+ {
+ super(s);
+ _data = null;
+ _end = 0;
+ }
- int getStart() {
- return _start;
- }
+ Object getData()
+ {
+ return _data;
+ }
- void setData(Object o) {
- _data = o;
- }
+ int getEnd()
+ {
+ return _end;
+ }
- void setStartEnd(int start, int end) {
- _start = start;
- _end = end;
- }
+ int getStart()
+ {
+ return _start;
+ }
- public String toString() {
- return super.toString() + " [" + _start + ".." + _end + "] " + "(data=\"" + getData() + "\")";
- }
+ void setData(Object o)
+ {
+ _data = o;
+ }
+
+ void setStartEnd(int start, int end)
+ {
+ _start = start;
+ _end = end;
+ }
+
+ public String toString()
+ {
+ return super.toString() + " [" + _start + ".." + _end + "] " + "(data=\"" + getData() + "\")";
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/MetaclassFactory.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -2,17 +2,20 @@
import java.util.Vector;
-public class MetaclassFactory
- implements ParserMetaclassFactory {
+public class MetaclassFactory implements ParserMetaclassFactory
+{
- public OptionMetaclass newOption(String name, Vector parameters) {
- return new Option(name, parameters);
- }
+ public OptionMetaclass newOption(String name, Vector parameters)
+ {
+ return new Option(name, parameters);
+ }
- public TargetMetaclass newTarget(String name) {
- return new Target(name);
- }
+ public TargetMetaclass newTarget(String name)
+ {
+ return new Target(name);
+ }
- public MetaclassFactory() {
- }
+ public MetaclassFactory()
+ {
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/Option.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/Option.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/Option.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -2,9 +2,11 @@
import java.util.Vector;
-public class Option extends OptionMetaclass {
+public class Option extends OptionMetaclass
+{
- public Option(String name, Vector arguments) {
- super(name, arguments);
- }
+ public Option(String name, Vector arguments)
+ {
+ super(name, arguments);
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/OptionMetaclass.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -2,34 +2,43 @@
import java.util.Vector;
-public abstract class OptionMetaclass {
+public abstract class OptionMetaclass
+{
- private String _name;
- private Vector _arguments;
+ private String _name;
- public OptionMetaclass(String name, Vector arguments) {
- _name = null;
- _arguments = null;
- _name = name;
- _arguments = arguments;
- }
+ private Vector _arguments;
- public Vector getArguments() {
- return _arguments;
- }
+ public OptionMetaclass(String name, Vector arguments)
+ {
+ _name = null;
+ _arguments = null;
+ _name = name;
+ _arguments = arguments;
+ }
- public String getName() {
- return _name;
- }
+ public Vector getArguments()
+ {
+ return _arguments;
+ }
- public String toString() {
- String s = getClass().getName();
- s = s + " name: " + _name;
- if (_arguments.isEmpty()) {
- s = s + ", no arguments";
- } else {
- s = s + ", arguments: " + _arguments;
- }
- return s;
- }
+ public String getName()
+ {
+ return _name;
+ }
+
+ public String toString()
+ {
+ String s = getClass().getName();
+ s = s + " name: " + _name;
+ if (_arguments.isEmpty())
+ {
+ s = s + ", no arguments";
+ }
+ else
+ {
+ s = s + ", arguments: " + _arguments;
+ }
+ return s;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/Parser.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/Parser.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -5,31 +5,38 @@
import antlr.ParserException;
-public class Parser {
+public class Parser
+{
- private ArgParser _argparser;
- private ArgLexer _lexer;
+ private ArgParser _argparser;
- public Parser(String s) {
- StringBufferInputStream is = new StringBufferInputStream(s);
- _lexer = new ArgLexer(is);
- _lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
- _argparser = new ArgParser(_lexer);
- }
+ private ArgLexer _lexer;
- public void doParse() throws ParserException {
- _argparser.cmdline();
- }
+ public Parser(String s)
+ {
+ StringBufferInputStream is = new StringBufferInputStream(s);
+ _lexer = new ArgLexer(is);
+ _lexer.setTokenObjectClass("net.sf.jcontracts.argParser.ExtendedToken");
+ _argparser = new ArgParser(_lexer);
+ }
- public Vector getOptions() {
- return _argparser.getOptions();
- }
+ public void doParse() throws ParserException
+ {
+ _argparser.cmdline();
+ }
- public Vector getTargets() {
- return _argparser.getTargets();
- }
+ public Vector getOptions()
+ {
+ return _argparser.getOptions();
+ }
- public void setMetaclassFactory(ParserMetaclassFactory metaclassFactory) {
- _argparser.setMetaclassFactory(metaclassFactory);
- }
+ public Vector getTargets()
+ {
+ return _argparser.getTargets();
+ }
+
+ public void setMetaclassFactory(ParserMetaclassFactory metaclassFactory)
+ {
+ _argparser.setMetaclassFactory(metaclassFactory);
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/ParserMetaclassFactory.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -2,9 +2,10 @@
import java.util.Vector;
-public interface ParserMetaclassFactory {
+public interface ParserMetaclassFactory
+{
- public abstract OptionMetaclass newOption(String s, Vector vector);
+ public abstract OptionMetaclass newOption(String s, Vector vector);
- public abstract TargetMetaclass newTarget(String s);
+ public abstract TargetMetaclass newTarget(String s);
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/Target.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/Target.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/Target.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -1,9 +1,10 @@
package net.sf.jcontracts.argparser;
+public class Target extends TargetMetaclass
+{
-public class Target extends TargetMetaclass {
-
- public Target(String name) {
- super(name);
- }
+ public Target(String name)
+ {
+ super(name);
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java 2006-11-27 16:54:31 UTC (rev 32)
+++ trunk/source/java/net/sf/jcontracts/argparser/TargetMetaclass.java 2006-11-27 16:56:26 UTC (rev 33)
@@ -1,20 +1,23 @@
package net.sf.jcontracts.argparser;
+public abstract class TargetMetaclass
+{
-public abstract class TargetMetaclass {
+ private String _name;
- private String _name;
+ public TargetMetaclass(String name)
+ {
+ _name = null;
+ _name = name;
+ }
- public TargetMetaclass(String name) {
- _name = null;
- _name = name;
- }
+ public String getName()
+ {
+ return _name;
+ }
- public String getName() {
- return _name;
- }
-
- public String toString() {
- return getClass().getName() + " " + _name;
- }
+ public String toString()
+ {
+ return getClass().getName() + " " + _name;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <js...@us...> - 2006-11-27 16:54:33
|
Revision: 32
http://svn.sourceforge.net/jcontracts/?rev=32&view=rev
Author: jstuyts
Date: 2006-11-27 08:54:31 -0800 (Mon, 27 Nov 2006)
Log Message:
-----------
Formatted code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/codeparser/Class.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_PackageLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_TypeLevel.java
trunk/source/java/net/sf/jcontracts/codeparser/ExtendedToken.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeBody.java
trunk/source/java/net/sf/jcontracts/codeparser/ICodeMetaclassVisitor.java
trunk/source/java/net/sf/jcontracts/codeparser/IDependencyFilter.java
trunk/source/java/net/sf/jcontracts/codeparser/IDotty_Component_Level.java
trunk/source/java/net/sf/jcontracts/codeparser/Interface.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaLexer.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaParser.java
trunk/source/java/net/sf/jcontracts/codeparser/JavaTokenTypes.java
trunk/source/java/net/sf/jcontracts/codeparser/MetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/Method.java
trunk/source/java/net/sf/jcontracts/codeparser/Parser.java
trunk/source/java/net/sf/jcontracts/codeparser/ParserMetaclassFactory.java
trunk/source/java/net/sf/jcontracts/codeparser/TypeMetaclass.java
trunk/source/java/net/sf/jcontracts/codeparser/Variable.java
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Class.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Class.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Class.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -2,59 +2,77 @@
import java.util.Enumeration;
-public class Class extends TypeMetaclass {
+public class Class extends TypeMetaclass
+{
- public Class(String name, String filename, int line_number) {
- super(name, filename, line_number);
- }
+ public Class(String name, String filename, int line_number)
+ {
+ super(name, filename, line_number);
+ }
- protected boolean containsConstructor() {
- for (Enumeration e = super._elements.elements(); e.hasMoreElements();) {
- CodeMetaclass element = (CodeMetaclass)e.nextElement();
- if (element.isConstructor()) {
- return true;
- }
- }
+ protected boolean containsConstructor()
+ {
+ for (Enumeration e = super._elements.elements(); e.hasMoreElements();)
+ {
+ CodeMetaclass element = (CodeMetaclass) e.nextElement();
+ if (element.isConstructor())
+ {
+ return true;
+ }
+ }
- return false;
- }
+ return false;
+ }
- protected boolean containsDefaultConstructor() {
- for (Enumeration e = super._elements.elements(); e.hasMoreElements();) {
- CodeMetaclass element = (CodeMetaclass)e.nextElement();
- if (element.isDefaultConstructor()) {
- return true;
- }
- }
+ protected boolean containsDefaultConstructor()
+ {
+ for (Enumeration e = super._elements.elements(); e.hasMoreElements();)
+ {
+ CodeMetaclass element = (CodeMetaclass) e.nextElement();
+ if (element.isDefaultConstructor())
+ {
+ return true;
+ }
+ }
- return false;
- }
+ return false;
+ }
- public String getSignature() {
- return getName();
- }
+ public String getSignature()
+ {
+ return getName();
+ }
- public String getType() {
- return getName();
- }
+ public String getType()
+ {
+ return getName();
+ }
- public boolean isAbstract() {
- return getModifiers().contains("abstract");
- }
+ public boolean isAbstract()
+ {
+ return getModifiers().contains("abstract");
+ }
- public String toString() {
- String s = getLocationDescription();
- if (!getModifiers().isEmpty()) {
- s = s + getClass().getName() + " " + getModifiers();
- } else {
- s = s + getClass().getName();
- }
- String b = "";
- if (getStartOfBody() != 0 && getEndOfBody() != 0) {
- b = ", body [" + getStartOfBody() + ".." + getEndOfBody() + "]";
- } else {
- b = ", no body";
- }
- return s + " " + getName() + ", " + getCodeComment() + b;
- }
+ public String toString()
+ {
+ String s = getLocationDescription();
+ if (!getModifiers().isEmpty())
+ {
+ s = s + getClass().getName() + " " + getModifiers();
+ }
+ else
+ {
+ s = s + getClass().getName();
+ }
+ String b = "";
+ if (getStartOfBody() != 0 && getEndOfBody() != 0)
+ {
+ b = ", body [" + getStartOfBody() + ".." + getEndOfBody() + "]";
+ }
+ else
+ {
+ b = ", no body";
+ }
+ return s + " " + getName() + ", " + getCodeComment() + b;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeComment.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -5,75 +5,105 @@
import java.util.Hashtable;
import java.util.Vector;
-class CodeComment
- implements Serializable {
+class CodeComment implements Serializable
+{
- private String _title;
- private Hashtable _comment_tags;
- public static final String AUTHOR_TAG = "author";
- public static final String VERSION_TAG = "version";
- public static final String SEE_TAG = "see";
- public static final String PARAM_TAG = "param";
- public static final String RETURN_TAG = "return";
- public static final String EXCEPTION_TAG = "exception";
- public static final String PRECOND_TAG = "requires";
- public static final String POSTCOND_TAG = "ensures";
- public static final String INVARIANT_TAG = "invariant";
- public static final String OPEN_TAG = "open";
- public static final String KNOWN_TAGS[] = {
- "author", "version", "see", "param", "return", "exception", "requires", "ensures", "invariant", "open"
- };
+ private String _title;
- CodeComment() {
- _title = "";
- _comment_tags = new Hashtable();
- }
+ private Hashtable _comment_tags;
- void addTagEntry(String tag, String entry) {
- if (!_comment_tags.containsKey(tag)) {
- _comment_tags.put(tag, new Vector());
- }
- ((Vector)_comment_tags.get(tag)).addElement(entry);
- }
+ public static final String AUTHOR_TAG = "author";
- Vector getTagEntry(String tag) {
- if (!_comment_tags.containsKey(tag)) {
- return new Vector();
- } else {
- return (Vector)_comment_tags.get(tag);
- }
- }
+ public static final String VERSION_TAG = "version";
- Vector getTagNames() {
- Vector names = new Vector();
- String element;
- for (Enumeration e = _comment_tags.keys(); e.hasMoreElements(); names.addElement(element)) {
- element = (String)e.nextElement();
- }
+ public static final String SEE_TAG = "see";
- return names;
- }
+ public static final String PARAM_TAG = "param";
- String getTitle() {
- return _title;
- }
+ public static final String RETURN_TAG = "return";
- void setTitle(String title) {
- _title = title;
- }
+ public static final String EXCEPTION_TAG = "exception";
- public String toString() {
- if (_comment_tags.isEmpty() && _title.length() == 0) {
- return "empty code comment (no title, no tags)";
- }
- if (_comment_tags.isEmpty() && _title.length() != 0) {
- return "code comment: \"" + _title + "\", no tags ";
- }
- if (!_comment_tags.isEmpty() && _title.length() == 0) {
- return "code comment: no title, tags: " + _comment_tags;
- } else {
- return "code comment: \"" + _title + "\", tags: " + _comment_tags;
- }
- }
+ public static final String PRECOND_TAG = "requires";
+ public static final String POSTCOND_TAG = "ensures";
+
+ public static final String INVARIANT_TAG = "invariant";
+
+ public static final String OPEN_TAG = "open";
+
+ public static final String KNOWN_TAGS[] =
+ {
+ "author", "version", "see", "param", "return", "exception", "requires", "ensures", "invariant", "open"
+ };
+
+ CodeComment()
+ {
+ _title = "";
+ _comment_tags = new Hashtable();
+ }
+
+ void addTagEntry(String tag, String entry)
+ {
+ if (!_comment_tags.containsKey(tag))
+ {
+ _comment_tags.put(tag, new Vector());
+ }
+ ((Vector) _comment_tags.get(tag)).addElement(entry);
+ }
+
+ Vector getTagEntry(String tag)
+ {
+ if (!_comment_tags.containsKey(tag))
+ {
+ return new Vector();
+ }
+ else
+ {
+ return (Vector) _comment_tags.get(tag);
+ }
+ }
+
+ Vector getTagNames()
+ {
+ Vector names = new Vector();
+ String element;
+ for (Enumeration e = _comment_tags.keys(); e.hasMoreElements(); names.addElement(element))
+ {
+ element = (String) e.nextElement();
+ }
+
+ return names;
+ }
+
+ String getTitle()
+ {
+ return _title;
+ }
+
+ void setTitle(String title)
+ {
+ _title = title;
+ }
+
+ public String toString()
+ {
+ if (_comment_tags.isEmpty() && _title.length() == 0)
+ {
+ return "empty code comment (no title, no tags)";
+ }
+ if (_comment_tags.isEmpty() && _title.length() != 0)
+ {
+ return "code comment: \"" + _title + "\", no tags ";
+ }
+ if (!_comment_tags.isEmpty() && _title.length() == 0)
+ {
+ return "code comment: no title, tags: " + _comment_tags;
+ }
+ else
+ {
+ return "code comment: \"" + _title + "\", tags: " + _comment_tags;
+ }
+ }
+
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclass.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -3,162 +3,199 @@
import java.io.Serializable;
import java.util.Vector;
-public abstract class CodeMetaclass
- implements Serializable {
- class Name
- implements Serializable {
+public abstract class CodeMetaclass implements Serializable
+{
+ class Name implements Serializable
+ {
- private String n_;
+ private String n_;
- String asString() {
- return n_;
- }
+ String asString()
+ {
+ return n_;
+ }
- void setName(String n) {
- n_ = n;
- }
+ void setName(String n)
+ {
+ n_ = n;
+ }
- Name(String name) {
- n_ = name;
- }
- }
+ Name(String name)
+ {
+ n_ = name;
+ }
+ }
+ private Name _name;
- private Name _name;
- private int _line_number;
- private String _filename;
- private String _packagename;
- private CodeComment _cc;
- private Vector _modifiers;
- private CodeMetaclass _parent;
+ private int _line_number;
- protected CodeMetaclass(String name, String filename, int line_number) {
- _cc = new CodeComment();
- _modifiers = new Vector();
- _parent = null;
- _name = new Name(name);
- _filename = filename;
- _line_number = line_number;
- }
+ private String _filename;
- public void accept(ICodeMetaclassVisitor visitor) {
- visitor.accept(this);
- }
+ private String _packagename;
- protected CodeComment getCodeComment() {
- return _cc;
- }
+ private CodeComment _cc;
- public String getCodeCommentTitle() {
- return _cc.getTitle();
- }
+ private Vector _modifiers;
- public String getFilename() {
- return _filename;
- }
+ private CodeMetaclass _parent;
- public String getLocationDescription() {
- return protectString(_filename, '\\') + ":" + _line_number + ": ";
- }
+ protected CodeMetaclass(String name, String filename, int line_number)
+ {
+ _cc = new CodeComment();
+ _modifiers = new Vector();
+ _parent = null;
+ _name = new Name(name);
+ _filename = filename;
+ _line_number = line_number;
+ }
- Vector getModifiers() {
- return _modifiers;
- }
+ public void accept(ICodeMetaclassVisitor visitor)
+ {
+ visitor.accept(this);
+ }
- public String getName() {
- return _name.asString();
- }
+ protected CodeComment getCodeComment()
+ {
+ return _cc;
+ }
- public String getPackagename() {
- return _packagename;
- }
+ public String getCodeCommentTitle()
+ {
+ return _cc.getTitle();
+ }
- public CodeMetaclass getParent() {
- return _parent;
- }
+ public String getFilename()
+ {
+ return _filename;
+ }
- public abstract String getSignature();
+ public String getLocationDescription()
+ {
+ return protectString(_filename, '\\') + ":" + _line_number + ": ";
+ }
- public Vector getTagEntry(String tag) {
- return _cc.getTagEntry(tag);
- }
+ Vector getModifiers()
+ {
+ return _modifiers;
+ }
- public Vector getTagNames() {
- return _cc.getTagNames();
- }
+ public String getName()
+ {
+ return _name.asString();
+ }
- public abstract String getType();
+ public String getPackagename()
+ {
+ return _packagename;
+ }
- public boolean isConstructor() {
- return false;
- }
+ public CodeMetaclass getParent()
+ {
+ return _parent;
+ }
- public boolean isDefaultConstructor() {
- return false;
- }
+ public abstract String getSignature();
- public boolean isPrivate() {
- return getModifiers().contains("private");
- }
+ public Vector getTagEntry(String tag)
+ {
+ return _cc.getTagEntry(tag);
+ }
- public boolean isProtected() {
- return getModifiers().contains("protected");
- }
+ public Vector getTagNames()
+ {
+ return _cc.getTagNames();
+ }
- public boolean isPublic() {
- return getModifiers().contains("public");
- }
+ public abstract String getType();
- public boolean isStatic() {
- return getModifiers().contains("static");
- }
+ public boolean isConstructor()
+ {
+ return false;
+ }
- String protectString(String str, char key) {
- if (str.length() == 0) {
- return str;
- }
- if (str.indexOf(key) == -1) {
- return str;
- }
- StringBuffer buf = new StringBuffer();
- int last;
- int j;
- for (last = 0; (j = str.indexOf(key, last)) != -1; last = j + 1) {
- for (int i = last; i < str.indexOf(key, last); i++) {
- buf.append(str.charAt(i));
- }
+ public boolean isDefaultConstructor()
+ {
+ return false;
+ }
- buf.append("\\");
- buf.append(key);
- }
+ public boolean isPrivate()
+ {
+ return getModifiers().contains("private");
+ }
- buf.append(str.substring(last, str.length()));
- return buf.toString();
- }
+ public boolean isProtected()
+ {
+ return getModifiers().contains("protected");
+ }
- void setCodeComment(CodeComment cc) {
- _cc = cc;
- }
+ public boolean isPublic()
+ {
+ return getModifiers().contains("public");
+ }
- void setModifiers(Vector modifiers) {
- _modifiers = modifiers;
- }
+ public boolean isStatic()
+ {
+ return getModifiers().contains("static");
+ }
- public void setName(String name) {
- _name.setName(name);
- }
+ String protectString(String str, char key)
+ {
+ if (str.length() == 0)
+ {
+ return str;
+ }
+ if (str.indexOf(key) == -1)
+ {
+ return str;
+ }
+ StringBuffer buf = new StringBuffer();
+ int last;
+ int j;
+ for (last = 0; (j = str.indexOf(key, last)) != -1; last = j + 1)
+ {
+ for (int i = last; i < str.indexOf(key, last); i++)
+ {
+ buf.append(str.charAt(i));
+ }
- public void setPackagename(String name) {
- _packagename = name;
- }
+ buf.append("\\");
+ buf.append(key);
+ }
- public void setParent(CodeMetaclass parent) {
- _parent = parent;
- }
+ buf.append(str.substring(last, str.length()));
+ return buf.toString();
+ }
- public String toShortDescription() {
- String s = getClass().getName();
- s = s + " " + getName();
- return s;
- }
+ void setCodeComment(CodeComment cc)
+ {
+ _cc = cc;
+ }
+
+ void setModifiers(Vector modifiers)
+ {
+ _modifiers = modifiers;
+ }
+
+ public void setName(String name)
+ {
+ _name.setName(name);
+ }
+
+ public void setPackagename(String name)
+ {
+ _packagename = name;
+ }
+
+ public void setParent(CodeMetaclass parent)
+ {
+ _parent = parent;
+ }
+
+ public String toShortDescription()
+ {
+ String s = getClass().getName();
+ s = s + " " + getName();
+ return s;
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/CodeMetaclassCache.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -13,37 +13,45 @@
import antlr.ParserException;
-public class CodeMetaclassCache {
-
+public class CodeMetaclassCache
+{
+
private static final String base;
-
- public Vector getAnnotations(Vector allFilenames, Vector outdatedFilenames, String srcbase)
- throws IOException, ParserException, ClassNotFoundException {
+
+ public Vector getAnnotations(Vector allFilenames, Vector outdatedFilenames, String srcbase) throws IOException,
+ ParserException, ClassNotFoundException
+ {
File t_dir = new File(base);
- if (!t_dir.exists()) {
+ if (!t_dir.exists())
+ {
t_dir.mkdirs();
}
long start = System.currentTimeMillis();
- Vector noUpdate = (Vector)allFilenames.clone();
- for (Enumeration e = allFilenames.elements(); e.hasMoreElements();) {
- String fn = (String)e.nextElement();
- if (outdatedFilenames.contains(fn)) {
+ Vector noUpdate = (Vector) allFilenames.clone();
+ for (Enumeration e = allFilenames.elements(); e.hasMoreElements();)
+ {
+ String fn = (String) e.nextElement();
+ if (outdatedFilenames.contains(fn))
+ {
noUpdate.removeElement(fn);
}
}
-
- Vector recache = (Vector)outdatedFilenames.clone();
- for (Enumeration e = noUpdate.elements(); e.hasMoreElements();) {
- String fn = (String)e.nextElement();
+
+ Vector recache = (Vector) outdatedFilenames.clone();
+ for (Enumeration e = noUpdate.elements(); e.hasMoreElements();)
+ {
+ String fn = (String) e.nextElement();
File f = new File(getCacheFilenameFor(fn));
- if (!f.exists()) {
+ if (!f.exists())
+ {
recache.addElement(fn);
}
}
-
+
Vector result = new Vector(allFilenames.size() * 20);
- for (Enumeration e = recache.elements(); e.hasMoreElements();) {
- String fn = (String)e.nextElement();
+ for (Enumeration e = recache.elements(); e.hasMoreElements();)
+ {
+ String fn = (String) e.nextElement();
FileInputStream is = new FileInputStream(srcbase + fn);
System.err.println("Upating cache entry for: " + fn.replace(File.separatorChar, '.'));
Parser parser = new Parser(is, fn);
@@ -53,32 +61,43 @@
Vector annotations = parser.getAnnotations();
OutputStream os = new FileOutputStream(new File(getCacheFilenameFor(fn)));
ObjectOutputStream cmos = new ObjectOutputStream(os);
- try {
+ try
+ {
cmos.writeObject(annotations);
- } finally {
+ }
+ finally
+ {
os.close();
}
}
-
- for (Enumeration e = allFilenames.elements(); e.hasMoreElements();) {
- String fn = (String)e.nextElement();
+
+ for (Enumeration e = allFilenames.elements(); e.hasMoreElements();)
+ {
+ String fn = (String) e.nextElement();
InputStream is = new FileInputStream(new File(getCacheFilenameFor(fn)));
ObjectInputStream cmis = new ObjectInputStream(is);
- try {
- Vector ann = (Vector)cmis.readObject();
+ try
+ {
+ Vector ann = (Vector) cmis.readObject();
System.err.print("+");
- for (Enumeration e2 = ann.elements(); e2.hasMoreElements(); result.addElement(e2.nextElement())) { }
- } finally {
+ for (Enumeration e2 = ann.elements(); e2.hasMoreElements(); result.addElement(e2.nextElement()))
+ {
+ }
+ }
+ finally
+ {
is.close();
}
}
-
+
long end = System.currentTimeMillis();
- System.err.println("\nFound " + result.size() + " elements in " + allFilenames.size() + " files (took " + (double)(end - start) / 1000D + "s).");
+ System.err.println("\nFound " + result.size() + " elements in " + allFilenames.size() + " files (took "
+ + (double) (end - start) / 1000D + "s).");
return result;
}
-
- private String getCacheFilenameFor(String fn) {
+
+ private String getCacheFilenameFor(String fn)
+ {
String result = fn;
result = result.replace(':', '_');
result = result.replace('/', '_');
@@ -86,11 +105,13 @@
result = result.replace('.', '-');
return base + result + ".idarwin";
}
-
- public CodeMetaclassCache() {
+
+ public CodeMetaclassCache()
+ {
}
-
- static {
+
+ static
+ {
base = "." + File.separatorChar + "darwin-data" + File.separatorChar + "cache" + File.separatorChar;
}
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DebugVisitor.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -1,33 +1,37 @@
package net.sf.jcontracts.codeparser;
+public class DebugVisitor implements ICodeMetaclassVisitor
+{
-public class DebugVisitor
- implements ICodeMetaclassVisitor {
+ public void accept(CodeMetaclass codemetaclass)
+ {
+ }
- public void accept(CodeMetaclass codemetaclass) {
- }
+ public void acceptMethod(CodeMetaclass item)
+ {
+ System.out.println("#### METHOD ####");
+ System.out.println("PARENT=\n" + item.getParent());
+ System.out.println("ITEM=\n" + item);
+ System.out.println();
+ }
- public void acceptMethod(CodeMetaclass item) {
- System.out.println("#### METHOD ####");
- System.out.println("PARENT=\n" + item.getParent());
- System.out.println("ITEM=\n" + item);
- System.out.println();
- }
+ public void acceptTypeMetaclass(CodeMetaclass item)
+ {
+ System.out.println("#### TYPE ####");
+ System.out.println("PARENT=\n" + item.getParent());
+ System.out.println("ITEM=\n" + item);
+ System.out.println();
+ }
- public void acceptTypeMetaclass(CodeMetaclass item) {
- System.out.println("#### TYPE ####");
- System.out.println("PARENT=\n" + item.getParent());
- System.out.println("ITEM=\n" + item);
- System.out.println();
- }
+ public void acceptVariable(CodeMetaclass item)
+ {
+ System.out.println("#### VARIABLE ####");
+ System.out.println("PARENT=\n" + item.getParent());
+ System.out.println("ITEM=\n" + item);
+ System.out.println();
+ }
- public void acceptVariable(CodeMetaclass item) {
- System.out.println("#### VARIABLE ####");
- System.out.println("PARENT=\n" + item.getParent());
- System.out.println("ITEM=\n" + item);
- System.out.println();
- }
-
- public DebugVisitor() {
- }
+ public DebugVisitor()
+ {
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitor.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -8,160 +8,215 @@
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureExporter;
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-public class DottyVisitor
- implements ICodeMetaclassVisitor {
+public class DottyVisitor implements ICodeMetaclassVisitor
+{
- private PrintWriter ostream;
- public static final int TYPE_DETAIL_LEVEL = 2;
- public static final int PACKAGE_DETAIL_LEVEL = 1;
- private IDotty_Component_Level component;
- private boolean layoutLR;
- private boolean directed;
- private int cluster_index;
- private boolean boxPackages;
- private boolean do_not_show_dependecy_details;
- private IArchitectureSpecification specification;
- private IDependencyFilter filter;
- private Vector unusedConstraints;
+ private PrintWriter ostream;
- public DottyVisitor(IArchitectureSpecification spec, String filename, String title, boolean layoutLR, boolean directed, int componentVisitorDetailLevel, boolean showPackages,
- Vector quietList, boolean check, boolean do_not_show_dependecy_details, IDependencyFilter filter) throws IOException {
- ostream = null;
- this.layoutLR = false;
- this.directed = true;
- cluster_index = 1;
- specification = null;
- this.filter = null;
- unusedConstraints = new Vector();
- specification = spec;
- if (componentVisitorDetailLevel == 2) {
- component = new Dotty_Component_TypeLevel(filter, check);
- }
- if (componentVisitorDetailLevel == 1) {
- component = new Dotty_Component_PackageLevel(filter, check);
- }
- this.directed = directed;
- boxPackages = showPackages;
- this.layoutLR = layoutLR;
- this.do_not_show_dependecy_details = do_not_show_dependecy_details;
- this.filter = filter;
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (filter == null) {
- writeHeader(ostream, title);
- } else {
- filter.writeHeader(ostream, title);
- }
- component.setIgnoranceList(quietList);
- }
+ public static final int TYPE_DETAIL_LEVEL = 2;
- public void accept(CodeMetaclass codemetaclass) {
- }
+ public static final int PACKAGE_DETAIL_LEVEL = 1;
- public void acceptMethod(CodeMetaclass item) {
- component.acceptMethod(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
+ private IDotty_Component_Level component;
- public void acceptTypeMetaclass(CodeMetaclass item) {
- component.acceptTypeMetaclass(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
+ private boolean layoutLR;
- public void acceptVariable(CodeMetaclass item) {
- component.acceptVariable(item, ostream, directed, specification, do_not_show_dependecy_details);
- }
+ private boolean directed;
- public void close() {
- if (filter == null) {
- component.createErrorLinks(directed, ostream);
- ostream.println("\n}");
- } else {
- filter.writeTrailer(ostream);
- }
- ostream.close();
- }
+ private int cluster_index;
- public void endSubGraph(String label) {
- if (boxPackages) {
- ostream.println("label=\"" + label + "\";");
- ostream.println("}");
- }
- }
+ private boolean boxPackages;
- public void export(String filename) {
- IArchitectureExporter exporter = null;
- try {
- exporter = specification.newArchitectureExporter(filename);
- if (exporter == null) {
- throw new RuntimeException("iDarwin: error no exporter implemented for this specification language.");
- }
- }
- catch (IOException e) {
- throw new RuntimeException("iDarwin: error could not open " + filename + " to export specification (" + e + ").", e);
- }
- try {
- exporter.open();
- exporter.export(specification);
- }
- catch (IOException e) {
- throw new RuntimeException("iDarwin: error during specification export to " + filename + " (" + e + ").", e);
- }
- finally {
- if (exporter != null) {
- try {
- exporter.close();
+ private boolean do_not_show_dependecy_details;
+
+ private IArchitectureSpecification specification;
+
+ private IDependencyFilter filter;
+
+ private Vector unusedConstraints;
+
+ public DottyVisitor(IArchitectureSpecification spec, String filename, String title, boolean layoutLR,
+ boolean directed, int componentVisitorDetailLevel, boolean showPackages, Vector quietList, boolean check,
+ boolean do_not_show_dependecy_details, IDependencyFilter filter) throws IOException
+ {
+ ostream = null;
+ this.layoutLR = false;
+ this.directed = true;
+ cluster_index = 1;
+ specification = null;
+ this.filter = null;
+ unusedConstraints = new Vector();
+ specification = spec;
+ if (componentVisitorDetailLevel == 2)
+ {
+ component = new Dotty_Component_TypeLevel(filter, check);
+ }
+ if (componentVisitorDetailLevel == 1)
+ {
+ component = new Dotty_Component_PackageLevel(filter, check);
+ }
+ this.directed = directed;
+ boxPackages = showPackages;
+ this.layoutLR = layoutLR;
+ this.do_not_show_dependecy_details = do_not_show_dependecy_details;
+ this.filter = filter;
+ ostream = new PrintWriter(new FileOutputStream(filename));
+ if (filter == null)
+ {
+ writeHeader(ostream, title);
+ }
+ else
+ {
+ filter.writeHeader(ostream, title);
+ }
+ component.setIgnoranceList(quietList);
+ }
+
+ public void accept(CodeMetaclass codemetaclass)
+ {
+ }
+
+ public void acceptMethod(CodeMetaclass item)
+ {
+ component.acceptMethod(item, ostream, directed, specification, do_not_show_dependecy_details);
+ }
+
+ public void acceptTypeMetaclass(CodeMetaclass item)
+ {
+ component.acceptTypeMetaclass(item, ostream, directed, specification, do_not_show_dependecy_details);
+ }
+
+ public void acceptVariable(CodeMetaclass item)
+ {
+ component.acceptVariable(item, ostream, directed, specification, do_not_show_dependecy_details);
+ }
+
+ public void close()
+ {
+ if (filter == null)
+ {
+ component.createErrorLinks(directed, ostream);
+ ostream.println("\n}");
+ }
+ else
+ {
+ filter.writeTrailer(ostream);
+ }
+ ostream.close();
+ }
+
+ public void endSubGraph(String label)
+ {
+ if (boxPackages)
+ {
+ ostream.println("label=\"" + label + "\";");
+ ostream.println("}");
+ }
+ }
+
+ public void export(String filename)
+ {
+ IArchitectureExporter exporter = null;
+ try
+ {
+ exporter = specification.newArchitectureExporter(filename);
+ if (exporter == null)
+ {
+ throw new RuntimeException("iDarwin: error no exporter implemented for this specification language.");
}
- catch (IOException e) {
- throw new RuntimeException("iDarwin: error attempt to close open stream " + filename + " failed (" + e + ").", e);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("iDarwin: error could not open " + filename + " to export specification (" + e
+ + ").", e);
+ }
+ try
+ {
+ exporter.open();
+ exporter.export(specification);
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("iDarwin: error during specification export to " + filename + " (" + e + ").", e);
+ }
+ finally
+ {
+ if (exporter != null)
+ {
+ try
+ {
+ exporter.close();
+ }
+ catch (IOException e)
+ {
+ throw new RuntimeException("iDarwin: error attempt to close open stream " + filename + " failed ("
+ + e + ").", e);
+ }
}
- }
- }
- }
+ }
+ }
- public boolean getError() {
- return component.getError();
- }
+ public boolean getError()
+ {
+ return component.getError();
+ }
- public int getNumberOfErrors() {
- return component.getNumberOfErrors();
- }
+ public int getNumberOfErrors()
+ {
+ return component.getNumberOfErrors();
+ }
- public int getNumberOfLinks() {
- return component.getNumberOfLinks();
- }
+ public int getNumberOfLinks()
+ {
+ return component.getNumberOfLinks();
+ }
- public void startSubGraph() {
- if (boxPackages) {
- ostream.println("subgraph cluster_" + cluster_index + " {");
- ostream.println("color=orange;");
- ostream.println("fontname=Helvetica;");
- ostream.println("fontsize=16;");
- cluster_index++;
- }
- }
+ public void startSubGraph()
+ {
+ if (boxPackages)
+ {
+ ostream.println("subgraph cluster_" + cluster_index + " {");
+ ostream.println("color=orange;");
+ ostream.println("fontname=Helvetica;");
+ ostream.println("fontsize=16;");
+ cluster_index++;
+ }
+ }
- public void writeHeader(PrintWriter ostream, String title) throws IOException {
- if (directed) {
- ostream.println("digraph \"" + title + "\" {");
- } else {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR) {
- ostream.println("rankdir=LR;");
- }
- }
+ public void writeHeader(PrintWriter ostream, String title) throws IOException
+ {
+ if (directed)
+ {
+ ostream.println("digraph \"" + title + "\" {");
+ }
+ else
+ {
+ ostream.println("graph \"" + title + "\" {");
+ }
+ ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
+ ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
+ if (layoutLR)
+ {
+ ostream.println("rankdir=LR;");
+ }
+ }
- public void writeHeader(String filename, String title) throws IOException {
- ostream = new PrintWriter(new FileOutputStream(filename));
- if (directed) {
- ostream.println("digraph \"" + title + "\" {");
- } else {
- ostream.println("graph \"" + title + "\" {");
- }
- ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
- ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
- if (layoutLR) {
- ostream.println("rankdir=LR;");
- }
- }
+ public void writeHeader(String filename, String title) throws IOException
+ {
+ ostream = new PrintWriter(new FileOutputStream(filename));
+ if (directed)
+ {
+ ostream.println("digraph \"" + title + "\" {");
+ }
+ else
+ {
+ ostream.println("graph \"" + title + "\" {");
+ }
+ ostream.println("fontsize=" + DottyVisitorConstants.fontSize() + ";");
+ ostream.println("fontname=\"" + DottyVisitorConstants.fontName() + "\"");
+ if (layoutLR)
+ {
+ ostream.println("rankdir=LR;");
+ }
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/DottyVisitorConstants.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -1,60 +1,80 @@
package net.sf.jcontracts.codeparser;
+public class DottyVisitorConstants
+{
-public class DottyVisitorConstants {
+ public static int FONT_SIZE = 12;
- public static int FONT_SIZE = 12;
- public static int EDGE_LENGTH = 4;
- public static String FONT_NAME = "Helvetica";
- public static final String DEFAULT_PACKAGE = "PACKAGE_DEFAULT";
+ public static int EDGE_LENGTH = 4;
- public static String edgeLengthCommand(boolean directed) {
- String result = null;
- if (directed) {
- result = "minlen=" + getEdgeLength() + ",";
- } else {
- result = "len=" + getEdgeLength() + ",";
- }
- return result;
- }
+ public static String FONT_NAME = "Helvetica";
- public static String extractPackage(String type) {
- String result = null;
- char tag = '.';
- if (type.indexOf('$') > type.indexOf('.')) {
- tag = '$';
- }
- if (type.indexOf(tag) == -1) {
- result = "PACKAGE_DEFAULT";
- } else {
- result = type.substring(0, type.lastIndexOf(tag));
- }
- return result;
- }
+ public static final String DEFAULT_PACKAGE = "PACKAGE_DEFAULT";
- public static String fontName() {
- return FONT_NAME;
- }
+ public static String edgeLengthCommand(boolean directed)
+ {
+ String result = null;
+ if (directed)
+ {
+ result = "minlen=" + getEdgeLength() + ",";
+ }
+ else
+ {
+ result = "len=" + getEdgeLength() + ",";
+ }
+ return result;
+ }
- public static int fontSize() {
- return FONT_SIZE;
- }
+ public static String extractPackage(String type)
+ {
+ String result = null;
+ char tag = '.';
+ if (type.indexOf('$') > type.indexOf('.'))
+ {
+ tag = '$';
+ }
+ if (type.indexOf(tag) == -1)
+ {
+ result = "PACKAGE_DEFAULT";
+ }
+ else
+ {
+ result = type.substring(0, type.lastIndexOf(tag));
+ }
+ return result;
+ }
- public static int getEdgeLength() {
- return EDGE_LENGTH;
- }
+ public static String fontName()
+ {
+ return FONT_NAME;
+ }
- public static String linkSymbol(boolean directed) {
- String result = null;
- if (directed) {
- result = " -> ";
- } else {
- result = " -- ";
- }
- return result;
- }
+ public static int fontSize()
+ {
+ return FONT_SIZE;
+ }
- public DottyVisitorConstants() {
- }
+ public static int getEdgeLength()
+ {
+ return EDGE_LENGTH;
+ }
+ public static String linkSymbol(boolean directed)
+ {
+ String result = null;
+ if (directed)
+ {
+ result = " -> ";
+ }
+ else
+ {
+ result = " -- ";
+ }
+ return result;
+ }
+
+ public DottyVisitorConstants()
+ {
+ }
+
}
Modified: trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2006-11-27 16:52:23 UTC (rev 31)
+++ trunk/source/java/net/sf/jcontracts/codeparser/Dotty_Component_CommonLevel.java 2006-11-27 16:54:31 UTC (rev 32)
@@ -8,350 +8,473 @@
import net.sf.jcontracts.icontract.QuietOption;
import net.sf.jcontracts.idarwin.specification.openapi.IArchitectureSpecification;
-public class Dotty_Component_CommonLevel {
+public class Dotty_Component_CommonLevel
+{
- protected Vector previouslyCheckedlinks;
- protected Vector previouslyDisplayedlinks;
- protected Hashtable errorBook;
- protected boolean hideAllButPublic;
- protected boolean performChecks;
- protected static final int BELONGS_TO = 0;
- public static final int INTERFACE_EXTENSION = 1;
- public static final int CLASS_EXTENSION = 2;
- public static final int INTERFACE_IMPLEMENTATION = 3;
- public static final int RETURN = 4;
- public static final int PARAMETER = 5;
- public static final int VARIABLE = 6;
- public static final int NEWED = 7;
- public static final int LOCALVAR = 8;
- protected IDependencyFilter filter;
- public static final int STATICREF = 9;
- public static final int CAST = 10;
- private String colorLUT[] = {
- "gray", "black", "black", "black", "blue", "blue", "yellow", "green", "pink", "cyan",
- "orange"
- };
- public String relationNameLUT[] = {
- "belongs-to", "extends", "extends", "implements", "return", "parameter", "variable", "new", "local-var", "static",
- "cast"
- };
- public static Vector ignore = new Vector();
- private boolean containsErrors;
- private int numberofErrors;
- private int errorID;
- private int numberNumberOfLink;
+ protected Vector previouslyCheckedlinks;
- public void addDependency(String source_item, String target_item, int relationType, PrintWriter ostream, boolean directed, String extra, IArchitectureSpecification specification,
- CodeMetaclass item, boolean do_not_show_dependecy_details) {
- if (filter == null) {
- localAddDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item, do_not_show_dependecy_details);
- } else {
- filter.addDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item, do_not_show_dependecy_details);
- }
- }
+ protected Vector previouslyDisplayedlinks;
- protected void addPackage(PrintWriter ostream, CodeMetaclass item) {
- if (filter == null) {
- localAddPackage(ostream, item);
- } else {
- filter.addPackage(ostream, item);
- }
- }
+ protected Hashtable errorBook;
- protected void addType(PrintWriter ostream, CodeMetaclass item) {
- if (filter == null) {
- localAddType(ostream, item);
- } else {
- filter.addType(ostream, item);
- }
- }
+ protected boolean hideAllButPublic;
- private final boolean atomicMatch(String item, String pattern) {
- boolean result = false;
- if (item.equals(pattern)) {
- result = true;
- } else
- if (pattern.equals("*")) {
- result = true;
- } else {
- int starPos = -1;
- if ((starPos = pattern.indexOf('*')) != -1) {
- if (pattern.endsWith("*") && pattern.startsWith("*")) {
- String subsection = pattern.substring(1, pattern.length() - 1);
- result = item.indexOf(subsection) != -1;
- } else
- if (pattern.endsWith("*")) {
- String b = pattern.substring(0, starPos);
- result = item.startsWith(b);
- } else
- if (pattern.startsWith("*")) {
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.endsWith(e);
- } else {
- pattern.substring(0, starPos);
- String e = pattern.substring(starPos + 1, pattern.length());
- result = item.startsWith(e) && item.endsWith(e);
+ protected boolean performChecks;
+
+ protected static final int BELONGS_TO = 0;
+
+ public static final int INTERFACE_EXTENSION = 1;
+
+ public static final int CLASS_EXTENSION = 2;
+
+ public static final int INTERFACE_IMPLEMENTATION = 3;
+
+ public static final int RETURN = 4;
+
+ public static final int PARAMETER = 5;
+
+ public static final int VARIABLE = 6;
+
+ public static final int NEWED = 7;
+
+ public static final int LOCALVAR = 8;
+
+ protected IDependencyFilter filter;
+
+ public static final int STATICREF = 9;
+
+ public static final int CAST = 10;
+
+ private String colorLUT[] =
+ {
+ "gray", "black", "black", "black", "blue", "blue", "yellow", "green", "pink", "cyan", "orange"
+ };
+
+ public String relationNameLUT[] =
+ {
+ "belongs-to", "extends", "extends", "implements", "return", "parameter", "variable", "new", "local-var",
+ "static", "cast"
+ };
+
+ public static Vector ignore = new Vector();
+
+ private boolean containsErrors;
+
+ private int numberofErrors;
+
+ private int errorID;
+
+ private int numberNumberOfLink;
+
+ public void addDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
+ boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
+ boolean do_not_show_dependecy_details)
+ {
+ if (filter == null)
+ {
+ localAddDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
+ do_not_show_dependecy_details);
+ }
+ else
+ {
+ filter.addDependency(source_item, target_item, relationType, ostream, directed, extra, specification, item,
+ do_not_show_dependecy_details);
+ }
+ }
+
+ protected void addPackage(PrintWriter ostream, CodeMetaclass item)
+ {
+ if (filter == null)
+ {
+ localAddPackage(ostream, item);
+ }
+ else
+ {
+ filter.addPackage(ostream, item);
+ }
+ }
+
+ protected void addType(PrintWriter ostream, CodeMetaclass item)
+ {
+ if (filter == null)
+ {
+ localAddType(ostream, item);
+ }
+ else
+ {
+ filter.addType(ostream, item);
+ }
+ }
+
+ private final boolean atomicMatch(String item, String pattern)
+ {
+ boolean result = false;
+ if (item.equals(pattern))
+ {
+ result = true;
+ }
+ else if (pattern.equals("*"))
+ {
+ result = true;
+ }
+ else
+ {
+ int starPos = -1;
+ if ((starPos = pattern.indexOf('*')) != -1)
+ {
+ if (pattern.endsWith("*") && pattern.startsWith("*"))
+ {
+ String subsection = pattern.substring(1, pattern.length() - 1);
+ result = item.indexOf(subsection) != -1;
+ }
+ else if (pattern.endsWith("*"))
+ {
+ String b = pattern.substring(0, starPos);
+ result = item.startsWith(b);
+ }
+ else if (pattern.startsWith("*"))
+ {
+ String e = pattern.substring(starPos + 1, pattern.length());
+ result = item.endsWith(e);
+ }
+ else
+ {
+ pattern.substring(0, starPos);
+ String e = pattern.substring(starPos + 1, pattern.length());
+ result = item.startsWith(e) && item.endsWith(e);
+ }
}
- }
- }
- QuietOption _tmp = QuietOption.theQuietOption;
- return result;
- }
+ }
+ QuietOption _tmp = QuietOption.theQuietOption;
+ return result;
+ }
- public void createErrorLinks(boolean directed, PrintWriter ostream) {
- String ms;
- String mt;
- int fontSize;
- String fontName;
- String edgeLengthCommand;
- String linkSymbol;
- String color;
- String extra;
- for (Enumeration e = errorBook.keys(); e.hasMoreElements(); ostream.println(ms + linkSymbol + mt + " [" + edgeLengthCommand + extra + "color=" + color + ",fontsize=" + fontSize + ",fontname=\"" + fontName + "\",style=bold,fontcolor=red];")) {
- String key = (String)e.nextElement();
- Object o[] = (Object[])errorBook.get(key);
- String label = (String)o[1];
- int num = 0;
- for (int pos = 0; (pos = label.indexOf("\\n", pos + 1)) != -1;) {
+ public void createErrorLinks(boolean directed, PrintWriter ostream)
+ {
+ String ms;
+ String mt;
+ int fontSize;
+ String fontName;
+ String edgeLengthCommand;
+ String linkSymbol;
+ String color;
+ String extra;
+ for (Enumeration e = errorBook.keys(); e.hasMoreElements(); ostream.println(ms + linkSymbol + mt + " ["
+ + edgeLengthCommand + extra + "color=" + color + ",fontsize=" + fontSize + ",fontname=\"" + fontName
+ + "\",style=bold,fontcolor=red];"))
+ {
+ String key = (String) e.nextElement();
+ Object o[] = (Object[]) errorBook.get(key);
+ String label = (String) o[1];
+ int num = 0;
+ for (int pos = 0; (pos = label.indexOf("\\n", pos + 1)) != -1;)
+ {
+ num++;
+ }
+
num++;
- }
+ String s = key.substring(0, key.indexOf("&"));
+ String t = key.substring(key.indexOf("&") + 1, key.lastIndexOf("&"));
+ ms = mangle(s);
+ mt = mangle(t);
+ fontSize = DottyVisitorConstants.fontSize();
+ fontName = DottyVisitorConstants.fontName();
+ edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
+ linkSymbol = DottyVisitorConstants.linkSymbol(directed);
+ color = "red";
+ extra = "label=\"" + num;
+ if (num > 1)
+ {
+ extra = extra + " errors:\\n";
+ }
+ else
+ {
+ extra = extra + " error:\\n";
+ }
+ extra = extra + label + "\"";
+ }
- num++;
- String s = key.substring(0, key.indexOf("&"));
- String t = key.substring(key.indexOf("&") + 1, key.lastIndexOf("&"));
- ms = mangle(s);
- mt = mangle(t);
- fontSize = DottyVisitorConstants.fontSize();
- fontName = DottyVisitorConstants.fontName();
- edgeLengthCommand = DottyVisitorConstants.edgeLengthCommand(directed);
- linkSymbol = DottyVisitorConstants.linkSymbol(directed);
- color = "red";
- extra = "label=\"" + num;
- if (num > 1) {
- extra = extra + " errors:\\n";
- } else {
- extra = extra + " error:\\n";
- }
- extra = extra + label + "\"";
- }
+ }
- }
+ public boolean getError()
+ {
+ return containsErrors;
+ }
- public boolean getError() {
- return containsErrors;
- }
+ protected String getErrorTextForDisplay(String source, String target, String type, String rule)
+ {
+ return "label=\"" + type + " VIOLATES\\n" + rule + "\",style=bold,fontcolor=red,";
+ }
- protected String getErrorTextForDisplay(String source, String target, String type, String rule) {
- return "label=\"" + type + " VIOLATES\\n" + rule + "\",style=bold,fontcolor=red,";
- }
+ public int getNumberOfErrors()
+ {
+ return numberofErrors;
+ }
- public int getNumberOfErrors() {
- return numberofErrors;
- }
+ public int getNumberOfLinks()
+ {
+ return numberNumberOfLink;
+ }
- public int getNumberOfLinks() {
- return numberNumberOfLink;
- }
+ protected String getVisibilityColorCode(CodeMetaclass item)
+ {
+ String color = "yellow";
+ if (item.isPublic())
+ {
+ color = "green";
+ }
+ if (item.isPrivate())
+ {
+ color = "gray";
+ }
+ if (item.isProtected())
+ {
+ color = "blue";
+ }
+ return color;
+ }
- protected String getVisibilityColorCode(CodeMetaclass item) {
- String color = "yellow";
- if (item.isPublic()) {
- color = "green";
- }
- if (item.isPrivate()) {
- color = "gray";
- }
- if (item.isProtected()) {
- color = "blue";
- }
- return color;
- }
-
- public void localAddDependency(String source_item, String target_item, int relationType, PrintWriter ostream, boolean directed, String extra, IArchitectureSpecification specification,
- CodeMetaclass item, boolean do_not_show_dependecy_details) {
- if (!shall_hide(source_item, target_item)) {
- numberNumberOfLink++;
- boolean checkPassed = true;
- String color = colorLUT[relationType];
- StringBuffer consoleErrorReportBuffer = new StringBuffer();
- StringBuffer displayErrorReportBuffer = new StringBuffer();
- String source = mangle(pruneToLevel(source_item));
- String target = mangle(pruneToLevel(target_item));
- if (performChecks) {
- String checkLinkID = source_item + "__" + target_item + "__" + relationType;
- if (!previouslyCheckedlinks.contains(checkLinkID)) {
- String errorBookKey = null;
- net.sf.jcontracts.idarwin.specification.openapi.IDependency dependency = specification.newDependency(source_item, target_item, relationNameLUT[relationType], item.getLocationDescription());
- StringBuffer errorReporBbuffer = new StringBuffer();
- if (!specification.check(dependency, consoleErrorReportBuffer, displayErrorReportBuffer)) {
- String errorText = errorReporBbuffer.toString();
- numberofErrors++;
- System.err.print("iDarwin: error " + errorID + " ");
- System.err.println(consoleErrorReportBuffer.toString());
- if (do_not_show_dependecy_details) {
- errorBookKey = source + "&" + target + "&";
- } else {
- errorBookKey = source + "&" + target + "&" + relationType;
- }
- if (!errorBook.containsKey(errorBookKey)) {
- Object arr[] = new Object[2];
- arr[0] = new Integer(0);
- arr[1] = "";
- errorBook.put(errorBookKey, ((Object) (arr)));
- }
- Object entry[] = (Object[])errorBook.get(errorBookKey);
- entry[0] = new Integer(((Integer)entry[0]).intValue() + 1);
- if (((String)entry[1]).length() > 0) {
- entry[1] = entry[1] + "\\n" + errorID + " (" + relationNameLUT[relationType] + ")";
- } else {
- entry[1] = "" + errorID + " (" + relationNameLUT[relationType] + ")";
- }
- errorID++;
- entry[1] = entry[1] + errorText;
- errorBook.put(errorBookKey, ((Object) (entry)));
- color = "red";
- String latestError = "error id: " + (String)entry[1] + "\\n(console)";
- extra = "label=\"" + latestError + "\",style=bold,fontcolor=red,";
- checkPassed = false;
- }
- previouslyCheckedlinks.addElement(checkLinkID);
+ public void localAddDependency(String source_item, String target_item, int relationType, PrintWriter ostream,
+ boolean directed, String extra, IArchitectureSpecification specification, CodeMetaclass item,
+ boolean do_not_show_dependecy_details)
+ {
+ if (!shall_hide(source_item, target_item))
+ {
+ numberNumberOfLink++;
+ boolean checkPassed = true;
+ String color = colorLUT[relationType];
+ StringBuffer consoleErrorReportBuffer = new StringBuffer();
+ StringBuffer displayErrorReportBuffer = new StringBuffer();
+ String source = mangle(pruneToLevel(source_item));
+ String target = mangle(pruneToLevel(target_item));
+ if (performChecks)
+ {
+ String checkLinkID = source_item + "__" + target_item + "__" + relationType;
+ if (!previouslyCheckedlinks.contains(checkLinkID))
+ {
+ String errorBookKey = null;
+ net.sf.jcontracts.idarwin.specification.openapi.IDependency dependency = specification
+ .newDependency(source_item, target_item, relationNameLUT[relationType], item
+ .getLocationDescription());
+ StringBuffer errorReporBbuffer = new StringBuffer();
+ if (!specification.check(dependency, consoleErrorReportBuffer, displayErrorReportBuffer))
+ {
+ String errorText = errorReporBbuffer.toString();
+ numberofErrors++;
+ System.err.print("iDarwin: error " + errorID + " ");
+ System.err.println(consoleErrorReportBuffer.toString());
+ if (do_not_show_dependecy_details)
+ {
+ errorBookKey = source + "&" + target + "&";
+ }
+ else
+ {
+ errorBookKey = source + "&" + target + "&" + relationType;
+ }
+ if (!errorBook.containsKey(errorBookKey))
+ {
+ Object arr[] = new Object[2];
+ arr[0] = new Integer(0);
+ arr[1] = "";
+ errorBook.put(errorBookKey, ((Object) (arr)));
+ }
+ Object entry[] = (Object[]) errorBook.get(errorBookKey);
+ entry[0] = new Integer(((Integer) entry[0]).intValue() + 1);
+ if (((String) entry[1]).length() > 0)
+ {
+ entry[1] = entry[1] + "\\n" + errorID + " (" + relationNameLUT[relationType] + ")";
+ }
+ else
+ {
+ entry[1] = "" + errorID + " (" + relationNameLUT[relationType] + ")";
+ }
+ errorID++;
+ entry[1] = entry[1] + errorText;
+ ...
[truncated message content] |
|
From: <js...@us...> - 2006-11-27 16:52:33
|
Revision: 31
http://svn.sourceforge.net/jcontracts/?rev=31&view=rev
Author: jstuyts
Date: 2006-11-27 08:52:23 -0800 (Mon, 27 Nov 2006)
Log Message:
-----------
Formatted code.
Modified Paths:
--------------
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java
trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
Modified: trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java 2006-11-27 16:51:37 UTC (rev 30)
+++ trunk/source/java/net/sf/jcontracts/dependencyanalyzer/BooleanBlockWithNodeArg.java 2006-11-27 16:52:23 UTC (rev 31)
@@ -1,7 +1,7 @@
package net.sf.jcontracts.dependencyanalyzer;
+public interface BooleanBlockWithNodeArg
+{
-public interface BooleanBlockWithNodeArg {
-
- public abstract boolean eval(Node node);
+ public abstract boolean eval(Node node);
}
Modified: trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java 2006-11-27 16:51:37 UTC (rev 30)
+++ trunk/source/java/net/sf/jcontracts/dependencyanalyzer/DependencyAnalyzer.java 2006-11-27 16:52:23 UTC (rev 31)
@@ -3,24 +3,30 @@
import java.util.Enumeration;
import java.util.Vector;
-public class DependencyAnalyzer {
+public class DependencyAnalyzer
+{
- private Graph dg_;
+ private Graph dg_;
- public DependencyAnalyzer() {
- dg_ = null;
- dg_ = new Graph();
- }
+ public DependencyAnalyzer()
+ {
+ dg_ = null;
+ dg_ = new Graph();
+ }
- public Graph getGraph() {
- return dg_;
- }
+ public Graph getGraph()
+ {
+ return dg_;
+ }
- public void process(Vector dependencies) {
- Node keyNode;
- for (Enumeration dependenciesenum = dependencies.elements(); dependenciesenum.hasMoreElements(); dg_.add(keyNode)) {
- keyNode = (Node)dependenciesenum.nextElement();
- }
+ public void process(Vector dependencies)
+ {
+ Node keyNode;
+ for (Enumeration dependenciesenum = dependencies.elements(); dependenciesenum.hasMoreElements(); dg_
+ .add(keyNode))
+ {
+ keyNode = (Node) dependenciesenum.nextElement();
+ }
- }
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java 2006-11-27 16:51:37 UTC (rev 30)
+++ trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Graph.java 2006-11-27 16:52:23 UTC (rev 31)
@@ -4,359 +4,447 @@
import java.util.Hashtable;
import java.util.Vector;
-public class Graph {
+public class Graph
+{
- protected Vector nodes_;
- protected int maxRank_;
+ protected Vector nodes_;
- public Graph() {
- this(new Vector());
- }
+ protected int maxRank_;
- public Graph(Vector nodes) {
- nodes_ = new Vector();
- maxRank_ = 0;
- nodes_ = nodes;
- }
+ public Graph()
+ {
+ this(new Vector());
+ }
- public void add(Node node) {
- if (!containsNodeNamed(node.getName())) {
- Node newnode = new Node(node.getName(), node.getPackagename(), node.getFilename(), new Vector());
- nodes_.addElement(newnode);
- }
- Node n = getNodeNamed(node.getName());
- if (n.getFilename().equals("???")) {
- n.setFilename(node.getFilename());
- }
- Node d;
- Node parent;
- for (Enumeration e = node.getUsedNodes().elements(); e.hasMoreElements(); parent.addUsedNode(getNodeNamed(d.getName()))) {
- d = (Node)e.nextElement();
- if (!containsNodeNamed(d.getName())) {
- Node newd = new Node(d.getName(), d.getPackagename(), d.getFilename(), new Vector());
- nodes_.addElement(newd);
- }
- parent = getNodeNamed(node.getName());
- }
+ public Graph(Vector nodes)
+ {
+ nodes_ = new Vector();
+ maxRank_ = 0;
+ nodes_ = nodes;
+ }
- }
+ public void add(Node node)
+ {
+ if (!containsNodeNamed(node.getName()))
+ {
+ Node newnode = new Node(node.getName(), node.getPackagename(), node.getFilename(), new Vector());
+ nodes_.addElement(newnode);
+ }
+ Node n = getNodeNamed(node.getName());
+ if (n.getFilename().equals("???"))
+ {
+ n.setFilename(node.getFilename());
+ }
+ Node d;
+ Node parent;
+ for (Enumeration e = node.getUsedNodes().elements(); e.hasMoreElements(); parent.addUsedNode(getNodeNamed(d
+ .getName())))
+ {
+ d = (Node) e.nextElement();
+ if (!containsNodeNamed(d.getName()))
+ {
+ Node newd = new Node(d.getName(), d.getPackagename(), d.getFilename(), new Vector());
+ nodes_.addElement(newd);
+ }
+ parent = getNodeNamed(node.getName());
+ }
- public boolean containsNodeNamed(String name) {
- boolean result = false;
- for (Enumeration e = nodes_.elements(); !result && e.hasMoreElements();) {
- if (((Node)e.nextElement()).getName().equals(name)) {
- result = true;
- }
- }
+ }
- return result;
- }
+ public boolean containsNodeNamed(String name)
+ {
+ boolean result = false;
+ for (Enumeration e = nodes_.elements(); !result && e.hasMoreElements();)
+ {
+ if (((Node) e.nextElement()).getName().equals(name))
+ {
+ result = true;
+ }
+ }
- public Vector getFileDependencyOrdering() {
- rank();
- int level = 1;
- Vector sortedList = new Vector();
- Vector sortedNodeList = new Vector();
- Hashtable dependencies = new Hashtable();
- for (; level <= maxRank_; level++) {
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.getRank() == level) {
- if (!dependencies.containsKey(new Integer(level))) {
- dependencies.put(new Integer(level), new Vector());
- }
- ((Vector)dependencies.get(new Integer(level))).addElement(n.getFilename());
- sortedList.insertElementAt(n.getFilename(), 0);
- sortedNodeList.insertElementAt(n, 0);
+ return result;
+ }
+
+ public Vector getFileDependencyOrdering()
+ {
+ rank();
+ int level = 1;
+ Vector sortedList = new Vector();
+ Vector sortedNodeList = new Vector();
+ Hashtable dependencies = new Hashtable();
+ for (; level <= maxRank_; level++)
+ {
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.getRank() == level)
+ {
+ if (!dependencies.containsKey(new Integer(level)))
+ {
+ dependencies.put(new Integer(level), new Vector());
+ }
+ ((Vector) dependencies.get(new Integer(level))).addElement(n.getFilename());
+ sortedList.insertElementAt(n.getFilename(), 0);
+ sortedNodeList.insertElementAt(n, 0);
+ }
}
- }
- }
+ }
- Vector result = new Vector();
- for (Enumeration e = sortedList.elements(); e.hasMoreElements();) {
- String s = (String)e.nextElement();
- if (!result.contains(s)) {
- result.addElement(s);
- }
- }
+ Vector result = new Vector();
+ for (Enumeration e = sortedList.elements(); e.hasMoreElements();)
+ {
+ String s = (String) e.nextElement();
+ if (!result.contains(s))
+ {
+ result.addElement(s);
+ }
+ }
- return result;
- }
+ return result;
+ }
- public Hashtable getFileDependencyTable(BooleanBlockWithNodeArg block) {
- Node node;
- for (Enumeration e = getLeafs().elements(); e.hasMoreElements(); node.mark(block)) {
- node = (Node)e.nextElement();
- }
+ public Hashtable getFileDependencyTable(BooleanBlockWithNodeArg block)
+ {
+ Node node;
+ for (Enumeration e = getLeafs().elements(); e.hasMoreElements(); node.mark(block))
+ {
+ node = (Node) e.nextElement();
+ }
- rank();
- int level = maxRank_;
- Hashtable dependencies = new Hashtable();
- for (; level > 0; level--) {
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.getRank() == level) {
- if (!dependencies.containsKey(new Integer(level))) {
- dependencies.put(new Integer(level), new Vector());
- }
- Vector line = (Vector)dependencies.get(new Integer(level));
- if (!n.getFilename().equals("???") && !line.contains(n.getFilename()) && n.isMarked()) {
- line.addElement(n.getFilename());
- }
+ rank();
+ int level = maxRank_;
+ Hashtable dependencies = new Hashtable();
+ for (; level > 0; level--)
+ {
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.getRank() == level)
+ {
+ if (!dependencies.containsKey(new Integer(level)))
+ {
+ dependencies.put(new Integer(level), new Vector());
+ }
+ Vector line = (Vector) dependencies.get(new Integer(level));
+ if (!n.getFilename().equals("???") && !line.contains(n.getFilename()) && n.isMarked())
+ {
+ line.addElement(n.getFilename());
+ }
+ }
}
- }
- }
+ }
- return dependencies;
- }
+ return dependencies;
+ }
- Vector getLeafs() {
- Vector results = new Vector();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.isLeaf()) {
- results.addElement(n);
- }
- }
+ Vector getLeafs()
+ {
+ Vector results = new Vector();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.isLeaf())
+ {
+ results.addElement(n);
+ }
+ }
- return results;
- }
+ return results;
+ }
- public int getMaxRank() {
- return maxRank_;
- }
+ public int getMaxRank()
+ {
+ return maxRank_;
+ }
- public Node getNodeNamed(String name) {
- Node result = null;
- for (Enumeration e = nodes_.elements(); result == null && e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.getName().equals(name)) {
- result = n;
- }
- }
+ public Node getNodeNamed(String name)
+ {
+ Node result = null;
+ for (Enumeration e = nodes_.elements(); result == null && e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.getName().equals(name))
+ {
+ result = n;
+ }
+ }
- return result;
- }
+ return result;
+ }
- public String getPackageForNodeWithFilename(String filename) {
- Node result = null;
- for (Enumeration e = nodes_.elements(); result == null && e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.getFilename().equals(filename)) {
- result = n;
- }
- }
+ public String getPackageForNodeWithFilename(String filename)
+ {
+ Node result = null;
+ for (Enumeration e = nodes_.elements(); result == null && e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.getFilename().equals(filename))
+ {
+ result = n;
+ }
+ }
- return result.getPackagename();
- }
+ return result.getPackagename();
+ }
- Vector getRoots() {
- Vector results = new Vector();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n.isRoot(nodes_)) {
- results.addElement(n);
- }
- }
+ Vector getRoots()
+ {
+ Vector results = new Vector();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n.isRoot(nodes_))
+ {
+ results.addElement(n);
+ }
+ }
- return results;
- }
+ return results;
+ }
- public int getSize() {
- return nodes_.size();
- }
+ public int getSize()
+ {
+ return nodes_.size();
+ }
- void rank() {
- boolean debug = false;
- Vector nodesLeft = new Vector();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (!n.getFilename().equals("???")) {
- nodesLeft.addElement(n.getName());
- }
- }
+ void rank()
+ {
+ boolean debug = false;
+ Vector nodesLeft = new Vector();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (!n.getFilename().equals("???"))
+ {
+ nodesLeft.addElement(n.getName());
+ }
+ }
- Vector newfirefront = getRoots();
- Vector previousNodesLeft = new Vector();
- boolean circRef = false;
- boolean stop = false;
- int stops = 1;
- int level = 1;
- while (!nodesLeft.isEmpty() && !circRef && !stop) {
- if (debug) {
- System.err.println("*** nodesLeft=" + nodesLeft);
- System.err.println("*** level=" + level);
- }
- Vector firefront = newfirefront;
- Vector tff = new Vector();
- Vector depclosure = new Vector();
- for (Enumeration e = firefront.elements(); e.hasMoreElements();) {
- Node node = (Node)e.nextElement();
- for (Enumeration depenum = node.getUsedNodes().elements(); depenum.hasMoreElements();) {
- Node depnode = (Node)depenum.nextElement();
- if (!depclosure.contains(depnode)) {
- depclosure.addElement(depnode);
- }
+ Vector newfirefront = getRoots();
+ Vector previousNodesLeft = new Vector();
+ boolean circRef = false;
+ boolean stop = false;
+ int stops = 1;
+ int level = 1;
+ while (!nodesLeft.isEmpty() && !circRef && !stop)
+ {
+ if (debug)
+ {
+ System.err.println("*** nodesLeft=" + nodesLeft);
+ System.err.println("*** level=" + level);
}
+ Vector firefront = newfirefront;
+ Vector tff = new Vector();
+ Vector depclosure = new Vector();
+ for (Enumeration e = firefront.elements(); e.hasMoreElements();)
+ {
+ Node node = (Node) e.nextElement();
+ for (Enumeration depenum = node.getUsedNodes().elements(); depenum.hasMoreElements();)
+ {
+ Node depnode = (Node) depenum.nextElement();
+ if (!depclosure.contains(depnode))
+ {
+ depclosure.addElement(depnode);
+ }
+ }
- }
+ }
- for (Enumeration e = firefront.elements(); e.hasMoreElements();) {
- Node node = (Node)e.nextElement();
- if (!depclosure.contains(node)) {
- tff.addElement(node);
+ for (Enumeration e = firefront.elements(); e.hasMoreElements();)
+ {
+ Node node = (Node) e.nextElement();
+ if (!depclosure.contains(node))
+ {
+ tff.addElement(node);
+ }
}
- }
- if (debug) {
- System.err.println("*** tff=" + tff);
- }
- firefront = tff;
- newfirefront = new Vector();
- for (Enumeration e = firefront.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- n.setRank(level);
- nodesLeft.removeElement(n.getName());
- for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements(); newfirefront.addElement(enum2.nextElement())) { }
- }
+ if (debug)
+ {
+ System.err.println("*** tff=" + tff);
+ }
+ firefront = tff;
+ newfirefront = new Vector();
+ for (Enumeration e = firefront.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ n.setRank(level);
+ nodesLeft.removeElement(n.getName());
+ for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements(); newfirefront
+ .addElement(enum2.nextElement()))
+ {
+ }
+ }
- level++;
- if (debug) {
- System.err.println("*** rank = " + level);
- }
- boolean all = true;
- for (Enumeration e = newfirefront.elements(); all && e.hasMoreElements();) {
- if (!firefront.contains(e.nextElement())) {
- all = false;
+ level++;
+ if (debug)
+ {
+ System.err.println("*** rank = " + level);
}
- }
+ boolean all = true;
+ for (Enumeration e = newfirefront.elements(); all && e.hasMoreElements();)
+ {
+ if (!firefront.contains(e.nextElement()))
+ {
+ all = false;
+ }
+ }
- circRef = all;
- if (circRef && nodesLeft.size() > 0) {
- System.err.println("Warning: circular reference among =" + nodesLeft + ".");
- for (Enumeration e = nodesLeft.elements(); e.hasMoreElements(); System.err.println(" - " + getNodeNamed((String)e.nextElement()))) { }
- }
- if (previousNodesLeft.equals(nodesLeft) && ++stops > 10) {
- StringBuffer sb = new StringBuffer();
- sb.append("algorthm problem: circular reference suspected among =" + nodesLeft + ".level=" + level);
- for (Enumeration e = nodesLeft.elements(); e.hasMoreElements(); sb.append(" - " + getNodeNamed((String)e.nextElement()))) { }
- throw new RuntimeException(sb.toString());
- }
- previousNodesLeft = nodesLeft;
- }
- maxRank_ = level - 1;
- if (debug) {
- System.err.println("*** maxRank=" + maxRank_);
- }
- }
+ circRef = all;
+ if (circRef && nodesLeft.size() > 0)
+ {
+ System.err.println("Warning: circular reference among =" + nodesLeft + ".");
+ for (Enumeration e = nodesLeft.elements(); e.hasMoreElements(); System.err.println(" - "
+ + getNodeNamed((String) e.nextElement())))
+ {
+ }
+ }
+ if (previousNodesLeft.equals(nodesLeft) && ++stops > 10)
+ {
+ StringBuffer sb = new StringBuffer();
+ sb.append("algorthm problem: circular reference suspected among =" + nodesLeft + ".level=" + level);
+ for (Enumeration e = nodesLeft.elements(); e.hasMoreElements(); sb.append(" - "
+ + getNodeNamed((String) e.nextElement())))
+ {
+ }
+ throw new RuntimeException(sb.toString());
+ }
+ previousNodesLeft = nodesLeft;
+ }
+ maxRank_ = level - 1;
+ if (debug)
+ {
+ System.err.println("*** maxRank=" + maxRank_);
+ }
+ }
- public String toDottyClasses() {
- StringBuffer buf = new StringBuffer();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- buf.append("// node " + n.getName() + " \n");
- for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements();) {
- if (!n.getFilename().equals("???")) {
- Node m = (Node)enum2.nextElement();
- if (!m.getFilename().equals("???")) {
- String name = n.getName();
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- buf.append(name);
- buf.append(" -> ");
- name = m.getName();
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- buf.append(name);
- buf.append(";\n");
- }
+ public String toDottyClasses()
+ {
+ StringBuffer buf = new StringBuffer();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ buf.append("// node " + n.getName() + " \n");
+ for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements();)
+ {
+ if (!n.getFilename().equals("???"))
+ {
+ Node m = (Node) enum2.nextElement();
+ if (!m.getFilename().equals("???"))
+ {
+ String name = n.getName();
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ buf.append(name);
+ buf.append(" -> ");
+ name = m.getName();
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ buf.append(name);
+ buf.append(";\n");
+ }
+ }
}
- }
- }
+ }
- buf.append("// LABELS\n");
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (!n.getFilename().equals("???")) {
- String name = n.getName();
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- buf.append(name);
- buf.append(" [label=\"" + n.getName() + " (" + n.getRank() + ")\"];\n");
- }
- }
+ buf.append("// LABELS\n");
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (!n.getFilename().equals("???"))
+ {
+ String name = n.getName();
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ buf.append(name);
+ buf.append(" [label=\"" + n.getName() + " (" + n.getRank() + ")\"];\n");
+ }
+ }
- return buf.toString();
- }
+ return buf.toString();
+ }
- public String toDottyPackage() {
- Vector depList = new Vector();
- StringBuffer outbuf = new StringBuffer();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- outbuf.append("// node (class) " + n.getName() + " \n");
- for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements();) {
- if (!n.getFilename().equals("???")) {
- Node m = (Node)enum2.nextElement();
- if (!m.getFilename().equals("???")) {
- StringBuffer buf = new StringBuffer();
- String name = n.getName();
- int start = -1;
- if ((start = name.lastIndexOf('.')) != -1) {
- name = name.substring(0, start);
- }
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- buf.append(name);
- buf.append(" -> ");
- name = m.getName();
- start = -1;
- if ((start = name.lastIndexOf('.')) != -1) {
- name = name.substring(0, start);
- }
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- buf.append(name);
- buf.append(";\n");
- if (!depList.contains(buf.toString())) {
- outbuf.append(buf.toString());
- depList.addElement(buf.toString());
- }
- }
+ public String toDottyPackage()
+ {
+ Vector depList = new Vector();
+ StringBuffer outbuf = new StringBuffer();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ outbuf.append("// node (class) " + n.getName() + " \n");
+ for (Enumeration enum2 = n.getUsedNodes().elements(); enum2.hasMoreElements();)
+ {
+ if (!n.getFilename().equals("???"))
+ {
+ Node m = (Node) enum2.nextElement();
+ if (!m.getFilename().equals("???"))
+ {
+ StringBuffer buf = new StringBuffer();
+ String name = n.getName();
+ int start = -1;
+ if ((start = name.lastIndexOf('.')) != -1)
+ {
+ name = name.substring(0, start);
+ }
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ buf.append(name);
+ buf.append(" -> ");
+ name = m.getName();
+ start = -1;
+ if ((start = name.lastIndexOf('.')) != -1)
+ {
+ name = name.substring(0, start);
+ }
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ buf.append(name);
+ buf.append(";\n");
+ if (!depList.contains(buf.toString()))
+ {
+ outbuf.append(buf.toString());
+ depList.addElement(buf.toString());
+ }
+ }
+ }
}
- }
- }
+ }
- outbuf.append("// LABELS\n");
- Vector packageList = new Vector();
- for (Enumeration e = nodes_.elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (!n.getFilename().equals("???")) {
- String name = n.getName();
- String displayName = name;
- if (!packageList.contains(name)) {
- packageList.addElement(name);
- int start = -1;
- if ((start = name.lastIndexOf('.')) != -1) {
- name = name.substring(0, start);
- displayName = name;
- }
- name = name.replace('.', '_');
- name = name.replace('$', '_');
- outbuf.append(name);
- outbuf.append(" [label=\"" + displayName + "\"];\n");
+ outbuf.append("// LABELS\n");
+ Vector packageList = new Vector();
+ for (Enumeration e = nodes_.elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (!n.getFilename().equals("???"))
+ {
+ String name = n.getName();
+ String displayName = name;
+ if (!packageList.contains(name))
+ {
+ packageList.addElement(name);
+ int start = -1;
+ if ((start = name.lastIndexOf('.')) != -1)
+ {
+ name = name.substring(0, start);
+ displayName = name;
+ }
+ name = name.replace('.', '_');
+ name = name.replace('$', '_');
+ outbuf.append(name);
+ outbuf.append(" [label=\"" + displayName + "\"];\n");
+ }
}
- }
- }
+ }
- return outbuf.toString();
- }
+ return outbuf.toString();
+ }
- public String toString() {
- return nodes_.toString();
- }
+ public String toString()
+ {
+ return nodes_.toString();
+ }
}
Modified: trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java
===================================================================
--- trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java 2006-11-27 16:51:37 UTC (rev 30)
+++ trunk/source/java/net/sf/jcontracts/dependencyanalyzer/Node.java 2006-11-27 16:52:23 UTC (rev 31)
@@ -3,176 +3,226 @@
import java.util.Enumeration;
import java.util.Vector;
-public class Node {
+public class Node
+{
- protected String name_;
- protected String packagename_;
- protected String filename_;
- protected Vector usedNodes_;
- protected Vector dependentNodes_;
- protected int rank_;
- protected boolean marked_;
- protected boolean visited4marked_;
+ protected String name_;
- public Node(String name, String packagename, String filename, Vector usedNodes) {
- name_ = null;
- packagename_ = null;
- filename_ = null;
- usedNodes_ = new Vector();
- dependentNodes_ = new Vector();
- rank_ = 0;
- marked_ = false;
- visited4marked_ = false;
- name_ = name;
- packagename_ = packagename;
- filename_ = filename;
- usedNodes_ = usedNodes;
- }
+ protected String packagename_;
- void addAllUsedNodes(Vector moreUsedNodes) {
- Node node;
- for (Enumeration e = moreUsedNodes.elements(); e.hasMoreElements(); node.addDependentNode(this)) {
- node = (Node)e.nextElement();
- usedNodes_.addElement(node);
- }
+ protected String filename_;
- }
+ protected Vector usedNodes_;
- public void addDependentNode(Node dependentNode) {
- dependentNodes_.addElement(dependentNode);
- }
+ protected Vector dependentNodes_;
- public void addUsedNode(Node usedNode) {
- boolean notFound = true;
- if (!usedNode.getName().equals(getName())) {
- Node node;
- for (Enumeration e = usedNodes_.elements(); e.hasMoreElements() && notFound; notFound = !node.getName().equals(usedNode.getName())) {
- node = (Node)e.nextElement();
- }
+ protected int rank_;
- if (notFound) {
- usedNodes_.addElement(usedNode);
- usedNode.addDependentNode(this);
- }
- }
- }
+ protected boolean marked_;
- Vector getDependentNodes() {
- return dependentNodes_;
- }
+ protected boolean visited4marked_;
- public String getFilename() {
- return filename_;
- }
+ public Node(String name, String packagename, String filename, Vector usedNodes)
+ {
+ name_ = null;
+ packagename_ = null;
+ filename_ = null;
+ usedNodes_ = new Vector();
+ dependentNodes_ = new Vector();
+ rank_ = 0;
+ marked_ = false;
+ visited4marked_ = false;
+ name_ = name;
+ packagename_ = packagename;
+ filename_ = filename;
+ usedNodes_ = usedNodes;
+ }
- public String getName() {
- return name_;
- }
+ void addAllUsedNodes(Vector moreUsedNodes)
+ {
+ Node node;
+ for (Enumeration e = moreUsedNodes.elements(); e.hasMoreElements(); node.addDependentNode(this))
+ {
+ node = (Node) e.nextElement();
+ usedNodes_.addElement(node);
+ }
- public String getPackagename() {
- return packagename_;
- }
+ }
- int getRank() {
- return rank_;
- }
+ public void addDependentNode(Node dependentNode)
+ {
+ dependentNodes_.addElement(dependentNode);
+ }
- Vector getUsedNodes() {
- return usedNodes_;
- }
+ public void addUsedNode(Node usedNode)
+ {
+ boolean notFound = true;
+ if (!usedNode.getName().equals(getName()))
+ {
+ Node node;
+ for (Enumeration e = usedNodes_.elements(); e.hasMoreElements() && notFound; notFound = !node.getName()
+ .equals(usedNode.getName()))
+ {
+ node = (Node) e.nextElement();
+ }
- boolean isLeaf() {
- return usedNodes_.isEmpty();
- }
+ if (notFound)
+ {
+ usedNodes_.addElement(usedNode);
+ usedNode.addDependentNode(this);
+ }
+ }
+ }
- public boolean isMarked() {
- return marked_;
- }
+ Vector getDependentNodes()
+ {
+ return dependentNodes_;
+ }
- boolean isRoot(Vector nodes_) {
- boolean found = false;
- for (Enumeration e = nodes_.elements(); !found && e.hasMoreElements();) {
- Node probe = (Node)e.nextElement();
- for (Enumeration enum2 = probe.getUsedNodes().elements(); !found && enum2.hasMoreElements();) {
- Node n = (Node)enum2.nextElement();
- if (getName().equals(n.getName())) {
- found = true;
+ public String getFilename()
+ {
+ return filename_;
+ }
+
+ public String getName()
+ {
+ return name_;
+ }
+
+ public String getPackagename()
+ {
+ return packagename_;
+ }
+
+ int getRank()
+ {
+ return rank_;
+ }
+
+ Vector getUsedNodes()
+ {
+ return usedNodes_;
+ }
+
+ boolean isLeaf()
+ {
+ return usedNodes_.isEmpty();
+ }
+
+ public boolean isMarked()
+ {
+ return marked_;
+ }
+
+ boolean isRoot(Vector nodes_)
+ {
+ boolean found = false;
+ for (Enumeration e = nodes_.elements(); !found && e.hasMoreElements();)
+ {
+ Node probe = (Node) e.nextElement();
+ for (Enumeration enum2 = probe.getUsedNodes().elements(); !found && enum2.hasMoreElements();)
+ {
+ Node n = (Node) enum2.nextElement();
+ if (getName().equals(n.getName()))
+ {
+ found = true;
+ }
}
- }
- }
+ }
- return !found;
- }
+ return !found;
+ }
- private boolean isVisited() {
- return visited4marked_;
- }
+ private boolean isVisited()
+ {
+ return visited4marked_;
+ }
- public void mark(BooleanBlockWithNodeArg block) {
- if (!visited4marked_ && !marked_) {
- markVisited();
- if (block.eval(this)) {
- marked_ = true;
- for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n != this) {
- n.markUnconditional(block);
- }
+ public void mark(BooleanBlockWithNodeArg block)
+ {
+ if (!visited4marked_ && !marked_)
+ {
+ markVisited();
+ if (block.eval(this))
+ {
+ marked_ = true;
+ for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n != this)
+ {
+ n.markUnconditional(block);
+ }
+ }
+
}
+ else
+ {
+ for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n != this && !n.isMarked())
+ {
+ n.mark(block);
+ }
+ }
- } else {
- for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n != this && !n.isMarked()) {
- n.mark(block);
- }
}
+ }
+ }
- }
- }
- }
-
- public void markUnconditional(BooleanBlockWithNodeArg block) {
- if (!marked_) {
- marked_ = true;
- for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();) {
- Node n = (Node)e.nextElement();
- if (n != this) {
- n.markUnconditional(block);
+ public void markUnconditional(BooleanBlockWithNodeArg block)
+ {
+ if (!marked_)
+ {
+ marked_ = true;
+ for (Enumeration e = getDependentNodes().elements(); e.hasMoreElements();)
+ {
+ Node n = (Node) e.nextElement();
+ if (n != this)
+ {
+ n.markUnconditional(block);
+ }
}
- }
- }
- }
+ }
+ }
- private void markVisited() {
- visited4marked_ = true;
- }
+ private void markVisited()
+ {
+ visited4marked_ = true;
+ }
- void setFilename(String filename) {
- filename_ = filename;
- }
+ void setFilename(String filename)
+ {
+ filename_ = filename;
+ }
- void setPackagename(String packagename) {
- packagename_ = packagename;
- }
+ void setPackagename(String packagename)
+ {
+ packagename_ = packagename;
+ }
- void setRank(int rank) {
- rank_ = rank;
- }
+ void setRank(int rank)
+ {
+ rank_ = rank;
+ }
- public String toString() {
- String str = "(NAME:" + name_ + " rank: " + rank_ + " packagename:" + packagename_ + ") -IT USES> (";
- for (Enumeration e = usedNodes_.elements(); e.hasMoreElements();) {
- str = str + ((Node)e.nextElement()).getName() + " ";
- }
+ public String toString()
+ {
+ String str = "(NAME:" + name_ + " rank: " + rank_ + " packagename:" + packagename_ + ") -IT USES> (";
+ for (Enumeration e = usedNodes_.elements(); e.hasMoreElements();)
+ {
+ str = str + ((Node) e.nextElement()).getName() + " ";
+ }
- str = str + ") -WHO DEPENDS ON IT> (";
- for (Enumeration e = dependentNodes_.elements(); e.hasMoreElements();) {
- str = str + ((Node)e.nextElement()).getName() + " ";
- }
+ str = str + ") -WHO DEPENDS ON IT> (";
+ for (Enumeration e = dependentNodes_.elements(); e.hasMoreElements();)
+ {
+ str = str + ((Node) e.nextElement()).getName() + " ";
+ }
- return str + ")";
- }
+ return str + ")";
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|