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

net.sf.mpxj.TimephasedItem Maven / Gradle / Ivy

Go to download

Library that provides facilities to allow project information to be manipulated in Java and .Net. Supports a range of data formats: Microsoft Project Exchange (MPX), Microsoft Project (MPP,MPT), Microsoft Project Data Interchange (MSPDI XML), Microsoft Project Database (MPD), Planner (XML), Primavera (PM XML, XER, and database), Asta Powerproject (PP, MDB), Asta Easyplan (PP), Phoenix Project Manager (PPX), FastTrack Schedule (FTS), and the Standard Data Exchange Format (SDEF).

There is a newer version: 13.6.0
Show newest version
/*
 * file:       TimephasedItem.java
 * author:     Jon Iles
 * copyright:  (c) Packwood Software 2008
 * date:       25/10/2008
 */

/*
 * This 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 2.1 of the License, or (at your
 * option) any later version.
 *
 * This 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 this library; if not, write to the Free Software Foundation, Inc.,
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
 */

package net.sf.mpxj;

import java.time.LocalDateTime;

/**
 * This class represents an amount, spread over a period of time.
 *
 * @param  payload type
 */
public abstract class TimephasedItem
{
   /**
    * Retrieve the start date.
    *
    * @return start date
    */
   public LocalDateTime getStart()
   {
      return m_start;
   }

   /**
    * Set the start date.
    *
    * @param start start date
    */
   public void setStart(LocalDateTime start)
   {
      m_start = start;
   }

   /**
    * Retrieve the amount per day.
    *
    * @return amount per day
    */
   public T getAmountPerDay()
   {
      return m_amountPerDay;
   }

   /**
    * Set the amount per day.
    *
    * @param amountPerDay amount per day
    */
   public void setAmountPerDay(T amountPerDay)
   {
      m_amountPerDay = amountPerDay;
   }

   /**
    * Retrieve the modified flag.
    *
    * @return modified flag
    */
   public boolean getModified()
   {
      return m_modified;
   }

   /**
    * Set the modified flag.
    *
    * @param modified modified flag
    */
   public void setModified(boolean modified)
   {
      m_modified = modified;
   }

   /**
    * Retrieve the total amount.
    *
    * @return total amount
    */
   public T getTotalAmount()
   {
      return m_totalAmount;
   }

   /**
    * Set the total amount.
    *
    * @param totalAmount total amount
    */
   public void setTotalAmount(T totalAmount)
   {
      m_totalAmount = totalAmount;
   }

   /**
    * Retrieve the finish date.
    *
    * @return finish date
    */
   public LocalDateTime getFinish()
   {
      return m_finish;
   }

   /**
    * Set the finish date.
    *
    * @param finish finish date
    */
   public void setFinish(LocalDateTime finish)
   {
      m_finish = finish;
   }

   @Override public String toString()
   {
      return "[TimephasedItem start=" + m_start + " totalAmount=" + m_totalAmount + " finish=" + m_finish + " amountPerDay=" + m_amountPerDay + " modified=" + m_modified + "]";
   }

   @SuppressWarnings("unchecked") @Override public boolean equals(Object o)
   {
      boolean result = false;

      if (o instanceof TimephasedItem)
      {
         TimephasedItem t = (TimephasedItem) o;
         result = m_start.equals(t.m_start) && m_finish.equals(t.m_finish) && m_totalAmount.equals(t.m_totalAmount) && m_amountPerDay.equals(t.m_amountPerDay);
      }

      return result;
   }

   @Override public int hashCode()
   {
      return m_start.hashCode() + m_finish.hashCode() + m_totalAmount.hashCode() + m_amountPerDay.hashCode();
   }

   private LocalDateTime m_start;
   private T m_totalAmount;
   private LocalDateTime m_finish;
   private T m_amountPerDay;
   private boolean m_modified;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy