Home » Modeling » Epsilon » Getting links with EGL
|
Re: Getting links with EGL [message #1739365 is a reply to message #1739364] |
Sat, 30 July 2016 19:28 |
|
Hi,
If you need to specify that Object1 is the first state in your model, you need to add a respective boolean attribute (e.g. isStart) in your metamodel and set it to true for Object1 and to false for everything else (alternatively you can introduce an InitialState class that extends your State class and make Object1 an instance of the prior). Does this answer your question?
Cheers,
Dimitris
|
|
| | |
Re: Getting links with EGL [message #1739370 is a reply to message #1739367] |
Sun, 31 July 2016 00:08 |
C. Santos Messages: 32 Registered: September 2015 |
Member |
|
|
@gmf.diagram(foo="bar", rcp="false", onefile="true", diagram.extension="ccase")
class CCase {
val Transition[*] transitions;
val Function[*] functions;
}
@gmf.node(label="name", label.text="Function", border.color="43,106,215")
class Function{
@gmf.compartment
val Parameters[*] declarativePart;
@gmf.compartment
val Statements[*] executablePart;
}
@gmf.node(label="name", figure="rectangle", border.width="1", label.icon="true",label.readOnly = "true", label.placement="internal")
class Parameters{
attr String name;
attr ParameterType type;
}
...
@gmf.node(label="description", label.icon="true", label.placement="internal")
abstract class Statements{
attr String description;
attr String code;
}
....
@gmf.link(source="source", target="target", incoming="true", target.decoration="arrow", color="0,0,0", width="1")
class Transition{
attr String name = "Connection";
ref Statements source;
ref Statements target;
}
Basically, inside of "Function" it's possible add many statements and parameters. The parameters can be linked by one Transition. I have to know where the diagram starts and the order of the statements linked.
|
|
|
Re: Getting links with EGL [message #1739371 is a reply to message #1739370] |
Sun, 31 July 2016 04:39 |
|
Hi,
Since your model can contain cycles (as illustrated in your initial diagram), there's no "natural" starting point, and as such one needs to be defined explicitly. After adding an isStart attribute to the Statements class, you can find the starting Statements object as follows:
var startStatements = Statements.all.selectOne(s|s.isStart);
To find the "next" Statements of a give Statements element you can use a function like the one below:
operation Statements getNext() {
return Transition.all.select(t|t.source = self).collect(t|t.target).flatten();
}
Cheers,
Dimitris
|
|
| | | | | | | |
Re: Getting links with EGL [message #1746521 is a reply to message #1746466] |
Mon, 31 October 2016 14:43 |
|
Hi,
#1 is feasible but you'd need to modify the generated EMF code. Let me know if that's something you'd like to do so that I can advise further.
To respond to #2, I'll need to see the latest version of your metamodel.
Cheers,
Dimitris
|
|
|
Re: Getting links with EGL [message #1746594 is a reply to message #1746521] |
Tue, 01 November 2016 14:30 |
C. Santos Messages: 32 Registered: September 2015 |
Member |
|
|
Hi Dimitris,
#1It's definitely something that I'l like to do.
#2 This is my .emf file updated:
@namespace(uri="crystal", prefix="crystal")
package crystal;
@gmf.diagram(foo="bar", rcp="false", onefile="true", diagram.extension="crystal")
class Crystal {
val Transition[*] transitions;
val SelectorTransition[*] selectorTransitions;
val Procedure[*] procedures;
val Function[*] functions;
val AnonymousBlock[*] blocks;
}
//Subprograms
@gmf.node(figure="rectangle", border.width="1", label.readOnly = "true")
abstract class Subprograms{
attr String name;
}
@gmf.node(label="name", label.text="Procedure", border.color="255,13,13") //vermelho
class Procedure extends Subprograms {
@gmf.compartment
val Parameters[*] declarativePart;
@gmf.compartment
val Parameters[*] parameters;
@gmf.compartment
val Statements[*] executablePart;
}
@gmf.node(label="name", label.text="Function", border.color="25,191,108") //azul
class Function extends Subprograms {
@gmf.compartment
val Parameters[*] declarativePart;
@gmf.compartment
val Parameters[*] parameters;
@gmf.compartment
val Parameters[1] returnPart;
@gmf.compartment
val Statements[*] executablePart;
}
@gmf.node(label="name", label.text="Anonymous Block", border.color="43,106,215", border.style="dash") //verde
class AnonymousBlock extends Subprograms {
@gmf.compartment
val Parameters[*] declarativePart;
@gmf.compartment
val Statements[*] executablePart;
}
//Parameters
@gmf.node(label="name", figure="rectangle", border.width="1", label.icon="true",label.readOnly = "true", label.placement="internal")
abstract class Parameters{
attr String name;
attr ParameterType type;
}
@gmf.node(label.text="Data Type")
class DataType extends Parameters{
attr String className ="DataType";
attr DataTypeOptions options;
attr int precision = 1;
attr int scale = 0;
}
@gmf.node(label.text="Collection")
class Collections extends Parameters{
attr String className ="Collection";
attr String code = "TYPE name IS TABLE OF NUMBER INDEX BY VARCHAR2(20)";
attr String typeName = "collectionTypeName";
}
@gmf.node(label.text="Record")
class Records extends Parameters{
attr String className ="Record";
attr String code = "TYPE recordType IS RECORD (id number(5), name varchar2(25), lastName tableA.last_name%type)";
attr String typeName = "recordTypeName";
}
@gmf.node(label.text="Cursor")
class Cursor extends Parameters {
attr String className ="Cursor";
attr String cursorQuery = "selectStatement";
}
//Statements
@gmf.node(label="description", label.icon="true", label.placement="internal")
abstract class Statements{
attr String description = "Description";
attr boolean isStart;
}
@gmf.node(figure="rectangle")
class Expression extends Statements {
attr String className ="Expression";
attr String value = "Type the expression here";
}
@gmf.node(figure="rectangle")
class Exception extends Statements{
attr String className ="Exception";
attr String code = "EXCEPTION WHEN no_data_found THEN DBMS_OUTPUT.PUT_LINE('There isnt data registered')";
}
@gmf.node(figure="rectangle")
class If extends Statements{
attr String className ="If";
attr String condition = "Type the IF condition";
@gmf.compartment
val Statements[*] ifs;
@gmf.compartment
val Statements[*] elses;
}
@gmf.node(figure="rectangle")
class Case extends Statements{
attr String className ="Case";
@gmf.compartment
val Selector[*] cases;
}
@gmf.node(figure="rectangle", label="description", label.icon="true", label.placement="internal")
class Selector {
attr String className = "Selector";
attr String condition = "Type the condition for this Selector";
attr String description = "Description";
@gmf.compartment
val Statements[*] caseStatements;
}
@gmf.node(figure="rectangle")
class Insert extends Statements{
attr String className ="Insert";
attr String code = "INSERT INTO tableA (id, name) VALUES (1, 'example')";
}
@gmf.node(figure="rectangle")
class Update extends Statements{
attr String className ="Update";
attr String code = "UPDATE tableA SET name = 'example' WHERE id = 1";
}
@gmf.node(figure="rectangle")
class Delete extends Statements{
attr String className ="Delete";
attr String code = "DELETE FROM tableA WHERE ID = 1";
}
@gmf.node(figure="rectangle")
class Select extends Statements{
attr String className ="Select";
attr String code = "SELECT * FROM tableA WHERE id = 1";
}
@gmf.node(figure="rectangle")
class While extends Statements{
attr String className ="While";
attr String condition = "Type the WHILE condition";
@gmf.compartment
val Statements[*] whileStatements;
}
@gmf.node(figure="rectangle")
class For extends Statements{
attr String className ="For";
attr String counter = "Type the name of the FOR counter";
attr ForCounter typeCounter;
attr int lowestNumber = 0;
attr int highestNumber = 0;
@gmf.compartment
val Statements[*] forStatements;
}
@gmf.node(figure="rectangle")
class Loop extends Statements{
attr String className ="Loop";
attr String breakCondition = "Type the break condition for LOOP";
@gmf.compartment
val Statements[*] loopStatements;
}
@gmf.node(figure="rectangle")
class Open extends Statements{
attr String className ="Open";
attr String cursorName = "cursorName";
}
@gmf.node(figure="rectangle")
class Fetch extends Statements{
attr String className ="Fetch";
attr String cursorName = "cursorName";
attr String variableName = "variableCursor";
}
@gmf.node(figure="rectangle")
class Close extends Statements{
attr String className ="Close";
attr String cursorName = "cursorName";
}
@gmf.node(figure="rectangle")
class CallProcedure extends Statements{
attr String className ="CallProcedure";
attr String nameSubroutine;
}
@gmf.node(figure="rectangle")
class CallFunction extends Statements{
attr String className ="CallFunction";
attr String nameSubroutine;
}
@gmf.link(source="source", target="target", incoming="true", target.decoration="arrow", color="0,0,0", width="1", label="name", label.text="Statement Connection", label.icon="true")
class Transition{
attr String name = "Statement Connection";
ref Statements source;
ref Statements target;
}
@gmf.link(source="source", target="target", incoming="true", target.decoration="arrow", color="0,0,0", width="1", label="name", label.text="Case Connection", label.icon="true")
class SelectorTransition{
attr String name = "Case Connection";
ref Selector source;
ref Selector target;
}
enum ParameterType {
IN = 0;
OUT = 1;
IN_OUT = 2;
}
enum ForCounter {
NORMAL = 0;
REVERSE = 1;
}
enum DataTypeOptions {
CHAR = 0;
NCHAR = 1;
NVARCHAR2 = 2;
VARCHAR2 = 3;
LONG = 4;
RAW = 5;
LONG_RAW = 6;
NUMBER = 7; //can modify the precision and scale
NUMERIC = 8; //can modify the precision and scale
FLOAT = 9;
DEC = 10; //can modify the precision and scale
DECIMAL = 11; //can modify the precision and scale
INTEGER = 12;
INT = 13;
SMALLINT = 14;
REAL = 15;
DOUBLE = 16;
DATE = 17;
TIMESTAMP_WITH_TIME_ZONE = 18;
TIMESTAMP_WITH_LOCAL_TIME_ZONE = 19;
INTERVAL_YEAR_TO_MONTH = 20;
INTERVAL_DAY_TO_SECOND = 21;
BFILE = 22;
BLOB = 23;
CLOB = 24;
NCLOB = 25;
ROWID = 26;
UROWID = 27;
}
Cheers.
|
|
|
Re: Getting links with EGL [message #1746611 is a reply to message #1746594] |
Tue, 01 November 2016 18:20 |
|
Hi,
#1: You can add an opposite reference from the object to its container and then override the setXYZ() method in the generated EMF code to update the value of isStart accordingly if at that point the container doesn't have any additional children.
#2: In your metamodel Transitions can only be contained under a top-level Crystal element. As such, I suspect that what you want to do is to get all transitions linking "Statements" in a particular compartment. To do this, you need to get hold of the Statements of interest first and then query all transitions (Transition.all) to find out which of them have Statements of interest as their source/target.
Cheers,
Dimitris
|
|
| |
Re: Getting links with EGL [message #1752338 is a reply to message #1752337] |
Sun, 22 January 2017 11:05 |
|
Hi,
I don't think that this is supported out of the box in Eugenia. I'd suggest sending a message to the GMF forum and when you've figured out how it's done using plain GMF you can use a polishing transformation to automate the process.
Cheers,
Dimitris
|
|
|
Re: Getting links with EGL [message #1752340 is a reply to message #1752338] |
Sun, 22 January 2017 11:19 |
|
Actually, this seems to be quite straightforward. You need to locate the Polyline Decoration that corresponds to the arrow of interest in your .gmfgraph model and turn its line kind to LINE_DASH. If you do this manually, you'll then need to right-click on your .gmfmap model and select "Create generator model ..." and then right-click on your .gmfgen and select "Generate diagram code".
Cheers,
Dimitris
|
|
|
Goto Forum:
Current Time: Mon Sep 23 19:25:27 GMT 2024
Powered by FUDForum. Page generated in 0.16138 seconds
|