Package at.jku.ssw.fp.sect07_5.index
Class Numbered<A extends Comparable<A>>
- java.lang.Object
-
- at.jku.ssw.fp.sect07_5.index.Numbered<A>
-
- Type Parameters:
A
- the type of the values
- All Implemented Interfaces:
Comparable<Numbered<A>>
public class Numbered<A extends Comparable<A>> extends Object implements Comparable<Numbered<A>>
Class for pairs of a number and a value.- Author:
- Herbert Praehofer
-
-
Field Summary
Fields Modifier and Type Field Description private Comparator<Numbered<A>>
comparator
Comparator for numbered values by first comparing the number and then the value.int
n
The numberA
value
The value
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(Numbered<A> other)
boolean
equals(Object obj)
int
hashCode()
static <A extends Comparable<A>>
Numbered<A>of(int n, A value)
Creates a numbered value by a number and a value.String
toString()
-
-
-
Field Detail
-
comparator
private Comparator<Numbered<A extends Comparable<A>>> comparator
Comparator for numbered values by first comparing the number and then the value.
-
n
public final int n
The number
-
value
public final A extends Comparable<A> value
The value
-
-
Constructor Detail
-
Numbered
private Numbered(int n, A value)
Private constructor initializing number and value.- Parameters:
n
- the numbervalue
- the value
-
-
Method Detail
-
of
public static <A extends Comparable<A>> Numbered<A> of(int n, A value)
Creates a numbered value by a number and a value.- Type Parameters:
A
- the type of the value- Parameters:
n
- the numbervalue
- the value- Returns:
- the numbered value
-
compareTo
public int compareTo(Numbered<A> other)
- Specified by:
compareTo
in interfaceComparable<A extends Comparable<A>>
-
-