public abstract class Sym extends MObj
In mmj there is only one occurrence of each symbol, and this includes constants and variables. For example, there is only one "(".
Modifier and Type | Field and Description |
---|---|
static java.util.Comparator<Sym> |
ID
ID sequences by Sym.id.
|
chapterNbr, description, isTempObject, SECTION_AND_MOBJ_NBR, sectionMObjNbr, sectionNbr, seq, SEQ
Modifier | Constructor and Description |
---|---|
|
Sym(int seq,
java.util.Map<?,?> symTbl,
java.util.Map<?,?> stmtTbl,
java.lang.String id)
Construct using sequence number and id string.
|
protected |
Sym(int seq,
java.lang.String id)
Construct using sequence number and id string.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compare for equality with another Sym.
|
java.lang.String |
getId()
Return Sym.id String
|
int |
hashCode()
Computes hashcode for this Sym
|
abstract boolean |
isActive()
Is Sym active?
|
java.lang.String |
toString()
converts to String
|
getChapterNbr, getDescription, getDescriptionForSearch, getIsTempObject, getOrigSectionNbr, getSectionMObjNbr, getSectionNbr, getSeq, setChapterNbr, setDescription, setIsTempObject, setSectionMObjNbr, setSectionNbr
public static final java.util.Comparator<Sym> ID
protected Sym(int seq, java.lang.String id) throws LangException
seq
- MObj.seq numberid
- Sym id stringLangException
- if id string is emptypublic Sym(int seq, java.util.Map<?,?> symTbl, java.util.Map<?,?> stmtTbl, java.lang.String id) throws LangException
seq
- MObj.seq numbersymTbl
- Symbol TablestmtTbl
- Statement Tableid
- Sym id stringLangException
- if Sym.id duplicates the id of another Sym (Cnst or
Var) or a Stmt label.public java.lang.String getId()
public abstract boolean isActive()
Cnst
s are always active as they cannot be defined inside a scope
level, but a Var defined in a scope level is "inactive" outside of that
scope.
The question "is Sym 'x' active" has relevance only in relation to a
Stmt: only "active" Sym
s can be used in a given Stmt
's
Formula.
public java.lang.String toString()
public int hashCode()
public boolean equals(java.lang.Object obj)
Equal if and only if the Sym id strings are equal. and the obj to be compared to this object is not null and is a Sym as well.
Note that "equals" is identical to "==" for Sym and Stmt MObj's.