Convert zu FunNTypen hinzufügen

This commit is contained in:
JanUlrich 2016-04-18 15:38:47 +02:00
parent afc6bc7b89
commit b70dc71a62
12 changed files with 75 additions and 437 deletions

View File

@ -209,43 +209,6 @@ public class MyCompiler implements MyCompilerAPI{
return OutputDir;
}
/**
* @author Arne ¼dtke
* Ersetzt alle GTVs durch TPHs mit gleichem Namen. Arbeitet Rekursiv.
* ACHTUNG: BACKDOOR CREATE!!! Nur ¼r Testzwecke verwenden.
* @param T - Typ, bei welchem die GTVs ersetzt werden sollen.
*/
public static Type makeGenericTypeVars2TypePlaceHolders(Type T)
{
if(T instanceof RefType)
{
RefType refT = (RefType)T;
if(refT.get_ParaList() != null)
{
Menge<Type> paras = refT.get_ParaList();
for(int i = 0; i<paras.size();i++)
{
Type tt = paras.elementAt(i);
if(tt instanceof GenericTypeVar)
{
GenericTypeVar gtv = (GenericTypeVar)tt;
paras.set(i,TypePlaceholder.backdoorCreate(gtv.getName().toString()));
}
else
{
makeGenericTypeVars2TypePlaceHolders(tt);
}
}
}
}
else if(T instanceof IMatchable)
{
Type TT = ((IMatchable)T).getMatchType();
makeGenericTypeVars2TypePlaceHolders(TT);
}
return T;
}
/**
* Parst den Inhalt einer Datei zu einem Syntaxbaum.
*/

View File

@ -554,7 +554,7 @@ public class Class extends GTVDeclarationContext implements AClassOrInterface, I
*/
// ino.method.get_ParaList.23101.definition
public Menge<? extends Type> get_ParaList()
public List<? extends Type> get_ParaList()
// ino.end
// ino.method.get_ParaList.23101.body
{

View File

@ -85,64 +85,6 @@ Paratyp gesetzt."); }
fielddecl.addElement(i);
}
// ino.method.is_declared.23188.defdescription type=line
//
// ********************************************************************************************
//
// ino.end
// ino.method.is_declared.23188.definition
public boolean is_declared(Type t, Menge<Class> classlist)
throws SCClassBodyException
// ino.end
// ino.method.is_declared.23188.body
{
boolean flag=false;
for(Enumeration<Class> e = classlist.elements();e.hasMoreElements();)
{
flag = false;
Class c = e.nextElement();
// System.out.println("is_init: vergleiche "+t.get_Type_()+" mit "+c.getName());
if(c.getName().equals(t.getName())){
// System.out.println("Klasse "+t.get_Type()+"im Menge classlist gefunden.");
flag = true;
break;
}
}
if( t instanceof RefType && ((RefType)t).get_ParaList()!=null)
{
if( ((RefType)t).get_ParaList().size() > 0 )
{
for(Enumeration e1 = ((RefType)t).get_ParaList().elements(); e1.hasMoreElements(); )
{
try
{
is_declared((Type)e1.nextElement(),classlist);
}
catch(SCClassBodyException ex)
{
throw ex;
}
}
}
}
if(flag)
return true;
else
{
SCClassBodyException ex = new SCClassBodyException();
SCExcept e = new SCExcept();
e.set_error("unbekannte Klasse "+t.getName()+".");
e.set_function("complete_parahashtable() --> is_declared()");
e.set_statement(t.getName().toString());
ex.addException(e);
throw ex;
}
}
// ino.end
// ino.method.string_rec.23191.definition
static String string_rec(Hashtable ht)

View File

@ -1,11 +1,14 @@
package de.dhbwstuttgart.syntaxtree.factory;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.logging.Logger;
import de.dhbwstuttgart.myexception.NotImplementedException;
import de.dhbwstuttgart.syntaxtree.NullSyntaxTreeNode;
import de.dhbwstuttgart.syntaxtree.type.ExtendsWildcardType;
import de.dhbwstuttgart.syntaxtree.type.FunN;
import de.dhbwstuttgart.syntaxtree.type.GenericTypeVar;
import de.dhbwstuttgart.syntaxtree.type.ObjectType;
import de.dhbwstuttgart.syntaxtree.type.RefType;
@ -29,6 +32,7 @@ import de.dhbwstuttgart.typeinference.assumptions.ClassAssumption;
import de.dhbwstuttgart.typeinference.assumptions.TypeAssumptions;
import de.dhbwstuttgart.typeinference.unify.model.ExtendsType;
import de.dhbwstuttgart.typeinference.unify.model.FiniteClosure;
import de.dhbwstuttgart.typeinference.unify.model.FunNType;
import de.dhbwstuttgart.typeinference.unify.model.UnifyPair;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
import de.dhbwstuttgart.typeinference.unify.model.PlaceholderType;
@ -67,14 +71,16 @@ public class UnifyTypeFactory {
//Es wurde versucht ein Typ umzuwandeln, welcher noch nicht von der Factory abgedeckt ist
if(t instanceof GenericTypeVar){
return UnifyTypeFactory.convert((GenericTypeVar)t);
}else if(t instanceof RefType){
return UnifyTypeFactory.convert((RefType)t);
}else if(t instanceof FunN){
return UnifyTypeFactory.convert((FunN)t);
}else if(t instanceof TypePlaceholder){
return UnifyTypeFactory.convert((TypePlaceholder)t);
}else if(t instanceof ExtendsWildcardType){
return UnifyTypeFactory.convert((ExtendsWildcardType)t);
}else if(t instanceof SuperWildcardType){
return UnifyTypeFactory.convert((SuperWildcardType)t);
}else if(t instanceof RefType){
return UnifyTypeFactory.convert((RefType)t);
}
throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden");
}
@ -93,6 +99,18 @@ public class UnifyTypeFactory {
return ret;
}
public static UnifyType convert(FunN t){
UnifyType ret;
Menge<UnifyType> params = new Menge<>();
if(t.getParaList() != null && t.getParaList().size() > 0){
for(Type pT : t.getParaList()){
params.add(UnifyTypeFactory.convert(pT));
}
}
ret = FunNType.getFunNType(new TypeParams(params));
return ret;
}
public static UnifyType convert(TypePlaceholder tph){
return new PlaceholderType(tph.get_Name());
}
@ -151,7 +169,15 @@ public class UnifyTypeFactory {
}
public static Type convert(ReferenceType t) {
return new RefType(t.getName(),null,0);
RefType ret = new RefType(t.getName(),null,0);
ret.set_ParaList(convert(t.getTypeParams()));
return ret;
}
public static Type convert(FunNType t) {
RefType ret = new RefType(t.getName(),null,0);
ret.set_ParaList(convert(t.getTypeParams()));
return ret;
}
public static Type convert(SuperType t) {
@ -169,10 +195,20 @@ public class UnifyTypeFactory {
}
public static Type convert(UnifyType t) {
if(t instanceof FunNType)return convert((FunNType) t);
if(t instanceof ReferenceType)return convert((ReferenceType) t);
if(t instanceof SuperType)return convert((SuperType) t);
if(t instanceof ExtendsType)return convert((ExtendsType) t);
if(t instanceof PlaceholderType)return convert((PlaceholderType) t);
throw new NotImplementedException("Der Typ "+t+" kann nicht umgewandelt werden");
}
private static List<Type> convert(TypeParams typeParams) {
List<Type> ret = new ArrayList<>();
for(UnifyType uT : typeParams){
ret.add(convert(uT));
}
return ret;
}
}

View File

@ -99,59 +99,6 @@ public class LocalVarDecl extends Statement implements TypeInsertable
}
// ino.end
// ino.method.is_declared.25587.definition
public void is_declared(Type t, Menge<Class> classlist)
throws SCStatementException
// ino.end
// ino.method.is_declared.25587.body
{
boolean flag=false;
for(Enumeration<Class> e = classlist.elements();e.hasMoreElements();){
flag = false;
Class c = e.nextElement();
// System.out.println("is_init: vergleiche "+t.get_Type_()+" mit "+c.get_classname());
if(c.getName().equals(t.getName())){
// System.out.println("Klasse "+t.get_Type()+" im Menge classlist gefunden.");
flag = true;
break;
}
}
if ( t instanceof RefType )
{
if(((RefType)t).get_ParaList()!=null)
{
if( ((RefType)t).get_ParaList().size()>0)
{
for(Enumeration e1 = ((RefType)t).get_ParaList().elements();e1.hasMoreElements();)
{
try
{
is_declared((Type)e1.nextElement(),classlist);
}
catch(SCStatementException ex)
{
throw ex;
}
}
}
}
}
if(!flag)
{
SCStatementException ex = new SCStatementException();
SCExcept e = new SCExcept();
e.set_error("unbekannte Klasse "+t.getName()+".");
e.set_function("complete_parahashtable() --> is_declared()");
e.set_statement(t.getName().toString());
ex.addException(e);
throw ex;
}
}
// ino.end
/*
// ino.method.check_anz.25590.definition
public void check_anz(Type type, Menge paralist, Menge<Class> classlist)

View File

@ -1,5 +1,7 @@
package de.dhbwstuttgart.syntaxtree.type;
import java.util.List;
import de.dhbwstuttgart.bytecode.ClassGenerator;
import de.dhbwstuttgart.parser.JavaClassName;
import de.dhbwstuttgart.syntaxtree.Class;
@ -12,7 +14,7 @@ import de.dhbwstuttgart.typeinference.TypeinferenceResultSet;
public class GenericClassType extends RefType{
public GenericClassType(String fullyQualifiedName, Menge parameter, SyntaxTreeNode parent, int offset) {
public GenericClassType(String fullyQualifiedName, List parameter, SyntaxTreeNode parent, int offset) {
super(fullyQualifiedName, parameter, parent, offset);
}

View File

@ -6,6 +6,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.logger.Logger;
@ -47,7 +48,7 @@ public class RefType extends ObjectType implements IMatchable
private boolean IsArray = false;
// ino.attribute.parameter.26625.declaration
private Menge<Type> parameter = null;
private List<Type> parameter = null;
// ino.end
// ino.attribute.primitiveFlag.29412.decldescription type=javadoc
/**
@ -97,7 +98,7 @@ public class RefType extends ObjectType implements IMatchable
}
// ino.method.RefType.26640.definition
public RefType(String fullyQualifiedName, Menge parameter,SyntaxTreeNode parent, int offset)
public RefType(String fullyQualifiedName, List parameter,SyntaxTreeNode parent, int offset)
// ino.end
// ino.method.RefType.26640.body
{
@ -134,52 +135,6 @@ public class RefType extends ObjectType implements IMatchable
this(jName.toString(), parent, offset);
}
// ino.method.Type2Key.26646.definition
public String Type2Key()
// ino.end
// ino.method.Type2Key.26646.body
{
if(parameter==null)
{
return name.toString();
}
else
{
String para = new String();
for(Enumeration e=parameter.elements();e.hasMoreElements();)
{
String t = ((Type)e.nextElement()).Type2Key();
if(para.length() > 0)
para = para +", "+ t;
else para = " " + t;
}
return name + "<"+para + " >" ;
}
}
// ino.end
// ino.method.Type2String.26649.definition
public String Type2String()
// ino.end
// ino.method.Type2String.26649.body
{
if(parameter==null)
{
return name.toString();
}
else
{
String para = new String();
for(Enumeration e=parameter.elements();e.hasMoreElements();)
{
String t = ((Type)e.nextElement()).Type2String();
if(para.length() > 0)
para = para +", "+ t;
else para = " " + t;
}
return name + "<"+para + " >" ;
}
}
/**
* Wandelt die Parameter des RefTypes in TPHs um, sofern es sich um Generische Variablen handelt.
@ -290,7 +245,7 @@ public class RefType extends ObjectType implements IMatchable
* @param v
*/
// ino.method.set_ParaList.26661.definition
public void set_ParaList(Menge<Type> v)
public void set_ParaList(List<Type> v)
// ino.end
// ino.method.set_ParaList.26661.body
{
@ -310,7 +265,7 @@ public class RefType extends ObjectType implements IMatchable
* @return gibt bei leere Parameterliste null zurück. Ist entscheidend ¼r unify-Algorithmus
*/
// ino.method.get_ParaList.26664.definition
public Menge<Type> get_ParaList()
public List<Type> get_ParaList()
// ino.end
// ino.method.get_ParaList.26664.body
{
@ -319,7 +274,7 @@ public class RefType extends ObjectType implements IMatchable
}
// ino.end
public Menge<Type> getParaList(){
public List<Type> getParaList(){
if(this.parameter==null)return new Menge<>();
return this.parameter;
}
@ -341,179 +296,7 @@ public class RefType extends ObjectType implements IMatchable
// otth: Liefert den Namen des Typs, ohne Parameter, z.B. Stapel bei Stapel<IntZahl>
return name.toString();
}
// ino.end
// ino.method.getParaN.26673.definition
public String getParaN( int n )
throws SCException
// ino.end
// ino.method.getParaN.26673.body
{
// otth: liefert n.ten Parameter
if( parameter == null )
{
throw new SCException();
}
if( n >= parameter.size() )
return "";
return ((Type)parameter.elementAt(n)).getName().toString();
}
// ino.end
// ino.method.isTV.26676.definition
public boolean isTV( int n )
// ino.end
// ino.method.isTV.26676.body
{
// otth: Prueft, ob Parameter n eine TV ist
return parameter.elementAt(n) instanceof TypePlaceholder;
}
// ino.end
// ino.method.is_Equiv.26679.defdescription type=line
// GenericTypeVar ergaenzt PL 06-03-16
// ino.end
// ino.method.is_Equiv.26679.definition
public boolean is_Equiv(RefType ty2, Hashtable<JavaClassName,Type> ht)
// ino.end
// ino.method.is_Equiv.26679.body
{
//vergleicht einen Typ ty2 mit dem aktuellen Typ, ob es bis auf Variablenumbennung
//gleich ist.
//System.out.println("is_EquivSTART: " + this.get_Type());
//System.out.println("is_EquivSTART: " + ty2.get_Type());
if (this.getTypeName().equals(ty2.getTypeName())) {
//System.out.println("is_EquivSTARTx: " + this.get_Type());
if ((get_ParaList() != null) && (ty2.get_ParaList() != null)) {
if (get_ParaList().size() == ty2.get_ParaList().size()) {
for(int i=0; i < get_ParaList().size(); i++) {
Type pty1 = (Type)get_ParaList().elementAt(i);
Type pty2 = (Type)ty2.get_ParaList().elementAt(i);
if ((pty1 instanceof RefType) && (pty2 instanceof RefType)) {
//System.out.println("Instance RefType" + ((RefType)pty1).get_Type());
//System.out.println("Instance RefType" + ((RefType)pty2).get_Type());
if (!((RefType)pty1).is_Equiv((RefType)pty2, ht)) return false;
}
else {
if ((pty1 instanceof TypePlaceholder) && (pty2 instanceof TypePlaceholder)) {
//System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty1).get_Type()));
//System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty2).get_Type()));
if (ht.get((((TypePlaceholder)pty1).getName())) != null) {
//System.out.println(ht.get((((TypePlaceholder)pty1).getName())));
if (!((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().equals(pty2.getName())) return false;
}
else {
//System.out.println("INPUT" + pty1.getName());
//System.out.println("INPUT" + pty2);
ht.put(pty1.getName(), pty2);
}
}
else {
if ((pty1 instanceof GenericTypeVar) && (pty2 instanceof GenericTypeVar)) {
if (ht.get((((GenericTypeVar)pty1).getName())) != null) {
if (!((GenericTypeVar)ht.get((((GenericTypeVar)pty1).getName()))).getName().equals(pty2.getName())) return false;
}
else {
ht.put(pty1.getName(), pty2);
}
}
else {
return false;
}
}
}
}
return true;
}
else {
return false;
}
}
else {
//Typ ohne Parameter
return true;
}
}
else {
return false;
}
}
// ino.end
// ino.method.Equiv2Equal.26682.definition
public boolean Equiv2Equal(RefType ty2, Hashtable<JavaClassName,Type> ht)
// ino.end
// ino.method.Equiv2Equal.26682.body
{
//vergleicht einen Typ ty2 mit dem aktuellen Typ, ob er bis auf Variablenumbennung
//gleich ist und bennent ty2 so um, dass sie gleich sind.
//System.out.println("is_EquivSTART: " + this.getName());
//System.out.println("is_EquivSTART: " + ty2.getName());
if (this.getTypeName().equals(ty2.getTypeName())) {
//System.out.println("is_EquivSTARTx: " + this.getName());
if ((get_ParaList() != null) && (ty2.get_ParaList() != null)) {
if (get_ParaList().size() == ty2.get_ParaList().size()) {
for(int i=0; i < get_ParaList().size(); i++) {
Type pty1 = (Type)get_ParaList().elementAt(i);
Type pty2 = (Type)ty2.get_ParaList().elementAt(i);
if ((pty1 instanceof RefType) && (pty2 instanceof RefType)) {
//System.out.println("Instance RefType" + ((RefType)pty1).getName());
//System.out.println("Instance RefType" + ((RefType)pty2).getName());
if (!((RefType)pty1).is_Equiv((RefType)pty2, ht)) return false;
}
else {
if ((pty1 instanceof TypePlaceholder) && (pty2 instanceof TypePlaceholder)) {
//System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty1).getName()));
//System.out.println("Instance TypePlaceholder" + (((TypePlaceholder)pty2).getName()));
if (ht.get((((TypePlaceholder)pty1).getName())) != null) {
//System.out.println(ht.get((((TypePlaceholder)pty1).getName())));
if (!((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().equals(pty2.getName())) return false;
else { //Typvariablen gleich machen
// #JB# 11.04.2005
// ###########################################################
((TypePlaceholder)pty2).backdoorSetName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName().toString());
//pty2.setName(((TypePlaceholder)ht.get((((TypePlaceholder)pty1).getName()))).getName());
// ###########################################################
}
}
else {
//System.out.println("INPUT" + pty1.getName());
//System.out.println("INPUT" + pty2);
ht.put(pty1.getName(), pty2);
// #JB# 11.04.2005
// ###########################################################
((TypePlaceholder)pty2).backdoorSetName(pty1.getName().toString());
//pty2.setName(pty1.getName());
// ###########################################################
}
}
else {
return false;
}
}
}
return true;
}
else {
return false;
}
}
else {
//Typ ohne Parameter
return true;
}
}
else {
return false;
}
}
// ino.end
// ino.method.equals.26685.defdescription type=javadoc
/**
* Author: Jrg Buerle<br/>
* @param Object
@ -565,11 +348,11 @@ public class RefType extends ObjectType implements IMatchable
{
if(this.get_ParaList() != null )
{
Menge para = this.get_ParaList();
List para = this.get_ParaList();
Menge<Type> clonepara = new Menge<Type>();
for(int i = 0; i< para.size(); i++)
{
clonepara.addElement(((Type)para.elementAt(i)).clone());
clonepara.addElement(((Type)para.get(i)).clone());
}
RefType newRefType=new RefType(this.getTypeName(), clonepara,this.getParent(),getOffset());
newRefType.setPrimitiveFlag(this.getPrimitiveFlag());
@ -598,10 +381,10 @@ public class RefType extends ObjectType implements IMatchable
else
{
String para = new String();
Enumeration e=parameter.elements();
while(e.hasMoreElements())
Iterator<Type> e=parameter.iterator();
while(e.hasNext())
{
Type ty = (Type)e.nextElement();
Type ty = (Type)e.next();
String t = ty.toString();
if(para.length() > 0)
para = para +", "+ t;

View File

@ -3,6 +3,9 @@ package de.dhbwstuttgart.typeinference;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
import java.util.List;
import de.dhbwstuttgart.syntaxtree.Class;
import de.dhbwstuttgart.syntaxtree.Method;
import de.dhbwstuttgart.syntaxtree.ParameterList;
@ -16,10 +19,10 @@ public class FunNMethod extends Method{
*
* @param N - Anzahl der Parameter (Beispiel: Fun2<R, T1, T2>)
*/
public FunNMethod(Menge<? extends Type> paralist){
public FunNMethod(List<? extends Type> paralist){
super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode
int N = paralist.size(); //In der paraliste ist der erste Parameter der ¼ckgabetyp
this.setType(paralist.firstElement());
this.setType(paralist.get(0));
this.set_DeclId(new DeclId("apply"));
ParameterList pl = new ParameterList();
Menge<FormalParameter> fpList = new Menge<FormalParameter>();

View File

@ -1,6 +1,7 @@
package de.dhbwstuttgart.typeinference;
import de.dhbwstuttgart.typeinference.Menge;
import java.util.List;
import de.dhbwstuttgart.syntaxtree.type.Void;
import de.dhbwstuttgart.syntaxtree.FormalParameter;
@ -17,7 +18,7 @@ public class FunVoidNMethod extends Method{
*
* @param N - Anzahl der Parameter (Beispiel: Fun2<R, T1, T2>)
*/
public FunVoidNMethod(Menge<? extends Type> paralist, Class parent){
public FunVoidNMethod(List<? extends Type> paralist, Class parent){
super(0); //Hat keinen Offset, da nur theoretisch gedachte Methode
int N = paralist.size();
this.setType(new Void(this, -1));

View File

@ -59,7 +59,9 @@ public class OderConstraint extends OderMenge<Pair>{
* @param toAdd
*/
public void addConstraint(Pair toAdd){
oderConstraintPairs.add(new SingleConstraint(toAdd));
UndConstraint uCons = new UndConstraint();
uCons.addConstraint(toAdd);
oderConstraintPairs.add(uCons);
}
@Override

View File

@ -9,6 +9,7 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.Hashtable;
import java.util.List;
import de.dhbwstuttgart.typeinference.Menge;
import de.dhbwstuttgart.typeinference.unify.model.PairOperator;
@ -143,8 +144,8 @@ public class Pair implements Serializable, DeepCloneable
RefType RT1=(RefType)TA1;
RefType RT2=(RefType)TA2;
if(RT1.getTypeName().equals(RT2.getTypeName())){
Menge<Type> v1=RT1.get_ParaList();
Menge<Type> v2=RT2.get_ParaList();
List<Type> v1=RT1.get_ParaList();
List<Type> v2=RT2.get_ParaList();
if(v1==null && v2==null){
return true;
}else{
@ -155,8 +156,8 @@ public class Pair implements Serializable, DeepCloneable
return false;
}else{
for(int i=0;i<v1.size();i++){
Type t1=v1.elementAt(i);
Type t2=v2.elementAt(i);
Type t1=v1.get(i);
Type t2=v2.get(i);
if(((t1 instanceof GenericTypeVar) && (t2 instanceof GenericTypeVar ))){
// alles ok, egal was drin steht, denn das kann man so nicht nachvollz.
}else{
@ -257,52 +258,6 @@ public class Pair implements Serializable, DeepCloneable
}
// ino.end
// ino.method.Pair_isEquiv.26582.definition
public boolean Pair_isEquiv(Pair p)
// ino.end
// ino.method.Pair_isEquiv.26582.body
{
//vergleicht Paare mit Reftype's, bis auf Variablenumbennung
Hashtable<JavaClassName,Type> ht = new Hashtable<JavaClassName,Type>();
//System.out.println((((RefType)TA1).is_Equiv((RefType)p.TA1, ht)));
//System.out.println(((RefType)TA2).is_Equiv((RefType)p.TA2, ht));
//Typen boxen, da es sich um TypePlaceholder handeln koennte
Menge<Type> hilfsMenge1 = new Menge<Type>();
Menge<Type> hilfsMenge2 = new Menge<Type>();
hilfsMenge1.addElement(TA1);
hilfsMenge2.addElement(TA2);
Menge<Type> hilfsMenge3 = new Menge<Type>();
Menge<Type> hilfsMenge4 = new Menge<Type>();
hilfsMenge3.addElement(p.TA1);
hilfsMenge4.addElement(p.TA2);
//return (((RefType)TA1).is_Equiv((RefType)p.TA1, ht) && ((RefType)TA2).is_Equiv((RefType)p.TA2, ht));
return (new RefType("dummy", hilfsMenge3,null,-1)).is_Equiv(new RefType("dummy", hilfsMenge1,null,-1), ht) &&
(new RefType("dummy", hilfsMenge4,null,-1)).is_Equiv(new RefType("dummy", hilfsMenge2,null,-1), ht);
}
// ino.end
// ino.method.isInMenge.26585.definition
public boolean isInMenge( Menge<Pair> V )
// ino.end
// ino.method.isInMenge.26585.body
{
// otth: prueft, ob Paar in Vektor liegt
for( int i = 0; i < V.size(); i++ )
{
if( V.elementAt(i) instanceof Pair )
{
//if( this.toString().equals( ( (Pair)V.elementAt(i) ).toString() ) )
if(Pair_isEquiv(V.elementAt(i))) {
return true;
}
}
}
return false;
}
// ino.end
// ino.method.equals.26588.defdescription type=javadoc
/**
* <br/>Author: ¯Â¿Â½rg ¯Â¿Â½uerle

View File

@ -33,7 +33,11 @@ public class UndConstraint extends UndMenge<Pair> {
public void addConstraint(Type type, Type rT) {
Pair p = new Pair(type, rT);
this.set.add(new EinzelElement<Pair>(p));
addConstraint(p);
}
public void addConstraint(Pair toAdd){
this.set.add(new EinzelElement<Pair>(toAdd));
}
@Override