Java Doc for Package.java in  » Scripting » Pnuts » pnuts » lang » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Scripting » Pnuts » pnuts.lang 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   pnuts.lang.SymbolTable
      pnuts.lang.Package

Package
public class Package extends SymbolTable implements Property,Serializable,Cloneable(Code)
This class represents a Pnuts' package (not Java's).

Inner Class :class DelayedExports implements AutoloadHook,Serializable

Field Summary
protected  SymbolTableautoloadTable
    
protected  SymbolTableexportedSymbols
    
protected  booleanexports
    
final public static  PackageglobalPackage
     The package with name "".
protected  booleaninitialized
    
transient  ObjectmoduleIntializationLock
    
protected  Stringname
     The name of the package.
protected transient  Hashtablepackages
    
protected transient  Packageparent
    
protected  VectorprovidedModuleNames
    
protected  VectorrequiredModuleNames
    
protected transient  Packageroot
    
final static  longserialVersionUID
    
protected  booleanusedAsModule
    

Constructor Summary
public  Package()
     Creates a package that is not visible from other packages.
public  Package(String name)
     Creates a package and register it in a static hashtable.
public  Package(String name, Package parent)
     Creates a package and register it in a static hashtable.
protected  Package(String name, Package parent, Package root)
     Creates a package and register it in a static hashtable.

Method Summary
protected  voidaddPackage(Package pkg, Context context)
    
public  MapasMap()
    
public  voidautoload(String name, String file, Context context)
     Registers an autoload script for the name.
public  voidautoload(String name, AutoloadHook hook)
     Registers an AutoloadHook for the name.
public  voidclear(String symbol, Context context)
     Deletes a symbol from the package.
public  Objectclone()
     Returns a clone package.
public  booleandefined(String name, Context context)
     Checks if the specified name is already defined in this package.
public  Enumerationelements()
    
public  voidexport(String name)
    
 voidexportFunction(String sym, Object value)
    
 voidexportFunctions()
    
public static  Packagefind(String pkg)
     Find a named package.
Parameters:
  pkg - a name of package to look.
public static  Packagefind(String pkg, Context context)
     Find a named package.
Parameters:
  pkg - a name of package to look.
public  Objectget(String symbol, Context context)
     Get the value of a symbol in the package.
public static  PackagegetGlobalPackage()
    
 StringgetInitScript()
    
static  StringgetInitScript(String name, String delimiter)
    
static  PackagegetInstance(String name, Package parent, Context context)
    
public  StringgetName()
    
public static  PackagegetPackage(String pkg)
     If package "pkg" exists returns the package, otherwise creates and returns it.
public static  PackagegetPackage(String pkg, Context context)
     If package "pkg" exists returns the package, otherwise creates and returns it.
public  PackagegetParent()
     Returns the parent package.
protected synchronized  voidinit(Context context)
     This method is called when the package become the current package with package() function.
protected synchronized  voidinitializeModule()
     Starts using this package as a module.
public  NamedValuelookup(String symbol, Context context)
     Looks up a symbol in this package.
 NamedValuelookupExportedSymbol(String symbol, Context context)
    
protected  NamedValuelookupRecursively(String symbol, Context context)
     Lookup the symbol in the package.
public  PackagenewInstance(String name)
     Creates an uninitialized instance of a Package subclass When a sub-package is created, this method is called.
public static  voidremove(String name)
     Removes the specified package.
public static  voidremove(String name, Context context)
     Removes the specified package.
protected  voidremovePackage(Package pkg, Context context)
    
public  voidset(String symbol, Object obj, Context context)
     Set a value of a symbol in the package.
public  StringtoString()
    
public static  Packagewrap(Map map)
    

Field Detail
autoloadTable
protected SymbolTable autoloadTable(Code)



exportedSymbols
protected SymbolTable exportedSymbols(Code)



exports
protected boolean exports(Code)



globalPackage
final public static Package globalPackage(Code)
The package with name "".



initialized
protected boolean initialized(Code)



moduleIntializationLock
transient Object moduleIntializationLock(Code)



name
protected String name(Code)
The name of the package.



packages
protected transient Hashtable packages(Code)
All packages with a non-null name



parent
protected transient Package parent(Code)



providedModuleNames
protected Vector providedModuleNames(Code)



requiredModuleNames
protected Vector requiredModuleNames(Code)



root
protected transient Package root(Code)



serialVersionUID
final static long serialVersionUID(Code)



usedAsModule
protected boolean usedAsModule(Code)




Constructor Detail
Package
public Package()(Code)
Creates a package that is not visible from other packages.



Package
public Package(String name)(Code)
Creates a package and register it in a static hashtable.
Parameters:
  name - the name of the package



Package
public Package(String name, Package parent)(Code)
Creates a package and register it in a static hashtable. The method get() tries to find a symbol in this package and then consult the parent package. Other instance methods, such as set(), defined(), operates on this package only. Other constructors implicitly specify the global package as the parent package.
Parameters:
  name - the name of the package
Parameters:
  parent - the parent package.



Package
protected Package(String name, Package parent, Package root)(Code)
Creates a package and register it in a static hashtable. The method get() tries to find a symbol in this package and then consult the parent package. Other instance methods, such as set(), defined(), operates on this package only. Other constructors implicitly specify the global package as the parent package.
Parameters:
  name - the name of the package
Parameters:
  parent - the parent package.
Parameters:
  root - the root package.




Method Detail
addPackage
protected void addPackage(Package pkg, Context context)(Code)



asMap
public Map asMap()(Code)
Returns a Map object that wraps this package



autoload
public void autoload(String name, String file, Context context)(Code)
Registers an autoload script for the name. If name is not defined when accessed, the registerred file is loaded.
Parameters:
  name - variable name
Parameters:
  file - the file
Parameters:
  context - the context



autoload
public void autoload(String name, AutoloadHook hook)(Code)
Registers an AutoloadHook for the name. If name is not defined when accessed, the registerred AutoloadHook is executed.
Parameters:
  name - variable name
Parameters:
  hook - the AutoloadHook



clear
public void clear(String symbol, Context context)(Code)
Deletes a symbol from the package.
Parameters:
  symbol - a name of variable to be deleted



clone
public Object clone()(Code)
Returns a clone package.



defined
public boolean defined(String name, Context context)(Code)
Checks if the specified name is already defined in this package. true if name is defined in the package.



elements
public Enumeration elements()(Code)
Enumerates sub-packages



export
public void export(String name)(Code)
Exports a symbol of the module
Parameters:
  name - the symbol
exception:
  IllegalStateException - when the package is not used as a module.



exportFunction
void exportFunction(String sym, Object value)(Code)



exportFunctions
void exportFunctions()(Code)



find
public static Package find(String pkg)(Code)
Find a named package.
Parameters:
  pkg - a name of package to look. a package with name "pkg" if it exits.



find
public static Package find(String pkg, Context context)(Code)
Find a named package.
Parameters:
  pkg - a name of package to look. a package with name "pkg" if it exits.



get
public Object get(String symbol, Context context)(Code)
Get the value of a symbol in the package. When the symbol is not defined in the package, first, the associated autoloading hook is invoked if any, second, get the value in the parent package.
Parameters:
  symbol - an interned name in the package
Parameters:
  context - the context in which the symbol is referenced. null means "notspecified". the value of specified variable in the package.



getGlobalPackage
public static Package getGlobalPackage()(Code)
the global package



getInitScript
String getInitScript()(Code)



getInitScript
static String getInitScript(String name, String delimiter)(Code)



getInstance
static Package getInstance(String name, Package parent, Context context)(Code)



getName
public String getName()(Code)
the name of the package.



getPackage
public static Package getPackage(String pkg)(Code)
If package "pkg" exists returns the package, otherwise creates and returns it.



getPackage
public static Package getPackage(String pkg, Context context)(Code)
If package "pkg" exists returns the package, otherwise creates and returns it.



getParent
public Package getParent()(Code)
Returns the parent package.



init
protected synchronized void init(Context context)(Code)
This method is called when the package become the current package with package() function. This method in a subclass must call super.init(context) first.



initializeModule
protected synchronized void initializeModule()(Code)
Starts using this package as a module.



lookup
public NamedValue lookup(String symbol, Context context)(Code)
Looks up a symbol in this package. If not defined, the associated autoloading hook is invoked if any.
Parameters:
  symbol - an interned String
Parameters:
  context - the context a NamedValue



lookupExportedSymbol
NamedValue lookupExportedSymbol(String symbol, Context context)(Code)



lookupRecursively
protected NamedValue lookupRecursively(String symbol, Context context)(Code)
Lookup the symbol in the package. When the symbol is not defined in the package and this.parent is not null, lookup the symbol in the parent package. Resulting value is an instance of NamedValue.
Parameters:
  symbol - intern'ed string



newInstance
public Package newInstance(String name)(Code)
Creates an uninitialized instance of a Package subclass When a sub-package is created, this method is called.
Parameters:
  name - the package name a Package object



remove
public static void remove(String name)(Code)
Removes the specified package.



remove
public static void remove(String name, Context context)(Code)
Removes the specified package.



removePackage
protected void removePackage(Package pkg, Context context)(Code)



set
public void set(String symbol, Object obj, Context context)(Code)
Set a value of a symbol in the package. If this package is "used" in the specified context, and if the target object is either a Class object or a function whose name matches the symbol, then the symbol is imported to the context.
Parameters:
  symbol - an interned name of variable
Parameters:
  obj - the value of the variable



toString
public String toString()(Code)



wrap
public static Package wrap(Map map)(Code)
Returns a Package object that wrap the specified Map



Fields inherited from pnuts.lang.SymbolTable
int count(Code)(Java Doc)
SymbolTable parent(Code)(Java Doc)
final static long serialVersionUID(Code)(Java Doc)
transient Binding[] table(Code)(Java Doc)

Methods inherited from pnuts.lang.SymbolTable
synchronized void addBinding(int hash, String interned, Object value, int index)(Code)(Java Doc)
synchronized void addConstant(int hash, String interned, Object value, int index)(Code)(Java Doc)
synchronized void assign(String interned, Object value)(Code)(Java Doc)
public Enumeration bindings()(Code)(Java Doc)
public synchronized void clear()(Code)(Java Doc)
public Object clone()(Code)(Java Doc)
void ensureCapacity(int newCapacity)(Code)(Java Doc)
public synchronized Object get(String interned)(Code)(Java Doc)
public Enumeration keys()(Code)(Java Doc)
public synchronized NamedValue lookup(String interned)(Code)(Java Doc)
synchronized Binding lookup0(String interned)(Code)(Java Doc)
synchronized Binding removeBinding(String interned)(Code)(Java Doc)
public synchronized void set(String interned, Object value)(Code)(Java Doc)
public synchronized void setConstant(String interned, Object value)(Code)(Java Doc)
public int size()(Code)(Java Doc)
public Enumeration values()(Code)(Java Doc)

Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.