Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Willink2016-11-04 14:01:35 +0000
committerEd Willink2016-11-04 14:01:35 +0000
commitfb00f283ddcf2da8cb63a8d723110c01d8b099c9 (patch)
tree643dfe896f63318dd2b2f81b47e9e981a0a5be52
parent58741457d4a4b0879eb46fef0679c01a0c9f79ec (diff)
downloadorg.eclipse.qvtd-fb00f283ddcf2da8cb63a8d723110c01d8b099c9.tar.gz
org.eclipse.qvtd-fb00f283ddcf2da8cb63a8d723110c01d8b099c9.tar.xz
org.eclipse.qvtd-fb00f283ddcf2da8cb63a8d723110c01d8b099c9.zip
[unrelated] Use a fill for conditional nodes
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java8
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Edge.java3
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Node.java3
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/NodeRole.java1
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Role.java13
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeImpl.java32
-rw-r--r--plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeRoleImpl.java13
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/DOTStringBuilder.java5
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphMLStringBuilder.java19
-rw-r--r--plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphStringBuilder.java1
10 files changed, 77 insertions, 21 deletions
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
index 5dc78086b..9987f1a48 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/AbstractMappingRegion.java
@@ -476,13 +476,15 @@ public abstract class AbstractMappingRegion extends AbstractRegion implements Ma
this.deadNodes = new ArrayList<>(deadNodes);
Collections.sort(this.deadNodes, NameUtil.NAMEABLE_COMPARATOR);
}
- for (@NonNull Node node : getNodes()) {
+ /* for (@NonNull Node node : getNodes()) {
boolean isMatched = node.isMatched();
boolean isUnconditional = node.isUnconditional();
- if (isMatched != isUnconditional) {
+ boolean isRequired = node.isRequired();
+ boolean isPattern = node.isPattern();
+ if (isMatched != (isUnconditional && isPattern)) {
System.out.println("Inconsistently isMatched in " + this + " : " + node);
}
- }
+ } */
}
@Override
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Edge.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Edge.java
index 5f67739a4..bd58d68f7 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Edge.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Edge.java
@@ -116,9 +116,8 @@ public interface Edge extends GraphStringBuilder.GraphEdge, Nameable, Visitable
* Conversely return false if this edge is a conditional execution path or its ends my be optional nulls.
* Collections are never null-valued, not even empty collections.
*
- * @deprecated use isUnconditional or getUtility
+ * *deprecated try to use isUnconditional or getUtility
*/
- @Deprecated
boolean isMatched();
/**
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Node.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Node.java
index a00e4a582..0b36cee5f 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Node.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Node.java
@@ -170,9 +170,8 @@ public interface Node extends ConnectionEnd, GraphStringBuilder.GraphNode, Namea
* Conversely return false if this node is optionally null or part of a conditional expression evaluation.
* Collections are never null-valued, not even empty collections.
*
- * @deprecated use isUnconditional or getUtility
+ * *deprecated try to use isUnconditional or getUtility
*/
- @Deprecated
boolean isMatched();
/**
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/NodeRole.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/NodeRole.java
index 119f0f630..af5844dbf 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/NodeRole.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/NodeRole.java
@@ -21,6 +21,7 @@ public interface NodeRole extends Role
@NonNull NodeRole asPredicated();
@NonNull NodeRole asSpeculated();
@NonNull NodeRole asSpeculation();
+ @NonNull String getFillColor();
/**
* Return the merged role combining this role and nodeRole.
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Role.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Role.java
index 606c918ba..ed213d751 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Role.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/Role.java
@@ -17,18 +17,25 @@ import org.eclipse.jdt.annotation.NonNull;
*/
public interface Role extends Comparable<Role>
{
- public static final @NonNull String BINDING_COLOR = "orange";
+ public static final @NonNull String BINDING_COLOR = "darkorange";
public static final @NonNull String CONSTANT_COLOR = "black";
public static final @NonNull String ERROR_COLOR = "red";
public static final @NonNull String ITERATION_COLOR = "magenta";
+ public static final @NonNull String LIGHT_CONSTANT_COLOR = "lightgray";
+ public static final @NonNull String LIGHT_LOADED_COLOR = "lightblue1";
+ public static final @NonNull String LIGHT_OTHER_COLOR = "gray";
+ public static final @NonNull String LIGHT_PREDICATED_COLOR = "lightcyan1";
+ public static final @NonNull String LIGHT_REALIZED_COLOR = "palegreen1";
+ public static final @NonNull String LIGHT_SPECULATED_COLOR = "palegoldenrod";
+ public static final @NonNull String LIGHT_SPECULATION_COLOR = "pink1";
public static final @NonNull String LOADED_COLOR = "blue";
public static final @NonNull String OPERATION_COLOR = "magenta";
public static final @NonNull String ORDERING_COLOR = "brown";
public static final @NonNull String OTHER_COLOR = "grey";
public static final @NonNull String PREDICATED_COLOR = "cyan";
- public static final @NonNull String REALIZED_COLOR = "green";
+ public static final @NonNull String REALIZED_COLOR = "green3";
public static final @NonNull String RECURSION_COLOR = "brown";
- public static final @NonNull String SPECULATED_COLOR = "orange";
+ public static final @NonNull String SPECULATED_COLOR = "darkorange";
public static final @NonNull String SPECULATION_COLOR = "red";
public static final @NonNull Integer HEAD_WIDTH = 8;
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeImpl.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeImpl.java
index 5a8784889..c04f99d88 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeImpl.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeImpl.java
@@ -179,6 +179,9 @@ public abstract class NodeImpl implements Node
s.setStyle(style);
}
s.setColor(getColor());
+ if (!isUnconditional()) {
+ s.setFillColor(getFillColor());
+ }
s.setPenwidth(getPenwidth());
s.appendAttributedNode(nodeName);
// if (isHead) {
@@ -298,6 +301,11 @@ public abstract class NodeImpl implements Node
return region.getName() + "::" + getName();
}
+ protected @NonNull String getFillColor() {
+ assert nodeRole != null;
+ return nodeRole.getFillColor();
+ }
+
@Override
public final @Nullable NodeConnection getIncomingConnection() {
return incomingConnection;
@@ -499,19 +507,23 @@ public abstract class NodeImpl implements Node
}
protected @Nullable String getStyle() {
- // if (isNull()) {
- // return "rounded";
- // }
- // if (isTrue() || getNodeRole().isExtraGuardVariable()) {
- // return null;
- // }
- boolean isDashed = !isMatched(); //!isRequired() && (isExpression() || !isRealized());
+ StringBuilder s = new StringBuilder();
if (isDataType()) {
- return isDashed ? "\"rounded,dashed\"" : "rounded";
+ s.append("rounded");
}
- else {
- return isDashed ? "dashed" : null;
+ if (!isMatched()) {
+ if (s.length() > 0) {
+ s.append(",");
+ }
+ s.append("dashed");
+ }
+ if (!isUnconditional()) {
+ if (s.length() > 0) {
+ s.append(",");
+ }
+ s.append("filled");
}
+ return "\"" + s.toString() + "\"";
}
@Override
diff --git a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeRoleImpl.java b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeRoleImpl.java
index 271150fa5..2d955b718 100644
--- a/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeRoleImpl.java
+++ b/plugins/org.eclipse.qvtd.compiler/src/org/eclipse/qvtd/compiler/internal/qvtp2qvts/impl/NodeRoleImpl.java
@@ -63,6 +63,19 @@ public class NodeRoleImpl extends AbstractRoleImpl implements NodeRole
}
@Override
+ public final @NonNull String getFillColor() {
+ switch (phase) {
+ case CONSTANT: return LIGHT_CONSTANT_COLOR;
+ case LOADED: return LIGHT_LOADED_COLOR;
+ case PREDICATED: return LIGHT_PREDICATED_COLOR;
+ case REALIZED: return LIGHT_REALIZED_COLOR;
+ case SPECULATION: return LIGHT_SPECULATION_COLOR;
+ case SPECULATED: return LIGHT_SPECULATED_COLOR;
+ default: return LIGHT_OTHER_COLOR;
+ }
+ }
+
+ @Override
public @NonNull NodeRole merge(@NonNull NodeRole nodeRole) {
Phase mergedPhase = RegionUtil.mergeToMoreKnownPhase(this, nodeRole).getPhase();
return getNodeRole(mergedPhase);
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/DOTStringBuilder.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/DOTStringBuilder.java
index d2adbbacf..e8f56fc9a 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/DOTStringBuilder.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/DOTStringBuilder.java
@@ -268,6 +268,11 @@ public class DOTStringBuilder implements GraphStringBuilder
}
@Override
+ public void setFillColor(@NonNull String value) {
+ attributes.put("fillcolor", value);
+ }
+
+ @Override
public void setHead() {
attributes.put("head", "true");
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphMLStringBuilder.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphMLStringBuilder.java
index 50bdb6364..600042cf3 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphMLStringBuilder.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphMLStringBuilder.java
@@ -24,9 +24,18 @@ public class GraphMLStringBuilder extends GraphMLBuilder implements GraphStringB
colorName2colorCode.put("brown", "#993300");
colorName2colorCode.put("blue", "#0000ff");
colorName2colorCode.put("cyan", "#00ffff");
+ colorName2colorCode.put("darkorange", "#ffcc00");
+ colorName2colorCode.put("gray", "#cccccc");
colorName2colorCode.put("green", "#00ff00");
+ colorName2colorCode.put("green3", "#00ff00");
+ colorName2colorCode.put("lightblue1", "#ccccff");
+ colorName2colorCode.put("lightcyan1", "#ccffff");
+ colorName2colorCode.put("lightgray", "#dddddd");
colorName2colorCode.put("magenta", "#ff00ff");
colorName2colorCode.put("orange", "#ffcc00");
+ colorName2colorCode.put("palegreen1", "#ccffcc");
+ colorName2colorCode.put("palegoldenrod", "#ffeecc");
+ colorName2colorCode.put("pink1", "#ffcccc");
colorName2colorCode.put("red", "#ff0000");
colorName2colorCode.put("white", "#ffffff");
colorName2colorCode.put("yellow", "#ffff00");
@@ -35,6 +44,7 @@ public class GraphMLStringBuilder extends GraphMLBuilder implements GraphStringB
private final @NonNull Map<Object,String> node2name = new HashMap<Object,String>();
private int graphCount = 0;
private @NonNull String color = "#cccccc";
+ private @NonNull String fillColor = "#ffffff";
private @Nullable String label = null;
private @NonNull String penwidth = "2.0";
private @NonNull String shape = "rectangle";
@@ -75,7 +85,7 @@ public class GraphMLStringBuilder extends GraphMLBuilder implements GraphStringB
public void appendAttributedNode(@NonNull String nodeName) {
String id = nodeName;
String shapeName = shape;
- String fillColor = "#ffffff";
+ // String fillColor = fillColor;
String lineColor = color;
// LineType lineType = LineType.line;
Double width = Double.valueOf(penwidth);
@@ -148,6 +158,7 @@ public class GraphMLStringBuilder extends GraphMLBuilder implements GraphStringB
protected void resetAttributes() {
color = "#000000";
+ fillColor = "#ffffff";
label = null;
lineType = LineType.line;
penwidth = "2.0";
@@ -191,6 +202,12 @@ public class GraphMLStringBuilder extends GraphMLBuilder implements GraphStringB
}
@Override
+ public void setFillColor(@NonNull String colorName) {
+ String colorCode = colorName2colorCode.get(colorName);
+ fillColor = colorCode != null ? colorCode : "#777777";
+ }
+
+ @Override
public void setHead() {
// TODO Auto-generated method stub
}
diff --git a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphStringBuilder.java b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphStringBuilder.java
index 7dab327fc..87694ba67 100644
--- a/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphStringBuilder.java
+++ b/plugins/org.eclipse.qvtd.pivot.qvtbase/src/org/eclipse/qvtd/pivot/qvtbase/graphs/GraphStringBuilder.java
@@ -39,6 +39,7 @@ public interface GraphStringBuilder
void setArrowtail(@NonNull String arrowtail);
void setColor(@NonNull String color);
void setDir(@NonNull String color);
+ void setFillColor(@NonNull String color);
void setHead();
void setHeadlabel(/*@NonNull*/ String string);
void setLabel(/*@NonNull*/ String string);

Back to the top