01: package it.unimi.dsi.fastutil;
02:
03: /*
04: * fastutil: Fast & compact type-specific collections for Java
05: *
06: * Copyright (C) 2003-2008 Paolo Boldi and Sebastiano Vigna
07: *
08: * This library is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Lesser General Public
10: * License as published by the Free Software Foundation; either
11: * version 2.1 of the License, or (at your option) any later version.
12: *
13: * This library is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16: * Lesser General Public License for more details.
17: *
18: * You should have received a copy of the GNU Lesser General Public
19: * License along with this library; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: *
22: */
23:
24: import java.util.Comparator;
25:
26: /** An indirect double priority queue.
27: *
28: * <P>An indirect double priority queue uses two distinct comparators (called <em>primary</em>
29: * and <em>secondary</em>) to keep its elements ordered. It makes it possible to access the
30: * first element w.r.t. the secondary comparatory using {@link #secondaryFirst()} (and, optionally,
31: * the last element using {@link #secondaryLast()}). The remaining methods
32: * work like those of an {@linkplain it.unimi.dsi.fastutil.IndirectPriorityQueue indirect priority queue} based on the
33: * primary comparator.
34: */
35:
36: public interface IndirectDoublePriorityQueue<K> extends
37: IndirectPriorityQueue<K> {
38:
39: /** Returns the secondary comparator of this queue.
40: *
41: * @return the secondary comparator of this queue.
42: * @see #secondaryFirst()
43: */
44: public Comparator<? super K> secondaryComparator();
45:
46: /** Returns the first element of this queue with respect to the {@linkplain #secondaryComparator() secondary comparator}.
47: *
48: * @return the first element of this queue w.r.t. the {@linkplain #secondaryComparator() secondary comparator}.
49: */
50: public int secondaryFirst();
51:
52: /** Returns the last element of this queue with respect to the {@linkplain #secondaryComparator() secondary comparator} (optional operation).
53: *
54: * @return the last element of this queue w.r.t. the {@linkplain #secondaryComparator() secondary comparator}.
55: */
56: public int secondaryLast();
57:
58: /** Retrieves the secondary front of the queue in a given array (optional operation).
59: *
60: * @param a an array large enough to hold the secondary front (e.g., at least long as the reference array).
61: * @return the number of elements actually written (starting from the first position of <code>a</code>).
62: * @see IndirectPriorityQueue#front(int[])
63: */
64:
65: public int secondaryFront(final int[] a);
66: }
|