Package net.sf.joafip.meminspector.entity

Examples of net.sf.joafip.meminspector.entity.NodeForObject


  @Override
  public Component getTableCellRendererComponent(final JTable table,
      final Object value, final boolean isSelected,
      final boolean hasFocus, final int row, final int column) {
    final NodeInfo nodeInfo = (NodeInfo) value;
    final NodeForObject nodeForObject = nodeInfo.getNodeForObject();
    setText(nodeForObject.identificationString());
    setForeground(nodeInfo.isMainFather() ? Color.RED : Color.BLACK);
    return this;
  }
View Full Code Here


  @Override
  public Component getTableCellRendererComponent(final JTable table,
      final Object value, final boolean isSelected,
      final boolean hasFocus, final int row, final int column) {
    final NodeForObject nodeForObject = (NodeForObject) value;
    setText(nodeForObject.identificationString());
    return this;
  }
View Full Code Here

        if (!event.getValueIsAdjusting()) {
          final ListSelectionModel lsm = (ListSelectionModel) event
              .getSource();
          if (!lsm.isSelectionEmpty()) {
            final int selectedRow = lsm.getMinSelectionIndex();
            final NodeForObject selectedNodeForObject = (NodeForObject) dataModel
                .getValueAt(selectedRow, 0);
            try {
              newNodeSelectedListener
                  .newNodeSelected(selectedNodeForObject);
            } catch (MemInspectorException exception) {
View Full Code Here

  private INodeForObject node;

  public void nodeSelected(final INodeForObject node) {
    this.node = node;
    final NodeForObject mainFatherNode=node.getMainFatherNode();
    final Set<NodeForObject> fatherNodeSet=node.getFatherNodeSet();
    nodeInfoList = new ArrayList<NodeInfo>(fatherNodeSet.size());
    final Set<NodeForObject> sorteFatherNodeSet=new TreeSet<NodeForObject>(new ByIdComparator());
    sorteFatherNodeSet.addAll(fatherNodeSet);
    for (NodeForObject nodeForObject : sorteFatherNodeSet) {
View Full Code Here

    final NodeForObjectModel nodeForObjectModel=new NodeForObjectModel();
    nodeForObjectModel.setNumberOfNode(map.size());
   
    // create NodeForObject for each NodeInfo
    for (NodeInfo nodeInfo : map.values()) {
      NodeForObject nodeForObject = nodeInfo.nodeForObject;
      if (nodeForObject == null) {
        final NodeForObjectTO nodeForObjectTO = nodeInfo.nodeForObjectTO;
        final NodeIdentifier identifier = nodeForObjectTO.getId();
        nodeForObject = new NodeForObject(null, identifier,
            nodeForObjectTO.getIdentityHashCode(),
            nodeForObjectTO.getObjectClassName(),
            nodeForObjectTO.isMarkedNew(),
            nodeForObjectTO.isMarkedNewSon(),
            nodeForObjectTO.getFieldByChildNodeIdMap(),
            nodeForObjectTO.getFieldIsStaticMap(),
            nodeForObjectTO.getObjectSize());
        nodeInfo.nodeForObject = nodeForObject;
        nodeForObjectModel.add(nodeForObject);
      } else {
        throw new MemInspectorException("node object must not be set");
      }
    }

    // create father link
    for (NodeInfo nodeInfo : map.values()) {

      NodeForObject nodeForObject = nodeInfo.nodeForObject;
      if (nodeForObject == null) {
        throw new MemInspectorException("node object must be set");
      }
      final NodeForObjectTO nodeForObjectTO = nodeInfo.nodeForObjectTO;
      final NodeIdentifier mainFatherId = nodeForObjectTO
          .getMainFatherNodeId();
      final NodeForObject mainFatherNode;
      if (mainFatherId == null) {
        mainFatherNode = null;
      } else {
        final NodeInfo fatherNodeInfo = map.get(mainFatherId);
        if (fatherNodeInfo == null) {
          throw new MemInspectorException("node of id #"
              + mainFatherId + " must exist");
        }
        mainFatherNode = fatherNodeInfo.nodeForObject;
      }
      nodeForObject.setMainFatherNode(mainFatherNode);

      for (NodeIdentifier fatherId : nodeInfo.fatherIdSet) {
        final NodeInfo fatherNodeInfo = map.get(fatherId);
        if (fatherNodeInfo == null) {
          // throw new MemInspectorException(
          // "missing node info for node #" + fatherId);
          LOGGER.warn("missing node info for node #" + fatherId
              + " father of " + nodeInfo.nodeForObject);
        } else {
          final NodeForObject fatherNode = map.get(fatherId).nodeForObject;
          if (fatherNode == null) {
            throw new MemInspectorException("missing node #"
                + fatherId + ", fatherNodeInfo="
                + fatherNodeInfo + ", node="
                + nodeInfo.nodeForObject);
          }
          nodeForObject.addFather(fatherNode);
        }
      }
    }

    // create child link
    for (NodeInfo nodeInfo : map.values()) {
      NodeForObject nodeForObject = nodeInfo.nodeForObject;
      for (NodeIdentifier childId : nodeInfo.childIdSet) {
        final NodeInfo childNodeInfo = map.get(childId);
        if (childNodeInfo == null) {
          throw new MemInspectorException(
              "missing node info for node #" + childId);
        }
        final NodeForObject childNode = map.get(childId).nodeForObject;
        if (childNode == null) {
          throw new MemInspectorException("missing node #" + childId
              + ", childNodeInfo=" + childNodeInfo + ", node="
              + nodeInfo.nodeForObject);
        }
        nodeForObject.addChild(childNode);
      }
    }

    final NodeForObject rootNode = map.get(rootNodeId).nodeForObject;
    nodeForObjectModel.setRootNode(rootNode);

    //nodeForObjectModel.x();
   
    // was for debug: check father path
View Full Code Here

  @SuppressWarnings("unused")
  private void checkFatherPathToRoot(final Map<NodeIdentifier, NodeInfo> map)
      throws MemInspectorException {
    for (NodeInfo nodeInfo : map.values()) {
      final NodeForObject nodeForObject = nodeInfo.nodeForObject;
      final Deque<NodeForObject> path=new LinkedList<NodeForObject>();
      NodeForObject current = nodeForObject.getMainFatherNode();
      while(current!=null) {
        if( path.contains(current)) {
          final StringBuilder stringBuilder=new StringBuilder();
          stringBuilder.append("-> ");
          stringBuilder.append(current.toString());
          stringBuilder.append('\n');
          for(NodeForObject inPathElt:path) {
            stringBuilder.append(inPathElt.toString());
            stringBuilder.append('\n');
          }
          final NodeForObject first = path.peekFirst();
          final Set<NodeForObject> fatherNodeSet = first.getFatherNodeSet();
          stringBuilder.append("first fathers:\n");
          for(NodeForObject inSetElt:fatherNodeSet) {
            stringBuilder.append(inSetElt.toString());
            stringBuilder.append('\n');
          }
View Full Code Here

    final Set<NodeIdentifier> childNodeIdSet = new TreeSet<NodeIdentifier>();
    for (NodeIdentifier childId : nodeForObject.getFieldByChildNodeIdMap()
        .keySet()) {
      childNodeIdSet.add(childId);
    }
    final NodeForObject mainFatherNode = nodeForObject.getMainFatherNode();
    final NodeIdentifier mainFatherNodeid;
    if (mainFatherNode == null) {
      mainFatherNodeid = new NodeIdentifier(-1);
    } else {
      mainFatherNodeid = mainFatherNode.getId();
    }
    return new NodeForObjectTO(nodeForObject.getId(),
        nodeForObject.getObjectClassName(),
        nodeForObject.getIdentityHashCode(), mainFatherNodeid,
        fatherNodeIdSet, childNodeIdSet,
View Full Code Here

    instanceVisitor.visit(rootObject, listener, new IncludedExcluded());
    return listener.getSize();
  }

  public boolean added() {
    final NodeForObject rootNode = currentMemoryImage.getRootNode();
    return rootNode.isMarkedNewSon() || rootNode.isMarkedNew();
  }
View Full Code Here

      if (rootNode != null) {
        throw new MemInspectorException("root node already defined");
      }
      final WeakObjectIdentityKey weakObject = new WeakObjectIdentityKey(
          fatherObject);
      rootNode = new NodeForObject(null, weakObject);
      memorizeNewObject(weakObject, rootNode);
      rootNode.setIsRootNode();
    } else if (rootNode == null) {
      throw new MemInspectorException(
          "root must be defined. referencing is "
View Full Code Here

  public void addChild(final Object fatherObject,
      final List<ReferencingReferencedCouple> childList)
      throws MemInspectorException {
    final ObjectIdentityKey fatherIdentity = new ObjectIdentityKey(
        fatherObject);
    final NodeForObject fatherNode = nodeForObjectByWeakMap
        .get(fatherIdentity);
    if (fatherNode == null) {
      throw new MemInspectorException("father node must exist");
    }
    for (ReferencingReferencedCouple couple : childList) {
View Full Code Here

TOP

Related Classes of net.sf.joafip.meminspector.entity.NodeForObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.