Overview | Package | Class | Tree | Deprecated | Index | Help
| Copyright © 2006 BEA Systems, Inc. All Rights Reserved
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.content.manager.sort
Class NodeComparator

    java.lang.Object
      com.bea.content.manager.sort.NodeComparator

All Implemented Interfaces
  Comparator

    public class NodeComparator

extends Object
implements Comparator

Compares Nodes in ascending order (case-insensitive) based on the Node name.

If SearchCriteria is set then the Nodes are compared based on the criteria against their properties. The criteria is iterated through, until a property is found that compares to less than or greater than and that result is returned. If a property compares to be equal, the next criteria will be used.

The NodeComparator can also be used for sorting standard properites as well as any explicit properties defined in the system. The following standard properties are supported for sorting :

cm_uid, cm_parent_uid, cm_createdDate, cm_createdBy, cm_modifiedDate, cm_path and cm_objectClass

Field Summary
`protected SortCriteria[]` | `sortCriteria` The sort criteria used when sorting nodes.

Constructor Summary
`NodeComparator()`
`NodeComparator(SortCriteria[] sortCriteria)`

Method Summary
`int` | `compare(Object obj1, Object obj2)` Compares its two arguments for order.
`int` | `compareNodeName(Object obj1, Object obj2)` Compares its two arguments for order.
`int` | `compareProperties(Object obj1, Object obj2)` Compares properties.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this Comparator.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### sortCriteria

    protected SortCriteria[] sortCriteria

  The sort criteria used when sorting nodes.

Constructor Detail

### NodeComparator

    public NodeComparator()

### NodeComparator

    public NodeComparator(SortCriteria[] sortCriteria)

Method Detail

### compare

    public int compare(Object obj1,
                       Object obj2)

  Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

  Specified by:
    `compare` in interface `Comparator`

### compareNodeName

    public int compareNodeName(Object obj1,
                               Object obj2)

  Compares its two arguments for order. Returns a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.

  In this case the arguments are nodes, and we're comparing node names.

### compareProperties

    public int compareProperties(Object obj1,
                                 Object obj2)

  Compares properties. Assumes sortCritiera is not null.

  Parameters
    `obj1` -
    `obj2` -
  Returns
    0 if the items are equal.

### equals

    public boolean equals(Object obj)

  Indicates whether some other object is "equal to" this Comparator. This method must obey the general contract of `Object.equals(Object)`. Additionally, this method can return `true` only if the specified Object is also a comparator and it imposes the same ordering as this comparator. Thus, `comp1.equals(comp2)` implies that `sgn(comp1.compare(o1, o2))==sgn(comp2.compare(o1, o2))` for every object reference `o1` and `o2`.

  Specified by:
    `equals` in interface `Comparator`
  Overrides:
    `equals` in class `Object`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2006 BEA Systems, Inc. All Rights Reserved