Package de.uni_hildesheim.sse
Class ModelUtility
- java.lang.Object
-
- net.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>
-
- de.uni_hildesheim.sse.ModelUtility
-
- All Implemented Interfaces:
net.ssehub.easy.basics.modelManagement.IModelLoader<net.ssehub.easy.varModel.model.Project>
public class ModelUtility extends net.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project> implements net.ssehub.easy.basics.modelManagement.IModelLoader<net.ssehub.easy.varModel.model.Project>(Entry points for) Utilities for working with the EMF model.- Author:
- Holger Eichelberger
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface net.ssehub.easy.basics.modelManagement.IModelLoader
net.ssehub.easy.basics.modelManagement.IModelLoader.IModelInfoHolder<M extends net.ssehub.easy.basics.modelManagement.IModel>, net.ssehub.easy.basics.modelManagement.IModelLoader.LoadResult<M extends net.ssehub.easy.basics.modelManagement.IModel>
-
-
Field Summary
Fields Modifier and Type Field Description static ModelUtilityINSTANCEprivate net.ssehub.easy.dslCore.translation.LogMessageReceiverlogReceiver
-
Constructor Summary
Constructors Modifier Constructor Description privateModelUtility()Prevents external creation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description net.ssehub.easy.varModel.model.ConstraintcreateConstraint(java.lang.String text, net.ssehub.easy.varModel.model.Project project, boolean asStatement)Parses a text into a constraint in the context ofproject.net.ssehub.easy.varModel.cst.ConstraintSyntaxTreecreateExpression(java.lang.String text, net.ssehub.easy.varModel.model.IModelElement parent)Parses a text into an expression in the context ofproject.net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project>createVarModel(de.uni_hildesheim.sse.ivml.VariabilityUnit root, java.net.URI uri, boolean registerSuccessful)Create the variability model from an EMF variability unit.java.lang.StringgetExtension()protected java.lang.ClassLoadergetLanguageClassLoader()protected java.lang.StringgetLanguageName()protected voidinitializeAfterResourceInitializer()java.util.List<net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.varModel.model.Project>>obtainInfo(org.eclipse.emf.common.util.URI uri)Obtains project info.net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project>parse(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.basics.modelManagement.ImportResolver<net.ssehub.easy.varModel.model.Project> resolver)voidprint(net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project> result, java.io.Writer out, boolean emitComments, boolean emitImports)Prints the var model stored in the result to the console output stream (for debugging).static java.lang.StringstringValue(de.uni_hildesheim.sse.ivml.DerivedType type, boolean forSearch)Returns the string representation oftype.static java.lang.StringstringValue(de.uni_hildesheim.sse.ivml.Type type)Returns the string representation oftype(no search).static java.lang.StringstringValue(de.uni_hildesheim.sse.ivml.Type type, boolean forSearch)Returns the string representation oftype.-
Methods inherited from class net.ssehub.easy.dslCore.ModelUtility
append, appendWithNewLine, getGrammar, getInjector, getResourceInitializer, getResourceSet, handles, load, obtainInfo, parse, parse, parse, parseFragment, scan, setInjector, setResourceInitializer, toNetUri
-
-
-
-
Field Detail
-
INSTANCE
public static final ModelUtility INSTANCE
-
logReceiver
private final net.ssehub.easy.dslCore.translation.LogMessageReceiver logReceiver
-
-
Method Detail
-
initializeAfterResourceInitializer
protected void initializeAfterResourceInitializer()
- Specified by:
initializeAfterResourceInitializerin classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>
-
getLanguageName
protected java.lang.String getLanguageName()
- Specified by:
getLanguageNamein classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>
-
getLanguageClassLoader
protected java.lang.ClassLoader getLanguageClassLoader()
- Specified by:
getLanguageClassLoaderin classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>
-
createVarModel
public net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project> createVarModel(de.uni_hildesheim.sse.ivml.VariabilityUnit root, java.net.URI uri, boolean registerSuccessful)Create the variability model from an EMF variability unit.- Parameters:
root- the root-level variability unituri- the URI of the project to resolve (in order to find the closest project, may be null)registerSuccessful- successfully created models shall be registered- Returns:
- the created variability model including messages
-
print
public void print(net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project> result, java.io.Writer out, boolean emitComments, boolean emitImports)Prints the var model stored in the result to the console output stream (for debugging).- Parameters:
result- the result instanceout- the output writeremitComments- whether comments shall be emittedemitImports- whether imports shall be emitted
-
parse
public net.ssehub.easy.dslCore.TranslationResult<net.ssehub.easy.varModel.model.Project> parse(org.eclipse.emf.common.util.URI uri, net.ssehub.easy.basics.modelManagement.ImportResolver<net.ssehub.easy.varModel.model.Project> resolver) throws java.io.IOException- Specified by:
parsein classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>- Throws:
java.io.IOException
-
obtainInfo
public java.util.List<net.ssehub.easy.basics.modelManagement.ModelInfo<net.ssehub.easy.varModel.model.Project>> obtainInfo(org.eclipse.emf.common.util.URI uri) throws java.io.IOExceptionObtains project info.- Specified by:
obtainInfoin classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>- Parameters:
uri- the URI to read the info from- Returns:
- the project info instances related to
uri - Throws:
java.io.IOException- in case that an I/O error happens during parsing
-
stringValue
public static final java.lang.String stringValue(de.uni_hildesheim.sse.ivml.Type type)
Returns the string representation oftype(no search).- Parameters:
type- the type to be converted into a string- Returns:
- the type representation
-
stringValue
public static final java.lang.String stringValue(de.uni_hildesheim.sse.ivml.Type type, boolean forSearch)Returns the string representation oftype.- Parameters:
type- the type to be converted into a stringforSearch- is the result intended for type searching- Returns:
- the type representation
-
stringValue
public static final java.lang.String stringValue(de.uni_hildesheim.sse.ivml.DerivedType type, boolean forSearch)Returns the string representation oftype.- Parameters:
type- the type to be converted into a stringforSearch- is the result intended for type searching- Returns:
- the type representation
-
createConstraint
public net.ssehub.easy.varModel.model.Constraint createConstraint(java.lang.String text, net.ssehub.easy.varModel.model.Project project, boolean asStatement) throws net.ssehub.easy.varModel.cst.CSTSemanticException, ConstraintSyntaxExceptionParses a text into a constraint in the context ofproject. Project is not modified!- Parameters:
text- the text to be parsed containing the constraintproject- the projectasStatement-truethen parsetextas a statement, else as an expression- Returns:
- the constraint, null in case of internal instantiation errors
- Throws:
net.ssehub.easy.varModel.cst.CSTSemanticException- in case of semantic problems intextConstraintSyntaxException- in case of syntax problems intext
-
createExpression
public net.ssehub.easy.varModel.cst.ConstraintSyntaxTree createExpression(java.lang.String text, net.ssehub.easy.varModel.model.IModelElement parent) throws net.ssehub.easy.varModel.cst.CSTSemanticException, ConstraintSyntaxExceptionParses a text into an expression in the context ofproject. Project is not modified!- Parameters:
text- the text to be parsed containing the constraintparent- the intended parent model element (turned intoCompoundorProjectdepending on nesting- Returns:
- the expression, null in case of internal instantiation errors
- Throws:
net.ssehub.easy.varModel.cst.CSTSemanticException- in case of semantic problems intextConstraintSyntaxException- in case of syntax problems intext
-
getExtension
public java.lang.String getExtension()
- Specified by:
getExtensionin classnet.ssehub.easy.dslCore.ModelUtility<de.uni_hildesheim.sse.ivml.VariabilityUnit,net.ssehub.easy.varModel.model.Project>
-
-