Commit 60fc39b3 authored by Daniel Ratiu's avatar Daniel Ratiu
Browse files

added RawString as expression - it represents an uninterpreted placeholder in an expression

parent 678d66a2
......@@ -323,6 +323,28 @@
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="RawString" eSuperTypes="#//terms/Const">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="documentation" value="Boolean constant terms."/>
</eAnnotations>
<eOperations name="toString" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RawStringStaticImpl.toString(this);"/>
</eAnnotations>
</eOperations>
<eOperations name="equals" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RawStringStaticImpl.equals(this, object);"/>
</eAnnotations>
<eParameters name="object" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EJavaObject"/>
</eOperations>
<eOperations name="hashCode" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt">
<eAnnotations source="http://www.eclipse.org/emf/2002/GenModel">
<details key="body" value="return RawStringStaticImpl.hashCode(this);"/>
</eAnnotations>
</eOperations>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="value" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eSubpackages name="imperative" nsURI="http://www.fortiss.org/af3/expression/terms/imperative"
nsPrefix="org-fortiss-af3-expression-terms-imperative">
<eClassifiers xsi:type="ecore:EClass" name="IStatementTerm" abstract="true"
......
......@@ -142,6 +142,14 @@
</genOperations>
<genOperations ecoreOperation="expression.ecore#//terms/StringConst/hashCode"/>
</genClasses>
<genClasses ecoreClass="expression.ecore#//terms/RawString">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute expression.ecore#//terms/RawString/value"/>
<genOperations ecoreOperation="expression.ecore#//terms/RawString/toString"/>
<genOperations ecoreOperation="expression.ecore#//terms/RawString/equals">
<genParameters ecoreParameter="expression.ecore#//terms/RawString/equals/object"/>
</genOperations>
<genOperations ecoreOperation="expression.ecore#//terms/RawString/hashCode"/>
</genClasses>
<nestedGenPackages prefix="Imperative" basePackage="org.fortiss.af3.expression.model.terms"
disposableProviderFactory="true" ecorePackage="expression.ecore#//terms/imperative">
<genClasses image="false" ecoreClass="expression.ecore#//terms/imperative/IStatementTerm"/>
......
/*--------------------------------------------------------------------------+
$Id: StringConstStaticImpl.java 5155 2012-07-27 09:41:58Z ratiu $
| |
| Copyright 2011 ForTISS GmbH |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, software |
| distributed under the License is distributed on an "AS IS" BASIS, |
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.af3.expression.model.terms.impl;
import org.fortiss.af3.expression.model.terms.RawString;
import org.fortiss.af3.expression.model.terms.TermsFactory;
/**
* Static implementations for {@link RawString}. A raw string is an uninterpreted expression
* which is generated as raw string. This is used when no other expression is available.
*
* @author hoelzl
* @author $Author: ratiu $
* @version $Rev: 5155 $
* @ConQAT.Rating YELLOW Hash: FA888B3DF0854ECB72093AF6C2DF6D6B
*/
public final class RawStringStaticImpl {
/** Creates a {@link RawString} for the given value. */
public static RawString create(String value) {
RawString rs = TermsFactory.eINSTANCE.createRawString();
rs.setValue(value);
return rs;
}
/** Return string representation. */
/* package */static String toString(RawString rs) {
return rs.getValue();
}
/** Compares the given objects. */
/* package */static boolean equals(RawString rs, Object object) {
return object instanceof RawString && ((RawString)object).getValue() == rs.getValue();
}
/** Computes the hash code. */
/* package */static int hashCode(RawString rs) {
return rs.getValue().hashCode();
}
}
......@@ -44,6 +44,7 @@ import org.fortiss.af3.expression.model.terms.EOperator;
import org.fortiss.af3.expression.model.terms.FunctionCall;
import org.fortiss.af3.expression.model.terms.IExpressionTerm;
import org.fortiss.af3.expression.model.terms.IntConst;
import org.fortiss.af3.expression.model.terms.RawString;
import org.fortiss.af3.expression.model.terms.StringConst;
import org.fortiss.af3.expression.model.terms.TermsFactory;
import org.fortiss.af3.expression.model.terms.UserdefinedFunction;
......@@ -63,6 +64,7 @@ import org.fortiss.af3.expression.model.terms.impl.DoubleConstStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.FunctionCallStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.IntConstStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.PredefinedFunctionStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.RawStringStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.StringConstStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.StructureMemberStaticImpl;
import org.fortiss.af3.expression.model.terms.impl.UserdefinedFunctionStaticImpl;
......@@ -244,6 +246,17 @@ public class ExpressionModelElementFactory {
return StringConstStaticImpl.create(value);
}
/**
* Returns a {@link RawString} with a given value.
*
* @param value
* the value of the raw string
* @return the constant object
*/
public static RawString rawString(String value) {
return RawStringStaticImpl.create(value);
}
/**
* Returns a {@link Var} with a given name.
*
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment