org.modelcc.io.java.JavaModelReaderMetadata 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.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.modelcc.metamodel.ModelElement;
/**
* Java model reader metadata
*
* @author Fernando Berzal ([email protected])
*
* @param Java class model element
*/
public class JavaModelReaderMetadata implements java.io.Serializable
{
private Set relevantClasses = new HashSet();
private Map classToJavaElement = new HashMap();
private Set javaElements = new HashSet();
private Map> javaSubclasses = new HashMap>();
private Map javaSuperclasses = new HashMap();
// Getters & setters
public Set getRelevantClasses()
{
return relevantClasses;
}
public void setRelevantClasses(Set relevantClasses)
{
this.relevantClasses = relevantClasses;
}
public J getClassElement (Class type)
{
return classToJavaElement.get(type);
}
public void setClassElement (Class type, J element)
{
classToJavaElement.put(type,element);
}
public void setClassToJavaElement(Map classToJavaElement)
{
this.classToJavaElement = classToJavaElement;
}
public Set getJavaElements()
{
return javaElements;
}
public Map> getJavaSubclasses()
{
return javaSubclasses;
}
public Set getJavaSubclasses (J element)
{
return javaSubclasses.get(element);
}
public void setJavaSubclasses (J element, Set subclasses)
{
javaSubclasses.put(element, subclasses);
}
public void addJavaSubclass (J element, J subclass)
{
Set se = javaSubclasses.get(element);
if (se == null) {
se = new HashSet();
javaSubclasses.put(element,se);
}
se.add(subclass);
setJavaSuperclass(subclass,element);
}
public Map getJavaSuperclasses()
{
return javaSuperclasses;
}
public J getJavaSuperclass(J element)
{
return javaSuperclasses.get(element);
}
private void setJavaSuperclass (J element, J superclass)
{
javaSuperclasses.put(element, superclass);
}
}