public class KinTermMatrix
extends java.lang.Object
implements java.io.Serializable
Node
containing the kinTerms
Row
(Ego) could use to refer to Column
(Alter).
This sparse matrix is currently implemented as a nested TreeMap. That may
change in the future.
A KinTermMatrix grows by adding a new person (indexed by their serialNmbr) to the rows (list of Egos) and columns (list of Alters) of the matrix. Each Node holds lists of terms that Ego calls Alter, plus data about the most recent diagram that has been drawn.
The matrix is normally built one person at a time as a Field Worker gathers data about people in the local culture. It is imperative that the retrieval of kinTerms by (row, col) address be fast and scalable.
A KinTermMatrix has 2 associated indexes of kinTerms, for Reference terms and terms of Address. For every kinTerm that has been recorded in a matrix, its index entry has a list of all the Egos who have a kin of that type, and for each one has a list of Alters whom Ego calls by that kinTerm.
Constructor and Description |
---|
KinTermMatrix() |
Modifier and Type | Method and Description |
---|---|
void |
addAdrCloneTerms()
For every Node in the matrix, make terms of address that mimic the
terms of reference.
|
void |
addNode(int egoInt,
int alterInt,
Node node) |
void |
addTerm(int egoInt,
int alterInt,
java.lang.String kinTerm,
java.lang.String type,
boolean addr)
Enter into this KinTermMatrix the kinship term that
ego calls alter . |
void |
checkSelfNodes()
Verify that each row has a self-node, and that an 'Ego' term of address
appears only if this context has separate terms of address.
|
void |
cleanAdrTerms()
Used when deleting a domain theory for Terms of Address.
|
KinTermMatrix |
clone() |
void |
correctKinTerm(int ego,
int alter,
java.lang.String oldTerm,
java.lang.String newTerm,
boolean adr) |
void |
deleteKinTerm(int ego,
int alter,
java.lang.String kinTerm,
boolean adr) |
void |
deletePerson(Individual ind)
This method removes the row and column associated
with an Individual.
|
Node |
getCell(Individual egoInd,
Individual alterInd)
|
Node |
getCell(int egoInt,
int alterInt)
|
java.util.ArrayList<java.lang.Object> |
getEgoTermList(int ego,
int[] individuals)
Return an ArrayList
|
java.util.ArrayList<java.lang.Integer> |
getPath(int egoNum,
int alterNum)
Build an array of ints = the linking kinsmen between ego and alter.
|
java.util.TreeMap |
getRow(Individual egoInd)
Return a TreeMap which represents
ego 's row in this KinTermMatrix, or null if no row exists yet. |
java.util.TreeMap |
getRow(int egoInt)
Return a TreeMap which represents
ego 's row in this KinTermMatrix, or null if no row exists yet. |
void |
insertNewRow(int serialNmbr) |
int |
numberOfCells() |
int |
numberOfKinTerms() |
java.lang.String |
printMatrix()
Return a printable String displaying the contents of this Matrix
|
java.lang.String |
printMatrixSummary() |
int |
pullSerial(java.lang.String suffix) |
void |
removeChartableUDP(java.lang.String udName) |
void |
renameChartableUDP(java.lang.String oldName,
java.lang.String newName) |
void |
replaceRow(int egoInt,
java.util.TreeMap newRow)
Replace
ego 's row in this KinTermMatrix with this TreeMap. |
java.lang.String |
toSILKString()
This method builds a string that represents a KinTermMatrix in a SILKin data (_.silk) file.
|
java.lang.String |
toString()
Return a printable String displaying the complete contents of this Matrix and Indices
|
java.util.ArrayList |
union(java.util.ArrayList lst1,
java.util.ArrayList lst2) |
void |
updateRow(Individual egoInd,
java.util.ArrayList<Individual> individuals)
Update
ego 's row in this KinTermMatrix. |
public KinTermMatrix clone()
clone
in class java.lang.Object
public void deletePerson(Individual ind)
ind
- the person being deleted.public void deleteKinTerm(int ego, int alter, java.lang.String kinTerm, boolean adr)
public void correctKinTerm(int ego, int alter, java.lang.String oldTerm, java.lang.String newTerm, boolean adr)
public void renameChartableUDP(java.lang.String oldName, java.lang.String newName)
public void removeChartableUDP(java.lang.String udName)
public int numberOfKinTerms()
public int numberOfCells()
public void checkSelfNodes()
public void addAdrCloneTerms()
public void cleanAdrTerms()
public java.util.ArrayList union(java.util.ArrayList lst1, java.util.ArrayList lst2)
public java.lang.String toSILKString()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printMatrixSummary()
public java.lang.String printMatrix()
public void addTerm(int egoInt, int alterInt, java.lang.String kinTerm, java.lang.String type, boolean addr) throws KSInternalErrorException
ego
calls alter
.
For example: addKinTerm(DonaldDuckSerial#, ScroogeMcDuckSerial#, "uncle", "primary", false).egoInt
- (serial number of) speaker of this kinTerm: the focus person.alterInt
- (serial number of) person ego would call this kinTermkinTerm
- the term to be foundtype
- 'primary' or 'extended' or 'exception'addr
- true = searching Terms of Address, false = searching Terms of ReferenceKSInternalErrorException
public void insertNewRow(int serialNmbr)
public void addNode(int egoInt, int alterInt, Node node)
public Node getCell(int egoInt, int alterInt)
egoInt
- (serial number of) speaker of this kinTerm: the focus person.alterInt
- (serial number of) person ego would call this kinTermpublic Node getCell(Individual egoInd, Individual alterInd)
egoInd
- Individual
who uses this kinTerm: the focus person.alterInd
- Individual
ego would call this kinTermpublic java.util.ArrayList<java.lang.Object> getEgoTermList(int ego, int[] individuals)
ego
- serial number of a focal person.individuals
- array of serial numberspublic java.util.TreeMap getRow(Individual egoInd)
ego
's row in this KinTermMatrix, or null
if no row exists yet.
The returned TreeMap has one Node associated with each Alter that has any kinTerms defined.egoInd
- a focal person.public java.util.TreeMap getRow(int egoInt)
ego
's row in this KinTermMatrix, or null
if no row exists yet.
The returned TreeMap has one Node associated with each Alter that has any kinTerms defined.egoInt
- serial number of a focal person.public java.util.ArrayList<java.lang.Integer> getPath(int egoNum, int alterNum) throws KSInternalErrorException
egoNum
- ego's serial numberalterNum
- alter's serial numberKSInternalErrorException
public void updateRow(Individual egoInd, java.util.ArrayList<Individual> individuals) throws java.lang.NumberFormatException
ego
's row in this KinTermMatrix. For each person in the ArrayListegoInd
- a focal person.individuals
- an ArrayListjava.lang.NumberFormatException
public int pullSerial(java.lang.String suffix) throws java.lang.NumberFormatException
java.lang.NumberFormatException
public void replaceRow(int egoInt, java.util.TreeMap newRow)
ego
's row in this KinTermMatrix with this TreeMap.
All terms in the old row are erased. Update the Indices of kinTerms
associated with this KinTermMatrix.egoInt
- serial number of a focal person.newRow
- new TreeMap of serial numbers associated with Node
s for ego
's row.a
- KSInternalErrorException if the values in the TreeMap newRow
are not Node
s and the keys are not Integers.