|
|||||||||
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
public abstract class SVar
Statistical Variable This abstract class defines an interface to variables. There are various implementations (fixed size/flexible, fixed type/objects etc.
Field Summary | |
---|---|
boolean |
cacheRanks
if false then ranks are not cached |
protected boolean |
cat
type of variable, true if categorial variable |
protected int |
contentsType
type of the contents |
static int |
CT_Map
|
static int |
CT_Number
|
static int |
CT_String
|
static int |
CT_Tree
|
static double |
double_NA
this value is returned by atD(int) if the value is missing (null ) or if the variable is not numerical. |
protected boolean |
guessing
if set to true then the type of the variable is not yet known and can be guessed |
static int |
int_NA
this value is returned by atI(int) if the value is missing (null ) or if the variable is not numerical. |
protected boolean |
isnum
type of variable, true if numeric (i.e. subclass of Number ) |
static int |
IVT_Derived
derived is not internal (and hence isInternal will return false) |
static int |
IVT_Index
|
static int |
IVT_LeafID
|
static int |
IVT_Misclass
|
static int |
IVT_Normal
|
static int |
IVT_Prediction
|
static int |
IVT_RCC
|
static int |
IVT_Resid
|
static int |
IVT_ResidStat1
|
static int |
IVT_ResidStat2
|
boolean |
linked
if true permutation of categories is linked between plots |
protected double |
max
|
protected double |
min
|
static java.lang.String |
missingCat
string denoting class of the missings |
protected int |
missingCount
# of missing cases in the variable |
protected java.lang.String |
name
variable name |
boolean |
selected
flag denoting selection in a SVarSet |
protected SCatSequence |
seq
permutation of categories |
static int |
SM_lexi
sort method lexicograph. |
static int |
SM_num
sort method numerical (all objects are cast to Number, non-castable are assigned -0.01, basically to appear just before zero) |
int |
tag
this attribute can be used by external code to store temporary information (tags) - it may not used by SVar or its subclasses. |
Constructor Summary | |
---|---|
SVar(java.lang.String Name,
boolean iscat)
construct new variable. iscat= true defaults to non-numerical, CT_String, whereas iscat=false defaults to numerical, CT_Number |
|
SVar(java.lang.String Name,
boolean isnum,
boolean iscat)
construct new variable. iscat= true defaults to non-numerical, CT_String, whereas iscat=false defaults to numerical, CT_Number |
Method Summary | |
---|---|
boolean |
add(double d)
|
boolean |
add(int d)
|
abstract boolean |
add(java.lang.Object o)
adds a new case to the variable. the exact behavior is implementation-dependent. |
abstract java.lang.Object |
at(int i)
|
double |
atD(int i)
|
double |
atF(int i)
|
int |
atI(int i)
|
java.lang.String |
atS(int i)
|
void |
categorize()
define the variable explicitely as categorial (equals to calling categorize(false) ) |
abstract void |
categorize(boolean rebuild)
define the variable explicitely as categorical |
abstract void |
dropCat()
define the variable explicitely as non-categorial (drop category list) |
java.lang.Object |
elementAt(int i)
for compatibility with old code that used Vector class |
static int[] |
filterRanksByID(int[] r,
int[] ids)
|
static int[] |
filterRanksByMap(int[] r,
int[] map,
int mapEntry)
|
abstract java.lang.Object |
getCatAt(int i)
returns the category with index ID or null if variable is not categorial |
abstract java.lang.Object[] |
getCategories()
returns new, fixed array of categories |
int |
getCatIndex(int i)
returns ID of the category of i-th case in the variable or -1 if i oob |
abstract int |
getCatIndex(java.lang.Object o)
returns the ID of the category |
int |
getContentsType()
retrieves contents type of the variable |
int |
getInternalType()
returns the internal type of the variable |
double |
getMax()
|
double |
getMin()
|
int |
getMissingCount()
returs the # of missing values in this variable |
java.lang.String |
getName()
returns name of the variable |
Notifier |
getNotifier()
since the current implemantation is a Notifier itef, it returns "this" |
abstract int |
getNumCats()
returns the number of categories for this variable or 0 if the variable is not categorial |
int[] |
getRanked()
returns list of indexes ordered by rank. |
abstract int[] |
getRanked(SMarker m,
int markspec)
|
abstract int |
getSizeCat(java.lang.Object o)
returns size of the category o. |
abstract int |
getSizeCatAt(int i)
returns size of the category with index ID or -1 if variable is not categorial or index oob |
boolean |
hasMissing()
returns true if there are missing values |
boolean |
insert(double d,
int index)
|
boolean |
insert(int d,
int index)
|
abstract 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 |
isCat()
returns true if it's a categorial variable |
boolean |
isEmpty()
|
boolean |
isInternal()
returns true if the variable is internal, i.e. generated on-the fly. note that derived variables are NOT internal. use (getInterrnalType()==SVar.IVT_Normal) to check for original, non-derived variables. |
boolean |
isMissingAt(int i)
|
static boolean |
isNA(double d)
checks for a missing value. |
static boolean |
isNA(int i)
checks for a missing value. |
boolean |
isNum()
returns true if the variable has numerical content (i.e. it can be casted to Number) |
boolean |
isSelected()
returns true the selected flag is set |
SCatSequence |
mainSeq()
returns the main category sequence for this variable. |
abstract boolean |
remove(int index)
removes a case from the variable at specified index. the exact behavior is implementation-dependent. |
boolean |
replace(int index,
double d)
|
boolean |
replace(int index,
int i)
|
abstract boolean |
replace(int index,
java.lang.Object o)
replaces an element at specified position |
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 |
boolean |
setContentsType(int ct)
If it is to be used then is should be used BEFORE first data entries are inserted. |
void |
setInternalType(int it)
sets type of an internal variable. internal variables are variables that were not contained in the original dataset. derived variables are also internal if they were derived in klimt and not loaded with the dataset. |
void |
setName(java.lang.String nn)
warning! |
void |
setSelected(boolean setit)
sets the selected flag to the specified state |
void |
setSeq(SCatSequence newSeq)
|
abstract int |
size()
returns the size (number of cases) of the variable |
void |
sortCategories()
sort caregotires, using default method which is numerical for num. variables, lexicogr. otherwise |
abstract void |
sortCategories(int method)
sort categories by specifeid method |
java.lang.String |
toString()
|
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 static final int CT_String
public static final int CT_Number
public static final int CT_Map
public static final int CT_Tree
public static final int IVT_Derived
public static final int IVT_Normal
public static final int IVT_Prediction
public static final int IVT_Misclass
public static final int IVT_LeafID
public static final int IVT_Index
public static final int IVT_Resid
public static final int IVT_RCC
public static final int IVT_ResidStat1
public static final int IVT_ResidStat2
public static final int SM_lexi
public static final int SM_num
public static int int_NA
atI(int)
if the value is missing (null
) or if the variable is not numerical. This variable should not be changed except on startup. (Note: R uses -2147483648)
public static double double_NA
atD(int)
if the value is missing (null
) or if the variable is not numerical. This variable should not be changed except on startup.
public static final java.lang.String missingCat
protected double min
protected double max
protected java.lang.String name
protected boolean cat
true
if categorial variable
protected boolean isnum
true
if numeric (i.e. subclass of Number
)
protected boolean guessing
true
then the type of the variable is not yet known and can be guessed
protected int contentsType
public boolean selected
protected int missingCount
public boolean cacheRanks
false
then ranks are not cached
public int tag
protected SCatSequence seq
public boolean linked
true
permutation of categories is linked between plots
Constructor Detail |
---|
public SVar(java.lang.String Name, boolean iscat)
true
defaults to non-numerical, CT_String, whereas iscat=false
defaults to numerical, CT_Number
Name
- variable nameiscat
- true
if categorial variablepublic SVar(java.lang.String Name, boolean isnum, boolean iscat)
true
defaults to non-numerical, CT_String, whereas iscat=false
defaults to numerical, CT_Number
Name
- variable nameisnum
- true
if numeric variableiscat
- true
if categorial variableMethod Detail |
---|
public void setAllEmpty(int size)
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)
public void setInternalType(int it)
public SCatSequence mainSeq()
public int getInternalType()
public boolean isInternal()
public boolean isSelected()
true
the selected flag is set
public void setSelected(boolean setit)
public abstract void categorize(boolean rebuild)
rebuild
- if set to true
force rebuild even if the variable is already categorial.public void categorize()
categorize(false)
)
public Notifier getNotifier()
public int getContentsType()
public boolean setContentsType(int ct)
true
upon success. This method is guaranteed to succeed if
setting a custom type when no data were inserted yet. The method may succeed in other cases,
but its return value should be checked in that case.public void sortCategories()
public abstract void sortCategories(int method)
method
- sort method, see SM_xxx constantspublic abstract void dropCat()
public void setCategorical(boolean nc)
false
does not necessarily drop categories information. this method should be used for quick toggling of the variable type
public static boolean isNA(double d)
isNA
implies isNaN
but NOT vice versa!
d
- value to checkpublic static boolean isNA(int i)
i
- value to checkpublic abstract int size()
public abstract boolean add(java.lang.Object o)
public boolean add(double d)
public boolean add(int d)
public abstract boolean insert(java.lang.Object o, int index)
public boolean insert(double d, int index)
public boolean insert(int d, int index)
public abstract boolean remove(int index)
public abstract boolean replace(int index, java.lang.Object o)
public boolean replace(int index, double d)
public boolean replace(int index, int i)
public double getMin()
public double getMax()
public abstract java.lang.Object at(int i)
public java.lang.Object elementAt(int i)
public int atI(int i)
public double atF(int i)
public double atD(int i)
public java.lang.String atS(int i)
public boolean isMissingAt(int i)
public int getMissingCount()
public abstract int getCatIndex(java.lang.Object o)
category
- (usually string)
public int getCatIndex(int i)
public abstract java.lang.Object getCatAt(int i)
null
if variable is not categorial
public abstract int getSizeCatAt(int i)
public abstract int getSizeCat(java.lang.Object o)
public java.lang.String getName()
public boolean isNum()
true
if the variable has numerical content (i.e. it can be casted to Number)
public boolean isCat()
true
if it's a categorial variable
public boolean isEmpty()
public void setName(java.lang.String nn)
public abstract int getNumCats()
public boolean hasMissing()
public abstract java.lang.Object[] getCategories()
public int[] getRanked()
public abstract int[] getRanked(SMarker m, int markspec)
public static int[] filterRanksByID(int[] r, int[] ids)
public static int[] filterRanksByMap(int[] r, int[] map, int mapEntry)
public java.lang.String toString()
toString
in class java.lang.Object
public void setSeq(SCatSequence newSeq)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |