public class KinTypeIndex
extends java.lang.Object
implements java.io.Serializable
A pair is a 2-element array of Integers = the serial numbers of Ego & Alter. This index is maintained to allow quickly finding a pair of persons who exemplify a particular structural relationship in Ego's family tree.
This index is used to create 'named-data-requests' for the user. If the Learning module needs some dyads for a particular kin type to prove or disprove that a Library definition fits the user's data so far, it will ask the User to produce 1-2 dyads for that kin type. If a pair of persons already exist in the IndividualCensus who could be used, we generate a named-data-request.
To make additions efficient, we implement this as a nested TreeMap: kinType => egoSerial# => AList of AlterSerial#s
Modifier and Type | Field and Description |
---|---|
int |
lastSerial
The highest serial number of a person when the index was last updated.
|
static java.util.ArrayList<java.lang.String> |
predsInPriorityOrder |
Constructor and Description |
---|
KinTypeIndex() |
Modifier and Type | Method and Description |
---|---|
void |
addList(java.lang.String kTyp,
java.util.ArrayList<java.lang.Integer[]> list)
Put this list in the index.
|
void |
addPair(java.lang.String kTyp,
java.lang.Integer[] pair)
Add pointers to a pair of Integers, to be indexed on its kin type.
|
java.util.ArrayList<java.lang.Integer[]> |
getList(java.lang.String kinType)
Returns the list of pairs indexed under this kin type (PC-String).
|
boolean |
isEmpty() |
static java.util.ArrayList<java.lang.String> |
makePredList() |
void |
removeChartableUDP(java.lang.String udName) |
boolean |
removePair(java.lang.String kTyp,
java.lang.Integer[] pair)
Removes this pair from the index if it is present.
|
void |
renameChartableUDP(java.lang.String oldName,
java.lang.String newName) |
java.lang.String |
toSILKString() |
void |
updateFromRow(java.lang.Integer egoInt,
java.util.TreeMap row)
For each Ego/Alter pair represented in the Row, make a KTI entry
|
boolean |
updateIndex(Context ctxt)
Picking up where we left off last time, update the KinTypeIndex for this
context by computing a PC String (kin type) for every pair of people
in this population.
|
public int lastSerial
public static java.util.ArrayList<java.lang.String> predsInPriorityOrder
public static java.util.ArrayList<java.lang.String> makePredList()
public void addPair(java.lang.String kTyp, java.lang.Integer[] pair)
kTyp
- the kinType of this pair.pair
- a 2-element array of Integers: the serial numbers of Ego/Alterpublic void addList(java.lang.String kTyp, java.util.ArrayList<java.lang.Integer[]> list)
kTyp
- the key (kin type)list
- the list of pairs for this kin typepublic void renameChartableUDP(java.lang.String oldName, java.lang.String newName)
public void removeChartableUDP(java.lang.String udName)
public java.util.ArrayList<java.lang.Integer[]> getList(java.lang.String kinType)
kinType
- the kin type of a relationshippublic boolean removePair(java.lang.String kTyp, java.lang.Integer[] pair)
kTyp
- the kinType of this pair.pair
- a 2-element array of Integers: the serial numbers of Ego/Alterpublic boolean isEmpty()
public boolean updateIndex(Context ctxt)
ctxt
- the Context containing the population to be updated.public void updateFromRow(java.lang.Integer egoInt, java.util.TreeMap row)
egoInt
- Serial number of the Ego in the rowrow
- Ego's row from the KinTermMAtrixpublic java.lang.String toSILKString()