Top Description Inners Fields Constructors Methods
de.undercouch.citeproc.csl.internal

public Class SSort

extends Object
Class Inheritance
Imports
de.undercouch.citeproc.AbbreviationProvider, de.undercouch.citeproc.csl.CSLItemData, de.undercouch.citeproc.csl.internal.locale.LLocale, de.undercouch.citeproc.helper.AlphanumComparator, org.w3c.dom.Node, .NodeList, java.util.ArrayList, .Comparator, .List

A sort element inside a bibliography or citation element
Author
Michel Kraemer

Nested and Inner Type Summary

Modifier and TypeClass and Description
public class

Field Summary

Modifier and TypeField and Description
private final List<SKey>

Constructor Summary

AccessConstructor and Description
public
SSort(Node
the XML node
node
)

Creates the sort element from an XML node

Method Summary

Modifier and TypeMethod and Description
public SSort.SortComparator

Returns:

the comparator
comparator
(SStyle
the current citation style
style
,
LLocale
the current locale
locale
,
AbbreviationProvider
the current abbreviation provider
abbreviationProvider
)

Creates a comparator that is able to compare CSLItemData objects according

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

keysback to summary
private final List<SKey> keys

Constructor Detail

SSortback to summary
public SSort(Node node)

Creates the sort element from an XML node

Parameters
node:Node

the XML node

Method Detail

comparatorback to summary
public SSort.SortComparator comparator(SStyle style, LLocale locale, AbbreviationProvider abbreviationProvider)

Creates a comparator that is able to compare CSLItemData objects according

Parameters
style:SStyle

the current citation style

locale:LLocale

the current locale

abbreviationProvider:AbbreviationProvider

the current abbreviation provider

Returns:SSort.SortComparator

the comparator

de.undercouch.citeproc.csl.internal back to summary

public Class SSort.SortComparator

extends Object
implements Comparator<CSLItemData>
Class Inheritance
All Implemented Interfaces
java.util.Comparator

A sort comparator returned by comparator(SStyle, LLocale, AbbreviationProvider)

Field Summary

Modifier and TypeField and Description
private final AbbreviationProvider
private int
private final AlphanumComparator
private final LLocale
private final SStyle

Constructor Summary

AccessConstructor and Description
public
SortComparator(SStyle
the current citation style
style
,
LLocale
the current locale
locale
,
AbbreviationProvider
the current abbreviation provider
abbreviationProvider
)

Create a new sort comparator

Method Summary

Modifier and TypeMethod and Description
public int
compare(CSLItemData a, CSLItemData b)

Implements java.util.Comparator.compare.

Compares its two arguments for order.

public int

Returns:

the sort direction (1 for ascending and -1 for descending)
getCitationNumberDirection
()

Get the sort direction of the citation-number variable

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

abbreviationProviderback to summary
private final AbbreviationProvider abbreviationProvider
citationNumberDirectionback to summary
private int citationNumberDirection
comparatorback to summary
private final AlphanumComparator comparator
localeback to summary
private final LLocale locale
styleback to summary
private final SStyle style

Constructor Detail

SortComparatorback to summary
public SortComparator(SStyle style, LLocale locale, AbbreviationProvider abbreviationProvider)

Create a new sort comparator

Parameters
style:SStyle

the current citation style

locale:LLocale

the current locale

abbreviationProvider:AbbreviationProvider

the current abbreviation provider

Method Detail

compareback to summary
public int compare(CSLItemData a, CSLItemData b)

Implements java.util.Comparator.compare.

Doc from java.util.Comparator.compare.

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.

The implementor must ensure that signum(compare(x, y)) == -signum(compare(y, x)) for all x and y. (This implies that compare(x, y) must throw an exception if and only if compare(y, x) throws an exception.)

The implementor must also ensure that the relation is transitive: ((compare(x, y)>0) && (compare(y, z)>0)) implies compare(x, z)>0.

Finally, the implementor must ensure that compare(x, y)==0 implies that signum(compare(x, z))==signum(compare(y, z)) for all z.

Annotations
@Override
getCitationNumberDirectionback to summary
public int getCitationNumberDirection()

Get the sort direction of the citation-number variable

Returns:int

the sort direction (1 for ascending and -1 for descending)