Java Code Examples for net.sf.mpxj.TimeUnit#ELAPSED_DAYS

The following examples show how to use net.sf.mpxj.TimeUnit#ELAPSED_DAYS . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FastTrackUtility.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * Convert an integer value into a TimeUnit instance.
 *
 * @param value time unit value
 * @return TimeUnit instance
 */
public static final TimeUnit getTimeUnit(int value)
{
   TimeUnit result = null;

   switch (value)
   {
      case 1:
      {
         // Appears to mean "use the document format"
         result = TimeUnit.ELAPSED_DAYS;
         break;
      }

      case 2:
      {
         result = TimeUnit.HOURS;
         break;
      }

      case 4:
      {
         result = TimeUnit.DAYS;
         break;
      }

      case 6:
      {
         result = TimeUnit.WEEKS;
         break;
      }

      case 8:
      case 10:
      {
         result = TimeUnit.MONTHS;
         break;
      }

      case 12:
      {
         result = TimeUnit.YEARS;
         break;
      }

      default:
      {
         break;
      }
   }

   return result;
}
 
Example 2
Source File: MPDUtility.java    From mpxj with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * This method converts between the duration units representation
 * used in the MPP file, and the standard MPX duration units.
 * If the supplied units are unrecognised, the units default to days.
 *
 * @param type MPP units
 * @return MPX units
 */
public static final TimeUnit getDurationTimeUnits(int type)
{
   TimeUnit units;

   switch (type & DURATION_UNITS_MASK)
   {
      case 3:
      {
         units = TimeUnit.MINUTES;
         break;
      }

      case 4:
      {
         units = TimeUnit.ELAPSED_MINUTES;
         break;
      }

      case 5:
      {
         units = TimeUnit.HOURS;
         break;
      }

      case 6:
      {
         units = TimeUnit.ELAPSED_HOURS;
         break;
      }

      case 8:
      {
         units = TimeUnit.ELAPSED_DAYS;
         break;
      }

      case 9:
      {
         units = TimeUnit.WEEKS;
         break;
      }

      case 10:
      {
         units = TimeUnit.ELAPSED_WEEKS;
         break;
      }

      case 11:
      {
         units = TimeUnit.MONTHS;
         break;
      }

      case 12:
      {
         units = TimeUnit.ELAPSED_MONTHS;
         break;
      }

      default:
      case 7:
      {
         units = TimeUnit.DAYS;
         break;
      }
   }

   return (units);
}