Some widening/vararg logging that I've had lying around for ages
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@861 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -30,11 +30,9 @@ import com.samskivert.util.StringUtil;
|
||||
import com.threerings.media.sprite.Sprite;
|
||||
|
||||
/**
|
||||
* The character component represents a single component that can be
|
||||
* composited with other character components to generate an image
|
||||
* representing a complete character displayable in any of the eight
|
||||
* compass directions as detailed in the {@link Sprite} class direction
|
||||
* constants.
|
||||
* The character component represents a single component that can be composited with other
|
||||
* character components to generate an image representing a complete character displayable in any
|
||||
* of the eight compass directions as detailed in the {@link Sprite} class direction constants.
|
||||
*/
|
||||
public class CharacterComponent implements Serializable
|
||||
{
|
||||
@@ -48,11 +46,10 @@ public class CharacterComponent implements Serializable
|
||||
public ComponentClass componentClass;
|
||||
|
||||
/**
|
||||
* Constructs a character component with the specified id of the
|
||||
* specified class.
|
||||
* Constructs a character component with the specified id of the specified class.
|
||||
*/
|
||||
public CharacterComponent (int componentId, String name,
|
||||
ComponentClass compClass, FrameProvider fprov)
|
||||
public CharacterComponent (
|
||||
int componentId, String name, ComponentClass compClass, FrameProvider fprov)
|
||||
{
|
||||
this.componentId = componentId;
|
||||
this.name = name;
|
||||
@@ -60,7 +57,6 @@ public class CharacterComponent implements Serializable
|
||||
_frameProvider = fprov;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the render priority appropriate for this component at the specified action and
|
||||
* orientation.
|
||||
@@ -71,11 +67,11 @@ public class CharacterComponent implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the image frames for the specified action animation or null if
|
||||
* no animation for the specified action is available for this component.
|
||||
* Returns the image frames for the specified action animation or null if no animation for the
|
||||
* specified action is available for this component.
|
||||
*
|
||||
* @param type null for the normal action frames or one of the custom
|
||||
* action sub-types: {@link StandardActions#SHADOW_TYPE}, etc.
|
||||
* @param type null for the normal action frames or one of the custom action sub-types:
|
||||
* {@link StandardActions#SHADOW_TYPE}, etc.
|
||||
*/
|
||||
public ActionFrames getFrames (String action, String type)
|
||||
{
|
||||
@@ -83,11 +79,11 @@ public class CharacterComponent implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the image frames for the specified action animation or null if
|
||||
* no animation for the specified action is available for this component.
|
||||
* Returns the path to the image frames for the specified action animation or null if no
|
||||
* animation for the specified action is available for this component.
|
||||
*
|
||||
* @param type null for the normal action frames or one of the custom
|
||||
* action sub-types: {@link StandardActions#SHADOW_TYPE}, etc.
|
||||
* @param type null for the normal action frames or one of the custom action sub-types:
|
||||
* {@link StandardActions#SHADOW_TYPE}, etc.
|
||||
*
|
||||
* @param existentPaths the set of all paths for which there are valid frames.
|
||||
*/
|
||||
|
||||
@@ -24,48 +24,44 @@ package com.threerings.cast;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* Makes available a collection of character components and associated
|
||||
* metadata. Character components are animated sequences that can be
|
||||
* composited together to create a complete character visualization
|
||||
* (imagine interchanging pairs of boots, torsos, hats, etc.).
|
||||
* Makes available a collection of character components and associated metadata. Character
|
||||
* components are animated sequences that can be composited together to create a complete
|
||||
* character visualization (imagine interchanging pairs of boots, torsos, hats, etc.).
|
||||
*/
|
||||
public interface ComponentRepository
|
||||
{
|
||||
/**
|
||||
* Returns the {@link CharacterComponent} object for the given
|
||||
* component identifier.
|
||||
* Returns the {@link CharacterComponent} object for the given component identifier.
|
||||
*/
|
||||
public CharacterComponent getComponent (int componentId)
|
||||
throws NoSuchComponentException;
|
||||
|
||||
/**
|
||||
* Returns the {@link CharacterComponent} object with the given
|
||||
* component class and name.
|
||||
* Returns the {@link CharacterComponent} object with the given component class and name.
|
||||
*/
|
||||
public CharacterComponent getComponent (String className, String compName)
|
||||
throws NoSuchComponentException;
|
||||
|
||||
/**
|
||||
* Returns the {@link ComponentClass} with the specified name or null
|
||||
* if none exists with that name.
|
||||
* Returns the {@link ComponentClass} with the specified name or null if none exists with that
|
||||
* name.
|
||||
*/
|
||||
public ComponentClass getComponentClass (String className);
|
||||
|
||||
/**
|
||||
* Iterates over the {@link ComponentClass} instances representing all
|
||||
* available character component classes.
|
||||
* Iterates over the {@link ComponentClass} instances representing all available character
|
||||
* component classes.
|
||||
*/
|
||||
public Iterator<ComponentClass> enumerateComponentClasses ();
|
||||
|
||||
/**
|
||||
* Iterates over the {@link ActionSequence} instances representing
|
||||
* every available action sequence.
|
||||
* Iterates over the {@link ActionSequence} instances representing every available action
|
||||
* sequence.
|
||||
*/
|
||||
public Iterator<ActionSequence> enumerateActionSequences ();
|
||||
|
||||
/**
|
||||
* Iterates over the component ids of all components in the specified
|
||||
* class.
|
||||
* Iterates over the component ids of all components in the specified class.
|
||||
*/
|
||||
public Iterator<Integer> enumerateComponentIds (ComponentClass compClass);
|
||||
}
|
||||
|
||||
@@ -47,14 +47,14 @@ import com.threerings.resource.ResourceManager;
|
||||
import static com.threerings.media.Log.log;
|
||||
|
||||
/**
|
||||
* A repository of image recoloration information. It was called the
|
||||
* recolor repository but the re-s cancelled one another out.
|
||||
* A repository of image recoloration information. It was called the recolor repository but the
|
||||
* re-s cancelled one another out.
|
||||
*/
|
||||
public class ColorPository implements Serializable
|
||||
{
|
||||
/**
|
||||
* Used to store information on a class of colors. These are public to
|
||||
* simplify the XML parsing process, so pay them no mind.
|
||||
* Used to store information on a class of colors. These are public to simplify the XML
|
||||
* parsing process, so pay them no mind.
|
||||
*/
|
||||
public static class ClassRecord implements Serializable
|
||||
{
|
||||
@@ -87,8 +87,8 @@ public class ColorPository implements Serializable
|
||||
{
|
||||
// validate the color id
|
||||
if (record.colorId > 255) {
|
||||
log.warning("Refusing to add color record; colorId > 255 " +
|
||||
"[class=" + this + ", record=" + record + "].");
|
||||
log.warning("Refusing to add color record; colorId > 255",
|
||||
"class", this, "record", record);
|
||||
} else {
|
||||
record.cclass = this;
|
||||
colors.put(record.colorId, record);
|
||||
@@ -96,14 +96,12 @@ public class ColorPository implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Translants a color identified in string form into the id that
|
||||
* should be used to look up its information. Throws an
|
||||
* exception if no color could be found that associates with
|
||||
* Translates a color identified in string form into the id that should be used to look up
|
||||
* its information. Throws an exception if no color could be found that associates with
|
||||
* that name.
|
||||
*
|
||||
* FIXME: This lookup could be sped up a lot with some cached
|
||||
* data tables if it looked like this function would get called
|
||||
* in time critical situations.
|
||||
* FIXME: This lookup could be sped up a lot with some cached data tables if it looked
|
||||
* like this function would get called in time critical situations.
|
||||
*/
|
||||
public int getColorId (String name)
|
||||
throws ParseException
|
||||
@@ -129,8 +127,7 @@ public class ColorPository implements Serializable
|
||||
throw new ParseException("No color named '" + name + "'", 0);
|
||||
}
|
||||
|
||||
/** Returns a random starting id from the entries in this
|
||||
* class. */
|
||||
/** Returns a random starting id from the entries in this class. */
|
||||
public ColorRecord randomStartingColor ()
|
||||
{
|
||||
// figure out our starter ids if we haven't already
|
||||
@@ -296,9 +293,8 @@ public class ColorPository implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified color is legal for use at character
|
||||
* creation time. false is always returned for non-existent colors or
|
||||
* classes.
|
||||
* Returns true if the specified color is legal for use at character creation time. false is
|
||||
* always returned for non-existent colors or classes.
|
||||
*/
|
||||
public boolean isLegalStartColor (int classId, int colorId)
|
||||
{
|
||||
@@ -359,7 +355,7 @@ public class ColorPository implements Serializable
|
||||
try {
|
||||
colorId = crec.getColorId(colorName);
|
||||
} catch (ParseException pe) {
|
||||
log.info("Error getting colorization by name. [error=" + pe + "]");
|
||||
log.info("Error getting colorization by name", "error", pe);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -372,8 +368,7 @@ public class ColorPository implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads up a colorization class by name and logs a warning if it
|
||||
* doesn't exist.
|
||||
* Loads up a colorization class by name and logs a warning if it doesn't exist.
|
||||
*/
|
||||
public ClassRecord getClassRecord (String className)
|
||||
{
|
||||
@@ -384,7 +379,7 @@ public class ColorPository implements Serializable
|
||||
return crec;
|
||||
}
|
||||
}
|
||||
log.warning("No such color class [class=" + className + "].", new Exception());
|
||||
log.warning("No such color class", "class", className, new Exception());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -398,8 +393,8 @@ public class ColorPository implements Serializable
|
||||
// if they request color class zero, we assume they're just
|
||||
// decoding a blank colorprint, otherwise we complain
|
||||
if (classId != 0) {
|
||||
log.warning("Requested unknown color class [classId=" + classId +
|
||||
", colorId=" + colorId + "].", new Exception());
|
||||
log.warning("Requested unknown color class",
|
||||
"classId", classId, "colorId", colorId, new Exception());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -413,8 +408,8 @@ public class ColorPository implements Serializable
|
||||
{
|
||||
ClassRecord record = getClassRecord(className);
|
||||
if (record == null) {
|
||||
log.warning("Requested unknown color class [className=" + className +
|
||||
", colorName=" + colorName + "].", new Exception());
|
||||
log.warning("Requested unknown color class",
|
||||
"className", className, "colorName", colorName, new Exception());
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -422,7 +417,7 @@ public class ColorPository implements Serializable
|
||||
try {
|
||||
colorId = record.getColorId(colorName);
|
||||
} catch (ParseException pe) {
|
||||
log.info("Error getting color record by name. [error=" + pe + "]");
|
||||
log.info("Error getting color record by name", "error", pe);
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -430,8 +425,8 @@ public class ColorPository implements Serializable
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a fully configured color class record to the pository. This is
|
||||
* only called by the XML parsing code, so pay it no mind.
|
||||
* Adds a fully configured color class record to the pository. This is only called by the XML
|
||||
* parsing code, so pay it no mind.
|
||||
*/
|
||||
public void addClass (ClassRecord record)
|
||||
{
|
||||
@@ -452,8 +447,7 @@ public class ColorPository implements Serializable
|
||||
try {
|
||||
return loadColorPository(rmgr.getResource(CONFIG_PATH));
|
||||
} catch (IOException ioe) {
|
||||
log.warning("Failure loading color pository [path=" + CONFIG_PATH +
|
||||
", error=" + ioe + "].");
|
||||
log.warning("Failure loading color pository", "path", CONFIG_PATH, "error", ioe);
|
||||
return new ColorPository();
|
||||
}
|
||||
}
|
||||
@@ -467,7 +461,7 @@ public class ColorPository implements Serializable
|
||||
try {
|
||||
return (ColorPository)CompiledConfig.loadConfig(source);
|
||||
} catch (IOException ioe) {
|
||||
log.warning("Failure loading color pository: " + ioe + ".");
|
||||
log.warning("Failure loading color pository", "ioe", ioe);
|
||||
return new ColorPository();
|
||||
}
|
||||
}
|
||||
@@ -481,8 +475,7 @@ public class ColorPository implements Serializable
|
||||
try {
|
||||
CompiledConfig.saveConfig(path, posit);
|
||||
} catch (IOException ioe) {
|
||||
log.warning("Failure saving color pository " +
|
||||
"[path=" + path + ", error=" + ioe + "].");
|
||||
log.warning("Failure saving color pository", "path", path, "error", ioe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user