Verified Owner
Top Description Inners Constructors Methods
org.jabref.model.openoffice.rangesort

public Class RangeSort

extends Object
Class Inheritance
Imports
java.util.ArrayList, .Comparator, .HashMap, .List, .Map, org.jabref.model.openoffice.uno.UnoCast, .UnoTextRange, com.sun.star.text.XText, com.sun.star.text.XTextRangeCompare

RangeSort provides sorting based on XTextRangeCompare, which only provides comparison between XTextRange values within the same XText.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
RangeSort.HolderComparatorWithinPartition

Compare two RangeHolders (using RangeHolder.getRange()) within an XText.

public static class
RangeSort.RangePartitions<V extends RangeHolder>

Represent a partitioning of RangeHolders by XText

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static <V extends RangeHolder> RangeSort.RangePartitions<V>
partitionAndSortRanges(List<V> holders)

Note

RangeHolder.getRange() is called many times.

public static <V extends RangeHolder> RangeSort.RangePartitions<V>
partitionRanges(List<V> holders)

Partition RangeHolders by the corresponding XText.

public static <V extends RangeHolder> void
sortWithinPartition(List<V> rangeHolders)

Sort a list of RangeHolder values known to share the same getText().

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

RangeSortback to summary
private RangeSort()

Method Detail

partitionAndSortRangesback to summary
public static <V extends RangeHolder> RangeSort.RangePartitions<V> partitionAndSortRanges(List<V> holders)

Note

RangeHolder.getRange() is called many times.

partitionRangesback to summary
public static <V extends RangeHolder> RangeSort.RangePartitions<V> partitionRanges(List<V> holders)

Partition RangeHolders by the corresponding XText.

sortWithinPartitionback to summary
public static <V extends RangeHolder> void sortWithinPartition(List<V> rangeHolders)

Sort a list of RangeHolder values known to share the same getText().

Note

RangeHolder.getRange() is called many times.

org.jabref.model.openoffice.rangesort back to summary

private Class RangeSort.HolderComparatorWithinPartition

extends Object
implements Comparator<RangeHolder>
Class Inheritance
  • java.lang.Object
  • org.jabref.model.openoffice.rangesort.RangeSort.HolderComparatorWithinPartition
All Implemented Interfaces
java.util.Comparator

Compare two RangeHolders (using RangeHolder.getRange()) within an XText.

Note

since we only look at the ranges, this comparison is generally not consistent with equals on the RangeHolders. Probably should not be used for key comparison in TreeMap<RangeHolder> or Set<RangeHolder>

Field Summary

Modifier and TypeField and Description
private final com.sun.star.text.XTextRangeCompare

Constructor Summary

AccessConstructor and Description
pack-priv
HolderComparatorWithinPartition(com.sun.star.text.XText text)

Method Summary

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

Implements java.util.Comparator.compare.

Assumes a and b belong to the same XText as cmp.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cmpback to summary
private final com.sun.star.text.XTextRangeCompare cmp

Constructor Detail

HolderComparatorWithinPartitionback to summary
pack-priv HolderComparatorWithinPartition(com.sun.star.text.XText text)

Method Detail

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

Implements java.util.Comparator.compare.

Assumes a and b belong to the same XText as cmp.

Annotations
@Override
org.jabref.model.openoffice.rangesort back to summary

public Class RangeSort.RangePartitions<V extends RangeHolder>

extends Object
Class Inheritance
  • java.lang.Object
  • org.jabref.model.openoffice.rangesort.RangeSort.RangePartitions

Represent a partitioning of RangeHolders by XText

Field Summary

Modifier and TypeField and Description
private final Map<com.sun.star.text.XText, List<V>>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
add(V holder)

public List<List<V>>
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

partitionsback to summary
private final Map<com.sun.star.text.XText, List<V>> partitions

Constructor Detail

RangePartitionsback to summary
public RangePartitions()

Method Detail

addback to summary
public void add(V holder)
getPartitionsback to summary
public List<List<V>> getPartitions()