Public Member Functions

cern.gp.nodes.children.BeanComparatorAdapter Class Reference

Inherits java::util::Comparator.

List of all members.

Public Member Functions

 BeanComparatorAdapter (Comparator beanComparator)
final int compare (Object o1, Object o2)
final boolean equals (Object obj)

Detailed Description

This class adapts a Comparator able to compare bean objects, to a Comparator able to compare nodes based on those bean objects.

The nodes will be sorted as the underlying bean objects are sorted by the bean comparator passed in the constructor of this object.

A typical use of the BeanComparatorAdapter will be inside a ChildrenManager. The method getComparator() must return a Comparator that compares nodes. But as a user you may prefer to compare at the bean level as each node represents a given bean. You can therefore write a Comparator that compares your beans and use the BeanComparatorAdapter to return a node Comparator based on your bean Comparator :

 public Comparator getComparator() {
   return new BeanComparatorAdapter(new MyBeanComparator());
 }
 

In this example, MyBeanComparator is a class that you write to compare the beans that are used to create the node. MyBeanComparator only knows how to compare two bean objects, instead of comparing two nodes based on those bean objects.

Version:
Revision:
1.2
Date:
2006/09/25 08:52:36
Author:
Lionel Mestre

Constructor & Destructor Documentation

cern.gp.nodes.children.BeanComparatorAdapter.BeanComparatorAdapter ( Comparator  beanComparator  ) 

Creates a new GPBeanNode based on the given bean with no children The new node is therefore a leaf.


Member Function Documentation

final int cern.gp.nodes.children.BeanComparatorAdapter.compare ( Object  o1,
Object  o2 
)
final boolean cern.gp.nodes.children.BeanComparatorAdapter.equals ( Object  obj  ) 

The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Enumerations Properties