Gridarta Editor
net.sf.gridarta.model.io.AbstractAnimationObjectsReader Class Referenceabstract

Utility class for reading AnimationObjects from files. More...

+ Inheritance diagram for net.sf.gridarta.model.io.AbstractAnimationObjectsReader:
+ Collaboration diagram for net.sf.gridarta.model.io.AbstractAnimationObjectsReader:

Public Member Functions

void loadAnimations (@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String path, @NotNull final File animFile, @NotNull final String startKey) throws IOException, AnimationParseException
 Loads animations from a file. More...
 
void loadAnimations (@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, final Reader reader, @NotNull final String startKey, @Nullable final String path, @Nullable final Map< String, String > animations) throws AnimationParseException, IOException
 Loads any number of animations from a reader. More...
 

Protected Member Functions

 AbstractAnimationObjectsReader ()
 Creates a new instance. More...
 
abstract int parseLine (@NotNull String line, int startLineNumber, @NotNull BufferedReader in, @NotNull ErrorViewCollector errorViewCollector) throws AnimationParseException, IOException
 Parses a line. More...
 

Static Private Member Functions

static int processAnimation (@NotNull final String animName, final int startLineNumber, @NotNull final BufferedReader in, @NotNull final String startKey, @NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final String path, @Nullable final Map< String, String > animations) throws AnimationParseException, IOException
 Processes an anim..mina block. More...
 
static void processAnimationLine (@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, @Nullable final String path, @Nullable final Map< String, String > animations, @NotNull final String animName, @NotNull final String animText)
 Processes a complete anim..mina block. More...
 

Detailed Description

Utility class for reading AnimationObjects from files.

Author
Christian Hujer
Andreas Kirschbaum

Definition at line 44 of file AbstractAnimationObjectsReader.java.

Constructor & Destructor Documentation

◆ AbstractAnimationObjectsReader()

net.sf.gridarta.model.io.AbstractAnimationObjectsReader.AbstractAnimationObjectsReader ( )
protected

Creates a new instance.

Definition at line 49 of file AbstractAnimationObjectsReader.java.

Member Function Documentation

◆ loadAnimations() [1/2]

void net.sf.gridarta.model.io.AbstractAnimationObjectsReader.loadAnimations ( @NotNull final AnimationObjects  animationObjects,
@NotNull final ErrorViewCollector  errorViewCollector,
@NotNull final String  path,
@NotNull final File  animFile,
@NotNull final String  startKey 
) throws IOException, AnimationParseException

Loads animations from a file.

Parameters
animationObjectsthe animation objects to update
errorViewCollectorthe error view collector for reporting errors
paththe animation path
animFilefile to load animations from
startKeythe key that begins an animation block; it must end with a space character
Exceptions
IOExceptionin case of I/O errors
java.io.FileNotFoundExceptionin case the file couldn't be opened
AnimationParseExceptionin case parsing the animation reveals errors

Definition at line 66 of file AbstractAnimationObjectsReader.java.

References net.sf.gridarta.utils.IOUtils.MAP_ENCODING.

Referenced by net.sf.gridarta.model.resource.AbstractFilesResourcesReader< TestGameObject, TestMapArchObject, TestArchetype >.loadAnimationsFromFiles(), and net.sf.gridarta.model.resource.AbstractFilesResourcesReader< TestGameObject, TestMapArchObject, TestArchetype >.parseDefFace().

+ Here is the caller graph for this function:

◆ loadAnimations() [2/2]

void net.sf.gridarta.model.io.AbstractAnimationObjectsReader.loadAnimations ( @NotNull final AnimationObjects  animationObjects,
@NotNull final ErrorViewCollector  errorViewCollector,
final Reader  reader,
@NotNull final String  startKey,
@Nullable final String  path,
@Nullable final Map< String, String >  animations 
) throws AnimationParseException, IOException

Loads any number of animations from a reader.

It is not necessary to provide a BufferedReader for buffering. This method will always wrap the supplied

reader

with a BufferedReader if the supplied reader isn't already a BufferedReader itself.

Parameters
animationObjectsthe animation objects to update
errorViewCollectorthe error view collector for reporting errors
readerthe reader to load animations from
startKeythe key that begins an animation block; it must end with a space character
paththe path relative to the arch directory, used to create tree information; either
animations
or this parameter must be non-
null
animationsmaps animation name to animation path; either
path
or this parameter must be non-
null
Exceptions
AnimationParseExceptionin case parsing the animation reveals errors
IOExceptionin case of I/O errors

Definition at line 93 of file AbstractAnimationObjectsReader.java.

References net.sf.gridarta.model.io.AbstractAnimationObjectsReader.parseLine(), and net.sf.gridarta.model.io.AbstractAnimationObjectsReader.processAnimation().

+ Here is the call graph for this function:

◆ parseLine()

abstract int net.sf.gridarta.model.io.AbstractAnimationObjectsReader.parseLine ( @NotNull String  line,
int  startLineNumber,
@NotNull BufferedReader  in,
@NotNull ErrorViewCollector  errorViewCollector 
) throws AnimationParseException, IOException
abstractprotected

Parses a line.

Parameters
linethe current line
startLineNumberthe current line number
inthe reader to read from
errorViewCollectorthe error view collector for reporting errors
Returns
the number of processed lines or -1 if the line could not be parsed
Exceptions
AnimationParseExceptionin case parsing the animation reveals errors
IOExceptionin case of I/O errors

Reimplemented in net.sf.gridarta.model.io.TestAnimationObjectsReader, net.sf.gridarta.var.crossfire.model.io.CrossfireAnimationObjectsReader, net.sf.gridarta.var.atrinik.model.io.AtrinikAnimationObjectsReader, and net.sf.gridarta.var.daimonin.model.io.DaimoninAnimationObjectsReader.

Referenced by net.sf.gridarta.model.io.AbstractAnimationObjectsReader.loadAnimations().

+ Here is the caller graph for this function:

◆ processAnimation()

static int net.sf.gridarta.model.io.AbstractAnimationObjectsReader.processAnimation ( @NotNull final String  animName,
final int  startLineNumber,
@NotNull final BufferedReader  in,
@NotNull final String  startKey,
@NotNull final AnimationObjects  animationObjects,
@NotNull final ErrorViewCollector  errorViewCollector,
@Nullable final String  path,
@Nullable final Map< String, String >  animations 
) throws AnimationParseException, IOException
staticprivate

Processes an anim..mina block.

Parameters
animNamethe name of this animation
startLineNumberthe line number of the anim line
inthe reader to read from
startKeythe "anim" tag name
animationObjectsthe animation objects to update
errorViewCollectorthe error view collector for reporting errors
paththe path relative to the arch directory, used to create tree information; either
animations
or this parameter must be non-
null
animationsmaps animation name to animation path; either
path
or this parameter must be non-
null
Returns
the number of processed lines
Exceptions
AnimationParseExceptionin case parsing the animation reveals errors
IOExceptionin case of I/O errors

Definition at line 158 of file AbstractAnimationObjectsReader.java.

References net.sf.gridarta.model.io.AbstractAnimationObjectsReader.processAnimationLine().

Referenced by net.sf.gridarta.model.io.AbstractAnimationObjectsReader.loadAnimations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ processAnimationLine()

static void net.sf.gridarta.model.io.AbstractAnimationObjectsReader.processAnimationLine ( @NotNull final AnimationObjects  animationObjects,
@NotNull final ErrorViewCollector  errorViewCollector,
@Nullable final String  path,
@Nullable final Map< String, String >  animations,
@NotNull final String  animName,
@NotNull final String  animText 
)
staticprivate

Processes a complete anim..mina block.

Parameters
animationObjectsthe animation objects to update
errorViewCollectorthe error view collector for reporting errors
paththe path relative to the arch directory, used to create tree information; either
animations
or this parameter must be non-
null
animationsmaps animation name to animation path; either
path
or this parameter must be non-
null
animNamethe name of this animation
animTextthe contents of the anim..mina block without comments

Definition at line 194 of file AbstractAnimationObjectsReader.java.

References net.sf.gridarta.model.errorview.ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, net.sf.gridarta.model.anim.IllegalAnimationException.getAnimationObject(), and net.sf.gridarta.model.data.NamedObject.getPath().

Referenced by net.sf.gridarta.model.io.AbstractAnimationObjectsReader.processAnimation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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