Package edu.wisc.game.sql
Class ImageObject
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,
String>
- Direct Known Subclasses:
Composite
Describes an image-and-properties-based object. For details, see
Image-and-property-based description of objects
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An image generator is an object that can be used to obtain a random IPB object.static class
A Generator interface to a stored list of ImageObjects, from which they can be retrieved at random.Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,
V>, AbstractMap.SimpleImmutableEntry<K, V> -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
void
enlist()
Enters this ImageObject into the master tablegetKey()
getSvg()
The SVG code for the image, if available.listProperties
(String sep) Produces a "key1:val1, key2:val2, ..." list, with a desired separator.static ImageObject
static ImageObject
obtainImageObjectPlain
(File f, boolean allowMissing) static ImageObject
obtainImageObjectPlain
(File dir, String plainPath, boolean allowMissing) Retrieves the ImageObject for a specified path (no wildcards!) from the master table.static Vector<ImageObject>
obtainImageObjects
(String wildCardPath) Loads an image object (or a group of them, if a wildcard is given).symbol()
For use in ASCII graphicsMethods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
Methods inherited from class java.util.AbstractMap
equals, hashCode, toString
-
Field Details
-
key
A relative path (under the main shapes dir) or absolute path (for images elsewhere), case-sensitive and complete with the extension. -
file
For static objects, this is the SVG file for the image. For dynamically generated ones, null.
-
-
Constructor Details
-
ImageObject
protected ImageObject()Used by Composite
-
-
Method Details
-
getKey
-
getSvg
The SVG code for the image, if available. It is mandatory for dynamically generated ImageObjects (/composite). For static ones, it may or may not be null. -
clearTable
public static void clearTable() -
enlist
public void enlist()Enters this ImageObject into the master table -
obtainImageObjectPlain
Retrieves the ImageObject for a specified path (no wildcards!) from the master table. If necessary, tries to add that object (and all other objects listed in the properties file in that directory) to the master table.- Parameters:
dir
- If provided, plainPath is understood as being relative to it.plainPath
- The image path (relative to dir, or absolute if dir==null). Must not contain wildcards. May contain an extension (e.g. ".png" or ".svg"); if it does not, ".svg" will be added.
-
obtainImageObjectPlain
-
obtainImageObjectPlain
- Parameters:
allowMissing
- If true, simply return null, rather than throw exception, when the file is not listed in the prop file
-
obtainImageObjects
Loads an image object (or a group of them, if a wildcard is given).- Parameters:
path
- One of the values from the "images" column of ParaSet. It is either a path (maybe with wildcards) relative to game-data/shapes, or a /composite/... string refering to a dynamically generated Composite ImageObject (or a group of them).- Returns:
- a Vector of "regular" ImageObjects (associated with the file(s) given by the wildCardPath), or a Composite ImageObject (maybe a "family" one) is the path is of that kind.
-
listProperties
-
listProperties
Produces a "key1:val1, key2:val2, ..." list, with a desired separator. -
symbol
For use in ASCII graphics
-