|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--pnuts.lang.Package
This class represents a Pnuts package (not Java's).
Field Summary | |
pnuts.lang.SymbolTable |
autoloadTable
This represents a set of names which are registered as autoloaded. |
protected java.util.Vector |
children
|
static Package |
globalPackage
The package with name "". |
protected java.lang.String |
name
The name of the package. |
protected static java.util.Hashtable |
packages
All packages with a non-null name |
protected Package |
parent
|
protected pnuts.lang.SymbolTable |
requireTable
This represents a set of loaded script names. |
protected pnuts.lang.SymbolTable |
table
|
protected pnuts.lang.SymbolTable |
unitTable
This represents a set of registered QuantityFactory. |
Constructor Summary | |
|
Package()
creates a package that is not visible from other packages |
protected |
Package(java.lang.String name)
creates a package and register it in a static hashtable. |
Method Summary | |
void |
clear(java.lang.String symbol)
Delete a symbol from the package |
void |
clear(java.lang.String symbol,
Context context)
Delete a symbol from the package |
java.lang.Object |
clone()
|
boolean |
defined(java.lang.String name)
|
boolean |
defined(java.lang.String name,
Context context)
|
java.util.Enumeration |
elements()
enumerates sub-packages |
static Package |
find(java.lang.String pkg)
|
java.lang.Object |
get(java.lang.String symbol)
This method defines the behavior of the following expression. |
java.lang.Object |
get(java.lang.String name,
Context context)
Get the value of a symbol in the package. |
static Package |
getGlobalPackage()
|
java.lang.String |
getName()
|
static Package |
getPackage(java.lang.String pkg)
If package "pkg" exists returns that, otherwise creates and returns one. |
protected void |
init()
This method is called by the constructors. |
protected void |
init(Context context)
This method is called when the package become the current package with package() function. |
java.util.Enumeration |
keys()
Returns an enumeration of the names in the package. |
protected Value |
lookup(java.lang.String symbol,
Context context)
lookup the symbol in the package |
static void |
registerQuantityFactory(java.lang.String unit,
QuantityFactory fac)
|
static void |
remove(java.lang.String name)
Remove the specified package |
static void |
reset()
Remove all packages |
void |
save(java.io.OutputStream s)
save the package to an outputStream. |
void |
set(java.lang.String symbol,
java.lang.Object obj)
Set a value of a symbol in the package. |
void |
set(java.lang.String symbol,
java.lang.Object obj,
Context context)
Set a value of a symbol in the package. |
static void |
setPackageFactory(PackageFactory factory)
When an instance of PackageFactory is registered by this method, the package() builtin function calls its PackageFactory.createPackage() method. |
int |
size()
the number of symbols |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected static java.util.Hashtable packages
public static Package globalPackage
protected transient pnuts.lang.SymbolTable table
protected transient java.util.Vector children
protected transient Package parent
protected java.lang.String name
public pnuts.lang.SymbolTable autoloadTable
protected pnuts.lang.SymbolTable unitTable
protected pnuts.lang.SymbolTable requireTable
Constructor Detail |
public Package()
protected Package(java.lang.String name)
Method Detail |
public static Package getGlobalPackage()
public static void setPackageFactory(PackageFactory factory)
public static Package getPackage(java.lang.String pkg)
public boolean defined(java.lang.String name)
public boolean defined(java.lang.String name, Context context)
public java.lang.Object get(java.lang.String symbol)
aProperty . name
public java.lang.Object get(java.lang.String name, Context context)
symbol
- a name in the packagecontext
- the context in which the symbol is referenced. null means "not specified".public void set(java.lang.String symbol, java.lang.Object obj)
sym
- a name of variableobj
- the value of the variablepublic void set(java.lang.String symbol, java.lang.Object obj, Context context)
symbol
- a name of variableobj
- the value of the variablepublic void clear(java.lang.String symbol)
symbol
- a name of variable to be deletedpublic void clear(java.lang.String symbol, Context context)
symbol
- a name of variable to be deletedpublic static void remove(java.lang.String name)
public static Package find(java.lang.String pkg)
pkg
- a name of package to lookpublic static void reset()
protected void init()
protected void init(Context context)
public java.lang.String getName()
public java.util.Enumeration keys()
public int size()
protected Value lookup(java.lang.String symbol, Context context)
symbol
- intern'ed stringpublic void save(java.io.OutputStream s)
public java.util.Enumeration elements()
public static void registerQuantityFactory(java.lang.String unit, QuantityFactory fac)
public java.lang.Object clone()
public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |