com.microcrowd.loader.java3d.max3ds.chunks
Class Chunk

java.lang.Object
  extended by com.microcrowd.loader.java3d.max3ds.chunks.Chunk
Direct Known Subclasses:
AxisChunk, BooleanChunk, BoundingBoxChunk, CameraChunk, ColorChunk, FacesDescriptionChunk, FacesMaterialChunk, FloatChunk, FramesChunk, FramesDescriptionChunk, HierarchyInfoChunk, KeyFramerInfoChunk, LightChunk, MaterialChunk, NamedObjectChunk, PercentageChunk, PivotChunk, PositionChunk, RotationChunk, ScaleChunk, SmoothingChunk, SpotLightChunk, StringChunk, TextureChunk, Vertex2ListChunk, Vertex3ListChunk

public class Chunk
extends java.lang.Object

The base class for all chunks. Chunks are flyweights and should be managed by ChunkChopper Every chunk should know how many bytes of data(or be able figure out) to read before its subchunks are found. Chunks that only have subchunks need not overrided loadData. Chunks may store data for later use in loadData with pushData If a chunk needs to initialize components with from subchunks, that data can be retrieved with ChunkChopper.popData(java.lang.Object) inside the initialize(com.microcrowd.loader.java3d.max3ds.ChunkChopper) method. loadData(com.microcrowd.loader.java3d.max3ds.ChunkChopper) is called at the beginning of the loading process, before any data or subchunks have been loaded(the chunk itself must load its data).

During loadData, if the length of data before subchunks is unknown, ChunkChopper.getChunkBytes() may be called and all the data for the chunk(including subchunks) will be read and returned.


Constructor Summary
Chunk()
          default no-arg constructror.
Chunk(java.lang.String chunkName)
          default no-arg constructror.
 
Method Summary
 void addSubChunk(java.lang.Integer id, Chunk subChunk)
           
 java.lang.String getDescription()
           
 java.lang.String getName()
          Gets a human readable name for the chunk.
 Chunk getSubChunk(java.lang.Integer id)
           
 void initialize(ChunkChopper chopper)
          This method is called after all the current chunks subchunks are loaded.
 void loadData(ChunkChopper chopper)
          This is called by the chunk chopper before any of the chunk's subchunks are loaded.
 void setDescription(java.lang.String desc)
           
 void setName(java.lang.String name)
          Sets nice human readable name for the chunk.
 java.lang.String toString()
          Returns the name of this chunk.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Chunk

public Chunk(java.lang.String chunkName)
default no-arg constructror.


Chunk

public Chunk()
default no-arg constructror.

Method Detail

addSubChunk

public void addSubChunk(java.lang.Integer id,
                        Chunk subChunk)

getSubChunk

public Chunk getSubChunk(java.lang.Integer id)

initialize

public void initialize(ChunkChopper chopper)
This method is called after all the current chunks subchunks are loaded. Any data stored by those subchunks may be retrieved via ChunkChopper.popData(java.lang.Object) The default implementation does nothing.

Parameters:
chopper - may contain data loaded by subchunks.

loadData

public void loadData(ChunkChopper chopper)
This is called by the chunk chopper before any of the chunk's subchunks are loaded. Any data loaded that may need to be used later by superchunks should be stored in the chunk chopper via ChunkChopper.popData(java.lang.Object) The default implementation does nothing.

Parameters:
chopper - may contain data loaded by subchunks.

setName

public final void setName(java.lang.String name)
Sets nice human readable name for the chunk.

Parameters:
name - to use for display of this chunk.

getName

public final java.lang.String getName()
Gets a human readable name for the chunk.

Returns:
name used to display the chunk.

getDescription

public final java.lang.String getDescription()

setDescription

public final void setDescription(java.lang.String desc)

toString

public java.lang.String toString()
Returns the name of this chunk. If the name is null then it just returns the unqualified class name.

Overrides:
toString in class java.lang.Object


Copyright © 2000-2011 Microcrowd. All Rights Reserved.