
com.discobeard.spriter.dom.Entity Maven / Gradle / Ivy
Show all versions of Spriter Show documentation
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, vhudson-jaxb-ri-2.1-2
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2013.01.18 at 06:33:53 PM MEZ
//
package com.discobeard.spriter.dom;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlType;
import com.brashmonkey.spriter.file.Reference;
/**
* Java class for Entity complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="Entity">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="animation" type="{}Animation" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* <attribute name="id" type="{http://www.w3.org/2001/XMLSchema}int" />
* <attribute name="name" type="{http://www.w3.org/2001/XMLSchema}string" />
* </restriction>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Entity", propOrder = {
"animation"
})
public class Entity {
protected List animation;
@XmlAttribute(name = "id")
protected Integer id;
@XmlAttribute(name = "name")
protected String name;
@XmlAttribute(name = "character_map")
protected List characterMaps;
protected List objectInfos;
/**
* Gets the value of the animation property.
*
*
* This accessor method returns a reference to the live list,
* not a snapshot. Therefore any modification you make to the
* returned list will be present inside the JAXB object.
* This is why there is not a set
method for the animation property.
*
*
* For example, to add a new item, do as follows:
*
* getAnimation().add(newItem);
*
*
*
*
* Objects of the following type(s) are allowed in the list
* {@link Animation }
*
*
*/
public List getAnimation() {
if (animation == null) {
animation = new ArrayList();
}
return this.animation;
}
/**
* @return all character maps, this entity has
*/
public List getCharacterMaps() {
if (characterMaps == null)
characterMaps = new ArrayList();
return this.characterMaps;
}
/**
* Gets the value of the id property.
*
* @return
* possible object is
* {@link Integer }
*
*/
public Integer getId() {
return id;
}
/**
* Sets the value of the id property.
*
* @param value
* allowed object is
* {@link Integer }
*
*/
public void setId(Integer value) {
this.id = value;
}
/**
* Gets the value of the name property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getName() {
return name;
}
/**
* Sets the value of the name property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setName(String value) {
this.name = value;
}
/**
* Searches for a character map for the given name.
* @param name A name to search for.
* @return The character map if one was found with the given name, null otherwise.
*/
public CharacterMap getCharacterMapByName(String name){
for(CharacterMap map: this.getCharacterMaps())
if(map.name.equals(name)) return map;
return null;
}
public void addInfo(ObjectInfo info){
if(this.objectInfos == null) this.objectInfos = new ArrayList();
this.objectInfos.add(info);
}
public ObjectInfo getInfo(int index){
if(this.objectInfos == null) return null;
return this.objectInfos.get(index);
}
public ObjectInfo getInfo(String name){
if(this.objectInfos == null) return null;
for(ObjectInfo info: this.objectInfos)
if(info.name.equals(name)) return info;
return null;
}
public ObjectInfo getInfo(String name, ObjectInfoType type){
ObjectInfo info = this.getInfo(name);
if(info.type == type) return info;
else return null;
}
public static enum ObjectInfoType{
Sprite, Bone, Box, Point;
public static ObjectInfoType getObjectInfoFor(String type){
switch(type){
case "bone": return Bone;
case "box": return Box;
case "point": return Point;
default: return Sprite;
}
}
}
public static class ObjectInfo{
public final ObjectInfoType type;
public final List frames;
public final String name;
public final float width, height;
public ObjectInfo(String name, ObjectInfoType type, float width, float height, List frames){
this.type = type;
this.frames = frames;
this.name = name;
this.width = width;
this.height = height;
}
public ObjectInfo(String name, ObjectInfoType type, float width, float height){
this(name, type, width, height, new ArrayList());
}
public ObjectInfo(String name, ObjectInfoType type, List frames){
this(name, type, 0, 0, frames);
}
}
}