public class PairSimilarityTable extends PairSimilarity
Modifier and Type | Field | Description |
---|---|---|
static int |
TABLE_TYPE_DOUBLE |
Constant indicating floating point similarity values in the table.
|
static int |
TABLE_TYPE_STRING |
Constant indicating enum similarity values in the table
|
static java.lang.String[] |
tableStringAllowedValues |
Contains allowed values of tabular similarity function, which can be defined for an ordinal criterion
|
Constructor | Description |
---|---|
PairSimilarityTable(int id,
java.lang.String[] header,
java.lang.String[][] table,
boolean tableType) |
Constructor of the
PairSimilarityTable class. |
PairSimilarityTable(int atributeId,
SimpleField[] headers,
SimpleField[][] similarities) |
Constructs similarity table for attribute with given id, using given table with similarities between any two
simple field values from the attribute's domain.
|
Modifier and Type | Method | Description |
---|---|---|
SimpleField[] |
getHeaders() |
Gets headers of this tabular function, i.e., list of values that are used to index similarities.
|
java.lang.String[] |
getHeadersStr() |
Gets textual headers of this tabular function, i.e., list of values that are used to index similarities
|
int |
getIntTableType() |
|
SimpleField |
getSimilarity(SimpleField firstField,
SimpleField secondField) |
Gets similarity between given two field's values, i.e., similarity of the first field to the second field
|
java.lang.String[][] |
getTable() |
Gets square table of textual representations of similarities returned by this tabular function
|
boolean |
isNeededType(PairSimilarity pairSimilairty) |
Checks if the other
PairSimilarity subclass object is of the same type (table or math function),
if other object is defined for the same attribute (has the same atributeId value)
and when both this and other object are table type similarities, checks if both objects have the same header |
boolean |
isTableType() |
|
FloatField[][] |
NormalizeTable(FloatField[][] table) |
|
void |
setTableType(boolean tableType) |
Sets table type.
|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getId, setId
public static java.lang.String[] tableStringAllowedValues
public static final int TABLE_TYPE_STRING
public static final int TABLE_TYPE_DOUBLE
public PairSimilarityTable(int atributeId, SimpleField[] headers, SimpleField[][] similarities)
atributeId
- index of an attribute in memory containerheaders
- array with headers for rows/columns of the square table with similarities.
Each header has to be unique.similarities
- square table with similarities between any two simple field values from attribute's domain.
Has to have identical number of rows/columns as the length of headers
.
Each table entry similarities[i][j]
expresses the similarity
of headers[i]
to headers[j]
.public PairSimilarityTable(int id, java.lang.String[] header, java.lang.String[][] table, boolean tableType)
PairSimilarityTable
class.id
- attribute number in the memory containerheader
- domain of a considered ordinal criterion from memory containertable
- tabular representation of created similarity functiontableType
- type of created table; true
denotes floating point mode, while false
denotes enum modejava.lang.NullPointerException
- when header
is null
,
when table
is null
,
when any row of table
is null
InvalidValueException
- when given attribute id is smaller than zero,
when number of rows or columns of table
is different than length of header
java.lang.NumberFormatException
- when tableType == true
and any string from table
cannot be converted to floating point number
(see Double.parseDouble(String)
)public SimpleField getSimilarity(SimpleField firstField, SimpleField secondField)
getSimilarity
in class PairSimilarity
firstField
- first field's valuesecondField
- second field's valuepublic boolean isTableType()
public void setTableType(boolean tableType)
tableType
- table typepublic FloatField[][] NormalizeTable(FloatField[][] table) throws java.lang.Exception
java.lang.Exception
public int getIntTableType()
public SimpleField[] getHeaders()
public java.lang.String[] getHeadersStr()
public java.lang.String[][] getTable()
public boolean isNeededType(PairSimilarity pairSimilairty)
PairSimilarity
PairSimilarity
subclass object is of the same type (table or math function),
if other object is defined for the same attribute (has the same atributeId
value)
and when both this and other object are table type similarities, checks if both objects have the same headerisNeededType
in class PairSimilarity
pairSimilairty
- another pair similarity objecttrue
when given object is of the same type as this object, false
otherwise