org.jclarion.clarion
Class ClarionMemoryModel

java.lang.Object
  extended by org.jclarion.clarion.ClarionMemoryModel
All Implemented Interfaces:
Threaded
Direct Known Subclasses:
ClarionGroup, ClarionObject, ManyGlue, RefVariable

public abstract class ClarionMemoryModel
extends java.lang.Object
implements Threaded

Model clarion object on memory.

Author:
barney

Nested Class Summary
static class ClarionMemoryModel.State
           
 
Constructor Summary
ClarionMemoryModel()
           
ClarionMemoryModel(ClarionMemoryModel base, java.lang.Thread lock)
           
 
Method Summary
 void addChangeListener(ClarionMemoryChangeListener cmcl)
          Listen for changes to the objects representation.
 void addChangeListener(ClarionMemoryChangeListener cmcl, boolean strong)
           
 ClarionMemoryModel castTo(java.lang.Class<? extends ClarionMemoryModel> clazz)
           
abstract  void deserialize(java.io.InputStream os)
          Read object from memory as clarion would represent object in memory
 int getListenerCount()
           
 void initThread()
           
 boolean isAnyoneInterestedInChange()
           
 boolean isThreaded()
           
protected  void lock(ClarionMemoryModel base, java.lang.Thread t)
           
 void notifyChange()
           
 void removeChangeListener(ClarionMemoryChangeListener cmcl)
          Stop Listening for changes to the objects representation
abstract  void serialize(java.io.OutputStream is)
          Write java object to memory as clarion would represent object in memory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jclarion.clarion.Threaded
getLockedObject
 

Constructor Detail

ClarionMemoryModel

public ClarionMemoryModel()

ClarionMemoryModel

public ClarionMemoryModel(ClarionMemoryModel base,
                          java.lang.Thread lock)
Method Detail

lock

protected void lock(ClarionMemoryModel base,
                    java.lang.Thread t)

castTo

public ClarionMemoryModel castTo(java.lang.Class<? extends ClarionMemoryModel> clazz)

initThread

public void initThread()
Specified by:
initThread in interface Threaded

serialize

public abstract void serialize(java.io.OutputStream is)
                        throws java.io.IOException
Write java object to memory as clarion would represent object in memory

Parameters:
is -
Throws:
java.io.IOException

deserialize

public abstract void deserialize(java.io.InputStream os)
                          throws java.io.IOException
Read object from memory as clarion would represent object in memory

Throws:
java.io.IOException

addChangeListener

public void addChangeListener(ClarionMemoryChangeListener cmcl)
Listen for changes to the objects representation. Note that listener is weakly referenced. You need to maintain a strong reference to the listener object in order for it not to be garbage collected

Parameters:
cmcl -

addChangeListener

public void addChangeListener(ClarionMemoryChangeListener cmcl,
                              boolean strong)

removeChangeListener

public void removeChangeListener(ClarionMemoryChangeListener cmcl)
Stop Listening for changes to the objects representation

Parameters:
cmcl -

isAnyoneInterestedInChange

public boolean isAnyoneInterestedInChange()

getListenerCount

public int getListenerCount()

notifyChange

public void notifyChange()

isThreaded

public final boolean isThreaded()
Specified by:
isThreaded in interface Threaded


Copyright © 2010. All Rights Reserved.