public class Label
extends java.lang.Object
implements java.io.Serializable
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
bestContext |
private java.lang.String |
name |
private double |
qe |
private static long |
serialVersionUID |
static int |
SORT_ASC |
private static int |
SORT_BYMEAN |
private static int |
SORT_BYNAME |
private static int |
SORT_BYQE |
static int |
SORT_DESC |
private double |
value |
Constructor and Description |
---|
Label(java.lang.String name) |
Label(java.lang.String name,
double value) |
Label(java.lang.String name,
double value,
double qe)
Constructs a label object with the given arguments.
|
Label(java.lang.String name,
java.lang.String BestContext) |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getBestContext() |
java.lang.String |
getName()
Returns the name of the label.
|
java.lang.String |
getNameAndScaledValue(int scale) |
double |
getQe()
Returns the quantization error of this label.
|
double |
getValue()
Returns the value of this label.
|
private static void |
qsort(Label[] a,
int type,
int order)
Internal method for the quick sort algorithm.
|
private static void |
qsort(Label[] a,
int lo0,
int hi0,
int type)
Internal method for the quick sort algorithm.
|
private static void |
reverse(Label[] a)
Convenience method for the reversal of an array of labels.
|
private static void |
reverse(Label[] a,
int start,
int end)
Internal method for reversal of a part of an array of labels.
|
static void |
sortByName(Label[] labels,
int order)
Convenience method for sorting an array of labels by their names.
|
static void |
sortByQe(Label[] labels,
int order)
Convenience method for sorting an array of labels by their quantization errors.
|
static void |
sortByQeValue(Label[] labels,
int order1,
int order2)
Convenience method for sorting an array of labels by their quantization errors and values (in case of equal
quantization errors).
|
static void |
sortByValue(Label[] labels,
int order)
Convenience method for sorting an array of labels by their values.
|
static void |
sortByValueQe(Label[] labels,
int order1,
int order2)
Convenience method for sorting an array of labels by their values and quantization errors (in case of equal
value).
|
private static void |
swap(Label[] a,
int i,
int j)
Internal method for the quick sort algorithm for swapping two elements (labels) of an array.
|
private static final long serialVersionUID
public static final int SORT_ASC
private static final int SORT_BYMEAN
private static final int SORT_BYNAME
private static final int SORT_BYQE
public static final int SORT_DESC
private java.lang.String name
private double qe
private double value
private java.lang.String bestContext
public Label(java.lang.String name, double value, double qe)
name
- the name of the label.value
- the label value.qe
- the quantization error of the label.public Label(java.lang.String name, double value)
public Label(java.lang.String name)
public Label(java.lang.String name, java.lang.String BestContext)
private static void qsort(Label[] a, int type, int order)
a
- an array of labels to be sorted.type
- the sorting criterion (SORT_BYMEAN
, SORT_BYNAME
or SORT_BYQE
).order
- the order of sorting, either ascending (SORT_ASC
) or descending (SORT_DESC
).private static void qsort(Label[] a, int lo0, int hi0, int type)
a
- an array of labels to be sorted.lo0
- the lower boundary.hi0
- the upper boundary.type
- the sorting criterion (SORT_BYMEAN
, SORT_BYNAME
or SORT_BYQE
).private static void reverse(Label[] a)
a
- the array of labels to be reversed.private static void reverse(Label[] a, int start, int end)
a
- the array of labels to be reversed.start
- the lower boundary.end
- the upper boundary.public static void sortByValue(Label[] labels, int order)
public static void sortByValueQe(Label[] labels, int order1, int order2)
order1
and
order2
.public static void sortByName(Label[] labels, int order)
public static void sortByQe(Label[] labels, int order)
public static void sortByQeValue(Label[] labels, int order1, int order2)
order1
and order2
.private static void swap(Label[] a, int i, int j)
a
- an array of labels.i
- index of first element to be swapped with second.j
- index of second element to be swapped with first.public java.lang.String getName()
public double getQe()
public java.lang.String getBestContext()
public double getValue()
public java.lang.String getNameAndScaledValue(int scale)