|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.rosuda.ibase.Notifier org.rosuda.ibase.SVar org.rosuda.ibase.SVarFact
public class SVarFact
Statistical Variable
IMPORTANT NOTES:
NOTE: do NOT remove any elements from SVar !! Any Vector methods that modify contents except for "add" are NOT safe (for categorized vars) as they DON'T update categories!! The "is number" property is set accoding to the first added (non-null) element - thus you should NOT mix numeric and non-numeric objects. It is safe to insert numbers in non-numeric value, but NOT vice-versa as for numeric variables the detection of min/max casts any object to Number.
Field Summary | |
---|---|
java.lang.String[] |
cats
|
int[] |
cont
|
boolean |
muteNotify
|
Fields inherited from class org.rosuda.ibase.SVar |
---|
cacheRanks, cat, contentsType, CT_Map, CT_Number, CT_String, CT_Tree, double_NA, guessing, int_NA, isnum, IVT_Derived, IVT_Index, IVT_LeafID, IVT_Misclass, IVT_Normal, IVT_Prediction, IVT_RCC, IVT_Resid, IVT_ResidStat1, IVT_ResidStat2, linked, max, min, missingCat, missingCount, name, selected, seq, SM_lexi, SM_num, tag |
Constructor Summary | |
---|---|
SVarFact(java.lang.String name,
int len)
|
|
SVarFact(java.lang.String Name,
int[] ids,
java.lang.String[] cnames)
construct new variable and add first element |
Method Summary | |
---|---|
boolean |
add(java.lang.Object o)
adds a new case to the variable. the exact behavior is implementation-dependent. |
java.lang.Object |
at(int i)
|
int |
atI(int i)
|
void |
categorize(boolean rebuild)
define the variable explicitely as categorical |
void |
createMissingsCat()
|
void |
dropCat()
define the variable explicitely as non-categorial (drop category list) |
java.lang.Object |
getCatAt(int i)
returns the category with index ID or null if variable is not categorial |
java.lang.Object[] |
getCategories()
returns new, ed array of categories |
int |
getCatIndex(int i)
returns ID of the category of i-th case in the variable or -1 if i oob |
int |
getCatIndex(java.lang.Object o)
returns the ID of the category |
int |
getNumCats()
returns the number of categories for this variable or 0 if the variable is not categorial |
int[] |
getRanked(SMarker m,
int markspec)
returns list of indexes ordered by rank, for non-cat, num vars only. missing values are omitted. |
int |
getSizeCat(java.lang.Object o)
returns size of the category o. |
int |
getSizeCatAt(int i)
returns size of the category with index ID or -1 if variable is not categorial or index oob |
boolean |
hasEqualContents(int[] i2,
java.lang.String[] s2)
|
boolean |
insert(java.lang.Object o,
int index)
inserts a new case to the variable at specified index. the exact behavior is implementation-dependent. |
boolean |
isLastMissing()
return true if missings have their own category (the last one) |
boolean |
remove(int index)
removes a case from the variable at specified index. the exact behavior is implementation-dependent. |
boolean |
replace(int i,
java.lang.Object o)
replaces an element at specified position |
boolean |
replaceAll(int[] ids,
java.lang.String[] cnames)
|
void |
setAllEmpty(int size)
we want to be able to make an empty SVar with the specified size and null content (added 28.12.03 MH). |
void |
setCategorical(boolean nc)
define the type of the variable. note that setting nc to false does not necessarily drop categories information. this method should be used for quick toggling of the variable type |
int |
size()
returns the size (number of cases) of the variable |
void |
sortCategories(int method)
sort categories by specifeid method |
java.lang.String |
toString()
|
Methods inherited from class org.rosuda.ibase.SVar |
---|
add, add, atD, atF, atS, categorize, elementAt, filterRanksByID, filterRanksByMap, getContentsType, getInternalType, getMax, getMin, getMissingCount, getName, getNotifier, getRanked, hasMissing, insert, insert, isCat, isEmpty, isInternal, isMissingAt, isNA, isNA, isNum, isSelected, mainSeq, replace, replace, setContentsType, setInternalType, setName, setSelected, setSeq, sortCategories |
Methods inherited from class org.rosuda.ibase.Notifier |
---|
addDepend, beginBatch, delDepend, endBatch, NotifyAll, NotifyAll, NotifyAll, NotifyAll, startCascadedNotifyAll |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public int[] cont
public java.lang.String[] cats
public boolean muteNotify
Constructor Detail |
---|
public SVarFact(java.lang.String name, int len)
public SVarFact(java.lang.String Name, int[] ids, java.lang.String[] cnames)
Name
- variable nameiscat
- true
if categorial variablefirst
- first element to be added - see add(java.lang.Object)
for details. If null
is passed then no element is added. The usage of this constructor is discouraged/deprecated because first entry cannot contain a missing value thus leading to a loss of generality.Method Detail |
---|
public boolean isLastMissing()
true
if missings have their own category (the last one)
public boolean replaceAll(int[] ids, java.lang.String[] cnames)
public void createMissingsCat()
public void setAllEmpty(int size)
SVar
null
content (added 28.12.03 MH).
remove abstract and define a fallback using replace/add/remove in case the subclass doesn't provide its optimized version (SU 19.1.04)
setAllEmpty
in class SVar
public int size()
SVar
size
in class SVar
public void categorize(boolean rebuild)
categorize
in class SVar
rebuild
- if set to true
force rebuild even if the variable is already categorial.public void sortCategories(int method)
sortCategories
in class SVar
method
- sort method, see SM_xxx constantspublic void dropCat()
dropCat
in class SVar
public void setCategorical(boolean nc)
SVar
false
does not necessarily drop categories information. this method should be used for quick toggling of the variable type
setCategorical
in class SVar
public boolean add(java.lang.Object o)
SVar
add
in class SVar
public boolean remove(int index)
SVar
remove
in class SVar
public boolean insert(java.lang.Object o, int index)
SVar
insert
in class SVar
public boolean replace(int i, java.lang.Object o)
SVar
replace
in class SVar
public java.lang.Object at(int i)
at
in class SVar
public int atI(int i)
atI
in class SVar
public int getCatIndex(java.lang.Object o)
SVar
getCatIndex
in class SVar
public int getCatIndex(int i)
SVar
getCatIndex
in class SVar
public java.lang.Object getCatAt(int i)
null
if variable is not categorial
getCatAt
in class SVar
public int getSizeCatAt(int i)
getSizeCatAt
in class SVar
public int getSizeCat(java.lang.Object o)
getSizeCat
in class SVar
public int getNumCats()
getNumCats
in class SVar
public java.lang.Object[] getCategories()
getCategories
in class SVar
public int[] getRanked(SMarker m, int markspec)
getRanked
in class SVar
v
- variable (should be obtained by at(..))m
- marker to use for filtering. if null
all cases will be checkedmarkspec
- mark for filtering, i.e. cases with that mark will be used only
null
is any of the following
cases: variable is not numerical or is categorical, no cases matching
specification are presentpublic boolean hasEqualContents(int[] i2, java.lang.String[] s2)
public java.lang.String toString()
toString
in class SVar
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |