Refactoring and added tests

parent 87a112a5
This diff is collapsed.
This source diff could not be displayed because it is too large. You can view the blob instead.
File added
......@@ -18,21 +18,21 @@ grammar CNNArch extends de.monticore.lang.math.Math {
Use nonterminal Architecture for embedding in another language (e.g. EmbeddedMontiArc)
*/
symbol scope CNNArchCompilationUnit = "architecture"
name:Name&
name:Name
( "(" (ArchitectureParameter || ",")* ")" )? "{"
ioDeclarations:IODeclaration*
Architecture
"}";
MethodDeclaration = NEWLINETOKEN* "def"
Name& "("
parameters:(MethodParameter || ",")* ")" "{" NEWLINETOKEN*
body:ArchBody NEWLINETOKEN* "}";
LayerDeclaration = NEWLINETOKEN* "def"
Name "("
parameters:(LayerParameter || ",")* ")" "{" NEWLINETOKEN*
body:ArchBody NEWLINETOKEN* "}";
IODeclaration = NEWLINETOKEN* "def"
(in:"input" | out:"output")
type:ArchType
Name&
Name
(ArrayDeclaration)?;
......@@ -53,22 +53,24 @@ grammar CNNArch extends de.monticore.lang.math.Math {
Defines the architecture of the neural network.
This NT is used for integration in EmbeddedMontiArc.
@attribute methodDeclaration*
A list of new methods/layers which can be used in the architecture.
A list of new layers which can be used in the architecture.
@attribute body
The architecture of the neural network.
*/
Architecture = NEWLINETOKEN* methodDeclaration:MethodDeclaration* NEWLINETOKEN*
Architecture = NEWLINETOKEN* methodDeclaration:LayerDeclaration* NEWLINETOKEN*
body:ArchBody NEWLINETOKEN*;
scope ArchBody = elements:(ArchitectureElement || "->")*;
interface ArchitectureElement;
IOLayer implements ArchitectureElement = NEWLINETOKEN* Name& ("[" index:ArchSimpleExpression "]")?;
IOElement implements ArchitectureElement = NEWLINETOKEN* Name ("[" index:ArchSimpleExpression "]")?;
MethodLayer implements ArchitectureElement = NEWLINETOKEN* Name& "(" arguments:(ArchArgument || ",")* ")";
Layer implements ArchitectureElement = NEWLINETOKEN* Name "(" arguments:(ArchArgument || ",")* ")";
ParallelLayer implements ArchitectureElement = NEWLINETOKEN* "(" NEWLINETOKEN* groups:ArchBody NEWLINETOKEN* "|" NEWLINETOKEN* groups:(ArchBody || "|")+ NEWLINETOKEN* ")";
ParallelBlock implements ArchitectureElement = NEWLINETOKEN* "(" NEWLINETOKEN*
groups:ArchBody NEWLINETOKEN* "|" NEWLINETOKEN*
groups:(ArchBody || "|")+ NEWLINETOKEN* ")";
ArrayAccessLayer implements ArchitectureElement = NEWLINETOKEN* "[" index:ArchSimpleExpression "]";
......@@ -77,16 +79,17 @@ grammar CNNArch extends de.monticore.lang.math.Math {
interface Variable;
ArchitectureParameter implements Variable = NEWLINETOKEN* Name& ("=" default:ArchSimpleExpression)? NEWLINETOKEN*;
ArchitectureParameter implements Variable = NEWLINETOKEN* Name ("=" default:ArchSimpleExpression)? NEWLINETOKEN*;
MethodParameter implements Variable = NEWLINETOKEN* Name& ("=" default:ArchSimpleExpression)? NEWLINETOKEN*;
LayerParameter implements Variable = NEWLINETOKEN* Name ("=" default:ArchSimpleExpression)? NEWLINETOKEN*;
interface ArchArgument;
ArchParameterArgument implements ArchArgument = NEWLINETOKEN* Name "=" rhs:ArchExpression NEWLINETOKEN*;
ArchSpecialArgument implements ArchArgument = NEWLINETOKEN* (serial:"->" | parallel:"|" | conditional:"?") "="
rhs:ArchExpression NEWLINETOKEN*;
ArchSpecialArgument implements ArchArgument = NEWLINETOKEN*
(serial:"->" | parallel:"|" | conditional:"?") "="
rhs:ArchExpression NEWLINETOKEN*;
/* ======= Value Expressions =======*/
......@@ -108,14 +111,14 @@ grammar CNNArch extends de.monticore.lang.math.Math {
(serial2:"->" | parallel2:"|")
end:ArchSimpleExpression "]";
/**
Expression for variable values.
Expressions for variable values.
*/
ArchSimpleExpression = (arithmeticExpression:MathArithmeticExpression
| booleanExpression:MathBooleanExpression
| tupleExpression:TupleExpression
| string:StringLiteral);
TupleExpression = "(" expressions:MathExpression "," expressions:(MathExpression || ",")* ")";
TupleExpression = "(" expressions:MathArithmeticExpression "," expressions:(MathArithmeticExpression || ",")* ")";
/* =================================*/
......
......@@ -62,7 +62,7 @@ public class CNNArchCocos {
public static CNNArchSymbolCoCoChecker createCNNArchPostResolveSymbolChecker() {
return new CNNArchSymbolCoCoChecker()
.addCoCo(new CheckIOType())
.addCoCo(new CheckLayerInputs())
.addCoCo(new CheckElementInputs())
.addCoCo(new CheckIOAccessAndIOMissing())
.addCoCo(new CheckArchitectureFinished());
}
......@@ -71,17 +71,17 @@ public class CNNArchCocos {
public static CNNArchSymbolCoCoChecker createCNNArchPreResolveSymbolChecker() {
return new CNNArchSymbolCoCoChecker()
.addCoCo(new CheckIOName())
.addCoCo(new CheckNameExpression());
.addCoCo(new CheckExpressions());
}
//checks all normal cocos
public static CNNArchCoCoChecker createASTChecker() {
return new CNNArchCoCoChecker()
.addCoCo(new CheckMethodLayer())
.addCoCo(new CheckLayer())
.addCoCo(new CheckRangeOperators())
.addCoCo(new CheckVariableName())
.addCoCo(new CheckMethodName())
.addCoCo(new CheckLayerName())
.addCoCo(new CheckArgument())
.addCoCo(new CheckMethodRecursion());
.addCoCo(new CheckLayerRecursion());
}
}
......@@ -30,11 +30,11 @@ public class CNNArchSymbolCoCo {
if (sym instanceof ArchitectureSymbol){
check((ArchitectureSymbol) sym);
}
else if (sym instanceof MethodDeclarationSymbol){
check((MethodDeclarationSymbol) sym);
else if (sym instanceof LayerDeclarationSymbol){
check((LayerDeclarationSymbol) sym);
}
else if (sym instanceof LayerSymbol){
check((LayerSymbol) sym);
else if (sym instanceof ArchitectureElementSymbol){
check((ArchitectureElementSymbol) sym);
}
else if (sym instanceof ArchExpressionSymbol){
check((ArchExpressionSymbol) sym);
......@@ -68,11 +68,11 @@ public class CNNArchSymbolCoCo {
//Override if needed
}
public void check(MethodDeclarationSymbol sym){
public void check(LayerDeclarationSymbol sym){
//Override if needed
}
public void check(LayerSymbol sym){
public void check(ArchitectureElementSymbol sym){
//Override if needed
}
......
......@@ -22,7 +22,7 @@ package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._ast.ASTArchArgument;
import de.monticore.lang.monticar.cnnarch._symboltable.ArgumentSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.MethodDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.Joiners;
import de.se_rwth.commons.logging.Log;
......@@ -32,11 +32,11 @@ public class CheckArgument implements CNNArchASTArchArgumentCoCo {
@Override
public void check(ASTArchArgument node) {
ArgumentSymbol argument = (ArgumentSymbol) node.getSymbol().get();
MethodDeclarationSymbol method = argument.getMethodLayer().getMethod();
if (method != null && argument.getParameter() == null){
LayerDeclarationSymbol layerDeclaration = argument.getLayer().getDeclaration();
if (layerDeclaration != null && argument.getParameter() == null){
Log.error("0"+ ErrorCodes.UNKNOWN_ARGUMENT + " Unknown Argument. " +
"Parameter with name '" + node.getName() + "' does not exist. " +
"Possible arguments are: " + Joiners.COMMA.join(method.getParameters())
"Possible arguments are: " + Joiners.COMMA.join(layerDeclaration.getParameters())
, node.get_SourcePositionStart());
}
}
......
......@@ -22,7 +22,7 @@ package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
public class CheckLayerInputs extends CNNArchSymbolCoCo {
public class CheckElementInputs extends CNNArchSymbolCoCo {
@Override
public void check(ArchitectureSymbol architecture) {
......
......@@ -31,16 +31,16 @@ import de.se_rwth.commons.logging.Log;
import java.util.Collection;
public class CheckNameExpression extends CNNArchSymbolCoCo {
public class CheckExpressions extends CNNArchSymbolCoCo {
@Override
public void check(ArchExpressionSymbol sym) {
if (sym instanceof ArchSimpleExpressionSymbol){
checkSimpleExpression((ArchSimpleExpressionSymbol) sym);
checkNamesInExpression((ArchSimpleExpressionSymbol) sym);
}
}
public void checkSimpleExpression(ArchSimpleExpressionSymbol expression) {
public void checkNamesInExpression(ArchSimpleExpressionSymbol expression) {
if (expression.getMathExpression().isPresent()){
MathExpressionSymbol mathExpression = expression.getMathExpression().get();
......@@ -56,8 +56,6 @@ public class CheckNameExpression extends CNNArchSymbolCoCo {
}
}
}
}
}
}
......@@ -22,7 +22,7 @@ package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IODeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IOLayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IOSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.Joiners;
import de.se_rwth.commons.logging.Log;
......@@ -48,16 +48,16 @@ public class CheckIOAccessAndIOMissing extends CNNArchSymbolCoCo {
}
private void checkSingleIO(IODeclarationSymbol ioDeclaration){
if (ioDeclaration.getConnectedLayers().isEmpty()){
if (ioDeclaration.getConnectedElements().isEmpty()){
Log.error("0" + ErrorCodes.MISSING_IO + " Input or output '" + ioDeclaration.getName() + "' was declared but never used."
, ioDeclaration.getSourcePosition());
}
else {
for (IOLayerSymbol layer : ioDeclaration.getConnectedLayers()){
if (layer.getArrayAccess().isPresent()){
for (IOSymbol ioElement : ioDeclaration.getConnectedElements()){
if (ioElement.getArrayAccess().isPresent()){
Log.error("0" + ErrorCodes.INVALID_ARRAY_ACCESS + " Invalid IO array access. " +
"This input or output is not an array."
, layer.getSourcePosition());
, ioElement.getSourcePosition());
}
}
}
......@@ -67,17 +67,17 @@ public class CheckIOAccessAndIOMissing extends CNNArchSymbolCoCo {
private void checkIOArray(IODeclarationSymbol ioDeclaration){
List<Integer> unusedIndices = IntStream.range(0, ioDeclaration.getArrayLength()).boxed().collect(Collectors.toList());
for (IOLayerSymbol layer : ioDeclaration.getConnectedLayers()){
if (layer.getArrayAccess().isPresent()){
Optional<Integer> arrayAccess = layer.getArrayAccess().get().getIntValue();
for (IOSymbol ioElement : ioDeclaration.getConnectedElements()){
if (ioElement.getArrayAccess().isPresent()){
Optional<Integer> arrayAccess = ioElement.getArrayAccess().get().getIntValue();
if (arrayAccess.isPresent() && arrayAccess.get() >= 0 && arrayAccess.get() < ioDeclaration.getArrayLength()){
unusedIndices.remove(arrayAccess.get());
}
else {
Log.error("0" + ErrorCodes.INVALID_ARRAY_ACCESS + " The IO array access value of '" + layer.getName() +
Log.error("0" + ErrorCodes.INVALID_ARRAY_ACCESS + " The IO array access value of '" + ioElement.getName() +
"' must be an integer between 0 and " + (ioDeclaration.getArrayLength()-1) + ". " +
"The current value is: " + layer.getArrayAccess().get().getValue().get().toString()
, layer.getSourcePosition());
"The current value is: " + ioElement.getArrayAccess().get().getValue().get().toString()
, ioElement.getSourcePosition());
}
}
else{
......
......@@ -20,9 +20,9 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IODeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IOLayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.IOSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
......@@ -35,19 +35,19 @@ public class CheckIOName extends CNNArchSymbolCoCo {
private Set<IODeclarationSymbol> checkedIODeclarations = new HashSet<>();
@Override
public void check(LayerSymbol sym) {
if (sym instanceof IOLayerSymbol){
checkIOLayer((IOLayerSymbol) sym);
public void check(ArchitectureElementSymbol sym) {
if (sym instanceof IOSymbol){
checkIOElement((IOSymbol) sym);
}
}
public void checkIOLayer(IOLayerSymbol ioLayer) {
Collection<IODeclarationSymbol> ioDeclarations = ioLayer.getEnclosingScope().resolveMany(ioLayer.getName(), IODeclarationSymbol.KIND);
public void checkIOElement(IOSymbol ioElement) {
Collection<IODeclarationSymbol> ioDeclarations = ioElement.getEnclosingScope().resolveMany(ioElement.getName(), IODeclarationSymbol.KIND);
if (ioDeclarations.isEmpty()){
Log.error("0" + ErrorCodes.UNKNOWN_IO + " Unknown input or output name. " +
"The input or output '" + ioLayer.getName() + "' does not exist"
, ioLayer.getSourcePosition());
"The input or output '" + ioElement.getName() + "' does not exist"
, ioElement.getSourcePosition());
}
else {
IODeclarationSymbol ioDeclaration = ioDeclarations.iterator().next();
......
......@@ -41,7 +41,7 @@ public class CheckIOType extends CNNArchSymbolCoCo {
public void checkIO(IODeclarationSymbol ioDeclaration) {
ArchTypeSymbol type = ioDeclaration.getType();
if (type.getElementType().isIsComplex() || type.getElementType().isIsBoolean()){
if (type.getDomain().isIsComplex() || type.getDomain().isIsBoolean()){
Log.error("0" + ErrorCodes.INVALID_IO_TYPE + " Invalid IO element type. " +
"Type has to be rational or whole number.");
}
......
......@@ -21,10 +21,10 @@
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._ast.ASTArchArgument;
import de.monticore.lang.monticar.cnnarch._ast.ASTMethodLayer;
import de.monticore.lang.monticar.cnnarch._ast.ASTLayer;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.MethodDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.MethodLayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.VariableSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.Joiners;
......@@ -33,10 +33,10 @@ import de.se_rwth.commons.logging.Log;
import java.util.HashSet;
import java.util.Set;
public class CheckMethodLayer implements CNNArchASTMethodLayerCoCo{
public class CheckLayer implements CNNArchASTLayerCoCo{
@Override
public void check(ASTMethodLayer node) {
public void check(ASTLayer node) {
Set<String> nameSet = new HashSet<>();
for (ASTArchArgument argument : node.getArguments()){
String name = argument.getName();
......@@ -50,17 +50,17 @@ public class CheckMethodLayer implements CNNArchASTMethodLayerCoCo{
}
}
MethodDeclarationSymbol method = ((MethodLayerSymbol) node.getSymbol().get()).getMethod();
if (method == null){
LayerDeclarationSymbol layerDeclaration = ((LayerSymbol) node.getSymbol().get()).getDeclaration();
if (layerDeclaration == null){
ArchitectureSymbol architecture = node.getSymbol().get().getEnclosingScope().<ArchitectureSymbol>resolve("", ArchitectureSymbol.KIND).get();
Log.error("0" + ErrorCodes.UNKNOWN_METHOD + " Unknown method error. " +
"Method with name '" + node.getName() + "' does not exist. " +
"Existing methods: " + Joiners.COMMA.join(architecture.getMethodDeclarations()) + "."
Log.error("0" + ErrorCodes.UNKNOWN_LAYER + " Unknown layer. " +
"Layer with name '" + node.getName() + "' does not exist. " +
"Existing layers: " + Joiners.COMMA.join(architecture.getLayerDeclarations()) + "."
, node.get_SourcePositionStart());
}
else {
Set<String> requiredArguments = new HashSet<>();
for (VariableSymbol param : method.getParameters()){
for (VariableSymbol param : layerDeclaration.getParameters()){
if (!param.getDefaultExpression().isPresent()){
requiredArguments.add(param.getName());
}
......
......@@ -20,19 +20,19 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._ast.ASTMethodDeclaration;
import de.monticore.lang.monticar.cnnarch._ast.ASTLayerDeclaration;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
import java.util.HashSet;
import java.util.Set;
public class CheckMethodName implements CNNArchASTMethodDeclarationCoCo {
public class CheckLayerName implements CNNArchASTLayerDeclarationCoCo {
Set<String> methodNames = new HashSet<>();
@Override
public void check(ASTMethodDeclaration node) {
public void check(ASTLayerDeclaration node) {
String name = node.getName();
if (name.isEmpty() || !Character.isLowerCase(name.codePointAt(0))){
Log.error("0" + ErrorCodes.ILLEGAL_NAME + " Illegal name: " + name +
......
......@@ -20,48 +20,48 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._ast.ASTMethodDeclaration;
import de.monticore.lang.monticar.cnnarch._symboltable.CompositeLayerSymbol;
import de.monticore.lang.monticar.cnnarch._ast.ASTLayerDeclaration;
import de.monticore.lang.monticar.cnnarch._symboltable.ArchitectureElementSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.CompositeElementSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.LayerSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.MethodDeclarationSymbol;
import de.monticore.lang.monticar.cnnarch._symboltable.MethodLayerSymbol;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.se_rwth.commons.logging.Log;
import java.util.HashSet;
import java.util.Set;
public class CheckMethodRecursion implements CNNArchASTMethodDeclarationCoCo {
public class CheckLayerRecursion implements CNNArchASTLayerDeclarationCoCo {
Set<MethodDeclarationSymbol> seenMethods = new HashSet<>();
Set<LayerDeclarationSymbol> seenLayers = new HashSet<>();
boolean done;
@Override
public void check(ASTMethodDeclaration node) {
public void check(ASTLayerDeclaration node) {
done = false;
MethodDeclarationSymbol method = (MethodDeclarationSymbol) node.getSymbol().get();
checkForRecursion(method, method.getBody());
LayerDeclarationSymbol layerDeclaration = (LayerDeclarationSymbol) node.getSymbol().get();
checkForRecursion(layerDeclaration, layerDeclaration.getBody());
}
private void checkForRecursion(MethodDeclarationSymbol startingMethod, LayerSymbol current){
private void checkForRecursion(LayerDeclarationSymbol startingLayer, ArchitectureElementSymbol current){
if (!done) {
if (current instanceof CompositeLayerSymbol) {
for (LayerSymbol layer : ((CompositeLayerSymbol) current).getLayers()) {
checkForRecursion(startingMethod, layer);
if (current instanceof CompositeElementSymbol) {
for (ArchitectureElementSymbol architectureElement : ((CompositeElementSymbol) current).getElement()) {
checkForRecursion(startingLayer, architectureElement);
}
}
else if (current instanceof MethodLayerSymbol) {
MethodDeclarationSymbol method = ((MethodLayerSymbol) current).getMethod();
if (method != null && !method.isPredefined() && !seenMethods.contains(method)) {
seenMethods.add(method);
if (startingMethod == method) {
else if (current instanceof LayerSymbol) {
LayerDeclarationSymbol layerDeclaration = ((LayerSymbol) current).getDeclaration();
if (layerDeclaration != null && !layerDeclaration.isPredefined() && !seenLayers.contains(layerDeclaration)) {
seenLayers.add(layerDeclaration);
if (startingLayer == layerDeclaration) {
Log.error("0" + ErrorCodes.RECURSION_ERROR + " Recursion is not allowed. " +
"The method '" + startingMethod.getName() + "' creates a recursive cycle."
, startingMethod.getSourcePosition());
"The layer '" + startingLayer.getName() + "' creates a recursive cycle."
, startingLayer.getSourcePosition());
done = true;
}
else {
checkForRecursion(startingMethod, method.getBody());
checkForRecursion(startingLayer, layerDeclaration.getBody());
}
}
}
......
......@@ -20,7 +20,7 @@
*/
package de.monticore.lang.monticar.cnnarch._cocos;
import de.monticore.lang.monticar.cnnarch._ast.ASTMethodParameter;
import de.monticore.lang.monticar.cnnarch._ast.ASTLayerParameter;
import de.monticore.lang.monticar.cnnarch._ast.ASTVariable;
import de.monticore.lang.monticar.cnnarch.helper.ErrorCodes;
import de.monticore.lang.monticar.cnnarch.predefined.AllPredefinedVariables;
......@@ -64,7 +64,7 @@ public class CheckVariableName implements CNNArchASTVariableCoCo {
private void checkForDuplicates(ASTVariable node){
String name = node.getName();
if (variableNames.contains(name)){
if (node instanceof ASTMethodParameter){
if (node instanceof ASTLayerParameter){
Collection<Symbol> allParametersWithSameName = node.getEnclosingScope().get().getLocalSymbols().get(name);
if (allParametersWithSameName.size() > 1){
duplicationError(node);
......
......@@ -34,7 +34,7 @@ public class ArchTypeSymbol extends CommonSymbol {
public static final ArchTypeKind KIND = new ArchTypeKind();
protected static final String DEFAULT_ELEMENT_TYPE = "Q(-oo:oo)";
private ASTElementType elementType;
private ASTElementType domain;
private int channelIndex = -1;
private int heightIndex = -1;
......@@ -46,15 +46,15 @@ public class ArchTypeSymbol extends CommonSymbol {
super("", KIND);
ASTElementType elementType = new ASTElementType();
elementType.setTElementType(DEFAULT_ELEMENT_TYPE);
setElementType(elementType);
setDomain(elementType);
}
public ASTElementType getElementType() {
return elementType;
public ASTElementType getDomain() {
return domain;
}
public void setElementType(ASTElementType elementType) {
this.elementType = elementType;
public void setDomain(ASTElementType domain) {
this.domain = domain;
}
public int getHeightIndex() {
......@@ -207,7 +207,7 @@ public class ArchTypeSymbol extends CommonSymbol {
copy.setAstNode(getAstNode().get());
}
copy.setElementType(getElementType());
copy.setDomain(getDomain());
copy.setWidthIndex(getWidthIndex());
copy.setChannelIndex(getChannelIndex());
copy.setHeightIndex(getHeightIndex());
......@@ -224,7 +224,7 @@ public class ArchTypeSymbol extends CommonSymbol {
private int height = 1;
private int width = 1;
private int channels = 1;
private ASTElementType elementType = null;
private ASTElementType domain = null;
public Builder height(int height){
this.height = height;
......@@ -238,13 +238,13 @@ public class ArchTypeSymbol extends CommonSymbol {
this.channels = channels;
return this;
}
public Builder elementType(ASTElementType elementType){
this.elementType = elementType;
public Builder elementType(ASTElementType domain){
this.domain = domain;
return this;
}
public Builder elementType(String start, String end){
elementType = new ASTElementType();
elementType.setTElementType("Q(" + start + ":" + end +")");
domain = new ASTElementType();
domain.setTElementType("Q(" + start + ":" + end +")");
return this;
}
......@@ -255,11 +255,11 @@ public class ArchTypeSymbol extends CommonSymbol {
sym.setWidthIndex(2);
sym.setDimensions(Arrays.asList(channels, height, width));
if (elementType == null){
elementType = new ASTElementType();
elementType.setTElementType(DEFAULT_ELEMENT_TYPE);
if (domain == null){