/* * Dog - Core * * Copyright (c) 2011-2016 Dario Bonino and Luigi De Russis * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License */ // // Automatically generated by the DogOnt2Dog utility // package it.polito.elite.dog.core.library.model.statevalue; import java.io.Serializable; import javax.measure.DecimalMeasure; import java.util.HashMap; /** * StateValue - automatically generated by it.polito.elite.domotics.ontologies.dogont.utilities.DogOnt2Dog * * @author it.polito.elite.domotics.ontologies.dogont.utilities.DogOnt2Dog * */ public class StateValue implements Serializable { /** * The unique class version for serialization */ private static final long serialVersionUID = 1L; //fixed identifier for the state value.... private static final String VALUE = "realStateValue"; //all features defined for this state value in form of couples name/value private HashMap<String,Object> features; /** * Empty constructor */ public StateValue() { this.features = new HashMap<String, Object>(); this.setValue(DecimalMeasure.valueOf("0.0")); } /** * Sets a couple feature name/value to this {@link StateValue} instance * @param featureName The name of the feature to add * @param featureValue The value of the feature to add, typically a {@link String} or a {@link Measure} */ public void setFeature(String featureName,Object featureValue) { if((featureName!=null)&&(!featureName.isEmpty())&& (featureValue!=null)) { this.features.put(featureName, featureValue); } } /** * Provides the actual features associated to this instance, null if no feature has been assigned. * @return */ public HashMap<String, Object> getFeatures() { return features; } /** * Sets the actual value associated to this instance * @param value the value to set, typically a {@link String} or a {@link Measure} */ public void setValue(Object value) { if(value!=null) { this.features.put(VALUE, value); } } /** * Provides the actual value associated to this instance, null if no value has been assigned. * @return */ public Object getValue() { return this.features.get(VALUE); } /** * Provides the unique name of this class as a {@link String}. * * @return */ public String getName() { return this.getClass().getSimpleName(); } }