org.modelcc.io.java.JavaLanguageClass Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ModelCC Show documentation
Show all versions of ModelCC Show documentation
ModelCC is a model-based parser generator (a.k.a. compiler compiler) that decouples language specification from language processing, avoiding some of the problems caused by grammar-driven parser generators. ModelCC receives a conceptual model as input, along with constraints that annotate it. It is then able to create a parser for the desired textual language and the generated parser fully automates the instantiation of the language conceptual model. ModelCC also includes a built-in reference resolution mechanism that results in abstract syntax graphs, rather than mere abstract syntax trees.
The newest version!
/*
* ModelCC, distributed under ModelCC Shared Software License, www.modelcc.org
*/
package org.modelcc.io.java;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import org.modelcc.AssociativityType;
import org.modelcc.CompositionType;
import org.modelcc.language.metamodel.LanguageMember;
import org.modelcc.lexer.recognizer.PatternRecognizer;
import org.modelcc.metamodel.Evaluator;
import org.modelcc.metamodel.ModelElement;
/**
* Java model element
*/
public final class JavaLanguageClass extends ModelElement
{
/**
* Key members.
*/
private List keyMembers;
/**
* Whether the element can appear in any order.
*/
private Boolean freeOrder;
/**
* Associativity type.
*/
private AssociativityType associativity;
/**
* Composition type.
*/
private CompositionType composition;
/**
* Prefix.
*/
private List prefix;
/**
* Suffix.
*/
private List suffix;
/**
* Separator.
*/
private List separator;
/**
* Pattern.
*/
private PatternRecognizer pattern;
/**
* Value field.
*/
private Field valueField;
/**
* Setup method.
*/
private Method setupMethod;
/**
* Constraint methods.
*/
private List constraintMethods;
/**
* Evaluator
*/
private Evaluator evaluator;
/**
* Constructor
* @param elementClass the element class
*/
public JavaLanguageClass(Class elementClass)
{
super(elementClass);
this.keyMembers = new ArrayList();
this.constraintMethods = new ArrayList();
}
public Boolean isFreeOrder()
{
return freeOrder;
}
public AssociativityType getAssociativity()
{
return associativity;
}
public CompositionType getComposition()
{
return composition;
}
public List getPrefix()
{
return prefix;
}
public List getSuffix()
{
return suffix;
}
public List getSeparator()
{
return separator;
}
public PatternRecognizer getPattern()
{
return pattern;
}
public Field getValueField()
{
return valueField;
}
public Method getSetupMethod()
{
return setupMethod;
}
public List getConstraintMethods()
{
return constraintMethods;
}
public void addConstraintMethod (Method method)
{
constraintMethods.add(method);
}
public void setFreeOrder(boolean freeOrder)
{
this.freeOrder = freeOrder;
}
public void setAssociativity(AssociativityType associativity)
{
this.associativity = associativity;
}
public void setComposition(CompositionType composition)
{
this.composition = composition;
}
public void setPrefix(List prefix)
{
this.prefix = prefix;
}
public void setSuffix(List suffix)
{
this.suffix = suffix;
}
public void setSeparator(List separator)
{
this.separator = separator;
}
public void setPattern(PatternRecognizer pattern)
{
this.pattern = pattern;
}
public void setValueField(Field valueField)
{
this.valueField = valueField;
}
public void setSetupMethod(Method method)
{
this.setupMethod = method;
}
public List getKeyMembers()
{
return keyMembers;
}
public void addKeyMember (LanguageMember member)
{
keyMembers.add(member);
}
public void setKeyMembers(List keyMembers)
{
this.keyMembers = keyMembers;
}
public Evaluator getEvaluator()
{
return evaluator;
}
public void setEvaluator(Evaluator evaluator)
{
this.evaluator = evaluator;
}
}