repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writeAssignmentTimephasedData
private void writeAssignmentTimephasedData(ResourceAssignment mpx, Project.Assignments.Assignment xml) { if (m_writeTimphasedData && mpx.getHasTimephasedData()) { List<TimephasedDataType> list = xml.getTimephasedData(); ProjectCalendar calendar = mpx.getCalendar(); BigInteger assignmentID = xml.getUID(); List<TimephasedWork> complete = mpx.getTimephasedActualWork(); List<TimephasedWork> planned = mpx.getTimephasedWork(); if (m_splitTimephasedAsDays) { TimephasedWork lastComplete = null; if (complete != null && !complete.isEmpty()) { lastComplete = complete.get(complete.size() - 1); } TimephasedWork firstPlanned = null; if (planned != null && !planned.isEmpty()) { firstPlanned = planned.get(0); } if (planned != null) { planned = splitDays(calendar, mpx.getTimephasedWork(), null, lastComplete); } if (complete != null) { complete = splitDays(calendar, complete, firstPlanned, null); } } if (planned != null) { writeAssignmentTimephasedData(assignmentID, list, planned, 1); } if (complete != null) { writeAssignmentTimephasedData(assignmentID, list, complete, 2); } } }
java
private void writeAssignmentTimephasedData(ResourceAssignment mpx, Project.Assignments.Assignment xml) { if (m_writeTimphasedData && mpx.getHasTimephasedData()) { List<TimephasedDataType> list = xml.getTimephasedData(); ProjectCalendar calendar = mpx.getCalendar(); BigInteger assignmentID = xml.getUID(); List<TimephasedWork> complete = mpx.getTimephasedActualWork(); List<TimephasedWork> planned = mpx.getTimephasedWork(); if (m_splitTimephasedAsDays) { TimephasedWork lastComplete = null; if (complete != null && !complete.isEmpty()) { lastComplete = complete.get(complete.size() - 1); } TimephasedWork firstPlanned = null; if (planned != null && !planned.isEmpty()) { firstPlanned = planned.get(0); } if (planned != null) { planned = splitDays(calendar, mpx.getTimephasedWork(), null, lastComplete); } if (complete != null) { complete = splitDays(calendar, complete, firstPlanned, null); } } if (planned != null) { writeAssignmentTimephasedData(assignmentID, list, planned, 1); } if (complete != null) { writeAssignmentTimephasedData(assignmentID, list, complete, 2); } } }
[ "private", "void", "writeAssignmentTimephasedData", "(", "ResourceAssignment", "mpx", ",", "Project", ".", "Assignments", ".", "Assignment", "xml", ")", "{", "if", "(", "m_writeTimphasedData", "&&", "mpx", ".", "getHasTimephasedData", "(", ")", ")", "{", "List", ...
Writes the timephased data for a resource assignment. @param mpx MPXJ assignment @param xml MSDPI assignment
[ "Writes", "the", "timephased", "data", "for", "a", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1704-L1750
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.writeAssignmentTimephasedData
private void writeAssignmentTimephasedData(BigInteger assignmentID, List<TimephasedDataType> list, List<TimephasedWork> data, int type) { for (TimephasedWork mpx : data) { TimephasedDataType xml = m_factory.createTimephasedDataType(); list.add(xml); xml.setStart(mpx.getStart()); xml.setFinish(mpx.getFinish()); xml.setType(BigInteger.valueOf(type)); xml.setUID(assignmentID); xml.setUnit(DatatypeConverter.printDurationTimeUnits(mpx.getTotalAmount(), false)); xml.setValue(DatatypeConverter.printDuration(this, mpx.getTotalAmount())); } }
java
private void writeAssignmentTimephasedData(BigInteger assignmentID, List<TimephasedDataType> list, List<TimephasedWork> data, int type) { for (TimephasedWork mpx : data) { TimephasedDataType xml = m_factory.createTimephasedDataType(); list.add(xml); xml.setStart(mpx.getStart()); xml.setFinish(mpx.getFinish()); xml.setType(BigInteger.valueOf(type)); xml.setUID(assignmentID); xml.setUnit(DatatypeConverter.printDurationTimeUnits(mpx.getTotalAmount(), false)); xml.setValue(DatatypeConverter.printDuration(this, mpx.getTotalAmount())); } }
[ "private", "void", "writeAssignmentTimephasedData", "(", "BigInteger", "assignmentID", ",", "List", "<", "TimephasedDataType", ">", "list", ",", "List", "<", "TimephasedWork", ">", "data", ",", "int", "type", ")", "{", "for", "(", "TimephasedWork", "mpx", ":", ...
Writes a list of timephased data to the MSPDI file. @param assignmentID current assignment ID @param list output list of timephased data items @param data input list of timephased data @param type list type (planned or completed)
[ "Writes", "a", "list", "of", "timephased", "data", "to", "the", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1894-L1908
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.getAllAssignmentExtendedAttributes
private List<AssignmentField> getAllAssignmentExtendedAttributes() { ArrayList<AssignmentField> result = new ArrayList<AssignmentField>(); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_MULTI_VALUE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_OUTLINE_CODE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_TEXT)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_TEXT)); return result; }
java
private List<AssignmentField> getAllAssignmentExtendedAttributes() { ArrayList<AssignmentField> result = new ArrayList<AssignmentField>(); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_MULTI_VALUE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_RESOURCE_OUTLINE_CODE)); result.addAll(Arrays.asList(AssignmentFieldLists.ENTERPRISE_TEXT)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(AssignmentFieldLists.CUSTOM_TEXT)); return result; }
[ "private", "List", "<", "AssignmentField", ">", "getAllAssignmentExtendedAttributes", "(", ")", "{", "ArrayList", "<", "AssignmentField", ">", "result", "=", "new", "ArrayList", "<", "AssignmentField", ">", "(", ")", ";", "result", ".", "addAll", "(", "Arrays", ...
Retrieve list of assignment extended attributes. @return list of extended attributes
[ "Retrieve", "list", "of", "assignment", "extended", "attributes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1915-L1935
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.getAllTaskExtendedAttributes
private List<TaskField> getAllTaskExtendedAttributes() { ArrayList<TaskField> result = new ArrayList<TaskField>(); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_OUTLINE_CODE)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_TEXT)); return result; }
java
private List<TaskField> getAllTaskExtendedAttributes() { ArrayList<TaskField> result = new ArrayList<TaskField>(); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(TaskFieldLists.CUSTOM_OUTLINE_CODE)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(TaskFieldLists.ENTERPRISE_TEXT)); return result; }
[ "private", "List", "<", "TaskField", ">", "getAllTaskExtendedAttributes", "(", ")", "{", "ArrayList", "<", "TaskField", ">", "result", "=", "new", "ArrayList", "<", "TaskField", ">", "(", ")", ";", "result", ".", "addAll", "(", "Arrays", ".", "asList", "("...
Retrieve list of task extended attributes. @return list of extended attributes
[ "Retrieve", "list", "of", "task", "extended", "attributes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1942-L1961
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java
MSPDIWriter.getAllResourceExtendedAttributes
private List<ResourceField> getAllResourceExtendedAttributes() { ArrayList<ResourceField> result = new ArrayList<ResourceField>(); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_OUTLINE_CODE)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_TEXT)); return result; }
java
private List<ResourceField> getAllResourceExtendedAttributes() { ArrayList<ResourceField> result = new ArrayList<ResourceField>(); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_TEXT)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_START)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_FINISH)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_COST)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_DATE)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_FLAG)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_NUMBER)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_DURATION)); result.addAll(Arrays.asList(ResourceFieldLists.CUSTOM_OUTLINE_CODE)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_COST)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_DATE)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_DURATION)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_FLAG)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_NUMBER)); result.addAll(Arrays.asList(ResourceFieldLists.ENTERPRISE_TEXT)); return result; }
[ "private", "List", "<", "ResourceField", ">", "getAllResourceExtendedAttributes", "(", ")", "{", "ArrayList", "<", "ResourceField", ">", "result", "=", "new", "ArrayList", "<", "ResourceField", ">", "(", ")", ";", "result", ".", "addAll", "(", "Arrays", ".", ...
Retrieve list of resource extended attributes. @return list of extended attributes
[ "Retrieve", "list", "of", "resource", "extended", "attributes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIWriter.java#L1968-L1987
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.processUDF
private void processUDF(UDFTypeType udf) { FieldTypeClass fieldType = FIELD_TYPE_MAP.get(udf.getSubjectArea()); if (fieldType != null) { UserFieldDataType dataType = UserFieldDataType.getInstanceFromXmlName(udf.getDataType()); String name = udf.getTitle(); FieldType field = addUserDefinedField(fieldType, dataType, name); if (field != null) { m_fieldTypeMap.put(udf.getObjectId(), field); } } }
java
private void processUDF(UDFTypeType udf) { FieldTypeClass fieldType = FIELD_TYPE_MAP.get(udf.getSubjectArea()); if (fieldType != null) { UserFieldDataType dataType = UserFieldDataType.getInstanceFromXmlName(udf.getDataType()); String name = udf.getTitle(); FieldType field = addUserDefinedField(fieldType, dataType, name); if (field != null) { m_fieldTypeMap.put(udf.getObjectId(), field); } } }
[ "private", "void", "processUDF", "(", "UDFTypeType", "udf", ")", "{", "FieldTypeClass", "fieldType", "=", "FIELD_TYPE_MAP", ".", "get", "(", "udf", ".", "getSubjectArea", "(", ")", ")", ";", "if", "(", "fieldType", "!=", "null", ")", "{", "UserFieldDataType"...
Process an individual UDF. @param udf UDF definition
[ "Process", "an", "individual", "UDF", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L251-L264
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.addUserDefinedField
private FieldType addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { FieldType field = null; try { switch (fieldType) { case TASK: { do { field = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (RESERVED_TASK_FIELDS.contains(field)); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } case RESOURCE: { field = m_resourceUdfCounters.nextField(ResourceField.class, dataType); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } case ASSIGNMENT: { field = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } default: { break; } } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } return field; }
java
private FieldType addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { FieldType field = null; try { switch (fieldType) { case TASK: { do { field = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (RESERVED_TASK_FIELDS.contains(field)); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } case RESOURCE: { field = m_resourceUdfCounters.nextField(ResourceField.class, dataType); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } case ASSIGNMENT: { field = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); m_projectFile.getCustomFields().getCustomField(field).setAlias(name); break; } default: { break; } } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } return field; }
[ "private", "FieldType", "addUserDefinedField", "(", "FieldTypeClass", "fieldType", ",", "UserFieldDataType", "dataType", ",", "String", "name", ")", "{", "FieldType", "field", "=", "null", ";", "try", "{", "switch", "(", "fieldType", ")", "{", "case", "TASK", ...
Map the Primavera UDF to a custom field. @param fieldType parent object type @param dataType UDF data type @param name UDF name @return FieldType instance
[ "Map", "the", "Primavera", "UDF", "to", "a", "custom", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L274-L328
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.zeroIsNull
private Double zeroIsNull(Double value) { if (value != null && value.doubleValue() == 0) { value = null; } return value; }
java
private Double zeroIsNull(Double value) { if (value != null && value.doubleValue() == 0) { value = null; } return value; }
[ "private", "Double", "zeroIsNull", "(", "Double", "value", ")", "{", "if", "(", "value", "!=", "null", "&&", "value", ".", "doubleValue", "(", ")", "==", "0", ")", "{", "value", "=", "null", ";", "}", "return", "value", ";", "}" ]
Render a zero Double as null. @param value double value @return null if the double value is zero
[ "Render", "a", "zero", "Double", "as", "null", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L995-L1002
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.getDuration
private Duration getDuration(Double duration) { Duration result = null; if (duration != null) { result = Duration.getInstance(NumberHelper.getDouble(duration), TimeUnit.HOURS); } return result; }
java
private Duration getDuration(Double duration) { Duration result = null; if (duration != null) { result = Duration.getInstance(NumberHelper.getDouble(duration), TimeUnit.HOURS); } return result; }
[ "private", "Duration", "getDuration", "(", "Double", "duration", ")", "{", "Duration", "result", "=", "null", ";", "if", "(", "duration", "!=", "null", ")", "{", "result", "=", "Duration", ".", "getInstance", "(", "NumberHelper", ".", "getDouble", "(", "du...
Extracts a duration from a JAXBElement instance. @param duration duration expressed in hours @return duration instance
[ "Extracts", "a", "duration", "from", "a", "JAXBElement", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1010-L1020
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.readUDFTypes
private void readUDFTypes(FieldContainer mpxj, List<UDFAssignmentType> udfs) { for (UDFAssignmentType udf : udfs) { FieldType fieldType = m_fieldTypeMap.get(Integer.valueOf(udf.getTypeObjectId())); if (fieldType != null) { mpxj.set(fieldType, getUdfValue(udf)); } } }
java
private void readUDFTypes(FieldContainer mpxj, List<UDFAssignmentType> udfs) { for (UDFAssignmentType udf : udfs) { FieldType fieldType = m_fieldTypeMap.get(Integer.valueOf(udf.getTypeObjectId())); if (fieldType != null) { mpxj.set(fieldType, getUdfValue(udf)); } } }
[ "private", "void", "readUDFTypes", "(", "FieldContainer", "mpxj", ",", "List", "<", "UDFAssignmentType", ">", "udfs", ")", "{", "for", "(", "UDFAssignmentType", "udf", ":", "udfs", ")", "{", "FieldType", "fieldType", "=", "m_fieldTypeMap", ".", "get", "(", "...
Process UDFs for a specific object. @param mpxj field container @param udfs UDF values
[ "Process", "UDFs", "for", "a", "specific", "object", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1052-L1062
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.getUdfValue
private Object getUdfValue(UDFAssignmentType udf) { if (udf.getCostValue() != null) { return udf.getCostValue(); } if (udf.getDoubleValue() != null) { return udf.getDoubleValue(); } if (udf.getFinishDateValue() != null) { return udf.getFinishDateValue(); } if (udf.getIndicatorValue() != null) { return udf.getIndicatorValue(); } if (udf.getIntegerValue() != null) { return udf.getIntegerValue(); } if (udf.getStartDateValue() != null) { return udf.getStartDateValue(); } if (udf.getTextValue() != null) { return udf.getTextValue(); } return null; }
java
private Object getUdfValue(UDFAssignmentType udf) { if (udf.getCostValue() != null) { return udf.getCostValue(); } if (udf.getDoubleValue() != null) { return udf.getDoubleValue(); } if (udf.getFinishDateValue() != null) { return udf.getFinishDateValue(); } if (udf.getIndicatorValue() != null) { return udf.getIndicatorValue(); } if (udf.getIntegerValue() != null) { return udf.getIntegerValue(); } if (udf.getStartDateValue() != null) { return udf.getStartDateValue(); } if (udf.getTextValue() != null) { return udf.getTextValue(); } return null; }
[ "private", "Object", "getUdfValue", "(", "UDFAssignmentType", "udf", ")", "{", "if", "(", "udf", ".", "getCostValue", "(", ")", "!=", "null", ")", "{", "return", "udf", ".", "getCostValue", "(", ")", ";", "}", "if", "(", "udf", ".", "getDoubleValue", "...
Retrieve the value of a UDF. @param udf UDF value holder @return UDF value
[ "Retrieve", "the", "value", "of", "a", "UDF", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1070-L1108
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java
PrimaveraPMFileReader.mapTaskID
private Integer mapTaskID(Integer id) { Integer mappedID = m_clashMap.get(id); if (mappedID == null) { mappedID = id; } return (mappedID); }
java
private Integer mapTaskID(Integer id) { Integer mappedID = m_clashMap.get(id); if (mappedID == null) { mappedID = id; } return (mappedID); }
[ "private", "Integer", "mapTaskID", "(", "Integer", "id", ")", "{", "Integer", "mappedID", "=", "m_clashMap", ".", "get", "(", "id", ")", ";", "if", "(", "mappedID", "==", "null", ")", "{", "mappedID", "=", "id", ";", "}", "return", "(", "mappedID", "...
Deals with the case where we have had to map a task ID to a new value. @param id task ID from database @return mapped task ID
[ "Deals", "with", "the", "case", "where", "we", "have", "had", "to", "map", "a", "task", "ID", "to", "a", "new", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileReader.java#L1165-L1173
train
joniles/mpxj
src/main/java/net/sf/mpxj/GraphicalIndicator.java
GraphicalIndicator.evaluate
public int evaluate(FieldContainer container) { // // First step - determine the list of criteria we are should use // List<GraphicalIndicatorCriteria> criteria; if (container instanceof Task) { Task task = (Task) container; if (NumberHelper.getInt(task.getUniqueID()) == 0) { if (m_projectSummaryInheritsFromSummaryRows == false) { criteria = m_projectSummaryCriteria; } else { if (m_summaryRowsInheritFromNonSummaryRows == false) { criteria = m_summaryRowCriteria; } else { criteria = m_nonSummaryRowCriteria; } } } else { if (task.getSummary() == true) { if (m_summaryRowsInheritFromNonSummaryRows == false) { criteria = m_summaryRowCriteria; } else { criteria = m_nonSummaryRowCriteria; } } else { criteria = m_nonSummaryRowCriteria; } } } else { // It is possible to have a resource summary row, but at the moment // I can't see how you can determine this. criteria = m_nonSummaryRowCriteria; } // // Now we have the criteria, evaluate each one until we get a result // int result = -1; for (GraphicalIndicatorCriteria gic : criteria) { result = gic.evaluate(container); if (result != -1) { break; } } // // If we still don't have a result at the end, return the // default value, which is 0 // if (result == -1) { result = 0; } return (result); }
java
public int evaluate(FieldContainer container) { // // First step - determine the list of criteria we are should use // List<GraphicalIndicatorCriteria> criteria; if (container instanceof Task) { Task task = (Task) container; if (NumberHelper.getInt(task.getUniqueID()) == 0) { if (m_projectSummaryInheritsFromSummaryRows == false) { criteria = m_projectSummaryCriteria; } else { if (m_summaryRowsInheritFromNonSummaryRows == false) { criteria = m_summaryRowCriteria; } else { criteria = m_nonSummaryRowCriteria; } } } else { if (task.getSummary() == true) { if (m_summaryRowsInheritFromNonSummaryRows == false) { criteria = m_summaryRowCriteria; } else { criteria = m_nonSummaryRowCriteria; } } else { criteria = m_nonSummaryRowCriteria; } } } else { // It is possible to have a resource summary row, but at the moment // I can't see how you can determine this. criteria = m_nonSummaryRowCriteria; } // // Now we have the criteria, evaluate each one until we get a result // int result = -1; for (GraphicalIndicatorCriteria gic : criteria) { result = gic.evaluate(container); if (result != -1) { break; } } // // If we still don't have a result at the end, return the // default value, which is 0 // if (result == -1) { result = 0; } return (result); }
[ "public", "int", "evaluate", "(", "FieldContainer", "container", ")", "{", "//", "// First step - determine the list of criteria we are should use", "//", "List", "<", "GraphicalIndicatorCriteria", ">", "criteria", ";", "if", "(", "container", "instanceof", "Task", ")", ...
This method evaluates a if a graphical indicator should be displayed, given a set of Task or Resource data. The method will return -1 if no indicator should be displayed. @param container Task or Resource instance @return indicator index
[ "This", "method", "evaluates", "a", "if", "a", "graphical", "indicator", "should", "be", "displayed", "given", "a", "set", "of", "Task", "or", "Resource", "data", ".", "The", "method", "will", "return", "-", "1", "if", "no", "indicator", "should", "be", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/GraphicalIndicator.java#L48-L124
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeFileCreationRecord
private void writeFileCreationRecord() throws IOException { ProjectProperties properties = m_projectFile.getProjectProperties(); m_buffer.setLength(0); m_buffer.append("MPX"); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxProgramName()); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxFileVersion()); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxCodePage()); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
java
private void writeFileCreationRecord() throws IOException { ProjectProperties properties = m_projectFile.getProjectProperties(); m_buffer.setLength(0); m_buffer.append("MPX"); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxProgramName()); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxFileVersion()); m_buffer.append(m_delimiter); m_buffer.append(properties.getMpxCodePage()); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
[ "private", "void", "writeFileCreationRecord", "(", ")", "throws", "IOException", "{", "ProjectProperties", "properties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "m_buffer", ".", "setLength", "(", "0", ")", ";", "m_buffer", ".", "append", ...
Write file creation record. @throws IOException
[ "Write", "file", "creation", "record", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L144-L158
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeCalendar
private void writeCalendar(ProjectCalendar record) throws IOException { // // Test used to ensure that we don't write the default calendar used for the "Unassigned" resource // if (record.getParent() == null || record.getResource() != null) { m_buffer.setLength(0); if (record.getParent() == null) { m_buffer.append(MPXConstants.BASE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); if (record.getName() != null) { m_buffer.append(record.getName()); } } else { m_buffer.append(MPXConstants.RESOURCE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(record.getParent().getName()); } for (DayType day : record.getDays()) { if (day == null) { day = DayType.DEFAULT; } m_buffer.append(m_delimiter); m_buffer.append(day.getValue()); } m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); ProjectCalendarHours[] hours = record.getHours(); for (int loop = 0; loop < hours.length; loop++) { if (hours[loop] != null) { writeCalendarHours(record, hours[loop]); } } if (!record.getCalendarExceptions().isEmpty()) { // // A quirk of MS Project is that these exceptions must be // in date order in the file, otherwise they are ignored. // The getCalendarExceptions method now guarantees that // the exceptions list is sorted when retrieved. // for (ProjectCalendarException ex : record.getCalendarExceptions()) { writeCalendarException(record, ex); } } m_eventManager.fireCalendarWrittenEvent(record); } }
java
private void writeCalendar(ProjectCalendar record) throws IOException { // // Test used to ensure that we don't write the default calendar used for the "Unassigned" resource // if (record.getParent() == null || record.getResource() != null) { m_buffer.setLength(0); if (record.getParent() == null) { m_buffer.append(MPXConstants.BASE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); if (record.getName() != null) { m_buffer.append(record.getName()); } } else { m_buffer.append(MPXConstants.RESOURCE_CALENDAR_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(record.getParent().getName()); } for (DayType day : record.getDays()) { if (day == null) { day = DayType.DEFAULT; } m_buffer.append(m_delimiter); m_buffer.append(day.getValue()); } m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); ProjectCalendarHours[] hours = record.getHours(); for (int loop = 0; loop < hours.length; loop++) { if (hours[loop] != null) { writeCalendarHours(record, hours[loop]); } } if (!record.getCalendarExceptions().isEmpty()) { // // A quirk of MS Project is that these exceptions must be // in date order in the file, otherwise they are ignored. // The getCalendarExceptions method now guarantees that // the exceptions list is sorted when retrieved. // for (ProjectCalendarException ex : record.getCalendarExceptions()) { writeCalendarException(record, ex); } } m_eventManager.fireCalendarWrittenEvent(record); } }
[ "private", "void", "writeCalendar", "(", "ProjectCalendar", "record", ")", "throws", "IOException", "{", "//", "// Test used to ensure that we don't write the default calendar used for the \"Unassigned\" resource", "//", "if", "(", "record", ".", "getParent", "(", ")", "==", ...
Write a calendar. @param record calendar instance @throws IOException
[ "Write", "a", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L322-L385
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeCalendarHours
private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException { m_buffer.setLength(0); int recordNumber; if (!parentCalendar.isDerived()) { recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER; } else { recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER; } DateRange range1 = record.getRange(0); if (range1 == null) { range1 = DateRange.EMPTY_RANGE; } DateRange range2 = record.getRange(1); if (range2 == null) { range2 = DateRange.EMPTY_RANGE; } DateRange range3 = record.getRange(2); if (range3 == null) { range3 = DateRange.EMPTY_RANGE; } m_buffer.append(recordNumber); m_buffer.append(m_delimiter); m_buffer.append(format(record.getDay())); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getEnd()))); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
java
private void writeCalendarHours(ProjectCalendar parentCalendar, ProjectCalendarHours record) throws IOException { m_buffer.setLength(0); int recordNumber; if (!parentCalendar.isDerived()) { recordNumber = MPXConstants.BASE_CALENDAR_HOURS_RECORD_NUMBER; } else { recordNumber = MPXConstants.RESOURCE_CALENDAR_HOURS_RECORD_NUMBER; } DateRange range1 = record.getRange(0); if (range1 == null) { range1 = DateRange.EMPTY_RANGE; } DateRange range2 = record.getRange(1); if (range2 == null) { range2 = DateRange.EMPTY_RANGE; } DateRange range3 = record.getRange(2); if (range3 == null) { range3 = DateRange.EMPTY_RANGE; } m_buffer.append(recordNumber); m_buffer.append(m_delimiter); m_buffer.append(format(record.getDay())); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range1.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range2.getEnd()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatTime(range3.getEnd()))); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
[ "private", "void", "writeCalendarHours", "(", "ProjectCalendar", "parentCalendar", ",", "ProjectCalendarHours", "record", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "int", "recordNumber", ";", "if", "(", "!", "parentCalend...
Write calendar hours. @param parentCalendar parent calendar instance @param record calendar hours instance @throws IOException
[ "Write", "calendar", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L394-L446
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeResource
private void writeResource(Resource record) throws IOException { m_buffer.setLength(0); // // Write the resource record // int[] fields = m_resourceModel.getModel(); m_buffer.append(MPXConstants.RESOURCE_RECORD_NUMBER); for (int loop = 0; loop < fields.length; loop++) { int mpxFieldType = fields[loop]; if (mpxFieldType == -1) { break; } ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType); Object value = record.getCachedValue(resourceField); value = formatType(resourceField.getDataType(), value); m_buffer.append(m_delimiter); m_buffer.append(format(value)); } stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); // // Write the resource notes // String notes = record.getNotes(); if (notes.length() != 0) { writeNotes(MPXConstants.RESOURCE_NOTES_RECORD_NUMBER, notes); } // // Write the resource calendar // if (record.getResourceCalendar() != null) { writeCalendar(record.getResourceCalendar()); } m_eventManager.fireResourceWrittenEvent(record); }
java
private void writeResource(Resource record) throws IOException { m_buffer.setLength(0); // // Write the resource record // int[] fields = m_resourceModel.getModel(); m_buffer.append(MPXConstants.RESOURCE_RECORD_NUMBER); for (int loop = 0; loop < fields.length; loop++) { int mpxFieldType = fields[loop]; if (mpxFieldType == -1) { break; } ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType); Object value = record.getCachedValue(resourceField); value = formatType(resourceField.getDataType(), value); m_buffer.append(m_delimiter); m_buffer.append(format(value)); } stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); // // Write the resource notes // String notes = record.getNotes(); if (notes.length() != 0) { writeNotes(MPXConstants.RESOURCE_NOTES_RECORD_NUMBER, notes); } // // Write the resource calendar // if (record.getResourceCalendar() != null) { writeCalendar(record.getResourceCalendar()); } m_eventManager.fireResourceWrittenEvent(record); }
[ "private", "void", "writeResource", "(", "Resource", "record", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "//", "// Write the resource record", "//", "int", "[", "]", "fields", "=", "m_resourceModel", ".", "getModel", ...
Write a resource. @param record resource instance @throws IOException
[ "Write", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L497-L545
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeNotes
private void writeNotes(int recordNumber, String text) throws IOException { m_buffer.setLength(0); m_buffer.append(recordNumber); m_buffer.append(m_delimiter); if (text != null) { String note = stripLineBreaks(text, MPXConstants.EOL_PLACEHOLDER_STRING); boolean quote = (note.indexOf(m_delimiter) != -1 || note.indexOf('"') != -1); int length = note.length(); char c; if (quote == true) { m_buffer.append('"'); } for (int loop = 0; loop < length; loop++) { c = note.charAt(loop); switch (c) { case '"': { m_buffer.append("\"\""); break; } default: { m_buffer.append(c); break; } } } if (quote == true) { m_buffer.append('"'); } } m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
java
private void writeNotes(int recordNumber, String text) throws IOException { m_buffer.setLength(0); m_buffer.append(recordNumber); m_buffer.append(m_delimiter); if (text != null) { String note = stripLineBreaks(text, MPXConstants.EOL_PLACEHOLDER_STRING); boolean quote = (note.indexOf(m_delimiter) != -1 || note.indexOf('"') != -1); int length = note.length(); char c; if (quote == true) { m_buffer.append('"'); } for (int loop = 0; loop < length; loop++) { c = note.charAt(loop); switch (c) { case '"': { m_buffer.append("\"\""); break; } default: { m_buffer.append(c); break; } } } if (quote == true) { m_buffer.append('"'); } } m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
[ "private", "void", "writeNotes", "(", "int", "recordNumber", ",", "String", "text", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "m_buffer", ".", "append", "(", "recordNumber", ")", ";", "m_buffer", ".", "append", "(...
Write notes. @param recordNumber record number @param text note text @throws IOException
[ "Write", "notes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L554-L602
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeResourceAssignment
private void writeResourceAssignment(ResourceAssignment record) throws IOException { m_buffer.setLength(0); m_buffer.append(MPXConstants.RESOURCE_ASSIGNMENT_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(formatResource(record.getResource())); m_buffer.append(m_delimiter); m_buffer.append(format(formatUnits(record.getUnits()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getBaselineWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getActualWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getOvertimeWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getBaselineCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getActualCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTime(record.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTime(record.getFinish()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getDelay()))); m_buffer.append(m_delimiter); m_buffer.append(format(record.getResourceUniqueID())); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); ResourceAssignmentWorkgroupFields workgroup = record.getWorkgroupAssignment(); if (workgroup == null) { workgroup = ResourceAssignmentWorkgroupFields.EMPTY; } writeResourceAssignmentWorkgroupFields(workgroup); m_eventManager.fireAssignmentWrittenEvent(record); }
java
private void writeResourceAssignment(ResourceAssignment record) throws IOException { m_buffer.setLength(0); m_buffer.append(MPXConstants.RESOURCE_ASSIGNMENT_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(formatResource(record.getResource())); m_buffer.append(m_delimiter); m_buffer.append(format(formatUnits(record.getUnits()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getBaselineWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getActualWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getOvertimeWork()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getBaselineCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatCurrency(record.getActualCost()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTime(record.getStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTime(record.getFinish()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDuration(record.getDelay()))); m_buffer.append(m_delimiter); m_buffer.append(format(record.getResourceUniqueID())); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); ResourceAssignmentWorkgroupFields workgroup = record.getWorkgroupAssignment(); if (workgroup == null) { workgroup = ResourceAssignmentWorkgroupFields.EMPTY; } writeResourceAssignmentWorkgroupFields(workgroup); m_eventManager.fireAssignmentWrittenEvent(record); }
[ "private", "void", "writeResourceAssignment", "(", "ResourceAssignment", "record", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "m_buffer", ".", "append", "(", "MPXConstants", ".", "RESOURCE_ASSIGNMENT_RECORD_NUMBER", ")", ";"...
Write resource assignment. @param record resource assignment instance @throws IOException
[ "Write", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L753-L796
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeResourceAssignmentWorkgroupFields
private void writeResourceAssignmentWorkgroupFields(ResourceAssignmentWorkgroupFields record) throws IOException { m_buffer.setLength(0); m_buffer.append(MPXConstants.RESOURCE_ASSIGNMENT_WORKGROUP_FIELDS_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(format(record.getMessageUniqueID())); m_buffer.append(m_delimiter); m_buffer.append(record.getConfirmed() ? "1" : "0"); m_buffer.append(m_delimiter); m_buffer.append(record.getResponsePending() ? "1" : "0"); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTimeNull(record.getUpdateStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTimeNull(record.getUpdateFinish()))); m_buffer.append(m_delimiter); m_buffer.append(format(record.getScheduleID())); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
java
private void writeResourceAssignmentWorkgroupFields(ResourceAssignmentWorkgroupFields record) throws IOException { m_buffer.setLength(0); m_buffer.append(MPXConstants.RESOURCE_ASSIGNMENT_WORKGROUP_FIELDS_RECORD_NUMBER); m_buffer.append(m_delimiter); m_buffer.append(format(record.getMessageUniqueID())); m_buffer.append(m_delimiter); m_buffer.append(record.getConfirmed() ? "1" : "0"); m_buffer.append(m_delimiter); m_buffer.append(record.getResponsePending() ? "1" : "0"); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTimeNull(record.getUpdateStart()))); m_buffer.append(m_delimiter); m_buffer.append(format(formatDateTimeNull(record.getUpdateFinish()))); m_buffer.append(m_delimiter); m_buffer.append(format(record.getScheduleID())); stripTrailingDelimiters(m_buffer); m_buffer.append(MPXConstants.EOL); m_writer.write(m_buffer.toString()); }
[ "private", "void", "writeResourceAssignmentWorkgroupFields", "(", "ResourceAssignmentWorkgroupFields", "record", ")", "throws", "IOException", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "m_buffer", ".", "append", "(", "MPXConstants", ".", "RESOURCE_ASSIGNMEN...
Write resource assignment workgroup. @param record resource assignment workgroup instance @throws IOException
[ "Write", "resource", "assignment", "workgroup", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L804-L826
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.writeTasks
private void writeTasks(List<Task> tasks) throws IOException { for (Task task : tasks) { writeTask(task); writeTasks(task.getChildTasks()); } }
java
private void writeTasks(List<Task> tasks) throws IOException { for (Task task : tasks) { writeTask(task); writeTasks(task.getChildTasks()); } }
[ "private", "void", "writeTasks", "(", "List", "<", "Task", ">", "tasks", ")", "throws", "IOException", "{", "for", "(", "Task", "task", ":", "tasks", ")", "{", "writeTask", "(", "task", ")", ";", "writeTasks", "(", "task", ".", "getChildTasks", "(", ")...
Recursively write tasks. @param tasks list of tasks @throws IOException
[ "Recursively", "write", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L834-L841
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.getIntegerTimeInMinutes
private Integer getIntegerTimeInMinutes(Date date) { Integer result = null; if (date != null) { Calendar cal = DateHelper.popCalendar(date); int time = cal.get(Calendar.HOUR_OF_DAY) * 60; time += cal.get(Calendar.MINUTE); DateHelper.pushCalendar(cal); result = Integer.valueOf(time); } return (result); }
java
private Integer getIntegerTimeInMinutes(Date date) { Integer result = null; if (date != null) { Calendar cal = DateHelper.popCalendar(date); int time = cal.get(Calendar.HOUR_OF_DAY) * 60; time += cal.get(Calendar.MINUTE); DateHelper.pushCalendar(cal); result = Integer.valueOf(time); } return (result); }
[ "private", "Integer", "getIntegerTimeInMinutes", "(", "Date", "date", ")", "{", "Integer", "result", "=", "null", ";", "if", "(", "date", "!=", "null", ")", "{", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", "date", ")", ";", "int", "tim...
This internal method is used to convert from a Date instance to an integer representing the number of minutes past midnight. @param date date instance @return minutes past midnight as an integer
[ "This", "internal", "method", "is", "used", "to", "convert", "from", "a", "Date", "instance", "to", "an", "integer", "representing", "the", "number", "of", "minutes", "past", "midnight", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L850-L862
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.escapeQuotes
private String escapeQuotes(String value) { StringBuilder sb = new StringBuilder(); int length = value.length(); char c; sb.append('"'); for (int index = 0; index < length; index++) { c = value.charAt(index); sb.append(c); if (c == '"') { sb.append('"'); } } sb.append('"'); return (sb.toString()); }
java
private String escapeQuotes(String value) { StringBuilder sb = new StringBuilder(); int length = value.length(); char c; sb.append('"'); for (int index = 0; index < length; index++) { c = value.charAt(index); sb.append(c); if (c == '"') { sb.append('"'); } } sb.append('"'); return (sb.toString()); }
[ "private", "String", "escapeQuotes", "(", "String", "value", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "length", "=", "value", ".", "length", "(", ")", ";", "char", "c", ";", "sb", ".", "append", "(", "'", "'...
This method is called when double quotes are found as part of a value. The quotes are escaped by adding a second quote character and the entire value is quoted. @param value text containing quote characters @return escaped and quoted text
[ "This", "method", "is", "called", "when", "double", "quotes", "are", "found", "as", "part", "of", "a", "value", ".", "The", "quotes", "are", "escaped", "by", "adding", "a", "second", "quote", "character", "and", "the", "entire", "value", "is", "quoted", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L872-L892
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.stripLineBreaks
private String stripLineBreaks(String text, String replacement) { if (text.indexOf('\r') != -1 || text.indexOf('\n') != -1) { StringBuilder sb = new StringBuilder(text); int index; while ((index = sb.indexOf("\r\n")) != -1) { sb.replace(index, index + 2, replacement); } while ((index = sb.indexOf("\n\r")) != -1) { sb.replace(index, index + 2, replacement); } while ((index = sb.indexOf("\r")) != -1) { sb.replace(index, index + 1, replacement); } while ((index = sb.indexOf("\n")) != -1) { sb.replace(index, index + 1, replacement); } text = sb.toString(); } return (text); }
java
private String stripLineBreaks(String text, String replacement) { if (text.indexOf('\r') != -1 || text.indexOf('\n') != -1) { StringBuilder sb = new StringBuilder(text); int index; while ((index = sb.indexOf("\r\n")) != -1) { sb.replace(index, index + 2, replacement); } while ((index = sb.indexOf("\n\r")) != -1) { sb.replace(index, index + 2, replacement); } while ((index = sb.indexOf("\r")) != -1) { sb.replace(index, index + 1, replacement); } while ((index = sb.indexOf("\n")) != -1) { sb.replace(index, index + 1, replacement); } text = sb.toString(); } return (text); }
[ "private", "String", "stripLineBreaks", "(", "String", "text", ",", "String", "replacement", ")", "{", "if", "(", "text", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", "||", "text", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "...
This method removes line breaks from a piece of text, and replaces them with the supplied text. @param text source text @param replacement line break replacement text @return text with line breaks removed.
[ "This", "method", "removes", "line", "breaks", "from", "a", "piece", "of", "text", "and", "replaces", "them", "with", "the", "supplied", "text", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L902-L934
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.format
private String format(Object o) { String result; if (o == null) { result = ""; } else { if (o instanceof Boolean == true) { result = LocaleData.getString(m_locale, (((Boolean) o).booleanValue() == true ? LocaleData.YES : LocaleData.NO)); } else { if (o instanceof Float == true || o instanceof Double == true) { result = (m_formats.getDecimalFormat().format(((Number) o).doubleValue())); } else { if (o instanceof Day) { result = Integer.toString(((Day) o).getValue()); } else { result = o.toString(); } } } // // At this point there should be no line break characters in // the file. If we find any, replace them with spaces // result = stripLineBreaks(result, MPXConstants.EOL_PLACEHOLDER_STRING); // // Finally we check to ensure that there are no embedded // quotes or separator characters in the value. If there are, then // we quote the value and escape any existing quote characters. // if (result.indexOf('"') != -1) { result = escapeQuotes(result); } else { if (result.indexOf(m_delimiter) != -1) { result = '"' + result + '"'; } } } return (result); }
java
private String format(Object o) { String result; if (o == null) { result = ""; } else { if (o instanceof Boolean == true) { result = LocaleData.getString(m_locale, (((Boolean) o).booleanValue() == true ? LocaleData.YES : LocaleData.NO)); } else { if (o instanceof Float == true || o instanceof Double == true) { result = (m_formats.getDecimalFormat().format(((Number) o).doubleValue())); } else { if (o instanceof Day) { result = Integer.toString(((Day) o).getValue()); } else { result = o.toString(); } } } // // At this point there should be no line break characters in // the file. If we find any, replace them with spaces // result = stripLineBreaks(result, MPXConstants.EOL_PLACEHOLDER_STRING); // // Finally we check to ensure that there are no embedded // quotes or separator characters in the value. If there are, then // we quote the value and escape any existing quote characters. // if (result.indexOf('"') != -1) { result = escapeQuotes(result); } else { if (result.indexOf(m_delimiter) != -1) { result = '"' + result + '"'; } } } return (result); }
[ "private", "String", "format", "(", "Object", "o", ")", "{", "String", "result", ";", "if", "(", "o", "==", "null", ")", "{", "result", "=", "\"\"", ";", "}", "else", "{", "if", "(", "o", "instanceof", "Boolean", "==", "true", ")", "{", "result", ...
This method returns the string representation of an object. In most cases this will simply involve calling the normal toString method on the object, but a couple of exceptions are handled here. @param o the object to formatted @return formatted string representing input Object
[ "This", "method", "returns", "the", "string", "representation", "of", "an", "object", ".", "In", "most", "cases", "this", "will", "simply", "involve", "calling", "the", "normal", "toString", "method", "on", "the", "object", "but", "a", "couple", "of", "excep...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L944-L1002
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.stripTrailingDelimiters
private void stripTrailingDelimiters(StringBuilder buffer) { int index = buffer.length() - 1; while (index > 0 && buffer.charAt(index) == m_delimiter) { --index; } buffer.setLength(index + 1); }
java
private void stripTrailingDelimiters(StringBuilder buffer) { int index = buffer.length() - 1; while (index > 0 && buffer.charAt(index) == m_delimiter) { --index; } buffer.setLength(index + 1); }
[ "private", "void", "stripTrailingDelimiters", "(", "StringBuilder", "buffer", ")", "{", "int", "index", "=", "buffer", ".", "length", "(", ")", "-", "1", ";", "while", "(", "index", ">", "0", "&&", "buffer", ".", "charAt", "(", "index", ")", "==", "m_d...
This method removes trailing delimiter characters. @param buffer input sring buffer
[ "This", "method", "removes", "trailing", "delimiter", "characters", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1009-L1019
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatTime
private String formatTime(Date value) { return (value == null ? null : m_formats.getTimeFormat().format(value)); }
java
private String formatTime(Date value) { return (value == null ? null : m_formats.getTimeFormat().format(value)); }
[ "private", "String", "formatTime", "(", "Date", "value", ")", "{", "return", "(", "value", "==", "null", "?", "null", ":", "m_formats", ".", "getTimeFormat", "(", ")", ".", "format", "(", "value", ")", ")", ";", "}" ]
This method is called to format a time value. @param value time value @return formatted time value
[ "This", "method", "is", "called", "to", "format", "a", "time", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1027-L1030
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatCurrency
private String formatCurrency(Number value) { return (value == null ? null : m_formats.getCurrencyFormat().format(value)); }
java
private String formatCurrency(Number value) { return (value == null ? null : m_formats.getCurrencyFormat().format(value)); }
[ "private", "String", "formatCurrency", "(", "Number", "value", ")", "{", "return", "(", "value", "==", "null", "?", "null", ":", "m_formats", ".", "getCurrencyFormat", "(", ")", ".", "format", "(", "value", ")", ")", ";", "}" ]
This method is called to format a currency value. @param value numeric value @return currency value
[ "This", "method", "is", "called", "to", "format", "a", "currency", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1038-L1041
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatUnits
private String formatUnits(Number value) { return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100)); }
java
private String formatUnits(Number value) { return (value == null ? null : m_formats.getUnitsDecimalFormat().format(value.doubleValue() / 100)); }
[ "private", "String", "formatUnits", "(", "Number", "value", ")", "{", "return", "(", "value", "==", "null", "?", "null", ":", "m_formats", ".", "getUnitsDecimalFormat", "(", ")", ".", "format", "(", "value", ".", "doubleValue", "(", ")", "/", "100", ")",...
This method is called to format a units value. @param value numeric value @return currency value
[ "This", "method", "is", "called", "to", "format", "a", "units", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1049-L1052
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatDateTimeNull
private String formatDateTimeNull(Date value) { return (value == null ? m_formats.getNullText() : m_formats.getDateTimeFormat().format(value)); }
java
private String formatDateTimeNull(Date value) { return (value == null ? m_formats.getNullText() : m_formats.getDateTimeFormat().format(value)); }
[ "private", "String", "formatDateTimeNull", "(", "Date", "value", ")", "{", "return", "(", "value", "==", "null", "?", "m_formats", ".", "getNullText", "(", ")", ":", "m_formats", ".", "getDateTimeFormat", "(", ")", ".", "format", "(", "value", ")", ")", ...
This method is called to format a date. It will return the null text if a null value is supplied. @param value date value @return formatted date value
[ "This", "method", "is", "called", "to", "format", "a", "date", ".", "It", "will", "return", "the", "null", "text", "if", "a", "null", "value", "is", "supplied", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1077-L1080
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatPercentage
private String formatPercentage(Number value) { return (value == null ? null : m_formats.getPercentageDecimalFormat().format(value) + "%"); }
java
private String formatPercentage(Number value) { return (value == null ? null : m_formats.getPercentageDecimalFormat().format(value) + "%"); }
[ "private", "String", "formatPercentage", "(", "Number", "value", ")", "{", "return", "(", "value", "==", "null", "?", "null", ":", "m_formats", ".", "getPercentageDecimalFormat", "(", ")", ".", "format", "(", "value", ")", "+", "\"%\"", ")", ";", "}" ]
This method is called to format a percentage value. @param value numeric value @return percentage value
[ "This", "method", "is", "called", "to", "format", "a", "percentage", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1099-L1102
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatAccrueType
private String formatAccrueType(AccrueType type) { return (type == null ? null : LocaleData.getStringArray(m_locale, LocaleData.ACCRUE_TYPES)[type.getValue() - 1]); }
java
private String formatAccrueType(AccrueType type) { return (type == null ? null : LocaleData.getStringArray(m_locale, LocaleData.ACCRUE_TYPES)[type.getValue() - 1]); }
[ "private", "String", "formatAccrueType", "(", "AccrueType", "type", ")", "{", "return", "(", "type", "==", "null", "?", "null", ":", "LocaleData", ".", "getStringArray", "(", "m_locale", ",", "LocaleData", ".", "ACCRUE_TYPES", ")", "[", "type", ".", "getValu...
This method is called to format an accrue type value. @param type accrue type @return formatted accrue type
[ "This", "method", "is", "called", "to", "format", "an", "accrue", "type", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1110-L1113
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatConstraintType
private String formatConstraintType(ConstraintType type) { return (type == null ? null : LocaleData.getStringArray(m_locale, LocaleData.CONSTRAINT_TYPES)[type.getValue()]); }
java
private String formatConstraintType(ConstraintType type) { return (type == null ? null : LocaleData.getStringArray(m_locale, LocaleData.CONSTRAINT_TYPES)[type.getValue()]); }
[ "private", "String", "formatConstraintType", "(", "ConstraintType", "type", ")", "{", "return", "(", "type", "==", "null", "?", "null", ":", "LocaleData", ".", "getStringArray", "(", "m_locale", ",", "LocaleData", ".", "CONSTRAINT_TYPES", ")", "[", "type", "."...
This method is called to format a constraint type. @param type constraint type @return formatted constraint type
[ "This", "method", "is", "called", "to", "format", "a", "constraint", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1121-L1124
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatDuration
private String formatDuration(Object value) { String result = null; if (value instanceof Duration) { Duration duration = (Duration) value; result = m_formats.getDurationDecimalFormat().format(duration.getDuration()) + formatTimeUnit(duration.getUnits()); } return result; }
java
private String formatDuration(Object value) { String result = null; if (value instanceof Duration) { Duration duration = (Duration) value; result = m_formats.getDurationDecimalFormat().format(duration.getDuration()) + formatTimeUnit(duration.getUnits()); } return result; }
[ "private", "String", "formatDuration", "(", "Object", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "instanceof", "Duration", ")", "{", "Duration", "duration", "=", "(", "Duration", ")", "value", ";", "result", "=", "m_format...
This method is called to format a duration. @param value duration value @return formatted duration value
[ "This", "method", "is", "called", "to", "format", "a", "duration", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1132-L1141
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatRate
private String formatRate(Rate value) { String result = null; if (value != null) { StringBuilder buffer = new StringBuilder(m_formats.getCurrencyFormat().format(value.getAmount())); buffer.append("/"); buffer.append(formatTimeUnit(value.getUnits())); result = buffer.toString(); } return (result); }
java
private String formatRate(Rate value) { String result = null; if (value != null) { StringBuilder buffer = new StringBuilder(m_formats.getCurrencyFormat().format(value.getAmount())); buffer.append("/"); buffer.append(formatTimeUnit(value.getUnits())); result = buffer.toString(); } return (result); }
[ "private", "String", "formatRate", "(", "Rate", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", "m_formats", ".", "getCurrencyFormat", "(", ")...
This method is called to format a rate. @param value rate value @return formatted rate
[ "This", "method", "is", "called", "to", "format", "a", "rate", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1149-L1160
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatPriority
private String formatPriority(Priority value) { String result = null; if (value != null) { String[] priorityTypes = LocaleData.getStringArray(m_locale, LocaleData.PRIORITY_TYPES); int priority = value.getValue(); if (priority < Priority.LOWEST) { priority = Priority.LOWEST; } else { if (priority > Priority.DO_NOT_LEVEL) { priority = Priority.DO_NOT_LEVEL; } } priority /= 100; result = priorityTypes[priority - 1]; } return (result); }
java
private String formatPriority(Priority value) { String result = null; if (value != null) { String[] priorityTypes = LocaleData.getStringArray(m_locale, LocaleData.PRIORITY_TYPES); int priority = value.getValue(); if (priority < Priority.LOWEST) { priority = Priority.LOWEST; } else { if (priority > Priority.DO_NOT_LEVEL) { priority = Priority.DO_NOT_LEVEL; } } priority /= 100; result = priorityTypes[priority - 1]; } return (result); }
[ "private", "String", "formatPriority", "(", "Priority", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", ")", "{", "String", "[", "]", "priorityTypes", "=", "LocaleData", ".", "getStringArray", "(", "m_locale", ","...
This method is called to format a priority. @param value priority instance @return formatted priority value
[ "This", "method", "is", "called", "to", "format", "a", "priority", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1168-L1194
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatTaskType
private String formatTaskType(TaskType value) { return (LocaleData.getString(m_locale, (value == TaskType.FIXED_DURATION ? LocaleData.YES : LocaleData.NO))); }
java
private String formatTaskType(TaskType value) { return (LocaleData.getString(m_locale, (value == TaskType.FIXED_DURATION ? LocaleData.YES : LocaleData.NO))); }
[ "private", "String", "formatTaskType", "(", "TaskType", "value", ")", "{", "return", "(", "LocaleData", ".", "getString", "(", "m_locale", ",", "(", "value", "==", "TaskType", ".", "FIXED_DURATION", "?", "LocaleData", ".", "YES", ":", "LocaleData", ".", "NO"...
This method is called to format a task type. @param value task type value @return formatted task type
[ "This", "method", "is", "called", "to", "format", "a", "task", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1202-L1205
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatRelationList
private String formatRelationList(List<Relation> value) { String result = null; if (value != null && value.size() != 0) { StringBuilder sb = new StringBuilder(); for (Relation relation : value) { if (sb.length() != 0) { sb.append(m_delimiter); } sb.append(formatRelation(relation)); } result = sb.toString(); } return (result); }
java
private String formatRelationList(List<Relation> value) { String result = null; if (value != null && value.size() != 0) { StringBuilder sb = new StringBuilder(); for (Relation relation : value) { if (sb.length() != 0) { sb.append(m_delimiter); } sb.append(formatRelation(relation)); } result = sb.toString(); } return (result); }
[ "private", "String", "formatRelationList", "(", "List", "<", "Relation", ">", "value", ")", "{", "String", "result", "=", "null", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "size", "(", ")", "!=", "0", ")", "{", "StringBuilder", "sb", ...
This method is called to format a relation list. @param value relation list instance @return formatted relation list
[ "This", "method", "is", "called", "to", "format", "a", "relation", "list", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1213-L1234
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatRelation
private String formatRelation(Relation relation) { String result = null; if (relation != null) { StringBuilder sb = new StringBuilder(relation.getTargetTask().getID().toString()); Duration duration = relation.getLag(); RelationType type = relation.getType(); double durationValue = duration.getDuration(); if ((durationValue != 0) || (type != RelationType.FINISH_START)) { String[] typeNames = LocaleData.getStringArray(m_locale, LocaleData.RELATION_TYPES); sb.append(typeNames[type.getValue()]); } if (durationValue != 0) { if (durationValue > 0) { sb.append('+'); } sb.append(formatDuration(duration)); } result = sb.toString(); } m_eventManager.fireRelationWrittenEvent(relation); return (result); }
java
private String formatRelation(Relation relation) { String result = null; if (relation != null) { StringBuilder sb = new StringBuilder(relation.getTargetTask().getID().toString()); Duration duration = relation.getLag(); RelationType type = relation.getType(); double durationValue = duration.getDuration(); if ((durationValue != 0) || (type != RelationType.FINISH_START)) { String[] typeNames = LocaleData.getStringArray(m_locale, LocaleData.RELATION_TYPES); sb.append(typeNames[type.getValue()]); } if (durationValue != 0) { if (durationValue > 0) { sb.append('+'); } sb.append(formatDuration(duration)); } result = sb.toString(); } m_eventManager.fireRelationWrittenEvent(relation); return (result); }
[ "private", "String", "formatRelation", "(", "Relation", "relation", ")", "{", "String", "result", "=", "null", ";", "if", "(", "relation", "!=", "null", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "relation", ".", "getTargetTask", "(",...
This method is called to format a relation. @param relation relation instance @return formatted relation instance
[ "This", "method", "is", "called", "to", "format", "a", "relation", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1242-L1275
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatTimeUnit
private String formatTimeUnit(TimeUnit timeUnit) { int units = timeUnit.getValue(); String result; String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY); if (units < 0 || units >= unitNames.length) { result = ""; } else { result = unitNames[units][0]; } return (result); }
java
private String formatTimeUnit(TimeUnit timeUnit) { int units = timeUnit.getValue(); String result; String[][] unitNames = LocaleData.getStringArrays(m_locale, LocaleData.TIME_UNITS_ARRAY); if (units < 0 || units >= unitNames.length) { result = ""; } else { result = unitNames[units][0]; } return (result); }
[ "private", "String", "formatTimeUnit", "(", "TimeUnit", "timeUnit", ")", "{", "int", "units", "=", "timeUnit", ".", "getValue", "(", ")", ";", "String", "result", ";", "String", "[", "]", "[", "]", "unitNames", "=", "LocaleData", ".", "getStringArrays", "(...
This method formats a time unit. @param timeUnit time unit instance @return formatted time unit instance
[ "This", "method", "formats", "a", "time", "unit", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1283-L1299
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXWriter.java
MPXWriter.formatType
@SuppressWarnings("unchecked") private Object formatType(DataType type, Object value) { switch (type) { case DATE: { value = formatDateTime(value); break; } case CURRENCY: { value = formatCurrency((Number) value); break; } case UNITS: { value = formatUnits((Number) value); break; } case PERCENTAGE: { value = formatPercentage((Number) value); break; } case ACCRUE: { value = formatAccrueType((AccrueType) value); break; } case CONSTRAINT: { value = formatConstraintType((ConstraintType) value); break; } case WORK: case DURATION: { value = formatDuration(value); break; } case RATE: { value = formatRate((Rate) value); break; } case PRIORITY: { value = formatPriority((Priority) value); break; } case RELATION_LIST: { value = formatRelationList((List<Relation>) value); break; } case TASK_TYPE: { value = formatTaskType((TaskType) value); break; } default: { break; } } return (value); }
java
@SuppressWarnings("unchecked") private Object formatType(DataType type, Object value) { switch (type) { case DATE: { value = formatDateTime(value); break; } case CURRENCY: { value = formatCurrency((Number) value); break; } case UNITS: { value = formatUnits((Number) value); break; } case PERCENTAGE: { value = formatPercentage((Number) value); break; } case ACCRUE: { value = formatAccrueType((AccrueType) value); break; } case CONSTRAINT: { value = formatConstraintType((ConstraintType) value); break; } case WORK: case DURATION: { value = formatDuration(value); break; } case RATE: { value = formatRate((Rate) value); break; } case PRIORITY: { value = formatPriority((Priority) value); break; } case RELATION_LIST: { value = formatRelationList((List<Relation>) value); break; } case TASK_TYPE: { value = formatTaskType((TaskType) value); break; } default: { break; } } return (value); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Object", "formatType", "(", "DataType", "type", ",", "Object", "value", ")", "{", "switch", "(", "type", ")", "{", "case", "DATE", ":", "{", "value", "=", "formatDateTime", "(", "value", ")", ...
Converts a value to the appropriate type. @param type target type @param value input value @return output value
[ "Converts", "a", "value", "to", "the", "appropriate", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXWriter.java#L1319-L1397
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/MapRow.java
MapRow.getBoolean
public final boolean getBoolean(String name) { boolean result = false; Boolean value = (Boolean) getObject(name); if (value != null) { result = BooleanHelper.getBoolean(value); } return result; }
java
public final boolean getBoolean(String name) { boolean result = false; Boolean value = (Boolean) getObject(name); if (value != null) { result = BooleanHelper.getBoolean(value); } return result; }
[ "public", "final", "boolean", "getBoolean", "(", "String", "name", ")", "{", "boolean", "result", "=", "false", ";", "Boolean", "value", "=", "(", "Boolean", ")", "getObject", "(", "name", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "result",...
Retrieve a boolean value. @param name column name @return boolean value
[ "Retrieve", "a", "boolean", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/MapRow.java#L90-L99
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/DocumentInputStreamFactory.java
DocumentInputStreamFactory.getInstance
public InputStream getInstance(DirectoryEntry directory, String name) throws IOException { DocumentEntry entry = (DocumentEntry) directory.getEntry(name); InputStream stream; if (m_encrypted) { stream = new EncryptedDocumentInputStream(entry, m_encryptionCode); } else { stream = new DocumentInputStream(entry); } return stream; }
java
public InputStream getInstance(DirectoryEntry directory, String name) throws IOException { DocumentEntry entry = (DocumentEntry) directory.getEntry(name); InputStream stream; if (m_encrypted) { stream = new EncryptedDocumentInputStream(entry, m_encryptionCode); } else { stream = new DocumentInputStream(entry); } return stream; }
[ "public", "InputStream", "getInstance", "(", "DirectoryEntry", "directory", ",", "String", "name", ")", "throws", "IOException", "{", "DocumentEntry", "entry", "=", "(", "DocumentEntry", ")", "directory", ".", "getEntry", "(", "name", ")", ";", "InputStream", "s...
Method used to instantiate the appropriate input stream reader, a standard one, or one which can deal with "encrypted" data. @param directory directory entry @param name file name @return new input stream @throws IOException
[ "Method", "used", "to", "instantiate", "the", "appropriate", "input", "stream", "reader", "a", "standard", "one", "or", "one", "which", "can", "deal", "with", "encrypted", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/DocumentInputStreamFactory.java#L59-L73
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttBarStyleFactory14.java
GanttBarStyleFactory14.getTaskField
private TaskField getTaskField(int field) { TaskField result = MPPTaskField14.getInstance(field); if (result != null) { switch (result) { case START_TEXT: { result = TaskField.START; break; } case FINISH_TEXT: { result = TaskField.FINISH; break; } case DURATION_TEXT: { result = TaskField.DURATION; break; } default: { break; } } } return result; }
java
private TaskField getTaskField(int field) { TaskField result = MPPTaskField14.getInstance(field); if (result != null) { switch (result) { case START_TEXT: { result = TaskField.START; break; } case FINISH_TEXT: { result = TaskField.FINISH; break; } case DURATION_TEXT: { result = TaskField.DURATION; break; } default: { break; } } } return result; }
[ "private", "TaskField", "getTaskField", "(", "int", "field", ")", "{", "TaskField", "result", "=", "MPPTaskField14", ".", "getInstance", "(", "field", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "switch", "(", "result", ")", "{", "case", "STAR...
Maps an integer field ID to a field type. @param field field ID @return field type
[ "Maps", "an", "integer", "field", "ID", "to", "a", "field", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttBarStyleFactory14.java#L173-L207
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectConfig.java
ProjectConfig.updateUniqueCounters
public void updateUniqueCounters() { // // Update task unique IDs // for (Task task : m_parent.getTasks()) { int uniqueID = NumberHelper.getInt(task.getUniqueID()); if (uniqueID > m_taskUniqueID) { m_taskUniqueID = uniqueID; } } // // Update resource unique IDs // for (Resource resource : m_parent.getResources()) { int uniqueID = NumberHelper.getInt(resource.getUniqueID()); if (uniqueID > m_resourceUniqueID) { m_resourceUniqueID = uniqueID; } } // // Update calendar unique IDs // for (ProjectCalendar calendar : m_parent.getCalendars()) { int uniqueID = NumberHelper.getInt(calendar.getUniqueID()); if (uniqueID > m_calendarUniqueID) { m_calendarUniqueID = uniqueID; } } // // Update assignment unique IDs // for (ResourceAssignment assignment : m_parent.getResourceAssignments()) { int uniqueID = NumberHelper.getInt(assignment.getUniqueID()); if (uniqueID > m_assignmentUniqueID) { m_assignmentUniqueID = uniqueID; } } }
java
public void updateUniqueCounters() { // // Update task unique IDs // for (Task task : m_parent.getTasks()) { int uniqueID = NumberHelper.getInt(task.getUniqueID()); if (uniqueID > m_taskUniqueID) { m_taskUniqueID = uniqueID; } } // // Update resource unique IDs // for (Resource resource : m_parent.getResources()) { int uniqueID = NumberHelper.getInt(resource.getUniqueID()); if (uniqueID > m_resourceUniqueID) { m_resourceUniqueID = uniqueID; } } // // Update calendar unique IDs // for (ProjectCalendar calendar : m_parent.getCalendars()) { int uniqueID = NumberHelper.getInt(calendar.getUniqueID()); if (uniqueID > m_calendarUniqueID) { m_calendarUniqueID = uniqueID; } } // // Update assignment unique IDs // for (ResourceAssignment assignment : m_parent.getResourceAssignments()) { int uniqueID = NumberHelper.getInt(assignment.getUniqueID()); if (uniqueID > m_assignmentUniqueID) { m_assignmentUniqueID = uniqueID; } } }
[ "public", "void", "updateUniqueCounters", "(", ")", "{", "//", "// Update task unique IDs", "//", "for", "(", "Task", "task", ":", "m_parent", ".", "getTasks", "(", ")", ")", "{", "int", "uniqueID", "=", "NumberHelper", ".", "getInt", "(", "task", ".", "ge...
This method is called to ensure that after a project file has been read, the cached unique ID values used to generate new unique IDs start after the end of the existing set of unique IDs.
[ "This", "method", "is", "called", "to", "ensure", "that", "after", "a", "project", "file", "has", "been", "read", "the", "cached", "unique", "ID", "values", "used", "to", "generate", "new", "unique", "IDs", "start", "after", "the", "end", "of", "the", "e...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectConfig.java#L297-L346
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.min
public static Date min(Date d1, Date d2) { Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) < 0) ? d1 : d2; } return result; }
java
public static Date min(Date d1, Date d2) { Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) < 0) ? d1 : d2; } return result; }
[ "public", "static", "Date", "min", "(", "Date", "d1", ",", "Date", "d2", ")", "{", "Date", "result", ";", "if", "(", "d1", "==", "null", ")", "{", "result", "=", "d2", ";", "}", "else", "if", "(", "d2", "==", "null", ")", "{", "result", "=", ...
Returns the earlier of two dates, handling null values. A non-null Date is always considered to be earlier than a null Date. @param d1 Date instance @param d2 Date instance @return Date earliest date
[ "Returns", "the", "earlier", "of", "two", "dates", "handling", "null", "values", ".", "A", "non", "-", "null", "Date", "is", "always", "considered", "to", "be", "earlier", "than", "a", "null", "Date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L191-L208
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.max
public static Date max(Date d1, Date d2) { Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) > 0) ? d1 : d2; } return result; }
java
public static Date max(Date d1, Date d2) { Date result; if (d1 == null) { result = d2; } else if (d2 == null) { result = d1; } else { result = (d1.compareTo(d2) > 0) ? d1 : d2; } return result; }
[ "public", "static", "Date", "max", "(", "Date", "d1", ",", "Date", "d2", ")", "{", "Date", "result", ";", "if", "(", "d1", "==", "null", ")", "{", "result", "=", "d2", ";", "}", "else", "if", "(", "d2", "==", "null", ")", "{", "result", "=", ...
Returns the later of two dates, handling null values. A non-null Date is always considered to be later than a null Date. @param d1 Date instance @param d2 Date instance @return Date latest date
[ "Returns", "the", "later", "of", "two", "dates", "handling", "null", "values", ".", "A", "non", "-", "null", "Date", "is", "always", "considered", "to", "be", "later", "than", "a", "null", "Date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L218-L235
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getVariance
public static Duration getVariance(Task task, Date date1, Date date2, TimeUnit format) { Duration variance = null; if (date1 != null && date2 != null) { ProjectCalendar calendar = task.getEffectiveCalendar(); if (calendar != null) { variance = calendar.getWork(date1, date2, format); } } if (variance == null) { variance = Duration.getInstance(0, format); } return (variance); }
java
public static Duration getVariance(Task task, Date date1, Date date2, TimeUnit format) { Duration variance = null; if (date1 != null && date2 != null) { ProjectCalendar calendar = task.getEffectiveCalendar(); if (calendar != null) { variance = calendar.getWork(date1, date2, format); } } if (variance == null) { variance = Duration.getInstance(0, format); } return (variance); }
[ "public", "static", "Duration", "getVariance", "(", "Task", "task", ",", "Date", "date1", ",", "Date", "date2", ",", "TimeUnit", "format", ")", "{", "Duration", "variance", "=", "null", ";", "if", "(", "date1", "!=", "null", "&&", "date2", "!=", "null", ...
This utility method calculates the difference in working time between two dates, given the context of a task. @param task parent task @param date1 first date @param date2 second date @param format required format for the resulting duration @return difference in working time between the two dates
[ "This", "utility", "method", "calculates", "the", "difference", "in", "working", "time", "between", "two", "dates", "given", "the", "context", "of", "a", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L247-L266
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getDateFromLong
public static Date getDateFromLong(long date) { TimeZone tz = TimeZone.getDefault(); return (new Date(date - tz.getRawOffset())); }
java
public static Date getDateFromLong(long date) { TimeZone tz = TimeZone.getDefault(); return (new Date(date - tz.getRawOffset())); }
[ "public", "static", "Date", "getDateFromLong", "(", "long", "date", ")", "{", "TimeZone", "tz", "=", "TimeZone", ".", "getDefault", "(", ")", ";", "return", "(", "new", "Date", "(", "date", "-", "tz", ".", "getRawOffset", "(", ")", ")", ")", ";", "}"...
Creates a date from the equivalent long value. This conversion takes account of the time zone. @param date date expressed as a long integer @return new Date instance
[ "Creates", "a", "date", "from", "the", "equivalent", "long", "value", ".", "This", "conversion", "takes", "account", "of", "the", "time", "zone", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L275-L279
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getTimestampFromLong
public static Date getTimestampFromLong(long timestamp) { TimeZone tz = TimeZone.getDefault(); Date result = new Date(timestamp - tz.getRawOffset()); if (tz.inDaylightTime(result) == true) { int savings; if (HAS_DST_SAVINGS == true) { savings = tz.getDSTSavings(); } else { savings = DEFAULT_DST_SAVINGS; } result = new Date(result.getTime() - savings); } return (result); }
java
public static Date getTimestampFromLong(long timestamp) { TimeZone tz = TimeZone.getDefault(); Date result = new Date(timestamp - tz.getRawOffset()); if (tz.inDaylightTime(result) == true) { int savings; if (HAS_DST_SAVINGS == true) { savings = tz.getDSTSavings(); } else { savings = DEFAULT_DST_SAVINGS; } result = new Date(result.getTime() - savings); } return (result); }
[ "public", "static", "Date", "getTimestampFromLong", "(", "long", "timestamp", ")", "{", "TimeZone", "tz", "=", "TimeZone", ".", "getDefault", "(", ")", ";", "Date", "result", "=", "new", "Date", "(", "timestamp", "-", "tz", ".", "getRawOffset", "(", ")", ...
Creates a timestamp from the equivalent long value. This conversion takes account of the time zone and any daylight savings time. @param timestamp timestamp expressed as a long integer @return new Date instance
[ "Creates", "a", "timestamp", "from", "the", "equivalent", "long", "value", ".", "This", "conversion", "takes", "account", "of", "the", "time", "zone", "and", "any", "daylight", "savings", "time", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L288-L309
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getTime
public static Date getTime(int hour, int minutes) { Calendar cal = popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, 0); Date result = cal.getTime(); pushCalendar(cal); return result; }
java
public static Date getTime(int hour, int minutes) { Calendar cal = popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, 0); Date result = cal.getTime(); pushCalendar(cal); return result; }
[ "public", "static", "Date", "getTime", "(", "int", "hour", ",", "int", "minutes", ")", "{", "Calendar", "cal", "=", "popCalendar", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hour", ")", ";", "cal", ".", "set", "(", ...
Create a Date instance representing a specific time. @param hour hour 0-23 @param minutes minutes 0-59 @return new Date instance
[ "Create", "a", "Date", "instance", "representing", "a", "specific", "time", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L318-L327
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.setTime
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
java
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
[ "public", "static", "void", "setTime", "(", "Calendar", "cal", ",", "Date", "time", ")", "{", "if", "(", "time", "!=", "null", ")", "{", "Calendar", "startCalendar", "=", "popCalendar", "(", "time", ")", ";", "cal", ".", "set", "(", "Calendar", ".", ...
Given a date represented by a Calendar instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param cal Calendar instance representing the date @param time Date instance representing the time of day
[ "Given", "a", "date", "represented", "by", "a", "Calendar", "instance", "set", "the", "time", "component", "of", "the", "date", "based", "on", "the", "hours", "and", "minutes", "of", "the", "time", "supplied", "by", "the", "Date", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L337-L347
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.setTime
public static Date setTime(Date date, Date canonicalTime) { Date result; if (canonicalTime == null) { result = date; } else { // // The original naive implementation of this method generated // the "start of day" date (midnight) for the required day // then added the milliseconds from the canonical time // to move the time forward to the required point. Unfortunately // if the date we'e trying to do this for is the entry or // exit from DST, the result is wrong, hence I've switched to // the approach below. // Calendar cal = popCalendar(canonicalTime); int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1; int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); int millisecond = cal.get(Calendar.MILLISECOND); cal.setTime(date); if (dayOffset != 0) { // The canonical time can be +1 day. // It's to do with the way we've historically // managed time ranges and midnight. cal.add(Calendar.DAY_OF_YEAR, dayOffset); } cal.set(Calendar.MILLISECOND, millisecond); cal.set(Calendar.SECOND, second); cal.set(Calendar.MINUTE, minute); cal.set(Calendar.HOUR_OF_DAY, hourOfDay); result = cal.getTime(); pushCalendar(cal); } return result; }
java
public static Date setTime(Date date, Date canonicalTime) { Date result; if (canonicalTime == null) { result = date; } else { // // The original naive implementation of this method generated // the "start of day" date (midnight) for the required day // then added the milliseconds from the canonical time // to move the time forward to the required point. Unfortunately // if the date we'e trying to do this for is the entry or // exit from DST, the result is wrong, hence I've switched to // the approach below. // Calendar cal = popCalendar(canonicalTime); int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1; int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); int millisecond = cal.get(Calendar.MILLISECOND); cal.setTime(date); if (dayOffset != 0) { // The canonical time can be +1 day. // It's to do with the way we've historically // managed time ranges and midnight. cal.add(Calendar.DAY_OF_YEAR, dayOffset); } cal.set(Calendar.MILLISECOND, millisecond); cal.set(Calendar.SECOND, second); cal.set(Calendar.MINUTE, minute); cal.set(Calendar.HOUR_OF_DAY, hourOfDay); result = cal.getTime(); pushCalendar(cal); } return result; }
[ "public", "static", "Date", "setTime", "(", "Date", "date", ",", "Date", "canonicalTime", ")", "{", "Date", "result", ";", "if", "(", "canonicalTime", "==", "null", ")", "{", "result", "=", "date", ";", "}", "else", "{", "//", "// The original naive implem...
Given a date represented by a Date instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param date Date instance representing the date @param canonicalTime Date instance representing the time of day @return new Date instance with the required time set
[ "Given", "a", "date", "represented", "by", "a", "Date", "instance", "set", "the", "time", "component", "of", "the", "date", "based", "on", "the", "hours", "and", "minutes", "of", "the", "time", "supplied", "by", "the", "Date", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L358-L402
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.addDays
public static Date addDays(Date date, int days) { Calendar cal = popCalendar(date); cal.add(Calendar.DAY_OF_YEAR, days); Date result = cal.getTime(); pushCalendar(cal); return result; }
java
public static Date addDays(Date date, int days) { Calendar cal = popCalendar(date); cal.add(Calendar.DAY_OF_YEAR, days); Date result = cal.getTime(); pushCalendar(cal); return result; }
[ "public", "static", "Date", "addDays", "(", "Date", "date", ",", "int", "days", ")", "{", "Calendar", "cal", "=", "popCalendar", "(", "date", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "days", ")", ";", "Date", "result", "...
Add a number of days to the supplied date. @param date start date @param days number of days to add @return new date
[ "Add", "a", "number", "of", "days", "to", "the", "supplied", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L441-L448
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.popCalendar
public static Calendar popCalendar() { Calendar result; Deque<Calendar> calendars = CALENDARS.get(); if (calendars.isEmpty()) { result = Calendar.getInstance(); } else { result = calendars.pop(); } return result; }
java
public static Calendar popCalendar() { Calendar result; Deque<Calendar> calendars = CALENDARS.get(); if (calendars.isEmpty()) { result = Calendar.getInstance(); } else { result = calendars.pop(); } return result; }
[ "public", "static", "Calendar", "popCalendar", "(", ")", "{", "Calendar", "result", ";", "Deque", "<", "Calendar", ">", "calendars", "=", "CALENDARS", ".", "get", "(", ")", ";", "if", "(", "calendars", ".", "isEmpty", "(", ")", ")", "{", "result", "=",...
Acquire a calendar instance. @return Calendar instance
[ "Acquire", "a", "calendar", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L455-L468
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/BlockReader.java
BlockReader.read
public List<MapRow> read() throws IOException { List<MapRow> result = new ArrayList<MapRow>(); int fileCount = m_stream.readInt(); if (fileCount != 0) { for (int index = 0; index < fileCount; index++) { // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); readBlock(map); result.add(new MapRow(map)); } } return result; }
java
public List<MapRow> read() throws IOException { List<MapRow> result = new ArrayList<MapRow>(); int fileCount = m_stream.readInt(); if (fileCount != 0) { for (int index = 0; index < fileCount; index++) { // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); readBlock(map); result.add(new MapRow(map)); } } return result; }
[ "public", "List", "<", "MapRow", ">", "read", "(", ")", "throws", "IOException", "{", "List", "<", "MapRow", ">", "result", "=", "new", "ArrayList", "<", "MapRow", ">", "(", ")", ";", "int", "fileCount", "=", "m_stream", ".", "readInt", "(", ")", ";"...
Read a list of fixed sized blocks from the input stream. @return List of MapRow instances representing the fixed size blocks
[ "Read", "a", "list", "of", "fixed", "sized", "blocks", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/BlockReader.java#L52-L68
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readByte
protected int readByte(InputStream is) throws IOException { byte[] data = new byte[1]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getByte(data, 0)); }
java
protected int readByte(InputStream is) throws IOException { byte[] data = new byte[1]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getByte(data, 0)); }
[ "protected", "int", "readByte", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "1", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", ...
This method reads a single byte from the input stream. @param is the input stream @return byte value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "single", "byte", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L51-L60
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readShort
protected int readShort(InputStream is) throws IOException { byte[] data = new byte[2]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getShort(data, 0)); }
java
protected int readShort(InputStream is) throws IOException { byte[] data = new byte[2]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getShort(data, 0)); }
[ "protected", "int", "readShort", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "2", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", ...
This method reads a two byte integer from the input stream. @param is the input stream @return integer value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "two", "byte", "integer", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L69-L78
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readInt
protected int readInt(InputStream is) throws IOException { byte[] data = new byte[4]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getInt(data, 0)); }
java
protected int readInt(InputStream is) throws IOException { byte[] data = new byte[4]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getInt(data, 0)); }
[ "protected", "int", "readInt", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "4", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", "...
This method reads a four byte integer from the input stream. @param is the input stream @return byte value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "four", "byte", "integer", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L87-L96
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readByteArray
protected byte[] readByteArray(InputStream is, int size) throws IOException { byte[] buffer = new byte[size]; if (is.read(buffer) != buffer.length) { throw new EOFException(); } return (buffer); }
java
protected byte[] readByteArray(InputStream is, int size) throws IOException { byte[] buffer = new byte[size]; if (is.read(buffer) != buffer.length) { throw new EOFException(); } return (buffer); }
[ "protected", "byte", "[", "]", "readByteArray", "(", "InputStream", "is", ",", "int", "size", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "size", "]", ";", "if", "(", "is", ".", "read", "(", "buffer", ")", ...
This method reads a byte array from the input stream. @param is the input stream @param size number of bytes to read @return byte array @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "byte", "array", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L106-L114
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/Blast.java
Blast.blast
public int blast(InputStream input, OutputStream output) throws IOException { m_input = input; m_output = output; int lit; /* true if literals are coded */ int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ int dist; /* distance for copy */ int copy; /* copy counter */ //unsigned char *from, *to; /* copy pointers */ /* read header */ lit = bits(8); if (lit > 1) { return -1; } dict = bits(8); if (dict < 4 || dict > 6) { return -2; } /* decode literals and length/distance pairs */ do { if (bits(1) != 0) { /* get length */ symbol = decode(LENCODE); len = BASE[symbol] + bits(EXTRA[symbol]); if (len == 519) { break; /* end code */ } /* get distance */ symbol = len == 2 ? 2 : dict; dist = decode(DISTCODE) << symbol; dist += bits(symbol); dist++; if (m_first != 0 && dist > m_next) { return -3; /* distance too far back */ } /* copy length bytes from distance bytes back */ do { //to = m_out + m_next; int to = m_next; int from = to - dist; copy = MAXWIN; if (m_next < dist) { from += copy; copy = dist; } copy -= m_next; if (copy > len) { copy = len; } len -= copy; m_next += copy; do { //*to++ = *from++; m_out[to++] = m_out[from++]; } while (--copy != 0); if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } while (len != 0); } else { /* get literal and write it */ symbol = lit != 0 ? decode(LITCODE) : bits(8); m_out[m_next++] = (byte) symbol; if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } } while (true); if (m_next != 0) { m_output.write(m_out, 0, m_next); } return 0; }
java
public int blast(InputStream input, OutputStream output) throws IOException { m_input = input; m_output = output; int lit; /* true if literals are coded */ int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ int dist; /* distance for copy */ int copy; /* copy counter */ //unsigned char *from, *to; /* copy pointers */ /* read header */ lit = bits(8); if (lit > 1) { return -1; } dict = bits(8); if (dict < 4 || dict > 6) { return -2; } /* decode literals and length/distance pairs */ do { if (bits(1) != 0) { /* get length */ symbol = decode(LENCODE); len = BASE[symbol] + bits(EXTRA[symbol]); if (len == 519) { break; /* end code */ } /* get distance */ symbol = len == 2 ? 2 : dict; dist = decode(DISTCODE) << symbol; dist += bits(symbol); dist++; if (m_first != 0 && dist > m_next) { return -3; /* distance too far back */ } /* copy length bytes from distance bytes back */ do { //to = m_out + m_next; int to = m_next; int from = to - dist; copy = MAXWIN; if (m_next < dist) { from += copy; copy = dist; } copy -= m_next; if (copy > len) { copy = len; } len -= copy; m_next += copy; do { //*to++ = *from++; m_out[to++] = m_out[from++]; } while (--copy != 0); if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } while (len != 0); } else { /* get literal and write it */ symbol = lit != 0 ? decode(LITCODE) : bits(8); m_out[m_next++] = (byte) symbol; if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } } while (true); if (m_next != 0) { m_output.write(m_out, 0, m_next); } return 0; }
[ "public", "int", "blast", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "m_input", "=", "input", ";", "m_output", "=", "output", ";", "int", "lit", ";", "/* true if literals are coded */", "int", "dict", ";", "/...
Decode PKWare Compression Library stream. Format notes: - First byte is 0 if literals are uncoded or 1 if they are coded. Second byte is 4, 5, or 6 for the number of extra bits in the distance code. This is the base-2 logarithm of the dictionary size minus six. - Compressed data is a combination of literals and length/distance pairs terminated by an end code. Literals are either Huffman coded or uncoded bytes. A length/distance pair is a coded length followed by a coded distance to represent a string that occurs earlier in the uncompressed data that occurs again at the current location. - A bit preceding a literal or length/distance pair indicates which comes next, 0 for literals, 1 for length/distance. - If literals are uncoded, then the next eight bits are the literal, in the normal bit order in the stream, i.e. no bit-reversal is needed. Similarly, no bit reversal is needed for either the length extra bits or the distance extra bits. - Literal bytes are simply written to the output. A length/distance pair is an instruction to copy previously uncompressed bytes to the output. The copy is from distance bytes back in the output stream, copying for length bytes. - Distances pointing before the beginning of the output data are not permitted. - Overlapped copies, where the length is greater than the distance, are allowed and common. For example, a distance of one and a length of 518 simply copies the last byte 518 times. A distance of four and a length of twelve copies the last four bytes three times. A simple forward copy ignoring whether the length is greater than the distance or not implements this correctly. @param input InputStream instance @param output OutputStream instance @return status code
[ "Decode", "PKWare", "Compression", "Library", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Blast.java#L156-L261
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/Blast.java
Blast.decode
private int decode(Huffman h) throws IOException { int len; /* current number of bits in code */ int code; /* len bits being decoded */ int first; /* first code of length len */ int count; /* number of codes of length len */ int index; /* index of first code of length len in symbol table */ int bitbuf; /* bits from stream */ int left; /* bits left in next or left to process */ //short *next; /* next number of codes */ bitbuf = m_bitbuf; left = m_bitcnt; code = first = index = 0; len = 1; int nextIndex = 1; // next = h->count + 1; while (true) { while (left-- != 0) { code |= (bitbuf & 1) ^ 1; /* invert code */ bitbuf >>= 1; //count = *next++; count = h.m_count[nextIndex++]; if (code < first + count) { /* if length len, return symbol */ m_bitbuf = bitbuf; m_bitcnt = (m_bitcnt - len) & 7; return h.m_symbol[index + (code - first)]; } index += count; /* else update for next length */ first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) { break; } if (m_left == 0) { m_in = m_input.read(); m_left = m_in == -1 ? 0 : 1; if (m_left == 0) { throw new IOException("out of input"); /* out of input */ } } bitbuf = m_in; m_left--; if (left > 8) { left = 8; } } return -9; /* ran out of codes */ }
java
private int decode(Huffman h) throws IOException { int len; /* current number of bits in code */ int code; /* len bits being decoded */ int first; /* first code of length len */ int count; /* number of codes of length len */ int index; /* index of first code of length len in symbol table */ int bitbuf; /* bits from stream */ int left; /* bits left in next or left to process */ //short *next; /* next number of codes */ bitbuf = m_bitbuf; left = m_bitcnt; code = first = index = 0; len = 1; int nextIndex = 1; // next = h->count + 1; while (true) { while (left-- != 0) { code |= (bitbuf & 1) ^ 1; /* invert code */ bitbuf >>= 1; //count = *next++; count = h.m_count[nextIndex++]; if (code < first + count) { /* if length len, return symbol */ m_bitbuf = bitbuf; m_bitcnt = (m_bitcnt - len) & 7; return h.m_symbol[index + (code - first)]; } index += count; /* else update for next length */ first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) { break; } if (m_left == 0) { m_in = m_input.read(); m_left = m_in == -1 ? 0 : 1; if (m_left == 0) { throw new IOException("out of input"); /* out of input */ } } bitbuf = m_in; m_left--; if (left > 8) { left = 8; } } return -9; /* ran out of codes */ }
[ "private", "int", "decode", "(", "Huffman", "h", ")", "throws", "IOException", "{", "int", "len", ";", "/* current number of bits in code */", "int", "code", ";", "/* len bits being decoded */", "int", "first", ";", "/* first code of length len */", "int", "count", ";...
Decode a code from the stream s using huffman table h. Return the symbol or a negative value if there is an error. If all of the lengths are zero, i.e. an empty code, or if the code is incomplete and an invalid code is received, then -9 is returned after reading MAXBITS bits. Format notes: - The codes as stored in the compressed data are bit-reversed relative to a simple integer ordering of codes of the same lengths. Hence below the bits are pulled from the compressed data one at a time and used to build the code value reversed from what is in the stream in order to permit simple integer comparisons for decoding. - The first code for the shortest length is all ones. Subsequent codes of the same length are simply integer decrements of the previous code. When moving up a length, a one bit is appended to the code. For a complete code, the last code of the longest length will be all zeros. To support this ordering, the bits pulled during decoding are inverted to apply the more "natural" ordering starting with all zeros and incrementing. @param h Huffman table @return status code
[ "Decode", "a", "code", "from", "the", "stream", "s", "using", "huffman", "table", "h", ".", "Return", "the", "symbol", "or", "a", "negative", "value", "if", "there", "is", "an", "error", ".", "If", "all", "of", "the", "lengths", "are", "zero", "i", "...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Blast.java#L331-L389
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java
MSPDITimephasedWorkNormaliser.validateSameDay
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
java
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
[ "private", "void", "validateSameDay", "(", "ProjectCalendar", "calendar", ",", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "Date", "assignmentStart", "=", "assignment", ".", "getS...
Ensures that the start and end dates for ranges fit within the working times for a given day. @param calendar current calendar @param list assignment data
[ "Ensures", "that", "the", "start", "and", "end", "dates", "for", "ranges", "fit", "within", "the", "working", "times", "for", "a", "given", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java#L279-L309
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TableFactory.java
TableFactory.createTable
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
java
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
[ "public", "Table", "createTable", "(", "ProjectFile", "file", ",", "byte", "[", "]", "data", ",", "VarMeta", "varMeta", ",", "Var2Data", "varData", ")", "{", "Table", "table", "=", "new", "Table", "(", ")", ";", "table", ".", "setID", "(", "MPPUtility", ...
Creates a new Table instance from data extracted from an MPP file. @param file parent project file @param data fixed data @param varMeta var meta @param varData var data @return Table instance
[ "Creates", "a", "new", "Table", "instance", "from", "data", "extracted", "from", "an", "MPP", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TableFactory.java#L61-L90
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/MapRow.java
MapRow.parseBoolean
private final boolean parseBoolean(String value) { return value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("y") || value.equalsIgnoreCase("yes")); }
java
private final boolean parseBoolean(String value) { return value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("y") || value.equalsIgnoreCase("yes")); }
[ "private", "final", "boolean", "parseBoolean", "(", "String", "value", ")", "{", "return", "value", "!=", "null", "&&", "(", "value", ".", "equalsIgnoreCase", "(", "\"true\"", ")", "||", "value", ".", "equalsIgnoreCase", "(", "\"y\"", ")", "||", "value", "...
Parse a string representation of a Boolean value. XER files sometimes have "N" and "Y" to indicate boolean @param value string representation @return Boolean value
[ "Parse", "a", "string", "representation", "of", "a", "Boolean", "value", ".", "XER", "files", "sometimes", "have", "N", "and", "Y", "to", "indicate", "boolean" ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/MapRow.java#L183-L186
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processActivityCodes
public void processActivityCodes(List<Row> types, List<Row> typeValues, List<Row> assignments) { ActivityCodeContainer container = m_project.getActivityCodes(); Map<Integer, ActivityCode> map = new HashMap<Integer, ActivityCode>(); for (Row row : types) { ActivityCode code = new ActivityCode(row.getInteger("actv_code_type_id"), row.getString("actv_code_type")); container.add(code); map.put(code.getUniqueID(), code); } for (Row row : typeValues) { ActivityCode code = map.get(row.getInteger("actv_code_type_id")); if (code != null) { ActivityCodeValue value = code.addValue(row.getInteger("actv_code_id"), row.getString("short_name"), row.getString("actv_code_name")); m_activityCodeMap.put(value.getUniqueID(), value); } } for (Row row : assignments) { Integer taskID = row.getInteger("task_id"); List<Integer> list = m_activityCodeAssignments.get(taskID); if (list == null) { list = new ArrayList<Integer>(); m_activityCodeAssignments.put(taskID, list); } list.add(row.getInteger("actv_code_id")); } }
java
public void processActivityCodes(List<Row> types, List<Row> typeValues, List<Row> assignments) { ActivityCodeContainer container = m_project.getActivityCodes(); Map<Integer, ActivityCode> map = new HashMap<Integer, ActivityCode>(); for (Row row : types) { ActivityCode code = new ActivityCode(row.getInteger("actv_code_type_id"), row.getString("actv_code_type")); container.add(code); map.put(code.getUniqueID(), code); } for (Row row : typeValues) { ActivityCode code = map.get(row.getInteger("actv_code_type_id")); if (code != null) { ActivityCodeValue value = code.addValue(row.getInteger("actv_code_id"), row.getString("short_name"), row.getString("actv_code_name")); m_activityCodeMap.put(value.getUniqueID(), value); } } for (Row row : assignments) { Integer taskID = row.getInteger("task_id"); List<Integer> list = m_activityCodeAssignments.get(taskID); if (list == null) { list = new ArrayList<Integer>(); m_activityCodeAssignments.put(taskID, list); } list.add(row.getInteger("actv_code_id")); } }
[ "public", "void", "processActivityCodes", "(", "List", "<", "Row", ">", "types", ",", "List", "<", "Row", ">", "typeValues", ",", "List", "<", "Row", ">", "assignments", ")", "{", "ActivityCodeContainer", "container", "=", "m_project", ".", "getActivityCodes",...
Read activity code types and values. @param types activity code type data @param typeValues activity code value data @param assignments activity code task assignments
[ "Read", "activity", "code", "types", "and", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L184-L217
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendar
public void processCalendar(Row row) { ProjectCalendar calendar = m_project.addCalendar(); Integer id = row.getInteger("clndr_id"); m_calMap.put(id, calendar); calendar.setName(row.getString("clndr_name")); try { calendar.setMinutesPerDay(Integer.valueOf((int) NumberHelper.getDouble(row.getDouble("day_hr_cnt")) * 60)); calendar.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("week_hr_cnt")) * 60))); calendar.setMinutesPerMonth(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("month_hr_cnt")) * 60))); calendar.setMinutesPerYear(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("year_hr_cnt")) * 60))); } catch (ClassCastException ex) { // We have seen examples of malformed calendar data where fields have been missing // from the record. We'll typically get a class cast exception here as we're trying // to process something which isn't a double. // We'll just return at this point as it's not clear that we can salvage anything // sensible from this record. return; } // Process data String calendarData = row.getString("clndr_data"); if (calendarData != null && !calendarData.isEmpty()) { Record root = Record.getRecord(calendarData); if (root != null) { processCalendarDays(calendar, root); processCalendarExceptions(calendar, root); } } else { // if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00 DateRange defaultHourRange = new DateRange(DateHelper.getTime(8, 0), DateHelper.getTime(16, 0)); for (Day day : Day.values()) { if (day != Day.SATURDAY && day != Day.SUNDAY) { calendar.setWorkingDay(day, true); ProjectCalendarHours hours = calendar.addCalendarHours(day); hours.addRange(defaultHourRange); } else { calendar.setWorkingDay(day, false); } } } m_eventManager.fireCalendarReadEvent(calendar); }
java
public void processCalendar(Row row) { ProjectCalendar calendar = m_project.addCalendar(); Integer id = row.getInteger("clndr_id"); m_calMap.put(id, calendar); calendar.setName(row.getString("clndr_name")); try { calendar.setMinutesPerDay(Integer.valueOf((int) NumberHelper.getDouble(row.getDouble("day_hr_cnt")) * 60)); calendar.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("week_hr_cnt")) * 60))); calendar.setMinutesPerMonth(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("month_hr_cnt")) * 60))); calendar.setMinutesPerYear(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("year_hr_cnt")) * 60))); } catch (ClassCastException ex) { // We have seen examples of malformed calendar data where fields have been missing // from the record. We'll typically get a class cast exception here as we're trying // to process something which isn't a double. // We'll just return at this point as it's not clear that we can salvage anything // sensible from this record. return; } // Process data String calendarData = row.getString("clndr_data"); if (calendarData != null && !calendarData.isEmpty()) { Record root = Record.getRecord(calendarData); if (root != null) { processCalendarDays(calendar, root); processCalendarExceptions(calendar, root); } } else { // if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00 DateRange defaultHourRange = new DateRange(DateHelper.getTime(8, 0), DateHelper.getTime(16, 0)); for (Day day : Day.values()) { if (day != Day.SATURDAY && day != Day.SUNDAY) { calendar.setWorkingDay(day, true); ProjectCalendarHours hours = calendar.addCalendarHours(day); hours.addRange(defaultHourRange); } else { calendar.setWorkingDay(day, false); } } } m_eventManager.fireCalendarReadEvent(calendar); }
[ "public", "void", "processCalendar", "(", "Row", "row", ")", "{", "ProjectCalendar", "calendar", "=", "m_project", ".", "addCalendar", "(", ")", ";", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"clndr_id\"", ")", ";", "m_calMap", ".", "put", "("...
Process data for an individual calendar. @param row calendar data
[ "Process", "data", "for", "an", "individual", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L298-L354
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendarDays
private void processCalendarDays(ProjectCalendar calendar, Record root) { // Retrieve working hours ... Record daysOfWeek = root.getChild("DaysOfWeek"); if (daysOfWeek != null) { for (Record dayRecord : daysOfWeek.getChildren()) { processCalendarHours(calendar, dayRecord); } } }
java
private void processCalendarDays(ProjectCalendar calendar, Record root) { // Retrieve working hours ... Record daysOfWeek = root.getChild("DaysOfWeek"); if (daysOfWeek != null) { for (Record dayRecord : daysOfWeek.getChildren()) { processCalendarHours(calendar, dayRecord); } } }
[ "private", "void", "processCalendarDays", "(", "ProjectCalendar", "calendar", ",", "Record", "root", ")", "{", "// Retrieve working hours ...", "Record", "daysOfWeek", "=", "root", ".", "getChild", "(", "\"DaysOfWeek\"", ")", ";", "if", "(", "daysOfWeek", "!=", "n...
Process calendar days of the week. @param calendar project calendar @param root calendar data
[ "Process", "calendar", "days", "of", "the", "week", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L362-L373
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendarHours
private void processCalendarHours(ProjectCalendar calendar, Record dayRecord) { // ... for each day of the week Day day = Day.getInstance(Integer.parseInt(dayRecord.getField())); // Get hours List<Record> recHours = dayRecord.getChildren(); if (recHours.size() == 0) { // No data -> not working calendar.setWorkingDay(day, false); } else { calendar.setWorkingDay(day, true); // Read hours ProjectCalendarHours hours = calendar.addCalendarHours(day); for (Record recWorkingHours : recHours) { addHours(hours, recWorkingHours); } } }
java
private void processCalendarHours(ProjectCalendar calendar, Record dayRecord) { // ... for each day of the week Day day = Day.getInstance(Integer.parseInt(dayRecord.getField())); // Get hours List<Record> recHours = dayRecord.getChildren(); if (recHours.size() == 0) { // No data -> not working calendar.setWorkingDay(day, false); } else { calendar.setWorkingDay(day, true); // Read hours ProjectCalendarHours hours = calendar.addCalendarHours(day); for (Record recWorkingHours : recHours) { addHours(hours, recWorkingHours); } } }
[ "private", "void", "processCalendarHours", "(", "ProjectCalendar", "calendar", ",", "Record", "dayRecord", ")", "{", "// ... for each day of the week", "Day", "day", "=", "Day", ".", "getInstance", "(", "Integer", ".", "parseInt", "(", "dayRecord", ".", "getField", ...
Process hours in a working day. @param calendar project calendar @param dayRecord working day data
[ "Process", "hours", "in", "a", "working", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L381-L402
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addHours
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
java
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
[ "private", "void", "addHours", "(", "ProjectCalendarDateRanges", "ranges", ",", "Record", "hoursRecord", ")", "{", "if", "(", "hoursRecord", ".", "getValue", "(", ")", "!=", "null", ")", "{", "String", "[", "]", "wh", "=", "hoursRecord", ".", "getValue", "...
Parses a record containing hours and add them to a container. @param ranges hours container @param hoursRecord hours record
[ "Parses", "a", "record", "containing", "hours", "and", "add", "them", "to", "a", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L410-L446
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getResourceCalendar
private ProjectCalendar getResourceCalendar(Integer calendarID) { ProjectCalendar result = null; if (calendarID != null) { ProjectCalendar calendar = m_calMap.get(calendarID); if (calendar != null) { // // If the resource is linked to a base calendar, derive // a default calendar from the base calendar. // if (!calendar.isDerived()) { ProjectCalendar resourceCalendar = m_project.addCalendar(); resourceCalendar.setParent(calendar); resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); result = resourceCalendar; } else { // // Primavera seems to allow a calendar to be shared between resources // whereas in the MS Project model there is a one-to-one // relationship. If we find a shared calendar, take a copy of it // if (calendar.getResource() == null) { result = calendar; } else { ProjectCalendar copy = m_project.addCalendar(); copy.copy(calendar); result = copy; } } } } return result; }
java
private ProjectCalendar getResourceCalendar(Integer calendarID) { ProjectCalendar result = null; if (calendarID != null) { ProjectCalendar calendar = m_calMap.get(calendarID); if (calendar != null) { // // If the resource is linked to a base calendar, derive // a default calendar from the base calendar. // if (!calendar.isDerived()) { ProjectCalendar resourceCalendar = m_project.addCalendar(); resourceCalendar.setParent(calendar); resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); result = resourceCalendar; } else { // // Primavera seems to allow a calendar to be shared between resources // whereas in the MS Project model there is a one-to-one // relationship. If we find a shared calendar, take a copy of it // if (calendar.getResource() == null) { result = calendar; } else { ProjectCalendar copy = m_project.addCalendar(); copy.copy(calendar); result = copy; } } } } return result; }
[ "private", "ProjectCalendar", "getResourceCalendar", "(", "Integer", "calendarID", ")", "{", "ProjectCalendar", "result", "=", "null", ";", "if", "(", "calendarID", "!=", "null", ")", "{", "ProjectCalendar", "calendar", "=", "m_calMap", ".", "get", "(", "calenda...
Retrieve the correct calendar for a resource. @param calendarID calendar ID @return calendar for resource
[ "Retrieve", "the", "correct", "calendar", "for", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L506-L553
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getActivityIDField
private FieldType getActivityIDField(Map<FieldType, String> map) { FieldType result = null; for (Map.Entry<FieldType, String> entry : map.entrySet()) { if (entry.getValue().equals("task_code")) { result = entry.getKey(); break; } } return result; }
java
private FieldType getActivityIDField(Map<FieldType, String> map) { FieldType result = null; for (Map.Entry<FieldType, String> entry : map.entrySet()) { if (entry.getValue().equals("task_code")) { result = entry.getKey(); break; } } return result; }
[ "private", "FieldType", "getActivityIDField", "(", "Map", "<", "FieldType", ",", "String", ">", "map", ")", "{", "FieldType", "result", "=", "null", ";", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "String", ">", "entry", ":", "map", ".", "...
Determine which field the Activity ID has been mapped to. @param map field map @return field
[ "Determine", "which", "field", "the", "Activity", "ID", "has", "been", "mapped", "to", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L793-L805
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addUserDefinedField
private void addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { try { switch (fieldType) { case TASK: TaskField taskField; do { taskField = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (m_taskFields.containsKey(taskField) || m_wbsFields.containsKey(taskField)); m_project.getCustomFields().getCustomField(taskField).setAlias(name); break; case RESOURCE: ResourceField resourceField; do { resourceField = m_resourceUdfCounters.nextField(ResourceField.class, dataType); } while (m_resourceFields.containsKey(resourceField)); m_project.getCustomFields().getCustomField(resourceField).setAlias(name); break; case ASSIGNMENT: AssignmentField assignmentField; do { assignmentField = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); } while (m_assignmentFields.containsKey(assignmentField)); m_project.getCustomFields().getCustomField(assignmentField).setAlias(name); break; default: break; } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } }
java
private void addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { try { switch (fieldType) { case TASK: TaskField taskField; do { taskField = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (m_taskFields.containsKey(taskField) || m_wbsFields.containsKey(taskField)); m_project.getCustomFields().getCustomField(taskField).setAlias(name); break; case RESOURCE: ResourceField resourceField; do { resourceField = m_resourceUdfCounters.nextField(ResourceField.class, dataType); } while (m_resourceFields.containsKey(resourceField)); m_project.getCustomFields().getCustomField(resourceField).setAlias(name); break; case ASSIGNMENT: AssignmentField assignmentField; do { assignmentField = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); } while (m_assignmentFields.containsKey(assignmentField)); m_project.getCustomFields().getCustomField(assignmentField).setAlias(name); break; default: break; } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } }
[ "private", "void", "addUserDefinedField", "(", "FieldTypeClass", "fieldType", ",", "UserFieldDataType", "dataType", ",", "String", "name", ")", "{", "try", "{", "switch", "(", "fieldType", ")", "{", "case", "TASK", ":", "TaskField", "taskField", ";", "do", "{"...
Configure a new user defined field. @param fieldType field type @param dataType field data type @param name field name
[ "Configure", "a", "new", "user", "defined", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L814-L871
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addUDFValue
private void addUDFValue(FieldTypeClass fieldType, FieldContainer container, Row row) { Integer fieldId = row.getInteger("udf_type_id"); String fieldName = m_udfFields.get(fieldId); Object value = null; FieldType field = m_project.getCustomFields().getFieldByAlias(fieldType, fieldName); if (field != null) { DataType fieldDataType = field.getDataType(); switch (fieldDataType) { case DATE: { value = row.getDate("udf_date"); break; } case CURRENCY: case NUMERIC: { value = row.getDouble("udf_number"); break; } case GUID: case INTEGER: { value = row.getInteger("udf_code_id"); break; } case BOOLEAN: { String text = row.getString("udf_text"); if (text != null) { // before a normal boolean parse, we try to lookup the text as a P6 static type indicator UDF value = STATICTYPE_UDF_MAP.get(text); if (value == null) { value = Boolean.valueOf(row.getBoolean("udf_text")); } } else { value = Boolean.valueOf(row.getBoolean("udf_number")); } break; } default: { value = row.getString("udf_text"); break; } } container.set(field, value); } }
java
private void addUDFValue(FieldTypeClass fieldType, FieldContainer container, Row row) { Integer fieldId = row.getInteger("udf_type_id"); String fieldName = m_udfFields.get(fieldId); Object value = null; FieldType field = m_project.getCustomFields().getFieldByAlias(fieldType, fieldName); if (field != null) { DataType fieldDataType = field.getDataType(); switch (fieldDataType) { case DATE: { value = row.getDate("udf_date"); break; } case CURRENCY: case NUMERIC: { value = row.getDouble("udf_number"); break; } case GUID: case INTEGER: { value = row.getInteger("udf_code_id"); break; } case BOOLEAN: { String text = row.getString("udf_text"); if (text != null) { // before a normal boolean parse, we try to lookup the text as a P6 static type indicator UDF value = STATICTYPE_UDF_MAP.get(text); if (value == null) { value = Boolean.valueOf(row.getBoolean("udf_text")); } } else { value = Boolean.valueOf(row.getBoolean("udf_number")); } break; } default: { value = row.getString("udf_text"); break; } } container.set(field, value); } }
[ "private", "void", "addUDFValue", "(", "FieldTypeClass", "fieldType", ",", "FieldContainer", "container", ",", "Row", "row", ")", "{", "Integer", "fieldId", "=", "row", ".", "getInteger", "(", "\"udf_type_id\"", ")", ";", "String", "fieldName", "=", "m_udfFields...
Adds a user defined field value to a task. @param fieldType field type @param container FieldContainer instance @param row UDF data
[ "Adds", "a", "user", "defined", "field", "value", "to", "a", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L880-L941
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.populateUserDefinedFieldValues
private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID) { Map<Integer, List<Row>> tableData = m_udfValues.get(tableName); if (tableData != null) { List<Row> udf = tableData.get(uniqueID); if (udf != null) { for (Row r : udf) { addUDFValue(type, container, r); } } } }
java
private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID) { Map<Integer, List<Row>> tableData = m_udfValues.get(tableName); if (tableData != null) { List<Row> udf = tableData.get(uniqueID); if (udf != null) { for (Row r : udf) { addUDFValue(type, container, r); } } } }
[ "private", "void", "populateUserDefinedFieldValues", "(", "String", "tableName", ",", "FieldTypeClass", "type", ",", "FieldContainer", "container", ",", "Integer", "uniqueID", ")", "{", "Map", "<", "Integer", ",", "List", "<", "Row", ">", ">", "tableData", "=", ...
Populate the UDF values for this entity. @param tableName parent table name @param type entity type @param container entity @param uniqueID entity Unique ID
[ "Populate", "the", "UDF", "values", "for", "this", "entity", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L951-L965
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processDefaultCurrency
public void processDefaultCurrency(Row row) { ProjectProperties properties = m_project.getProjectProperties(); properties.setCurrencySymbol(row.getString("curr_symbol")); properties.setSymbolPosition(CURRENCY_SYMBOL_POSITION_MAP.get(row.getString("pos_curr_fmt_type"))); properties.setCurrencyDigits(row.getInteger("decimal_digit_cnt")); properties.setThousandsSeparator(row.getString("digit_group_symbol").charAt(0)); properties.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); }
java
public void processDefaultCurrency(Row row) { ProjectProperties properties = m_project.getProjectProperties(); properties.setCurrencySymbol(row.getString("curr_symbol")); properties.setSymbolPosition(CURRENCY_SYMBOL_POSITION_MAP.get(row.getString("pos_curr_fmt_type"))); properties.setCurrencyDigits(row.getInteger("decimal_digit_cnt")); properties.setThousandsSeparator(row.getString("digit_group_symbol").charAt(0)); properties.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); }
[ "public", "void", "processDefaultCurrency", "(", "Row", "row", ")", "{", "ProjectProperties", "properties", "=", "m_project", ".", "getProjectProperties", "(", ")", ";", "properties", ".", "setCurrencySymbol", "(", "row", ".", "getString", "(", "\"curr_symbol\"", ...
Code common to both XER and database readers to extract currency format data. @param row row containing currency data
[ "Code", "common", "to", "both", "XER", "and", "database", "readers", "to", "extract", "currency", "format", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1358-L1366
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processFields
private void processFields(Map<FieldType, String> map, Row row, FieldContainer container) { for (Map.Entry<FieldType, String> entry : map.entrySet()) { FieldType field = entry.getKey(); String name = entry.getValue(); Object value; switch (field.getDataType()) { case INTEGER: { value = row.getInteger(name); break; } case BOOLEAN: { value = Boolean.valueOf(row.getBoolean(name)); break; } case DATE: { value = row.getDate(name); break; } case CURRENCY: case NUMERIC: case PERCENTAGE: { value = row.getDouble(name); break; } case DELAY: case WORK: case DURATION: { value = row.getDuration(name); break; } case RESOURCE_TYPE: { value = RESOURCE_TYPE_MAP.get(row.getString(name)); break; } case TASK_TYPE: { value = TASK_TYPE_MAP.get(row.getString(name)); break; } case CONSTRAINT: { value = CONSTRAINT_TYPE_MAP.get(row.getString(name)); break; } case PRIORITY: { value = PRIORITY_MAP.get(row.getString(name)); break; } case GUID: { value = row.getUUID(name); break; } default: { value = row.getString(name); break; } } container.set(field, value); } }
java
private void processFields(Map<FieldType, String> map, Row row, FieldContainer container) { for (Map.Entry<FieldType, String> entry : map.entrySet()) { FieldType field = entry.getKey(); String name = entry.getValue(); Object value; switch (field.getDataType()) { case INTEGER: { value = row.getInteger(name); break; } case BOOLEAN: { value = Boolean.valueOf(row.getBoolean(name)); break; } case DATE: { value = row.getDate(name); break; } case CURRENCY: case NUMERIC: case PERCENTAGE: { value = row.getDouble(name); break; } case DELAY: case WORK: case DURATION: { value = row.getDuration(name); break; } case RESOURCE_TYPE: { value = RESOURCE_TYPE_MAP.get(row.getString(name)); break; } case TASK_TYPE: { value = TASK_TYPE_MAP.get(row.getString(name)); break; } case CONSTRAINT: { value = CONSTRAINT_TYPE_MAP.get(row.getString(name)); break; } case PRIORITY: { value = PRIORITY_MAP.get(row.getString(name)); break; } case GUID: { value = row.getUUID(name); break; } default: { value = row.getString(name); break; } } container.set(field, value); } }
[ "private", "void", "processFields", "(", "Map", "<", "FieldType", ",", "String", ">", "map", ",", "Row", "row", ",", "FieldContainer", "container", ")", "{", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "String", ">", "entry", ":", "map", "....
Generic method to extract Primavera fields and assign to MPXJ fields. @param map map of MPXJ field types and Primavera field names @param row Primavera data container @param container MPXJ data contain
[ "Generic", "method", "to", "extract", "Primavera", "fields", "and", "assign", "to", "MPXJ", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1375-L1458
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.applyAliases
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
java
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
[ "private", "void", "applyAliases", "(", "Map", "<", "FieldType", ",", "String", ">", "aliases", ")", "{", "CustomFieldContainer", "fields", "=", "m_project", ".", "getCustomFields", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "St...
Apply aliases to task and resource fields. @param aliases map of aliases
[ "Apply", "aliases", "to", "task", "and", "resource", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1481-L1488
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculatePercentComplete
private Number calculatePercentComplete(Row row) { Number result; switch (PercentCompleteType.getInstance(row.getString("complete_pct_type"))) { case UNITS: { result = calculateUnitsPercentComplete(row); break; } case DURATION: { result = calculateDurationPercentComplete(row); break; } default: { result = calculatePhysicalPercentComplete(row); break; } } return result; }
java
private Number calculatePercentComplete(Row row) { Number result; switch (PercentCompleteType.getInstance(row.getString("complete_pct_type"))) { case UNITS: { result = calculateUnitsPercentComplete(row); break; } case DURATION: { result = calculateDurationPercentComplete(row); break; } default: { result = calculatePhysicalPercentComplete(row); break; } } return result; }
[ "private", "Number", "calculatePercentComplete", "(", "Row", "row", ")", "{", "Number", "result", ";", "switch", "(", "PercentCompleteType", ".", "getInstance", "(", "row", ".", "getString", "(", "\"complete_pct_type\"", ")", ")", ")", "{", "case", "UNITS", ":...
Determine which type of percent complete is used on on this task, and calculate the required value. @param row task data @return percent complete value
[ "Determine", "which", "type", "of", "percent", "complete", "is", "used", "on", "on", "this", "task", "and", "calculate", "the", "required", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1497-L1522
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculateUnitsPercentComplete
private Number calculateUnitsPercentComplete(Row row) { double result = 0; double actualWorkQuantity = NumberHelper.getDouble(row.getDouble("act_work_qty")); double actualEquipmentQuantity = NumberHelper.getDouble(row.getDouble("act_equip_qty")); double numerator = actualWorkQuantity + actualEquipmentQuantity; if (numerator != 0) { double remainingWorkQuantity = NumberHelper.getDouble(row.getDouble("remain_work_qty")); double remainingEquipmentQuantity = NumberHelper.getDouble(row.getDouble("remain_equip_qty")); double denominator = remainingWorkQuantity + actualWorkQuantity + remainingEquipmentQuantity + actualEquipmentQuantity; result = denominator == 0 ? 0 : ((numerator * 100) / denominator); } return NumberHelper.getDouble(result); }
java
private Number calculateUnitsPercentComplete(Row row) { double result = 0; double actualWorkQuantity = NumberHelper.getDouble(row.getDouble("act_work_qty")); double actualEquipmentQuantity = NumberHelper.getDouble(row.getDouble("act_equip_qty")); double numerator = actualWorkQuantity + actualEquipmentQuantity; if (numerator != 0) { double remainingWorkQuantity = NumberHelper.getDouble(row.getDouble("remain_work_qty")); double remainingEquipmentQuantity = NumberHelper.getDouble(row.getDouble("remain_equip_qty")); double denominator = remainingWorkQuantity + actualWorkQuantity + remainingEquipmentQuantity + actualEquipmentQuantity; result = denominator == 0 ? 0 : ((numerator * 100) / denominator); } return NumberHelper.getDouble(result); }
[ "private", "Number", "calculateUnitsPercentComplete", "(", "Row", "row", ")", "{", "double", "result", "=", "0", ";", "double", "actualWorkQuantity", "=", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"act_work_qty\"", ")", ")", ";", "...
Calculate the units percent complete. @param row task data @return percent complete
[ "Calculate", "the", "units", "percent", "complete", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1541-L1558
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculateDurationPercentComplete
private Number calculateDurationPercentComplete(Row row) { double result = 0; double targetDuration = row.getDuration("target_drtn_hr_cnt").getDuration(); double remainingDuration = row.getDuration("remain_drtn_hr_cnt").getDuration(); if (targetDuration == 0) { if (remainingDuration == 0) { if ("TK_Complete".equals(row.getString("status_code"))) { result = 100; } } } else { if (remainingDuration < targetDuration) { result = ((targetDuration - remainingDuration) * 100) / targetDuration; } } return NumberHelper.getDouble(result); }
java
private Number calculateDurationPercentComplete(Row row) { double result = 0; double targetDuration = row.getDuration("target_drtn_hr_cnt").getDuration(); double remainingDuration = row.getDuration("remain_drtn_hr_cnt").getDuration(); if (targetDuration == 0) { if (remainingDuration == 0) { if ("TK_Complete".equals(row.getString("status_code"))) { result = 100; } } } else { if (remainingDuration < targetDuration) { result = ((targetDuration - remainingDuration) * 100) / targetDuration; } } return NumberHelper.getDouble(result); }
[ "private", "Number", "calculateDurationPercentComplete", "(", "Row", "row", ")", "{", "double", "result", "=", "0", ";", "double", "targetDuration", "=", "row", ".", "getDuration", "(", "\"target_drtn_hr_cnt\"", ")", ".", "getDuration", "(", ")", ";", "double", ...
Calculate the duration percent complete. @param row task data @return percent complete
[ "Calculate", "the", "duration", "percent", "complete", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1566-L1591
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultResourceFieldMap
public static Map<FieldType, String> getDefaultResourceFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(ResourceField.UNIQUE_ID, "rsrc_id"); map.put(ResourceField.GUID, "guid"); map.put(ResourceField.NAME, "rsrc_name"); map.put(ResourceField.CODE, "employee_code"); map.put(ResourceField.EMAIL_ADDRESS, "email_addr"); map.put(ResourceField.NOTES, "rsrc_notes"); map.put(ResourceField.CREATED, "create_date"); map.put(ResourceField.TYPE, "rsrc_type"); map.put(ResourceField.INITIALS, "rsrc_short_name"); map.put(ResourceField.PARENT_ID, "parent_rsrc_id"); return map; }
java
public static Map<FieldType, String> getDefaultResourceFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(ResourceField.UNIQUE_ID, "rsrc_id"); map.put(ResourceField.GUID, "guid"); map.put(ResourceField.NAME, "rsrc_name"); map.put(ResourceField.CODE, "employee_code"); map.put(ResourceField.EMAIL_ADDRESS, "email_addr"); map.put(ResourceField.NOTES, "rsrc_notes"); map.put(ResourceField.CREATED, "create_date"); map.put(ResourceField.TYPE, "rsrc_type"); map.put(ResourceField.INITIALS, "rsrc_short_name"); map.put(ResourceField.PARENT_ID, "parent_rsrc_id"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultResourceFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", "."...
Retrieve the default mapping between MPXJ resource fields and Primavera resource field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "resource", "fields", "and", "Primavera", "resource", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1598-L1614
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultWbsFieldMap
public static Map<FieldType, String> getDefaultWbsFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "wbs_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "wbs_name"); map.put(TaskField.BASELINE_COST, "orig_cost"); map.put(TaskField.REMAINING_COST, "indep_remain_total_cost"); map.put(TaskField.REMAINING_WORK, "indep_remain_work_qty"); map.put(TaskField.DEADLINE, "anticip_end_date"); map.put(TaskField.DATE1, "suspend_date"); map.put(TaskField.DATE2, "resume_date"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.WBS, "wbs_short_name"); return map; }
java
public static Map<FieldType, String> getDefaultWbsFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "wbs_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "wbs_name"); map.put(TaskField.BASELINE_COST, "orig_cost"); map.put(TaskField.REMAINING_COST, "indep_remain_total_cost"); map.put(TaskField.REMAINING_WORK, "indep_remain_work_qty"); map.put(TaskField.DEADLINE, "anticip_end_date"); map.put(TaskField.DATE1, "suspend_date"); map.put(TaskField.DATE2, "resume_date"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.WBS, "wbs_short_name"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultWbsFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "...
Retrieve the default mapping between MPXJ task fields and Primavera wbs field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "task", "fields", "and", "Primavera", "wbs", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1621-L1638
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultTaskFieldMap
public static Map<FieldType, String> getDefaultTaskFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "task_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "task_name"); map.put(TaskField.ACTUAL_DURATION, "act_drtn_hr_cnt"); map.put(TaskField.REMAINING_DURATION, "remain_drtn_hr_cnt"); map.put(TaskField.ACTUAL_WORK, "act_work_qty"); map.put(TaskField.REMAINING_WORK, "remain_work_qty"); map.put(TaskField.BASELINE_WORK, "target_work_qty"); map.put(TaskField.BASELINE_DURATION, "target_drtn_hr_cnt"); map.put(TaskField.DURATION, "target_drtn_hr_cnt"); map.put(TaskField.CONSTRAINT_DATE, "cstr_date"); map.put(TaskField.ACTUAL_START, "act_start_date"); map.put(TaskField.ACTUAL_FINISH, "act_end_date"); map.put(TaskField.LATE_START, "late_start_date"); map.put(TaskField.LATE_FINISH, "late_end_date"); map.put(TaskField.EARLY_START, "early_start_date"); map.put(TaskField.EARLY_FINISH, "early_end_date"); map.put(TaskField.REMAINING_EARLY_START, "restart_date"); map.put(TaskField.REMAINING_EARLY_FINISH, "reend_date"); map.put(TaskField.BASELINE_START, "target_start_date"); map.put(TaskField.BASELINE_FINISH, "target_end_date"); map.put(TaskField.CONSTRAINT_TYPE, "cstr_type"); map.put(TaskField.PRIORITY, "priority_type"); map.put(TaskField.CREATED, "create_date"); map.put(TaskField.TYPE, "duration_type"); map.put(TaskField.FREE_SLACK, "free_float_hr_cnt"); map.put(TaskField.TOTAL_SLACK, "total_float_hr_cnt"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.TEXT2, "task_type"); map.put(TaskField.TEXT3, "status_code"); map.put(TaskField.NUMBER1, "rsrc_id"); return map; }
java
public static Map<FieldType, String> getDefaultTaskFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "task_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "task_name"); map.put(TaskField.ACTUAL_DURATION, "act_drtn_hr_cnt"); map.put(TaskField.REMAINING_DURATION, "remain_drtn_hr_cnt"); map.put(TaskField.ACTUAL_WORK, "act_work_qty"); map.put(TaskField.REMAINING_WORK, "remain_work_qty"); map.put(TaskField.BASELINE_WORK, "target_work_qty"); map.put(TaskField.BASELINE_DURATION, "target_drtn_hr_cnt"); map.put(TaskField.DURATION, "target_drtn_hr_cnt"); map.put(TaskField.CONSTRAINT_DATE, "cstr_date"); map.put(TaskField.ACTUAL_START, "act_start_date"); map.put(TaskField.ACTUAL_FINISH, "act_end_date"); map.put(TaskField.LATE_START, "late_start_date"); map.put(TaskField.LATE_FINISH, "late_end_date"); map.put(TaskField.EARLY_START, "early_start_date"); map.put(TaskField.EARLY_FINISH, "early_end_date"); map.put(TaskField.REMAINING_EARLY_START, "restart_date"); map.put(TaskField.REMAINING_EARLY_FINISH, "reend_date"); map.put(TaskField.BASELINE_START, "target_start_date"); map.put(TaskField.BASELINE_FINISH, "target_end_date"); map.put(TaskField.CONSTRAINT_TYPE, "cstr_type"); map.put(TaskField.PRIORITY, "priority_type"); map.put(TaskField.CREATED, "create_date"); map.put(TaskField.TYPE, "duration_type"); map.put(TaskField.FREE_SLACK, "free_float_hr_cnt"); map.put(TaskField.TOTAL_SLACK, "total_float_hr_cnt"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.TEXT2, "task_type"); map.put(TaskField.TEXT3, "status_code"); map.put(TaskField.NUMBER1, "rsrc_id"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultTaskFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", ...
Retrieve the default mapping between MPXJ task fields and Primavera task field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "task", "fields", "and", "Primavera", "task", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1645-L1682
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultAssignmentFieldMap
public static Map<FieldType, String> getDefaultAssignmentFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(AssignmentField.UNIQUE_ID, "taskrsrc_id"); map.put(AssignmentField.GUID, "guid"); map.put(AssignmentField.REMAINING_WORK, "remain_qty"); map.put(AssignmentField.BASELINE_WORK, "target_qty"); map.put(AssignmentField.ACTUAL_OVERTIME_WORK, "act_ot_qty"); map.put(AssignmentField.BASELINE_COST, "target_cost"); map.put(AssignmentField.ACTUAL_OVERTIME_COST, "act_ot_cost"); map.put(AssignmentField.REMAINING_COST, "remain_cost"); map.put(AssignmentField.ACTUAL_START, "act_start_date"); map.put(AssignmentField.ACTUAL_FINISH, "act_end_date"); map.put(AssignmentField.BASELINE_START, "target_start_date"); map.put(AssignmentField.BASELINE_FINISH, "target_end_date"); map.put(AssignmentField.ASSIGNMENT_DELAY, "target_lag_drtn_hr_cnt"); return map; }
java
public static Map<FieldType, String> getDefaultAssignmentFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(AssignmentField.UNIQUE_ID, "taskrsrc_id"); map.put(AssignmentField.GUID, "guid"); map.put(AssignmentField.REMAINING_WORK, "remain_qty"); map.put(AssignmentField.BASELINE_WORK, "target_qty"); map.put(AssignmentField.ACTUAL_OVERTIME_WORK, "act_ot_qty"); map.put(AssignmentField.BASELINE_COST, "target_cost"); map.put(AssignmentField.ACTUAL_OVERTIME_COST, "act_ot_cost"); map.put(AssignmentField.REMAINING_COST, "remain_cost"); map.put(AssignmentField.ACTUAL_START, "act_start_date"); map.put(AssignmentField.ACTUAL_FINISH, "act_end_date"); map.put(AssignmentField.BASELINE_START, "target_start_date"); map.put(AssignmentField.BASELINE_FINISH, "target_end_date"); map.put(AssignmentField.ASSIGNMENT_DELAY, "target_lag_drtn_hr_cnt"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultAssignmentFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", "...
Retrieve the default mapping between MPXJ assignment fields and Primavera assignment field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "assignment", "fields", "and", "Primavera", "assignment", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1689-L1708
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultAliases
public static Map<FieldType, String> getDefaultAliases() { Map<FieldType, String> map = new HashMap<FieldType, String>(); map.put(TaskField.DATE1, "Suspend Date"); map.put(TaskField.DATE2, "Resume Date"); map.put(TaskField.TEXT1, "Code"); map.put(TaskField.TEXT2, "Activity Type"); map.put(TaskField.TEXT3, "Status"); map.put(TaskField.NUMBER1, "Primary Resource Unique ID"); return map; }
java
public static Map<FieldType, String> getDefaultAliases() { Map<FieldType, String> map = new HashMap<FieldType, String>(); map.put(TaskField.DATE1, "Suspend Date"); map.put(TaskField.DATE2, "Resume Date"); map.put(TaskField.TEXT1, "Code"); map.put(TaskField.TEXT2, "Activity Type"); map.put(TaskField.TEXT3, "Status"); map.put(TaskField.NUMBER1, "Primary Resource Unique ID"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultAliases", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "HashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(...
Retrieve the default aliases to be applied to MPXJ task and resource fields. @return map of aliases
[ "Retrieve", "the", "default", "aliases", "to", "be", "applied", "to", "MPXJ", "task", "and", "resource", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1715-L1727
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.filter
private static void filter(String filename, String filtername) throws Exception { ProjectFile project = new UniversalProjectReader().read(filename); Filter filter = project.getFilters().getFilterByName(filtername); if (filter == null) { displayAvailableFilters(project); } else { System.out.println(filter); System.out.println(); if (filter.isTaskFilter()) { processTaskFilter(project, filter); } else { processResourceFilter(project, filter); } } }
java
private static void filter(String filename, String filtername) throws Exception { ProjectFile project = new UniversalProjectReader().read(filename); Filter filter = project.getFilters().getFilterByName(filtername); if (filter == null) { displayAvailableFilters(project); } else { System.out.println(filter); System.out.println(); if (filter.isTaskFilter()) { processTaskFilter(project, filter); } else { processResourceFilter(project, filter); } } }
[ "private", "static", "void", "filter", "(", "String", "filename", ",", "String", "filtername", ")", "throws", "Exception", "{", "ProjectFile", "project", "=", "new", "UniversalProjectReader", "(", ")", ".", "read", "(", "filename", ")", ";", "Filter", "filter"...
This method opens the named project, applies the named filter and displays the filtered list of tasks or resources. If an invalid filter name is supplied, a list of valid filter names is shown. @param filename input file name @param filtername input filter name
[ "This", "method", "opens", "the", "named", "project", "applies", "the", "named", "filter", "and", "displays", "the", "filtered", "list", "of", "tasks", "or", "resources", ".", "If", "an", "invalid", "filter", "name", "is", "supplied", "a", "list", "of", "v...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L74-L97
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.displayAvailableFilters
private static void displayAvailableFilters(ProjectFile project) { System.out.println("Unknown filter name supplied."); System.out.println("Available task filters:"); for (Filter filter : project.getFilters().getTaskFilters()) { System.out.println(" " + filter.getName()); } System.out.println("Available resource filters:"); for (Filter filter : project.getFilters().getResourceFilters()) { System.out.println(" " + filter.getName()); } }
java
private static void displayAvailableFilters(ProjectFile project) { System.out.println("Unknown filter name supplied."); System.out.println("Available task filters:"); for (Filter filter : project.getFilters().getTaskFilters()) { System.out.println(" " + filter.getName()); } System.out.println("Available resource filters:"); for (Filter filter : project.getFilters().getResourceFilters()) { System.out.println(" " + filter.getName()); } }
[ "private", "static", "void", "displayAvailableFilters", "(", "ProjectFile", "project", ")", "{", "System", ".", "out", ".", "println", "(", "\"Unknown filter name supplied.\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Available task filters:\"", ")", ...
This utility displays a list of available task filters, and a list of available resource filters. @param project project file
[ "This", "utility", "displays", "a", "list", "of", "available", "task", "filters", "and", "a", "list", "of", "available", "resource", "filters", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L105-L120
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processTaskFilter
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
java
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
[ "private", "static", "void", "processTaskFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Task", "task", ":", "project", ".", "getTasks", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", "task", ",", ...
Apply a filter to the list of all tasks, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "tasks", "and", "show", "the", "results", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L128-L137
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processResourceFilter
private static void processResourceFilter(ProjectFile project, Filter filter) { for (Resource resource : project.getResources()) { if (filter.evaluate(resource, null)) { System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName()); } } }
java
private static void processResourceFilter(ProjectFile project, Filter filter) { for (Resource resource : project.getResources()) { if (filter.evaluate(resource, null)) { System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName()); } } }
[ "private", "static", "void", "processResourceFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Resource", "resource", ":", "project", ".", "getResources", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", ...
Apply a filter to the list of all resources, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "resources", "and", "show", "the", "results", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L145-L154
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjConvert.java
MpxjConvert.process
public void process(String inputFile, String outputFile) throws Exception { System.out.println("Reading input file started."); long start = System.currentTimeMillis(); ProjectFile projectFile = readFile(inputFile); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading input file completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
java
public void process(String inputFile, String outputFile) throws Exception { System.out.println("Reading input file started."); long start = System.currentTimeMillis(); ProjectFile projectFile = readFile(inputFile); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading input file completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
[ "public", "void", "process", "(", "String", "inputFile", ",", "String", "outputFile", ")", "throws", "Exception", "{", "System", ".", "out", ".", "println", "(", "\"Reading input file started.\"", ")", ";", "long", "start", "=", "System", ".", "currentTimeMillis...
Convert one project file format to another. @param inputFile input file @param outputFile output file @throws Exception
[ "Convert", "one", "project", "file", "format", "to", "another", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjConvert.java#L80-L94
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjConvert.java
MpxjConvert.readFile
private ProjectFile readFile(String inputFile) throws MPXJException { ProjectReader reader = new UniversalProjectReader(); ProjectFile projectFile = reader.read(inputFile); if (projectFile == null) { throw new IllegalArgumentException("Unsupported file type"); } return projectFile; }
java
private ProjectFile readFile(String inputFile) throws MPXJException { ProjectReader reader = new UniversalProjectReader(); ProjectFile projectFile = reader.read(inputFile); if (projectFile == null) { throw new IllegalArgumentException("Unsupported file type"); } return projectFile; }
[ "private", "ProjectFile", "readFile", "(", "String", "inputFile", ")", "throws", "MPXJException", "{", "ProjectReader", "reader", "=", "new", "UniversalProjectReader", "(", ")", ";", "ProjectFile", "projectFile", "=", "reader", ".", "read", "(", "inputFile", ")", ...
Use the universal project reader to open the file. Throw an exception if we can't determine the file type. @param inputFile file name @return ProjectFile instance
[ "Use", "the", "universal", "project", "reader", "to", "open", "the", "file", ".", "Throw", "an", "exception", "if", "we", "can", "t", "determine", "the", "file", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjConvert.java#L103-L112
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readProjectProperties
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
java
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
[ "private", "void", "readProjectProperties", "(", "Settings", "phoenixSettings", ",", "Storepoint", "storepoint", ")", "{", "ProjectProperties", "mpxjProperties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "mpxjProperties", ".", "setName", "(", "...
This method extracts project properties from a Phoenix file. @param phoenixSettings Phoenix settings @param storepoint Current storepoint
[ "This", "method", "extracts", "project", "properties", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L193-L199
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readCalendars
private void readCalendars(Storepoint phoenixProject) { Calendars calendars = phoenixProject.getCalendars(); if (calendars != null) { for (Calendar calendar : calendars.getCalendar()) { readCalendar(calendar); } ProjectCalendar defaultCalendar = m_projectFile.getCalendarByName(phoenixProject.getDefaultCalendar()); if (defaultCalendar != null) { m_projectFile.getProjectProperties().setDefaultCalendarName(defaultCalendar.getName()); } } }
java
private void readCalendars(Storepoint phoenixProject) { Calendars calendars = phoenixProject.getCalendars(); if (calendars != null) { for (Calendar calendar : calendars.getCalendar()) { readCalendar(calendar); } ProjectCalendar defaultCalendar = m_projectFile.getCalendarByName(phoenixProject.getDefaultCalendar()); if (defaultCalendar != null) { m_projectFile.getProjectProperties().setDefaultCalendarName(defaultCalendar.getName()); } } }
[ "private", "void", "readCalendars", "(", "Storepoint", "phoenixProject", ")", "{", "Calendars", "calendars", "=", "phoenixProject", ".", "getCalendars", "(", ")", ";", "if", "(", "calendars", "!=", "null", ")", "{", "for", "(", "Calendar", "calendar", ":", "...
This method extracts calendar data from a Phoenix file. @param phoenixProject Root node of the Phoenix file
[ "This", "method", "extracts", "calendar", "data", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L206-L222
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readCalendar
private void readCalendar(Calendar calendar) { // Create the calendar ProjectCalendar mpxjCalendar = m_projectFile.addCalendar(); mpxjCalendar.setName(calendar.getName()); // Default all days to working for (Day day : Day.values()) { mpxjCalendar.setWorkingDay(day, true); } // Mark non-working days List<NonWork> nonWorkingDays = calendar.getNonWork(); for (NonWork nonWorkingDay : nonWorkingDays) { // TODO: handle recurring exceptions if (nonWorkingDay.getType().equals("internal_weekly")) { mpxjCalendar.setWorkingDay(nonWorkingDay.getWeekday(), false); } } // Add default working hours for working days for (Day day : Day.values()) { if (mpxjCalendar.isWorkingDay(day)) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
java
private void readCalendar(Calendar calendar) { // Create the calendar ProjectCalendar mpxjCalendar = m_projectFile.addCalendar(); mpxjCalendar.setName(calendar.getName()); // Default all days to working for (Day day : Day.values()) { mpxjCalendar.setWorkingDay(day, true); } // Mark non-working days List<NonWork> nonWorkingDays = calendar.getNonWork(); for (NonWork nonWorkingDay : nonWorkingDays) { // TODO: handle recurring exceptions if (nonWorkingDay.getType().equals("internal_weekly")) { mpxjCalendar.setWorkingDay(nonWorkingDay.getWeekday(), false); } } // Add default working hours for working days for (Day day : Day.values()) { if (mpxjCalendar.isWorkingDay(day)) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
[ "private", "void", "readCalendar", "(", "Calendar", "calendar", ")", "{", "// Create the calendar", "ProjectCalendar", "mpxjCalendar", "=", "m_projectFile", ".", "addCalendar", "(", ")", ";", "mpxjCalendar", ".", "setName", "(", "calendar", ".", "getName", "(", ")...
This method extracts data for a single calendar from a Phoenix file. @param calendar calendar data
[ "This", "method", "extracts", "data", "for", "a", "single", "calendar", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L229-L262
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readResources
private void readResources(Storepoint phoenixProject) { Resources resources = phoenixProject.getResources(); if (resources != null) { for (net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res : resources.getResource()) { Resource resource = readResource(res); readAssignments(resource, res); } } }
java
private void readResources(Storepoint phoenixProject) { Resources resources = phoenixProject.getResources(); if (resources != null) { for (net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res : resources.getResource()) { Resource resource = readResource(res); readAssignments(resource, res); } } }
[ "private", "void", "readResources", "(", "Storepoint", "phoenixProject", ")", "{", "Resources", "resources", "=", "phoenixProject", ".", "getResources", "(", ")", ";", "if", "(", "resources", "!=", "null", ")", "{", "for", "(", "net", ".", "sf", ".", "mpxj...
This method extracts resource data from a Phoenix file. @param phoenixProject parent node for resources
[ "This", "method", "extracts", "resource", "data", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L269-L280
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readResource
private Resource readResource(net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource phoenixResource) { Resource mpxjResource = m_projectFile.addResource(); TimeUnit rateUnits = phoenixResource.getMonetarybase(); if (rateUnits == null) { rateUnits = TimeUnit.HOURS; } // phoenixResource.getMaximum() mpxjResource.setCostPerUse(phoenixResource.getMonetarycostperuse()); mpxjResource.setStandardRate(new Rate(phoenixResource.getMonetaryrate(), rateUnits)); mpxjResource.setStandardRateUnits(rateUnits); mpxjResource.setName(phoenixResource.getName()); mpxjResource.setType(phoenixResource.getType()); mpxjResource.setMaterialLabel(phoenixResource.getUnitslabel()); //phoenixResource.getUnitsperbase() mpxjResource.setGUID(phoenixResource.getUuid()); m_eventManager.fireResourceReadEvent(mpxjResource); return mpxjResource; }
java
private Resource readResource(net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource phoenixResource) { Resource mpxjResource = m_projectFile.addResource(); TimeUnit rateUnits = phoenixResource.getMonetarybase(); if (rateUnits == null) { rateUnits = TimeUnit.HOURS; } // phoenixResource.getMaximum() mpxjResource.setCostPerUse(phoenixResource.getMonetarycostperuse()); mpxjResource.setStandardRate(new Rate(phoenixResource.getMonetaryrate(), rateUnits)); mpxjResource.setStandardRateUnits(rateUnits); mpxjResource.setName(phoenixResource.getName()); mpxjResource.setType(phoenixResource.getType()); mpxjResource.setMaterialLabel(phoenixResource.getUnitslabel()); //phoenixResource.getUnitsperbase() mpxjResource.setGUID(phoenixResource.getUuid()); m_eventManager.fireResourceReadEvent(mpxjResource); return mpxjResource; }
[ "private", "Resource", "readResource", "(", "net", ".", "sf", ".", "mpxj", ".", "phoenix", ".", "schema", ".", "Project", ".", "Storepoints", ".", "Storepoint", ".", "Resources", ".", "Resource", "phoenixResource", ")", "{", "Resource", "mpxjResource", "=", ...
This method extracts data for a single resource from a Phoenix file. @param phoenixResource resource data @return Resource instance
[ "This", "method", "extracts", "data", "for", "a", "single", "resource", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L288-L311
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readTasks
private void readTasks(Project phoenixProject, Storepoint storepoint) { processLayouts(phoenixProject); processActivityCodes(storepoint); processActivities(storepoint); updateDates(); }
java
private void readTasks(Project phoenixProject, Storepoint storepoint) { processLayouts(phoenixProject); processActivityCodes(storepoint); processActivities(storepoint); updateDates(); }
[ "private", "void", "readTasks", "(", "Project", "phoenixProject", ",", "Storepoint", "storepoint", ")", "{", "processLayouts", "(", "phoenixProject", ")", ";", "processActivityCodes", "(", "storepoint", ")", ";", "processActivities", "(", "storepoint", ")", ";", "...
Read phases and activities from the Phoenix file to create the task hierarchy. @param phoenixProject all project data @param storepoint storepoint containing current project data
[ "Read", "phases", "and", "activities", "from", "the", "Phoenix", "file", "to", "create", "the", "task", "hierarchy", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L319-L325
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processActivityCodes
private void processActivityCodes(Storepoint storepoint) { for (Code code : storepoint.getActivityCodes().getCode()) { int sequence = 0; for (Value value : code.getValue()) { UUID uuid = getUUID(value.getUuid(), value.getName()); m_activityCodeValues.put(uuid, value.getName()); m_activityCodeSequence.put(uuid, Integer.valueOf(++sequence)); } } }
java
private void processActivityCodes(Storepoint storepoint) { for (Code code : storepoint.getActivityCodes().getCode()) { int sequence = 0; for (Value value : code.getValue()) { UUID uuid = getUUID(value.getUuid(), value.getName()); m_activityCodeValues.put(uuid, value.getName()); m_activityCodeSequence.put(uuid, Integer.valueOf(++sequence)); } } }
[ "private", "void", "processActivityCodes", "(", "Storepoint", "storepoint", ")", "{", "for", "(", "Code", "code", ":", "storepoint", ".", "getActivityCodes", "(", ")", ".", "getCode", "(", ")", ")", "{", "int", "sequence", "=", "0", ";", "for", "(", "Val...
Map from an activity code value UUID to the actual value itself, and its sequence number. @param storepoint storepoint containing current project data
[ "Map", "from", "an", "activity", "code", "value", "UUID", "to", "the", "actual", "value", "itself", "and", "its", "sequence", "number", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L333-L345
train
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processLayouts
private void processLayouts(Project phoenixProject) { // // Find the active layout // Layout activeLayout = getActiveLayout(phoenixProject); // // Create a list of the visible codes in the correct order // for (CodeOption option : activeLayout.getCodeOptions().getCodeOption()) { if (option.isShown().booleanValue()) { m_codeSequence.add(getUUID(option.getCodeUuid(), option.getCode())); } } }
java
private void processLayouts(Project phoenixProject) { // // Find the active layout // Layout activeLayout = getActiveLayout(phoenixProject); // // Create a list of the visible codes in the correct order // for (CodeOption option : activeLayout.getCodeOptions().getCodeOption()) { if (option.isShown().booleanValue()) { m_codeSequence.add(getUUID(option.getCodeUuid(), option.getCode())); } } }
[ "private", "void", "processLayouts", "(", "Project", "phoenixProject", ")", "{", "//", "// Find the active layout", "//", "Layout", "activeLayout", "=", "getActiveLayout", "(", "phoenixProject", ")", ";", "//", "// Create a list of the visible codes in the correct order", "...
Find the current layout and extract the activity code order and visibility. @param phoenixProject phoenix project data
[ "Find", "the", "current", "layout", "and", "extract", "the", "activity", "code", "order", "and", "visibility", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L352-L369
train