当前位置: 首页>>代码示例>>Java>>正文


Java GraphEdge.set方法代码示例

本文整理汇总了Java中edu.mit.csail.sdg.alloy4graph.GraphEdge.set方法的典型用法代码示例。如果您正苦于以下问题:Java GraphEdge.set方法的具体用法?Java GraphEdge.set怎么用?Java GraphEdge.set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.mit.csail.sdg.alloy4graph.GraphEdge的用法示例。


在下文中一共展示了GraphEdge.set方法的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;
}
 
开发者ID:AlloyTools,项目名称:org.alloytools.alloy,代码行数:55,代码来源:StaticGraphMaker.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:43,代码来源:StaticGraphMaker.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:59,代码来源:GraphMaker.java

示例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;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:46,代码来源:StaticGraphMaker.java


注:本文中的edu.mit.csail.sdg.alloy4graph.GraphEdge.set方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。