Erste Implementierung des IntermediateType und unvollständige Implementierung von IntermediateRefType.
This commit is contained in:
parent
c22d12f6b0
commit
f457e7e4d0
@ -0,0 +1,5 @@
|
||||
package de.dhbwstuttgart.intermediate.convert;
|
||||
|
||||
public class ASTToIntermediate {
|
||||
//ToDo
|
||||
}
|
@ -1,4 +1,13 @@
|
||||
package de.dhbwstuttgart.intermediate.types;
|
||||
|
||||
public class IntermediateExtendsWildcard {
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
|
||||
/**
|
||||
* //ToDo Beschreiben
|
||||
*
|
||||
* @since Studienarbeit Type Erasure
|
||||
* @author etiennezink
|
||||
*/
|
||||
public final class IntermediateExtendsWildcard {
|
||||
//ToDo
|
||||
}
|
||||
|
@ -1,4 +1,13 @@
|
||||
package de.dhbwstuttgart.intermediate.types;
|
||||
|
||||
public class IntermediateGenericType {
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
|
||||
/**
|
||||
* //ToDo Beschreiben
|
||||
*
|
||||
* @since Studienarbeit Type Erasure
|
||||
* @author etiennezink
|
||||
*/
|
||||
public final class IntermediateGenericType {
|
||||
//ToDo
|
||||
}
|
||||
|
@ -1,4 +1,68 @@
|
||||
package de.dhbwstuttgart.intermediate.types;
|
||||
|
||||
public class IntermediateRefType {
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a Java reference type.
|
||||
*
|
||||
* @since Studienarbeit Type Erasure
|
||||
* @author etiennezink
|
||||
*/
|
||||
public final class IntermediateRefType extends IntermediateType{
|
||||
|
||||
private final List<IntermediateRefType> typParameters;
|
||||
|
||||
public IntermediateRefType(JavaClassName className) {
|
||||
this(className, new ArrayList<>());
|
||||
}
|
||||
|
||||
public IntermediateRefType(JavaClassName className, List<IntermediateRefType> typParameters){
|
||||
super(className);
|
||||
this.typParameters = Collections.unmodifiableList(typParameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassSignature() {
|
||||
//ToDo
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassDescriptor() {
|
||||
//ToDo
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (!(o instanceof IntermediateRefType)) return false;
|
||||
|
||||
IntermediateRefType intermediateRefType = (IntermediateRefType) o;
|
||||
if(!getFullyQualifiedName().equals(intermediateRefType.getFullyQualifiedName())) return false;
|
||||
|
||||
for(int index = 0; index < typParameters.size(); index++){
|
||||
if(!typParameters.get(index).equals(intermediateRefType.typParameters.get(index))) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
//ToDo korrekte Definition auf Basis von equals
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getTypParameterSize(){ return typParameters.size(); }
|
||||
|
||||
/**
|
||||
* @param index
|
||||
* @return the typ parameter at {@code index} or {@code null}, iff {@code |typ parameters| < index}
|
||||
*/
|
||||
public IntermediateType getTypParameter(int index) {
|
||||
if(getTypParameterSize() < index) return null;
|
||||
return typParameters.get(index);
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,13 @@
|
||||
package de.dhbwstuttgart.intermediate.types;
|
||||
|
||||
public class IntermediateSuperWildcard {
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
|
||||
/**
|
||||
* //ToDo Beschreiben
|
||||
*
|
||||
* @since Studienarbeit Type Erasure
|
||||
* @author etiennezink
|
||||
*/
|
||||
public final class IntermediateSuperWildcard {
|
||||
//ToDo
|
||||
}
|
||||
|
@ -1,5 +1,36 @@
|
||||
package de.dhbwstuttgart.intermediate.types;
|
||||
|
||||
public interface IntermediateType {
|
||||
|
||||
import de.dhbwstuttgart.core.IItemWithOffset;
|
||||
import de.dhbwstuttgart.parser.scope.JavaClassName;
|
||||
import org.antlr.v4.runtime.Token;
|
||||
|
||||
/**
|
||||
* //ToDo Beschreiben
|
||||
*
|
||||
* @since Studienarbeit Type Erasure
|
||||
* @author etiennezink
|
||||
*/
|
||||
public abstract class IntermediateType {
|
||||
|
||||
private final JavaClassName className;
|
||||
|
||||
public IntermediateType(JavaClassName className){ this.className = className; }
|
||||
|
||||
@Override
|
||||
public abstract boolean equals(Object o);
|
||||
|
||||
@Override
|
||||
public abstract int hashCode();
|
||||
|
||||
public abstract String getClassSignature();
|
||||
public abstract String getClassDescriptor();
|
||||
|
||||
@Override
|
||||
public String toString() { return getFullyQualifiedName(); }
|
||||
|
||||
public String getClassName() {
|
||||
return className.getClassName();
|
||||
}
|
||||
public String getPackageName() { return className.getPackageName(); }
|
||||
public String getFullyQualifiedName() { return className.toString(); }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user