neosim.implementation
Class NeosimClassesImpl

java.lang.Object
  |
  +--neosim.implementation.NeosimClassesImpl

public class NeosimClassesImpl
extends java.lang.Object
implements NeosimClasses


Constructor Summary
NeosimClassesImpl()
           
 
Method Summary
 ClassID addClass(NeosimClass nc)
          Add a class to the registry
 byte[] getByteArray(java.lang.Object o)
          Convert an instance into an array of bytes (object serialization)
 NeosimClass getClassFromID(ClassID cid)
          Return a class from an integer id
 NeosimClass getClassFromName(java.lang.String name)
          Return a class from a name
 ClassID getClassIDFromName(java.lang.String name)
          Return a class id from a name
 java.lang.Object readFromArray(byte[] a)
          Read an object from an array of bytes
 ClassID registerClass(java.lang.String name, java.lang.String parent, java.lang.String pkg)
          Register a class given name, parent, and package.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NeosimClassesImpl

public NeosimClassesImpl()
Method Detail

getClassFromID

public NeosimClass getClassFromID(ClassID cid)
Return a class from an integer id
Specified by:
getClassFromID in interface NeosimClasses
Parameters:
cid - the class id
Returns:
the NeosimClass, or null if an invalid id

getClassFromName

public NeosimClass getClassFromName(java.lang.String name)
Return a class from a name
Specified by:
getClassFromName in interface NeosimClasses
Parameters:
name - the name of the class
Returns:
the NeosimClass, or null if not found

getClassIDFromName

public ClassID getClassIDFromName(java.lang.String name)
Return a class id from a name
Specified by:
getClassIDFromName in interface NeosimClasses
Parameters:
name - the name of the class
Returns:
the ClassID, or -1 if an invalid name

addClass

public ClassID addClass(NeosimClass nc)
Add a class to the registry
Specified by:
addClass in interface NeosimClasses
Parameters:
nc - the class to add
Returns:
the id of the class

registerClass

public ClassID registerClass(java.lang.String name,
                             java.lang.String parent,
                             java.lang.String pkg)
Register a class given name, parent, and package. e.g. registerClass( "SpikeEvent", "Event", "neosim.kernel" )
Specified by:
registerClass in interface NeosimClasses
Parameters:
name - the name of the class
parent - the name of the parent

getByteArray

public byte[] getByteArray(java.lang.Object o)
Convert an instance into an array of bytes (object serialization)
Specified by:
getByteArray in interface NeosimClasses
Parameters:
o - the object to convert
Returns:
the array of bytes

readFromArray

public java.lang.Object readFromArray(byte[] a)
Read an object from an array of bytes
Specified by:
readFromArray in interface NeosimClasses
Parameters:
a - the array
Returns:
the object