public class IlvSDMObjectComparator extends Object implements Comparator<Object>, IlvPersistentObject, Serializable
IlvSDMObjectComparator
allows you to define one or more
ordering criteria for the nodes and links of a graph.
The ordering criteria can be the order of objects in the SDM model,
the values of data model attributes,
or be implemented as java.util.Comparator
objects.
This class is an implementation of the java.util.Comparator
interface.IlvBusLayout.setNodeComparator(java.util.Comparator)
,
IlvGridLayout.setNodeComparator(java.util.Comparator)
,
IlvGraphLayoutRenderer.setNodeOrderingComparator(java.util.Comparator<java.lang.Object>)
,
IlvGraphLayoutRenderer.setLinkOrderingComparator(java.util.Comparator<java.lang.Object>)
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
IlvSDMObjectComparator.ComparatorSortCriteria
ComparatorSortCriteria defines a sort criteria
by using an implementation of java.util.Comparator . |
static class |
IlvSDMObjectComparator.DataModelAttributeSortCriteria
DataModelAttributeSortCriteria defines a sort criteria
that allows you to specify the order using data model attributes
of the objects. |
static class |
IlvSDMObjectComparator.ModelOrderSortCriteria
ModelOrderSortCriteria defines a sort criteria
to order the objects as in the SDM model. |
static class |
IlvSDMObjectComparator.SortCriteria
SortCriteria is the base class
for specifying a sort criteria. |
Constructor and Description |
---|
IlvSDMObjectComparator()
Creates a new empty
IlvSDMObjectComparator instance. |
IlvSDMObjectComparator(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvSDMObjectComparator(IlvSDMObjectComparator.SortCriteria[] sortCriteria)
Creates a new
IlvSDMObjectComparator with a given
list of sort criteria. |
IlvSDMObjectComparator(String textualDescription)
Creates a new
IlvSDMObjectComparator from a given
text description. |
Modifier and Type | Method and Description |
---|---|
int |
compare(Object obj1,
Object obj2)
Compares two objects for order.
|
IlvSDMObjectComparator.SortCriteria[] |
getSortCriteria()
Returns the sort criteria.
|
String |
getTextualSortCriteria()
Returns the text description sort criteria.
|
void |
setSortCriteria(IlvSDMObjectComparator.SortCriteria[] sortCriteria)
Sets the sort criteria.
|
void |
setTextualSortCriteria(String textualSortCriteria)
Sets the sort criteria using a text description.
|
void |
write(IlvOutputStream stream)
Writes this comparator to the output stream.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
comparing, comparing, comparingDouble, comparingInt, comparingLong, equals, naturalOrder, nullsFirst, nullsLast, reversed, reverseOrder, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
public IlvSDMObjectComparator()
IlvSDMObjectComparator
instance.public IlvSDMObjectComparator(IlvSDMObjectComparator.SortCriteria[] sortCriteria)
IlvSDMObjectComparator
with a given
list of sort criteria.sortCriteria
- The sort criteria to be used by this
IlvSDMObjectComparator
instance.setSortCriteria(ilog.views.sdm.renderer.graphlayout.IlvSDMObjectComparator.SortCriteria[])
public IlvSDMObjectComparator(String textualDescription)
IlvSDMObjectComparator
from a given
text description.
The textualDescription
parameter
must use a format similar to the following example:
data,name,ascending;data,value,descending;comparator,DESCENDING_HEIGHT;
DESCENDING_HEIGHT
predefined comparator.
model,ascending
describes the
order of objects in the SDM model.textualDescription
- The description used to create a new
IlvSDMObjectComparator
instance.setTextualSortCriteria(java.lang.String)
,
IlvSDMObjectComparator.DataModelAttributeSortCriteria
,
IlvSDMObjectComparator.ComparatorSortCriteria
,
IlvSDMObjectComparator.ModelOrderSortCriteria
public IlvSDMObjectComparator(IlvInputStream stream)
IlvInputStream
.stream
- The IlvInputStream
to read from.public void setSortCriteria(IlvSDMObjectComparator.SortCriteria[] sortCriteria)
sortCriteria
list can
contain either:
String
s.java.util.Comparator
. For example, the
comparators defined by the Bus or Grid layout.getSortCriteria()
public IlvSDMObjectComparator.SortCriteria[] getSortCriteria()
setSortCriteria(ilog.views.sdm.renderer.graphlayout.IlvSDMObjectComparator.SortCriteria[])
public void setTextualSortCriteria(String textualSortCriteria)
textualSortCriteria
parameter
must use a format similar to the following example:
data,name,ascending;data,value,descending;comparator,DESCENDING_HEIGHT;
DESCENDING_HEIGHT
predefined comparator.
model,ascending
describes the
order of objects in the SDM model.getTextualSortCriteria()
public String getTextualSortCriteria()
setTextualSortCriteria(java.lang.String)
public int compare(Object obj1, Object obj2)
compare
in interface Comparator<Object>
obj1
- The first object to be compared.obj2
- The second object to be compared.ClassCastException
- if the type of the arguments prevents them from
being compared by this Comparator
.public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
stream
- The output stream to write to.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.