Beginnen mit Typinferenzalgorithmus
This commit is contained in:
parent
0b17894ed2
commit
a44baeaa34
@ -55,7 +55,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/CSubstitutionSet.html" title="class in de.dhbwstuttgart.typeinference.unify" target="classFrame">CSubstitutionSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/myexception/CTypeReconstructionException.html" title="class in de.dhbwstuttgart.myexception" target="classFrame">CTypeReconstructionException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/CVectorSet.html" title="class in de.dhbwstuttgart.typeinference.unify" target="classFrame">CVectorSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">DebugException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">DebugException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/misc/DeclId.html" title="class in de.dhbwstuttgart.syntaxtree.misc" target="classFrame">DeclId</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/DivideOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator" target="classFrame">DivideOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.html" title="class in de.dhbwstuttgart.syntaxtree.statement" target="classFrame">DoubleLiteral</a></li>
|
||||
@ -203,7 +203,7 @@
|
||||
<li><a href="syntaxTree/NodeEqualTest.html" title="class in syntaxTree" target="classFrame">NodeEqualTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator" target="classFrame">NotEqualOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/NotExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement" target="classFrame">NotExpr</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">NotImplementedException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">NotImplementedException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/Null.html" title="class in de.dhbwstuttgart.syntaxtree.statement" target="classFrame">Null</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/type/ObjectType.html" title="class in de.dhbwstuttgart.syntaxtree.type" target="classFrame">ObjectType</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/OderConstraint.html" title="class in de.dhbwstuttgart.typeinference" target="classFrame">OderConstraint</a></li>
|
||||
@ -228,7 +228,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/ParameterAssumption.html" title="class in de.dhbwstuttgart.typeinference.assumptions" target="classFrame">ParameterAssumption</a></li>
|
||||
<li><a href="plugindevelopment/ParameterInsertTest.html" title="class in plugindevelopment" target="classFrame">ParameterInsertTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/ParameterList.html" title="class in de.dhbwstuttgart.syntaxtree" target="classFrame">ParameterList</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">ParserError</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">ParserError</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/PlusOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator" target="classFrame">PlusOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/PositivExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement" target="classFrame">PositivExpr</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement" target="classFrame">PostDecExpr</a></li>
|
||||
@ -282,7 +282,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.html" title="class in de.dhbwstuttgart.typeinference.assumptions" target="classFrame">TypeAssumptions</a></li>
|
||||
<li><a href="plugindevelopment/TypeInsertTests/LargeSourceCodeTests/TypedMatrixSimpleTest.html" title="class in plugindevelopment.TypeInsertTests.LargeSourceCodeTests" target="classFrame">TypedMatrixSimpleTest</a></li>
|
||||
<li><a href="plugindevelopment/TypeInsertTests/LargeSourceCodeTests/TypedMatrixTest.html" title="class in plugindevelopment.TypeInsertTests.LargeSourceCodeTests" target="classFrame">TypedMatrixTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">TypeinferenceException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">TypeinferenceException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/TypeinferenceResultSet.html" title="class in de.dhbwstuttgart.typeinference" target="classFrame">TypeinferenceResultSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/TypeInsertable.html" title="interface in de.dhbwstuttgart.typeinference" target="classFrame"><span class="interfaceName">TypeInsertable</span></a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.html" title="class in de.dhbwstuttgart.typeinference.typedeployment" target="classFrame">TypeInsertPoint</a></li>
|
||||
|
@ -55,7 +55,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/CSubstitutionSet.html" title="class in de.dhbwstuttgart.typeinference.unify">CSubstitutionSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/myexception/CTypeReconstructionException.html" title="class in de.dhbwstuttgart.myexception">CTypeReconstructionException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/CVectorSet.html" title="class in de.dhbwstuttgart.typeinference.unify">CVectorSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">DebugException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">DebugException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/misc/DeclId.html" title="class in de.dhbwstuttgart.syntaxtree.misc">DeclId</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/DivideOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator">DivideOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/DoubleLiteral.html" title="class in de.dhbwstuttgart.syntaxtree.statement">DoubleLiteral</a></li>
|
||||
@ -203,7 +203,7 @@
|
||||
<li><a href="syntaxTree/NodeEqualTest.html" title="class in syntaxTree">NodeEqualTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/NotEqualOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator">NotEqualOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/NotExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement">NotExpr</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">NotImplementedException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">NotImplementedException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/Null.html" title="class in de.dhbwstuttgart.syntaxtree.statement">Null</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/type/ObjectType.html" title="class in de.dhbwstuttgart.syntaxtree.type">ObjectType</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/OderConstraint.html" title="class in de.dhbwstuttgart.typeinference">OderConstraint</a></li>
|
||||
@ -228,7 +228,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/ParameterAssumption.html" title="class in de.dhbwstuttgart.typeinference.assumptions">ParameterAssumption</a></li>
|
||||
<li><a href="plugindevelopment/ParameterInsertTest.html" title="class in plugindevelopment">ParameterInsertTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/ParameterList.html" title="class in de.dhbwstuttgart.syntaxtree">ParameterList</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/operator/PlusOp.html" title="class in de.dhbwstuttgart.syntaxtree.operator">PlusOp</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/PositivExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement">PositivExpr</a></li>
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/statement/PostDecExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement">PostDecExpr</a></li>
|
||||
@ -282,7 +282,7 @@
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/TypeAssumptions.html" title="class in de.dhbwstuttgart.typeinference.assumptions">TypeAssumptions</a></li>
|
||||
<li><a href="plugindevelopment/TypeInsertTests/LargeSourceCodeTests/TypedMatrixSimpleTest.html" title="class in plugindevelopment.TypeInsertTests.LargeSourceCodeTests">TypedMatrixSimpleTest</a></li>
|
||||
<li><a href="plugindevelopment/TypeInsertTests/LargeSourceCodeTests/TypedMatrixTest.html" title="class in plugindevelopment.TypeInsertTests.LargeSourceCodeTests">TypedMatrixTest</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/TypeinferenceResultSet.html" title="class in de.dhbwstuttgart.typeinference">TypeinferenceResultSet</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/TypeInsertable.html" title="interface in de.dhbwstuttgart.typeinference"><span class="interfaceName">TypeInsertable</span></a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/typedeployment/TypeInsertPoint.html" title="class in de.dhbwstuttgart.typeinference.typedeployment">TypeInsertPoint</a></li>
|
||||
|
@ -567,11 +567,11 @@ implements <a href="../../../de/dhbwstuttgart/core/MyCompilerAPI.html" title="in
|
||||
<li class="blockList">
|
||||
<h4>parse2SyntaxTree</h4>
|
||||
<pre>private <a href="../../../de/dhbwstuttgart/syntaxtree/SourceFile.html" title="class in de.dhbwstuttgart.syntaxtree">SourceFile</a> parse2SyntaxTree(java.io.Reader fileContent)
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></pre>
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></pre>
|
||||
<div class="block">Parst den Inhalt einer Datei zu einem Syntaxbaum.</div>
|
||||
<dl>
|
||||
<dt><span class="throwsLabel">Throws:</span></dt>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></code></dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
@ -582,7 +582,7 @@ implements <a href="../../../de/dhbwstuttgart/core/MyCompilerAPI.html" title="in
|
||||
<li class="blockList">
|
||||
<h4>parse</h4>
|
||||
<pre>public void parse(<a href="../../../de/dhbwstuttgart/typeinference/Menge.html" title="class in de.dhbwstuttgart.typeinference">Menge</a><java.lang.String> filenames)
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></pre>
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></pre>
|
||||
<div class="block">Diese Funktion nimmt einen Menge von Dateinamen. Alle diese Dateien werden zu einem SyntaxBaum geparst.</div>
|
||||
<dl>
|
||||
<dt><span class="overrideSpecifyLabel">Specified by:</span></dt>
|
||||
@ -590,7 +590,7 @@ implements <a href="../../../de/dhbwstuttgart/core/MyCompilerAPI.html" title="in
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>filenames</code> - - Eine Liste von Quellcodedateien, welche gseparst werden sollen</dd>
|
||||
<dt><span class="throwsLabel">Throws:</span></dt>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></code></dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -237,7 +237,7 @@ var activeTableTab = "activeTableTab";
|
||||
<h4>typeReconstruction</h4>
|
||||
<pre><a href="../../../de/dhbwstuttgart/typeinference/Menge.html" title="class in de.dhbwstuttgart.typeinference">Menge</a><<a href="../../../de/dhbwstuttgart/typeinference/TypeinferenceResultSet.html" title="class in de.dhbwstuttgart.typeinference">TypeinferenceResultSet</a>> typeReconstruction()
|
||||
throws java.lang.NullPointerException,
|
||||
<a href="../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></pre>
|
||||
<a href="../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></pre>
|
||||
<div class="block">Author: Jörg Bäuerle<br/>
|
||||
Ruft den Typrekonstruktionsalgorithmus auf.</div>
|
||||
<dl>
|
||||
@ -247,7 +247,7 @@ var activeTableTab = "activeTableTab";
|
||||
<dd><code>java.lang.NullPointerException</code> - Wenn noch kein abstrakter Syntaxbaum vorhanden
|
||||
ist. @throws CTypeReconstructionException Wenn ein Fehler bei der
|
||||
Typrekonstruktion auftritt.</dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></code></dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
@ -280,13 +280,13 @@ var activeTableTab = "activeTableTab";
|
||||
<li class="blockList">
|
||||
<h4>parse</h4>
|
||||
<pre>void parse(<a href="../../../de/dhbwstuttgart/typeinference/Menge.html" title="class in de.dhbwstuttgart.typeinference">Menge</a><java.lang.String> filenames)
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></pre>
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></pre>
|
||||
<div class="block">Parst zusammenhängende JavaKlassen in verschiedenen Dateien.</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
<dd><code>filenames</code> - - Eine Liste von Quellcodedateien, welche gseparst werden sollen</dd>
|
||||
<dt><span class="throwsLabel">Throws:</span></dt>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></code></dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
@ -297,7 +297,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li class="blockList">
|
||||
<h4>parse</h4>
|
||||
<pre><a href="../../../de/dhbwstuttgart/syntaxtree/SourceFile.html" title="class in de.dhbwstuttgart.syntaxtree">SourceFile</a> parse(java.lang.String sourceCode)
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></pre>
|
||||
throws <a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></pre>
|
||||
<div class="block">Parst den SourceCode einer Datei.</div>
|
||||
<dl>
|
||||
<dt><span class="paramLabel">Parameters:</span></dt>
|
||||
@ -305,7 +305,7 @@ var activeTableTab = "activeTableTab";
|
||||
<dt><span class="returnLabel">Returns:</span></dt>
|
||||
<dd>den aus dem sourceCode generierten Syntaxbaum</dd>
|
||||
<dt><span class="throwsLabel">Throws:</span></dt>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></code></dd>
|
||||
<dd><code><a href="../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></code></dd>
|
||||
</dl>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -91,7 +91,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -160,12 +160,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Uses of <a href="../../../../de/dhbwstuttgart/parser/JavaParser.yyException.html" title="class in de.dhbwstuttgart.parser">JavaParser.yyException</a> in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></h3>
|
||||
<h3>Uses of <a href="../../../../de/dhbwstuttgart/parser/JavaParser.yyException.html" title="class in de.dhbwstuttgart.parser">JavaParser.yyException</a> in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></h3>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
|
||||
<caption><span>Constructors in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a> with parameters of type <a href="../../../../de/dhbwstuttgart/parser/JavaParser.yyException.html" title="class in de.dhbwstuttgart.parser">JavaParser.yyException</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Constructors in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a> with parameters of type <a href="../../../../de/dhbwstuttgart/parser/JavaParser.yyException.html" title="class in de.dhbwstuttgart.parser">JavaParser.yyException</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Constructor and Description</th>
|
||||
</tr>
|
||||
|
@ -107,7 +107,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@ -238,11 +238,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
|
||||
<caption><span>Classes in <a href="../../../de/dhbwstuttgart/parser/package-summary.html">de.dhbwstuttgart.parser</a> used by <a href="../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Classes in <a href="../../../de/dhbwstuttgart/parser/package-summary.html">de.dhbwstuttgart.parser</a> used by <a href="../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Class and Description</th>
|
||||
</tr>
|
||||
|
@ -111,7 +111,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
@ -1296,12 +1296,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Uses of <a href="../../../../de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.html" title="class in de.dhbwstuttgart.syntaxtree">SyntaxTreeNode</a> in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></h3>
|
||||
<h3>Uses of <a href="../../../../de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.html" title="class in de.dhbwstuttgart.syntaxtree">SyntaxTreeNode</a> in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></h3>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing constructors, and an explanation">
|
||||
<caption><span>Constructors in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a> with parameters of type <a href="../../../../de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.html" title="class in de.dhbwstuttgart.syntaxtree">SyntaxTreeNode</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Constructors in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a> with parameters of type <a href="../../../../de/dhbwstuttgart/syntaxtree/SyntaxTreeNode.html" title="class in de.dhbwstuttgart.syntaxtree">SyntaxTreeNode</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Constructor and Description</th>
|
||||
</tr>
|
||||
|
@ -115,7 +115,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
@ -367,11 +367,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
|
||||
<caption><span>Classes in <a href="../../../de/dhbwstuttgart/syntaxtree/package-summary.html">de.dhbwstuttgart.syntaxtree</a> used by <a href="../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Classes in <a href="../../../de/dhbwstuttgart/syntaxtree/package-summary.html">de.dhbwstuttgart.syntaxtree</a> used by <a href="../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Class and Description</th>
|
||||
</tr>
|
||||
|
@ -44,7 +44,7 @@
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li>Prev Class</li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/DebugException.html" target="_top">Frames</a></li>
|
||||
@ -86,7 +86,7 @@
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<div class="header">
|
||||
<div class="subTitle">de.dhbwstuttgart.typeinference.exceptions</div>
|
||||
<div class="subTitle">de.dhbwstuttgart.exceptions</div>
|
||||
<h2 title="Class DebugException" class="title">Class DebugException</h2>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
@ -103,7 +103,7 @@
|
||||
<li>java.lang.RuntimeException</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.exceptions.DebugException</li>
|
||||
<li>de.dhbwstuttgart.exceptions.DebugException</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -223,7 +223,7 @@ extends java.lang.RuntimeException</pre>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li>Prev Class</li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/DebugException.html" target="_top">Frames</a></li>
|
||||
|
@ -43,8 +43,8 @@
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" target="_top">Frames</a></li>
|
||||
@ -86,7 +86,7 @@
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<div class="header">
|
||||
<div class="subTitle">de.dhbwstuttgart.typeinference.exceptions</div>
|
||||
<div class="subTitle">de.dhbwstuttgart.exceptions</div>
|
||||
<h2 title="Class NotImplementedException" class="title">Class NotImplementedException</h2>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
@ -103,7 +103,7 @@
|
||||
<li>java.lang.RuntimeException</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</li>
|
||||
<li>de.dhbwstuttgart.exceptions.NotImplementedException</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -222,8 +222,8 @@ extends java.lang.RuntimeException</pre>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" target="_top">Frames</a></li>
|
||||
|
@ -43,8 +43,8 @@
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/ParserError.html" target="_top">Frames</a></li>
|
||||
@ -71,7 +71,7 @@
|
||||
<li>Nested | </li>
|
||||
<li>Field | </li>
|
||||
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException">Method</a></li>
|
||||
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.exceptions.TypeinferenceException">Method</a></li>
|
||||
</ul>
|
||||
<ul class="subNavList">
|
||||
<li>Detail: </li>
|
||||
@ -86,7 +86,7 @@
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<div class="header">
|
||||
<div class="subTitle">de.dhbwstuttgart.typeinference.exceptions</div>
|
||||
<div class="subTitle">de.dhbwstuttgart.exceptions</div>
|
||||
<h2 title="Class ParserError" class="title">Class ParserError</h2>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
@ -103,10 +103,10 @@
|
||||
<li>java.lang.RuntimeException</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions.TypeinferenceException</a></li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.exceptions.ParserError</li>
|
||||
<li>de.dhbwstuttgart.exceptions.ParserError</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -128,7 +128,7 @@
|
||||
<hr>
|
||||
<br>
|
||||
<pre>public class <span class="typeNameLabel">ParserError</span>
|
||||
extends <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></pre>
|
||||
extends <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></pre>
|
||||
<dl>
|
||||
<dt><span class="seeLabel">See Also:</span></dt>
|
||||
<dd><a href="../../../../serialized-form.html#de.dhbwstuttgart.typeinference.exceptions.ParserError">Serialized Form</a></dd>
|
||||
@ -163,10 +163,10 @@ extends <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/Typeinfer
|
||||
</a>
|
||||
<h3>Method Summary</h3>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException">
|
||||
<li class="blockList"><a name="methods.inherited.from.class.de.dhbwstuttgart.exceptions.TypeinferenceException">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></h3>
|
||||
<h3>Methods inherited from class de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></h3>
|
||||
<code><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getMessage--">getMessage</a>, <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getOffset--">getOffset</a></code></li>
|
||||
</ul>
|
||||
<ul class="blockList">
|
||||
@ -234,8 +234,8 @@ extends <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/Typeinfer
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Next Class</span></a></li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../index.html?de/dhbwstuttgart/typeinference/exceptions/ParserError.html" target="_top">Frames</a></li>
|
||||
@ -262,7 +262,7 @@ extends <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/Typeinfer
|
||||
<li>Nested | </li>
|
||||
<li>Field | </li>
|
||||
<li><a href="#constructor.summary">Constr</a> | </li>
|
||||
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException">Method</a></li>
|
||||
<li><a href="#methods.inherited.from.class.de.dhbwstuttgart.exceptions.TypeinferenceException">Method</a></li>
|
||||
</ul>
|
||||
<ul class="subNavList">
|
||||
<li>Detail: </li>
|
||||
|
@ -49,7 +49,7 @@ var activeTableTab = "activeTableTab";
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
@ -92,7 +92,7 @@ var activeTableTab = "activeTableTab";
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<!-- ======== START OF CLASS DATA ======== -->
|
||||
<div class="header">
|
||||
<div class="subTitle">de.dhbwstuttgart.typeinference.exceptions</div>
|
||||
<div class="subTitle">de.dhbwstuttgart.exceptions</div>
|
||||
<h2 title="Class TypeinferenceException" class="title">Class TypeinferenceException</h2>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
@ -109,7 +109,7 @@ var activeTableTab = "activeTableTab";
|
||||
<li>java.lang.RuntimeException</li>
|
||||
<li>
|
||||
<ul class="inheritance">
|
||||
<li>de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</li>
|
||||
<li>de.dhbwstuttgart.exceptions.TypeinferenceException</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -128,7 +128,7 @@ var activeTableTab = "activeTableTab";
|
||||
</dl>
|
||||
<dl>
|
||||
<dt>Direct Known Subclasses:</dt>
|
||||
<dd><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></dd>
|
||||
<dd><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></dd>
|
||||
</dl>
|
||||
<hr>
|
||||
<br>
|
||||
@ -353,7 +353,7 @@ extends java.lang.RuntimeException</pre>
|
||||
</div>
|
||||
<div class="subNav">
|
||||
<ul class="navList">
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">Prev Class</span></a></li>
|
||||
<li>Next Class</li>
|
||||
</ul>
|
||||
<ul class="navList">
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.exceptions.DebugException</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.exceptions.DebugException</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.DebugException";
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.exceptions.DebugException";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -33,7 +32,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
@ -70,9 +69,9 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.DebugException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.DebugException</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.exceptions.DebugException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.DebugException</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.typeinference.exceptions.DebugException</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.exceptions.DebugException</div>
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<div class="bottomNav"><a name="navbar.bottom">
|
||||
<!-- -->
|
||||
@ -84,7 +83,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.exceptions.NotImplementedException</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.NotImplementedException";
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.exceptions.NotImplementedException";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -33,7 +32,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
@ -70,9 +69,9 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.NotImplementedException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.exceptions.NotImplementedException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</div>
|
||||
<div class="classUseContainer">No usage of de.dhbwstuttgart.exceptions.NotImplementedException</div>
|
||||
<!-- ======= START OF BOTTOM NAVBAR ====== -->
|
||||
<div class="bottomNav"><a name="navbar.bottom">
|
||||
<!-- -->
|
||||
@ -84,7 +83,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.exceptions.ParserError</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.exceptions.ParserError</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.ParserError";
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.exceptions.ParserError";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -33,7 +32,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
@ -70,13 +69,13 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.ParserError" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.ParserError</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.exceptions.ParserError" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.ParserError</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
|
||||
<caption><span>Packages that use <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Packages that use <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Package</th>
|
||||
<th class="colLast" scope="col">Description</th>
|
||||
@ -94,9 +93,9 @@
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.core">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a> in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></h3>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a> in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></h3>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
|
||||
<caption><span>Methods in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a> that throw <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Methods in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a> that throw <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||
<th class="colLast" scope="col">Method and Description</th>
|
||||
@ -144,7 +143,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>Uses of Class de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</title>
|
||||
<title>Uses of Class de.dhbwstuttgart.exceptions.TypeinferenceException</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException";
|
||||
parent.document.title="Uses of Class de.dhbwstuttgart.exceptions.TypeinferenceException";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -33,7 +32,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
@ -70,13 +69,13 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</h2>
|
||||
<h2 title="Uses of Class de.dhbwstuttgart.exceptions.TypeinferenceException" class="title">Uses of Class<br>de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</h2>
|
||||
</div>
|
||||
<div class="classUseContainer">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
|
||||
<caption><span>Packages that use <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Packages that use <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Package</th>
|
||||
<th class="colLast" scope="col">Description</th>
|
||||
@ -87,7 +86,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -98,9 +97,9 @@
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.core">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></h3>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></h3>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing methods, and an explanation">
|
||||
<caption><span>Methods in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a> that throw <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Methods in <a href="../../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a> that throw <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||
<th class="colLast" scope="col">Method and Description</th>
|
||||
@ -116,12 +115,12 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></h3>
|
||||
<h3>Uses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></h3>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing subclasses, and an explanation">
|
||||
<caption><span>Subclasses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Subclasses of <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a> in <a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Modifier and Type</th>
|
||||
<th class="colLast" scope="col">Class and Description</th>
|
||||
@ -129,7 +128,7 @@
|
||||
<tbody>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><code>class </code></td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></span></code> </td>
|
||||
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></span></code> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -149,7 +148,7 @@
|
||||
<ul class="navList" title="Navigation">
|
||||
<li><a href="../../../../../overview-summary.html">Overview</a></li>
|
||||
<li><a href="../package-summary.html">Package</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">Class</a></li>
|
||||
<li><a href="../../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">Class</a></li>
|
||||
<li class="navBarCell1Rev">Use</li>
|
||||
<li><a href="../package-tree.html">Tree</a></li>
|
||||
<li><a href="../../../../../deprecated-list.html">Deprecated</a></li>
|
||||
|
@ -3,20 +3,20 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>de.dhbwstuttgart.typeinference.exceptions</title>
|
||||
<title>de.dhbwstuttgart.exceptions</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<h1 class="bar"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html" target="classFrame">de.dhbwstuttgart.typeinference.exceptions</a></h1>
|
||||
<h1 class="bar"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html" target="classFrame">de.dhbwstuttgart.exceptions</a></h1>
|
||||
<div class="indexContainer">
|
||||
<h2 title="Exceptions">Exceptions</h2>
|
||||
<ul title="Exceptions">
|
||||
<li><a href="DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">DebugException</a></li>
|
||||
<li><a href="NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">NotImplementedException</a></li>
|
||||
<li><a href="ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">ParserError</a></li>
|
||||
<li><a href="TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions" target="classFrame">TypeinferenceException</a></li>
|
||||
<li><a href="DebugException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">DebugException</a></li>
|
||||
<li><a href="NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">NotImplementedException</a></li>
|
||||
<li><a href="ParserError.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">ParserError</a></li>
|
||||
<li><a href="TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions" target="classFrame">TypeinferenceException</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>de.dhbwstuttgart.typeinference.exceptions</title>
|
||||
<title>de.dhbwstuttgart.exceptions</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,7 +70,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h1 title="Package" class="title">Package de.dhbwstuttgart.typeinference.exceptions</h1>
|
||||
<h1 title="Package" class="title">Package de.dhbwstuttgart.exceptions</h1>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
<ul class="blockList">
|
||||
@ -83,19 +83,19 @@
|
||||
</tr>
|
||||
<tbody>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">DebugException</a></td>
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">DebugException</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">NotImplementedException</a></td>
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">NotImplementedException</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></td>
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></td>
|
||||
<td class="colFirst"><a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></td>
|
||||
<td class="colLast">
|
||||
<div class="block">Eine RuntimeException, welche bei einem Fehler während des Typinferenzalgorithmus ausgelöst wird.</div>
|
||||
</td>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:23 CEST 2015 -->
|
||||
<title>de.dhbwstuttgart.typeinference.exceptions Class Hierarchy</title>
|
||||
<title>de.dhbwstuttgart.exceptions Class Hierarchy</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -12,13 +12,12 @@
|
||||
<script type="text/javascript"><!--
|
||||
try {
|
||||
if (location.href.indexOf('is-external=true') == -1) {
|
||||
parent.document.title="de.dhbwstuttgart.typeinference.exceptions Class Hierarchy";
|
||||
parent.document.title="de.dhbwstuttgart.exceptions Class Hierarchy";
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
}
|
||||
//-->
|
||||
</script>
|
||||
//--></script>
|
||||
<noscript>
|
||||
<div>JavaScript is disabled on your browser.</div>
|
||||
</noscript>
|
||||
@ -70,7 +69,7 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h1 class="title">Hierarchy For Package de.dhbwstuttgart.typeinference.exceptions</h1>
|
||||
<h1 class="title">Hierarchy For Package de.dhbwstuttgart.exceptions</h1>
|
||||
<span class="packageHierarchyLabel">Package Hierarchies:</span>
|
||||
<ul class="horizontal">
|
||||
<li><a href="../../../../overview-tree.html">All Packages</a></li>
|
||||
@ -87,11 +86,11 @@
|
||||
<ul>
|
||||
<li type="circle">java.lang.RuntimeException
|
||||
<ul>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">DebugException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">NotImplementedException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">TypeinferenceException</span></a>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">DebugException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">NotImplementedException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">TypeinferenceException</span></a>
|
||||
<ul>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">ParserError</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="../../../../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">ParserError</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<html lang="de">
|
||||
<head>
|
||||
<!-- Generated by javadoc (1.8.0_05) on Tue May 12 19:56:24 CEST 2015 -->
|
||||
<title>Uses of Package de.dhbwstuttgart.typeinference.exceptions</title>
|
||||
<title>Uses of Package de.dhbwstuttgart.exceptions</title>
|
||||
<meta name="date" content="2015-05-12">
|
||||
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">
|
||||
<script type="text/javascript" src="../../../../script.js"></script>
|
||||
@ -70,13 +70,13 @@
|
||||
</a></div>
|
||||
<!-- ========= END OF TOP NAVBAR ========= -->
|
||||
<div class="header">
|
||||
<h1 title="Uses of Package de.dhbwstuttgart.typeinference.exceptions" class="title">Uses of Package<br>de.dhbwstuttgart.typeinference.exceptions</h1>
|
||||
<h1 title="Uses of Package de.dhbwstuttgart.exceptions" class="title">Uses of Package<br>de.dhbwstuttgart.typeinference.exceptions</h1>
|
||||
</div>
|
||||
<div class="contentContainer">
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing packages, and an explanation">
|
||||
<caption><span>Packages that use <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Packages that use <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colFirst" scope="col">Package</th>
|
||||
<th class="colLast" scope="col">Description</th>
|
||||
@ -87,7 +87,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="#de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@ -97,7 +97,7 @@
|
||||
<!-- -->
|
||||
</a>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
|
||||
<caption><span>Classes in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a> used by <a href="../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Classes in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a> used by <a href="../../../../de/dhbwstuttgart/core/package-summary.html">de.dhbwstuttgart.core</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Class and Description</th>
|
||||
</tr>
|
||||
@ -113,11 +113,11 @@
|
||||
</tbody>
|
||||
</table>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions">
|
||||
<!-- -->
|
||||
</a>
|
||||
<table class="useSummary" border="0" cellpadding="3" cellspacing="0" summary="Use table, listing classes, and an explanation">
|
||||
<caption><span>Classes in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a> used by <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<caption><span>Classes in <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a> used by <a href="../../../../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></span><span class="tabEnd"> </span></caption>
|
||||
<tr>
|
||||
<th class="colOne" scope="col">Class and Description</th>
|
||||
</tr>
|
||||
|
@ -182,7 +182,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/myexception/CTypeReconstructionException.html#message">message</a></span> - Variable in exception de.dhbwstuttgart.myexception.<a href="../de/dhbwstuttgart/myexception/CTypeReconstructionException.html" title="class in de.dhbwstuttgart.myexception">CTypeReconstructionException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#message">message</a></span> - Variable in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#message">message</a></span> - Variable in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/JvmDisassembler/GenericsTest.html#meth-a-">meth(a)</a></span> - Method in class de.dhbwstuttgart.JvmDisassembler.<a href="../de/dhbwstuttgart/JvmDisassembler/GenericsTest.html" title="class in de.dhbwstuttgart.JvmDisassembler">GenericsTest</a></dt>
|
||||
<dd> </dd>
|
||||
|
@ -132,9 +132,9 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/syntaxtree/statement/NotExpr.html#NotExpr-int-int-">NotExpr(int, int)</a></span> - Constructor for class de.dhbwstuttgart.syntaxtree.statement.<a href="../de/dhbwstuttgart/syntaxtree/statement/NotExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement">NotExpr</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">NotImplementedException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></dt>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">NotImplementedException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html#NotImplementedException--">NotImplementedException()</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">NotImplementedException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html#NotImplementedException--">NotImplementedException()</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">NotImplementedException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/syntaxtree/statement/Null.html" title="class in de.dhbwstuttgart.syntaxtree.statement"><span class="typeNameLink">Null</span></a> - Class in <a href="../de/dhbwstuttgart/syntaxtree/statement/package-summary.html">de.dhbwstuttgart.syntaxtree.statement</a></dt>
|
||||
<dd> </dd>
|
||||
|
@ -102,7 +102,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/syntaxtree/type/Type.html#offset">offset</a></span> - Variable in class de.dhbwstuttgart.syntaxtree.type.<a href="../de/dhbwstuttgart/syntaxtree/type/Type.html" title="class in de.dhbwstuttgart.syntaxtree.type">Type</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#offset">offset</a></span> - Variable in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#offset">offset</a></span> - Variable in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd>
|
||||
<div class="block">Das Offset im Quelltext bei dem das Problem aufgetaucht ist</div>
|
||||
</dd>
|
||||
|
@ -204,9 +204,9 @@
|
||||
<dd> </dd>
|
||||
<dt><a href="../parser/package-summary.html">parser</a> - package parser</dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">ParserError</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></dt>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">ParserError</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html#ParserError-de.dhbwstuttgart.parser.JavaParser.yyException-">ParserError(JavaParser.yyException)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">ParserError</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html#ParserError-de.dhbwstuttgart.parser.JavaParser.yyException-">ParserError(JavaParser.yyException)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">ParserError</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/myexception/SCClassException.html#parserlog">parserlog</a></span> - Static variable in exception de.dhbwstuttgart.myexception.<a href="../de/dhbwstuttgart/myexception/SCClassException.html" title="class in de.dhbwstuttgart.myexception">SCClassException</a></dt>
|
||||
<dd> </dd>
|
||||
|
@ -679,13 +679,13 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/syntaxtree/statement/UnaryExpr.html#TYPEExpr-de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions-">TYPEExpr(TypeAssumptions)</a></span> - Method in class de.dhbwstuttgart.syntaxtree.statement.<a href="../de/dhbwstuttgart/syntaxtree/statement/UnaryExpr.html" title="class in de.dhbwstuttgart.syntaxtree.statement">UnaryExpr</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">TypeinferenceException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></dt>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">TypeinferenceException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></dt>
|
||||
<dd>
|
||||
<div class="block">Eine RuntimeException, welche bei einem Fehler während des Typinferenzalgorithmus ausgelöst wird.</div>
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#TypeinferenceException-java.lang.String-de.dhbwstuttgart.syntaxtree.SyntaxTreeNode-">TypeinferenceException(String, SyntaxTreeNode)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#TypeinferenceException-java.lang.String-de.dhbwstuttgart.syntaxtree.SyntaxTreeNode-">TypeinferenceException(String, SyntaxTreeNode)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#TypeinferenceException-java.lang.String-int-">TypeinferenceException(String, int)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#TypeinferenceException-java.lang.String-int-">TypeinferenceException(String, int)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/TypeinferenceResultSet.html" title="class in de.dhbwstuttgart.typeinference"><span class="typeNameLink">TypeinferenceResultSet</span></a> - Class in <a href="../de/dhbwstuttgart/typeinference/package-summary.html">de.dhbwstuttgart.typeinference</a></dt>
|
||||
<dd>
|
||||
|
@ -100,7 +100,7 @@
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/assumptions/package-summary.html">de.dhbwstuttgart.typeinference.assumptions</a> - package de.dhbwstuttgart.typeinference.assumptions</dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a> - package de.dhbwstuttgart.typeinference.exceptions</dt>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a> - package de.dhbwstuttgart.typeinference.exceptions</dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/typedeployment/package-summary.html">de.dhbwstuttgart.typeinference.typedeployment</a> - package de.dhbwstuttgart.typeinference.typedeployment</dt>
|
||||
<dd> </dd>
|
||||
@ -112,9 +112,9 @@
|
||||
</dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/logger/SectionLogger.html#debug-java.lang.String-">debug(String)</a></span> - Method in class de.dhbwstuttgart.logger.<a href="../de/dhbwstuttgart/logger/SectionLogger.html" title="class in de.dhbwstuttgart.logger">SectionLogger</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">DebugException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></dt>
|
||||
<dt><a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">DebugException</span></a> - Exception in <a href="../de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html#DebugException-java.lang.String-">DebugException(String)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">DebugException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html#DebugException-java.lang.String-">DebugException(String)</a></span> - Constructor for exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">DebugException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/syntaxtree/Field.html#declid">declid</a></span> - Variable in class de.dhbwstuttgart.syntaxtree.<a href="../de/dhbwstuttgart/syntaxtree/Field.html" title="class in de.dhbwstuttgart.syntaxtree">Field</a></dt>
|
||||
<dd> </dd>
|
||||
|
@ -845,7 +845,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/myexception/CTypeReconstructionException.html#getMessage--">getMessage()</a></span> - Method in exception de.dhbwstuttgart.myexception.<a href="../de/dhbwstuttgart/myexception/CTypeReconstructionException.html" title="class in de.dhbwstuttgart.myexception">CTypeReconstructionException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getMessage--">getMessage()</a></span> - Method in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getMessage--">getMessage()</a></span> - Method in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.html#getMethod--">getMethod()</a></span> - Method in class de.dhbwstuttgart.typeinference.assumptions.<a href="../de/dhbwstuttgart/typeinference/assumptions/MethodAssumption.html" title="class in de.dhbwstuttgart.typeinference.assumptions">MethodAssumption</a></dt>
|
||||
<dd> </dd>
|
||||
@ -931,7 +931,7 @@
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/syntaxtree/type/Type.html#getOffset--">getOffset()</a></span> - Method in class de.dhbwstuttgart.syntaxtree.type.<a href="../de/dhbwstuttgart/syntaxtree/type/Type.html" title="class in de.dhbwstuttgart.syntaxtree.type">Type</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getOffset--">getOffset()</a></span> - Method in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a></dt>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html#getOffset--">getOffset()</a></span> - Method in exception de.dhbwstuttgart.typeinference.exceptions.<a href="../de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a></dt>
|
||||
<dd> </dd>
|
||||
<dt><span class="memberNameLink"><a href="../de/dhbwstuttgart/typeinference/typedeployment/GenericTypeInsertPoint.html#getOffset--">getOffset()</a></span> - Method in class de.dhbwstuttgart.typeinference.typedeployment.<a href="../de/dhbwstuttgart/typeinference/typedeployment/GenericTypeInsertPoint.html" title="class in de.dhbwstuttgart.typeinference.typedeployment">GenericTypeInsertPoint</a></dt>
|
||||
<dd> </dd>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/type/package-frame.html" target="packageFrame">de.dhbwstuttgart.syntaxtree.type</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/package-frame.html" target="packageFrame">de.dhbwstuttgart.typeinference</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/package-frame.html" target="packageFrame">de.dhbwstuttgart.typeinference.assumptions</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/package-frame.html" target="packageFrame">de.dhbwstuttgart.typeinference.exceptions</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/package-frame.html" target="packageFrame">de.dhbwstuttgart.exceptions</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/typedeployment/package-frame.html" target="packageFrame">de.dhbwstuttgart.typeinference.typedeployment</a></li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/package-frame.html" target="packageFrame">de.dhbwstuttgart.typeinference.unify</a></li>
|
||||
<li><a href="KomplexeMenge/package-frame.html" target="packageFrame">KomplexeMenge</a></li>
|
||||
|
@ -130,7 +130,7 @@
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="rowColor">
|
||||
<td class="colFirst"><a href="de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.typeinference.exceptions</a></td>
|
||||
<td class="colFirst"><a href="de/dhbwstuttgart/typeinference/exceptions/package-summary.html">de.dhbwstuttgart.exceptions</a></td>
|
||||
<td class="colLast"> </td>
|
||||
</tr>
|
||||
<tr class="altColor">
|
||||
|
@ -86,7 +86,7 @@
|
||||
<li><a href="de/dhbwstuttgart/syntaxtree/type/package-tree.html">de.dhbwstuttgart.syntaxtree.type</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/package-tree.html">de.dhbwstuttgart.typeinference</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/assumptions/package-tree.html">de.dhbwstuttgart.typeinference.assumptions</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/package-tree.html">de.dhbwstuttgart.typeinference.exceptions</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/exceptions/package-tree.html">de.dhbwstuttgart.exceptions</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/typedeployment/package-tree.html">de.dhbwstuttgart.typeinference.typedeployment</a>, </li>
|
||||
<li><a href="de/dhbwstuttgart/typeinference/unify/package-tree.html">de.dhbwstuttgart.typeinference.unify</a>, </li>
|
||||
<li><a href="KomplexeMenge/package-tree.html">KomplexeMenge</a>, </li>
|
||||
@ -497,11 +497,11 @@
|
||||
<li type="circle">java.lang.RuntimeException
|
||||
<ul>
|
||||
<li type="circle">de.dhbwstuttgart.myexception.<a href="de/dhbwstuttgart/myexception/CTypeReconstructionException.html" title="class in de.dhbwstuttgart.myexception"><span class="typeNameLink">CTypeReconstructionException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">DebugException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">NotImplementedException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">TypeinferenceException</span></a>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">DebugException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">NotImplementedException</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">TypeinferenceException</span></a>
|
||||
<ul>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions"><span class="typeNameLink">ParserError</span></a></li>
|
||||
<li type="circle">de.dhbwstuttgart.typeinference.exceptions.<a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions"><span class="typeNameLink">ParserError</span></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -302,27 +302,27 @@
|
||||
</ul>
|
||||
</li>
|
||||
<li class="blockList">
|
||||
<h2 title="Package">Package de.dhbwstuttgart.typeinference.exceptions</h2>
|
||||
<h2 title="Package">Package de.dhbwstuttgart.exceptions</h2>
|
||||
<ul class="blockList">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions.DebugException">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions.DebugException">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions.DebugException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/DebugException.html" title="class in de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions.DebugException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions.NotImplementedException">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions.NotImplementedException">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions.NotImplementedException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/NotImplementedException.html" title="class in de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions.NotImplementedException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions.ParserError">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions.ParserError">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions.ParserError</a> extends <a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">TypeinferenceException</a> implements Serializable</h3>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/ParserError.html" title="class in de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions.ParserError</a> extends <a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">TypeinferenceException</a> implements Serializable</h3>
|
||||
</li>
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException">
|
||||
<li class="blockList"><a name="de.dhbwstuttgart.exceptions.TypeinferenceException">
|
||||
<!-- -->
|
||||
</a>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.typeinference.exceptions">de.dhbwstuttgart.typeinference.exceptions.TypeinferenceException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
<h3>Class <a href="de/dhbwstuttgart/typeinference/exceptions/TypeinferenceException.html" title="class in de.dhbwstuttgart.exceptions">de.dhbwstuttgart.exceptions.TypeinferenceException</a> extends java.lang.RuntimeException implements Serializable</h3>
|
||||
<ul class="blockList">
|
||||
<li class="blockList">
|
||||
<h3>Serialized Fields</h3>
|
||||
|
@ -1,6 +1,9 @@
|
||||
package de.dhbwstuttgart.core;
|
||||
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public interface IItemWithOffset
|
||||
{
|
||||
Token getOffset();
|
||||
}
|
||||
|
@ -1,14 +1,23 @@
|
||||
package de.dhbwstuttgart.core;
|
||||
|
||||
import de.dhbwstuttgart.parser.JavaTXParser;
|
||||
import de.dhbwstuttgart.syntaxtree.SourceFile;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class JavaTXCompiler {
|
||||
|
||||
private List<SourceFile> sourceFiles = new ArrayList<>();
|
||||
|
||||
public void typeInference(){
|
||||
|
||||
}
|
||||
|
||||
public void parse(File sourceFile) throws IOException, ClassNotFoundException {
|
||||
new JavaTXParser().parse(sourceFile);
|
||||
sourceFiles.add(new JavaTXParser().parse(sourceFile));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,10 +0,0 @@
|
||||
|
||||
package de.dhbwstuttgart.core;
|
||||
|
||||
|
||||
public class MyCompiler {
|
||||
// PL: Der Zusammenhang zwischen paralist und vParaOrg muesste
|
||||
// noch geklaert werden 05-01-07
|
||||
|
||||
}
|
||||
|
@ -1,19 +0,0 @@
|
||||
package de.dhbwstuttgart.core;
|
||||
|
||||
/**
|
||||
* Schnittstellen-Klasse zum Compiler. Diese Klasse soll der
|
||||
* IDE als Compiler-API zum Kompilieren einer Quellcode-Datei
|
||||
* dienen und stellt somit die Schnittstelle zur Studienarbeit
|
||||
* von Markus Melzer (Eclipse-Plugin) dar.
|
||||
* @author Jörg Bäuerle
|
||||
* @version $Date: 2013/09/09 11:04:24 $
|
||||
*/
|
||||
public interface MyCompilerAPI
|
||||
{
|
||||
|
||||
/**
|
||||
* Author: Jörg Bäuerle<br/>
|
||||
* Initialisiert den Compiler
|
||||
*/
|
||||
public void init();
|
||||
}
|
8
src/de/dhbwstuttgart/exceptions/DebugException.java
Normal file
8
src/de/dhbwstuttgart/exceptions/DebugException.java
Normal file
@ -0,0 +1,8 @@
|
||||
package de.dhbwstuttgart.exceptions;
|
||||
|
||||
public class DebugException extends RuntimeException {
|
||||
|
||||
public DebugException(String message) {
|
||||
System.err.print(message);
|
||||
}
|
||||
}
|
11
src/de/dhbwstuttgart/exceptions/NotImplementedException.java
Normal file
11
src/de/dhbwstuttgart/exceptions/NotImplementedException.java
Normal file
@ -0,0 +1,11 @@
|
||||
package de.dhbwstuttgart.exceptions;
|
||||
|
||||
public class NotImplementedException extends RuntimeException {
|
||||
|
||||
public NotImplementedException() {
|
||||
}
|
||||
|
||||
public NotImplementedException(String string) {
|
||||
super(string);
|
||||
}
|
||||
}
|
10
src/de/dhbwstuttgart/exceptions/ParserError.java
Normal file
10
src/de/dhbwstuttgart/exceptions/ParserError.java
Normal file
@ -0,0 +1,10 @@
|
||||
package de.dhbwstuttgart.exceptions;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class ParserError extends TypeinferenceException{
|
||||
|
||||
public ParserError(Token offset){
|
||||
super("Fehler beim Parsen", offset);
|
||||
}
|
||||
}
|
46
src/de/dhbwstuttgart/exceptions/TypeinferenceException.java
Executable file
46
src/de/dhbwstuttgart/exceptions/TypeinferenceException.java
Executable file
@ -0,0 +1,46 @@
|
||||
package de.dhbwstuttgart.exceptions;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
/**
|
||||
* Eine RuntimeException, welche bei einem Fehler während des Typinferenzalgorithmus ausgelöst wird.
|
||||
* Dies wird zum Beispiel durch Programmierfehler in der Java-Eingabedatei ausgelöst.
|
||||
* @author Andreas Stadelmeier, a10023
|
||||
*
|
||||
*/
|
||||
//TODO: Diese Klasse muss von Exception erben
|
||||
public class TypeinferenceException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Das Offset im Quelltext bei dem das Problem aufgetaucht ist
|
||||
*/
|
||||
private Token offset;
|
||||
private String message;
|
||||
|
||||
public TypeinferenceException(String message, SyntaxTreeNode problemSource)
|
||||
{
|
||||
super(message);
|
||||
this.message=message;
|
||||
if(problemSource == null)throw new DebugException("TypinferenzException ohne Offset: "+this.message);
|
||||
this.offset=problemSource.getOffset();
|
||||
}
|
||||
|
||||
public TypeinferenceException(String message, Token offset){
|
||||
this.message=message;
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return Der Offset an dem im Quellcode der Fehler aufgetreten ist.
|
||||
*/
|
||||
public Token getOffset(){
|
||||
return offset;
|
||||
}
|
||||
|
||||
public String getMessage(){
|
||||
return this.message;
|
||||
}
|
||||
|
||||
}
|
@ -22,7 +22,6 @@ public class JavaTXParser {
|
||||
Java8Parser parser = new Java8Parser(tokens);
|
||||
Java8Parser.CompilationUnitContext tree = parser.compilationUnit();
|
||||
|
||||
|
||||
SyntaxTreeGenerator generator = new SyntaxTreeGenerator(new JavaClassRegistry(generateJavaLangNames()));
|
||||
return generator.convert(tree);
|
||||
}
|
||||
|
57
src/de/dhbwstuttgart/parser/NullToken.java
Normal file
57
src/de/dhbwstuttgart/parser/NullToken.java
Normal file
@ -0,0 +1,57 @@
|
||||
package de.dhbwstuttgart.parser;
|
||||
|
||||
import org.antlr.v4.runtime.CharStream;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.antlr.v4.runtime.TokenSource;
|
||||
|
||||
public class NullToken implements Token {
|
||||
@Override
|
||||
public String getText() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLine() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCharPositionInLine() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getChannel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getTokenIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStartIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStopIndex() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TokenSource getTokenSource() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharStream getInputStream() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -264,7 +264,7 @@ public class SyntaxTreeGenerator{
|
||||
List<FormalParameter> ret = new ArrayList<>();
|
||||
List<Java8Parser.FormalParameterContext> fps = new ArrayList<>();
|
||||
if(formalParameterListContext == null || formalParameterListContext.lastFormalParameter() == null)
|
||||
return new ParameterList(ret); //Dann ist die Parameterliste leer
|
||||
return new ParameterList(ret, new NullToken()); //Dann ist die Parameterliste leer
|
||||
|
||||
if(formalParameterListContext.lastFormalParameter().formalParameter() == null)throw new NotImplementedException();
|
||||
|
||||
@ -284,7 +284,7 @@ public class SyntaxTreeGenerator{
|
||||
}
|
||||
ret.add(new FormalParameter(paramName, type, fp.getStart()));
|
||||
}
|
||||
return new ParameterList(ret);
|
||||
return new ParameterList(ret, ret.get(0).getOffset());
|
||||
}
|
||||
|
||||
private List<MethodModifier> convert(List<Java8Parser.MethodModifierContext> methodModifierContexts) {
|
||||
|
@ -24,6 +24,7 @@ public class ClassOrInterface extends GTVDeclarationContext implements IItemWith
|
||||
|
||||
public ClassOrInterface(Modifiers modifiers, JavaClassName name, List<Field> fielddecl, GenericDeclarationList genericClassParameters,
|
||||
RefTypeOrTPH superClass, Boolean isInterface, List<RefTypeOrTPH> implementedInterfaces, Token offset){
|
||||
super(offset);
|
||||
if(modifiers != null){
|
||||
this.modifiers = modifiers;
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ public class Field extends GTVDeclarationContext implements Generic {
|
||||
private GenericDeclarationList genericParameters;
|
||||
|
||||
public Field(String name, RefTypeOrTPH type, List<? extends FieldModifier> modifier, Token offset){
|
||||
super(offset);
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
@ -9,7 +9,8 @@ public class FormalParameter extends SyntaxTreeNode
|
||||
private String name;
|
||||
|
||||
public FormalParameter(String name, RefTypeOrTPH type, Token offset){
|
||||
this.name = name;
|
||||
super(offset);
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,13 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
/**
|
||||
* Beischreibt eine SyntaxTreeNode, welcher die Eigenschaft besitzt,
|
||||
* dass bei seiner Deklaration auch Generische Typvariablen deklariert wurden.
|
||||
*/
|
||||
public abstract class GTVDeclarationContext extends SyntaxTreeNode {
|
||||
public GTVDeclarationContext(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ public class GenericDeclarationList extends SyntaxTreeNode implements Iterable<G
|
||||
private List<GenericTypeVar> gtvs = new ArrayList<>();
|
||||
|
||||
public GenericDeclarationList(List<GenericTypeVar> values, Token endOffset) {
|
||||
super(endOffset);
|
||||
gtvs = values;
|
||||
this.offsetOfLastElement = endOffset;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -21,11 +22,12 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
* Hier sind die Bounds in Form von Type-Objekten abgespeichert
|
||||
*/
|
||||
List<RefTypeOrTPH> bounds=new ArrayList<RefTypeOrTPH>();
|
||||
private int endOffset;
|
||||
private Token endOffset;
|
||||
private String name;
|
||||
|
||||
public GenericTypeVar(String s, List<RefTypeOrTPH> bounds, int offset, int endOffset)
|
||||
public GenericTypeVar(String s, List<RefTypeOrTPH> bounds, Token offset, Token endOffset)
|
||||
{
|
||||
super(offset);
|
||||
name = s;
|
||||
if(bounds != null)for(RefTypeOrTPH t : bounds){
|
||||
//if(t!=null)this.extendVars.add(t);
|
||||
@ -35,10 +37,6 @@ public class GenericTypeVar extends SyntaxTreeNode
|
||||
this.endOffset = endOffset;
|
||||
}
|
||||
|
||||
public int getEndOffset(){
|
||||
return this.endOffset;
|
||||
}
|
||||
|
||||
public List<RefTypeOrTPH> getBounds()
|
||||
{
|
||||
return bounds;
|
||||
|
@ -3,6 +3,7 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.syntaxtree.modifier.methodModifier.MethodModifier;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
@ -22,7 +23,7 @@ import de.dhbwstuttgart.syntaxtree.statement.Block;
|
||||
public class Method extends Field implements IItemWithOffset
|
||||
{
|
||||
private Block block;
|
||||
public ParameterList parameterlist = new ParameterList(null);
|
||||
public ParameterList parameterlist = new ParameterList(null, new NullToken());
|
||||
private ExceptionList exceptionlist;
|
||||
private String name;
|
||||
|
||||
|
@ -2,6 +2,8 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
|
||||
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@ -10,8 +12,9 @@ public class ParameterList extends SyntaxTreeNode implements Iterable<FormalPara
|
||||
{
|
||||
public List<FormalParameter> formalparameter;
|
||||
|
||||
public ParameterList(List<FormalParameter> params){
|
||||
this.formalparameter = params;
|
||||
public ParameterList(List<FormalParameter> params, Token offset){
|
||||
super(offset);
|
||||
this.formalparameter = params;
|
||||
}
|
||||
|
||||
public FormalParameter getParameterAt(int i)
|
||||
|
@ -2,6 +2,7 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.parser.NullToken;
|
||||
import de.dhbwstuttgart.typecheck.JavaClassName;
|
||||
|
||||
|
||||
@ -16,6 +17,7 @@ public class SourceFile extends SyntaxTreeNode{
|
||||
* SourceFile stellt dabei den Wurzelknoten des Syntaxbaumes dar.
|
||||
*/
|
||||
public SourceFile(String pkgName,List<ClassOrInterface> classDefinitions,List<JavaClassName> imports){
|
||||
super(new NullToken());
|
||||
this.KlassenVektor = classDefinitions;
|
||||
if(pkgName != null){
|
||||
this.pkgName = pkgName;
|
||||
|
@ -3,7 +3,16 @@ package de.dhbwstuttgart.syntaxtree;
|
||||
import java.util.List;
|
||||
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public abstract class SyntaxTreeNode implements IItemWithOffset{
|
||||
private final Token offset;
|
||||
|
||||
public SyntaxTreeNode(Token offset){
|
||||
this.offset = offset;
|
||||
}
|
||||
|
||||
public Token getOffset(){
|
||||
return offset;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.Constants;
|
||||
import org.apache.bcel.generic.ArithmeticInstruction;
|
||||
import org.apache.bcel.generic.DUP;
|
||||
@ -15,8 +16,8 @@ import org.apache.bcel.generic.ObjectType;
|
||||
|
||||
public abstract class AddOp extends Operator
|
||||
{
|
||||
public AddOp(int offset, int variableLength)
|
||||
{
|
||||
public AddOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.ArithmeticInstruction;
|
||||
import org.apache.bcel.generic.DADD;
|
||||
import org.apache.bcel.generic.DDIV;
|
||||
@ -19,7 +20,7 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class DivideOp extends MulOp
|
||||
{
|
||||
public DivideOp(int offset, int variableLength)
|
||||
{
|
||||
public DivideOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.BranchInstruction;
|
||||
import org.apache.bcel.generic.IF_ICMPNE;
|
||||
|
||||
|
||||
public class EqualOp extends RelOp
|
||||
{
|
||||
public EqualOp(int offset, int variableLength)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
public EqualOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.BranchInstruction;
|
||||
import org.apache.bcel.generic.IF_ICMPLT;
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
@ -11,9 +12,8 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class GreaterEquOp extends RelOp
|
||||
{
|
||||
public GreaterEquOp(int offset, int variableLength)
|
||||
{
|
||||
|
||||
public GreaterEquOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.BranchInstruction;
|
||||
import org.apache.bcel.generic.IF_ICMPLE;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
@ -9,8 +10,9 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class GreaterOp extends RelOp
|
||||
{
|
||||
public GreaterOp(int offset, int variableLength)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public GreaterOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.BranchInstruction;
|
||||
import org.apache.bcel.generic.IF_ICMPGT;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
@ -10,9 +11,9 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class LessEquOp extends RelOp
|
||||
{
|
||||
public LessEquOp(int offset, int variableLength)
|
||||
{
|
||||
|
||||
|
||||
public LessEquOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.BranchInstruction;
|
||||
import org.apache.bcel.generic.IF_ICMPGE;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
@ -9,8 +10,9 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class LessOp extends RelOp
|
||||
{
|
||||
public LessOp(int offset, int variableLength)
|
||||
public LessOp(Token offset)
|
||||
{
|
||||
super(offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public abstract class LogOp extends Operator
|
||||
|
||||
public LogOp(Token offset)
|
||||
{
|
||||
super(offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,11 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class MinusOp extends AddOp
|
||||
{
|
||||
public MinusOp(int offset, int variableLength)
|
||||
{
|
||||
super(offset,variableLength);
|
||||
public MinusOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.ArithmeticInstruction;
|
||||
import org.apache.bcel.generic.IREM;
|
||||
import de.dhbwstuttgart.syntaxtree.statement.Binary;
|
||||
@ -10,8 +11,9 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class ModuloOp extends MulOp
|
||||
{
|
||||
public ModuloOp(int offset, int variableLength)
|
||||
public ModuloOp(Token offset)
|
||||
{
|
||||
super(offset);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public abstract class MulOp extends Operator
|
||||
{
|
||||
public MulOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class NotEqualOp extends RelOp
|
||||
{
|
||||
public NotEqualOp(int offset, int variableLength)
|
||||
{
|
||||
}
|
||||
|
||||
public NotEqualOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -2,8 +2,12 @@ package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public abstract class Operator extends SyntaxTreeNode
|
||||
{
|
||||
|
||||
public Operator(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public class PlusOp extends AddOp
|
||||
{
|
||||
public PlusOp(int offset, int variableLength)
|
||||
public PlusOp(Token offset)
|
||||
{
|
||||
super(offset,variableLength);
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,11 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
public abstract class RelOp extends Operator
|
||||
{
|
||||
|
||||
|
||||
public RelOp(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package de.dhbwstuttgart.syntaxtree.operator;
|
||||
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.ArithmeticInstruction;
|
||||
import org.apache.bcel.generic.DMUL;
|
||||
import org.apache.bcel.generic.FMUL;
|
||||
@ -11,8 +12,9 @@ import de.dhbwstuttgart.syntaxtree.statement.Expr;
|
||||
|
||||
public class TimesOp extends MulOp
|
||||
{
|
||||
public TimesOp(int offset,int variableLength)
|
||||
public TimesOp(Token offset)
|
||||
{
|
||||
super(offset);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2,13 +2,14 @@ package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ArgumentList extends SyntaxTreeNode
|
||||
{
|
||||
public ArgumentList(int offset) {
|
||||
|
||||
public ArgumentList(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
|
||||
public List<Expr> expr;
|
||||
|
@ -1,10 +1,11 @@
|
||||
|
||||
package de.dhbwstuttgart.syntaxtree.statement;
|
||||
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
public interface Expr
|
||||
public interface Expr extends IItemWithOffset
|
||||
{
|
||||
}
|
||||
|
@ -9,6 +9,6 @@ import org.antlr.v4.runtime.Token;
|
||||
public class Expression extends SyntaxTreeNode implements Expr
|
||||
{
|
||||
public Expression(RefTypeOrTPH type, Token offset){
|
||||
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
import org.apache.bcel.generic.ClassGen;
|
||||
import org.apache.bcel.generic.InstructionList;
|
||||
|
||||
@ -13,8 +14,9 @@ import org.apache.bcel.generic.InstructionList;
|
||||
public class InstVar extends SyntaxTreeNode implements Expr
|
||||
{
|
||||
private Expr expr;
|
||||
public InstVar(Expr instanz, String name, int offset)
|
||||
public InstVar(Expr instanz, String name, Token offset)
|
||||
{
|
||||
super(offset);
|
||||
expr = instanz;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ public abstract class Statement extends SyntaxTreeNode
|
||||
|
||||
public Statement(RefTypeOrTPH type, Token offset)
|
||||
{
|
||||
super(offset);
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import de.dhbwstuttgart.syntaxtree.SyntaxTreeNode;
|
||||
public class UnaryPlus extends SyntaxTreeNode implements Expr
|
||||
{
|
||||
public UnaryPlus(Expr expression){
|
||||
super(expression.getOffset());
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,7 @@ public class RefType extends RefTypeOrTPH
|
||||
|
||||
public RefType(JavaClassName fullyQualifiedName, Token offset)
|
||||
{
|
||||
super(offset);
|
||||
this.name = (fullyQualifiedName);
|
||||
}
|
||||
|
||||
|
@ -8,5 +8,9 @@ import org.antlr.v4.runtime.Token;
|
||||
|
||||
|
||||
public abstract class RefTypeOrTPH extends SyntaxTreeNode
|
||||
{ }
|
||||
{
|
||||
public RefTypeOrTPH(Token offset) {
|
||||
super(offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,13 @@ public class TypePlaceholder extends RefTypeOrTPH
|
||||
|
||||
|
||||
/**
|
||||
* Privater Konstruktor - Eine TypePlaceholder-Variable wird �ber die
|
||||
* Privater Konstruktor - Eine TypePlaceholder-Variable wird �ber die
|
||||
* Factory-Methode <code>fresh()</code> erzeugt.
|
||||
* <br>Author: J�rg B�uerle
|
||||
*/
|
||||
private TypePlaceholder(String name)
|
||||
private TypePlaceholder(String name, Token offset)
|
||||
{
|
||||
super(offset);
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
109
src/de/dhbwstuttgart/typeinference/Pair.java
Executable file
109
src/de/dhbwstuttgart/typeinference/Pair.java
Executable file
@ -0,0 +1,109 @@
|
||||
package de.dhbwstuttgart.typeinference;
|
||||
import java.io.Serializable;
|
||||
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.syntaxtree.type.RefType;
|
||||
import de.dhbwstuttgart.syntaxtree.type.TypePlaceholder;
|
||||
import de.dhbwstuttgart.syntaxtree.type.WildcardType;
|
||||
|
||||
|
||||
public class Pair implements Serializable
|
||||
{
|
||||
public RefTypeOrTPH TA1;
|
||||
public RefTypeOrTPH TA2;
|
||||
|
||||
private PairOperator eOperator = PairOperator.SMALLER;
|
||||
|
||||
public Pair( RefTypeOrTPH TA1, RefTypeOrTPH TA2 )
|
||||
{
|
||||
this.TA1 = TA1;
|
||||
this.TA2 = TA2;
|
||||
eOperator = PairOperator.SMALLER;
|
||||
}
|
||||
|
||||
public Pair( RefTypeOrTPH TA1, RefTypeOrTPH TA2, PairOperator eOp)
|
||||
{
|
||||
// Konstruktor
|
||||
this(TA1,TA2);
|
||||
this.eOperator = eOp;
|
||||
}
|
||||
|
||||
public String toString()
|
||||
{
|
||||
// otth: Gibt ein Paar als String aus --> zum Debuggen und Vergleichen
|
||||
String strElement1 = "NULL";
|
||||
String strElement2 = "NULL";
|
||||
String Operator = "<.";
|
||||
|
||||
if( TA1 != null )
|
||||
strElement1 = TA1.toString();
|
||||
|
||||
if( TA2 != null )
|
||||
strElement2 = TA2.toString();
|
||||
|
||||
if(OperatorEqual())
|
||||
Operator = "=";
|
||||
if(OperatorSmaller())
|
||||
Operator = "<.";
|
||||
if(OperatorSmallerExtends())
|
||||
Operator = "<?";
|
||||
|
||||
return "\n(" + strElement1 + " " + Operator + " " + strElement2 + ")";
|
||||
|
||||
/*- Equals: " + bEqual*/
|
||||
}
|
||||
|
||||
/**
|
||||
* <br/>Author: J�rg B�uerle
|
||||
* @param obj
|
||||
* @return
|
||||
*/
|
||||
public boolean equals(Object obj)
|
||||
{
|
||||
boolean ret = true;
|
||||
ret &= (obj instanceof Pair);
|
||||
if(!ret)return ret;
|
||||
ret &= ((Pair)obj).TA1.equals(this.TA1);
|
||||
ret &= ((Pair)obj).TA2.equals(this.TA2);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Abfrage, ob Operator vom Typ Equal ist.
|
||||
*/
|
||||
public boolean OperatorEqual()
|
||||
{
|
||||
return eOperator == PairOperator.EQUALSDOT;
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Abfrage, ob Operator vom Typ Smaller ist.
|
||||
*/
|
||||
public boolean OperatorSmaller()
|
||||
{
|
||||
return eOperator == PairOperator.SMALLER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Abfrage, ob Operator vom Typ SmallerExtends ist.
|
||||
*/
|
||||
public boolean OperatorSmallerExtends()
|
||||
{
|
||||
return eOperator == PairOperator.SMALLERDOTWC;
|
||||
}
|
||||
|
||||
/**
|
||||
* Author: Arne Lüdtke<br/>
|
||||
* Gibt den Operator zurück.
|
||||
*/
|
||||
public PairOperator GetOperator()
|
||||
{
|
||||
return eOperator;
|
||||
}
|
||||
|
||||
}
|
||||
// ino.end
|
@ -0,0 +1,23 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations;
|
||||
|
||||
/**
|
||||
* Implements set operations using google guava.
|
||||
* @author DH10STF
|
||||
*
|
||||
*/
|
||||
public class GuavaSetOperations implements ISetOperations {
|
||||
|
||||
@Override
|
||||
public <B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets) {
|
||||
// Wraps the call to google guava
|
||||
return Sets.cartesianProduct(sets);
|
||||
}
|
||||
|
||||
}
|
72
src/de/dhbwstuttgart/typeinference/unify/Mapping.java
Normal file
72
src/de/dhbwstuttgart/typeinference/unify/Mapping.java
Normal file
@ -0,0 +1,72 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.Pair;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
|
||||
public class Mapping {
|
||||
|
||||
private HashMap<de.dhbwstuttgart.typeinference.unify.model.UnifyType, de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH> backwardMap = new HashMap<>();
|
||||
private HashMap<de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH, de.dhbwstuttgart.typeinference.unify.model.UnifyType> forwardMap = new HashMap<>();
|
||||
private Set<de.dhbwstuttgart.typeinference.unify.model.UnifyType> irreversible = new HashSet<>();
|
||||
|
||||
public Mapping(Set<de.dhbwstuttgart.syntaxtree.type.RefType> types) {
|
||||
for(de.dhbwstuttgart.syntaxtree.type.RefType t : types) {
|
||||
}
|
||||
}
|
||||
|
||||
public de.dhbwstuttgart.typeinference.unify.model.UnifyType map(de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH type) {
|
||||
return forwardMap.get(type);
|
||||
}
|
||||
|
||||
public de.dhbwstuttgart.typeinference.unify.model.UnifyPair map(de.dhbwstuttgart.typeinference.Pair pair) {
|
||||
return new de.dhbwstuttgart.typeinference.unify.model.UnifyPair(forwardMap.get(pair.TA1), forwardMap.get(pair.TA2), mapOp(pair.GetOperator()));
|
||||
}
|
||||
|
||||
public Set<de.dhbwstuttgart.typeinference.unify.model.UnifyType> mapTypeSet(Set<de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH> types) {
|
||||
return types.stream().map(this::map).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
public Set<de.dhbwstuttgart.typeinference.unify.model.UnifyPair> mapPairSet(Set<de.dhbwstuttgart.typeinference.Pair> pairs) {
|
||||
return pairs.stream().map(this::map).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
public Optional<de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH> unmap(de.dhbwstuttgart.typeinference.unify.model.UnifyType type) {
|
||||
return irreversible.contains(type) ? Optional.of(backwardMap.get(type)) : Optional.empty();
|
||||
}
|
||||
|
||||
public Optional<Pair> unmap(de.dhbwstuttgart.typeinference.unify.model.UnifyPair mpair) {
|
||||
de.dhbwstuttgart.typeinference.unify.model.UnifyType lhs = mpair.getLhsType();
|
||||
de.dhbwstuttgart.typeinference.unify.model.UnifyType rhs = mpair.getRhsType();
|
||||
|
||||
if(irreversible.contains(lhs) || irreversible.contains(rhs))
|
||||
return Optional.empty();
|
||||
return Optional.of(new Pair(backwardMap.get(lhs), backwardMap.get(rhs), unmapOp(mpair.getPairOp())));
|
||||
}
|
||||
|
||||
public Optional<Set<de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH>> unmapTypeSet(Set<de.dhbwstuttgart.typeinference.unify.model.UnifyType> types) {
|
||||
Set<de.dhbwstuttgart.syntaxtree.type.RefTypeOrTPH> result = types.stream().map(this::unmap).filter(x -> x.isPresent()).map(x -> x.get()).collect(Collectors.toCollection(HashSet::new));
|
||||
return result.size() == types.size() ? Optional.of(result) : Optional.empty();
|
||||
}
|
||||
|
||||
public Optional<Set<de.dhbwstuttgart.typeinference.Pair>> unmapPairSet(Set<de.dhbwstuttgart.typeinference.unify.model.UnifyPair> pairs) {
|
||||
Set<de.dhbwstuttgart.typeinference.Pair> result = pairs.stream().map(this::unmap).filter(x -> x.isPresent()).map(x -> x.get()).collect(Collectors.toCollection(HashSet::new));
|
||||
return result.size() == pairs.size() ? Optional.of(result) : Optional.empty();
|
||||
}
|
||||
|
||||
private PairOperator mapOp(PairOperator op) {
|
||||
//TODO: Methode kann entfernt werden:
|
||||
return op;
|
||||
}
|
||||
|
||||
private PairOperator unmapOp(PairOperator op) {
|
||||
//TODO: Methode kann entfernt werden:
|
||||
return op;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||
|
||||
/**
|
||||
* Implementation of the Martelli-Montanari unification algorithm.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class MartelliMontanariUnify implements IUnify {
|
||||
|
||||
@Override
|
||||
public Optional<Unifier> unify(Set<UnifyType> terms) {
|
||||
// Sets with less than 2 terms are trivially unified
|
||||
if(terms.size() < 2)
|
||||
return Optional.of(Unifier.identity());
|
||||
|
||||
// For the the set of terms {t1,...,tn},
|
||||
// build a list of equations {(t1 = t2), (t2 = t3), (t3 = t4), ....}
|
||||
ArrayList<UnifyPair> termsList = new ArrayList<UnifyPair>();
|
||||
Iterator<UnifyType> iter = terms.iterator();
|
||||
UnifyType prev = iter.next();
|
||||
while(iter.hasNext()) {
|
||||
UnifyType next = iter.next();
|
||||
termsList.add(new UnifyPair(prev, next, PairOperator.EQUALSDOT));
|
||||
prev = next;
|
||||
}
|
||||
|
||||
// Start with the identity unifier. Substitutions will be added later.
|
||||
Unifier mgu = Unifier.identity();
|
||||
|
||||
// Apply rules while possible
|
||||
int idx = 0;
|
||||
while(idx < termsList.size()) {
|
||||
UnifyPair pair = termsList.get(idx);
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
TypeParams rhsTypeParams = rhsType.getTypeParams();
|
||||
TypeParams lhsTypeParams = lhsType.getTypeParams();
|
||||
|
||||
// REDUCE - Rule
|
||||
if(!(rhsType instanceof PlaceholderType) && !(lhsType instanceof PlaceholderType)) {
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
|
||||
// f<...> = g<...> with f != g are not unifiable
|
||||
if(!rhsType.getName().equals(lhsType.getName()))
|
||||
return Optional.empty(); // conflict
|
||||
// f<t1,...,tn> = f<s1,...,sm> are not unifiable
|
||||
if(rhsTypeParams.size() != lhsTypeParams.size())
|
||||
return Optional.empty(); // conflict
|
||||
// f = g is not unifiable (cannot be f = f because erase rule would have been applied)
|
||||
//if(rhsTypeParams.size() == 0)
|
||||
//return Optional.empty();
|
||||
|
||||
// Unpack the arguments
|
||||
for(int i = 0; i < rhsTypeParams.size(); i++)
|
||||
result.add(new UnifyPair(rhsTypeParams.get(i), lhsTypeParams.get(i), PairOperator.EQUALSDOT));
|
||||
|
||||
termsList.remove(idx);
|
||||
termsList.addAll(result);
|
||||
continue;
|
||||
}
|
||||
|
||||
// DELETE - Rule
|
||||
if(pair.getRhsType().equals(pair.getLhsType())) {
|
||||
termsList.remove(idx);
|
||||
continue;
|
||||
}
|
||||
|
||||
// SWAP - Rule
|
||||
if(!(lhsType instanceof PlaceholderType) && (rhsType instanceof PlaceholderType)) {
|
||||
termsList.remove(idx);
|
||||
termsList.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT));
|
||||
continue;
|
||||
}
|
||||
|
||||
// OCCURS-CHECK
|
||||
if(pair.getLhsType() instanceof PlaceholderType
|
||||
&& pair.getRhsType().getTypeParams().occurs((PlaceholderType) pair.getLhsType()))
|
||||
return Optional.empty();
|
||||
|
||||
// SUBST - Rule
|
||||
if(lhsType instanceof PlaceholderType) {
|
||||
mgu.add((PlaceholderType) lhsType, rhsType);
|
||||
termsList = termsList.stream().map(mgu::apply).collect(Collectors.toCollection(ArrayList::new));
|
||||
idx = idx+1 == termsList.size() ? 0 : idx+1;
|
||||
continue;
|
||||
}
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
return Optional.of(mgu);
|
||||
}
|
||||
}
|
833
src/de/dhbwstuttgart/typeinference/unify/RuleSet.java
Normal file
833
src/de/dhbwstuttgart/typeinference/unify/RuleSet.java
Normal file
@ -0,0 +1,833 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Optional;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.Stack;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.exceptions.DebugException;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.WildcardType;
|
||||
|
||||
/**
|
||||
* Implementation of the type inference rules.
|
||||
* @author Florian Steurer
|
||||
*
|
||||
*/
|
||||
public class RuleSet implements IRuleSet{
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceUp(UnifyPair pair) {
|
||||
// Check if reduce up is applicable
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(rhsType instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
// Rule is applicable, unpack the SuperType
|
||||
return Optional.of(new UnifyPair(lhsType, ((SuperType) rhsType).getSuperedType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceLow(UnifyPair pair) {
|
||||
// Check if rule is applicable
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
if(!(lhsType instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
// Rule is applicable, unpack the ExtendsType
|
||||
return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), rhsType, PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceUpLow(UnifyPair pair) {
|
||||
// Check if rule is applicable
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
if(!(lhsType instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(rhsType instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
// Rule is applicable, unpack both sides
|
||||
return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(),((SuperType) rhsType).getSuperedType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceExt(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType x = pair.getLhsType();
|
||||
UnifyType sTypeX;
|
||||
|
||||
if(x instanceof ReferenceType)
|
||||
sTypeX = x;
|
||||
else if(x instanceof ExtendsType)
|
||||
sTypeX = ((ExtendsType) x).getExtendedType();
|
||||
else
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType extY = pair.getRhsType();
|
||||
|
||||
if(!(extY instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
if(x.getTypeParams().empty() || extY.getTypeParams().size() != x.getTypeParams().size())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType xFromFc = fc.getLeftHandedType(sTypeX.getName()).orElse(null);
|
||||
|
||||
if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders())
|
||||
return Optional.empty();
|
||||
|
||||
if(x instanceof ExtendsType)
|
||||
xFromFc = new ExtendsType(xFromFc);
|
||||
|
||||
UnifyType extYFromFc = fc.grArg(xFromFc).stream().filter(t -> t.getName().equals(extY.getName())).filter(t -> t.getTypeParams().arePlaceholders()).findAny().orElse(null);
|
||||
|
||||
if(extYFromFc == null || extYFromFc.getTypeParams() != xFromFc.getTypeParams())
|
||||
return Optional.empty();
|
||||
|
||||
TypeParams extYParams = extY.getTypeParams();
|
||||
TypeParams xParams = x.getTypeParams();
|
||||
|
||||
int[] pi = pi(xParams, extYParams);
|
||||
|
||||
if(pi.length == 0)
|
||||
return Optional.empty();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
|
||||
for(int rhsIdx = 0; rhsIdx < extYParams.size(); rhsIdx++)
|
||||
result.add(new UnifyPair(xParams.get(pi[rhsIdx]), extYParams.get(rhsIdx), PairOperator.SMALLERDOTWC));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceSup(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType x = pair.getLhsType();
|
||||
UnifyType sTypeX;
|
||||
|
||||
if(x instanceof ReferenceType)
|
||||
sTypeX = x;
|
||||
else if(x instanceof SuperType)
|
||||
sTypeX = ((SuperType) x).getSuperedType();
|
||||
else
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType supY = pair.getRhsType();
|
||||
|
||||
if(!(supY instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
if(x.getTypeParams().empty() || supY.getTypeParams().size() != x.getTypeParams().size())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType xFromFc = fc.getLeftHandedType(sTypeX.getName()).orElse(null);
|
||||
|
||||
if(xFromFc == null || !xFromFc.getTypeParams().arePlaceholders())
|
||||
return Optional.empty();
|
||||
|
||||
if(x instanceof SuperType)
|
||||
xFromFc = new SuperType(xFromFc);
|
||||
|
||||
UnifyType supYFromFc = fc.grArg(xFromFc).stream().filter(t -> t.getName().equals(supY.getName())).filter(t -> t.getTypeParams().arePlaceholders()).findAny().orElse(null);
|
||||
|
||||
if(supYFromFc == null || supYFromFc.getTypeParams() != xFromFc.getTypeParams())
|
||||
return Optional.empty();
|
||||
|
||||
TypeParams supYParams = supY.getTypeParams();
|
||||
TypeParams xParams = x.getTypeParams();
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
|
||||
int[] pi = pi(xParams, supYParams);
|
||||
|
||||
if(pi.length == 0)
|
||||
return Optional.empty();
|
||||
|
||||
for(int rhsIdx = 0; rhsIdx < supYParams.size(); rhsIdx++)
|
||||
result.add(new UnifyPair(supYParams.get(rhsIdx), xParams.get(pi[rhsIdx]), PairOperator.SMALLERDOTWC));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceEq(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
if(lhsType instanceof PlaceholderType || lhsType.getTypeParams().empty())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
if(!rhsType.getName().equals(lhsType.getName()))
|
||||
return Optional.empty();
|
||||
|
||||
if(rhsType instanceof PlaceholderType || lhsType instanceof PlaceholderType || rhsType.getTypeParams().empty())
|
||||
return Optional.empty();
|
||||
|
||||
if(rhsType.getTypeParams().size() != lhsType.getTypeParams().size())
|
||||
return Optional.empty();
|
||||
|
||||
// Keine Permutation wie im Paper nötig
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
TypeParams lhsTypeParams = lhsType.getTypeParams();
|
||||
TypeParams rhsTypeParams = rhsType.getTypeParams();
|
||||
|
||||
for(int i = 0; i < lhsTypeParams.size(); i++)
|
||||
result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduce1(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType c = pair.getLhsType();
|
||||
if(!(c instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType d = pair.getRhsType();
|
||||
if(!(d instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
ReferenceType lhsSType = (ReferenceType) c;
|
||||
ReferenceType rhsSType = (ReferenceType) d;
|
||||
|
||||
if(lhsSType.getTypeParams().empty() || lhsSType.getTypeParams().size() != rhsSType.getTypeParams().size())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType cFromFc = fc.getLeftHandedType(c.getName()).orElse(null);
|
||||
|
||||
if(cFromFc == null || !cFromFc.getTypeParams().arePlaceholders())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType dFromFc = fc.getAncestors(cFromFc).stream().filter(x -> x.getName().equals(d.getName())).findAny().orElse(null);
|
||||
|
||||
if(dFromFc == null || !dFromFc.getTypeParams().arePlaceholders() || dFromFc.getTypeParams().size() != cFromFc.getTypeParams().size())
|
||||
return Optional.empty();
|
||||
|
||||
int[] pi = pi(cFromFc.getTypeParams(), dFromFc.getTypeParams());
|
||||
|
||||
if(pi.length == 0)
|
||||
return Optional.empty();
|
||||
|
||||
TypeParams rhsTypeParams = d.getTypeParams();
|
||||
TypeParams lhsTypeParams = c.getTypeParams();
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
|
||||
for(int rhsIdx = 0; rhsIdx < rhsTypeParams.size(); rhsIdx++)
|
||||
result.add(new UnifyPair(lhsTypeParams.get(pi[rhsIdx]), rhsTypeParams.get(rhsIdx), PairOperator.SMALLERDOTWC));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.EQUALSDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
ReferenceType lhsSType;
|
||||
|
||||
if(lhsType instanceof ReferenceType)
|
||||
lhsSType = (ReferenceType) lhsType;
|
||||
else if(lhsType instanceof WildcardType) {
|
||||
UnifyType lhsSTypeRaw = ((WildcardType) lhsType).getWildcardedType();
|
||||
if(lhsSTypeRaw instanceof ReferenceType)
|
||||
lhsSType = (ReferenceType) lhsSTypeRaw;
|
||||
else
|
||||
return Optional.empty();
|
||||
}
|
||||
else
|
||||
return Optional.empty();
|
||||
|
||||
if(lhsSType.getTypeParams().empty())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
ReferenceType rhsSType;
|
||||
|
||||
if(rhsType instanceof ReferenceType)
|
||||
rhsSType = (ReferenceType) rhsType;
|
||||
else if(rhsType instanceof WildcardType) {
|
||||
UnifyType rhsSTypeRaw = ((WildcardType) rhsType).getWildcardedType();
|
||||
if(rhsSTypeRaw instanceof ReferenceType)
|
||||
rhsSType = (ReferenceType) rhsSTypeRaw;
|
||||
else
|
||||
return Optional.empty();
|
||||
}
|
||||
else
|
||||
return Optional.empty();
|
||||
|
||||
if(!rhsSType.getName().equals(lhsSType.getName()))
|
||||
return Optional.empty();
|
||||
|
||||
if(!(lhsSType.getTypeParams().size()==rhsSType.getTypeParams().size()))throw new DebugException("Fehler in Unifizierung");
|
||||
//if(rhsSType.getTypeParams().size() != lhsSType.getTypeParams().size())
|
||||
// return Optional.empty();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
|
||||
TypeParams rhsTypeParams = rhsSType.getTypeParams();
|
||||
TypeParams lhsTypeParams = lhsSType.getTypeParams();
|
||||
for(int i = 0; i < rhsTypeParams.size(); i++)
|
||||
result.add(new UnifyPair(lhsTypeParams.get(i), rhsTypeParams.get(i), PairOperator.EQUALSDOT));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean erase1(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return false;
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
if(!(lhsType instanceof ReferenceType) && !(lhsType instanceof PlaceholderType))
|
||||
return false;
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(rhsType instanceof ReferenceType) && !(rhsType instanceof PlaceholderType))
|
||||
return false;
|
||||
|
||||
return fc.greater(lhsType).contains(rhsType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean erase2(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return false;
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
return fc.grArg(lhsType).contains(rhsType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean erase3(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.EQUALSDOT)
|
||||
return false;
|
||||
|
||||
return pair.getLhsType().equals(pair.getRhsType());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> swap(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.EQUALSDOT)
|
||||
return Optional.empty();
|
||||
|
||||
if(pair.getLhsType() instanceof PlaceholderType)
|
||||
return Optional.empty();
|
||||
|
||||
if(!(pair.getRhsType() instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(pair.getRhsType(), pair.getLhsType(), PairOperator.EQUALSDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> adapt(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeD = pair.getLhsType();
|
||||
if(!(typeD instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeDs = pair.getRhsType();
|
||||
if(!(typeDs instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
/*if(typeD.getTypeParams().size() == 0 || typeDs.getTypeParams().size() == 0)
|
||||
return Optional.empty();*/
|
||||
|
||||
if(typeD.getName().equals(typeDs.getName()))
|
||||
return Optional.empty();
|
||||
|
||||
|
||||
Optional<UnifyType> opt = fc.getLeftHandedType(typeD.getName());
|
||||
if(!opt.isPresent())
|
||||
return Optional.empty();
|
||||
|
||||
// The generic Version of Type D (D<a1, a2, a3, ... >)
|
||||
UnifyType typeDgen = opt.get();
|
||||
|
||||
// Actually greater+ because the types are ensured to have different names
|
||||
Set<UnifyType> greater = fc.getAncestors(typeDgen);
|
||||
opt = greater.stream().filter(x -> x.getName().equals(typeDs.getName())).findAny();
|
||||
|
||||
if(!opt.isPresent())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType newLhs = opt.get();
|
||||
|
||||
TypeParams typeDParams = typeD.getTypeParams();
|
||||
TypeParams typeDgenParams = typeDgen.getTypeParams();
|
||||
|
||||
Unifier unif = Unifier.identity();
|
||||
for(int i = 0; i < typeDParams.size(); i++)
|
||||
unif.add((PlaceholderType) typeDgenParams.get(i), typeDParams.get(i));
|
||||
|
||||
return Optional.of(new UnifyPair(unif.apply(newLhs), typeDs, PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> adaptExt(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeD = pair.getLhsType();
|
||||
if(!(typeD instanceof ReferenceType) && !(typeD instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeExtDs = pair.getRhsType();
|
||||
if(!(typeExtDs instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
if(typeD.getTypeParams().size() == 0 || typeExtDs.getTypeParams().size() == 0)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeDgen;
|
||||
if(typeD instanceof ReferenceType)
|
||||
typeDgen = fc.getLeftHandedType(typeD.getName()).orElse(null);
|
||||
else {
|
||||
Optional<UnifyType> opt = fc.getLeftHandedType(((ExtendsType) typeD).getExtendedType().getName());
|
||||
typeDgen = opt.isPresent() ? new ExtendsType(opt.get()) : null;
|
||||
}
|
||||
|
||||
if(typeDgen == null)
|
||||
return Optional.empty();
|
||||
|
||||
Set<UnifyType> grArg = fc.grArg(typeDgen);
|
||||
|
||||
Optional<UnifyType> opt = grArg.stream().filter(x -> x.getName().equals(typeExtDs.getName())).findAny();
|
||||
|
||||
if(!opt.isPresent())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType newLhs = ((ExtendsType) opt.get()).getExtendedType();
|
||||
|
||||
TypeParams typeDParams = typeD.getTypeParams();
|
||||
TypeParams typeDgenParams = typeDgen.getTypeParams();
|
||||
|
||||
Unifier unif = new Unifier((PlaceholderType) typeDgenParams.get(0), typeDParams.get(0));
|
||||
for(int i = 1; i < typeDParams.size(); i++)
|
||||
unif.add((PlaceholderType) typeDgenParams.get(i), typeDParams.get(i));
|
||||
|
||||
return Optional.of(new UnifyPair(unif.apply(newLhs), typeExtDs, PairOperator.SMALLERDOTWC));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> adaptSup(UnifyPair pair, IFiniteClosure fc) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeDs = pair.getLhsType();
|
||||
if(!(typeDs instanceof ReferenceType) && !(typeDs instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeSupD = pair.getRhsType();
|
||||
if(!(typeSupD instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
if(typeDs.getTypeParams().size() == 0 || typeSupD.getTypeParams().size() == 0)
|
||||
return Optional.empty();
|
||||
|
||||
|
||||
Optional<UnifyType> opt = fc.getLeftHandedType(((SuperType) typeSupD).getSuperedType().getName());
|
||||
|
||||
if(!opt.isPresent())
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType typeDgen = opt.get();
|
||||
UnifyType typeSupDgen = new SuperType(typeDgen);
|
||||
|
||||
// Use of smArg instead of grArg because
|
||||
// a in grArg(b) => b in smArg(a)
|
||||
Set<UnifyType> smArg = fc.smArg(typeSupDgen);
|
||||
opt = smArg.stream().filter(x -> x.getName().equals(typeDs.getName())).findAny();
|
||||
|
||||
if(!opt.isPresent())
|
||||
return Optional.empty();
|
||||
|
||||
// New RHS
|
||||
UnifyType newRhs = null;
|
||||
if(typeDs instanceof ReferenceType)
|
||||
newRhs = new ExtendsType(typeDs);
|
||||
else
|
||||
newRhs = new ExtendsType(((SuperType) typeDs).getSuperedType());
|
||||
|
||||
// New LHS
|
||||
UnifyType newLhs = opt.get();
|
||||
TypeParams typeDParams = typeSupD.getTypeParams();
|
||||
TypeParams typeSupDsgenParams = typeSupDgen.getTypeParams();
|
||||
|
||||
Unifier unif = new Unifier((PlaceholderType) typeSupDsgenParams.get(0), typeDParams.get(0));
|
||||
for(int i = 1; i < typeDParams.size(); i++)
|
||||
unif.add((PlaceholderType) typeSupDsgenParams.get(i), typeDParams.get(i));
|
||||
|
||||
return Optional.of(new UnifyPair(unif.apply(newLhs), newRhs, PairOperator.SMALLERDOTWC));
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the permutation pi of the type arguments of two types based on the finite closure
|
||||
* @param cArgs The type which arguments are permuted
|
||||
* @param dArgs The other type
|
||||
* @return An array containing the values of pi for every type argument of C or an empty array if the search failed.
|
||||
*/
|
||||
private int[] pi(TypeParams cArgs, TypeParams dArgs) {
|
||||
if(!(cArgs.size()==dArgs.size()))throw new DebugException("Fehler in Unifizierung");
|
||||
|
||||
int[] permutation = new int[dArgs.size()];
|
||||
|
||||
boolean succ = true;
|
||||
for (int dArgIdx = 0; dArgIdx < dArgs.size() && succ; dArgIdx++) {
|
||||
UnifyType dArg = dArgs.get(dArgIdx);
|
||||
succ = false;
|
||||
for (int pi = 0; pi < cArgs.size(); pi++)
|
||||
if (cArgs.get(pi).getName().equals(dArg.getName())) {
|
||||
permutation[dArgIdx] = pi;
|
||||
succ = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return succ ? permutation : new int[0];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs) {
|
||||
HashMap<UnifyType, Integer> typeMap = new HashMap<>();
|
||||
|
||||
Stack<UnifyType> occuringTypes = new Stack<>();
|
||||
|
||||
for(UnifyPair pair : pairs) {
|
||||
occuringTypes.push(pair.getLhsType());
|
||||
occuringTypes.push(pair.getRhsType());
|
||||
}
|
||||
|
||||
while(!occuringTypes.isEmpty()) {
|
||||
UnifyType t1 = occuringTypes.pop();
|
||||
if(!typeMap.containsKey(t1))
|
||||
typeMap.put(t1, 0);
|
||||
typeMap.put(t1, typeMap.get(t1)+1);
|
||||
|
||||
if(t1 instanceof ExtendsType)
|
||||
occuringTypes.push(((ExtendsType) t1).getExtendedType());
|
||||
if(t1 instanceof SuperType)
|
||||
occuringTypes.push(((SuperType) t1).getSuperedType());
|
||||
else
|
||||
t1.getTypeParams().forEach(x -> occuringTypes.push(x));
|
||||
}
|
||||
|
||||
Queue<UnifyPair> result1 = new LinkedList<UnifyPair>(pairs);
|
||||
ArrayList<UnifyPair> result = new ArrayList<UnifyPair>();
|
||||
boolean applied = false;
|
||||
|
||||
while(!result1.isEmpty()) {
|
||||
UnifyPair pair = result1.poll();
|
||||
PlaceholderType lhsType = null;
|
||||
UnifyType rhsType;
|
||||
|
||||
if(pair.getPairOp() == PairOperator.EQUALSDOT
|
||||
&& pair.getLhsType() instanceof PlaceholderType)
|
||||
lhsType = (PlaceholderType) pair.getLhsType();
|
||||
if(lhsType != null
|
||||
&& !((rhsType = pair.getRhsType()) instanceof PlaceholderType)
|
||||
&& typeMap.get(lhsType) > 1 // The type occurs in more pairs in the set than just the recent pair.
|
||||
&& !rhsType.getTypeParams().occurs(lhsType)) {
|
||||
Unifier uni = new Unifier(lhsType, rhsType);
|
||||
result = result.stream().map(uni::apply).collect(Collectors.toCollection(ArrayList::new));
|
||||
result1 = result1.stream().map(uni::apply).collect(Collectors.toCollection(LinkedList::new));
|
||||
applied = true;
|
||||
}
|
||||
|
||||
result.add(pair);
|
||||
}
|
||||
|
||||
return applied ? Optional.of(new HashSet<>(result)) : Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), ((ExtendsType) rhsType).getExtendedType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof ReferenceType) || !(rhsType instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(lhsType, ((ExtendsType) rhsType).getExtendedType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardUp(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof SuperType) || !(rhsType instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(((SuperType) rhsType).getSuperedType(), ((SuperType) lhsType).getSuperedType(), PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardUpRight(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof ReferenceType) || !(rhsType instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(((SuperType) rhsType).getSuperedType(), lhsType, PairOperator.SMALLERDOTWC));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardLowUp(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof SuperType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(((ExtendsType) lhsType).getExtendedType(), ((SuperType) rhsType).getSuperedType(), PairOperator.EQUALSDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardUpLow(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof SuperType) || !(rhsType instanceof ExtendsType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(((SuperType) lhsType).getSuperedType(), ((ExtendsType) rhsType).getExtendedType(), PairOperator.EQUALSDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceWildcardLeft(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(rhsType instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
|
||||
if(lhsType instanceof WildcardType)
|
||||
return Optional.of(new UnifyPair(((WildcardType) lhsType).getWildcardedType(), rhsType, PairOperator.EQUALSDOT));
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceFunN(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
if(!(lhsType instanceof FunNType) || !(rhsType instanceof FunNType))
|
||||
return Optional.empty();
|
||||
|
||||
FunNType funNLhsType = (FunNType) lhsType;
|
||||
FunNType funNRhsType = (FunNType) rhsType;
|
||||
|
||||
if(funNLhsType.getN() != funNRhsType.getN())
|
||||
return Optional.empty();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<UnifyPair>();
|
||||
|
||||
result.add(new UnifyPair(funNLhsType.getTypeParams().get(0), funNRhsType.getTypeParams().get(0), PairOperator.SMALLERDOT));
|
||||
for(int i = 1; i < funNLhsType.getTypeParams().size(); i++)
|
||||
result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
if(!(lhsType instanceof FunNType) || !(rhsType instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
FunNType funNLhsType = (FunNType) lhsType;
|
||||
|
||||
Set<UnifyPair> result = new HashSet<UnifyPair>();
|
||||
|
||||
UnifyType[] freshPlaceholders = new UnifyType[funNLhsType.getTypeParams().size()];
|
||||
for(int i = 0; i < freshPlaceholders.length; i++)
|
||||
freshPlaceholders[i] = PlaceholderType.freshPlaceholder();
|
||||
|
||||
result.add(new UnifyPair(funNLhsType.getTypeParams().get(0), freshPlaceholders[0], PairOperator.SMALLERDOT));
|
||||
for(int i = 1; i < funNLhsType.getTypeParams().size(); i++)
|
||||
result.add(new UnifyPair(freshPlaceholders[i], funNLhsType.getTypeParams().get(i), PairOperator.SMALLERDOT));
|
||||
result.add(new UnifyPair(rhsType, funNLhsType.setTypeParams(new TypeParams(freshPlaceholders)), PairOperator.EQUALSDOT));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOT)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
if(!(lhsType instanceof PlaceholderType) || !(rhsType instanceof FunNType))
|
||||
return Optional.empty();
|
||||
|
||||
FunNType funNRhsType = (FunNType) rhsType;
|
||||
|
||||
Set<UnifyPair> result = new HashSet<UnifyPair>();
|
||||
|
||||
UnifyType[] freshPlaceholders = new UnifyType[funNRhsType.getTypeParams().size()];
|
||||
for(int i = 0; i < freshPlaceholders.length; i++)
|
||||
freshPlaceholders[i] = PlaceholderType.freshPlaceholder();
|
||||
|
||||
result.add(new UnifyPair(freshPlaceholders[0], funNRhsType.getTypeParams().get(0), PairOperator.SMALLERDOT));
|
||||
for(int i = 1; i < funNRhsType.getTypeParams().size(); i++)
|
||||
result.add(new UnifyPair(funNRhsType.getTypeParams().get(i), freshPlaceholders[i], PairOperator.SMALLERDOT));
|
||||
result.add(new UnifyPair(lhsType, funNRhsType.setTypeParams(new TypeParams(freshPlaceholders)), PairOperator.EQUALSDOT));
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyPair> reduceTph(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof PlaceholderType) || !(rhsType instanceof ReferenceType))
|
||||
return Optional.empty();
|
||||
|
||||
return Optional.of(new UnifyPair(lhsType, rhsType, PairOperator.EQUALSDOT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceTphExt(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof ExtendsType) || !(rhsType instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType extendedType = ((ExtendsType)lhsType).getExtendedType();
|
||||
|
||||
boolean isGen = extendedType instanceof PlaceholderType && !((PlaceholderType) extendedType).isGenerated();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
if(isGen)
|
||||
result.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT));
|
||||
else {
|
||||
UnifyType freshTph = PlaceholderType.freshPlaceholder();
|
||||
result.add(new UnifyPair(rhsType, new ExtendsType(freshTph), PairOperator.EQUALSDOT));
|
||||
result.add(new UnifyPair(extendedType, freshTph, PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<Set<UnifyPair>> reduceTphSup(UnifyPair pair) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLERDOTWC)
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
if(!(lhsType instanceof SuperType) || !(rhsType instanceof PlaceholderType))
|
||||
return Optional.empty();
|
||||
|
||||
UnifyType superedType = ((SuperType)lhsType).getSuperedType();
|
||||
|
||||
boolean isGen = superedType instanceof PlaceholderType && !((PlaceholderType) superedType).isGenerated();
|
||||
|
||||
Set<UnifyPair> result = new HashSet<>();
|
||||
if(isGen)
|
||||
result.add(new UnifyPair(rhsType, lhsType, PairOperator.EQUALSDOT));
|
||||
else {
|
||||
UnifyType freshTph = PlaceholderType.freshPlaceholder();
|
||||
result.add(new UnifyPair(rhsType, new SuperType(freshTph), PairOperator.EQUALSDOT));
|
||||
result.add(new UnifyPair(freshTph, superedType, PairOperator.SMALLERDOT));
|
||||
}
|
||||
|
||||
return Optional.of(result);
|
||||
}
|
||||
}
|
24
src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
Normal file
24
src/de/dhbwstuttgart/typeinference/unify/TypeUnify.java
Normal file
@ -0,0 +1,24 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ForkJoinPool;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
|
||||
public class TypeUnify {
|
||||
public Set<Set<UnifyPair>> unify(Set<UnifyPair> eq, IFiniteClosure fc) {
|
||||
TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, true);
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
pool.invoke(unifyTask);
|
||||
Set<Set<UnifyPair>> res = unifyTask.join();
|
||||
return res;
|
||||
}
|
||||
|
||||
public Set<Set<UnifyPair>> unifySequential(Set<UnifyPair> eq, IFiniteClosure fc) {
|
||||
TypeUnifyTask unifyTask = new TypeUnifyTask(eq, fc, false);
|
||||
Set<Set<UnifyPair>> res = unifyTask.compute();
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
626
src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Normal file
626
src/de/dhbwstuttgart/typeinference/unify/TypeUnifyTask.java
Normal file
@ -0,0 +1,626 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.RecursiveTask;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IRuleSet;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.ISetOperations;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.TypeParams;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||
|
||||
|
||||
/**
|
||||
* Implementation of the type unification algorithm
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class TypeUnifyTask extends RecursiveTask<Set<Set<UnifyPair>>> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* The implementation of setOps that will be used during the unification
|
||||
*/
|
||||
protected ISetOperations setOps = new GuavaSetOperations();
|
||||
|
||||
/**
|
||||
* The implementation of the standard unify that will be used during the unification
|
||||
*/
|
||||
protected IUnify stdUnify = new MartelliMontanariUnify();
|
||||
|
||||
/**
|
||||
* The implementation of the rules that will be used during the unification.
|
||||
*/
|
||||
protected IRuleSet rules = new RuleSet();
|
||||
|
||||
protected Set<UnifyPair> eq;
|
||||
|
||||
protected IFiniteClosure fc;
|
||||
|
||||
protected boolean parallel;
|
||||
|
||||
public TypeUnifyTask(Set<UnifyPair> eq, IFiniteClosure fc, boolean parallel) {
|
||||
this.eq = eq;
|
||||
this.fc = fc;
|
||||
this.parallel = parallel;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<Set<UnifyPair>> compute() {
|
||||
return unify(eq, fc, parallel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes all principal type unifiers for a set of constraints.
|
||||
* @param eq The set of constraints
|
||||
* @param fc The finite closure
|
||||
* @return The set of all principal type unifiers
|
||||
*/
|
||||
protected Set<Set<UnifyPair>> unify(Set<UnifyPair> eq, IFiniteClosure fc, boolean parallel) {
|
||||
/*
|
||||
* Step 1: Repeated application of reduce, adapt, erase, swap
|
||||
*/
|
||||
Set<UnifyPair> eq0 = applyTypeUnificationRules(eq, fc);
|
||||
|
||||
/*
|
||||
* Step 2 and 3: Create a subset eq1s of pairs where both sides are TPH and eq2s of the other pairs
|
||||
*/
|
||||
Set<UnifyPair> eq1s = new HashSet<>();
|
||||
Set<UnifyPair> eq2s = new HashSet<>();
|
||||
splitEq(eq0, eq1s, eq2s);
|
||||
|
||||
/*
|
||||
* Step 4: Create possible typings
|
||||
*
|
||||
* "Manche Autoren identifizieren die Paare (a, (b,c)) und ((a,b),c)
|
||||
* mit dem geordneten Tripel (a,b,c), wodurch das kartesische Produkt auch assoziativ wird." - Wikipedia
|
||||
*/
|
||||
|
||||
// There are up to 10 toplevel set. 8 of 10 are the result of the
|
||||
// cartesian product of the sets created by pattern matching.
|
||||
List<Set<Set<UnifyPair>>> topLevelSets = new ArrayList<>();
|
||||
|
||||
if(eq1s.size() != 0) { // Do not add empty sets or the cartesian product will always be empty.
|
||||
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
||||
wrap.add(eq1s);
|
||||
topLevelSets.add(wrap); // Add Eq1'
|
||||
}
|
||||
|
||||
// Add the set of [a =. Theta | (a=. Theta) in Eq2']
|
||||
Set<UnifyPair> bufferSet = eq2s.stream()
|
||||
.filter(x -> x.getPairOp() == PairOperator.EQUALSDOT && x.getLhsType() instanceof PlaceholderType)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
if(bufferSet.size() != 0) { // Do not add empty sets or the cartesian product will always be empty.
|
||||
Set<Set<UnifyPair>> wrap = new HashSet<>();
|
||||
wrap.add(bufferSet);
|
||||
topLevelSets.add(wrap);
|
||||
eq2s.removeAll(bufferSet);
|
||||
}
|
||||
|
||||
// Sets that originate from pair pattern matching
|
||||
// Sets of the "second level"
|
||||
Set<UnifyPair> undefinedPairs = new HashSet<>();
|
||||
Set<Set<Set<Set<UnifyPair>>>> secondLevelSets = calculatePairSets(eq2s, fc, undefinedPairs);
|
||||
|
||||
// If pairs occured that did not match one of the cartesian product cases,
|
||||
// those pairs are contradictory and the unification is impossible.
|
||||
if(!undefinedPairs.isEmpty())
|
||||
return new HashSet<>();
|
||||
|
||||
/* Up to here, no cartesian products are calculated.
|
||||
* filters for pairs and sets can be applied here */
|
||||
|
||||
// Sub cartesian products of the second level (pattern matched) sets
|
||||
// "the big (x)"
|
||||
for(Set<Set<Set<UnifyPair>>> secondLevelSet : secondLevelSets) {
|
||||
List<Set<Set<UnifyPair>>> secondLevelSetList = new ArrayList<>(secondLevelSet);
|
||||
Set<List<Set<UnifyPair>>> cartResult = setOps.cartesianProduct(secondLevelSetList);
|
||||
|
||||
// Flatten and add to top level sets
|
||||
Set<Set<UnifyPair>> flat = new HashSet<>();
|
||||
for(List<Set<UnifyPair>> s : cartResult) {
|
||||
Set<UnifyPair> flat1 = new HashSet<>();
|
||||
for(Set<UnifyPair> s1 : s)
|
||||
flat1.addAll(s1);
|
||||
flat.add(flat1);
|
||||
}
|
||||
topLevelSets.add(flat);
|
||||
}
|
||||
|
||||
// Cartesian product over all (up to 10) top level sets
|
||||
Set<Set<Set<UnifyPair>>> eqPrimeSet = setOps.cartesianProduct(topLevelSets)
|
||||
.stream().map(x -> new HashSet<>(x))
|
||||
.collect(Collectors.toCollection(HashSet::new));
|
||||
//System.out.println(result);
|
||||
|
||||
Set<Set<UnifyPair>> eqPrimePrimeSet = new HashSet<>();
|
||||
|
||||
Set<TypeUnifyTask> forks = new HashSet<>();
|
||||
for(Set<Set<UnifyPair>> setToFlatten : eqPrimeSet) {
|
||||
// Flatten the cartesian product
|
||||
Set<UnifyPair> eqPrime = new HashSet<>();
|
||||
setToFlatten.stream().forEach(x -> eqPrime.addAll(x));
|
||||
|
||||
/*
|
||||
* Step 5: Substitution
|
||||
*/
|
||||
Optional<Set<UnifyPair>> eqPrimePrime = rules.subst(eqPrime);
|
||||
|
||||
|
||||
/*
|
||||
* Step 6 a) Restart (fork) for pairs where subst was applied
|
||||
*/
|
||||
if(parallel) {
|
||||
if (eqPrime.equals(eq))
|
||||
eqPrimePrimeSet.add(eqPrime);
|
||||
else if(eqPrimePrime.isPresent()) {
|
||||
TypeUnifyTask fork = new TypeUnifyTask(eqPrimePrime.get(), fc, true);
|
||||
forks.add(fork);
|
||||
fork.fork();
|
||||
}
|
||||
else {
|
||||
TypeUnifyTask fork = new TypeUnifyTask(eqPrime, fc, true);
|
||||
forks.add(fork);
|
||||
fork.fork();
|
||||
}
|
||||
}
|
||||
else { // sequentiell (Step 6b is included)
|
||||
if (eqPrime.equals(eq))
|
||||
eqPrimePrimeSet.add(eqPrime);
|
||||
else if(eqPrimePrime.isPresent())
|
||||
eqPrimePrimeSet.addAll(unify(eqPrimePrime.get(), fc, false));
|
||||
else
|
||||
eqPrimePrimeSet.addAll(unify(eqPrime, fc, false));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Step 6 b) Build the union over everything.
|
||||
*/
|
||||
|
||||
if(parallel)
|
||||
for(TypeUnifyTask fork : forks)
|
||||
eqPrimePrimeSet.addAll(fork.join());
|
||||
|
||||
/*
|
||||
* Step 7: Filter empty sets;
|
||||
*/
|
||||
return eqPrimePrimeSet.stream().filter(x -> isSolvedForm(x)).collect(Collectors.toCollection(HashSet::new));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether a set of pairs is in solved form.
|
||||
* @param eqPrimePrime The set of pair
|
||||
* @return True if in solved form, false otherwise.
|
||||
*/
|
||||
protected boolean isSolvedForm(Set<UnifyPair> eqPrimePrime) {
|
||||
for(UnifyPair pair : eqPrimePrime) {
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
if(!(lhsType instanceof PlaceholderType))
|
||||
return false;
|
||||
|
||||
// If operator is not equals, both sides must be placeholders
|
||||
if(pair.getPairOp() != PairOperator.EQUALSDOT && !(rhsType instanceof PlaceholderType))
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Repeatedly applies type unification rules to a set of equations.
|
||||
* This is step one of the unification algorithm.
|
||||
* @return The set of pairs that results from repeated application of the inference rules.
|
||||
*/
|
||||
protected Set<UnifyPair> applyTypeUnificationRules(Set<UnifyPair> eq, IFiniteClosure fc) {
|
||||
|
||||
/*
|
||||
* Rule Application Strategy:
|
||||
*
|
||||
* 1. Swap all pairs and erase all erasable pairs
|
||||
* 2. Apply all possible rules to a single pair, then move it to the result set.
|
||||
* Iterating over pairs first, then iterating over rules prevents the application
|
||||
* of rules to a "finished" pair over and over.
|
||||
* 2.1 Apply all rules repeatedly except for erase rules. If
|
||||
* the application of a rule creates new pairs, check immediately
|
||||
* against the erase rules.
|
||||
*/
|
||||
|
||||
|
||||
LinkedHashSet<UnifyPair> targetSet = new LinkedHashSet<UnifyPair>();
|
||||
LinkedList<UnifyPair> eqQueue = new LinkedList<>();
|
||||
|
||||
/*
|
||||
* Swap all pairs and erase all erasable pairs
|
||||
*/
|
||||
eq.forEach(x -> swapAddOrErase(x, fc, eqQueue));
|
||||
|
||||
/*
|
||||
* Apply rules until the queue is empty
|
||||
*/
|
||||
while(!eqQueue.isEmpty()) {
|
||||
UnifyPair pair = eqQueue.pollFirst();
|
||||
|
||||
// ReduceUp, ReduceLow, ReduceUpLow
|
||||
Optional<UnifyPair> opt = rules.reduceUpLow(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceLow(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceUp(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardLow(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardLowRight(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardUp(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardUpRight(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardLowUp(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardUpLow(pair);
|
||||
opt = opt.isPresent() ? opt : rules.reduceWildcardLeft(pair);
|
||||
|
||||
// Reduce TPH
|
||||
opt = opt.isPresent() ? opt : rules.reduceTph(pair);
|
||||
|
||||
// One of the rules has been applied
|
||||
if(opt.isPresent()) {
|
||||
swapAddOrErase(opt.get(), fc, eqQueue);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Reduce1, Reduce2, ReduceExt, ReduceSup, ReduceEq
|
||||
Optional<Set<UnifyPair>> optSet = rules.reduce1(pair, fc);
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduce2(pair);
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceExt(pair, fc);
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceSup(pair, fc);
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceEq(pair);
|
||||
|
||||
// ReduceTphExt, ReduceTphSup
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceTphExt(pair);
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceTphSup(pair);
|
||||
|
||||
|
||||
// FunN Rules
|
||||
optSet = optSet.isPresent() ? optSet : rules.reduceFunN(pair);
|
||||
optSet = optSet.isPresent() ? optSet : rules.greaterFunN(pair);
|
||||
optSet = optSet.isPresent() ? optSet : rules.smallerFunN(pair);
|
||||
|
||||
// One of the rules has been applied
|
||||
if(optSet.isPresent()) {
|
||||
optSet.get().forEach(x -> swapAddOrErase(x, fc, eqQueue));
|
||||
continue;
|
||||
}
|
||||
|
||||
// Adapt, AdaptExt, AdaptSup
|
||||
opt = rules.adapt(pair, fc);
|
||||
opt = opt.isPresent() ? opt : rules.adaptExt(pair, fc);
|
||||
opt = opt.isPresent() ? opt : rules.adaptSup(pair, fc);
|
||||
|
||||
// One of the rules has been applied
|
||||
if(opt.isPresent()) {
|
||||
swapAddOrErase(opt.get(), fc, eqQueue);
|
||||
continue;
|
||||
}
|
||||
|
||||
// None of the rules has been applied
|
||||
targetSet.add(pair);
|
||||
}
|
||||
|
||||
return targetSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the rule swap to a pair if possible. Then adds the pair to the set if no erase rule applies.
|
||||
* If an erase rule applies, the pair is not added (erased).
|
||||
* @param pair The pair to swap and add or erase.
|
||||
* @param collection The collection to which the pairs are added.
|
||||
*/
|
||||
protected void swapAddOrErase(UnifyPair pair, IFiniteClosure fc, Collection<UnifyPair> collection) {
|
||||
Optional<UnifyPair> opt = rules.swap(pair);
|
||||
UnifyPair pair2 = opt.isPresent() ? opt.get() : pair;
|
||||
|
||||
if(rules.erase1(pair2, fc) || rules.erase3(pair2) || rules.erase2(pair2, fc))
|
||||
return;
|
||||
|
||||
collection.add(pair2);
|
||||
}
|
||||
|
||||
/**
|
||||
* Splits the equation eq into a set eq1s where both terms are type variables,
|
||||
* and a set eq2s where one of both terms is not a type variable.
|
||||
* @param eq Set of pairs to be splitted.
|
||||
* @param eq1s Subset of eq where both terms are type variables.
|
||||
* @param eq2s eq/eq1s.
|
||||
*/
|
||||
protected void splitEq(Set<UnifyPair> eq, Set<UnifyPair> eq1s, Set<UnifyPair> eq2s) {
|
||||
for(UnifyPair pair : eq)
|
||||
if(pair.getLhsType() instanceof PlaceholderType && pair.getRhsType() instanceof PlaceholderType)
|
||||
eq1s.add(pair);
|
||||
else
|
||||
eq2s.add(pair);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates sets of pairs specified in the fourth step. Does not calculate cartesian products.
|
||||
* @param undefined All pairs that did not match one of the 8 cases are added to this set.
|
||||
* @return The set of the eight cases (without empty sets). Each case is a set, containing sets generated
|
||||
* from the pairs that matched the case. Each generated set contains singleton sets or sets with few elements
|
||||
* (as in case 1 where sigma is added to the innermost set).
|
||||
*/
|
||||
protected Set<Set<Set<Set<UnifyPair>>>> calculatePairSets(Set<UnifyPair> eq2s, IFiniteClosure fc, Set<UnifyPair> undefined) {
|
||||
List<Set<Set<Set<UnifyPair>>>> result = new ArrayList<>(8);
|
||||
|
||||
// Init all 8 cases
|
||||
for(int i = 0; i < 8; i++)
|
||||
result.add(new HashSet<>());
|
||||
|
||||
for(UnifyPair pair : eq2s) {
|
||||
PairOperator pairOp = pair.getPairOp();
|
||||
UnifyType lhsType = pair.getLhsType();
|
||||
UnifyType rhsType = pair.getRhsType();
|
||||
|
||||
// Case 1: (a <. Theta')
|
||||
if(pairOp == PairOperator.SMALLERDOT && lhsType instanceof PlaceholderType)
|
||||
result.get(0).add(unifyCase1((PlaceholderType) pair.getLhsType(), pair.getRhsType(), fc));
|
||||
|
||||
// Case 2: (a <.? ? ext Theta')
|
||||
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof ExtendsType)
|
||||
result.get(1).add(unifyCase2((PlaceholderType) pair.getLhsType(), (ExtendsType) pair.getRhsType(), fc));
|
||||
|
||||
// Case 3: (a <.? ? sup Theta')
|
||||
else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType && rhsType instanceof SuperType)
|
||||
result.get(2).add(unifyCase3((PlaceholderType) lhsType, (SuperType) rhsType, fc));
|
||||
|
||||
// Case 4 was replaced by an inference rule
|
||||
// Case 4: (a <.? Theta')
|
||||
//else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof PlaceholderType)
|
||||
// result.get(3).add(unifyCase4((PlaceholderType) lhsType, rhsType, fc));
|
||||
|
||||
// Case 5: (Theta <. a)
|
||||
else if(pairOp == PairOperator.SMALLERDOT && rhsType instanceof PlaceholderType)
|
||||
result.get(4).add(unifyCase5(lhsType, (PlaceholderType) rhsType, fc));
|
||||
|
||||
// Case 6 was replaced by an inference rule.
|
||||
// Case 6: (? ext Theta <.? a)
|
||||
//else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof ExtendsType && rhsType instanceof PlaceholderType)
|
||||
// result.get(5).add(unifyCase6((ExtendsType) lhsType, (PlaceholderType) rhsType, fc));
|
||||
|
||||
// Case 7 was replaced by an inference rule
|
||||
// Case 7: (? sup Theta <.? a)
|
||||
//else if(pairOp == PairOperator.SMALLERDOTWC && lhsType instanceof SuperType && rhsType instanceof PlaceholderType)
|
||||
// result.get(6).add(unifyCase7((SuperType) lhsType, (PlaceholderType) rhsType, fc));
|
||||
|
||||
// Case 8: (Theta <.? a)
|
||||
else if(pairOp == PairOperator.SMALLERDOTWC && rhsType instanceof PlaceholderType)
|
||||
result.get(7).add(unifyCase8(lhsType, (PlaceholderType) rhsType, fc));
|
||||
// Case unknown: If a pair fits no other case, then the type unification has failed.
|
||||
// Through application of the rules, every pair should have one of the above forms.
|
||||
// Pairs that do not have one of the aboves form are contradictory.
|
||||
else {
|
||||
// If a pair is not defined, the unificiation will fail, so the loop can be stopped here.
|
||||
undefined.add(pair);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Filter empty sets or sets that only contain an empty set.
|
||||
return result.stream().map(x -> x.stream().filter(y -> y.size() > 0).collect(Collectors.toCollection(HashSet::new)))
|
||||
.filter(x -> x.size() > 0).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
/**
|
||||
* Cartesian product Case 1: (a <. Theta')
|
||||
*/
|
||||
protected Set<Set<UnifyPair>> unifyCase1(PlaceholderType a, UnifyType thetaPrime, IFiniteClosure fc) {
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
boolean allGen = thetaPrime.getTypeParams().size() > 0;
|
||||
for(UnifyType t : thetaPrime.getTypeParams())
|
||||
if(!(t instanceof PlaceholderType) || !((PlaceholderType) t).isGenerated()) {
|
||||
allGen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
Set<UnifyType> cs = fc.getAllTypesByName(thetaPrime.getName());
|
||||
cs.add(thetaPrime);
|
||||
|
||||
for(UnifyType c : cs) {
|
||||
Set<UnifyType> thetaQs = fc.getChildren(c).stream().collect(Collectors.toCollection(HashSet::new));
|
||||
//thetaQs.add(thetaPrime);
|
||||
Set<UnifyType> thetaQPrimes = new HashSet<>();
|
||||
TypeParams cParams = c.getTypeParams();
|
||||
if(cParams.size() == 0)
|
||||
thetaQPrimes.add(c);
|
||||
else {
|
||||
ArrayList<Set<UnifyType>> candidateParams = new ArrayList<>();
|
||||
|
||||
for(UnifyType param : cParams)
|
||||
candidateParams.add(fc.grArg(param));
|
||||
|
||||
for(TypeParams tp : permuteParams(candidateParams))
|
||||
thetaQPrimes.add(c.setTypeParams(tp));
|
||||
}
|
||||
|
||||
for(UnifyType tqp : thetaQPrimes) {
|
||||
Optional<Unifier> opt = stdUnify.unify(tqp, thetaPrime);
|
||||
if (!opt.isPresent())
|
||||
continue;
|
||||
|
||||
Unifier unifier = opt.get();
|
||||
unifier.swapPlaceholderSubstitutions(thetaPrime.getTypeParams());
|
||||
Set<UnifyPair> substitutionSet = new HashSet<>();
|
||||
for (Entry<PlaceholderType, UnifyType> sigma : unifier)
|
||||
substitutionSet.add(new UnifyPair(sigma.getKey(), sigma.getValue(), PairOperator.EQUALSDOT));
|
||||
|
||||
List<UnifyType> freshTphs = new ArrayList<>();
|
||||
for (UnifyType tq : thetaQs) {
|
||||
Set<UnifyType> smaller = fc.smaller(unifier.apply(tq));
|
||||
for(UnifyType theta : smaller) {
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
|
||||
for(int i = 0; !allGen && i < theta.getTypeParams().size(); i++) {
|
||||
if(freshTphs.size()-1 < i)
|
||||
freshTphs.add(PlaceholderType.freshPlaceholder());
|
||||
resultPrime.add(new UnifyPair(freshTphs.get(i), theta.getTypeParams().get(i), PairOperator.SMALLERDOTWC));
|
||||
}
|
||||
|
||||
if(allGen)
|
||||
resultPrime.add(new UnifyPair(a, theta, PairOperator.EQUALSDOT));
|
||||
else
|
||||
resultPrime.add(new UnifyPair(a, theta.setTypeParams(new TypeParams(freshTphs.toArray(new UnifyType[0]))), PairOperator.EQUALSDOT));
|
||||
resultPrime.addAll(substitutionSet);
|
||||
result.add(resultPrime);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cartesian Product Case 2: (a <.? ? ext Theta')
|
||||
*/
|
||||
private Set<Set<UnifyPair>> unifyCase2(PlaceholderType a, ExtendsType extThetaPrime, IFiniteClosure fc) {
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
||||
UnifyType extAPrime = new ExtendsType(aPrime);
|
||||
UnifyType thetaPrime = extThetaPrime.getExtendedType();
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, thetaPrime, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, extAPrime, PairOperator.EQUALSDOT));
|
||||
resultPrime.add(new UnifyPair(aPrime, thetaPrime, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cartesian Product Case 3: (a <.? ? sup Theta')
|
||||
*/
|
||||
private Set<Set<UnifyPair>> unifyCase3(PlaceholderType a, SuperType subThetaPrime, IFiniteClosure fc) {
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
UnifyType aPrime = PlaceholderType.freshPlaceholder();
|
||||
UnifyType supAPrime = new SuperType(aPrime);
|
||||
UnifyType thetaPrime = subThetaPrime.getSuperedType();
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(thetaPrime, a, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, supAPrime, PairOperator.EQUALSDOT));
|
||||
resultPrime.add(new UnifyPair(thetaPrime, aPrime, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cartesian Product Case 5: (Theta <. a)
|
||||
*/
|
||||
private Set<Set<UnifyPair>> unifyCase5(UnifyType theta, PlaceholderType a, IFiniteClosure fc) {
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
|
||||
boolean allGen = theta.getTypeParams().size() > 0;
|
||||
for(UnifyType t : theta.getTypeParams())
|
||||
if(!(t instanceof PlaceholderType) || !((PlaceholderType) t).isGenerated()) {
|
||||
allGen = false;
|
||||
break;
|
||||
}
|
||||
|
||||
for(UnifyType thetaS : fc.greater(theta)) {
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
|
||||
UnifyType[] freshTphs = new UnifyType[thetaS.getTypeParams().size()];
|
||||
for(int i = 0; !allGen && i < freshTphs.length; i++) {
|
||||
freshTphs[i] = PlaceholderType.freshPlaceholder();
|
||||
resultPrime.add(new UnifyPair(thetaS.getTypeParams().get(i), freshTphs[i], PairOperator.SMALLERDOTWC));
|
||||
}
|
||||
|
||||
if(allGen)
|
||||
resultPrime.add(new UnifyPair(a, thetaS, PairOperator.EQUALSDOT));
|
||||
else
|
||||
resultPrime.add(new UnifyPair(a, thetaS.setTypeParams(new TypeParams(freshTphs)), PairOperator.EQUALSDOT));
|
||||
result.add(resultPrime);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cartesian Product Case 8: (Theta <.? a)
|
||||
*/
|
||||
private Set<Set<UnifyPair>> unifyCase8(UnifyType theta, PlaceholderType a, IFiniteClosure fc) {
|
||||
Set<Set<UnifyPair>> result = new HashSet<>();
|
||||
//for(UnifyType thetaS : fc.grArg(theta)) {
|
||||
Set<UnifyPair> resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, theta, PairOperator.EQUALSDOT));
|
||||
result.add(resultPrime);
|
||||
|
||||
UnifyType freshTph = PlaceholderType.freshPlaceholder();
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, new ExtendsType(freshTph), PairOperator.EQUALSDOT));
|
||||
resultPrime.add(new UnifyPair(theta, freshTph, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
|
||||
resultPrime = new HashSet<>();
|
||||
resultPrime.add(new UnifyPair(a, new SuperType(freshTph), PairOperator.EQUALSDOT));
|
||||
resultPrime.add(new UnifyPair(freshTph, theta, PairOperator.SMALLERDOT));
|
||||
result.add(resultPrime);
|
||||
//}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a set of candidates for each position and computes all possible permutations.
|
||||
* @param candidates The length of the list determines the number of type params. Each set
|
||||
* contains the candidates for the corresponding position.
|
||||
*/
|
||||
protected Set<TypeParams> permuteParams(ArrayList<Set<UnifyType>> candidates) {
|
||||
Set<TypeParams> result = new HashSet<>();
|
||||
permuteParams(candidates, 0, result, new UnifyType[candidates.size()]);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a set of candidates for each position and computes all possible permutations.
|
||||
* @param candidates The length of the list determines the number of type params. Each set
|
||||
* contains the candidates for the corresponding position.
|
||||
* @param idx Idx for the current permutatiton.
|
||||
* @param result Set of all permutations found so far
|
||||
* @param current The permutation of type params that is currently explored
|
||||
*/
|
||||
private void permuteParams(ArrayList<Set<UnifyType>> candidates, int idx, Set<TypeParams> result, UnifyType[] current) {
|
||||
if(candidates.size() == idx) {
|
||||
result.add(new TypeParams(Arrays.copyOf(current, current.length)));
|
||||
return;
|
||||
}
|
||||
|
||||
Set<UnifyType> localCandidates = candidates.get(idx);
|
||||
|
||||
for(UnifyType t : localCandidates) {
|
||||
current[idx] = t;
|
||||
permuteParams(candidates, idx+1, result, current);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
package de.dhbwstuttgart.typeinference.unify;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
|
||||
public interface Unifikationsalgorithmus {
|
||||
|
||||
public Set<Set<UnifyPair>> apply (Set<UnifyPair> E);
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.interfaces;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.ReferenceType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.SuperType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public interface IFiniteClosure {
|
||||
|
||||
/**
|
||||
* Returns all types of the finite closure that are subtypes of the argument.
|
||||
* @return The set of subtypes of the argument.
|
||||
*/
|
||||
public Set<UnifyType> smaller(UnifyType type);
|
||||
|
||||
/**
|
||||
* Returns all types of the finite closure that are supertypes of the argument.
|
||||
* @return The set of supertypes of the argument.
|
||||
*/
|
||||
public Set<UnifyType> greater(UnifyType type);
|
||||
|
||||
/**
|
||||
* Wo passt Type rein?
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public Set<UnifyType> grArg(UnifyType type);
|
||||
|
||||
/**
|
||||
* Was passt in Type rein?
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
public Set<UnifyType> smArg(UnifyType type);
|
||||
|
||||
public Set<UnifyType> grArg(ReferenceType type);
|
||||
public Set<UnifyType> smArg(ReferenceType type);
|
||||
|
||||
public Set<UnifyType> grArg(ExtendsType type);
|
||||
public Set<UnifyType> smArg(ExtendsType type);
|
||||
|
||||
public Set<UnifyType> grArg(SuperType type);
|
||||
public Set<UnifyType> smArg(SuperType type);
|
||||
|
||||
public Set<UnifyType> grArg(PlaceholderType type);
|
||||
public Set<UnifyType> smArg(PlaceholderType type);
|
||||
|
||||
public Set<UnifyType> grArg(FunNType type);
|
||||
public Set<UnifyType> smArg(FunNType type);
|
||||
|
||||
public Optional<UnifyType> getLeftHandedType(String typeName);
|
||||
public Set<UnifyType> getAncestors(UnifyType t);
|
||||
public Set<UnifyType> getChildren(UnifyType t);
|
||||
public Set<UnifyType> getAllTypesByName(String typeName);
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.interfaces;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
|
||||
|
||||
/**
|
||||
* Contains the inference rules that are applied to the set Eq.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public interface IRuleSet {
|
||||
|
||||
public Optional<UnifyPair> reduceUp(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceLow(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceUpLow(UnifyPair pair);
|
||||
public Optional<Set<UnifyPair>> reduceExt(UnifyPair pair, IFiniteClosure fc);
|
||||
public Optional<Set<UnifyPair>> reduceSup(UnifyPair pair, IFiniteClosure fc);
|
||||
public Optional<Set<UnifyPair>> reduceEq(UnifyPair pair);
|
||||
public Optional<Set<UnifyPair>> reduce1(UnifyPair pair, IFiniteClosure fc);
|
||||
public Optional<Set<UnifyPair>> reduce2(UnifyPair pair);
|
||||
|
||||
/*
|
||||
* Missing Reduce-Rules for Wildcards
|
||||
*/
|
||||
public Optional<UnifyPair> reduceWildcardLow(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardLowRight(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardUp(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardUpRight(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardLowUp(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardUpLow(UnifyPair pair);
|
||||
public Optional<UnifyPair> reduceWildcardLeft(UnifyPair pair);
|
||||
|
||||
/*
|
||||
* Additional Rules which replace cases of the cartesian product
|
||||
*/
|
||||
|
||||
/**
|
||||
* Rule that replaces the fourth case of the cartesian product where (a <.? Theta)
|
||||
*/
|
||||
public Optional<UnifyPair> reduceTph(UnifyPair pair);
|
||||
|
||||
/**
|
||||
* Rule that replaces the sixth case of the cartesian product where (? ext Theta <.? a)
|
||||
*/
|
||||
public Optional<Set<UnifyPair>> reduceTphExt(UnifyPair pair);
|
||||
|
||||
/**
|
||||
* Rule that replaces the fourth case of the cartesian product where (? sup Theta <.? a)
|
||||
*/
|
||||
public Optional<Set<UnifyPair>> reduceTphSup(UnifyPair pair);
|
||||
|
||||
/*
|
||||
* FunN Rules
|
||||
*/
|
||||
public Optional<Set<UnifyPair>> reduceFunN(UnifyPair pair);
|
||||
public Optional<Set<UnifyPair>> greaterFunN(UnifyPair pair);
|
||||
public Optional<Set<UnifyPair>> smallerFunN(UnifyPair pair);
|
||||
|
||||
/**
|
||||
* Checks whether the erase1-Rule applies to the pair.
|
||||
* @return True if the pair is erasable, false otherwise.
|
||||
*/
|
||||
public boolean erase1(UnifyPair pair, IFiniteClosure fc);
|
||||
|
||||
/**
|
||||
* Checks whether the erase2-Rule applies to the pair.
|
||||
* @return True if the pair is erasable, false otherwise.
|
||||
*/
|
||||
public boolean erase2(UnifyPair pair, IFiniteClosure fc);
|
||||
|
||||
/**
|
||||
* Checks whether the erase3-Rule applies to the pair.
|
||||
* @return True if the pair is erasable, false otherwise.
|
||||
*/
|
||||
public boolean erase3(UnifyPair pair);
|
||||
|
||||
public Optional<UnifyPair> swap(UnifyPair pair);
|
||||
|
||||
public Optional<UnifyPair> adapt(UnifyPair pair, IFiniteClosure fc);
|
||||
public Optional<UnifyPair> adaptExt(UnifyPair pair, IFiniteClosure fc);
|
||||
public Optional<UnifyPair> adaptSup(UnifyPair pair, IFiniteClosure fc);
|
||||
|
||||
/**
|
||||
* Applies the subst-Rule to a set of pairs (usually Eq').
|
||||
* @param pairs The set of pairs where the subst rule should apply.
|
||||
* @return An optional of the modified set, if there were any substitutions. An empty optional if there were no substitutions.
|
||||
*/
|
||||
public Optional<Set<UnifyPair>> subst(Set<UnifyPair> pairs);
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Contains operations on sets.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public interface ISetOperations {
|
||||
/**
|
||||
* Calculates the cartesian product of the sets.
|
||||
* @return The cartesian product
|
||||
*/
|
||||
<B> Set<List<B>> cartesianProduct(List<? extends Set<? extends B>> sets);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.interfaces;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.model.UnifyType;
|
||||
import de.dhbwstuttgart.typeinference.unify.model.Unifier;
|
||||
|
||||
/**
|
||||
* Standard unification algorithm (e.g. Robinson, Paterson-Wegman, Martelli-Montanari)
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public interface IUnify {
|
||||
|
||||
/**
|
||||
* Finds the most general unifier sigma of the set {t1,...,tn} so that
|
||||
* sigma(t1) = sigma(t2) = ... = sigma(tn).
|
||||
* @param terms The set of terms to be unified
|
||||
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
|
||||
*/
|
||||
public Optional<Unifier> unify(Set<UnifyType> terms);
|
||||
|
||||
/**
|
||||
* Finds the most general unifier sigma of the set {t1,...,tn} so that
|
||||
* sigma(t1) = sigma(t2) = ... = sigma(tn).
|
||||
* @param terms The set of terms to be unified
|
||||
* @return An optional of the most general unifier if it exists or an empty optional if there is no unifier.
|
||||
*/
|
||||
default public Optional<Unifier> unify(UnifyType... terms) {
|
||||
return unify(Arrays.stream(terms).collect(Collectors.toSet()));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* An extends wildcard type "? extends T".
|
||||
*/
|
||||
public final class ExtendsType extends WildcardType {
|
||||
|
||||
/**
|
||||
* Creates a new extends wildcard type.
|
||||
* @param extendedType The extended type e.g. Integer in "? extends Integer"
|
||||
*/
|
||||
public ExtendsType(UnifyType extendedType) {
|
||||
super("? extends " + extendedType.getName(), extendedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* The extended type e.g. Integer in "? extends Integer"
|
||||
*/
|
||||
public UnifyType getExtendedType() {
|
||||
return wildcardedType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type parameters of the wildcarded type and returns a new extendstype that extends that type.
|
||||
*/
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
UnifyType newType = wildcardedType.setTypeParams(newTp);
|
||||
if(newType == wildcardedType)
|
||||
return this; // Reduced the amount of objects created
|
||||
return new ExtendsType(wildcardedType.setTypeParams(newTp));
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> smArg(IFiniteClosure fc) {
|
||||
return fc.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> grArg(IFiniteClosure fc) {
|
||||
return fc.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
UnifyType apply(Unifier unif) {
|
||||
UnifyType newType = wildcardedType.apply(unif);
|
||||
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
|
||||
return this; // Reduced the amount of objects created
|
||||
return new ExtendsType(newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
/*
|
||||
* It is important that the prime that is added is different to the prime added in hashCode() of SuperType.
|
||||
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
|
||||
*/
|
||||
return wildcardedType.hashCode() + 229;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof ExtendsType))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
ExtendsType other = (ExtendsType) obj;
|
||||
|
||||
|
||||
return other.getWildcardedType().equals(wildcardedType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "? extends " + wildcardedType;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,413 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.MartelliMontanariUnify;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IUnify;
|
||||
|
||||
/**
|
||||
* The finite closure for the type unification
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class FiniteClosure implements IFiniteClosure {
|
||||
|
||||
/**
|
||||
* A map that maps every type to the node in the inheritance graph that contains that type.
|
||||
*/
|
||||
private HashMap<UnifyType, Node<UnifyType>> inheritanceGraph;
|
||||
|
||||
/**
|
||||
* A map that maps every typename to the nodes of the inheritance graph that contain a type with that name.
|
||||
*/
|
||||
private HashMap<String, Set<Node<UnifyType>>> strInheritanceGraph;
|
||||
|
||||
/**
|
||||
* The initial pairs of that define the inheritance tree
|
||||
*/
|
||||
private Set<UnifyPair> pairs;
|
||||
|
||||
/**
|
||||
* Creates a new instance using the inheritance tree defined in the pairs.
|
||||
*/
|
||||
public FiniteClosure(Set<UnifyPair> pairs) {
|
||||
this.pairs = new HashSet<>(pairs);
|
||||
inheritanceGraph = new HashMap<UnifyType, Node<UnifyType>>();
|
||||
|
||||
// Build the transitive closure of the inheritance tree
|
||||
for(UnifyPair pair : pairs) {
|
||||
if(pair.getPairOp() != PairOperator.SMALLER)
|
||||
continue;
|
||||
|
||||
// Add nodes if not already in the graph
|
||||
if(!inheritanceGraph.containsKey(pair.getLhsType()))
|
||||
inheritanceGraph.put(pair.getLhsType(), new Node<UnifyType>(pair.getLhsType()));
|
||||
if(!inheritanceGraph.containsKey(pair.getRhsType()))
|
||||
inheritanceGraph.put(pair.getRhsType(), new Node<UnifyType>(pair.getRhsType()));
|
||||
|
||||
Node<UnifyType> childNode = inheritanceGraph.get(pair.getLhsType());
|
||||
Node<UnifyType> parentNode = inheritanceGraph.get(pair.getRhsType());
|
||||
|
||||
// Add edge
|
||||
parentNode.addDescendant(childNode);
|
||||
|
||||
// Add edges to build the transitive closure
|
||||
parentNode.getPredecessors().stream().forEach(x -> x.addDescendant(childNode));
|
||||
childNode.getDescendants().stream().forEach(x -> x.addPredecessor(parentNode));
|
||||
}
|
||||
|
||||
// Build the alternative representation with strings as keys
|
||||
strInheritanceGraph = new HashMap<>();
|
||||
for(UnifyType key : inheritanceGraph.keySet()) {
|
||||
if(!strInheritanceGraph.containsKey(key.getName()))
|
||||
strInheritanceGraph.put(key.getName(), new HashSet<>());
|
||||
|
||||
strInheritanceGraph.get(key.getName()).add(inheritanceGraph.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all types of the finite closure that are subtypes of the argument.
|
||||
* @return The set of subtypes of the argument.
|
||||
*/
|
||||
@Override
|
||||
public Set<UnifyType> smaller(UnifyType type) {
|
||||
if(type instanceof FunNType)
|
||||
return computeSmallerFunN((FunNType) type);
|
||||
|
||||
Set<UnifyType> ts = new HashSet<>();
|
||||
ts.add(type);
|
||||
return computeSmaller(ts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the smaller functions for every type except FunNTypes.
|
||||
*/
|
||||
private Set<UnifyType> computeSmaller(Set<UnifyType> types) {
|
||||
HashSet<UnifyType> result = new HashSet<>();
|
||||
|
||||
IUnify unify = new MartelliMontanariUnify();
|
||||
|
||||
for(UnifyType t : types) {
|
||||
|
||||
// if T = T' then T <* T'
|
||||
result.add(t);
|
||||
|
||||
// if C<...> <* C<...> then ... (third case in definition of <*)
|
||||
if(t.getTypeParams().size() > 0) {
|
||||
ArrayList<Set<UnifyType>> paramCandidates = new ArrayList<>();
|
||||
for (int i = 0; i < t.getTypeParams().size(); i++)
|
||||
paramCandidates.add(smArg(t.getTypeParams().get(i)));
|
||||
permuteParams(paramCandidates).forEach(x -> result.add(t.setTypeParams(x)));
|
||||
}
|
||||
|
||||
if(!strInheritanceGraph.containsKey(t.getName()))
|
||||
continue;
|
||||
|
||||
// if T <* T' then sigma(T) <* sigma(T')
|
||||
Set<Node<UnifyType>> candidates = strInheritanceGraph.get(t.getName());
|
||||
for(Node<UnifyType> candidate : candidates) {
|
||||
UnifyType theta2 = candidate.getContent();
|
||||
Optional<Unifier> optSigma = unify.unify(theta2, t);
|
||||
if(!optSigma.isPresent())
|
||||
continue;
|
||||
|
||||
Unifier sigma = optSigma.get();
|
||||
sigma.swapPlaceholderSubstitutions(t.getTypeParams());
|
||||
|
||||
Set<UnifyType> theta1Set = candidate.getContentOfDescendants();
|
||||
|
||||
for(UnifyType theta1 : theta1Set)
|
||||
result.add(theta1.apply(sigma));
|
||||
}
|
||||
}
|
||||
|
||||
if(result.equals(types))
|
||||
return result;
|
||||
return computeSmaller(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the smaller-Function for FunNTypes.
|
||||
*/
|
||||
private Set<UnifyType> computeSmallerFunN(FunNType type) {
|
||||
Set<UnifyType> result = new HashSet<>();
|
||||
|
||||
// if T = T' then T <=* T'
|
||||
result.add(type);
|
||||
|
||||
// Because real function types are implicitly variant
|
||||
// it is enough to permute the params with the values of greater / smaller.
|
||||
ArrayList<Set<UnifyType>> paramCandidates = new ArrayList<>();
|
||||
paramCandidates.add(smaller(type.getTypeParams().get(0)));
|
||||
for (int i = 1; i < type.getTypeParams().size(); i++)
|
||||
paramCandidates.add(greater(type.getTypeParams().get(i)));
|
||||
|
||||
permuteParams(paramCandidates).forEach(x -> result.add(type.setTypeParams(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all types of the finite closure that are supertypes of the argument.
|
||||
* @return The set of supertypes of the argument.
|
||||
*/
|
||||
@Override
|
||||
public Set<UnifyType> greater(UnifyType type) {
|
||||
if(type instanceof FunNType)
|
||||
return computeGreaterFunN((FunNType) type);
|
||||
|
||||
Set<UnifyType> ts = new HashSet<>();
|
||||
ts.add(type);
|
||||
return computeGreater(ts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the greater function for all types except function types.
|
||||
*/
|
||||
protected Set<UnifyType> computeGreater(Set<UnifyType> types) {
|
||||
HashSet<UnifyType> result = new HashSet<>();
|
||||
|
||||
IUnify unify = new MartelliMontanariUnify();
|
||||
|
||||
for(UnifyType t : types) {
|
||||
|
||||
// if T = T' then T <=* T'
|
||||
result.add(t);
|
||||
|
||||
// if C<...> <* C<...> then ... (third case in definition of <*)
|
||||
if(t.getTypeParams().size() > 0) {
|
||||
ArrayList<Set<UnifyType>> paramCandidates = new ArrayList<>();
|
||||
for (int i = 0; i < t.getTypeParams().size(); i++)
|
||||
paramCandidates.add(grArg(t.getTypeParams().get(i)));
|
||||
permuteParams(paramCandidates).forEach(x -> result.add(t.setTypeParams(x)));
|
||||
}
|
||||
|
||||
if(!strInheritanceGraph.containsKey(t.getName()))
|
||||
continue;
|
||||
|
||||
// if T <* T' then sigma(T) <* sigma(T')
|
||||
Set<Node<UnifyType>> candidates = strInheritanceGraph.get(t.getName());
|
||||
for(Node<UnifyType> candidate : candidates) {
|
||||
UnifyType theta1 = candidate.getContent();
|
||||
Optional<Unifier> optSigma = unify.unify(theta1, t);
|
||||
if(!optSigma.isPresent())
|
||||
continue;
|
||||
|
||||
Unifier sigma = optSigma.get();
|
||||
sigma.swapPlaceholderSubstitutionsReverse(theta1.getTypeParams());
|
||||
|
||||
Set<UnifyType> theta2Set = candidate.getContentOfPredecessors();
|
||||
|
||||
for(UnifyType theta2 : theta2Set)
|
||||
result.add(theta2.apply(sigma));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(result.equals(types))
|
||||
return result;
|
||||
return computeGreater(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the greater function for FunN-Types
|
||||
*/
|
||||
protected Set<UnifyType> computeGreaterFunN(FunNType type) {
|
||||
Set<UnifyType> result = new HashSet<>();
|
||||
|
||||
// if T = T' then T <=* T'
|
||||
result.add(type);
|
||||
|
||||
// Because real function types are implicitly variant
|
||||
// it is enough to permute the params with the values of greater / smaller.
|
||||
ArrayList<Set<UnifyType>> paramCandidates = new ArrayList<>();
|
||||
paramCandidates.add(greater(type.getTypeParams().get(0)));
|
||||
for (int i = 1; i < type.getTypeParams().size(); i++)
|
||||
paramCandidates.add(smaller(type.getTypeParams().get(i)));
|
||||
permuteParams(paramCandidates).forEach(x -> result.add(type.setTypeParams(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(UnifyType type) {
|
||||
return type.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(ReferenceType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
smaller(type).forEach(x -> result.add(new SuperType(x)));
|
||||
greater(type).forEach(x -> result.add(new ExtendsType(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(FunNType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
smaller(type).forEach(x -> result.add(new SuperType(x)));
|
||||
greater(type).forEach(x -> result.add(new ExtendsType(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(ExtendsType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
UnifyType t = type.getExtendedType();
|
||||
greater(t).forEach(x -> result.add(new ExtendsType(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(SuperType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
UnifyType t = type.getSuperedType();
|
||||
smaller(t).forEach(x -> result.add(new SuperType(x)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> grArg(PlaceholderType type) {
|
||||
HashSet<UnifyType> result = new HashSet<>();
|
||||
result.add(type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(UnifyType type) {
|
||||
return type.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(ReferenceType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(FunNType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(ExtendsType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
UnifyType t = type.getExtendedType();
|
||||
result.add(t);
|
||||
smaller(t).forEach(x -> {
|
||||
result.add(new ExtendsType(x));
|
||||
result.add(x);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(SuperType type) {
|
||||
Set<UnifyType> result = new HashSet<UnifyType>();
|
||||
result.add(type);
|
||||
UnifyType t = type.getSuperedType();
|
||||
result.add(t);
|
||||
greater(t).forEach(x -> {
|
||||
result.add(new SuperType(x));
|
||||
result.add(x);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> smArg(PlaceholderType type) {
|
||||
HashSet<UnifyType> result = new HashSet<>();
|
||||
result.add(type);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> getAllTypesByName(String typeName) {
|
||||
if(!strInheritanceGraph.containsKey(typeName))
|
||||
return new HashSet<>();
|
||||
return strInheritanceGraph.get(typeName).stream().map(x -> x.getContent()).collect(Collectors.toCollection(HashSet::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Optional<UnifyType> getLeftHandedType(String typeName) {
|
||||
if(!strInheritanceGraph.containsKey(typeName))
|
||||
return Optional.empty();
|
||||
|
||||
for(UnifyPair pair : pairs)
|
||||
if(pair.getLhsType().getName().equals(typeName))
|
||||
return Optional.of(pair.getLhsType());
|
||||
|
||||
return Optional.empty();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> getAncestors(UnifyType t) {
|
||||
if(!inheritanceGraph.containsKey(t))
|
||||
return new HashSet<>();
|
||||
Set<UnifyType> result = inheritanceGraph.get(t).getContentOfPredecessors();
|
||||
result.add(t);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<UnifyType> getChildren(UnifyType t) {
|
||||
if(!inheritanceGraph.containsKey(t))
|
||||
return new HashSet<>();
|
||||
Set<UnifyType> result = inheritanceGraph.get(t).getContentOfDescendants();
|
||||
result.add(t);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a set of candidates for each position and computes all possible permutations.
|
||||
* @param candidates The length of the list determines the number of type params. Each set
|
||||
* contains the candidates for the corresponding position.
|
||||
*/
|
||||
protected Set<TypeParams> permuteParams(ArrayList<Set<UnifyType>> candidates) {
|
||||
Set<TypeParams> result = new HashSet<>();
|
||||
permuteParams(candidates, 0, result, new UnifyType[candidates.size()]);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Takes a set of candidates for each position and computes all possible permutations.
|
||||
* @param candidates The length of the list determines the number of type params. Each set
|
||||
* contains the candidates for the corresponding position.
|
||||
* @param idx Idx for the current permutatiton.
|
||||
* @param result Set of all permutations found so far
|
||||
* @param current The permutation of type params that is currently explored
|
||||
*/
|
||||
protected void permuteParams(ArrayList<Set<UnifyType>> candidates, int idx, Set<TypeParams> result, UnifyType[] current) {
|
||||
if(candidates.size() == idx) {
|
||||
result.add(new TypeParams(Arrays.copyOf(current, current.length)));
|
||||
return;
|
||||
}
|
||||
|
||||
Set<UnifyType> localCandidates = candidates.get(idx);
|
||||
|
||||
for(UnifyType t : localCandidates) {
|
||||
current[idx] = t;
|
||||
permuteParams(candidates, idx+1, result, current);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
return this.inheritanceGraph.toString();
|
||||
}
|
||||
}
|
88
src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java
Normal file
88
src/de/dhbwstuttgart/typeinference/unify/model/FunNType.java
Normal file
@ -0,0 +1,88 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* A real function type in java.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class FunNType extends UnifyType {
|
||||
|
||||
/**
|
||||
* Creates a FunN-Type with the specified TypeParameters.
|
||||
*/
|
||||
protected FunNType(TypeParams p) {
|
||||
super("Fun"+(p.size()-1), p);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new FunNType.
|
||||
* @param tp The parameters of the type.
|
||||
* @return A FunNType.
|
||||
* @throws IllegalArgumentException is thrown when there are to few type parameters or there are wildcard-types.
|
||||
*/
|
||||
public static FunNType getFunNType(TypeParams tp) throws IllegalArgumentException {
|
||||
if(tp.size() == 0)
|
||||
throw new IllegalArgumentException("FunNTypes need at least one type parameter");
|
||||
for(UnifyType t : tp)
|
||||
if(t instanceof WildcardType)
|
||||
throw new IllegalArgumentException("Invalid TypeParams for a FunNType: " + tp);
|
||||
return new FunNType(tp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the degree of the function type, e.g. 2 for FunN<Integer, Integer, Integer>.
|
||||
*/
|
||||
public int getN() {
|
||||
return typeParams.size()-1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
|
||||
return this;
|
||||
return getFunNType(newTp);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> smArg(IFiniteClosure fc) {
|
||||
return fc.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> grArg(IFiniteClosure fc) {
|
||||
return fc.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
UnifyType apply(Unifier unif) {
|
||||
// TODO this bypasses the validation of the type parameters.
|
||||
// Wildcard types can be unified into FunNTypes.
|
||||
TypeParams newParams = typeParams.apply(unif);
|
||||
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
|
||||
return this;
|
||||
|
||||
return new FunNType(newParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return 181 + typeParams.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof FunNType))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
FunNType other = (FunNType) obj;
|
||||
|
||||
return other.getTypeParams().equals(typeParams);
|
||||
}
|
||||
|
||||
}
|
99
src/de/dhbwstuttgart/typeinference/unify/model/Node.java
Normal file
99
src/de/dhbwstuttgart/typeinference/unify/model/Node.java
Normal file
@ -0,0 +1,99 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* A node of a directed graph.
|
||||
* @author Florian Steurer
|
||||
*
|
||||
* @param <T> The type of the content of the node.
|
||||
*/
|
||||
class Node<T> {
|
||||
|
||||
/**
|
||||
* The content of the node.
|
||||
*/
|
||||
private T content;
|
||||
|
||||
/**
|
||||
* The set of predecessors
|
||||
*/
|
||||
private HashSet<Node<T>> predecessors = new HashSet<>();
|
||||
|
||||
/**
|
||||
* The set of descendants
|
||||
*/
|
||||
private HashSet<Node<T>> descendants = new HashSet<>();
|
||||
|
||||
/**
|
||||
* Creates a node containing the specified content.
|
||||
*/
|
||||
public Node(T content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a directed edge from this node to the descendant (this -> descendant)
|
||||
*/
|
||||
public void addDescendant(Node<T> descendant) {
|
||||
if(descendants.contains(descendant))
|
||||
return;
|
||||
|
||||
descendants.add(descendant);
|
||||
descendant.addPredecessor(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a directed edge from the predecessor to this node (predecessor -> this)
|
||||
*/
|
||||
public void addPredecessor(Node<T> predecessor) {
|
||||
if(predecessors.contains(predecessor))
|
||||
return;
|
||||
|
||||
predecessors.add(predecessor);
|
||||
predecessor.addDescendant(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* The content of this node.
|
||||
*/
|
||||
public T getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all predecessors (nodes that have a directed edge to this node)
|
||||
*/
|
||||
public Set<Node<T>> getPredecessors() {
|
||||
return predecessors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all descendants. All nodes M, where there is a edge from this node to the node M.
|
||||
* @return
|
||||
*/
|
||||
public Set<Node<T>> getDescendants() {
|
||||
return descendants;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the content of all descendants.
|
||||
*/
|
||||
public Set<T> getContentOfDescendants() {
|
||||
return descendants.stream().map(x -> x.getContent()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the content of all predecessors.
|
||||
*/
|
||||
public Set<T> getContentOfPredecessors() {
|
||||
return predecessors.stream().map(x -> x.getContent()).collect(Collectors.toSet());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Node(" + content.toString() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
/**
|
||||
* Operators of pairs of the unification.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public enum PairOperator {
|
||||
/**
|
||||
* The smaller operator (T < P) is used to express a subtyping relation between
|
||||
* T and P for example in the finite closure. It is necessarily true.
|
||||
*/
|
||||
SMALLER,
|
||||
|
||||
/**
|
||||
* The smallerdot operator (T <. P) is used to express a subtyping relation between
|
||||
* of T and P in a CONSTRAINT during the unification. It is not necessarily true.
|
||||
*/
|
||||
SMALLERDOT,
|
||||
|
||||
/**
|
||||
* The smallerdot operator for arguments (T <.? P) is used to express that
|
||||
* T is an element of smArg(P) (or P is an element of grArg(T)) in a CONSTRAINT
|
||||
* during the unification. It is not necessarily true.
|
||||
*/
|
||||
SMALLERDOTWC,
|
||||
|
||||
/**
|
||||
* The equalsdot operator (T =. P) is used to express that two types during the unification
|
||||
* should be equal. It is not necessarily true.
|
||||
*/
|
||||
EQUALSDOT;
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
switch (this) {
|
||||
case SMALLER: return "<";
|
||||
case SMALLERDOT: return "<.";
|
||||
case SMALLERDOTWC: return "<.?";
|
||||
default: return "=."; // EQUALSDOT
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* An unbounded placeholder type.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public final class PlaceholderType extends UnifyType{
|
||||
|
||||
/**
|
||||
* Static list containing the names of all existing placeholders.
|
||||
* Used for generating fresh placeholders.
|
||||
*/
|
||||
protected static final HashSet<String> EXISTING_PLACEHOLDERS = new HashSet<String>();
|
||||
|
||||
/**
|
||||
* Prefix of auto-generated placeholder names.
|
||||
*/
|
||||
protected static String nextName = "gen_";
|
||||
|
||||
/**
|
||||
* Random number generator used to generate fresh placeholder name.
|
||||
*/
|
||||
protected static Random rnd = new Random(43558747548978L);
|
||||
|
||||
/**
|
||||
* True if this object was auto-generated, false if this object was user-generated.
|
||||
*/
|
||||
private final boolean IsGenerated;
|
||||
|
||||
/**
|
||||
* Creates a new placeholder type with the specified name.
|
||||
*/
|
||||
public PlaceholderType(String name) {
|
||||
super(name, new TypeParams());
|
||||
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
|
||||
IsGenerated = false; // This type is user generated
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new placeholdertype
|
||||
* @param isGenerated true if this placeholder is auto-generated, false if it is user-generated.
|
||||
*/
|
||||
protected PlaceholderType(String name, boolean isGenerated) {
|
||||
super(name, new TypeParams());
|
||||
EXISTING_PLACEHOLDERS.add(name); // Add to list of existing placeholder names
|
||||
IsGenerated = isGenerated;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a fresh placeholder type with a name that does so far not exist.
|
||||
* A user could later instantiate a type using the same name that is equivalent to this type.
|
||||
* @return A fresh placeholder type.
|
||||
*/
|
||||
public static PlaceholderType freshPlaceholder() {
|
||||
String name = nextName + (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
|
||||
// Add random chars while the name is in use.
|
||||
while(EXISTING_PLACEHOLDERS.contains(name));
|
||||
name += (char) (rnd.nextInt(22) + 97); // Returns random char between 'a' and 'z'
|
||||
return new PlaceholderType(name, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if this placeholder is auto-generated, false if it is user-generated.
|
||||
*/
|
||||
public boolean isGenerated() {
|
||||
return IsGenerated;
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> smArg(IFiniteClosure fc) {
|
||||
return fc.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> grArg(IFiniteClosure fc) {
|
||||
return fc.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
return this; // Placeholders never have params.
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return typeName.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
UnifyType apply(Unifier unif) {
|
||||
if(unif.hasSubstitute(this))
|
||||
return unif.getSubstitute(this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof PlaceholderType))
|
||||
return false;
|
||||
|
||||
return ((PlaceholderType) obj).getName().equals(typeName);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Collection<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
|
||||
ArrayList<PlaceholderType> ret = new ArrayList<>();
|
||||
ret.add(this);
|
||||
return ret;
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* A reference type e.q. Integer or List<T>.
|
||||
* @author Florian Steurer
|
||||
*
|
||||
*/
|
||||
public final class ReferenceType extends UnifyType {
|
||||
|
||||
/**
|
||||
* The buffered hashCode
|
||||
*/
|
||||
private final int hashCode;
|
||||
|
||||
public ReferenceType(String name, UnifyType... params) {
|
||||
super(name, new TypeParams(params));
|
||||
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
||||
}
|
||||
|
||||
public ReferenceType(String name, TypeParams params) {
|
||||
super(name, params);
|
||||
hashCode = 31 + 17 * typeName.hashCode() + 17 * typeParams.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> smArg(IFiniteClosure fc) {
|
||||
return fc.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> grArg(IFiniteClosure fc) {
|
||||
return fc.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
UnifyType apply(Unifier unif) {
|
||||
TypeParams newParams = typeParams.apply(unif);
|
||||
|
||||
if(newParams.hashCode() == typeParams.hashCode() && newParams.equals(typeParams))
|
||||
return this;
|
||||
|
||||
return new ReferenceType(typeName, newParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
if(newTp.hashCode() == typeParams.hashCode() && newTp.equals(typeParams))
|
||||
return this; // reduced the amount of objects created
|
||||
return new ReferenceType(typeName, newTp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof ReferenceType))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
ReferenceType other = (ReferenceType) obj;
|
||||
|
||||
if(!other.getName().equals(typeName))
|
||||
return false;
|
||||
|
||||
return other.getTypeParams().equals(typeParams);
|
||||
}
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import de.dhbwstuttgart.typeinference.unify.interfaces.IFiniteClosure;
|
||||
|
||||
/**
|
||||
* A super wildcard type e.g. ? super Integer.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public final class SuperType extends WildcardType {
|
||||
|
||||
/**
|
||||
* Creates a new instance "? extends superedType"
|
||||
* @param superedType The type that is supered e.g. Integer in "? super Integer"
|
||||
*/
|
||||
public SuperType(UnifyType superedType) {
|
||||
super("? super " + superedType.getName(), superedType);
|
||||
}
|
||||
|
||||
/**
|
||||
* The type that is supered e.g. Integer in "? super Integer"
|
||||
*/
|
||||
public UnifyType getSuperedType() {
|
||||
return wildcardedType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "? super " + wildcardedType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type parameters of the wildcarded type and returns a new supertype that supers that type.
|
||||
*/
|
||||
@Override
|
||||
public UnifyType setTypeParams(TypeParams newTp) {
|
||||
UnifyType newType = wildcardedType.setTypeParams(newTp);
|
||||
if(newType == wildcardedType)
|
||||
return this; // Reduced the amount of objects created
|
||||
return new SuperType(wildcardedType.setTypeParams(newTp));
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> smArg(IFiniteClosure fc) {
|
||||
return fc.smArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
Set<UnifyType> grArg(IFiniteClosure fc) {
|
||||
return fc.grArg(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
UnifyType apply(Unifier unif) {
|
||||
UnifyType newType = wildcardedType.apply(unif);
|
||||
if(newType.hashCode() == wildcardedType.hashCode() && newType.equals(wildcardedType))
|
||||
return this; // Reduced the amount of objects created
|
||||
return new SuperType(newType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
/*
|
||||
* It is important that the prime that is added is different to the prime added in hashCode() of ExtendsType.
|
||||
* Otherwise ? extends T and ? super T have the same hashCode() for every Type T.
|
||||
*/
|
||||
return wildcardedType.hashCode() + 3917;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof SuperType))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
SuperType other = (SuperType) obj;
|
||||
return other.getSuperedType().equals(wildcardedType);
|
||||
}
|
||||
}
|
176
src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java
Normal file
176
src/de/dhbwstuttgart/typeinference/unify/model/TypeParams.java
Normal file
@ -0,0 +1,176 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
|
||||
/**
|
||||
* The generic or non-generic parameters of a type e.g. <T> for List<T>
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public final class TypeParams implements Iterable<UnifyType>{
|
||||
/**
|
||||
* The array which backs the type parameters.
|
||||
*/
|
||||
private final UnifyType[] typeParams;
|
||||
|
||||
/**
|
||||
* Hashcode calculation is expensive and must be cached.
|
||||
*/
|
||||
private final int hashCode;
|
||||
|
||||
/**
|
||||
* Creates a new set of type parameters.
|
||||
* @param types The type parameters.
|
||||
*/
|
||||
public TypeParams(List<UnifyType> types){
|
||||
typeParams = new UnifyType[types.size()];
|
||||
for(int i=0;i<types.size();i++)
|
||||
typeParams[i] = types.get(i);
|
||||
|
||||
// Hashcode calculation is expensive and must be cached.
|
||||
hashCode = Arrays.deepHashCode(typeParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new set of type parameters.
|
||||
* @param types The type parameters.
|
||||
*/
|
||||
public TypeParams(UnifyType... types) {
|
||||
typeParams = types;
|
||||
|
||||
// Hashcode calculation is expensive and must be cached.
|
||||
hashCode = Arrays.deepHashCode(typeParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if every parameter in this object is a placeholder type, false otherwise.
|
||||
*/
|
||||
public boolean arePlaceholders() {
|
||||
return Arrays.stream(typeParams).allMatch(x -> x instanceof PlaceholderType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the number of the type parameters in this object.
|
||||
* @return number of type parameters, always positive (including 0).
|
||||
*/
|
||||
public int size() {
|
||||
return typeParams.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if this object has size() of zero, false otherwise.
|
||||
*/
|
||||
public boolean empty() {
|
||||
return typeParams.length == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies a unifier to every parameter in this object.
|
||||
* @param unif The applied unifier.
|
||||
* @return A new type parameter object, where the unifier was applied to every parameter.
|
||||
*/
|
||||
public TypeParams apply(Unifier unif) {
|
||||
UnifyType[] newParams = new UnifyType[typeParams.length];
|
||||
|
||||
// If true, a type was modified and a new typeparams object has to be created.
|
||||
// Otherwise it is enough to return this object, since it is immutable
|
||||
// This reduced the needed TypeParams-Instances for the lambda14-Test from
|
||||
// 130.000 to 30.000 without a decrease in speed.
|
||||
boolean isNew = false;
|
||||
|
||||
for(int i = 0; i < typeParams.length; i++) {
|
||||
UnifyType newType = typeParams[i].apply(unif);
|
||||
newParams[i] = newType;
|
||||
if(!isNew && (newType.hashCode() != typeParams[i].hashCode() || !newType.equals(typeParams[i])))
|
||||
isNew = true;
|
||||
}
|
||||
|
||||
if(!isNew)
|
||||
return this;
|
||||
return new TypeParams(newParams);
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the PlaceholderType t is a parameter of this object, or if any parameter
|
||||
* contains t (arbitrary depth of recursion), false otherwise.
|
||||
*/
|
||||
public boolean occurs(PlaceholderType t) {
|
||||
for(UnifyType p : typeParams)
|
||||
if(p instanceof PlaceholderType)
|
||||
if(p.equals(t))
|
||||
return true;
|
||||
else
|
||||
if(p.getTypeParams().occurs(t))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the i-th parameter of this object.
|
||||
*/
|
||||
public UnifyType get(int i) {
|
||||
return typeParams[i];
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the the type t as the i-th parameter and returns a new object
|
||||
* that equals this object, except for the i-th type.
|
||||
*/
|
||||
public TypeParams set(UnifyType t, int idx) {
|
||||
// Reduce the creation of new objects for less memory
|
||||
// Reduced the needed instances of TypeParams in the lambda14-Test from
|
||||
// 150.000 to 130.000
|
||||
if(t.hashCode() == typeParams[idx].hashCode() && t.equals(typeParams[idx]))
|
||||
return this;
|
||||
UnifyType[] newparams = Arrays.copyOf(typeParams, typeParams.length);
|
||||
newparams[idx] = t;
|
||||
return new TypeParams(newparams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<UnifyType> iterator() {
|
||||
return Arrays.stream(typeParams).iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof TypeParams))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
TypeParams other = (TypeParams) obj;
|
||||
|
||||
if(other.size() != this.size())
|
||||
return false;
|
||||
|
||||
for(int i = 0; i < this.size(); i++)
|
||||
if(!(this.get(i).equals(other.get(i))))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String res = "";
|
||||
for(UnifyType t : typeParams)
|
||||
res += t + ",";
|
||||
return "<" + res.substring(0, res.length()-1) + ">";
|
||||
}
|
||||
|
||||
public Collection<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
|
||||
ArrayList<PlaceholderType> ret = new ArrayList<>();
|
||||
for(UnifyType t : typeParams){
|
||||
ret.addAll(t.getInvolvedPlaceholderTypes());
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
142
src/de/dhbwstuttgart/typeinference/unify/model/Unifier.java
Normal file
142
src/de/dhbwstuttgart/typeinference/unify/model/Unifier.java
Normal file
@ -0,0 +1,142 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* A set of substitutions (s -> t) that is an applicable function to types and pairs.
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class Unifier implements Function<UnifyType, UnifyType>, Iterable<Entry<PlaceholderType, UnifyType>> {
|
||||
|
||||
/**
|
||||
* The set of substitutions that unify a type-term
|
||||
*/
|
||||
private HashMap<PlaceholderType, UnifyType> substitutions = new HashMap<>();
|
||||
|
||||
/**
|
||||
* Creates a new instance with a single substitution (source -> target).
|
||||
* @param The type that is replaced
|
||||
* @param The type that replaces
|
||||
*/
|
||||
public Unifier(PlaceholderType source, UnifyType target) {
|
||||
substitutions.put(source, target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Identity function as an "unifier".
|
||||
*/
|
||||
protected Unifier() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates an unifier that is the identity function (thus has no substitutions).
|
||||
*/
|
||||
public static Unifier identity() {
|
||||
return new Unifier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a substitution to the unifier from (source -> target)
|
||||
* @param The type that is replaced
|
||||
* @param The type that replaces
|
||||
*/
|
||||
public void add(PlaceholderType source, UnifyType target) {
|
||||
Unifier tempU = new Unifier(source, target);
|
||||
// Every new substitution must be applied to previously added substitutions
|
||||
// otherwise the unifier needs to be applied multiple times to unify two terms
|
||||
for(PlaceholderType pt : substitutions.keySet())
|
||||
substitutions.put(pt, substitutions.get(pt).apply(tempU));
|
||||
substitutions.put(source, target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public UnifyType apply(UnifyType t) {
|
||||
return t.apply(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the unifier to the two terms of the pair.
|
||||
* @return A new pair where the left and right-hand side are applied
|
||||
*/
|
||||
public UnifyPair apply(UnifyPair p) {
|
||||
return new UnifyPair(this.apply(p.getLhsType()), this.apply(p.getRhsType()), p.getPairOp());
|
||||
}
|
||||
|
||||
/**
|
||||
* True if the typevariable t will be substituted if the unifier is applied.
|
||||
* false otherwise.
|
||||
*/
|
||||
public boolean hasSubstitute(PlaceholderType t) {
|
||||
return substitutions.containsKey(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type that will replace the typevariable t if the unifier is applied.
|
||||
*/
|
||||
public UnifyType getSubstitute(PlaceholderType t) {
|
||||
return substitutions.get(t);
|
||||
}
|
||||
|
||||
/**
|
||||
* The number of substitutions in the unifier. If zero, this is the identity function.
|
||||
*/
|
||||
public int size() {
|
||||
return substitutions.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Garantuees that if there is a substitutions (a -> b) in this unifier,
|
||||
* a is not an element of the targetParams. Substitutions that do not
|
||||
* satisfy this condition, are swapped.
|
||||
*/
|
||||
public void swapPlaceholderSubstitutions(Iterable<UnifyType> targetParams) {
|
||||
for(UnifyType tph : targetParams) {
|
||||
if(!(tph instanceof PlaceholderType))
|
||||
continue;
|
||||
// Swap a substitutions (a -> b) if a is an element of the target params.
|
||||
if(substitutions.containsKey(tph)) {
|
||||
if((substitutions.get(tph) instanceof PlaceholderType)) {
|
||||
PlaceholderType newLhs = (PlaceholderType) substitutions.get(tph);
|
||||
substitutions.remove(tph);
|
||||
substitutions.put(newLhs, tph);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void swapPlaceholderSubstitutionsReverse(Iterable<UnifyType> sourceParams) {
|
||||
for(UnifyType tph : sourceParams) {
|
||||
if(!(tph instanceof PlaceholderType))
|
||||
continue;
|
||||
if(substitutions.containsValue(tph)) {
|
||||
UnifyType key = substitutions.values().stream().filter(x -> x.equals(tph)).findAny().get();
|
||||
if(key instanceof PlaceholderType) {
|
||||
PlaceholderType newLhs = (PlaceholderType) tph;
|
||||
substitutions.remove(key);
|
||||
substitutions.put(newLhs, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
String result = "{ ";
|
||||
for(Entry<PlaceholderType, UnifyType> entry : substitutions.entrySet())
|
||||
result += "(" + entry.getKey() + " -> " + entry.getValue() + "), ";
|
||||
if(!substitutions.isEmpty())
|
||||
result = result.substring(0, result.length()-2);
|
||||
result += " }";
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterator<Entry<PlaceholderType, UnifyType>> iterator() {
|
||||
return substitutions.entrySet().iterator();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,99 @@
|
||||
package de.dhbwstuttgart.typeinference.unify.model;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* A pair which contains two types and an operator, e.q. (Integer <. a).
|
||||
* @author Florian Steurer
|
||||
*/
|
||||
public class UnifyPair {
|
||||
|
||||
/**
|
||||
* The type on the left hand side of the pair.
|
||||
*/
|
||||
private final UnifyType lhs;
|
||||
|
||||
/**
|
||||
* The type on the right hand side of the pair.
|
||||
*/
|
||||
private final UnifyType rhs;
|
||||
|
||||
/**
|
||||
* The operator that determines the relation between the left and right hand side type.
|
||||
*/
|
||||
private PairOperator pairOp;
|
||||
|
||||
private final int hashCode;
|
||||
|
||||
/**
|
||||
* Creates a new instance of the pair.
|
||||
* @param lhs The type on the left hand side of the pair.
|
||||
* @param rhs The type on the right hand side of the pair.
|
||||
* @param op The operator that determines the relation between the left and right hand side type.
|
||||
*/
|
||||
public UnifyPair(UnifyType lhs, UnifyType rhs, PairOperator op) {
|
||||
this.lhs = lhs;
|
||||
this.rhs = rhs;
|
||||
pairOp = op;
|
||||
|
||||
// Caching hashcode
|
||||
hashCode = 17 + 31 * lhs.hashCode() + 31 * rhs.hashCode() + 31 * pairOp.hashCode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type on the left hand side of the pair.
|
||||
*/
|
||||
public UnifyType getLhsType() {
|
||||
return lhs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type on the right hand side of the pair.
|
||||
*/
|
||||
public UnifyType getRhsType() {
|
||||
return rhs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the operator that determines the relation between the left and right hand side type.
|
||||
*/
|
||||
public PairOperator getPairOp() {
|
||||
return pairOp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if(!(obj instanceof UnifyPair))
|
||||
return false;
|
||||
|
||||
if(obj.hashCode() != this.hashCode())
|
||||
return false;
|
||||
|
||||
UnifyPair other = (UnifyPair) obj;
|
||||
|
||||
return other.getPairOp() == pairOp
|
||||
&& other.getLhsType().equals(lhs)
|
||||
&& other.getRhsType().equals(rhs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return hashCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "(" + lhs + " " + pairOp + " " + rhs + ")";
|
||||
}
|
||||
|
||||
public List<? extends PlaceholderType> getInvolvedPlaceholderTypes() {
|
||||
ArrayList<PlaceholderType> ret = new ArrayList<>();
|
||||
ret.addAll(lhs.getInvolvedPlaceholderTypes());
|
||||
ret.addAll(rhs.getInvolvedPlaceholderTypes());
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user