|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.somtoolbox.layers.Label
public class Label
A simple class representing a unit label. This class holds the name, the value and the quantization error of a label. It also provides static methods for sorting an array of labels according to on of the three properties mentioned before.
Field Summary | |
---|---|
private String |
bestContext
|
private 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 Summary | |
---|---|
Label(String name)
|
|
Label(String name,
double value)
|
|
Label(String name,
double value,
double qe)
Constructs a label object with the given arguments. |
|
Label(String name,
String BestContext)
|
Method Summary | |
---|---|
String |
getBestContext()
|
String |
getName()
Returns the name of the label. |
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. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
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 String name
private double qe
private double value
private String bestContext
Constructor Detail |
---|
public Label(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(String name, double value)
public Label(String name)
public Label(String name, String BestContext)
Method Detail |
---|
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)
labels
- an array of labels to be sorted.order
- the sorting order, either ascending (SORT_ASC
) or descending (SORT_DESC
).public static void sortByValueQe(Label[] labels, int order1, int order2)
order1
and
order2
.
labels
- an array of labels to be sorted.order1
- the sorting order for the primary criterion, either ascending (SORT_ASC
) or descending (
SORT_DESC
).order2
- the sorting order for the secondary criterion, either ascending (SORT_ASC
) or descending (
SORT_DESC
).public static void sortByName(Label[] labels, int order)
labels
- an array of labels to be sorted.order
- the sorting order, either ascending (SORT_ASC
) or descending (SORT_DESC
).public static void sortByQe(Label[] labels, int order)
labels
- an array of labels to be sorted.order
- the sorting order, either ascending (SORT_ASC
) or descending (SORT_DESC
).public static void sortByQeValue(Label[] labels, int order1, int order2)
order1
and order2
.
labels
- an array of labels to be sorted.order1
- the sorting order for the primary criterion, either ascending (SORT_ASC
) or descending (
SORT_DESC
).order2
- the sorting order for the secondary criterion, either ascending (SORT_ASC
) or descending (
SORT_DESC
).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 String getName()
public double getQe()
public String getBestContext()
public double getValue()
public String getNameAndScaledValue(int scale)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |