All Packages This Package Class Hierarchy Class Search Index
java.lang.Object | +----edu.utah.janos.antsr.core.CodeGroup
Summary |
class CodeGroup extends java.lang.Object { // Fields 8 static final int CHUNK_SIZE; int availChunkMask; boolean builtin; int chunkCount; final Vector classes; final TypeID groupID; final TypeID[] groupIDs; final TypeID protocolID; // Constructors 1 CodeGroup(TypeID, TypeID[], TypeID, boolean); // Methods 7 static int codeChunkCount(byte[]); final void activate(Node, boolean) throws ClassNotFoundException; final void add(CapsuleClass) throws FullCodeGroupException; final boolean builtin(); final int chunkMask(int); final void register(Node) throws ClassNotFoundException; public String toString(); }
A record collecting information about methods into a related group. The CodeGroup is the unit of code forwarding.
This class is only used internally in ANTSR and is part of the dynamic code loading infrastructure.
The fields of CodeGroup have package access since a CodeGroup may be in many different states of completion during code loading and protocol registration.
A protocol is composed of several CodeGroups.
See Also: Protocol
Cross Reference |
Fields |
· classes | Summary | Top |
final Vector classes
The CapsuleClasses comprising the CodeGroup. XXX make into an array?
· groupID | Summary | Top |
final TypeID groupID
· groupIDs | Summary | Top |
final TypeID[] groupIDs
groupIDs may or may not be necessary. Currently, it's only used to fill in the group ID list in a DLResponse capsule. groupIDs holds the groupID of every group in the protocol. This may be useful for checking that a group really is a member of the protocol: a group belongs to a protocol only if it is in the group ID list and the group ID list hashes to the protocol ID. We may not need this, though.
The groupIDs is fixed at instantiation time. The contents of this array should not be modified by anyone.
· protocolID | Summary | Top |
final TypeID protocolID
ProtocolID is computed from the Vector of GroupIDs. This is the only link from a CodeGroup up to its Protocol.
It may seem wasteful to store the ProtocolID in each CodeGroup in a Protocol, but remember, Protocol objects only exist at application nodes. Shipping the Protocol object just to give internal nodes a handle on the ProtocolID would be even more wasteful.
· chunkCount | Summary | Top |
int chunkCount
The number of chunks of size CHUNK_SIZE that are required to ship this CodeGroup.
There is a hard limit of 32 chunks in a CodeGroup. (Because the set of chunks in a CodeGroup a node has loaded must fit in a 32-bit mask.)
Each CapsuleClass in the CodeGroup will require a set number of chunks to transport. Sadly, chunks for distinct CapsuleClasses are not compressed together, i.e., two CapsuleClasses of CHUNK_SIZE+4 will require 4 chunks to ship.
See Also: CHUNK_SIZE, initChunkCount, availChunkMask
· availChunkMask | Summary | Top |
int availChunkMask
A bit vector indicating which code chunks are available on this node. Extra bits are 1 (i.e., if a CodeGroup has four chunks, and all four are loaded and available all of the bits in the availChunkMask will be set.
XXX add availChunkMask() function. XXX make this a long?!
· builtin | Summary | Top |
boolean builtin
Flag if this class is a builtin class.
· CHUNK_SIZE | Summary | Top |
static final int CHUNK_SIZE
Code to be shipped over the net is broken into chunks no bigger than this value.
XXX ideally this value should be a function of the outgoing link's MTU.
See Also: initChunkCount, codeChunkCount
Constructors |
· CodeGroup | Summary | Top |
CodeGroup(TypeID groupID, TypeID[] groupIDs, TypeID protocolID, boolean builtin)
Create a new (empty) CodeGroup with the given groupID and protocolID.
Parameter Description groupID The group ID for this CodeGroup.
Methods |
· builtin | Summary | Top |
final boolean builtin()
· chunkMask | Summary | Top |
final int chunkMask(int i)
Compute a mask for chunk i. Fills in all unused chunk fields with 1. Thus the result can be read as a bit mask with 0's indicating which chunks are part of the CodeGroup except chunk i is set.
Parameter Description i the chunk index
- Returns:
- a bit-vector indicating which chunks are available.
· codeChunkCount | Summary | Top |
static int codeChunkCount(byte[] code)
Determine the number of chunks the given code array will be broken into.
XXX rename to chunkCountForCode()
- Returns:
- the number chunks the given code array will be broken into.
· register | Summary | Top |
final void register(Node node) throws ClassNotFoundException
Register a CodeGroup with the current flow. Essentially this just means that objects created from group classes can be instantiated and sent, but dispatching is taken care of by another flow.
Parameter Description node The node to register this group with
· activate | Summary | Top |
final void activate(Node node, boolean actuallyActive) throws ClassNotFoundException
Activate this CodeGroup. All classes in the CodeGroup are registered with the flow, and instances of all the various Capsules classes are created. If the CodeGroup is "actually active", then InChannels are registered for DLRequests and MIDIDRequests for the protocol. Any existing packets queued up for this protocol are forwarded to the new InChannels.
Invoked by Protocol.activate() and DLResponseCapsule.evaluate().
Parameter Description node the Node to get the waiting packets off of actuallyActive flag to indicate if this CodeGroup should have InChannels created for it.
· add | Summary | Top |
final void add(CapsuleClass cc) throws FullCodeGroupException
Add a capsule to the code group.
- Throws: FullCodeGroupException
- if the CodeGroup has too many chunks (currently the limit is 32).
· toString | Summary | Top |
public String toString()
- Overrides:
- toString in class Object
All Packages This Package Class Hierarchy Class Search IndexFreshly brewed Java API Documentation automatically generated with polardoc Version 1.0.7