本文整理汇总了Java中edu.mit.csail.sdg.alloy4graph.GraphEdge类的典型用法代码示例。如果您正苦于以下问题:Java GraphEdge类的具体用法?Java GraphEdge怎么用?Java GraphEdge使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GraphEdge类属于edu.mit.csail.sdg.alloy4graph包,在下文中一共展示了GraphEdge类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createEdge
import edu.mit.csail.sdg.alloy4graph.GraphEdge; //导入依赖的package包/类
/**
* Create an edge for a given tuple from a relation (if neither start nor
* end node is explicitly invisible)
*/
private boolean createEdge(final boolean hidePrivate, final boolean hideMeta, AlloyRelation rel, AlloyTuple tuple,
boolean bidirectional, Color magicColor) {
// This edge represents a given tuple from a given relation.
//
// If the tuple's arity==2, then the label is simply the label of the
// relation.
//
// If the tuple's arity>2, then we append the node labels for all the
// intermediate nodes.
// eg. Say a given tuple is (A,B,C,D) from the relation R.
// An edge will be drawn from A to D, with the label "R [B, C]"
if ((hidePrivate && tuple.getStart().getType().isPrivate) || (hideMeta && tuple.getStart().getType().isMeta)
|| !view.nodeVisible(tuple.getStart(), instance))
return false;
if ((hidePrivate && tuple.getEnd().getType().isPrivate) || (hideMeta && tuple.getEnd().getType().isMeta)
|| !view.nodeVisible(tuple.getEnd(), instance))
return false;
GraphNode start = createNode(hidePrivate, hideMeta, tuple.getStart());
GraphNode end = createNode(hidePrivate, hideMeta, tuple.getEnd());
if (start == null || end == null)
return false;
boolean layoutBack = view.layoutBack.resolve(rel);
String label = view.label.get(rel);
if (tuple.getArity() > 2) {
StringBuilder moreLabel = new StringBuilder();
List<AlloyAtom> atoms = tuple.getAtoms();
for (int i = 1; i < atoms.size() - 1; i++) {
if (i > 1)
moreLabel.append(", ");
moreLabel.append(atomname(atoms.get(i), false));
}
if (label.length() == 0) { /* label=moreLabel.toString(); */ } else {
label = label + (" [" + moreLabel + "]");
}
}
DotDirection dir = bidirectional ? DotDirection.BOTH : (layoutBack ? DotDirection.BACK : DotDirection.FORWARD);
DotStyle style = view.edgeStyle.resolve(rel);
DotColor color = view.edgeColor.resolve(rel);
int weight = view.weight.get(rel);
GraphEdge e = new GraphEdge((layoutBack ? end : start), (layoutBack ? start : end), tuple, label, rel);
if (color == DotColor.MAGIC && magicColor != null)
e.set(magicColor);
else
e.set(color.getColor(view.getEdgePalette()));
e.set(style);
e.set(dir != DotDirection.FORWARD, dir != DotDirection.BACK);
e.set(weight < 1 ? 1 : (weight > 100 ? 10000 : 100 * weight));
edges.put(e, tuple);
return true;
}
示例2: createEdge
import edu.mit.csail.sdg.alloy4graph.GraphEdge; //导入依赖的package包/类
/** Create an edge for a given tuple from a relation (if neither start nor end node is explicitly invisible) */
private boolean createEdge(final boolean hidePrivate, final boolean hideMeta, AlloyRelation rel, AlloyTuple tuple, boolean bidirectional, Color magicColor) {
// This edge represents a given tuple from a given relation.
//
// If the tuple's arity==2, then the label is simply the label of the relation.
//
// If the tuple's arity>2, then we append the node labels for all the intermediate nodes.
// eg. Say a given tuple is (A,B,C,D) from the relation R.
// An edge will be drawn from A to D, with the label "R [B, C]"
if ((hidePrivate && tuple.getStart().getType().isPrivate)
||(hideMeta && tuple.getStart().getType().isMeta)
|| !view.nodeVisible(tuple.getStart(), instance)) return false;
if ((hidePrivate && tuple.getEnd().getType().isPrivate)
||(hideMeta && tuple.getEnd().getType().isMeta)
|| !view.nodeVisible(tuple.getEnd(), instance)) return false;
GraphNode start = createNode(hidePrivate, hideMeta, tuple.getStart());
GraphNode end = createNode(hidePrivate, hideMeta, tuple.getEnd());
if (start==null || end==null) return false;
boolean layoutBack = view.layoutBack.resolve(rel);
String label = view.label.get(rel);
if (tuple.getArity() > 2) {
StringBuilder moreLabel = new StringBuilder();
List<AlloyAtom> atoms=tuple.getAtoms();
for (int i=1; i<atoms.size()-1; i++) {
if (i>1) moreLabel.append(", ");
moreLabel.append(atomname(atoms.get(i),false));
}
if (label.length()==0) { /* label=moreLabel.toString(); */ }
else { label=label+(" ["+moreLabel+"]"); }
}
DotDirection dir = bidirectional ? DotDirection.BOTH : (layoutBack ? DotDirection.BACK : DotDirection.FORWARD);
DotStyle style = view.edgeStyle.resolve(rel);
DotColor color = view.edgeColor.resolve(rel);
int weight = view.weight.get(rel);
GraphEdge e = new GraphEdge((layoutBack ? end : start), (layoutBack ? start : end), tuple, label, rel);
if (color == DotColor.MAGIC && magicColor != null) e.set(magicColor); else e.set(color.getColor(view.getEdgePalette()));
e.set(style);
e.set(dir!=DotDirection.FORWARD, dir!=DotDirection.BACK);
e.set(weight<1 ? 1 : (weight>100 ? 10000 : 100*weight));
edges.put(e, tuple);
return true;
}
示例3: createEdge
import edu.mit.csail.sdg.alloy4graph.GraphEdge; //导入依赖的package包/类
/**
* Create an edge for a given tuple from a relation (if neither start nor end node is explicitly
* invisible)
*/
private boolean createEdge(Relation rel, Tuple tuple, Color magicColor) {
// This edge represents a given tuple from a given relation.
//
// If the tuple's arity==2, then the label is simply the label of the relation.
//
// If the tuple's arity>2, then we append the node labels for all the intermediate nodes.
// eg. Say a given tuple is (A,B,C,D) from the relation R.
// An edge will be drawn from A to D, with the label "R [B, C]"
if (/*
* (hidePrivate && tuple.getStart().getType().isPrivate) || (hideMeta &&
* tuple.getStart().getType().isMeta) ||
*/!view.nodeVisible(tuple.getAtom(0)))
return false;
if (/*
* (hidePrivate && tuple.getEnd().getType().isPrivate) || (hideMeta &&
* tuple.getEnd().getType().isMeta) ||
*/!view.nodeVisible(tuple.getAtom(tuple.getAtomCount() - 1)))
return false;
GraphNode start = createNode(tuple.getAtom(0));
GraphNode end = createNode(tuple.getAtom(tuple.getAtomCount() - 1));
if (start == null || end == null)
return false;
boolean layoutBack = view.layoutBack.resolve(rel);
String label = rel.getName();
if (tuple.getArity() > 2) {
StringBuilder moreLabel = new StringBuilder();
List<Atom> atoms = tuple.getAtoms();
for (int i = 1; i < atoms.size() - 1; i++) {
if (i > 1)
moreLabel.append(", ");
moreLabel.append(atomname(atoms.get(i)));
}
if (label.length() == 0) {
label = moreLabel.toString();
} else {
label = label + (" [" + moreLabel + "]");
}
}
DotDirection dir = /* bidirectional ? DotDirection.BOTH : */(layoutBack ? DotDirection.BACK
: DotDirection.FORWARD);
DotStyle style = view.edgeStyle.resolve(rel);
DotColor color = view.edgeColor.resolve(rel);
int weight = view.weight.get(rel);
GraphEdge e = new GraphEdge((start), (end), tuple, label, rel);
e.set(magicColor);
e.set(style);
e.set(dir != DotDirection.FORWARD, dir != DotDirection.BACK);
e.set(weight < 1 ? 1 : (weight > 100 ? 10000 : 100 * weight));
edges.put(e, tuple);
return true;
}
示例4: createEdge
import edu.mit.csail.sdg.alloy4graph.GraphEdge; //导入依赖的package包/类
/** Create an edge for a given tuple from a relation (if neither start nor end node is explicitly invisible) */
private boolean createEdge(final boolean hidePrivate, final boolean hideMeta, AlloyRelation rel, AlloyTuple tuple, boolean bidirectional, Color magicColor) {
// This edge represents a given tuple from a given relation.
//
// If the tuple's arity==2, then the label is simply the label of the relation.
//
// If the tuple's arity>2, then we append the node labels for all the intermediate nodes.
// eg. Say a given tuple is (A,B,C,D) from the relation R.
// An edge will be drawn from A to D, with the label "R [B, C]"
if ((hidePrivate && tuple.getStart().getType().isPrivate)
||(hideMeta && tuple.getStart().getType().isMeta)
|| !view.nodeVisible(tuple.getStart(), instance)) return false;
if ((hidePrivate && tuple.getEnd().getType().isPrivate)
||(hideMeta && tuple.getEnd().getType().isMeta)
|| !view.nodeVisible(tuple.getEnd(), instance)) return false;
GraphNode start = createNode(hidePrivate, hideMeta, tuple.getStart());
GraphNode end = createNode(hidePrivate, hideMeta, tuple.getEnd());
if (start==null || end==null) return false;
boolean layoutBack = view.layoutBack.resolve(rel);
String label = view.label.get(rel);
if (tuple.getArity() > 2) {
StringBuilder moreLabel = new StringBuilder();
List<AlloyAtom> atoms=tuple.getAtoms();
for (int i=1; i<atoms.size()-1; i++) {
if (i>1) moreLabel.append(", ");
moreLabel.append(atomname(atoms.get(i),false));
}
if (label.length()==0) { /* label=moreLabel.toString(); */ }
else { label=label+(" ["+moreLabel+"]"); }
}
DotDirection dir = bidirectional ? DotDirection.BOTH : (layoutBack ? DotDirection.BACK : DotDirection.FORWARD);
DotStyle style = view.edgeStyle.resolve(rel);
if (tuple.isDashed) {
style = DotStyle.DASHED;
}
DotColor color = view.edgeColor.resolve(rel);
int weight = view.weight.get(rel);
GraphEdge e = new GraphEdge((layoutBack ? end : start), (layoutBack ? start : end), tuple, label, rel);
if (color == DotColor.MAGIC && magicColor != null) e.set(magicColor); else e.set(color.getColor(view.getEdgePalette()));
e.set(style);
e.set(dir!=DotDirection.FORWARD, dir!=DotDirection.BACK);
e.set(weight<1 ? 1 : (weight>100 ? 10000 : 100*weight));
edges.put(e, tuple);
return true;
}