Permalink
Browse files

no idea

  • Loading branch information...
Albert Zuendorf
Albert Zuendorf committed Apr 18, 2016
1 parent aa41bea commit f3865c3731294222353582e0c9f2bc50e15d1fd8
Showing with 48 additions and 46 deletions.
  1. +3 −1 META-INF/MANIFEST.MF
  2. +45 −45 src/main/java/org/sdmlib/models/pattern/PatternObject.java
View
@@ -4,7 +4,8 @@ Bundle-Name: SDMLib
Bundle-SymbolicName: SDMLib;singleton:=true
Bundle-Version: 1.0.0.qualifier
Main-Class: org.sdmlib.models.classes.gui.SDMDiagramEditor
Require-Bundle: NetworkParser;bundle-version="1.0.0";visibility:=reexport
Require-Bundle: NetworkParser;bundle-version="1.0.0";visibility:=reexport,
SDMLib
Export-Package: org.sdmlib,
org.sdmlib.codegen,
org.sdmlib.codegen.util,
@@ -35,3 +36,4 @@ Export-Package: org.sdmlib,
org.sdmlib.storyboards,
org.sdmlib.storyboards.util,
org.sdmlib.templates
Import-Package: org.sdmlib.models.pattern
@@ -41,11 +41,11 @@ and associated documentation files (the "Software"), to deal in the Software wit
import org.sdmlib.models.pattern.CardinalityConstraint;
import org.sdmlib.models.pattern.MatchOtherThen;
/**
*
* @see <a href='../../../../../../../src/test/java/org/sdmlib/test/examples/SDMLib/PatternModelCodeGen.java'>PatternModelCodeGen.java</a>
*/
public class PatternObject<POC, MC> extends PatternElement<POC>
/**
*
* @see <a href='../../../../../../../src/test/java/org/sdmlib/test/examples/SDMLib/PatternModelCodeGen.java'>PatternModelCodeGen.java</a>
*/
public class PatternObject<POC, MC> extends PatternElement<POC>
{
public static final String PROPERTY_ATTRCONSTRAINTS = "attrConstraints";
public static final String PROPERTY_CANDIDATES = "candidates";
@@ -72,7 +72,7 @@ protected void newInstance(IdMap map){
Pattern<Object> pattern = new Pattern<Object>(new SDMLibIdMap("p"));
pattern.addToElements(this);
}
protected void newInstance(IdMap map, Object[] hostGraphObject){
Pattern<Object> pattern = new Pattern<Object>(new SDMLibIdMap("p"));
pattern.addToElements(this);
@@ -84,16 +84,16 @@ protected void newInstance(IdMap map, Object[] hostGraphObject){
}
pattern.findMatch();
}
public <POSC extends PatternObject> POSC instanceOf(POSC subclassPO)
{
// add a pattern link that checks the type of the source object and the
// target object passed as subclassPO
this.hasLink("instanceof", subclassPO);
return subclassPO;
}
public boolean rebind(MC o)
{
return this.getPattern().rebind(this, o);
@@ -159,7 +159,7 @@ public boolean findNextMatch()
this.getTopPattern().addLogMsg(
"" + getLHSPatternObjectName() + " = new " + shortClassName + "(); // "
+ getPattern().getIdMap().getId(sendableInstance));
+ getPattern().getIdMap().getId(sendableInstance));
}
return true;
@@ -192,7 +192,7 @@ else if (Pattern.BOUND.equals(getModifier()))
}
if (this.getCandidates() == null
|| this.getCandidates() instanceof Collection && ((Collection<?>) this.getCandidates()).isEmpty())
|| this.getCandidates() instanceof Collection && ((Collection<?>) this.getCandidates()).isEmpty())
{
this.setHasMatch(false);
return false;
@@ -221,8 +221,8 @@ else if (Pattern.BOUND.equals(getModifier()))
String tgtVar = getLHSPatternObjectName();
getTopPattern().addLogMsg(
tgtVar + " = " + getPatternObjectName() + "Candidates.removeFirst(); // "
+ getTopPattern().getIdMap().getId(obj) + " " + obj + " <- "
+ valueSetString(this.getCandidates()));
+ getTopPattern().getIdMap().getId(obj) + " " + obj + " <- "
+ valueSetString(this.getCandidates()));
}
}
else
@@ -402,11 +402,11 @@ public POC doAllMatches()
public POC destroy()
{
DestroyObjectElem destroyObjectElem = (DestroyObjectElem) new DestroyObjectElem()
.withPatternObject(this)
.withPattern(this.getPattern());
.withPatternObject(this)
.withPattern(this.getPattern());
this.getPattern()
.findMatch();
.findMatch();
return (POC) this;
}
@@ -461,9 +461,9 @@ public PatternObject withCurrentMatch(Object value)
* PatternObject ----------------------------------- PatternLink
* tgt incomming
* </pre>
* @return The PatternObject
*/
public PatternLinkSet getIncomming()
* @return The PatternObject
*/
public PatternLinkSet getIncomming()
{
if (this.incomming == null)
{
@@ -731,9 +731,9 @@ public void hasLink(String roleName, PatternObject result)
this.getPattern().findMatch();
LinkConstraint patternLink = (LinkConstraint) new LinkConstraint()
.withTgt(result).withTgtRoleName(roleName)
.withSrc(this)
.withModifier(this.getPattern().getModifier());
.withTgt(result).withTgtRoleName(roleName)
.withSrc(this)
.withModifier(this.getPattern().getModifier());
this.getPattern().addToElements(patternLink);
@@ -742,16 +742,16 @@ public void hasLink(String roleName, PatternObject result)
else
{
PatternLink patternLink = new PatternLink()
.withTgt(result).withTgtRoleName(roleName)
.withSrc(this);
.withTgt(result).withTgtRoleName(roleName)
.withSrc(this);
patternLink.setModifier(this.getPattern().getModifier());
this.getPattern().addToElements(patternLink);
this.getPattern().addToElements(result);
result.getPattern()
.findMatch();
.findMatch();
}
}
@@ -761,15 +761,15 @@ protected void filterAttr() {
setCurrentMatch(null);
}
}
public POC has(Condition<Object> condition, String text)
{
GenericConstraint genericConstraint = (GenericConstraint) new GenericConstraint()
.withText(text)
.withSrc(this)
.withCondition(condition)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
.withText(text)
.withSrc(this)
.withCondition(condition)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
this.getPattern().findMatch();
@@ -785,23 +785,23 @@ public POC has(Condition<Object> condition, String text)
public POC has(Condition<Object> condition)
{
GenericConstraint genericConstraint = (GenericConstraint) new GenericConstraint()
.withCondition(condition)
.withSrc(this)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
.withCondition(condition)
.withSrc(this)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
this.getPattern().findMatch();
return (POC) this;
}
public POC filter(Condition<Object> condition)
public POC filter(Condition<MC> condition)
{
GenericConstraint genericConstraint = (GenericConstraint) new GenericConstraint()
.withCondition(condition)
.withSrc(this)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
.withCondition((Condition<Object>) condition)
.withSrc(this)
.withModifier(this.getPattern().getModifier())
.withPattern(this.getPattern());
this.getPattern().findMatch();
@@ -976,9 +976,9 @@ public POC hasLinkConstraint(PatternObject tgt, String roleName)
else
{
LinkConstraint patternLink = (LinkConstraint) new LinkConstraint()
.withTgt(tgt).withTgtRoleName(roleName)
.withSrc(this)
.withModifier(this.getPattern().getModifier());
.withTgt(tgt).withTgtRoleName(roleName)
.withSrc(this)
.withModifier(this.getPattern().getModifier());
this.getPattern().addToElements(patternLink);
@@ -1079,8 +1079,8 @@ MatchOtherThen createMatchOtherThen()
public POC hasMatchOtherThen(PatternObject forbidden)
{
MatchOtherThen otherThen = createMatchOtherThen()
.withForbidden(forbidden)
.withPattern(getPattern());
.withForbidden(forbidden)
.withPattern(getPattern());
getPattern().findMatch();

0 comments on commit f3865c3

Please sign in to comment.