/**
* Squidy Interaction Library is free software: you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the License,
* or (at your option) any later version.
*
* Squidy Interaction Library is distributed in the hope that it will be
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Squidy Interaction Library. If not, see
* <http://www.gnu.org/licenses/>.
*
* 2009 Human-Computer Interaction Group, University of Konstanz.
* <http://hci.uni-konstanz.de>
*
* Please contact info@squidy-lib.de or visit our website
* <http://www.squidy-lib.de> for further information.
*/
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.3-b01-fcs
// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2007.06.29 at 11:07:26 AM CEST
//
package org.squidy.nodes.laserpointer.config.xml;
import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for anonymous complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType>
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="display" type="{}display" maxOccurs="unbounded"/>
* <element name="camera" type="{}camera" maxOccurs="unbounded"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "", propOrder = {
"display",
"camera"
})
@XmlRootElement(name = "configuration")
public class Configuration {
@XmlTransient
protected Hashtable<String, Camera> cameraHashtable; // id, camera hashtable
@XmlTransient
protected Hashtable<String, Display> displayHashtable; // id, display hashtable
@XmlElement(required = true)
protected List<Display> display;
@XmlElement(required = true)
protected List<Camera> camera;
/**
* Replaces the whole configuration constituents with data from
* new configuration.
* @param newConfig
*/
public void update(Configuration newConfig) {
this.display = newConfig.getDisplay();
this.camera = newConfig.getCamera();
this.createCameraHashtable();
this.createDisplayHashtable();
}
@Override
public String toString() {
StringBuffer strBuf = new StringBuffer();
strBuf.append("cameras: ");
for (Camera cam : getCamera()) {
strBuf.append(cam);
}
return strBuf.toString();
}
/**
* Gets the value of the display property.
*
* <p>
* 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 <CODE>set</CODE> method for the display property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getDisplay().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Display }
*
*
*/
public List<Display> getDisplay() {
if (display == null) {
display = new ArrayList<Display>();
}
return this.display;
}
/**
* Convenience method.
* @author Jo Bieg
* @return
*/
public List<Display> getDisplays() {
return getDisplay();
}
/**
* Gets the value of the camera property.
*
* <p>
* 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 <CODE>set</CODE> method for the camera property.
*
* <p>
* For example, to add a new item, do as follows:
* <pre>
* getCamera().add(newItem);
* </pre>
*
*
* <p>
* Objects of the following type(s) are allowed in the list
* {@link Camera }
*
*
*/
public List<Camera> getCamera() {
if (camera == null) {
camera = new ArrayList<Camera>();
}
return this.camera;
}
/**
* Convenience method.
* @author Jo Bieg
* @return
*/
public List<Camera> getCameras() {
return getCamera();
}
public Hashtable<String, Camera> getCameraHashtable() {
if(cameraHashtable == null) createCameraHashtable();
return cameraHashtable;
}
private void createCameraHashtable() {
cameraHashtable = new Hashtable<String, Camera>();
List<Camera> cameras = getCamera();
for (Camera camera : cameras) {
cameraHashtable.put(camera.getId(), camera);
}
}
public Hashtable<String, Display> getDisplayHashtable() {
if(displayHashtable == null) createDisplayHashtable();
return displayHashtable;
}
private void createDisplayHashtable() {
displayHashtable = new Hashtable<String, Display>();
List<Display> displays = getDisplay();
for (Display display : displays) {
displayHashtable.put(display.getId(), display);
}
}
}