All Downloads are FREE. Search and download functionalities are using the official Maven repository.

nl.cloudfarming.client.farm.model.FieldPlan Maven / Gradle / Ivy

There is a newer version: 13.03-beta
Show newest version
/**
 * Copyright (C) 2010-2012 Agrosense [email protected]
 *
 * Licensed under the Eclipse Public License - v 1.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.eclipse.org/legal/epl-v10.html
 *
 * 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.
 */
package nl.cloudfarming.client.farm.model;

import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyVetoException;
import java.io.IOException;
import java.io.Serializable;
import java.util.Objects;

/**
 * A FieldPlan is the collection of operational data grouped for a harvest year.
 * All data related to fields and or crops in a certain period or time will be
 * placed in a field plan. Examples of such elements are: - Production Units -
 * Sensor data - unoccupied fields
 *
 *
 * @author Timon Veenstra 
 */
public class FieldPlan implements Serializable {

    public static final String MIME_TYPE = "application/x-agrosense-fieldplan";
    private static final long serialVersionUID = 1L;
    private Integer harvestYear;
    public static final String PROP_HARVESTYEAR = "harvestYear";

    /**
     * Get the value of harvestYear
     *
     * @return the value of harvestYear
     */
    public Integer getHarvestYear() {
        return harvestYear;
    }

    /**
     * Set the value of harvestYear
     *
     * @param harvestYear new value of harvestYear
     */
    public void setHarvestYear(Integer harvestYear) {
        Integer oldHarvestYear = this.harvestYear;
        this.harvestYear = harvestYear;
        propertyChangeSupport.firePropertyChange(PROP_HARVESTYEAR, oldHarvestYear, harvestYear);
    }
    private transient PropertyChangeSupport propertyChangeSupport = new PropertyChangeSupport(this);

    /**
     * Add PropertyChangeListener.
     *
     * @param listener
     */
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.addPropertyChangeListener(listener);
    }

    /**
     * Remove PropertyChangeListener.
     *
     * @param listener
     */
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        propertyChangeSupport.removePropertyChangeListener(listener);
    }
    private String name;
    public static final String PROP_NAME = "name";

    /**
     * Get the value of name
     *
     * @return the value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Set the value of name
     *
     * @param name new value of name
     * @throws java.beans.PropertyVetoException
     */
    public void setName(String name) {
        String oldName = this.name;
        this.name = name;
        propertyChangeSupport.firePropertyChange(PROP_NAME, oldName, name);
    }

    private void readObject(java.io.ObjectInputStream in)
            throws IOException, ClassNotFoundException {
        in.defaultReadObject();
        propertyChangeSupport = new PropertyChangeSupport(this);
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final FieldPlan other = (FieldPlan) obj;
        if (!Objects.equals(this.harvestYear, other.harvestYear)) {
            return false;
        }
        if (!Objects.equals(this.name, other.name)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 83 * hash + Objects.hashCode(this.harvestYear);
        hash = 83 * hash + Objects.hashCode(this.name);
        return hash;
    }
    
    
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy