Java Code Examples for net.sf.mpxj.TimeUnit#MONTHS
The following examples show how to use
net.sf.mpxj.TimeUnit#MONTHS .
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: DatatypeConverter.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Parse work units. * * @param value work units value * @return TimeUnit instance */ public static final TimeUnit parseWorkUnits(BigInteger value) { TimeUnit result = TimeUnit.HOURS; if (value != null) { switch (value.intValue()) { case 1: { result = TimeUnit.MINUTES; break; } case 3: { result = TimeUnit.DAYS; break; } case 4: { result = TimeUnit.WEEKS; break; } case 5: { result = TimeUnit.MONTHS; break; } case 7: { result = TimeUnit.YEARS; break; } default: case 2: { result = TimeUnit.HOURS; break; } } } return (result); }
Example 2
Source File: FastTrackUtility.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * 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 3
Source File: MapRow.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * Convert the string representation of a duration to a Duration instance. * * @param value string representation of a duration * @return Duration instance */ private Duration parseDuration(String value) { // // Let's assume that we always receive well-formed values. // int unitsLength = 1; char unitsChar = value.charAt(value.length() - unitsLength); // // Handle an estimated duration // if (unitsChar == '?') { unitsLength = 2; unitsChar = value.charAt(value.length() - unitsLength); } double durationValue = Double.parseDouble(value.substring(0, value.length() - unitsLength)); // // Note that we don't handle 'u' the material type here // TimeUnit durationUnits; switch (unitsChar) { case 's': { durationUnits = TimeUnit.MINUTES; durationValue /= 60; break; } case 'm': { durationUnits = TimeUnit.MINUTES; break; } case 'h': { durationUnits = TimeUnit.HOURS; break; } case 'w': { durationUnits = TimeUnit.WEEKS; break; } case 'M': { durationUnits = TimeUnit.MONTHS; break; } case 'q': { durationUnits = TimeUnit.MONTHS; durationValue *= 3; break; } case 'y': { durationUnits = TimeUnit.YEARS; break; } case 'f': { durationUnits = TimeUnit.PERCENT; break; } case 'd': default: { durationUnits = TimeUnit.DAYS; break; } } return Duration.getInstance(durationValue, durationUnits); }
Example 4
Source File: MPDUtility.java From mpxj with GNU Lesser General Public License v2.1 | 4 votes |
/** * 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); }