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

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

The newest version!
/**
 * Copyright (C) 2008-2012 AgroSense Foundation.
 *
 * AgroSense is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * There are special exceptions to the terms and conditions of the GPLv3 as it is applied to
 * this software, see the FLOSS License Exception
 * .
 *
 * AgroSense 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with AgroSense.  If not, see .
 */
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