Esempio n. 1
1
  public boolean equals(Object object) {
    if (Util.THIS.isLoggable()) /* then */ Util.THIS.debug("-=#| TreeNodeFilter.equals");

    if ((object instanceof TreeNodeFilter) == false) {
      return false;
    }

    TreeNodeFilter peer = (TreeNodeFilter) object;

    Set thisSet = new HashSet(Arrays.asList(this.nodeTypes));
    Set peerSet = new HashSet(Arrays.asList(peer.nodeTypes));

    if (Util.THIS.isLoggable()) /* then */ Util.THIS.debug("-=#|    thisSet = " + thisSet);
    if (Util.THIS.isLoggable()) /* then */ Util.THIS.debug("-=#|    peerSet = " + peerSet);
    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("-=#|    acceptPolicy? " + (this.acceptPolicy == peer.acceptPolicy));
    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("-=#|    nodeTypes   ? " + (thisSet.equals(peerSet)));

    if (this.acceptPolicy != peer.acceptPolicy) {
      return false;
    }

    return thisSet.equals(peerSet);
  }
Esempio n. 2
0
  public short acceptNode(TreeNode node) {
    short isInstanceReturn;
    short isNotInstanceReturn;

    if (acceptPolicy == ACCEPT_TYPES) {
      isInstanceReturn = FILTER_ACCEPT;
      isNotInstanceReturn = FILTER_REJECT;
    } else {
      isInstanceReturn = FILTER_REJECT;
      isNotInstanceReturn = FILTER_ACCEPT;
    }

    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("+ TreeNodeFilter::acceptNode: this = " + this); // NOI18N
    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("+               ::acceptNode: node = " + node); // NOI18N
    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("+               ::acceptNode: acceptPolicy = " + acceptPolicy); // NOI18N

    for (int i = 0; i < nodeTypes.length; i++) {
      if (nodeTypes[i].isInstance(node)) {

        if (Util.THIS.isLoggable()) /* then */
          Util.THIS.debug("+               ::acceptNode: RETURN " + isInstanceReturn); // NOI18N

        return isInstanceReturn;
      }
    }

    if (Util.THIS.isLoggable()) /* then */
      Util.THIS.debug("+               ::acceptNode: RETURN " + isNotInstanceReturn); // NOI18N

    return isNotInstanceReturn;
  }