Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Integrate changes for IBeX v2 #425

Draft
wants to merge 268 commits into
base: master
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
268 commits
Select commit Hold shift + click to select a range
61ade79
+ Finishd the initial version of the new pattern matching engine base…
arg0n1s Oct 9, 2022
b9b2d80
more work on the pattern matching engine
arg0n1s Oct 10, 2022
ff55ba0
initial ideas for new api base-classes
arg0n1s Oct 10, 2022
98e8df5
finished API and engine base-types
arg0n1s Oct 13, 2022
e32a046
more work on core base-classes and initial work on templates
arg0n1s Oct 16, 2022
5f3258d
added the first batch of api template classes
arg0n1s Oct 17, 2022
2c909bc
added more api template classe
arg0n1s Oct 17, 2022
5ed0186
+ added expressions to gt template
arg0n1s Oct 18, 2022
2970d07
+ added random number generator to IBeXGTEngine
arg0n1s Oct 18, 2022
85b15e3
finished templates
arg0n1s Oct 19, 2022
6161d3a
implemented gt match filter
arg0n1s Oct 19, 2022
668e3c2
added rule application template
arg0n1s Oct 19, 2022
ca5c89e
Merge remote-tracking branch 'origin/master' into refactoring/rework_…
arg0n1s Oct 20, 2022
d739703
finished gt rule template
arg0n1s Oct 20, 2022
1d3bf46
+ removed old api code and generator code
arg0n1s Oct 20, 2022
690c210
+ more deletions of old code
arg0n1s Oct 20, 2022
e9e4690
added new tgg.compiler project
Arikae Oct 19, 2022
723155d
refactoring on IBeXTGGModel.ecore
Arikae Oct 20, 2022
aafb43b
xtext to internal tgg language trafo
Arikae Oct 20, 2022
876e40a
fixed schemas
arg0n1s Oct 20, 2022
293035a
+ further work on tgg transformer
Arikae Oct 21, 2022
56ce89e
Merge branch 'refactoring/rework_merge_GT_TGG_Model' into refactoring…
Arikae Oct 21, 2022
af77bca
added csp definitions and calls to model
Arikae Oct 21, 2022
048a0f6
+ major fixes
arg0n1s Oct 21, 2022
99ba27c
added parameterized conditions
arg0n1s Oct 21, 2022
df82016
connected attribute conditions
Arikae Oct 24, 2022
9b7857d
Merge branch 'refactoring/rework_merge_GT_TGG_Model' into refactoring…
Arikae Oct 24, 2022
763fde9
+ fixed rule template
arg0n1s Oct 24, 2022
83cfd64
fixed several NPEs
arg0n1s Oct 25, 2022
aff48f8
+ fixed more NPEs and uninitialized xyz errors
arg0n1s Oct 25, 2022
6932a07
+ fixed creation of superfluous injectivity constraints
arg0n1s Oct 26, 2022
abdd433
+ fixed empty patterns for axiomatic rules
arg0n1s Oct 28, 2022
011ccfc
+ simplified pattern and rule configuration
arg0n1s Nov 1, 2022
2476ecf
+ fixed type casting errors
arg0n1s Nov 1, 2022
d74376d
+ fixed missing parameter value initialization
arg0n1s Nov 2, 2022
f219ae0
fixed wrong invocation types after transformation to GT model
arg0n1s Nov 3, 2022
6fba75e
+ temporary fix for local node attribute conditions
arg0n1s Nov 3, 2022
a5f586b
finished first draft of transformation
Arikae Nov 7, 2022
fb42e79
+ code formatting
arg0n1s Nov 8, 2022
d1aac7b
+ fixed iterator feature NPE on castings
arg0n1s Nov 8, 2022
dc6864f
implemented protocol generator
Arikae Nov 9, 2022
6a92c04
+ added additional relational operators for complex objects
arg0n1s Nov 9, 2022
5bf0d05
+ changed the order of rule operations to deletions after creations
arg0n1s Nov 9, 2022
a4f2359
finalized operationalizer
Arikae Nov 10, 2022
7b11fa0
Merge branch 'refactoring/rework_merge_GT_TGG_Model' into refactoring…
Arikae Nov 10, 2022
0f10251
+ getMatches and getMatchStream do not return the actual internal mat…
arg0n1s Nov 10, 2022
eca4ba7
- String literals are now a type of arithmetic value, to enable strin…
arg0n1s Nov 10, 2022
9665164
removed language gen folder to see which parts must be replaced
Arikae Nov 11, 2022
03fa840
runtime now imports util
Arikae Nov 11, 2022
cbd1059
+ added runtime support for watch dog expressions
arg0n1s Nov 11, 2022
b34d737
minor fixes for the new watchdog functionality
arg0n1s Nov 14, 2022
721a2be
more fixed concerning the watch-dog feature
arg0n1s Nov 14, 2022
ff8127f
some refactorings
Arikae Nov 15, 2022
6ef2f95
fixing filter nac and pac analysis
Arikae Nov 15, 2022
88be776
further fixing and refactoring of dec nac analysis
Arikae Nov 16, 2022
10bb8c4
ac analysis now has its own package
Arikae Nov 16, 2022
946938d
new class to handle injectivity constraints
Arikae Nov 16, 2022
66d7647
+ minor fixes to gt metamodel
arg0n1s Nov 16, 2022
4a735ac
+ fixed disable injectivity constraint option
arg0n1s Nov 17, 2022
37c9f03
minor fixes to api data helper class and code gen templates
arg0n1s Nov 18, 2022
ec74232
removed legacy code
Arikae Nov 21, 2022
2679d43
finished operationalisation and saving of resources
Arikae Nov 21, 2022
270b976
fixing plantuml
Arikae Dec 5, 2022
93995d7
partially fixed the visualizer (not sc rules)
Arikae Dec 5, 2022
c372611
fixed parts of DefaultFilesGenerator
Arikae Dec 6, 2022
20a36d9
moved jars to tgg.util
Arikae Dec 7, 2022
50d16ee
removed green patterns
Arikae Dec 7, 2022
bfd5095
Merge branch 'refactoring/rework_merge_GT_TGG_Model' into refactoring…
Arikae Mar 2, 2023
d467c88
moved some code from the compiler to the new analysis plugin to break…
Arikae Mar 3, 2023
c3416d5
new analysis plugin
Arikae Mar 3, 2023
0dfb841
more refactoring of runtime
Arikae Mar 3, 2023
98419f7
more refactoring to match the new model
Arikae Mar 3, 2023
81c7b7d
removed green factories
Arikae Mar 3, 2023
a8354f1
refactored green interpreter
Arikae Mar 5, 2023
cbcf13c
more fixing
Arikae Mar 6, 2023
f4bf035
more fixes
Arikae Mar 6, 2023
1aba3da
started fixing sc framework
Arikae Mar 7, 2023
659ad8e
fixed sc fixing
Arikae Mar 7, 2023
abf6edc
optimized imports of tgg.compiler
Arikae Mar 7, 2023
c3640f5
fixed csps
Arikae Mar 7, 2023
624cb2c
fixed parts of the ho sc framework
Arikae Mar 7, 2023
3270f60
more sc fixing
Arikae Mar 7, 2023
c7cd3b6
more fixes
Arikae Mar 7, 2023
d4092d9
fixed some csp related methods in compiler project
Arikae Mar 8, 2023
0a87f9d
started implementing pattern matcher interface
Arikae Mar 9, 2023
42513c8
started implementing pattern matcher interface
Arikae Mar 9, 2023
86e8eb6
started implementing pattern matcher interface
Arikae Mar 11, 2023
c736ae5
started implementing pattern matcher interface
Arikae Mar 11, 2023
da707f7
started fixing integration framework
Arikae Mar 12, 2023
9f48055
more fixing
Arikae Mar 12, 2023
b5ed0f5
Merge remote-tracking branch 'origin/AdrianM/higher-order-scr' into r…
Arikae Mar 12, 2023
926244f
fixed match container
Arikae Mar 12, 2023
65fc361
fixed integrate
Arikae Mar 12, 2023
eaba6db
fixed pg
Arikae Mar 12, 2023
9f8965a
fixed parts of the match analyzer
Arikae Mar 12, 2023
ad34dca
Delete duplicate file
adrianmoeller Mar 12, 2023
c1813a0
fixed some conflict classes
Arikae Mar 12, 2023
0d80ab4
fixed most parts of the conflict detector
Arikae Mar 12, 2023
3253e3a
fixed marker creation
Arikae Mar 12, 2023
ae7f5cf
fixed marker creation
Arikae Mar 12, 2023
b494dea
added attribute assignment to tgg nodes
Arikae Mar 12, 2023
754b090
(hopefully) fixed csps
Arikae Mar 12, 2023
5f17368
Extend tgg model with shortcut elements
adrianmoeller Mar 12, 2023
48acf62
Fixed ShortcutRule
adrianmoeller Mar 12, 2023
a71f45d
Partly fixed repair framework
adrianmoeller Mar 14, 2023
578ac51
Update model
adrianmoeller Mar 14, 2023
729b575
Partly fixed repair framework
adrianmoeller Mar 14, 2023
723ac36
Merge remote-tracking branch 'origin/refactoring/rework_TGG_repair' i…
adrianmoeller Mar 14, 2023
bfc84b8
Fixed PropagationDirectionHolder
adrianmoeller Mar 14, 2023
9d25ce8
Merge remote-tracking branch 'origin/refactoring/rework_TGG_propagati…
adrianmoeller Mar 14, 2023
610db58
Merge remote-tracking branch 'origin/master' into refactoring/rework_TGG
adrianmoeller Mar 14, 2023
d430289
started implementing a utility class for filling derived tgg rule fields
Arikae Mar 14, 2023
ac34ddc
started implementing a utility class for filling derived tgg rule fields
Arikae Mar 14, 2023
0860ad1
regenerted tgg core model code
Arikae Mar 15, 2023
e4260ed
changed builder extension and removed flattened model
Arikae Mar 16, 2023
68b39bf
there are now tgg patterns that contain the csp information
Arikae Mar 17, 2023
879b60f
fixed csp stuff
Arikae Mar 17, 2023
9d8deed
refactored interpreters
Arikae Mar 17, 2023
151ab4f
some fixes due to csp refactorings
Arikae Mar 17, 2023
da6f579
fixed tgg extension
Arikae Mar 17, 2023
48d7053
fixed pipeline
Arikae Mar 17, 2023
25a651a
Fixed attribute condition check
adrianmoeller Mar 14, 2023
ac70418
Fixed attributes in runtime shortcut rule
adrianmoeller Mar 14, 2023
e895a4e
Fix Preconditions & attribute conditions
adrianmoeller Mar 18, 2023
f4dfb4b
Merge remote-tracking branch 'origin/refactoring/rework_TGG_attr' int…
adrianmoeller Mar 18, 2023
d63fd60
fixed several problems in the flattener
Arikae Mar 18, 2023
b01d097
fixed TGGL 2 TGG problems with nodes, edges and attribute constraints…
Arikae Mar 18, 2023
2884901
fixed correspondence edges
Arikae Mar 18, 2023
8e756e5
fixed some npes
Arikae Mar 19, 2023
9ec0a74
fixing generated operationalized rules
Arikae Mar 19, 2023
0ae3e4d
tgg hipe codegen is now called
Arikae Mar 19, 2023
f6fd687
Fix attribute conditions & local PM
adrianmoeller Mar 19, 2023
bb5c29f
Fixes and model extensions
adrianmoeller Mar 20, 2023
429e00e
fixed npe
Arikae Mar 20, 2023
3475b55
Fix repair attributes & CSPs
adrianmoeller Mar 20, 2023
64dd0af
Fixed attribute change container
adrianmoeller Mar 20, 2023
dcd5b4c
started fixing csp generation
Arikae Mar 21, 2023
59b8d65
Fix shortcut persistence
adrianmoeller Mar 21, 2023
7d17b63
Fixed CPSs for higher-order rules
adrianmoeller Mar 21, 2023
e6c12a4
fixed generated default csp lib
Arikae Mar 21, 2023
0f7d3ab
fixed generated csp stubs
Arikae Mar 22, 2023
24173e9
csps libraries have their own package
Arikae Mar 22, 2023
3c46e40
last fixes for csp generation
Arikae Mar 23, 2023
34cd5f3
refactored analysis package
Arikae Mar 23, 2023
438e5d5
added consistency as an operationalization
Arikae Mar 23, 2023
d75dd32
started fixing tgg plantuml vis
Arikae Mar 23, 2023
ab20be4
patterns should again match the old names before the refactoring
Arikae Mar 23, 2023
27ac046
patterns should again match the old names before the refactoring
Arikae Mar 23, 2023
a465e88
Fixed all errors in runtime project
adrianmoeller Mar 23, 2023
564a25c
refactored tgg runtime model
Arikae Mar 24, 2023
973b170
fixing more runtime errors
Arikae Mar 24, 2023
214ee31
tgg is executing again
Arikae Apr 1, 2023
8fb9aeb
fixed some problems with wrongly generated preconditions
Arikae Apr 1, 2023
15110d8
fixed generated marked elements
Arikae Apr 1, 2023
505b987
fixed more problems with missing information for csp execution
Arikae Apr 1, 2023
e16a93b
probably solved most csp problems
Arikae Apr 1, 2023
025700d
first test without exceptions
Arikae Apr 1, 2023
a277c43
first green test
Arikae Apr 2, 2023
dc16d40
almost all companyToIT-batch tests are running
Arikae Apr 2, 2023
e0f8dc9
implemented missing domain specific fields
Arikae Apr 2, 2023
b80f14a
fixed tgg visualizer
Arikae Apr 7, 2023
56b31f7
fixed tgg plant uml vis. attribute assignments, constraints and condi…
Arikae Apr 9, 2023
eee0b99
fixed a classcast exception for flattening arithmetic expression
Arikae Apr 11, 2023
7eaffc6
removed UserDefined prefix from attribute constraints
Arikae Apr 11, 2023
5b8641d
fixed an issue where emf complained about ereferences not being added…
Arikae Apr 11, 2023
ccdf4f9
reimplemented derived parameters of csp node attribute values
Arikae Apr 14, 2023
a4737d7
fixed a problem where broken attribute conditions were not removed du…
Arikae Apr 14, 2023
9d31ecf
added a new project that encapsulates plant uml visualisations
Arikae Apr 15, 2023
637e7b0
fixed visualisation
Arikae Apr 15, 2023
f1ed136
implemented generation and optimization of injectivity constraints
Arikae Apr 15, 2023
7e77066
no longer generating forward and backward rules without created eleme…
Arikae Apr 15, 2023
d6bd4b4
Fixed missing null check
adrianmoeller Apr 17, 2023
70d7287
refactored last fix. now using ecoreUtil.deleteAll
Arikae Apr 17, 2023
a70667a
fixed a problem where some csp parameters were duplicated
Arikae Apr 17, 2023
3aef87a
Fixed a missing null check
adrianmoeller Apr 17, 2023
2e2933b
Fixed dependency bug
adrianmoeller Apr 17, 2023
b71fa8a
Fixed setting precondition
adrianmoeller Apr 17, 2023
d7ae1d9
Fixed dependency bug
adrianmoeller Apr 17, 2023
8e09ce2
fixed csp initialization
Arikae Apr 17, 2023
a85613b
eliminated edge duplicates
Arikae Apr 17, 2023
e0860b6
fixed npe when there are no csps
Arikae Apr 17, 2023
9aa652c
fixed a problem with duplicate csp parameter values
Arikae Apr 18, 2023
554d7be
implemented filter nac analysis
Arikae Apr 19, 2023
37e7985
now using correct operators for object comparisons
Arikae Apr 19, 2023
3f34227
fixed injectivity constraints for operationalized rules
Arikae Apr 19, 2023
f829eea
Fixed dangling references
adrianmoeller Apr 20, 2023
13a0a51
every strategy is now aware of its currently applied operationalRule …
Arikae Apr 20, 2023
a79e860
Fix operational rule name confusion
adrianmoeller Apr 21, 2023
9ebd178
now generating typed source and target references due to problems wit…
Arikae Apr 24, 2023
85c36dd
correspondence metamodel code generation moved to this repository
Arikae Apr 25, 2023
4c8b564
first attempt to fix missing source and target types
Arikae Apr 25, 2023
ceaeb78
fixed correspondence type inheritance
Arikae Apr 25, 2023
823d202
fixed correspondence code generation
Arikae Apr 26, 2023
d87b3d6
Insert exception throw for better error transparency
adrianmoeller Apr 28, 2023
937f7f9
we no longer generate redundant backward edges for bidirectional edge…
Arikae Apr 28, 2023
1253d16
Fixed setting operationalType for shortcut rule nodes & edges, fixed …
adrianmoeller Apr 29, 2023
d648294
Fix CSP registration for operational shortcut rules
adrianmoeller Apr 29, 2023
77b7148
filter nac generation now also checks for opposite edges since we do …
Arikae May 2, 2023
d43ca2a
Fixed remove inplace attr in TGG operationalizer
adrianmoeller Apr 26, 2023
d840e45
Fixed CSPs in shortcut rules
adrianmoeller May 3, 2023
394b212
Fixed failing CSP definition library comparison
adrianmoeller May 3, 2023
821c70b
Removed non-flattened TGG option
adrianmoeller May 3, 2023
e408dd1
Fixed missing CC patterns for INTEGRATE; fixed wrong RuleHandler call…
adrianmoeller May 4, 2023
192a95f
Fixed wrong RuleHandler call
adrianmoeller May 4, 2023
07e3672
Fixed wrong RuleHandler call
adrianmoeller May 4, 2023
80f6852
Fixed several bugs in higher-order framework
adrianmoeller May 6, 2023
b842272
Fix more bugs
adrianmoeller May 8, 2023
33741a5
Fixed Shortcut resource management
adrianmoeller May 8, 2023
b73b166
Fixed higher-order framework
adrianmoeller May 8, 2023
94347f4
Hopefully last fix :)
adrianmoeller May 9, 2023
74ea9c4
removed possibility of patterns to contain created elements
Arikae Jun 22, 2023
e3937e4
fixed an issue where filter nacs were omitted because there was alrea…
Arikae Jul 10, 2023
a08f622
- optimized appearing and disappearing subscriptions by avoiding redu…
Arikae Sep 7, 2023
f5c1a90
Updates/Fixes gitignores
maxkratz Oct 12, 2023
ff3f022
Merge remote-tracking branch 'origin/master' into refactoring/rework_TGG
maxkratz Oct 12, 2023
f7dd772
Removes non-existing folders from build.properties to fix updatesite
maxkratz Oct 12, 2023
828cc56
Fixes missing DefaultFilesHelper.class in updatesite JAR
maxkratz Oct 12, 2023
43fd7a6
Include src folder to tgg runtime JAR build
maxkratz Oct 12, 2023
def1ae5
Removes old IBeX 1.0 projects
maxkratz Oct 12, 2023
4e5cfdf
readding DefaultFilesGenerator.xtend
Arikae Feb 20, 2024
4889692
Merge remote-tracking branch 'origin/master' into refactoring/rework_TGG
maxkratz Feb 20, 2024
f7bf6ad
Updates all genmodels to Java 17 + fixes merge issue with one metamodel
maxkratz Feb 20, 2024
61a0e64
Removes generated code + adds src-gen folders to the gitignores
maxkratz Feb 20, 2024
1b9f67b
Removes generated code from tgg.compiler project
maxkratz Feb 20, 2024
5adf46f
Adapts/adds all MWE2 files to build all metamodels, languages, etc.
maxkratz Feb 20, 2024
20239fe
Adds missing common core model MWE run file
maxkratz Feb 20, 2024
e5eee44
fixed default files generator templates to match the new tggl syntax
Arikae Apr 15, 2024
596efac
fixed a bottleneck within the shortcut rule framework due to expensiv…
Arikae Apr 15, 2024
357716e
removing some unnecessary time logging in the shortcut rule framework
Arikae Apr 15, 2024
260b2dd
fixed some issues with the last improvements
Arikae Apr 16, 2024
2667b1a
fixed an issue within the pattern matcher used for shortcut rules whi…
Arikae Apr 17, 2024
b357370
fixed attribute bindings of shortcut rules which were not setting csp…
Arikae Apr 23, 2024
74ea161
Fixes a typo in the DefaultFilesHelper for the TGGL code gen
maxkratz Apr 25, 2024
b4a79e9
small fix in the shortcut rule framework where csp parameters were se…
Arikae Apr 26, 2024
cbc783f
Updates README.md for IBeX v2
maxkratz May 8, 2024
273b5cd
Merge remote-tracking branch 'origin/master' into refactoring/rework_TGG
maxkratz Jun 18, 2024
adee7f4
Snapshot: fixes after merge
maxkratz Jun 18, 2024
f990533
TGG: fixes stop criterion handling in MODELGEN
maxkratz Jun 24, 2024
cfd6c75
merges upstream
maxkratz Sep 4, 2024
03bc421
Renames both projects manually
maxkratz Sep 4, 2024
9472221
Adds a way to pass the IBeX pattern path to the api manually
maxkratz Sep 10, 2024
99eded1
small fix in the shortcut rule framework where csp parameters were se…
Arikae Oct 23, 2024
261e468
small fix regarding attribute repairs with csps that led to cases wer…
Arikae Oct 24, 2024
5c23610
IBeXGtAPI::loadGTModel now uses the getIbexGTModel getter to obtain t…
Arikae Oct 24, 2024
4641bdc
Revert "IBeXGtAPI::loadGTModel now uses the getIbexGTModel getter to …
maxkratz Oct 25, 2024
6983e58
Clarifies IBeXGtAPI init with static and dynamic XMI paths
maxkratz Oct 28, 2024
6aba36f
Merge pull request #430 from eMoflon/refactoring/rework_TGG_ibex-mode…
maxkratz Oct 29, 2024
5aa77dc
Merge branch 'master' into refactoring/rework_TGG
maxkratz Nov 8, 2024
cdcfa9c
Merge branch 'master' into refactoring/rework_TGG
maxkratz Dec 17, 2024
310ff10
Properly update all projects to Java 21
maxkratz Mar 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added more api template classe
-> TODO:
(1) Add CoPattern template
(2) Implement: rule application
(3) Implement: match conditions
(4) Implement: Match filter
arg0n1s committed Oct 17, 2022
commit 2c909bc7823135a13ce23bcc777496af3a276281
Original file line number Diff line number Diff line change
@@ -33,6 +33,8 @@ public class IBeXGTApiData {
final public Map<GTPattern, String> pattern2matchClassName = new LinkedHashMap<>();
final public Map<GTPattern, String> pattern2patternClassName = new LinkedHashMap<>();
final public Map<GTRule, String> rule2ruleClassName = new LinkedHashMap<>();
final public Map<GTRule, String> rule2CoPatternClassName = new LinkedHashMap<>();
final public Map<GTRule, String> rule2CoMatchClassName = new LinkedHashMap<>();
final public Map<GTPattern, GTRule> pattern2rule = new LinkedHashMap<>();

public IBeXGTApiData(final GTModel model) {
@@ -65,6 +67,8 @@ protected void init() {
rulePatterns.add((GTPattern) rule.getPrecondition());
rule2ruleClassName.put(rule, firstToUpper(rule.getName()) + "Rule");
pattern2matchClassName.put((GTPattern) rule.getPrecondition(), firstToUpper(rule.getName()) + "Match");
rule2CoPatternClassName.put(rule, firstToUpper(rule.getPostcondition().getName()));
rule2CoMatchClassName.put(rule, firstToUpper(rule.getName()) + "CoMatch");
pattern2rule.put((GTPattern) rule.getPrecondition(), rule);
});
model.getPatternSet().getPatterns().stream().map(pattern -> (GTPattern) pattern)
Original file line number Diff line number Diff line change
@@ -0,0 +1,128 @@
package org.emoflon.ibex.gt.build.template

import org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTPattern
import org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTRule

class IBeXGtCoMatchTemplate extends GeneratorTemplate<GTRule>{

protected String ruleClassName;
protected String matchClassName;
protected String coPatternClassName;
protected GTPattern coPattern;

new(IBeXGTApiData data, GTRule context) {
super(data, context)
}

override init() {
packageName = data.matchPackage
className = data.rule2CoMatchClassName.get(context)
fqn = packageName + "." + className;
filePath = data.matchPackagePath + "/" + className

imports.add("java.util.List")
imports.add("java.util.Map")
imports.add("org.emoflon.ibex.common.operational.HashUtil")
imports.add("org.emoflon.ibex.gt.engine.IBeXGTCoMatch")
ruleClassName = data.rule2ruleClassName.get(context);
matchClassName = data.pattern2matchClassName.get(context.precondition)
coPatternClassName = data.rule2CoPatternClassName.get(context)

imports.add(data.rulePackage + "." + ruleClassName)
imports.add(data.patternPackage + "." + coPatternClassName)
imports.add(data.matchPackage + "." + matchClassName)

coPattern = context.postcondition as GTPattern
coPattern.signatureNodes
.map[node | data.model.metaData.name2package.get(node.eClass.EPackage.name).classifierName2FQN.get(node.type)]
.forEach[fqn | imports.add(fqn)]
}

override generate() {
code = '''package «data.matchPackage»

«FOR imp : imports»
import «imp»;
«ENDFOR»

public class «className» extends IBeXGTCoMatch<«className», «coPatternClassName», «ruleClassName», «ruleClassName», «matchClassName»> {

«FOR node : coPattern.signatureNodes»
protected «node.type.name» «node.name.toFirstLower»;
«ENDFOR»

public «className»(final «ruleClassName» typedRule, final «coPatternClassName» typedCoPattern, final Map<String, Object> nodes) {
super(typedRule, typedCoPattern, nodes);
}

public «className»(final «className» other) {
super(other);
}

@Override
public String getPatternName() {
return "«context.name»"
}

@Override
public Object get(String name) {
return switch(name) -> {
«FOR node : coPattern.signatureNodes»
case "«node.name»" -> yield «node.name.toFirstLower»
«ENDFOR»
};
}

@Override
public Collection<String> getParameterNames() {
return List.of(
«FOR node : coPattern.signatureNodes SEPARATOR ', '»
"«node.name»"
«ENDFOR»
);
}

@Override
public Collection<Object> getObjects() {
return List.of(
«FOR node : coPattern.signatureNodes SEPARATOR ', '»
«node.name.toFirstLower»
«ENDFOR»
);
}

@Override
protected void initialize(final Map<String, Object> nodes) {
«FOR node : coPattern.signatureNodes»
«node.name.toFirstLower» = («node.type.name») nodes.get("«node.name»");
«ENDFOR»
}

@Override
protected void initialize(final «className» other) {
«FOR node : coPattern.signatureNodes»
«node.name.toFirstLower» = other.«node.name.toFirstLower»;
«ENDFOR»
}

@Override
public boolean checkConditions() {
return typedPattern.checkConditions(this);
}

@Override
public «className» copy() {
return new «className»(this);
}

«FOR node : coPattern.signatureNodes»
public «node.type.name» «node.name.toFirstLower»() {
return «node.name.toFirstLower»;
}

«ENDFOR»
}'''
}


}
Original file line number Diff line number Diff line change
@@ -35,7 +35,7 @@ class IBeXGtMatchTemplate extends GeneratorTemplate<GTPattern>{
}

override generate() {
code = '''package data.matchPackage
code = '''package «data.matchPackage»

«FOR imp : imports»
import «imp»;
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
package org.emoflon.ibex.gt.build.template

import org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTPattern

class IBeXGtPatternTemplate extends GeneratorTemplate<GTPattern>{

protected String matchClassName;

new(IBeXGTApiData data, GTPattern context) {
super(data, context)
}

override init() {
packageName = data.patternPackage
className = data.pattern2patternClassName.get(context)
matchClassName = data.pattern2matchClassName.get(context)

fqn = packageName + "." + className;
filePath = data.patternPackagePath + "/" + className

imports.add("java.util.Collection")
imports.add("java.util.Map")
imports.add("org.emoflon.ibex.gt.engine.IBeXGTPattern")
imports.add("org.emoflon.ibex.gt.api.IBeXGtAPI")
imports.add("org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTPattern")

}

override generate() {
code = '''package «data.patternPackage»

«FOR imp : imports»
import «imp»;
«ENDFOR»

public class «className» extends IBeXGTPattern<«className», «matchClassName»> {

public «className»(final IBeXGtAPI<?, ?, ?> api, final GTPattern pattern) {
super(api, pattern);
}

@Override
protected Collection<String> getParameterNames() {
throw new UnsupportedOperationException("Patterns do not have any parameters.");
}

@Override
protected Map<String, Object> getParameters() {
throw new UnsupportedOperationException("Patterns do not have any parameters.");
}

@Override
protected boolean checkConditions(final «matchClassName» match) {
//TODO: !
return false;
}

@Override
public boolean hasArithmeticExpressions() {
//TODO: !
return false;
}

@Override
public abstract boolean hasCountExpressions() {
//TODO: !
return false;
}

protected «matchClassName» createMatch(final Map<String, Object> nodes) {
return new «matchClassName»(this, nodes);
}

}'''
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
package org.emoflon.ibex.gt.build.template

import org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTRule

class IBeXGtRuleTemplate extends GeneratorTemplate<GTRule>{

protected String coMatchClassName;
protected String matchClassName;

protected String coPatternClassName;
protected String patternClassName;

new(IBeXGTApiData data, GTRule context) {
super(data, context)
}

override init() {
packageName = data.rulePackage
className = data.rule2ruleClassName.get(context)
coMatchClassName = data.rule2CoMatchClassName.get(context)
matchClassName = data.pattern2matchClassName.get(context.precondition)
coPatternClassName = data.rule2CoPatternClassName.get(context)
patternClassName = data.pattern2patternClassName.get(context.precondition)

fqn = packageName + "." + className;
filePath = data.rulePackagePath + "/" + className

imports.add("java.util.Collection")
imports.add("java.util.List")
imports.add("java.util.Map")
imports.add("java.util.Optional")
imports.add("org.emoflon.ibex.gt.engine.IBeXGTRule")
imports.add("org.emoflon.ibex.gt.api.IBeXGtAPI")
imports.add("org.emoflon.ibex.gt.gtmodel.IBeXGTModel.GTRule")

context.parameters
.map[param | data.model.metaData.name2package.get(param.type.EPackage).classifierName2FQN.get(param.type.name)]
.forEach[fqn | imports.add(fqn)]

}

override generate() {
code = '''package «data.rulePackage»

«FOR imp : imports»
import «imp»;
«ENDFOR»

public class «className» extends IBeXGTRule<«className», «patternClassName», «matchClassName», «coPatternClassName», «coMatchClassName»> {

«FOR param : context.parameters»
protected «param.type.name» «param.name.toFirstLower»;
«ENDFOR»

public «className»(final IBeXGtAPI<?, ?, ?> api, final GTRule rule) {
super(api, rule);
}

@Override
protected Collection<String> getParameterNames() {
return List.of(
«FOR param : context.parameters SEPARATOR ', '»
"«param.name»"
«ENDFOR»
);
}

@Override
protected Map<String, Object> getParameters() {
return Map.of(
«FOR param : context.parameters SEPARATOR ', '»
"«param.name»", «param.name.toFirstLower»
«ENDFOR»
);
}

@Override
public void setParameters(final Map<String, Object> parameters) {
for(String name : parameters.keySet()) {
switch(name) {
«FOR param : context.parameters»
case "«param.name»" : {
«param.name.toFirstLower» = parameters.get("«param.name»");
break;
}
«ENDFOR»
}
}
}

public void setParameters(«FOR param : context.parameters SEPARATOR ', '»final «param.type.name» «param.name.toFirstLower»«ENDFOR») {
«FOR param : context.parameters»
this.«param.name.toFirstLower» = «param.name.toFirstLower»;
«ENDFOR»
}

@Override
protected boolean checkConditions(final «matchClassName» match) {
//TODO: !
return false;
}

@Override
public boolean hasArithmeticExpressions() {
//TODO: !
return false;
}

@Override
public abstract boolean hasCountExpressions() {
//TODO: !
return false;
}

protected «matchClassName» createMatch(final Map<String, Object> nodes) {
return new «matchClassName»(this, nodes);
}

protected «coPatternClassName» createCoPattern() {
return new «coPatternClassName»(api, this, rule);
}

public boolean hasProbability() {
«IF context.probability === null»
return false;
«ELSE»
return true;
«ENDIF»
}

public double getProbability(final «matchClassName» match) {
// TODO: !
return 0.0;
}

public Optional<«coMatchClassName»> apply(final «matchClassName» match) {
// TODO: !
return Optional.empty();
}

public Optional<«matchClassName»> applyReverse(final «coMatchClassName» coMatch) {
throw new UnsupportedOperationException("Reverse application is currently not implemented!");
}

}'''
}


}
Loading