Class ExpressionTranslator
- java.lang.Object
-
- net.ssehub.easy.dslCore.translation.MessageReceiver
-
- net.ssehub.easy.dslCore.translation.ExpressionTranslator
-
- All Implemented Interfaces:
IMessageReceiver
- Direct Known Subclasses:
ExpressionTranslator,ExpressionTranslator
public abstract class ExpressionTranslator extends MessageReceiver
A basic implementation of an expression translator, i.e., a basic class for translating individual expressions into model instances.- Author:
- Holger Eichelberger
-
-
Constructor Summary
Constructors Constructor Description ExpressionTranslator()Creates an expression translator (to be used within this package only).
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearMessages(java.net.URI uri)Clears all messages registered for the resourceuri.voidclearMessages(ModelInfo<?> info)Clears all messages registered forinfo.voidcollect(IMessage message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives an EASy message.voiderror(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives an error message.voiderror(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)Adds a diagnostic error, typically from a standalone parser configuration.private MessageerrorImpl(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives an error message.intgetErrorCount()Returns the number of errors.MessagegetMessage(int index)Returns the specified message.intgetMessageCount()Returns the number of messages.private static org.eclipse.emf.common.util.URIgetURI(org.eclipse.emf.ecore.EObject object)Returns the resource URI ofobject.private static booleansameURIs(java.net.URI uri, org.eclipse.emf.ecore.EObject cause)Checks whetheruriand the URI ofcauseare the same.voidwarning(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives a warning message.private MessagewarningImpl(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Receives a warning message.-
Methods inherited from class net.ssehub.easy.dslCore.translation.MessageReceiver
error
-
-
-
-
Method Detail
-
getMessageCount
public int getMessageCount()
Description copied from class:MessageReceiverReturns the number of messages.- Specified by:
getMessageCountin classMessageReceiver- Returns:
- the number of messages
-
getErrorCount
public int getErrorCount()
Description copied from class:MessageReceiverReturns the number of errors.- Specified by:
getErrorCountin classMessageReceiver- Returns:
- the number of errors
-
getMessage
public Message getMessage(int index)
Description copied from class:MessageReceiverReturns the specified message.- Specified by:
getMessagein classMessageReceiver- Parameters:
index- the position of the message to be returned- Returns:
- the specified message
-
getURI
private static org.eclipse.emf.common.util.URI getURI(org.eclipse.emf.ecore.EObject object)
Returns the resource URI ofobject.- Parameters:
object- the object- Returns:
- the resource URI (may be null)
-
errorImpl
private Message errorImpl(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
Receives an error message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the error- Returns:
- the created/stored message
-
warningImpl
private Message warningImpl(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
Receives a warning message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the warning- Returns:
- the created/stored message
-
error
public void error(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Description copied from interface:IMessageReceiverReceives an error message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the error
-
warning
public void warning(java.lang.String message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)Description copied from interface:IMessageReceiverReceives a warning message.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the warning
-
collect
public void collect(IMessage message, org.eclipse.emf.ecore.EObject cause, org.eclipse.emf.ecore.EStructuralFeature causeFeature, int code)
Description copied from interface:IMessageReceiverReceives an EASy message. This allows re-directing the message while keeping the relation to the original one, e.g., for cleaning up messages.- Parameters:
message- the messagecause- the cause (as instance of the EMF grammar model)causeFeature- the cause of the feature as an appropriate constant fromIvmlPackage.Literalscode- a numerical identification of the error
-
error
public void error(org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic)
Adds a diagnostic error, typically from a standalone parser configuration.- Specified by:
errorin classMessageReceiver- Parameters:
diagnostic- the diagnostic to be added
-
clearMessages
public void clearMessages(ModelInfo<?> info)
Clears all messages registered forinfo.- Parameters:
info- the information object to clear the messages for
-
clearMessages
public void clearMessages(java.net.URI uri)
Clears all messages registered for the resourceuri.- Parameters:
uri- the URI to clear the messages for
-
sameURIs
private static boolean sameURIs(java.net.URI uri, org.eclipse.emf.ecore.EObject cause)Checks whetheruriand the URI ofcauseare the same.- Parameters:
uri- the URI to checkcause- the cause object to check- Returns:
trueif both are the same,falseelse also if null
-
-