Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
ttc18
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stgroup
ttc18
Commits
27515144
Commit
27515144
authored
6 years ago
by
Johannes Mey
Browse files
Options
Downloads
Patches
Plain Diff
add attribute for potentially valid implementations
parent
b539c508
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
jastadd-mquat-base/src/main/jastadd/solution/Checking.jrag
+72
-0
72 additions, 0 deletions
jastadd-mquat-base/src/main/jastadd/solution/Checking.jrag
with
72 additions
and
0 deletions
jastadd-mquat-base/src/main/jastadd/solution/Checking.jrag
+
72
−
0
View file @
27515144
...
@@ -136,4 +136,76 @@ aspect Checking {
...
@@ -136,4 +136,76 @@ aspect Checking {
throw new RuntimeException("Objective could not be computed!");
throw new RuntimeException("Objective could not be computed!");
}
}
syn java.util.List<Implementation> Component.locallyValidImplementations(Request request) {
java.util.List<Implementation> locallyValidImplementations = new java.util.ArrayList<>();
for (Implementation implementation : this.getImplementationList()) {
Assignment assignment = new Assignment();
assignment.setTopLevel(true);
assignment.setRequest(request);
assignment.setImplementation(implementation);
boolean fitting = true;
for (Clause clause : request.getConstraintList()) {
if (clause.isRequiringClause() && clause.getDesignator().isSoftwareDesignator()) {
if (!clause.checkUsing(assignment)) {
fitting = false;
logger.info("found a not fitting top level impl");
break;
}
}
}
if (fitting) {
locallyValidImplementations.add(implementation);
}
}
return locallyValidImplementations;
}
syn java.util.List<Implementation> Component.locallyValidImplementations(Request request, Implementation parentImplementation, Instance instance) {
Assignment assignment = new Assignment();
assignment.setTopLevel(false);
assignment.setRequest(request);
assignment.setImplementation(parentImplementation);
java.util.List<Implementation> locallyValidImplementations = new java.util.ArrayList<>();
for (Implementation implementation : this.getImplementationList()) {
Assignment subAssignment = new Assignment();
subAssignment.setTopLevel(false);
subAssignment.setRequest(assignment.getRequest());
subAssignment.setImplementation(implementation);
ComponentMapping mapping = new ComponentMapping(instance, subAssignment);
int mappingIndex = 0;
for (; mappingIndex < assignment.getNumComponentMapping(); mappingIndex++) {
if (assignment.getComponentMapping(mappingIndex).getInstance() == instance) {
break;
}
}
assignment.setComponentMapping(mapping, mappingIndex);
boolean fitting = true;
for (Clause clause : assignment.getImplementation().getClauseList()) {
if (clause.isRequiringClause() && clause.getDesignator().isSoftwareDesignator()) {
if (clause.getDesignator().asSoftwareDesignator().getInstanceRef().getRef() == instance) {
if (!clause.checkUsing(assignment)) {
fitting = false;
logger.info("found a not fitting impl");
break;
}
}
}
}
assignment.getComponentMappingList().removeChild(mappingIndex);
if (fitting) {
locallyValidImplementations.add(implementation);
}
}
return locallyValidImplementations;
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment