Gridarta Editor
net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?> Class Template Referenceabstract

Abstract base class for archetype set loader classes. More...

+ Inheritance diagram for net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>:
+ Collaboration diagram for net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>:

Public Member Functions

abstract FaceProvider read (@NotNull ErrorView errorView, @NotNull List< G > invObjects)
 Reads the resources. More...
 

Protected Member Functions

 AbstractResourcesReader (@NotNull final File collectedDirectory, @Nullable final String imageSet, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjects faceObjects)
 Creates a new instance. More...
 
void addPNGFace (@NotNull final String filename, @NotNull final String path, @NotNull final String name, @NotNull final ErrorView errorView, @NotNull final ArchFaceProvider archFaceProvider)
 Loads a png from the file, convert it to IconImage and attach it to the face list. More...
 
void loadAnimationsFromCollect (@NotNull final ErrorView errorView, @NotNull final Map< String, String > animations)
 Loads all animations from the big collected animations file. More...
 

Static Protected Member Functions

static Map< String, String > loadAnimTree (@NotNull final URL url) throws IOException
 Loads animations from a file. More...
 

Private Member Functions

String generateFaceName (@NotNull final String name)
 Generates the facename for a face. More...
 

Static Private Member Functions

static Map< String, String > loadAnimTree (@NotNull final BufferedReader reader) throws IOException
 Reads Animation Tree from Stream. More...
 

Private Attributes

final AnimationObjects animationObjects
 The animation objects instance. More...
 
final File collectedDirectory
 The collected directory. More...
 
final FaceObjects faceObjects
 The face objects instance. More...
 
final String imageSet
 The current image set. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 Action Builder. More...
 
static final Category LOG = Logger.getLogger(AbstractResourcesReader.class)
 The logger for printing log messages. More...
 

Detailed Description

Abstract base class for archetype set loader classes.

Author
Michael Toennies
Andreas Vogl
Christian Hujer
Andreas Kirschbaum

Definition at line 60 of file AbstractResourcesReader.java.

Constructor & Destructor Documentation

◆ AbstractResourcesReader()

net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.AbstractResourcesReader ( @NotNull final File  collectedDirectory,
@Nullable final String  imageSet,
@NotNull final AnimationObjects  animationObjects,
@NotNull final FaceObjects  faceObjects 
)
protected

Creates a new instance.

Parameters
collectedDirectorythe collected directory
imageSetthe active image set or
null
animationObjectsthe animation objects instance
faceObjectsthe face objects instance

Definition at line 106 of file AbstractResourcesReader.java.

Member Function Documentation

◆ addPNGFace()

void net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.addPNGFace ( @NotNull final String  filename,
@NotNull final String  path,
@NotNull final String  name,
@NotNull final ErrorView  errorView,
@NotNull final ArchFaceProvider  archFaceProvider 
)
protected

Loads a png from the file, convert it to IconImage and attach it to the face list.

Parameters
filenamethe filename, an absolute path
paththe path name of
name
namethe name of the png (e.g. blocked.111.png)
errorViewthe error view to use
archFaceProviderthe arch face provider to add to

Definition at line 155 of file AbstractResourcesReader.java.

◆ generateFaceName()

String net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.generateFaceName ( @NotNull final String  name)
private

Generates the facename for a face.

Parameters
namethe filename to generate facename from
Returns
the facename generated from
name

Definition at line 173 of file AbstractResourcesReader.java.

Referenced by net.sf.gridarta.model.resource.AbstractResourcesReader< G >.addPNGFace().

+ Here is the caller graph for this function:

◆ loadAnimationsFromCollect()

void net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.loadAnimationsFromCollect ( @NotNull final ErrorView  errorView,
@NotNull final Map< String, String >  animations 
)
protected

Loads all animations from the big collected animations file.

Parameters
errorViewthe error view for reporting errors
animationsmaps animation name to animation path

Definition at line 118 of file AbstractResourcesReader.java.

◆ loadAnimTree() [1/2]

static Map<String, String> net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.loadAnimTree ( @NotNull final URL  url) throws IOException
staticprotected

Loads animations from a file.

Parameters
urlthe URL to load animations tree from
Returns
a map from animation name to animation path
Exceptions
IOExceptionin case of I/O errors
java.io.FileNotFoundExceptionin case the file couldn't be opened

Definition at line 219 of file AbstractResourcesReader.java.

Referenced by net.sf.gridarta.model.resource.AbstractResourcesReader< G >.loadAnimTree().

+ Here is the caller graph for this function:

◆ loadAnimTree() [2/2]

static Map<String, String> net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.loadAnimTree ( @NotNull final BufferedReader  reader) throws IOException
staticprivate

Reads Animation Tree from Stream.

Parameters
readerInput stream
Returns
a map from animation name to animation path
Exceptions
IOExceptionin case of I/O errors

Definition at line 241 of file AbstractResourcesReader.java.

◆ read()

abstract FaceProvider net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.read ( @NotNull ErrorView  errorView,
@NotNull List< G >  invObjects 
)
abstract

Reads the resources.

Parameters
errorViewthe error view for reporting problems
invObjectsall read archetypes are added to this list
Returns
the face provider for accessing the read faces

Referenced by net.sf.gridarta.model.resource.AbstractResourcesReader< G >.generateFaceName(), and net.sf.gridarta.model.resource.AbstractFilesResourcesReaderTest.readAnimations().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

Action Builder.

Definition at line 66 of file AbstractResourcesReader.java.

◆ animationObjects

final AnimationObjects net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.animationObjects
private

The animation objects instance.

Definition at line 91 of file AbstractResourcesReader.java.

Referenced by net.sf.gridarta.model.resource.AbstractResourcesReader< G >.AbstractResourcesReader().

◆ collectedDirectory

final File net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.collectedDirectory
private

◆ faceObjects

◆ imageSet

final String net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.imageSet
private

The current image set.

Set to

null

if no explicit image set is used.

Definition at line 85 of file AbstractResourcesReader.java.

Referenced by net.sf.gridarta.model.resource.AbstractResourcesReader< G >.AbstractResourcesReader().

◆ LOG

final Category net.sf.gridarta.model.resource.AbstractResourcesReader< G extends GameObject< G, ?, ?>.LOG = Logger.getLogger(AbstractResourcesReader.class)
staticprivate

The logger for printing log messages.

Definition at line 72 of file AbstractResourcesReader.java.


The documentation for this class was generated from the following file: