Package edu.wisc.game.svg
Class Composite
- java.lang.Object
-
- java.util.AbstractMap<K,V>
-
- java.util.HashMap<String,String>
-
- edu.wisc.game.sql.ImageObject
-
- edu.wisc.game.svg.Composite
-
- All Implemented Interfaces:
Serializable
,Cloneable
,Map<String,String>
public class Composite extends ImageObject
The description of a single composite ImageObject, or a family of such objects, obtained by parsing its name (which may contain wildcards). Unlike other ImageObject, Composite ones are dynamically generated, because they are drawn from a large space.A Composite object may be a "concrete" one (has no wildcards, and describes exactly one ImageObject), or a "family" one (has wildcards that match a group of objects). The sample() method can be used to randomly draw a concrete object from a family.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Composite.Generator
A tool for drawing concrete ImageObjects from a family defined by a Composite object, or a union of such families.-
Nested classes/interfaces inherited from class edu.wisc.game.sql.ImageObject
ImageObject.PickFromList
-
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object,V extends Object>
-
-
Field Summary
-
Fields inherited from class edu.wisc.game.sql.ImageObject
file, key
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description BigInteger
familySize()
How many distinct concrete Composite ImageObjects does this Composite object describe? The result is based on the number of wildcards in this object.Map<String,Set<Object>>
getAllFeatures()
For the CGS' FEATURE commandString
getSvg()
The SVG code for the image, if available.static boolean
isCompositeName(String name)
boolean
isWild()
Does the name contain wildcards, thus describing a family of Composite images, rather than a single "concrete" image?static void
main(String[] argv)
Composite
sample(Random random)
If this is a wildcard description, generates a "concrete" (non-wildcard) desription of a matching composite objectstatic void
setNeedFeatures(boolean x)
String
toString()
-
Methods inherited from class edu.wisc.game.sql.ImageObject
clearTable, enlist, getKey, listProperties, listProperties, obtainImageObjectPlain, obtainImageObjectPlain, obtainImageObjectPlain, obtainImageObjects, symbol
-
Methods inherited from class java.util.HashMap
clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values
-
Methods inherited from class java.util.AbstractMap
equals, hashCode
-
-
-
-
Constructor Detail
-
Composite
public Composite(String name)
Constructs a concrete or "family" Composite object based on a name string.- Parameters:
name
- E.g. "/composite/h/d=???/b=123/gq/gq/gq"
-
-
Method Detail
-
isWild
public boolean isWild()
Does the name contain wildcards, thus describing a family of Composite images, rather than a single "concrete" image?
-
getSvg
public String getSvg()
Description copied from class:ImageObject
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.- Overrides:
getSvg
in classImageObject
-
toString
public String toString()
- Overrides:
toString
in classAbstractMap<String,String>
-
familySize
public BigInteger familySize()
How many distinct concrete Composite ImageObjects does this Composite object describe? The result is based on the number of wildcards in this object. BigInteger is used because the number can be combinatorially large.
-
sample
public Composite sample(Random random)
If this is a wildcard description, generates a "concrete" (non-wildcard) desription of a matching composite object
-
isCompositeName
public static boolean isCompositeName(String name)
-
setNeedFeatures
public static void setNeedFeatures(boolean x)
-
main
public static void main(String[] argv) throws IOException
- Throws:
IOException
-
-