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


Java Node类代码示例

本文整理汇总了Java中y.base.Node的典型用法代码示例。如果您正苦于以下问题:Java Node类的具体用法?Java Node怎么用?Java Node使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Node类属于y.base包,在下文中一共展示了Node类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupNewNode

import y.base.Node; //导入依赖的package包/类
/**
 * Inserts a new node into the graph for a given raw node.
 *
 * @param rawNode The raw node that provides the data.
 */
private void setupNewNode(final INaviViewNode rawNode) {
  final Pair<Node, NaviNode> result =
      ZyGraphNodeBuilder.convertNode(rawNode, m_graph.getGraph(), m_graph.getSettings());

  m_mappings.addNode(result.first(), result.second());

  // rawNode.addListener(m_nodeListener);

  if (rawNode instanceof INaviGroupNode) {
    ((INaviGroupNode) rawNode).addGroupListener(m_groupNodeListener);
  }

  for (final INaviGraphListener listener : m_listeners) {
    try {
      listener.addedNode(m_graph, result.second());
    } catch (final Exception exception) {
      CUtilityFunctions.logException(exception);
    }
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:26,代码来源:CViewGraphSynchronizer.java

示例2: ZyGraphMappings

import y.base.Node; //导入依赖的package包/类
public ZyGraphMappings(final Graph2D graph, final Map<Node, NodeType> nodeMap,
    final Map<Edge, EdgeType> edgeMap) {
  m_graph = graph;

  // Create a clone so that we have our own map that's not exposed to the outside.
  m_nodeMap = Maps.newHashMap(nodeMap);
  m_rawNodeMap = Maps.newHashMap();

  // Create a clone so that we have our own map that's not exposed to the outside.
  m_edgeMap = Maps.newHashMap(edgeMap);
  m_rawEdgeMap = Maps.newHashMap();

  for (final EdgeType e : edgeMap.values()) {
    m_rawEdgeMap.put(e.getRawEdge(), e);
  }

  for (final NodeType n : nodeMap.values()) {
    m_rawNodeMap.put(n.getRawNode(), n);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:21,代码来源:ZyGraphMappings.java

示例3: addMember

import y.base.Node; //导入依赖的package包/类
/**
 * Adds a member to the dependence graph and returns the set of base types that are affected by
 * the changed compound type. This method assumes that all base type nodes that correspond to the
 * member base type already exist.
 *
 * @return The set of base types that are affected by the new member.
 */
public DependenceResult addMember(final BaseType parentType, final BaseType memberType) {
  Preconditions.checkNotNull(parentType, "IE02762: Parent type can not be null.");
  Preconditions.checkNotNull(memberType, "IE02763: Member type can not be null.");
  final Node memberTypeNode = Preconditions.checkNotNull(containedRelationMap.get(memberType),
      "Type node for member type must exist prior to adding a member.");
  final Node parentNode = Preconditions.checkNotNull(containedRelationMap.get(parentType),
      "Type node for member parent must exist prior to adding a member");

  if (willCreateCycle(parentType, memberType)) {
    return new DependenceResult(false, ImmutableSet.<BaseType>of());
  }
  containedRelation.createEdge(memberTypeNode, parentNode);
  final TypeSearch search = new TypeSearch(containedRelationMap.inverse());
  search.start(containedRelation, containedRelationMap.get(parentType));
  return new DependenceResult(true, search.getDependentTypes());
}
 
开发者ID:google,项目名称:binnavi,代码行数:24,代码来源:TypeDependenceGraph.java

示例4: createInstructionEdge

import y.base.Node; //导入依赖的package包/类
/**
 * Creates an instruction graph edge between the source node and the destination node and returns
 * the resulting yfiles edge.
 * 
 * @param sourceNode The source node of the edge to be created.
 * @param destinationNode The destination node of the edge to be created.
 * @param isTrueEdge Boolean parameter to determine if the edge is a conditional true edge.
 * 
 * @return The yfiles edge which has been created and inserted in the graph.
 */
private Edge createInstructionEdge(final Node sourceNode, final Node destinationNode,
    final boolean isTrueEdge) {
  final ReilInstruction reilInstruction = m_nodesMap.get(destinationNode).getReilInstruction();

  boolean isExitEdge = false;

  if (reilInstruction != null) {
    final IAddress reilInstructionAddress = reilInstruction.getAddress();

    if ((reilInstructionAddress.toLong() & 0xFF) == 0) {
      isExitEdge = true;
    }
  }

  final Edge edge = m_internalGraph.createEdge(sourceNode, destinationNode);
  m_edgesMap.put(edge, new ReilInstructionGraphEdge(isTrueEdge, isExitEdge));
  return edge;
}
 
开发者ID:google,项目名称:binnavi,代码行数:29,代码来源:CReilInstructionGraph.java

示例5: changedVisibility

import y.base.Node; //导入依赖的package包/类
@Override
public void changedVisibility(final IViewEdge<?> edge, final boolean visible) {
  if (visible) {
    final Node source = m_sourceNode.getNode();
    final Node target = m_targetNode.getNode();

    // Make sure "all endpoints lie in a graph"
    if ((source.getGraph() == null) || (target.getGraph() == null)) {
      return;
    }

    // Note: "m_graph.reInsertEdge(m_edge)" won't work here, as
    // edges can lose target nodes when group nodes are
    // collapsed
    final HierarchyManager hm = m_graph.getHierarchyManager();
    final Edge yedge = hm.createEdge(source, target);

    m_graph.setRealizer(yedge, m_realizer);

    m_edge = yedge;
  } else if (m_edge.getGraph() == m_graph) {
    m_graph.removeEdge(m_edge);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:ZyGraphEdge.java

示例6: getAdjacentSwimlane

import y.base.Node; //导入依赖的package包/类
/**
 * @param n
 * @return
 */
private static Object getAdjacentSwimlane(Node n, Graph2D abstractGraph) {
  // Get the vertical layers (y-coordinate) in which nodes are arranged
  NodeMap swimlaneMap =
      (NodeMap) abstractGraph.getDataProvider(IncrementalHierarchicLayouter.SWIMLANE_DESCRIPTOR_DPKEY);

  // This node needs to get a layer info => Inspect adjacent nodes
  EdgeCursor ec = n.edges();
  Object adjacentSwimlandID = null;
  Object adjacentSwimlandID2ndPrio = null;
  while (ec.ok()) {
    Edge e = (Edge) ec.current();
    Node connectedNode = e.opposite(n);
    EdgeRealizer r = abstractGraph.getRealizer(e);
    if (r instanceof DomainEdgeRealizer) {
      adjacentSwimlandID = swimlaneMap.get(connectedNode);

    } else if (!(r instanceof CysBridgeEdgeRealizer)) { // Don't consider Cystein Brdidges!
      // Most likely GeneralConnectionEdgeRealizer
      adjacentSwimlandID2ndPrio = swimlaneMap.get(connectedNode);
    }
    ec.next();
  }

  return adjacentSwimlandID != null ? adjacentSwimlandID : adjacentSwimlandID2ndPrio;
}
 
开发者ID:PistoiaHELM,项目名称:HELMAntibodyEditor,代码行数:30,代码来源:AbstractGraphLayoutService.java

示例7: bringNodeToFront

import y.base.Node; //导入依赖的package包/类
public void bringNodeToFront(final Node node) {
  final Graph2D g = (Graph2D) node.getGraph();
  final NodeRealizer r = g.getRealizer(node);

  if (r.isSelected()) {
    // This does not work properly! Why? NH
    for (final NodeCursor nc = g.selectedNodes(); nc.ok(); nc.next()) {
      m_nodesInDrawingOrder.remove(nc.node());
      m_nodesInDrawingOrder.add(nc.node());
    }
  } else {
    // This seems to work correctly.
    m_nodesInDrawingOrder.remove(node);
    m_nodesInDrawingOrder.add(node);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:17,代码来源:ZyGraphDefaultRenderer.java

示例8: ZyGraphNode

import y.base.Node; //导入依赖的package包/类
/**
 * Creates a new mapping between raw node and yfiles node.
 *
 * @param node The yfiles node.
 * @param rawNode The raw node.
 */
public ZyGraphNode(final Node node, final IZyNodeRealizer realizer, final RawNodeType rawNode) {
  m_node = Preconditions.checkNotNull(node, "Node argument cannot be null");
  m_realizer = Preconditions.checkNotNull(realizer, "Node realizer argument cannot be null");
  m_rawNode = Preconditions.checkNotNull(rawNode, "Raw node argument cannot be null");

  m_realizer.setX(m_rawNode.getX());
  m_realizer.setY(m_rawNode.getY());
  m_realizer.setFillColor(m_rawNode.getColor());
  m_realizer.setLineColor(m_rawNode.getBorderColor());
  m_realizer.setSelected(m_rawNode.isSelected());

  getGraph().setRealizer(m_node, realizer.getRealizer());

  m_listener = new InternalListener(getGraph());
  realizer.addListener(m_listener);
  rawNode.addListener(m_listener);
}
 
开发者ID:google,项目名称:binnavi,代码行数:24,代码来源:ZyGraphNode.java

示例9: addSequence

import y.base.Node; //导入依赖的package包/类
/**
 * @param graph
 * @param sequence could be a {@link ChemElement} or a @link {@link Domain}
 */
public static Node addSequence(Graph2D graph, Sequence sequence) {
  AntibodyEditorPane abePane = AntibodyEditorAccess.getInstance().getAntibodyEditorPane();
  if (abePane != null) {
    abePane.updatePane(null);
  }

  Node newNode = null;
  if (sequence instanceof ChemElement) {
    newNode = addChemElement(graph, (ChemElement) sequence);
  } else if (sequence instanceof Domain) {
    newNode = addDomain(graph, (Domain) sequence);
  } else if (sequence instanceof RNA) {
    newNode = addRNAElement(graph, (RNA) sequence);
  } else {
    LOG.warn("Cannot add unknown sequence type.");
  }

  // graph.updateViews(); // Connections are eventually missing. This will mis-arrange the graph here.
  return newNode;
}
 
开发者ID:PistoiaHELM,项目名称:HELMAntibodyEditor,代码行数:25,代码来源:AbstractGraphService.java

示例10: deleteProximityBrowsingNodes

import y.base.Node; //导入依赖的package包/类
/**
 * Removes all proximity browsing nodes from the graph.
 */
protected void deleteProximityBrowsingNodes() {
  // each node deletion triggers the selection state listener
  // which updates proximity browsing automatically
  // this is suppressed here by setting m_isActive temporarily to false
  m_internallyDisabled = true;

  for (final Node node : m_proximityMap.keySet()) {
    m_graph.getGraph().removeNode(node);
  }

  m_proximityMap.clear();

  for (final Entry<ZyProximityNode<?>, InternalNodeListener> entry : m_nodeListeners.entrySet()) {
    ((IViewNode<?>) entry.getKey().getRawNode().getAttachedNode()).removeListener(entry
        .getValue());
  }

  m_nodeListeners.clear();

  m_internallyDisabled = false;
}
 
开发者ID:google,项目名称:binnavi,代码行数:25,代码来源:ZyDefaultProximityBrowser.java

示例11: isAnyParentNodeSelected

import y.base.Node; //导入依赖的package包/类
/**
 * Determines whether any of the parent nodes of the given node is selected.
 */
private boolean isAnyParentNodeSelected(final Node n) {
  final Graph2D graph = (Graph2D) n.getGraph();
  final HierarchyManager hierarchy = graph.getHierarchyManager();

  if (hierarchy == null) {
    return false;
  }

  boolean result = false;
  Node parent = hierarchy.getParentNode(n);
  while (parent != null) {
    if (graph.isSelected(parent)) {
      result = true;
      break;
    }
    parent = hierarchy.getParentNode(parent);
  }
  return result;
}
 
开发者ID:google,项目名称:binnavi,代码行数:23,代码来源:ZyGraphLayeredRenderer.java

示例12: testAddedDebugger

import y.base.Node; //导入依赖的package包/类
/**
 * This test is making sure that listeners are correctly attached to new debuggers.
 *
 * @throws CouldntSaveDataException
 * @throws FileReadException
 */
@Test
public void testAddedDebugger() throws CouldntSaveDataException, FileReadException {
  ConfigManager.instance().read();

  final INaviModule mockModule = new MockModule();
  final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
  final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
  final ZyGraphViewSettings settings = new ZyGraphViewSettings(new FlowGraphSettingsConfigItem());
  settings.getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
  final ZyGraph graph =
      new ZyGraph(new MockView(), new LinkedHashMap<Node, NaviNode>(),
          new LinkedHashMap<Edge, NaviEdge>(), settings, new ZyGraph2DView());
  final IViewContainer viewContainer = new MockViewContainer();

  final CBreakpointTable table = new CBreakpointTable(debuggerProvider, graph, viewContainer);

  final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
  final MockModule module = new MockModule();
  debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR,
      Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0)))));
  debuggerProvider.addDebugger(debugger);

  table.dispose();
}
 
开发者ID:google,项目名称:binnavi,代码行数:31,代码来源:CBreakpointTableTest.java

示例13: select

import y.base.Node; //导入依赖的package包/类
public static void select(final AbstractZyGraph<?, ?> graph, final Node node,
    final MouseEvent event) {
  final double mouseX = graph.getEditMode().translateX(event.getX());
  final double mouseY = graph.getEditMode().translateY(event.getY());

  final IZyNodeRealizer realizer = (IZyNodeRealizer) graph.getGraph().getRealizer(node);
  final ZyLabelContent labelContent = realizer.getNodeContent();

  final CDefaultLabelEventHandler labelEventHandler = graph.getEditMode().getLabelEventHandler();

  if (labelContent.isSelectable()) {
    final double zoom = graph.getView().getZoom();

    final double nodeX = realizer.getRealizer().getX();
    final double nodeY = realizer.getRealizer().getY();

    labelEventHandler.handleMouseDraggedEvent(nodeX, nodeY, mouseX, mouseY, zoom);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:20,代码来源:CEditNodeHelper.java

示例14: setCaretEnd

import y.base.Node; //导入依赖的package包/类
public static void setCaretEnd(final AbstractZyGraph<?, ?> graph, final Node node,
    final MouseEvent event) {
  final double mouseX = graph.getEditMode().translateX(event.getX());
  final double mouseY = graph.getEditMode().translateY(event.getY());

  final IZyNodeRealizer realizer = (IZyNodeRealizer) graph.getGraph().getRealizer(node);
  final ZyLabelContent labelContent = realizer.getNodeContent();

  final CDefaultLabelEventHandler labelEventHandler = graph.getEditMode().getLabelEventHandler();

  if (labelContent.isSelectable()) {
    final double zoom = graph.getView().getZoom();

    final double nodeX = realizer.getRealizer().getX();
    final double nodeY = realizer.getRealizer().getY();

    labelEventHandler.handleMouseReleasedEvent(nodeX, nodeY, mouseX, mouseY, zoom,
        event.getClickCount());
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:21,代码来源:CEditNodeHelper.java

示例15: setCaretStart

import y.base.Node; //导入依赖的package包/类
public static void setCaretStart(final AbstractZyGraph<?, ?> graph, final Node node,
    final MouseEvent event) {
  final double mouseX = graph.getEditMode().translateX(event.getX());
  final double mouseY = graph.getEditMode().translateY(event.getY());

  final IZyNodeRealizer realizer = (IZyNodeRealizer) graph.getGraph().getRealizer(node);
  final ZyLabelContent labelContent = realizer.getNodeContent();

  final CDefaultLabelEventHandler labelEventHandler = graph.getEditMode().getLabelEventHandler();

  graph.getEditMode().getLabelEventHandler()
      .activateLabelContent(labelContent, new ZyRegenerateableNodeRealizer(realizer));

  if (labelContent.isSelectable()) {
    final double zoom = graph.getView().getZoom();

    final double nodeX = realizer.getRealizer().getX();
    final double nodeY = realizer.getRealizer().getY();

    labelEventHandler.handleMousePressedEvent(nodeX, nodeY, mouseX, mouseY, zoom);
  }
}
 
开发者ID:google,项目名称:binnavi,代码行数:23,代码来源:CEditNodeHelper.java


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