ingo@110: /* ingo@110: * Copyright (c) 2011 by Intevation GmbH ingo@110: * ingo@110: * This program is free software under the LGPL (>=v2.1) ingo@110: * Read the file LGPL.txt coming with the software for details ingo@110: * or visit http://www.gnu.org/licenses/ if it does not exist. ingo@110: */ teichmann@475: package org.dive4elements.artifactdatabase.data; ingo@110: ingo@110: ingo@110: /** ingo@110: * @author Ingo Weinzierl ingo@110: */ ingo@110: public class DefaultStateData implements StateData { ingo@110: ingo@110: /** The name of the data. */ ingo@110: protected String name; ingo@110: ingo@110: /** The description of the data. */ ingo@110: protected String description; ingo@110: ingo@110: /** The type of the data. */ ingo@110: protected String type; ingo@110: ingo@110: /** The value. */ ingo@110: protected Object value; ingo@110: sascha@322: public DefaultStateData() { sascha@322: } ingo@110: ingo@110: /** ingo@110: * The default constructor. It creates empty StateData objects with no ingo@110: * value. ingo@110: * ingo@110: * @param name The name. ingo@110: * @param description The description. ingo@110: * @param type The type. ingo@110: */ ingo@110: public DefaultStateData(String name, String description, String type) { ingo@110: this.name = name; ingo@110: this.description = description; ingo@110: this.type = type; ingo@110: } ingo@110: sascha@322: public void set(StateData other) { sascha@322: name = other.getName(); sascha@322: description = other.getDescription(); sascha@322: type = other.getType(); sascha@322: value = other.getValue(); sascha@322: } sascha@322: ingo@110: ingo@110: /** ingo@200: * A constructor that takes the name of the data, its value and the ingo@200: * describing parameters description and type. ingo@200: * ingo@200: * @param name The name of the data item. ingo@200: * @param description The description. ingo@200: * @param type The type. ingo@200: * @param value The value of the data item. ingo@200: */ ingo@200: public DefaultStateData( ingo@200: String name, ingo@200: String description, ingo@200: String type, ingo@200: String value) ingo@200: { ingo@200: this.name = name; ingo@200: this.description = description; ingo@200: this.type = type; ingo@200: this.value = value; ingo@200: } ingo@200: ingo@200: ingo@200: /** ingo@110: * Returns the name of the data object. ingo@110: * ingo@110: * @return the name. ingo@110: */ ingo@110: public String getName() { ingo@110: return name; ingo@110: } ingo@110: ingo@110: ingo@110: /** ingo@110: * Returns the description of the data object. ingo@110: * ingo@110: * @return the description of the data object. ingo@110: */ ingo@110: public String getDescription() { ingo@110: return description; ingo@110: } ingo@110: ingo@110: ingo@110: /** ingo@110: * Returns the type of the data object as string. ingo@110: * ingo@110: * @return the type as string. ingo@110: */ ingo@110: public String getType() { ingo@110: return type; ingo@110: } ingo@110: ingo@110: ingo@110: /** ingo@110: * Returns the value of the data object. ingo@110: * ingo@110: * @return the value. ingo@110: */ ingo@110: public Object getValue() { ingo@110: return value; ingo@110: } ingo@110: ingo@110: ingo@110: /** ingo@110: * Set the value of this data object. ingo@110: * ingo@110: * @param value The new value for this data object. ingo@110: */ ingo@110: public void setValue(Object value) { ingo@110: this.value = value; ingo@110: } sascha@322: sascha@322: @Override sascha@322: public StateData deepCopy() { sascha@322: DefaultStateData copy = new DefaultStateData(); sascha@322: copy.set(this); sascha@322: return copy; sascha@322: } ingo@110: } ingo@110: // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf-8 :