robocode.naval
Class ComponentBase.HiddenComponentHelper

java.lang.Object
  extended by robocode.naval.ComponentBase.HiddenComponentHelper
All Implemented Interfaces:
net.sf.robocode.security.IHiddenComponentHelper, net.sf.robocode.serialization.ISerializableHelper
Enclosing class:
ComponentBase

protected abstract static class ComponentBase.HiddenComponentHelper
extends Object
implements net.sf.robocode.serialization.ISerializableHelper, net.sf.robocode.security.IHiddenComponentHelper

Only visible towards subclasses.

This class is used for the serialization of a component. Sub-classes of this class have to expand on this to serialize the super class.

Since:
1.8.3.0 Alpha 1
Version:
0.1
Author:
Thales B.V. / Jiri Waning

Constructor Summary
protected ComponentBase.HiddenComponentHelper()
           
 
Method Summary
 Object deserialize(net.sf.robocode.serialization.RbSerializer serializer, ByteBuffer buffer)
          De-serialize the base component and request the sub-class to de-serialize itself too.
protected abstract  void deserializeSub(net.sf.robocode.serialization.RbSerializer serializer, ByteBuffer buffer, Object component)
          De-serialize the subclass of this super class.
protected abstract  ComponentBase getObject()
          Get an empty object to work with.
protected abstract  int getSize(net.sf.robocode.serialization.RbSerializer serializer, Object object)
           
 void serialize(net.sf.robocode.serialization.RbSerializer serializer, ByteBuffer buffer, Object object)
          Serialize the base component and request the sub-class to serialize itself too.
protected abstract  void serializeSub(net.sf.robocode.serialization.RbSerializer serializer, ByteBuffer buffer, Object object)
           
 int sizeOf(net.sf.robocode.serialization.RbSerializer serializer, Object object)
          Add the size of the base component and request the sub-class to add his additional size too.
 void update(ComponentBase component)
           
abstract  void updateSub(ComponentBase component)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ComponentBase.HiddenComponentHelper

protected ComponentBase.HiddenComponentHelper()
Method Detail

update

public final void update(ComponentBase component)
Specified by:
update in interface net.sf.robocode.security.IHiddenComponentHelper

updateSub

public abstract void updateSub(ComponentBase component)

sizeOf

public final int sizeOf(net.sf.robocode.serialization.RbSerializer serializer,
                        Object object)
Add the size of the base component and request the sub-class to add his additional size too.

Specified by:
sizeOf in interface net.sf.robocode.serialization.ISerializableHelper

getSize

protected abstract int getSize(net.sf.robocode.serialization.RbSerializer serializer,
                               Object object)

serialize

public final void serialize(net.sf.robocode.serialization.RbSerializer serializer,
                            ByteBuffer buffer,
                            Object object)
Serialize the base component and request the sub-class to serialize itself too.

Specified by:
serialize in interface net.sf.robocode.serialization.ISerializableHelper

serializeSub

protected abstract void serializeSub(net.sf.robocode.serialization.RbSerializer serializer,
                                     ByteBuffer buffer,
                                     Object object)

deserialize

public final Object deserialize(net.sf.robocode.serialization.RbSerializer serializer,
                                ByteBuffer buffer)
De-serialize the base component and request the sub-class to de-serialize itself too.

Specified by:
deserialize in interface net.sf.robocode.serialization.ISerializableHelper

deserializeSub

protected abstract void deserializeSub(net.sf.robocode.serialization.RbSerializer serializer,
                                       ByteBuffer buffer,
                                       Object component)
De-serialize the subclass of this super class.

Parameters:
serializer - The serializer that does the transcoding.
buffer - The buffer in which the data is stored.
component - The component to whom to restore the values.

getObject

protected abstract ComponentBase getObject()
Get an empty object to work with.

The object has to come from the subclass of RobotComponent.

Returns:
A new empty subclass.


Copyright © 2015 Robocode. All Rights Reserved.