id
int32 0
165k
| 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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
157,400
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeAssignments
|
private void writeAssignments()
{
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
Resource resource = assignment.getResource();
if (resource != null)
{
Task task = assignment.getTask();
if (task != null && task.getUniqueID().intValue() != 0 && !task.getSummary())
{
writeAssignment(assignment);
}
}
}
}
|
java
|
private void writeAssignments()
{
for (ResourceAssignment assignment : m_projectFile.getResourceAssignments())
{
Resource resource = assignment.getResource();
if (resource != null)
{
Task task = assignment.getTask();
if (task != null && task.getUniqueID().intValue() != 0 && !task.getSummary())
{
writeAssignment(assignment);
}
}
}
}
|
[
"private",
"void",
"writeAssignments",
"(",
")",
"{",
"for",
"(",
"ResourceAssignment",
"assignment",
":",
"m_projectFile",
".",
"getResourceAssignments",
"(",
")",
")",
"{",
"Resource",
"resource",
"=",
"assignment",
".",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"Task",
"task",
"=",
"assignment",
".",
"getTask",
"(",
")",
";",
"if",
"(",
"task",
"!=",
"null",
"&&",
"task",
".",
"getUniqueID",
"(",
")",
".",
"intValue",
"(",
")",
"!=",
"0",
"&&",
"!",
"task",
".",
"getSummary",
"(",
")",
")",
"{",
"writeAssignment",
"(",
"assignment",
")",
";",
"}",
"}",
"}",
"}"
] |
Writes assignment data to a PM XML file.
|
[
"Writes",
"assignment",
"data",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L702-L716
|
157,401
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeAssignment
|
private void writeAssignment(ResourceAssignment mpxj)
{
ResourceAssignmentType xml = m_factory.createResourceAssignmentType();
m_project.getResourceAssignment().add(xml);
Task task = mpxj.getTask();
Task parentTask = task.getParentTask();
Integer parentTaskUniqueID = parentTask == null ? null : parentTask.getUniqueID();
xml.setActivityObjectId(mpxj.getTaskUniqueID());
xml.setActualCost(getDouble(mpxj.getActualCost()));
xml.setActualFinishDate(mpxj.getActualFinish());
xml.setActualOvertimeUnits(getDuration(mpxj.getActualOvertimeWork()));
xml.setActualRegularUnits(getDuration(mpxj.getActualWork()));
xml.setActualStartDate(mpxj.getActualStart());
xml.setActualUnits(getDuration(mpxj.getActualWork()));
xml.setAtCompletionUnits(getDuration(mpxj.getRemainingWork()));
xml.setPlannedCost(getDouble(mpxj.getActualCost()));
xml.setFinishDate(mpxj.getFinish());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setObjectId(mpxj.getUniqueID());
xml.setPlannedDuration(getDuration(mpxj.getWork()));
xml.setPlannedFinishDate(mpxj.getFinish());
xml.setPlannedStartDate(mpxj.getStart());
xml.setPlannedUnits(getDuration(mpxj.getWork()));
xml.setPlannedUnitsPerTime(getPercentage(mpxj.getUnits()));
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setRateSource("Resource");
xml.setRemainingCost(getDouble(mpxj.getActualCost()));
xml.setRemainingDuration(getDuration(mpxj.getRemainingWork()));
xml.setRemainingFinishDate(mpxj.getFinish());
xml.setRemainingStartDate(mpxj.getStart());
xml.setRemainingUnits(getDuration(mpxj.getRemainingWork()));
xml.setRemainingUnitsPerTime(getPercentage(mpxj.getUnits()));
xml.setResourceObjectId(mpxj.getResourceUniqueID());
xml.setStartDate(mpxj.getStart());
xml.setWBSObjectId(parentTaskUniqueID);
xml.getUDF().addAll(writeUDFType(FieldTypeClass.ASSIGNMENT, mpxj));
}
|
java
|
private void writeAssignment(ResourceAssignment mpxj)
{
ResourceAssignmentType xml = m_factory.createResourceAssignmentType();
m_project.getResourceAssignment().add(xml);
Task task = mpxj.getTask();
Task parentTask = task.getParentTask();
Integer parentTaskUniqueID = parentTask == null ? null : parentTask.getUniqueID();
xml.setActivityObjectId(mpxj.getTaskUniqueID());
xml.setActualCost(getDouble(mpxj.getActualCost()));
xml.setActualFinishDate(mpxj.getActualFinish());
xml.setActualOvertimeUnits(getDuration(mpxj.getActualOvertimeWork()));
xml.setActualRegularUnits(getDuration(mpxj.getActualWork()));
xml.setActualStartDate(mpxj.getActualStart());
xml.setActualUnits(getDuration(mpxj.getActualWork()));
xml.setAtCompletionUnits(getDuration(mpxj.getRemainingWork()));
xml.setPlannedCost(getDouble(mpxj.getActualCost()));
xml.setFinishDate(mpxj.getFinish());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setObjectId(mpxj.getUniqueID());
xml.setPlannedDuration(getDuration(mpxj.getWork()));
xml.setPlannedFinishDate(mpxj.getFinish());
xml.setPlannedStartDate(mpxj.getStart());
xml.setPlannedUnits(getDuration(mpxj.getWork()));
xml.setPlannedUnitsPerTime(getPercentage(mpxj.getUnits()));
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setRateSource("Resource");
xml.setRemainingCost(getDouble(mpxj.getActualCost()));
xml.setRemainingDuration(getDuration(mpxj.getRemainingWork()));
xml.setRemainingFinishDate(mpxj.getFinish());
xml.setRemainingStartDate(mpxj.getStart());
xml.setRemainingUnits(getDuration(mpxj.getRemainingWork()));
xml.setRemainingUnitsPerTime(getPercentage(mpxj.getUnits()));
xml.setResourceObjectId(mpxj.getResourceUniqueID());
xml.setStartDate(mpxj.getStart());
xml.setWBSObjectId(parentTaskUniqueID);
xml.getUDF().addAll(writeUDFType(FieldTypeClass.ASSIGNMENT, mpxj));
}
|
[
"private",
"void",
"writeAssignment",
"(",
"ResourceAssignment",
"mpxj",
")",
"{",
"ResourceAssignmentType",
"xml",
"=",
"m_factory",
".",
"createResourceAssignmentType",
"(",
")",
";",
"m_project",
".",
"getResourceAssignment",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"Task",
"task",
"=",
"mpxj",
".",
"getTask",
"(",
")",
";",
"Task",
"parentTask",
"=",
"task",
".",
"getParentTask",
"(",
")",
";",
"Integer",
"parentTaskUniqueID",
"=",
"parentTask",
"==",
"null",
"?",
"null",
":",
"parentTask",
".",
"getUniqueID",
"(",
")",
";",
"xml",
".",
"setActivityObjectId",
"(",
"mpxj",
".",
"getTaskUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setActualCost",
"(",
"getDouble",
"(",
"mpxj",
".",
"getActualCost",
"(",
")",
")",
")",
";",
"xml",
".",
"setActualFinishDate",
"(",
"mpxj",
".",
"getActualFinish",
"(",
")",
")",
";",
"xml",
".",
"setActualOvertimeUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getActualOvertimeWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setActualRegularUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getActualWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setActualStartDate",
"(",
"mpxj",
".",
"getActualStart",
"(",
")",
")",
";",
"xml",
".",
"setActualUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getActualWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setAtCompletionUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getRemainingWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setPlannedCost",
"(",
"getDouble",
"(",
"mpxj",
".",
"getActualCost",
"(",
")",
")",
")",
";",
"xml",
".",
"setFinishDate",
"(",
"mpxj",
".",
"getFinish",
"(",
")",
")",
";",
"xml",
".",
"setGUID",
"(",
"DatatypeConverter",
".",
"printUUID",
"(",
"mpxj",
".",
"getGUID",
"(",
")",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setPlannedDuration",
"(",
"getDuration",
"(",
"mpxj",
".",
"getWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setPlannedFinishDate",
"(",
"mpxj",
".",
"getFinish",
"(",
")",
")",
";",
"xml",
".",
"setPlannedStartDate",
"(",
"mpxj",
".",
"getStart",
"(",
")",
")",
";",
"xml",
".",
"setPlannedUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setPlannedUnitsPerTime",
"(",
"getPercentage",
"(",
"mpxj",
".",
"getUnits",
"(",
")",
")",
")",
";",
"xml",
".",
"setProjectObjectId",
"(",
"PROJECT_OBJECT_ID",
")",
";",
"xml",
".",
"setRateSource",
"(",
"\"Resource\"",
")",
";",
"xml",
".",
"setRemainingCost",
"(",
"getDouble",
"(",
"mpxj",
".",
"getActualCost",
"(",
")",
")",
")",
";",
"xml",
".",
"setRemainingDuration",
"(",
"getDuration",
"(",
"mpxj",
".",
"getRemainingWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setRemainingFinishDate",
"(",
"mpxj",
".",
"getFinish",
"(",
")",
")",
";",
"xml",
".",
"setRemainingStartDate",
"(",
"mpxj",
".",
"getStart",
"(",
")",
")",
";",
"xml",
".",
"setRemainingUnits",
"(",
"getDuration",
"(",
"mpxj",
".",
"getRemainingWork",
"(",
")",
")",
")",
";",
"xml",
".",
"setRemainingUnitsPerTime",
"(",
"getPercentage",
"(",
"mpxj",
".",
"getUnits",
"(",
")",
")",
")",
";",
"xml",
".",
"setResourceObjectId",
"(",
"mpxj",
".",
"getResourceUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setStartDate",
"(",
"mpxj",
".",
"getStart",
"(",
")",
")",
";",
"xml",
".",
"setWBSObjectId",
"(",
"parentTaskUniqueID",
")",
";",
"xml",
".",
"getUDF",
"(",
")",
".",
"addAll",
"(",
"writeUDFType",
"(",
"FieldTypeClass",
".",
"ASSIGNMENT",
",",
"mpxj",
")",
")",
";",
"}"
] |
Writes a resource assignment to a PM XML file.
@param mpxj MPXJ ResourceAssignment instance
|
[
"Writes",
"a",
"resource",
"assignment",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L723-L760
|
157,402
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writePredecessors
|
private void writePredecessors(Task task)
{
List<Relation> relations = task.getPredecessors();
for (Relation mpxj : relations)
{
RelationshipType xml = m_factory.createRelationshipType();
m_project.getRelationship().add(xml);
xml.setLag(getDuration(mpxj.getLag()));
xml.setObjectId(Integer.valueOf(++m_relationshipObjectID));
xml.setPredecessorActivityObjectId(mpxj.getTargetTask().getUniqueID());
xml.setSuccessorActivityObjectId(mpxj.getSourceTask().getUniqueID());
xml.setPredecessorProjectObjectId(PROJECT_OBJECT_ID);
xml.setSuccessorProjectObjectId(PROJECT_OBJECT_ID);
xml.setType(RELATION_TYPE_MAP.get(mpxj.getType()));
}
}
|
java
|
private void writePredecessors(Task task)
{
List<Relation> relations = task.getPredecessors();
for (Relation mpxj : relations)
{
RelationshipType xml = m_factory.createRelationshipType();
m_project.getRelationship().add(xml);
xml.setLag(getDuration(mpxj.getLag()));
xml.setObjectId(Integer.valueOf(++m_relationshipObjectID));
xml.setPredecessorActivityObjectId(mpxj.getTargetTask().getUniqueID());
xml.setSuccessorActivityObjectId(mpxj.getSourceTask().getUniqueID());
xml.setPredecessorProjectObjectId(PROJECT_OBJECT_ID);
xml.setSuccessorProjectObjectId(PROJECT_OBJECT_ID);
xml.setType(RELATION_TYPE_MAP.get(mpxj.getType()));
}
}
|
[
"private",
"void",
"writePredecessors",
"(",
"Task",
"task",
")",
"{",
"List",
"<",
"Relation",
">",
"relations",
"=",
"task",
".",
"getPredecessors",
"(",
")",
";",
"for",
"(",
"Relation",
"mpxj",
":",
"relations",
")",
"{",
"RelationshipType",
"xml",
"=",
"m_factory",
".",
"createRelationshipType",
"(",
")",
";",
"m_project",
".",
"getRelationship",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"xml",
".",
"setLag",
"(",
"getDuration",
"(",
"mpxj",
".",
"getLag",
"(",
")",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"Integer",
".",
"valueOf",
"(",
"++",
"m_relationshipObjectID",
")",
")",
";",
"xml",
".",
"setPredecessorActivityObjectId",
"(",
"mpxj",
".",
"getTargetTask",
"(",
")",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setSuccessorActivityObjectId",
"(",
"mpxj",
".",
"getSourceTask",
"(",
")",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setPredecessorProjectObjectId",
"(",
"PROJECT_OBJECT_ID",
")",
";",
"xml",
".",
"setSuccessorProjectObjectId",
"(",
"PROJECT_OBJECT_ID",
")",
";",
"xml",
".",
"setType",
"(",
"RELATION_TYPE_MAP",
".",
"get",
"(",
"mpxj",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"}"
] |
Writes task predecessor links to a PM XML file.
@param task MPXJ Task instance
|
[
"Writes",
"task",
"predecessor",
"links",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L767-L783
|
157,403
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeUDFType
|
private List<UDFAssignmentType> writeUDFType(FieldTypeClass type, FieldContainer mpxj)
{
List<UDFAssignmentType> out = new ArrayList<UDFAssignmentType>();
for (CustomField cf : m_sortedCustomFieldsList)
{
FieldType fieldType = cf.getFieldType();
if (fieldType != null && type == fieldType.getFieldTypeClass())
{
Object value = mpxj.getCachedValue(fieldType);
if (FieldTypeHelper.valueIsNotDefault(fieldType, value))
{
UDFAssignmentType udf = m_factory.createUDFAssignmentType();
udf.setTypeObjectId(FieldTypeHelper.getFieldID(fieldType));
setUserFieldValue(udf, fieldType.getDataType(), value);
out.add(udf);
}
}
}
return out;
}
|
java
|
private List<UDFAssignmentType> writeUDFType(FieldTypeClass type, FieldContainer mpxj)
{
List<UDFAssignmentType> out = new ArrayList<UDFAssignmentType>();
for (CustomField cf : m_sortedCustomFieldsList)
{
FieldType fieldType = cf.getFieldType();
if (fieldType != null && type == fieldType.getFieldTypeClass())
{
Object value = mpxj.getCachedValue(fieldType);
if (FieldTypeHelper.valueIsNotDefault(fieldType, value))
{
UDFAssignmentType udf = m_factory.createUDFAssignmentType();
udf.setTypeObjectId(FieldTypeHelper.getFieldID(fieldType));
setUserFieldValue(udf, fieldType.getDataType(), value);
out.add(udf);
}
}
}
return out;
}
|
[
"private",
"List",
"<",
"UDFAssignmentType",
">",
"writeUDFType",
"(",
"FieldTypeClass",
"type",
",",
"FieldContainer",
"mpxj",
")",
"{",
"List",
"<",
"UDFAssignmentType",
">",
"out",
"=",
"new",
"ArrayList",
"<",
"UDFAssignmentType",
">",
"(",
")",
";",
"for",
"(",
"CustomField",
"cf",
":",
"m_sortedCustomFieldsList",
")",
"{",
"FieldType",
"fieldType",
"=",
"cf",
".",
"getFieldType",
"(",
")",
";",
"if",
"(",
"fieldType",
"!=",
"null",
"&&",
"type",
"==",
"fieldType",
".",
"getFieldTypeClass",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"mpxj",
".",
"getCachedValue",
"(",
"fieldType",
")",
";",
"if",
"(",
"FieldTypeHelper",
".",
"valueIsNotDefault",
"(",
"fieldType",
",",
"value",
")",
")",
"{",
"UDFAssignmentType",
"udf",
"=",
"m_factory",
".",
"createUDFAssignmentType",
"(",
")",
";",
"udf",
".",
"setTypeObjectId",
"(",
"FieldTypeHelper",
".",
"getFieldID",
"(",
"fieldType",
")",
")",
";",
"setUserFieldValue",
"(",
"udf",
",",
"fieldType",
".",
"getDataType",
"(",
")",
",",
"value",
")",
";",
"out",
".",
"add",
"(",
"udf",
")",
";",
"}",
"}",
"}",
"return",
"out",
";",
"}"
] |
Writes a list of UDF types.
@author lsong
@param type parent entity type
@param mpxj parent entity
@return list of UDFAssignmentType instances
|
[
"Writes",
"a",
"list",
"of",
"UDF",
"types",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L793-L812
|
157,404
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.setUserFieldValue
|
private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value)
{
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
}
|
java
|
private void setUserFieldValue(UDFAssignmentType udf, DataType dataType, Object value)
{
switch (dataType)
{
case DURATION:
{
udf.setTextValue(((Duration) value).toString());
break;
}
case CURRENCY:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setCostValue((Double) value);
break;
}
case BINARY:
{
udf.setTextValue("");
break;
}
case STRING:
{
udf.setTextValue((String) value);
break;
}
case DATE:
{
udf.setStartDateValue((Date) value);
break;
}
case NUMERIC:
{
if (!(value instanceof Double))
{
value = Double.valueOf(((Number) value).doubleValue());
}
udf.setDoubleValue((Double) value);
break;
}
case BOOLEAN:
{
udf.setIntegerValue(BooleanHelper.getBoolean((Boolean) value) ? Integer.valueOf(1) : Integer.valueOf(0));
break;
}
case INTEGER:
case SHORT:
{
udf.setIntegerValue(NumberHelper.getInteger((Number) value));
break;
}
default:
{
throw new RuntimeException("Unconvertible data type: " + dataType);
}
}
}
|
[
"private",
"void",
"setUserFieldValue",
"(",
"UDFAssignmentType",
"udf",
",",
"DataType",
"dataType",
",",
"Object",
"value",
")",
"{",
"switch",
"(",
"dataType",
")",
"{",
"case",
"DURATION",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"(",
"(",
"Duration",
")",
"value",
")",
".",
"toString",
"(",
")",
")",
";",
"break",
";",
"}",
"case",
"CURRENCY",
":",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Double",
")",
")",
"{",
"value",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"udf",
".",
"setCostValue",
"(",
"(",
"Double",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"BINARY",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"\"\"",
")",
";",
"break",
";",
"}",
"case",
"STRING",
":",
"{",
"udf",
".",
"setTextValue",
"(",
"(",
"String",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"DATE",
":",
"{",
"udf",
".",
"setStartDateValue",
"(",
"(",
"Date",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"NUMERIC",
":",
"{",
"if",
"(",
"!",
"(",
"value",
"instanceof",
"Double",
")",
")",
"{",
"value",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"udf",
".",
"setDoubleValue",
"(",
"(",
"Double",
")",
"value",
")",
";",
"break",
";",
"}",
"case",
"BOOLEAN",
":",
"{",
"udf",
".",
"setIntegerValue",
"(",
"BooleanHelper",
".",
"getBoolean",
"(",
"(",
"Boolean",
")",
"value",
")",
"?",
"Integer",
".",
"valueOf",
"(",
"1",
")",
":",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
";",
"break",
";",
"}",
"case",
"INTEGER",
":",
"case",
"SHORT",
":",
"{",
"udf",
".",
"setIntegerValue",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"(",
"Number",
")",
"value",
")",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"Unconvertible data type: \"",
"+",
"dataType",
")",
";",
"}",
"}",
"}"
] |
Sets the value of a UDF.
@param udf user defined field
@param dataType MPXJ data type
@param value field value
|
[
"Sets",
"the",
"value",
"of",
"a",
"UDF",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L821-L887
|
157,405
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getDuration
|
private Double getDuration(Duration duration)
{
Double result;
if (duration == null)
{
result = null;
}
else
{
if (duration.getUnits() != TimeUnit.HOURS)
{
duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
}
result = Double.valueOf(duration.getDuration());
}
return result;
}
|
java
|
private Double getDuration(Duration duration)
{
Double result;
if (duration == null)
{
result = null;
}
else
{
if (duration.getUnits() != TimeUnit.HOURS)
{
duration = duration.convertUnits(TimeUnit.HOURS, m_projectFile.getProjectProperties());
}
result = Double.valueOf(duration.getDuration());
}
return result;
}
|
[
"private",
"Double",
"getDuration",
"(",
"Duration",
"duration",
")",
"{",
"Double",
"result",
";",
"if",
"(",
"duration",
"==",
"null",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"duration",
".",
"getUnits",
"(",
")",
"!=",
"TimeUnit",
".",
"HOURS",
")",
"{",
"duration",
"=",
"duration",
".",
"convertUnits",
"(",
"TimeUnit",
".",
"HOURS",
",",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
")",
";",
"}",
"result",
"=",
"Double",
".",
"valueOf",
"(",
"duration",
".",
"getDuration",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Retrieve a duration in the form required by Primavera.
@param duration Duration instance
@return formatted duration
|
[
"Retrieve",
"a",
"duration",
"in",
"the",
"form",
"required",
"by",
"Primavera",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L895-L912
|
157,406
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getResourceType
|
private String getResourceType(Resource resource)
{
String result;
net.sf.mpxj.ResourceType type = resource.getType();
if (type == null)
{
type = net.sf.mpxj.ResourceType.WORK;
}
switch (type)
{
case MATERIAL:
{
result = "Material";
break;
}
case COST:
{
result = "Nonlabor";
break;
}
default:
{
result = "Labor";
break;
}
}
return result;
}
|
java
|
private String getResourceType(Resource resource)
{
String result;
net.sf.mpxj.ResourceType type = resource.getType();
if (type == null)
{
type = net.sf.mpxj.ResourceType.WORK;
}
switch (type)
{
case MATERIAL:
{
result = "Material";
break;
}
case COST:
{
result = "Nonlabor";
break;
}
default:
{
result = "Labor";
break;
}
}
return result;
}
|
[
"private",
"String",
"getResourceType",
"(",
"Resource",
"resource",
")",
"{",
"String",
"result",
";",
"net",
".",
"sf",
".",
"mpxj",
".",
"ResourceType",
"type",
"=",
"resource",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"type",
"=",
"net",
".",
"sf",
".",
"mpxj",
".",
"ResourceType",
".",
"WORK",
";",
"}",
"switch",
"(",
"type",
")",
"{",
"case",
"MATERIAL",
":",
"{",
"result",
"=",
"\"Material\"",
";",
"break",
";",
"}",
"case",
"COST",
":",
"{",
"result",
"=",
"\"Nonlabor\"",
";",
"break",
";",
"}",
"default",
":",
"{",
"result",
"=",
"\"Labor\"",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Formats a resource type.
@param resource MPXJ resource
@return Primavera resource type
|
[
"Formats",
"a",
"resource",
"type",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L931-L962
|
157,407
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getPercentage
|
private Double getPercentage(Number number)
{
Double result = null;
if (number != null)
{
result = Double.valueOf(number.doubleValue() / 100);
}
return result;
}
|
java
|
private Double getPercentage(Number number)
{
Double result = null;
if (number != null)
{
result = Double.valueOf(number.doubleValue() / 100);
}
return result;
}
|
[
"private",
"Double",
"getPercentage",
"(",
"Number",
"number",
")",
"{",
"Double",
"result",
"=",
"null",
";",
"if",
"(",
"number",
"!=",
"null",
")",
"{",
"result",
"=",
"Double",
".",
"valueOf",
"(",
"number",
".",
"doubleValue",
"(",
")",
"/",
"100",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Formats a percentage value.
@param number MPXJ percentage value
@return Primavera percentage value
|
[
"Formats",
"a",
"percentage",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L970-L980
|
157,408
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getDouble
|
private Double getDouble(Number number)
{
Double result = null;
if (number != null)
{
result = Double.valueOf(number.doubleValue());
}
return result;
}
|
java
|
private Double getDouble(Number number)
{
Double result = null;
if (number != null)
{
result = Double.valueOf(number.doubleValue());
}
return result;
}
|
[
"private",
"Double",
"getDouble",
"(",
"Number",
"number",
")",
"{",
"Double",
"result",
"=",
"null",
";",
"if",
"(",
"number",
"!=",
"null",
")",
"{",
"result",
"=",
"Double",
".",
"valueOf",
"(",
"number",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Formats a double value.
@param number numeric value
@return Double instance
|
[
"Formats",
"a",
"double",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L988-L998
|
157,409
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getActivityStatus
|
private String getActivityStatus(Task mpxj)
{
String result;
if (mpxj.getActualStart() == null)
{
result = "Not Started";
}
else
{
if (mpxj.getActualFinish() == null)
{
result = "In Progress";
}
else
{
result = "Completed";
}
}
return result;
}
|
java
|
private String getActivityStatus(Task mpxj)
{
String result;
if (mpxj.getActualStart() == null)
{
result = "Not Started";
}
else
{
if (mpxj.getActualFinish() == null)
{
result = "In Progress";
}
else
{
result = "Completed";
}
}
return result;
}
|
[
"private",
"String",
"getActivityStatus",
"(",
"Task",
"mpxj",
")",
"{",
"String",
"result",
";",
"if",
"(",
"mpxj",
".",
"getActualStart",
"(",
")",
"==",
"null",
")",
"{",
"result",
"=",
"\"Not Started\"",
";",
"}",
"else",
"{",
"if",
"(",
"mpxj",
".",
"getActualFinish",
"(",
")",
"==",
"null",
")",
"{",
"result",
"=",
"\"In Progress\"",
";",
"}",
"else",
"{",
"result",
"=",
"\"Completed\"",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieve an activity status.
@param mpxj MPXJ Task instance
@return activity status
|
[
"Retrieve",
"an",
"activity",
"status",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L1030-L1049
|
157,410
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getActivityID
|
private String getActivityID(Task task)
{
String result = null;
if (m_activityIDField != null)
{
Object value = task.getCachedValue(m_activityIDField);
if (value != null)
{
result = value.toString();
}
}
return result;
}
|
java
|
private String getActivityID(Task task)
{
String result = null;
if (m_activityIDField != null)
{
Object value = task.getCachedValue(m_activityIDField);
if (value != null)
{
result = value.toString();
}
}
return result;
}
|
[
"private",
"String",
"getActivityID",
"(",
"Task",
"task",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"m_activityIDField",
"!=",
"null",
")",
"{",
"Object",
"value",
"=",
"task",
".",
"getCachedValue",
"(",
"m_activityIDField",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"result",
"=",
"value",
".",
"toString",
"(",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieve the Activity ID value for this task.
@param task Task instance
@return Activity ID value
|
[
"Retrieve",
"the",
"Activity",
"ID",
"value",
"for",
"this",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L1056-L1068
|
157,411
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.configureCustomFields
|
private void configureCustomFields()
{
CustomFieldContainer customFields = m_projectFile.getCustomFields();
// If the caller hasn't already supplied a value for this field
if (m_activityIDField == null)
{
m_activityIDField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, "Code");
if (m_activityIDField == null)
{
m_activityIDField = TaskField.WBS;
}
}
// If the caller hasn't already supplied a value for this field
if (m_activityTypeField == null)
{
m_activityTypeField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, "Activity Type");
}
}
|
java
|
private void configureCustomFields()
{
CustomFieldContainer customFields = m_projectFile.getCustomFields();
// If the caller hasn't already supplied a value for this field
if (m_activityIDField == null)
{
m_activityIDField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, "Code");
if (m_activityIDField == null)
{
m_activityIDField = TaskField.WBS;
}
}
// If the caller hasn't already supplied a value for this field
if (m_activityTypeField == null)
{
m_activityTypeField = (TaskField) customFields.getFieldByAlias(FieldTypeClass.TASK, "Activity Type");
}
}
|
[
"private",
"void",
"configureCustomFields",
"(",
")",
"{",
"CustomFieldContainer",
"customFields",
"=",
"m_projectFile",
".",
"getCustomFields",
"(",
")",
";",
"// If the caller hasn't already supplied a value for this field",
"if",
"(",
"m_activityIDField",
"==",
"null",
")",
"{",
"m_activityIDField",
"=",
"(",
"TaskField",
")",
"customFields",
".",
"getFieldByAlias",
"(",
"FieldTypeClass",
".",
"TASK",
",",
"\"Code\"",
")",
";",
"if",
"(",
"m_activityIDField",
"==",
"null",
")",
"{",
"m_activityIDField",
"=",
"TaskField",
".",
"WBS",
";",
"}",
"}",
"// If the caller hasn't already supplied a value for this field",
"if",
"(",
"m_activityTypeField",
"==",
"null",
")",
"{",
"m_activityTypeField",
"=",
"(",
"TaskField",
")",
"customFields",
".",
"getFieldByAlias",
"(",
"FieldTypeClass",
".",
"TASK",
",",
"\"Activity Type\"",
")",
";",
"}",
"}"
] |
Find the fields in which the Activity ID and Activity Type are stored.
|
[
"Find",
"the",
"fields",
"in",
"which",
"the",
"Activity",
"ID",
"and",
"Activity",
"Type",
"are",
"stored",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L1073-L1092
|
157,412
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.populateSortedCustomFieldsList
|
private void populateSortedCustomFieldsList ()
{
m_sortedCustomFieldsList = new ArrayList<CustomField>();
for (CustomField field : m_projectFile.getCustomFields())
{
FieldType fieldType = field.getFieldType();
if (fieldType != null)
{
m_sortedCustomFieldsList.add(field);
}
}
// Sort to ensure consistent order in file
Collections.sort(m_sortedCustomFieldsList, new Comparator<CustomField>()
{
@Override public int compare(CustomField customField1, CustomField customField2)
{
FieldType o1 = customField1.getFieldType();
FieldType o2 = customField2.getFieldType();
String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
return name1.compareTo(name2);
}
});
}
|
java
|
private void populateSortedCustomFieldsList ()
{
m_sortedCustomFieldsList = new ArrayList<CustomField>();
for (CustomField field : m_projectFile.getCustomFields())
{
FieldType fieldType = field.getFieldType();
if (fieldType != null)
{
m_sortedCustomFieldsList.add(field);
}
}
// Sort to ensure consistent order in file
Collections.sort(m_sortedCustomFieldsList, new Comparator<CustomField>()
{
@Override public int compare(CustomField customField1, CustomField customField2)
{
FieldType o1 = customField1.getFieldType();
FieldType o2 = customField2.getFieldType();
String name1 = o1.getClass().getSimpleName() + "." + o1.getName() + " " + customField1.getAlias();
String name2 = o2.getClass().getSimpleName() + "." + o2.getName() + " " + customField2.getAlias();
return name1.compareTo(name2);
}
});
}
|
[
"private",
"void",
"populateSortedCustomFieldsList",
"(",
")",
"{",
"m_sortedCustomFieldsList",
"=",
"new",
"ArrayList",
"<",
"CustomField",
">",
"(",
")",
";",
"for",
"(",
"CustomField",
"field",
":",
"m_projectFile",
".",
"getCustomFields",
"(",
")",
")",
"{",
"FieldType",
"fieldType",
"=",
"field",
".",
"getFieldType",
"(",
")",
";",
"if",
"(",
"fieldType",
"!=",
"null",
")",
"{",
"m_sortedCustomFieldsList",
".",
"add",
"(",
"field",
")",
";",
"}",
"}",
"// Sort to ensure consistent order in file",
"Collections",
".",
"sort",
"(",
"m_sortedCustomFieldsList",
",",
"new",
"Comparator",
"<",
"CustomField",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"CustomField",
"customField1",
",",
"CustomField",
"customField2",
")",
"{",
"FieldType",
"o1",
"=",
"customField1",
".",
"getFieldType",
"(",
")",
";",
"FieldType",
"o2",
"=",
"customField2",
".",
"getFieldType",
"(",
")",
";",
"String",
"name1",
"=",
"o1",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\".\"",
"+",
"o1",
".",
"getName",
"(",
")",
"+",
"\" \"",
"+",
"customField1",
".",
"getAlias",
"(",
")",
";",
"String",
"name2",
"=",
"o2",
".",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\".\"",
"+",
"o2",
".",
"getName",
"(",
")",
"+",
"\" \"",
"+",
"customField2",
".",
"getAlias",
"(",
")",
";",
"return",
"name1",
".",
"compareTo",
"(",
"name2",
")",
";",
"}",
"}",
")",
";",
"}"
] |
Populate a sorted list of custom fields to ensure that these fields
are written to the file in a consistent order.
|
[
"Populate",
"a",
"sorted",
"list",
"of",
"custom",
"fields",
"to",
"ensure",
"that",
"these",
"fields",
"are",
"written",
"to",
"the",
"file",
"in",
"a",
"consistent",
"order",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L1098-L1122
|
157,413
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ProjectCalendarHours.java
|
ProjectCalendarHours.setDay
|
public void setDay(Day d)
{
if (m_day != null)
{
m_parentCalendar.removeHoursFromDay(this);
}
m_day = d;
m_parentCalendar.attachHoursToDay(this);
}
|
java
|
public void setDay(Day d)
{
if (m_day != null)
{
m_parentCalendar.removeHoursFromDay(this);
}
m_day = d;
m_parentCalendar.attachHoursToDay(this);
}
|
[
"public",
"void",
"setDay",
"(",
"Day",
"d",
")",
"{",
"if",
"(",
"m_day",
"!=",
"null",
")",
"{",
"m_parentCalendar",
".",
"removeHoursFromDay",
"(",
"this",
")",
";",
"}",
"m_day",
"=",
"d",
";",
"m_parentCalendar",
".",
"attachHoursToDay",
"(",
"this",
")",
";",
"}"
] |
Set day.
@param d day instance
|
[
"Set",
"day",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarHours.java#L67-L77
|
157,414
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/MPXJBaseFormat.java
|
MPXJBaseFormat.applyPatterns
|
public void applyPatterns(String[] patterns)
{
m_formats = new SimpleDateFormat[patterns.length];
for (int index = 0; index < patterns.length; index++)
{
m_formats[index] = new SimpleDateFormat(patterns[index]);
}
}
|
java
|
public void applyPatterns(String[] patterns)
{
m_formats = new SimpleDateFormat[patterns.length];
for (int index = 0; index < patterns.length; index++)
{
m_formats[index] = new SimpleDateFormat(patterns[index]);
}
}
|
[
"public",
"void",
"applyPatterns",
"(",
"String",
"[",
"]",
"patterns",
")",
"{",
"m_formats",
"=",
"new",
"SimpleDateFormat",
"[",
"patterns",
".",
"length",
"]",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"patterns",
".",
"length",
";",
"index",
"++",
")",
"{",
"m_formats",
"[",
"index",
"]",
"=",
"new",
"SimpleDateFormat",
"(",
"patterns",
"[",
"index",
"]",
")",
";",
"}",
"}"
] |
This method is used to configure the format pattern.
@param patterns new format patterns
|
[
"This",
"method",
"is",
"used",
"to",
"configure",
"the",
"format",
"pattern",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJBaseFormat.java#L55-L62
|
157,415
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDuration
|
public static Duration getDuration(ProjectProperties properties, Integer durationValue, Integer unitsValue)
{
Duration result;
if (durationValue == null)
{
result = null;
}
else
{
result = Duration.getInstance(durationValue.intValue(), TimeUnit.MINUTES);
TimeUnit units = getDurationUnits(unitsValue);
if (result.getUnits() != units)
{
result = result.convertUnits(units, properties);
}
}
return (result);
}
|
java
|
public static Duration getDuration(ProjectProperties properties, Integer durationValue, Integer unitsValue)
{
Duration result;
if (durationValue == null)
{
result = null;
}
else
{
result = Duration.getInstance(durationValue.intValue(), TimeUnit.MINUTES);
TimeUnit units = getDurationUnits(unitsValue);
if (result.getUnits() != units)
{
result = result.convertUnits(units, properties);
}
}
return (result);
}
|
[
"public",
"static",
"Duration",
"getDuration",
"(",
"ProjectProperties",
"properties",
",",
"Integer",
"durationValue",
",",
"Integer",
"unitsValue",
")",
"{",
"Duration",
"result",
";",
"if",
"(",
"durationValue",
"==",
"null",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"result",
"=",
"Duration",
".",
"getInstance",
"(",
"durationValue",
".",
"intValue",
"(",
")",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"TimeUnit",
"units",
"=",
"getDurationUnits",
"(",
"unitsValue",
")",
";",
"if",
"(",
"result",
".",
"getUnits",
"(",
")",
"!=",
"units",
")",
"{",
"result",
"=",
"result",
".",
"convertUnits",
"(",
"units",
",",
"properties",
")",
";",
"}",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Convert the integer representation of a duration value and duration units
into an MPXJ Duration instance.
@param properties project properties, used for duration units conversion
@param durationValue integer duration value
@param unitsValue integer units value
@return Duration instance
|
[
"Convert",
"the",
"integer",
"representation",
"of",
"a",
"duration",
"value",
"and",
"duration",
"units",
"into",
"an",
"MPXJ",
"Duration",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L63-L80
|
157,416
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDurationValue
|
public static Integer getDurationValue(ProjectProperties properties, Duration duration)
{
Integer result;
if (duration == null)
{
result = null;
}
else
{
if (duration.getUnits() != TimeUnit.MINUTES)
{
duration = duration.convertUnits(TimeUnit.MINUTES, properties);
}
result = Integer.valueOf((int) duration.getDuration());
}
return (result);
}
|
java
|
public static Integer getDurationValue(ProjectProperties properties, Duration duration)
{
Integer result;
if (duration == null)
{
result = null;
}
else
{
if (duration.getUnits() != TimeUnit.MINUTES)
{
duration = duration.convertUnits(TimeUnit.MINUTES, properties);
}
result = Integer.valueOf((int) duration.getDuration());
}
return (result);
}
|
[
"public",
"static",
"Integer",
"getDurationValue",
"(",
"ProjectProperties",
"properties",
",",
"Duration",
"duration",
")",
"{",
"Integer",
"result",
";",
"if",
"(",
"duration",
"==",
"null",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"duration",
".",
"getUnits",
"(",
")",
"!=",
"TimeUnit",
".",
"MINUTES",
")",
"{",
"duration",
"=",
"duration",
".",
"convertUnits",
"(",
"TimeUnit",
".",
"MINUTES",
",",
"properties",
")",
";",
"}",
"result",
"=",
"Integer",
".",
"valueOf",
"(",
"(",
"int",
")",
"duration",
".",
"getDuration",
"(",
")",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Convert an MPXJ Duration instance into an integer duration in minutes
ready to be written to an MPX file.
@param properties project properties, used for duration units conversion
@param duration Duration instance
@return integer duration in minutes
|
[
"Convert",
"an",
"MPXJ",
"Duration",
"instance",
"into",
"an",
"integer",
"duration",
"in",
"minutes",
"ready",
"to",
"be",
"written",
"to",
"an",
"MPX",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L90-L106
|
157,417
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDurationUnits
|
public static Integer getDurationUnits(RecurringTask recurrence)
{
Duration duration = recurrence.getDuration();
Integer result = null;
if (duration != null)
{
result = UNITS_MAP.get(duration.getUnits());
}
return (result);
}
|
java
|
public static Integer getDurationUnits(RecurringTask recurrence)
{
Duration duration = recurrence.getDuration();
Integer result = null;
if (duration != null)
{
result = UNITS_MAP.get(duration.getUnits());
}
return (result);
}
|
[
"public",
"static",
"Integer",
"getDurationUnits",
"(",
"RecurringTask",
"recurrence",
")",
"{",
"Duration",
"duration",
"=",
"recurrence",
".",
"getDuration",
"(",
")",
";",
"Integer",
"result",
"=",
"null",
";",
"if",
"(",
"duration",
"!=",
"null",
")",
"{",
"result",
"=",
"UNITS_MAP",
".",
"get",
"(",
"duration",
".",
"getUnits",
"(",
")",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Converts a TimeUnit instance to an integer value suitable for
writing to an MPX file.
@param recurrence RecurringTask instance
@return integer value
|
[
"Converts",
"a",
"TimeUnit",
"instance",
"to",
"an",
"integer",
"value",
"suitable",
"for",
"writing",
"to",
"an",
"MPX",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L115-L126
|
157,418
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDurationUnits
|
private static TimeUnit getDurationUnits(Integer value)
{
TimeUnit result = null;
if (value != null)
{
int index = value.intValue();
if (index >= 0 && index < DURATION_UNITS.length)
{
result = DURATION_UNITS[index];
}
}
if (result == null)
{
result = TimeUnit.DAYS;
}
return (result);
}
|
java
|
private static TimeUnit getDurationUnits(Integer value)
{
TimeUnit result = null;
if (value != null)
{
int index = value.intValue();
if (index >= 0 && index < DURATION_UNITS.length)
{
result = DURATION_UNITS[index];
}
}
if (result == null)
{
result = TimeUnit.DAYS;
}
return (result);
}
|
[
"private",
"static",
"TimeUnit",
"getDurationUnits",
"(",
"Integer",
"value",
")",
"{",
"TimeUnit",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"int",
"index",
"=",
"value",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"DURATION_UNITS",
".",
"length",
")",
"{",
"result",
"=",
"DURATION_UNITS",
"[",
"index",
"]",
";",
"}",
"}",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"TimeUnit",
".",
"DAYS",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Maps a duration unit value from a recurring task record in an MPX file
to a TimeUnit instance. Defaults to days if any problems are encountered.
@param value integer duration units value
@return TimeUnit instance
|
[
"Maps",
"a",
"duration",
"unit",
"value",
"from",
"a",
"recurring",
"task",
"record",
"in",
"an",
"MPX",
"file",
"to",
"a",
"TimeUnit",
"instance",
".",
"Defaults",
"to",
"days",
"if",
"any",
"problems",
"are",
"encountered",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L135-L154
|
157,419
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDays
|
public static Integer getDays(String days)
{
Integer result = null;
if (days != null)
{
result = Integer.valueOf(Integer.parseInt(days, 2));
}
return (result);
}
|
java
|
public static Integer getDays(String days)
{
Integer result = null;
if (days != null)
{
result = Integer.valueOf(Integer.parseInt(days, 2));
}
return (result);
}
|
[
"public",
"static",
"Integer",
"getDays",
"(",
"String",
"days",
")",
"{",
"Integer",
"result",
"=",
"null",
";",
"if",
"(",
"days",
"!=",
"null",
")",
"{",
"result",
"=",
"Integer",
".",
"valueOf",
"(",
"Integer",
".",
"parseInt",
"(",
"days",
",",
"2",
")",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Converts the string representation of the days bit field into an integer.
@param days string bit field
@return integer bit field
|
[
"Converts",
"the",
"string",
"representation",
"of",
"the",
"days",
"bit",
"field",
"into",
"an",
"integer",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L186-L194
|
157,420
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDays
|
public static String getDays(RecurringTask task)
{
StringBuilder sb = new StringBuilder();
for (Day day : Day.values())
{
sb.append(task.getWeeklyDay(day) ? "1" : "0");
}
return sb.toString();
}
|
java
|
public static String getDays(RecurringTask task)
{
StringBuilder sb = new StringBuilder();
for (Day day : Day.values())
{
sb.append(task.getWeeklyDay(day) ? "1" : "0");
}
return sb.toString();
}
|
[
"public",
"static",
"String",
"getDays",
"(",
"RecurringTask",
"task",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Day",
"day",
":",
"Day",
".",
"values",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"task",
".",
"getWeeklyDay",
"(",
"day",
")",
"?",
"\"1\"",
":",
"\"0\"",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Convert weekly recurrence days into a bit field.
@param task recurring task
@return bit field as a string
|
[
"Convert",
"weekly",
"recurrence",
"days",
"into",
"a",
"bit",
"field",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L202-L210
|
157,421
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDay
|
public static Day getDay(Integer day)
{
Day result = null;
if (day != null)
{
result = DAY_ARRAY[day.intValue()];
}
return (result);
}
|
java
|
public static Day getDay(Integer day)
{
Day result = null;
if (day != null)
{
result = DAY_ARRAY[day.intValue()];
}
return (result);
}
|
[
"public",
"static",
"Day",
"getDay",
"(",
"Integer",
"day",
")",
"{",
"Day",
"result",
"=",
"null",
";",
"if",
"(",
"day",
"!=",
"null",
")",
"{",
"result",
"=",
"DAY_ARRAY",
"[",
"day",
".",
"intValue",
"(",
")",
"]",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Convert MPX day index to Day instance.
@param day day index
@return Day instance
|
[
"Convert",
"MPX",
"day",
"index",
"to",
"Day",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L218-L226
|
157,422
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getDay
|
public static Integer getDay(Day day)
{
Integer result = null;
if (day != null)
{
result = DAY_MAP.get(day);
}
return (result);
}
|
java
|
public static Integer getDay(Day day)
{
Integer result = null;
if (day != null)
{
result = DAY_MAP.get(day);
}
return (result);
}
|
[
"public",
"static",
"Integer",
"getDay",
"(",
"Day",
"day",
")",
"{",
"Integer",
"result",
"=",
"null",
";",
"if",
"(",
"day",
"!=",
"null",
")",
"{",
"result",
"=",
"DAY_MAP",
".",
"get",
"(",
"day",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Convert Day instance to MPX day index.
@param day Day instance
@return day index
|
[
"Convert",
"Day",
"instance",
"to",
"MPX",
"day",
"index",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L234-L242
|
157,423
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java
|
RecurrenceUtility.getYearlyAbsoluteAsDate
|
public static Date getYearlyAbsoluteAsDate(RecurringData data)
{
Date result;
Integer yearlyAbsoluteDay = data.getDayNumber();
Integer yearlyAbsoluteMonth = data.getMonthNumber();
Date startDate = data.getStartDate();
if (yearlyAbsoluteDay == null || yearlyAbsoluteMonth == null || startDate == null)
{
result = null;
}
else
{
Calendar cal = DateHelper.popCalendar(startDate);
cal.set(Calendar.MONTH, yearlyAbsoluteMonth.intValue() - 1);
cal.set(Calendar.DAY_OF_MONTH, yearlyAbsoluteDay.intValue());
result = cal.getTime();
DateHelper.pushCalendar(cal);
}
return result;
}
|
java
|
public static Date getYearlyAbsoluteAsDate(RecurringData data)
{
Date result;
Integer yearlyAbsoluteDay = data.getDayNumber();
Integer yearlyAbsoluteMonth = data.getMonthNumber();
Date startDate = data.getStartDate();
if (yearlyAbsoluteDay == null || yearlyAbsoluteMonth == null || startDate == null)
{
result = null;
}
else
{
Calendar cal = DateHelper.popCalendar(startDate);
cal.set(Calendar.MONTH, yearlyAbsoluteMonth.intValue() - 1);
cal.set(Calendar.DAY_OF_MONTH, yearlyAbsoluteDay.intValue());
result = cal.getTime();
DateHelper.pushCalendar(cal);
}
return result;
}
|
[
"public",
"static",
"Date",
"getYearlyAbsoluteAsDate",
"(",
"RecurringData",
"data",
")",
"{",
"Date",
"result",
";",
"Integer",
"yearlyAbsoluteDay",
"=",
"data",
".",
"getDayNumber",
"(",
")",
";",
"Integer",
"yearlyAbsoluteMonth",
"=",
"data",
".",
"getMonthNumber",
"(",
")",
";",
"Date",
"startDate",
"=",
"data",
".",
"getStartDate",
"(",
")",
";",
"if",
"(",
"yearlyAbsoluteDay",
"==",
"null",
"||",
"yearlyAbsoluteMonth",
"==",
"null",
"||",
"startDate",
"==",
"null",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
"(",
"startDate",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MONTH",
",",
"yearlyAbsoluteMonth",
".",
"intValue",
"(",
")",
"-",
"1",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"DAY_OF_MONTH",
",",
"yearlyAbsoluteDay",
".",
"intValue",
"(",
")",
")",
";",
"result",
"=",
"cal",
".",
"getTime",
"(",
")",
";",
"DateHelper",
".",
"pushCalendar",
"(",
"cal",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Retrieves the yearly absolute date.
@param data recurrence data
@return yearly absolute date
|
[
"Retrieves",
"the",
"yearly",
"absolute",
"date",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RecurrenceUtility.java#L250-L270
|
157,424
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/common/AbstractIntColumn.java
|
AbstractIntColumn.readInt
|
public int readInt(int offset, byte[] data)
{
int result = 0;
int i = offset + m_offset;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
{
result |= ((data[i] & 0xff)) << shiftBy;
++i;
}
return result;
}
|
java
|
public int readInt(int offset, byte[] data)
{
int result = 0;
int i = offset + m_offset;
for (int shiftBy = 0; shiftBy < 32; shiftBy += 8)
{
result |= ((data[i] & 0xff)) << shiftBy;
++i;
}
return result;
}
|
[
"public",
"int",
"readInt",
"(",
"int",
"offset",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"result",
"=",
"0",
";",
"int",
"i",
"=",
"offset",
"+",
"m_offset",
";",
"for",
"(",
"int",
"shiftBy",
"=",
"0",
";",
"shiftBy",
"<",
"32",
";",
"shiftBy",
"+=",
"8",
")",
"{",
"result",
"|=",
"(",
"(",
"data",
"[",
"i",
"]",
"&",
"0xff",
")",
")",
"<<",
"shiftBy",
";",
"++",
"i",
";",
"}",
"return",
"result",
";",
"}"
] |
Read a four byte integer from the data.
@param offset current offset into data block
@param data data block
@return int value
|
[
"Read",
"a",
"four",
"byte",
"integer",
"from",
"the",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/AbstractIntColumn.java#L49-L59
|
157,425
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/RowHeader.java
|
RowHeader.parse
|
private void parse(String header)
{
ArrayList<String> list = new ArrayList<String>(4);
StringBuilder sb = new StringBuilder();
int index = 1;
while (index < header.length())
{
char c = header.charAt(index++);
if (Character.isDigit(c))
{
sb.append(c);
}
else
{
if (sb.length() != 0)
{
list.add(sb.toString());
sb.setLength(0);
}
}
}
if (sb.length() != 0)
{
list.add(sb.toString());
}
m_id = list.get(0);
m_sequence = Integer.parseInt(list.get(1));
m_type = Integer.valueOf(list.get(2));
if (list.size() > 3)
{
m_subtype = Integer.parseInt(list.get(3));
}
}
|
java
|
private void parse(String header)
{
ArrayList<String> list = new ArrayList<String>(4);
StringBuilder sb = new StringBuilder();
int index = 1;
while (index < header.length())
{
char c = header.charAt(index++);
if (Character.isDigit(c))
{
sb.append(c);
}
else
{
if (sb.length() != 0)
{
list.add(sb.toString());
sb.setLength(0);
}
}
}
if (sb.length() != 0)
{
list.add(sb.toString());
}
m_id = list.get(0);
m_sequence = Integer.parseInt(list.get(1));
m_type = Integer.valueOf(list.get(2));
if (list.size() > 3)
{
m_subtype = Integer.parseInt(list.get(3));
}
}
|
[
"private",
"void",
"parse",
"(",
"String",
"header",
")",
"{",
"ArrayList",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"4",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"index",
"=",
"1",
";",
"while",
"(",
"index",
"<",
"header",
".",
"length",
"(",
")",
")",
"{",
"char",
"c",
"=",
"header",
".",
"charAt",
"(",
"index",
"++",
")",
";",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"c",
")",
")",
"{",
"sb",
".",
"append",
"(",
"c",
")",
";",
"}",
"else",
"{",
"if",
"(",
"sb",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"list",
".",
"add",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"sb",
".",
"setLength",
"(",
"0",
")",
";",
"}",
"}",
"}",
"if",
"(",
"sb",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"list",
".",
"add",
"(",
"sb",
".",
"toString",
"(",
")",
")",
";",
"}",
"m_id",
"=",
"list",
".",
"get",
"(",
"0",
")",
";",
"m_sequence",
"=",
"Integer",
".",
"parseInt",
"(",
"list",
".",
"get",
"(",
"1",
")",
")",
";",
"m_type",
"=",
"Integer",
".",
"valueOf",
"(",
"list",
".",
"get",
"(",
"2",
")",
")",
";",
"if",
"(",
"list",
".",
"size",
"(",
")",
">",
"3",
")",
"{",
"m_subtype",
"=",
"Integer",
".",
"parseInt",
"(",
"list",
".",
"get",
"(",
"3",
")",
")",
";",
"}",
"}"
] |
Parses values out of the header text.
@param header header text
|
[
"Parses",
"values",
"out",
"of",
"the",
"header",
"text",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/RowHeader.java#L49-L83
|
157,426
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/CostRateTable.java
|
CostRateTable.getIndexByDate
|
public int getIndexByDate(Date date)
{
int result = -1;
int index = 0;
for (CostRateTableEntry entry : this)
{
if (DateHelper.compare(date, entry.getEndDate()) < 0)
{
result = index;
break;
}
++index;
}
return result;
}
|
java
|
public int getIndexByDate(Date date)
{
int result = -1;
int index = 0;
for (CostRateTableEntry entry : this)
{
if (DateHelper.compare(date, entry.getEndDate()) < 0)
{
result = index;
break;
}
++index;
}
return result;
}
|
[
"public",
"int",
"getIndexByDate",
"(",
"Date",
"date",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"int",
"index",
"=",
"0",
";",
"for",
"(",
"CostRateTableEntry",
"entry",
":",
"this",
")",
"{",
"if",
"(",
"DateHelper",
".",
"compare",
"(",
"date",
",",
"entry",
".",
"getEndDate",
"(",
")",
")",
"<",
"0",
")",
"{",
"result",
"=",
"index",
";",
"break",
";",
"}",
"++",
"index",
";",
"}",
"return",
"result",
";",
"}"
] |
Retrieve the index of the table entry valid for the supplied date.
@param date required date
@return cost rate table entry index
|
[
"Retrieve",
"the",
"index",
"of",
"the",
"table",
"entry",
"valid",
"for",
"the",
"supplied",
"date",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CostRateTable.java#L64-L80
|
157,427
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.getInt
|
public static final int getInt(String value)
{
return (value == null || value.length() == 0 ? 0 : Integer.parseInt(value));
}
|
java
|
public static final int getInt(String value)
{
return (value == null || value.length() == 0 ? 0 : Integer.parseInt(value));
}
|
[
"public",
"static",
"final",
"int",
"getInt",
"(",
"String",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
"?",
"0",
":",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
";",
"}"
] |
This method retrieves an int value from a String instance.
It returns zero by default if a null value or an empty string is supplied.
@param value string representation of an integer
@return int value
|
[
"This",
"method",
"retrieves",
"an",
"int",
"value",
"from",
"a",
"String",
"instance",
".",
"It",
"returns",
"zero",
"by",
"default",
"if",
"a",
"null",
"value",
"or",
"an",
"empty",
"string",
"is",
"supplied",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L53-L56
|
157,428
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.getDouble
|
public static final double getDouble(String value)
{
return (value == null || value.length() == 0 ? 0 : Double.parseDouble(value));
}
|
java
|
public static final double getDouble(String value)
{
return (value == null || value.length() == 0 ? 0 : Double.parseDouble(value));
}
|
[
"public",
"static",
"final",
"double",
"getDouble",
"(",
"String",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
"?",
"0",
":",
"Double",
".",
"parseDouble",
"(",
"value",
")",
")",
";",
"}"
] |
This method retrieves a double value from a String instance.
It returns zero by default if a null value or an empty string is supplied.
@param value string representation of a double
@return double value
|
[
"This",
"method",
"retrieves",
"a",
"double",
"value",
"from",
"a",
"String",
"instance",
".",
"It",
"returns",
"zero",
"by",
"default",
"if",
"a",
"null",
"value",
"or",
"an",
"empty",
"string",
"is",
"supplied",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L65-L68
|
157,429
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.getInteger
|
public static final Integer getInteger(Number value)
{
Integer result = null;
if (value != null)
{
if (value instanceof Integer)
{
result = (Integer) value;
}
else
{
result = Integer.valueOf((int) Math.round(value.doubleValue()));
}
}
return (result);
}
|
java
|
public static final Integer getInteger(Number value)
{
Integer result = null;
if (value != null)
{
if (value instanceof Integer)
{
result = (Integer) value;
}
else
{
result = Integer.valueOf((int) Math.round(value.doubleValue()));
}
}
return (result);
}
|
[
"public",
"static",
"final",
"Integer",
"getInteger",
"(",
"Number",
"value",
")",
"{",
"Integer",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
"instanceof",
"Integer",
")",
"{",
"result",
"=",
"(",
"Integer",
")",
"value",
";",
"}",
"else",
"{",
"result",
"=",
"Integer",
".",
"valueOf",
"(",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"value",
".",
"doubleValue",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Utility method used to convert an arbitrary Number into an Integer.
@param value Number instance
@return Integer instance
|
[
"Utility",
"method",
"used",
"to",
"convert",
"an",
"arbitrary",
"Number",
"into",
"an",
"Integer",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L76-L91
|
157,430
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.getInteger
|
public static final Integer getInteger(String value)
{
Integer result;
try
{
result = Integer.valueOf(Integer.parseInt(value));
}
catch (Exception ex)
{
result = null;
}
return (result);
}
|
java
|
public static final Integer getInteger(String value)
{
Integer result;
try
{
result = Integer.valueOf(Integer.parseInt(value));
}
catch (Exception ex)
{
result = null;
}
return (result);
}
|
[
"public",
"static",
"final",
"Integer",
"getInteger",
"(",
"String",
"value",
")",
"{",
"Integer",
"result",
";",
"try",
"{",
"result",
"=",
"Integer",
".",
"valueOf",
"(",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Converts a string representation of an integer into an Integer object.
Silently ignores any parse exceptions and returns null.
@param value String representation of an integer
@return Integer instance
|
[
"Converts",
"a",
"string",
"representation",
"of",
"an",
"integer",
"into",
"an",
"Integer",
"object",
".",
"Silently",
"ignores",
"any",
"parse",
"exceptions",
"and",
"returns",
"null",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L100-L115
|
157,431
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.getBigInteger
|
public static final BigInteger getBigInteger(Number value)
{
BigInteger result = null;
if (value != null)
{
if (value instanceof BigInteger)
{
result = (BigInteger) value;
}
else
{
result = BigInteger.valueOf(Math.round(value.doubleValue()));
}
}
return (result);
}
|
java
|
public static final BigInteger getBigInteger(Number value)
{
BigInteger result = null;
if (value != null)
{
if (value instanceof BigInteger)
{
result = (BigInteger) value;
}
else
{
result = BigInteger.valueOf(Math.round(value.doubleValue()));
}
}
return (result);
}
|
[
"public",
"static",
"final",
"BigInteger",
"getBigInteger",
"(",
"Number",
"value",
")",
"{",
"BigInteger",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"if",
"(",
"value",
"instanceof",
"BigInteger",
")",
"{",
"result",
"=",
"(",
"BigInteger",
")",
"value",
";",
"}",
"else",
"{",
"result",
"=",
"BigInteger",
".",
"valueOf",
"(",
"Math",
".",
"round",
"(",
"value",
".",
"doubleValue",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Utility method used to convert a Number into a BigInteger.
@param value Number instance
@return BigInteger instance
|
[
"Utility",
"method",
"used",
"to",
"convert",
"a",
"Number",
"into",
"a",
"BigInteger",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L123-L138
|
157,432
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.round
|
public static final double round(double value, double precision)
{
precision = Math.pow(10, precision);
return Math.round(value * precision) / precision;
}
|
java
|
public static final double round(double value, double precision)
{
precision = Math.pow(10, precision);
return Math.round(value * precision) / precision;
}
|
[
"public",
"static",
"final",
"double",
"round",
"(",
"double",
"value",
",",
"double",
"precision",
")",
"{",
"precision",
"=",
"Math",
".",
"pow",
"(",
"10",
",",
"precision",
")",
";",
"return",
"Math",
".",
"round",
"(",
"value",
"*",
"precision",
")",
"/",
"precision",
";",
"}"
] |
Utility method used to round a double to the given precision.
@param value value to truncate
@param precision Number of decimals to round to.
@return double value
|
[
"Utility",
"method",
"used",
"to",
"round",
"a",
"double",
"to",
"the",
"given",
"precision",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L180-L184
|
157,433
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.parseInteger
|
public static final Integer parseInteger(String value)
{
return (value == null || value.length() == 0 ? null : Integer.valueOf(Integer.parseInt(value)));
}
|
java
|
public static final Integer parseInteger(String value)
{
return (value == null || value.length() == 0 ? null : Integer.valueOf(Integer.parseInt(value)));
}
|
[
"public",
"static",
"final",
"Integer",
"parseInteger",
"(",
"String",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"||",
"value",
".",
"length",
"(",
")",
"==",
"0",
"?",
"null",
":",
"Integer",
".",
"valueOf",
"(",
"Integer",
".",
"parseInt",
"(",
"value",
")",
")",
")",
";",
"}"
] |
Utility method to convert a String to an Integer, and
handles null values.
@param value string representation of an integer
@return int value
|
[
"Utility",
"method",
"to",
"convert",
"a",
"String",
"to",
"an",
"Integer",
"and",
"handles",
"null",
"values",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L193-L196
|
157,434
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/NumberHelper.java
|
NumberHelper.compare
|
public static int compare(Integer n1, Integer n2)
{
int result;
if (n1 == null || n2 == null)
{
result = (n1 == null && n2 == null ? 0 : (n1 == null ? 1 : -1));
}
else
{
result = n1.compareTo(n2);
}
return (result);
}
|
java
|
public static int compare(Integer n1, Integer n2)
{
int result;
if (n1 == null || n2 == null)
{
result = (n1 == null && n2 == null ? 0 : (n1 == null ? 1 : -1));
}
else
{
result = n1.compareTo(n2);
}
return (result);
}
|
[
"public",
"static",
"int",
"compare",
"(",
"Integer",
"n1",
",",
"Integer",
"n2",
")",
"{",
"int",
"result",
";",
"if",
"(",
"n1",
"==",
"null",
"||",
"n2",
"==",
"null",
")",
"{",
"result",
"=",
"(",
"n1",
"==",
"null",
"&&",
"n2",
"==",
"null",
"?",
"0",
":",
"(",
"n1",
"==",
"null",
"?",
"1",
":",
"-",
"1",
")",
")",
";",
"}",
"else",
"{",
"result",
"=",
"n1",
".",
"compareTo",
"(",
"n2",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Compare two integers, accounting for null values.
@param n1 integer value
@param n2 integer value
@return comparison result
|
[
"Compare",
"two",
"integers",
"accounting",
"for",
"null",
"values",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/NumberHelper.java#L237-L249
|
157,435
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpd/MapRow.java
|
MapRow.getObject
|
private final Object getObject(String name)
{
if (m_map.containsKey(name) == false)
{
throw new IllegalArgumentException("Invalid column name " + name);
}
Object result = m_map.get(name);
return (result);
}
|
java
|
private final Object getObject(String name)
{
if (m_map.containsKey(name) == false)
{
throw new IllegalArgumentException("Invalid column name " + name);
}
Object result = m_map.get(name);
return (result);
}
|
[
"private",
"final",
"Object",
"getObject",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"m_map",
".",
"containsKey",
"(",
"name",
")",
"==",
"false",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid column name \"",
"+",
"name",
")",
";",
"}",
"Object",
"result",
"=",
"m_map",
".",
"get",
"(",
"name",
")",
";",
"return",
"(",
"result",
")",
";",
"}"
] |
Retrieve a value from the map, ensuring that a key exists in the map
with the specified name.
@param name column name
@return column value
|
[
"Retrieve",
"a",
"value",
"from",
"the",
"map",
"ensuring",
"that",
"a",
"key",
"exists",
"in",
"the",
"map",
"with",
"the",
"specified",
"name",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MapRow.java#L164-L174
|
157,436
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/Tokenizer.java
|
Tokenizer.nextToken
|
public int nextToken() throws IOException
{
int c;
int nextc = -1;
boolean quoted = false;
int result = m_next;
if (m_next != 0)
{
m_next = 0;
}
m_buffer.setLength(0);
while (result == 0)
{
if (nextc != -1)
{
c = nextc;
nextc = -1;
}
else
{
c = read();
}
switch (c)
{
case TT_EOF:
{
if (m_buffer.length() != 0)
{
result = TT_WORD;
m_next = TT_EOF;
}
else
{
result = TT_EOF;
}
break;
}
case TT_EOL:
{
int length = m_buffer.length();
if (length != 0 && m_buffer.charAt(length - 1) == '\r')
{
--length;
m_buffer.setLength(length);
}
if (length == 0)
{
result = TT_EOL;
}
else
{
result = TT_WORD;
m_next = TT_EOL;
}
break;
}
default:
{
if (c == m_quote)
{
if (quoted == false && startQuotedIsValid(m_buffer))
{
quoted = true;
}
else
{
if (quoted == false)
{
m_buffer.append((char) c);
}
else
{
nextc = read();
if (nextc == m_quote)
{
m_buffer.append((char) c);
nextc = -1;
}
else
{
quoted = false;
}
}
}
}
else
{
if (c == m_delimiter && quoted == false)
{
result = TT_WORD;
}
else
{
m_buffer.append((char) c);
}
}
}
}
}
m_type = result;
return (result);
}
|
java
|
public int nextToken() throws IOException
{
int c;
int nextc = -1;
boolean quoted = false;
int result = m_next;
if (m_next != 0)
{
m_next = 0;
}
m_buffer.setLength(0);
while (result == 0)
{
if (nextc != -1)
{
c = nextc;
nextc = -1;
}
else
{
c = read();
}
switch (c)
{
case TT_EOF:
{
if (m_buffer.length() != 0)
{
result = TT_WORD;
m_next = TT_EOF;
}
else
{
result = TT_EOF;
}
break;
}
case TT_EOL:
{
int length = m_buffer.length();
if (length != 0 && m_buffer.charAt(length - 1) == '\r')
{
--length;
m_buffer.setLength(length);
}
if (length == 0)
{
result = TT_EOL;
}
else
{
result = TT_WORD;
m_next = TT_EOL;
}
break;
}
default:
{
if (c == m_quote)
{
if (quoted == false && startQuotedIsValid(m_buffer))
{
quoted = true;
}
else
{
if (quoted == false)
{
m_buffer.append((char) c);
}
else
{
nextc = read();
if (nextc == m_quote)
{
m_buffer.append((char) c);
nextc = -1;
}
else
{
quoted = false;
}
}
}
}
else
{
if (c == m_delimiter && quoted == false)
{
result = TT_WORD;
}
else
{
m_buffer.append((char) c);
}
}
}
}
}
m_type = result;
return (result);
}
|
[
"public",
"int",
"nextToken",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
";",
"int",
"nextc",
"=",
"-",
"1",
";",
"boolean",
"quoted",
"=",
"false",
";",
"int",
"result",
"=",
"m_next",
";",
"if",
"(",
"m_next",
"!=",
"0",
")",
"{",
"m_next",
"=",
"0",
";",
"}",
"m_buffer",
".",
"setLength",
"(",
"0",
")",
";",
"while",
"(",
"result",
"==",
"0",
")",
"{",
"if",
"(",
"nextc",
"!=",
"-",
"1",
")",
"{",
"c",
"=",
"nextc",
";",
"nextc",
"=",
"-",
"1",
";",
"}",
"else",
"{",
"c",
"=",
"read",
"(",
")",
";",
"}",
"switch",
"(",
"c",
")",
"{",
"case",
"TT_EOF",
":",
"{",
"if",
"(",
"m_buffer",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"result",
"=",
"TT_WORD",
";",
"m_next",
"=",
"TT_EOF",
";",
"}",
"else",
"{",
"result",
"=",
"TT_EOF",
";",
"}",
"break",
";",
"}",
"case",
"TT_EOL",
":",
"{",
"int",
"length",
"=",
"m_buffer",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
"!=",
"0",
"&&",
"m_buffer",
".",
"charAt",
"(",
"length",
"-",
"1",
")",
"==",
"'",
"'",
")",
"{",
"--",
"length",
";",
"m_buffer",
".",
"setLength",
"(",
"length",
")",
";",
"}",
"if",
"(",
"length",
"==",
"0",
")",
"{",
"result",
"=",
"TT_EOL",
";",
"}",
"else",
"{",
"result",
"=",
"TT_WORD",
";",
"m_next",
"=",
"TT_EOL",
";",
"}",
"break",
";",
"}",
"default",
":",
"{",
"if",
"(",
"c",
"==",
"m_quote",
")",
"{",
"if",
"(",
"quoted",
"==",
"false",
"&&",
"startQuotedIsValid",
"(",
"m_buffer",
")",
")",
"{",
"quoted",
"=",
"true",
";",
"}",
"else",
"{",
"if",
"(",
"quoted",
"==",
"false",
")",
"{",
"m_buffer",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"}",
"else",
"{",
"nextc",
"=",
"read",
"(",
")",
";",
"if",
"(",
"nextc",
"==",
"m_quote",
")",
"{",
"m_buffer",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"nextc",
"=",
"-",
"1",
";",
"}",
"else",
"{",
"quoted",
"=",
"false",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"c",
"==",
"m_delimiter",
"&&",
"quoted",
"==",
"false",
")",
"{",
"result",
"=",
"TT_WORD",
";",
"}",
"else",
"{",
"m_buffer",
".",
"append",
"(",
"(",
"char",
")",
"c",
")",
";",
"}",
"}",
"}",
"}",
"}",
"m_type",
"=",
"result",
";",
"return",
"(",
"result",
")",
";",
"}"
] |
This method retrieves the next token and returns a constant representing
the type of token found.
@return token type value
|
[
"This",
"method",
"retrieves",
"the",
"next",
"token",
"and",
"returns",
"a",
"constant",
"representing",
"the",
"type",
"of",
"token",
"found",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/Tokenizer.java#L51-L162
|
157,437
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.addWorkgroupAssignment
|
public ResourceAssignmentWorkgroupFields addWorkgroupAssignment() throws MPXJException
{
if (m_workgroup != null)
{
throw new MPXJException(MPXJException.MAXIMUM_RECORDS);
}
m_workgroup = new ResourceAssignmentWorkgroupFields();
return (m_workgroup);
}
|
java
|
public ResourceAssignmentWorkgroupFields addWorkgroupAssignment() throws MPXJException
{
if (m_workgroup != null)
{
throw new MPXJException(MPXJException.MAXIMUM_RECORDS);
}
m_workgroup = new ResourceAssignmentWorkgroupFields();
return (m_workgroup);
}
|
[
"public",
"ResourceAssignmentWorkgroupFields",
"addWorkgroupAssignment",
"(",
")",
"throws",
"MPXJException",
"{",
"if",
"(",
"m_workgroup",
"!=",
"null",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"MAXIMUM_RECORDS",
")",
";",
"}",
"m_workgroup",
"=",
"new",
"ResourceAssignmentWorkgroupFields",
"(",
")",
";",
"return",
"(",
"m_workgroup",
")",
";",
"}"
] |
This method allows a resource assignment workgroup fields record
to be added to the current resource assignment. A maximum of
one of these records can be added to a resource assignment record.
@return ResourceAssignmentWorkgroupFields object
@throws MPXJException if MSP defined limit of 1 is exceeded
|
[
"This",
"method",
"allows",
"a",
"resource",
"assignment",
"workgroup",
"fields",
"record",
"to",
"be",
"added",
"to",
"the",
"current",
"resource",
"assignment",
".",
"A",
"maximum",
"of",
"one",
"of",
"these",
"records",
"can",
"be",
"added",
"to",
"a",
"resource",
"assignment",
"record",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L71-L81
|
157,438
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getStart
|
public Date getStart()
{
Date result = (Date) getCachedValue(AssignmentField.START);
if (result == null)
{
result = getTask().getStart();
}
return result;
}
|
java
|
public Date getStart()
{
Date result = (Date) getCachedValue(AssignmentField.START);
if (result == null)
{
result = getTask().getStart();
}
return result;
}
|
[
"public",
"Date",
"getStart",
"(",
")",
"{",
"Date",
"result",
"=",
"(",
"Date",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"START",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getTask",
"(",
")",
".",
"getStart",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns the start of this resource assignment.
@return start date
|
[
"Returns",
"the",
"start",
"of",
"this",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L348-L356
|
157,439
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getFinish
|
public Date getFinish()
{
Date result = (Date) getCachedValue(AssignmentField.FINISH);
if (result == null)
{
result = getTask().getFinish();
}
return result;
}
|
java
|
public Date getFinish()
{
Date result = (Date) getCachedValue(AssignmentField.FINISH);
if (result == null)
{
result = getTask().getFinish();
}
return result;
}
|
[
"public",
"Date",
"getFinish",
"(",
")",
"{",
"Date",
"result",
"=",
"(",
"Date",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"FINISH",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getTask",
"(",
")",
".",
"getFinish",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Returns the finish date for this resource assignment.
@return finish date
|
[
"Returns",
"the",
"finish",
"date",
"for",
"this",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L373-L381
|
157,440
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedOvertimeWork
|
public List<TimephasedWork> getTimephasedOvertimeWork()
{
if (m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork() != null)
{
double perDayFactor = getRemainingOvertimeWork().getDuration() / (getRemainingWork().getDuration() - getRemainingOvertimeWork().getDuration());
double totalFactor = getRemainingOvertimeWork().getDuration() / getRemainingWork().getDuration();
perDayFactor = Double.isNaN(perDayFactor) ? 0 : perDayFactor;
totalFactor = Double.isNaN(totalFactor) ? 0 : totalFactor;
m_timephasedOvertimeWork = new DefaultTimephasedWorkContainer(m_timephasedWork, perDayFactor, totalFactor);
}
return m_timephasedOvertimeWork == null ? null : m_timephasedOvertimeWork.getData();
}
|
java
|
public List<TimephasedWork> getTimephasedOvertimeWork()
{
if (m_timephasedOvertimeWork == null && m_timephasedWork != null && getOvertimeWork() != null)
{
double perDayFactor = getRemainingOvertimeWork().getDuration() / (getRemainingWork().getDuration() - getRemainingOvertimeWork().getDuration());
double totalFactor = getRemainingOvertimeWork().getDuration() / getRemainingWork().getDuration();
perDayFactor = Double.isNaN(perDayFactor) ? 0 : perDayFactor;
totalFactor = Double.isNaN(totalFactor) ? 0 : totalFactor;
m_timephasedOvertimeWork = new DefaultTimephasedWorkContainer(m_timephasedWork, perDayFactor, totalFactor);
}
return m_timephasedOvertimeWork == null ? null : m_timephasedOvertimeWork.getData();
}
|
[
"public",
"List",
"<",
"TimephasedWork",
">",
"getTimephasedOvertimeWork",
"(",
")",
"{",
"if",
"(",
"m_timephasedOvertimeWork",
"==",
"null",
"&&",
"m_timephasedWork",
"!=",
"null",
"&&",
"getOvertimeWork",
"(",
")",
"!=",
"null",
")",
"{",
"double",
"perDayFactor",
"=",
"getRemainingOvertimeWork",
"(",
")",
".",
"getDuration",
"(",
")",
"/",
"(",
"getRemainingWork",
"(",
")",
".",
"getDuration",
"(",
")",
"-",
"getRemainingOvertimeWork",
"(",
")",
".",
"getDuration",
"(",
")",
")",
";",
"double",
"totalFactor",
"=",
"getRemainingOvertimeWork",
"(",
")",
".",
"getDuration",
"(",
")",
"/",
"getRemainingWork",
"(",
")",
".",
"getDuration",
"(",
")",
";",
"perDayFactor",
"=",
"Double",
".",
"isNaN",
"(",
"perDayFactor",
")",
"?",
"0",
":",
"perDayFactor",
";",
"totalFactor",
"=",
"Double",
".",
"isNaN",
"(",
"totalFactor",
")",
"?",
"0",
":",
"totalFactor",
";",
"m_timephasedOvertimeWork",
"=",
"new",
"DefaultTimephasedWorkContainer",
"(",
"m_timephasedWork",
",",
"perDayFactor",
",",
"totalFactor",
")",
";",
"}",
"return",
"m_timephasedOvertimeWork",
"==",
"null",
"?",
"null",
":",
"m_timephasedOvertimeWork",
".",
"getData",
"(",
")",
";",
"}"
] |
Retrieves the timephased breakdown of the planned overtime work for this
resource assignment.
@return timephased planned work
|
[
"Retrieves",
"the",
"timephased",
"breakdown",
"of",
"the",
"planned",
"overtime",
"work",
"for",
"this",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L587-L600
|
157,441
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedCost
|
public List<TimephasedCost> getTimephasedCost()
{
if (m_timephasedCost == null)
{
Resource r = getResource();
ResourceType type = r != null ? r.getType() : ResourceType.WORK;
//for Work and Material resources, we will calculate in the normal way
if (type != ResourceType.COST)
{
if (m_timephasedWork != null && m_timephasedWork.hasData())
{
if (hasMultipleCostRates())
{
m_timephasedCost = getTimephasedCostMultipleRates(getTimephasedWork(), getTimephasedOvertimeWork());
}
else
{
m_timephasedCost = getTimephasedCostSingleRate(getTimephasedWork(), getTimephasedOvertimeWork());
}
}
}
else
{
m_timephasedCost = getTimephasedCostFixedAmount();
}
}
return m_timephasedCost;
}
|
java
|
public List<TimephasedCost> getTimephasedCost()
{
if (m_timephasedCost == null)
{
Resource r = getResource();
ResourceType type = r != null ? r.getType() : ResourceType.WORK;
//for Work and Material resources, we will calculate in the normal way
if (type != ResourceType.COST)
{
if (m_timephasedWork != null && m_timephasedWork.hasData())
{
if (hasMultipleCostRates())
{
m_timephasedCost = getTimephasedCostMultipleRates(getTimephasedWork(), getTimephasedOvertimeWork());
}
else
{
m_timephasedCost = getTimephasedCostSingleRate(getTimephasedWork(), getTimephasedOvertimeWork());
}
}
}
else
{
m_timephasedCost = getTimephasedCostFixedAmount();
}
}
return m_timephasedCost;
}
|
[
"public",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedCost",
"(",
")",
"{",
"if",
"(",
"m_timephasedCost",
"==",
"null",
")",
"{",
"Resource",
"r",
"=",
"getResource",
"(",
")",
";",
"ResourceType",
"type",
"=",
"r",
"!=",
"null",
"?",
"r",
".",
"getType",
"(",
")",
":",
"ResourceType",
".",
"WORK",
";",
"//for Work and Material resources, we will calculate in the normal way",
"if",
"(",
"type",
"!=",
"ResourceType",
".",
"COST",
")",
"{",
"if",
"(",
"m_timephasedWork",
"!=",
"null",
"&&",
"m_timephasedWork",
".",
"hasData",
"(",
")",
")",
"{",
"if",
"(",
"hasMultipleCostRates",
"(",
")",
")",
"{",
"m_timephasedCost",
"=",
"getTimephasedCostMultipleRates",
"(",
"getTimephasedWork",
"(",
")",
",",
"getTimephasedOvertimeWork",
"(",
")",
")",
";",
"}",
"else",
"{",
"m_timephasedCost",
"=",
"getTimephasedCostSingleRate",
"(",
"getTimephasedWork",
"(",
")",
",",
"getTimephasedOvertimeWork",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"m_timephasedCost",
"=",
"getTimephasedCostFixedAmount",
"(",
")",
";",
"}",
"}",
"return",
"m_timephasedCost",
";",
"}"
] |
Retrieves the timephased breakdown of cost.
@return timephased cost
|
[
"Retrieves",
"the",
"timephased",
"breakdown",
"of",
"cost",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L629-L658
|
157,442
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedActualCost
|
public List<TimephasedCost> getTimephasedActualCost()
{
if (m_timephasedActualCost == null)
{
Resource r = getResource();
ResourceType type = r != null ? r.getType() : ResourceType.WORK;
//for Work and Material resources, we will calculate in the normal way
if (type != ResourceType.COST)
{
if (m_timephasedActualWork != null && m_timephasedActualWork.hasData())
{
if (hasMultipleCostRates())
{
m_timephasedActualCost = getTimephasedCostMultipleRates(getTimephasedActualWork(), getTimephasedActualOvertimeWork());
}
else
{
m_timephasedActualCost = getTimephasedCostSingleRate(getTimephasedActualWork(), getTimephasedActualOvertimeWork());
}
}
}
else
{
m_timephasedActualCost = getTimephasedActualCostFixedAmount();
}
}
return m_timephasedActualCost;
}
|
java
|
public List<TimephasedCost> getTimephasedActualCost()
{
if (m_timephasedActualCost == null)
{
Resource r = getResource();
ResourceType type = r != null ? r.getType() : ResourceType.WORK;
//for Work and Material resources, we will calculate in the normal way
if (type != ResourceType.COST)
{
if (m_timephasedActualWork != null && m_timephasedActualWork.hasData())
{
if (hasMultipleCostRates())
{
m_timephasedActualCost = getTimephasedCostMultipleRates(getTimephasedActualWork(), getTimephasedActualOvertimeWork());
}
else
{
m_timephasedActualCost = getTimephasedCostSingleRate(getTimephasedActualWork(), getTimephasedActualOvertimeWork());
}
}
}
else
{
m_timephasedActualCost = getTimephasedActualCostFixedAmount();
}
}
return m_timephasedActualCost;
}
|
[
"public",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedActualCost",
"(",
")",
"{",
"if",
"(",
"m_timephasedActualCost",
"==",
"null",
")",
"{",
"Resource",
"r",
"=",
"getResource",
"(",
")",
";",
"ResourceType",
"type",
"=",
"r",
"!=",
"null",
"?",
"r",
".",
"getType",
"(",
")",
":",
"ResourceType",
".",
"WORK",
";",
"//for Work and Material resources, we will calculate in the normal way",
"if",
"(",
"type",
"!=",
"ResourceType",
".",
"COST",
")",
"{",
"if",
"(",
"m_timephasedActualWork",
"!=",
"null",
"&&",
"m_timephasedActualWork",
".",
"hasData",
"(",
")",
")",
"{",
"if",
"(",
"hasMultipleCostRates",
"(",
")",
")",
"{",
"m_timephasedActualCost",
"=",
"getTimephasedCostMultipleRates",
"(",
"getTimephasedActualWork",
"(",
")",
",",
"getTimephasedActualOvertimeWork",
"(",
")",
")",
";",
"}",
"else",
"{",
"m_timephasedActualCost",
"=",
"getTimephasedCostSingleRate",
"(",
"getTimephasedActualWork",
"(",
")",
",",
"getTimephasedActualOvertimeWork",
"(",
")",
")",
";",
"}",
"}",
"}",
"else",
"{",
"m_timephasedActualCost",
"=",
"getTimephasedActualCostFixedAmount",
"(",
")",
";",
"}",
"}",
"return",
"m_timephasedActualCost",
";",
"}"
] |
Retrieves the timephased breakdown of actual cost.
@return timephased actual cost
|
[
"Retrieves",
"the",
"timephased",
"breakdown",
"of",
"actual",
"cost",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L665-L695
|
157,443
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedCostMultipleRates
|
private List<TimephasedCost> getTimephasedCostMultipleRates(List<TimephasedWork> standardWorkList, List<TimephasedWork> overtimeWorkList)
{
List<TimephasedWork> standardWorkResult = new LinkedList<TimephasedWork>();
List<TimephasedWork> overtimeWorkResult = new LinkedList<TimephasedWork>();
CostRateTable table = getCostRateTable();
ProjectCalendar calendar = getCalendar();
Iterator<TimephasedWork> iter = overtimeWorkList.iterator();
for (TimephasedWork standardWork : standardWorkList)
{
TimephasedWork overtimeWork = iter.hasNext() ? iter.next() : null;
int startIndex = getCostRateTableEntryIndex(standardWork.getStart());
int finishIndex = getCostRateTableEntryIndex(standardWork.getFinish());
if (startIndex == finishIndex)
{
standardWorkResult.add(standardWork);
if (overtimeWork != null)
{
overtimeWorkResult.add(overtimeWork);
}
}
else
{
standardWorkResult.addAll(splitWork(table, calendar, standardWork, startIndex));
if (overtimeWork != null)
{
overtimeWorkResult.addAll(splitWork(table, calendar, overtimeWork, startIndex));
}
}
}
return getTimephasedCostSingleRate(standardWorkResult, overtimeWorkResult);
}
|
java
|
private List<TimephasedCost> getTimephasedCostMultipleRates(List<TimephasedWork> standardWorkList, List<TimephasedWork> overtimeWorkList)
{
List<TimephasedWork> standardWorkResult = new LinkedList<TimephasedWork>();
List<TimephasedWork> overtimeWorkResult = new LinkedList<TimephasedWork>();
CostRateTable table = getCostRateTable();
ProjectCalendar calendar = getCalendar();
Iterator<TimephasedWork> iter = overtimeWorkList.iterator();
for (TimephasedWork standardWork : standardWorkList)
{
TimephasedWork overtimeWork = iter.hasNext() ? iter.next() : null;
int startIndex = getCostRateTableEntryIndex(standardWork.getStart());
int finishIndex = getCostRateTableEntryIndex(standardWork.getFinish());
if (startIndex == finishIndex)
{
standardWorkResult.add(standardWork);
if (overtimeWork != null)
{
overtimeWorkResult.add(overtimeWork);
}
}
else
{
standardWorkResult.addAll(splitWork(table, calendar, standardWork, startIndex));
if (overtimeWork != null)
{
overtimeWorkResult.addAll(splitWork(table, calendar, overtimeWork, startIndex));
}
}
}
return getTimephasedCostSingleRate(standardWorkResult, overtimeWorkResult);
}
|
[
"private",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedCostMultipleRates",
"(",
"List",
"<",
"TimephasedWork",
">",
"standardWorkList",
",",
"List",
"<",
"TimephasedWork",
">",
"overtimeWorkList",
")",
"{",
"List",
"<",
"TimephasedWork",
">",
"standardWorkResult",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"List",
"<",
"TimephasedWork",
">",
"overtimeWorkResult",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"CostRateTable",
"table",
"=",
"getCostRateTable",
"(",
")",
";",
"ProjectCalendar",
"calendar",
"=",
"getCalendar",
"(",
")",
";",
"Iterator",
"<",
"TimephasedWork",
">",
"iter",
"=",
"overtimeWorkList",
".",
"iterator",
"(",
")",
";",
"for",
"(",
"TimephasedWork",
"standardWork",
":",
"standardWorkList",
")",
"{",
"TimephasedWork",
"overtimeWork",
"=",
"iter",
".",
"hasNext",
"(",
")",
"?",
"iter",
".",
"next",
"(",
")",
":",
"null",
";",
"int",
"startIndex",
"=",
"getCostRateTableEntryIndex",
"(",
"standardWork",
".",
"getStart",
"(",
")",
")",
";",
"int",
"finishIndex",
"=",
"getCostRateTableEntryIndex",
"(",
"standardWork",
".",
"getFinish",
"(",
")",
")",
";",
"if",
"(",
"startIndex",
"==",
"finishIndex",
")",
"{",
"standardWorkResult",
".",
"add",
"(",
"standardWork",
")",
";",
"if",
"(",
"overtimeWork",
"!=",
"null",
")",
"{",
"overtimeWorkResult",
".",
"add",
"(",
"overtimeWork",
")",
";",
"}",
"}",
"else",
"{",
"standardWorkResult",
".",
"addAll",
"(",
"splitWork",
"(",
"table",
",",
"calendar",
",",
"standardWork",
",",
"startIndex",
")",
")",
";",
"if",
"(",
"overtimeWork",
"!=",
"null",
")",
"{",
"overtimeWorkResult",
".",
"addAll",
"(",
"splitWork",
"(",
"table",
",",
"calendar",
",",
"overtimeWork",
",",
"startIndex",
")",
")",
";",
"}",
"}",
"}",
"return",
"getTimephasedCostSingleRate",
"(",
"standardWorkResult",
",",
"overtimeWorkResult",
")",
";",
"}"
] |
Generates timephased costs from timephased work where multiple cost rates
apply to the assignment.
@param standardWorkList timephased work
@param overtimeWorkList timephased work
@return timephased cost
|
[
"Generates",
"timephased",
"costs",
"from",
"timephased",
"work",
"where",
"multiple",
"cost",
"rates",
"apply",
"to",
"the",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L805-L839
|
157,444
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedCostFixedAmount
|
private List<TimephasedCost> getTimephasedCostFixedAmount()
{
List<TimephasedCost> result = new LinkedList<TimephasedCost>();
ProjectCalendar cal = getCalendar();
double remainingCost = getRemainingCost().doubleValue();
if (remainingCost > 0)
{
AccrueType accrueAt = getResource().getAccrueAt();
if (accrueAt == AccrueType.START)
{
result.add(splitCostStart(cal, remainingCost, getStart()));
}
else
if (accrueAt == AccrueType.END)
{
result.add(splitCostEnd(cal, remainingCost, getFinish()));
}
else
{
//for prorated, we have to deal with it differently depending on whether or not
//any actual has been entered, since we want to mimic the other timephased data
//where planned and actual values do not overlap
double numWorkingDays = cal.getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();
double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;
if (getActualCost().intValue() > 0)
{
//need to get three possible blocks of data: one for the possible partial amount
//overlap with timephased actual cost; one with all the standard amount days
//that happen after the actual cost stops; and one with any remaining
//partial day cost amount
int numActualDaysUsed = (int) Math.ceil(getActualCost().doubleValue() / standardAmountPerDay);
Date actualWorkFinish = cal.getDate(getStart(), Duration.getInstance(numActualDaysUsed, TimeUnit.DAYS), false);
double partialDayActualAmount = getActualCost().doubleValue() % standardAmountPerDay;
if (partialDayActualAmount > 0)
{
double dayAmount = standardAmountPerDay < remainingCost ? standardAmountPerDay - partialDayActualAmount : remainingCost;
result.add(splitCostEnd(cal, dayAmount, actualWorkFinish));
remainingCost -= dayAmount;
}
//see if there's anything left to work with
if (remainingCost > 0)
{
//have to split up the amount into standard prorated amount days and whatever is left
result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, cal.getNextWorkStart(actualWorkFinish)));
}
}
else
{
//no actual cost to worry about, so just a standard split from the beginning of the assignment
result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, getStart()));
}
}
}
return result;
}
|
java
|
private List<TimephasedCost> getTimephasedCostFixedAmount()
{
List<TimephasedCost> result = new LinkedList<TimephasedCost>();
ProjectCalendar cal = getCalendar();
double remainingCost = getRemainingCost().doubleValue();
if (remainingCost > 0)
{
AccrueType accrueAt = getResource().getAccrueAt();
if (accrueAt == AccrueType.START)
{
result.add(splitCostStart(cal, remainingCost, getStart()));
}
else
if (accrueAt == AccrueType.END)
{
result.add(splitCostEnd(cal, remainingCost, getFinish()));
}
else
{
//for prorated, we have to deal with it differently depending on whether or not
//any actual has been entered, since we want to mimic the other timephased data
//where planned and actual values do not overlap
double numWorkingDays = cal.getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();
double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;
if (getActualCost().intValue() > 0)
{
//need to get three possible blocks of data: one for the possible partial amount
//overlap with timephased actual cost; one with all the standard amount days
//that happen after the actual cost stops; and one with any remaining
//partial day cost amount
int numActualDaysUsed = (int) Math.ceil(getActualCost().doubleValue() / standardAmountPerDay);
Date actualWorkFinish = cal.getDate(getStart(), Duration.getInstance(numActualDaysUsed, TimeUnit.DAYS), false);
double partialDayActualAmount = getActualCost().doubleValue() % standardAmountPerDay;
if (partialDayActualAmount > 0)
{
double dayAmount = standardAmountPerDay < remainingCost ? standardAmountPerDay - partialDayActualAmount : remainingCost;
result.add(splitCostEnd(cal, dayAmount, actualWorkFinish));
remainingCost -= dayAmount;
}
//see if there's anything left to work with
if (remainingCost > 0)
{
//have to split up the amount into standard prorated amount days and whatever is left
result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, cal.getNextWorkStart(actualWorkFinish)));
}
}
else
{
//no actual cost to worry about, so just a standard split from the beginning of the assignment
result.addAll(splitCostProrated(cal, remainingCost, standardAmountPerDay, getStart()));
}
}
}
return result;
}
|
[
"private",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedCostFixedAmount",
"(",
")",
"{",
"List",
"<",
"TimephasedCost",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedCost",
">",
"(",
")",
";",
"ProjectCalendar",
"cal",
"=",
"getCalendar",
"(",
")",
";",
"double",
"remainingCost",
"=",
"getRemainingCost",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"remainingCost",
">",
"0",
")",
"{",
"AccrueType",
"accrueAt",
"=",
"getResource",
"(",
")",
".",
"getAccrueAt",
"(",
")",
";",
"if",
"(",
"accrueAt",
"==",
"AccrueType",
".",
"START",
")",
"{",
"result",
".",
"add",
"(",
"splitCostStart",
"(",
"cal",
",",
"remainingCost",
",",
"getStart",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"accrueAt",
"==",
"AccrueType",
".",
"END",
")",
"{",
"result",
".",
"add",
"(",
"splitCostEnd",
"(",
"cal",
",",
"remainingCost",
",",
"getFinish",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"//for prorated, we have to deal with it differently depending on whether or not",
"//any actual has been entered, since we want to mimic the other timephased data",
"//where planned and actual values do not overlap",
"double",
"numWorkingDays",
"=",
"cal",
".",
"getWork",
"(",
"getStart",
"(",
")",
",",
"getFinish",
"(",
")",
",",
"TimeUnit",
".",
"DAYS",
")",
".",
"getDuration",
"(",
")",
";",
"double",
"standardAmountPerDay",
"=",
"getCost",
"(",
")",
".",
"doubleValue",
"(",
")",
"/",
"numWorkingDays",
";",
"if",
"(",
"getActualCost",
"(",
")",
".",
"intValue",
"(",
")",
">",
"0",
")",
"{",
"//need to get three possible blocks of data: one for the possible partial amount",
"//overlap with timephased actual cost; one with all the standard amount days",
"//that happen after the actual cost stops; and one with any remaining",
"//partial day cost amount",
"int",
"numActualDaysUsed",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"getActualCost",
"(",
")",
".",
"doubleValue",
"(",
")",
"/",
"standardAmountPerDay",
")",
";",
"Date",
"actualWorkFinish",
"=",
"cal",
".",
"getDate",
"(",
"getStart",
"(",
")",
",",
"Duration",
".",
"getInstance",
"(",
"numActualDaysUsed",
",",
"TimeUnit",
".",
"DAYS",
")",
",",
"false",
")",
";",
"double",
"partialDayActualAmount",
"=",
"getActualCost",
"(",
")",
".",
"doubleValue",
"(",
")",
"%",
"standardAmountPerDay",
";",
"if",
"(",
"partialDayActualAmount",
">",
"0",
")",
"{",
"double",
"dayAmount",
"=",
"standardAmountPerDay",
"<",
"remainingCost",
"?",
"standardAmountPerDay",
"-",
"partialDayActualAmount",
":",
"remainingCost",
";",
"result",
".",
"add",
"(",
"splitCostEnd",
"(",
"cal",
",",
"dayAmount",
",",
"actualWorkFinish",
")",
")",
";",
"remainingCost",
"-=",
"dayAmount",
";",
"}",
"//see if there's anything left to work with",
"if",
"(",
"remainingCost",
">",
"0",
")",
"{",
"//have to split up the amount into standard prorated amount days and whatever is left",
"result",
".",
"addAll",
"(",
"splitCostProrated",
"(",
"cal",
",",
"remainingCost",
",",
"standardAmountPerDay",
",",
"cal",
".",
"getNextWorkStart",
"(",
"actualWorkFinish",
")",
")",
")",
";",
"}",
"}",
"else",
"{",
"//no actual cost to worry about, so just a standard split from the beginning of the assignment",
"result",
".",
"addAll",
"(",
"splitCostProrated",
"(",
"cal",
",",
"remainingCost",
",",
"standardAmountPerDay",
",",
"getStart",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Generates timephased costs from the assignment's cost value. Used for Cost type Resources.
@return timephased cost
|
[
"Generates",
"timephased",
"costs",
"from",
"the",
"assignment",
"s",
"cost",
"value",
".",
"Used",
"for",
"Cost",
"type",
"Resources",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L846-L913
|
157,445
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedActualCostFixedAmount
|
private List<TimephasedCost> getTimephasedActualCostFixedAmount()
{
List<TimephasedCost> result = new LinkedList<TimephasedCost>();
double actualCost = getActualCost().doubleValue();
if (actualCost > 0)
{
AccrueType accrueAt = getResource().getAccrueAt();
if (accrueAt == AccrueType.START)
{
result.add(splitCostStart(getCalendar(), actualCost, getActualStart()));
}
else
if (accrueAt == AccrueType.END)
{
result.add(splitCostEnd(getCalendar(), actualCost, getActualFinish()));
}
else
{
//for prorated, we have to deal with it differently; have to 'fill up' each
//day with the standard amount before going to the next one
double numWorkingDays = getCalendar().getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();
double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;
result.addAll(splitCostProrated(getCalendar(), actualCost, standardAmountPerDay, getActualStart()));
}
}
return result;
}
|
java
|
private List<TimephasedCost> getTimephasedActualCostFixedAmount()
{
List<TimephasedCost> result = new LinkedList<TimephasedCost>();
double actualCost = getActualCost().doubleValue();
if (actualCost > 0)
{
AccrueType accrueAt = getResource().getAccrueAt();
if (accrueAt == AccrueType.START)
{
result.add(splitCostStart(getCalendar(), actualCost, getActualStart()));
}
else
if (accrueAt == AccrueType.END)
{
result.add(splitCostEnd(getCalendar(), actualCost, getActualFinish()));
}
else
{
//for prorated, we have to deal with it differently; have to 'fill up' each
//day with the standard amount before going to the next one
double numWorkingDays = getCalendar().getWork(getStart(), getFinish(), TimeUnit.DAYS).getDuration();
double standardAmountPerDay = getCost().doubleValue() / numWorkingDays;
result.addAll(splitCostProrated(getCalendar(), actualCost, standardAmountPerDay, getActualStart()));
}
}
return result;
}
|
[
"private",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedActualCostFixedAmount",
"(",
")",
"{",
"List",
"<",
"TimephasedCost",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedCost",
">",
"(",
")",
";",
"double",
"actualCost",
"=",
"getActualCost",
"(",
")",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"actualCost",
">",
"0",
")",
"{",
"AccrueType",
"accrueAt",
"=",
"getResource",
"(",
")",
".",
"getAccrueAt",
"(",
")",
";",
"if",
"(",
"accrueAt",
"==",
"AccrueType",
".",
"START",
")",
"{",
"result",
".",
"add",
"(",
"splitCostStart",
"(",
"getCalendar",
"(",
")",
",",
"actualCost",
",",
"getActualStart",
"(",
")",
")",
")",
";",
"}",
"else",
"if",
"(",
"accrueAt",
"==",
"AccrueType",
".",
"END",
")",
"{",
"result",
".",
"add",
"(",
"splitCostEnd",
"(",
"getCalendar",
"(",
")",
",",
"actualCost",
",",
"getActualFinish",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"//for prorated, we have to deal with it differently; have to 'fill up' each",
"//day with the standard amount before going to the next one",
"double",
"numWorkingDays",
"=",
"getCalendar",
"(",
")",
".",
"getWork",
"(",
"getStart",
"(",
")",
",",
"getFinish",
"(",
")",
",",
"TimeUnit",
".",
"DAYS",
")",
".",
"getDuration",
"(",
")",
";",
"double",
"standardAmountPerDay",
"=",
"getCost",
"(",
")",
".",
"doubleValue",
"(",
")",
"/",
"numWorkingDays",
";",
"result",
".",
"addAll",
"(",
"splitCostProrated",
"(",
"getCalendar",
"(",
")",
",",
"actualCost",
",",
"standardAmountPerDay",
",",
"getActualStart",
"(",
")",
")",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Generates timephased actual costs from the assignment's cost value. Used for Cost type Resources.
@return timephased cost
|
[
"Generates",
"timephased",
"actual",
"costs",
"from",
"the",
"assignment",
"s",
"cost",
"value",
".",
"Used",
"for",
"Cost",
"type",
"Resources",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L920-L951
|
157,446
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.splitWork
|
private List<TimephasedWork> splitWork(CostRateTable table, ProjectCalendar calendar, TimephasedWork work, int rateIndex)
{
List<TimephasedWork> result = new LinkedList<TimephasedWork>();
work.setTotalAmount(Duration.getInstance(0, work.getAmountPerDay().getUnits()));
while (true)
{
CostRateTableEntry rate = table.get(rateIndex);
Date splitDate = rate.getEndDate();
if (splitDate.getTime() >= work.getFinish().getTime())
{
result.add(work);
break;
}
Date currentPeriodEnd = calendar.getPreviousWorkFinish(splitDate);
TimephasedWork currentPeriod = new TimephasedWork(work);
currentPeriod.setFinish(currentPeriodEnd);
result.add(currentPeriod);
Date nextPeriodStart = calendar.getNextWorkStart(splitDate);
work.setStart(nextPeriodStart);
++rateIndex;
}
return result;
}
|
java
|
private List<TimephasedWork> splitWork(CostRateTable table, ProjectCalendar calendar, TimephasedWork work, int rateIndex)
{
List<TimephasedWork> result = new LinkedList<TimephasedWork>();
work.setTotalAmount(Duration.getInstance(0, work.getAmountPerDay().getUnits()));
while (true)
{
CostRateTableEntry rate = table.get(rateIndex);
Date splitDate = rate.getEndDate();
if (splitDate.getTime() >= work.getFinish().getTime())
{
result.add(work);
break;
}
Date currentPeriodEnd = calendar.getPreviousWorkFinish(splitDate);
TimephasedWork currentPeriod = new TimephasedWork(work);
currentPeriod.setFinish(currentPeriodEnd);
result.add(currentPeriod);
Date nextPeriodStart = calendar.getNextWorkStart(splitDate);
work.setStart(nextPeriodStart);
++rateIndex;
}
return result;
}
|
[
"private",
"List",
"<",
"TimephasedWork",
">",
"splitWork",
"(",
"CostRateTable",
"table",
",",
"ProjectCalendar",
"calendar",
",",
"TimephasedWork",
"work",
",",
"int",
"rateIndex",
")",
"{",
"List",
"<",
"TimephasedWork",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"work",
".",
"setTotalAmount",
"(",
"Duration",
".",
"getInstance",
"(",
"0",
",",
"work",
".",
"getAmountPerDay",
"(",
")",
".",
"getUnits",
"(",
")",
")",
")",
";",
"while",
"(",
"true",
")",
"{",
"CostRateTableEntry",
"rate",
"=",
"table",
".",
"get",
"(",
"rateIndex",
")",
";",
"Date",
"splitDate",
"=",
"rate",
".",
"getEndDate",
"(",
")",
";",
"if",
"(",
"splitDate",
".",
"getTime",
"(",
")",
">=",
"work",
".",
"getFinish",
"(",
")",
".",
"getTime",
"(",
")",
")",
"{",
"result",
".",
"add",
"(",
"work",
")",
";",
"break",
";",
"}",
"Date",
"currentPeriodEnd",
"=",
"calendar",
".",
"getPreviousWorkFinish",
"(",
"splitDate",
")",
";",
"TimephasedWork",
"currentPeriod",
"=",
"new",
"TimephasedWork",
"(",
"work",
")",
";",
"currentPeriod",
".",
"setFinish",
"(",
"currentPeriodEnd",
")",
";",
"result",
".",
"add",
"(",
"currentPeriod",
")",
";",
"Date",
"nextPeriodStart",
"=",
"calendar",
".",
"getNextWorkStart",
"(",
"splitDate",
")",
";",
"work",
".",
"setStart",
"(",
"nextPeriodStart",
")",
";",
"++",
"rateIndex",
";",
"}",
"return",
"result",
";",
"}"
] |
Splits timephased work segments in line with cost rates. Note that this is
an approximation - where a rate changes during a working day, the second
rate is used for the whole day.
@param table cost rate table
@param calendar calendar used by this assignment
@param work timephased work segment
@param rateIndex rate applicable at the start of the timephased work segment
@return list of segments which replace the one supplied by the caller
|
[
"Splits",
"timephased",
"work",
"segments",
"in",
"line",
"with",
"cost",
"rates",
".",
"Note",
"that",
"this",
"is",
"an",
"approximation",
"-",
"where",
"a",
"rate",
"changes",
"during",
"a",
"working",
"day",
"the",
"second",
"rate",
"is",
"used",
"for",
"the",
"whole",
"day",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1061-L1089
|
157,447
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.hasMultipleCostRates
|
private boolean hasMultipleCostRates()
{
boolean result = false;
CostRateTable table = getCostRateTable();
if (table != null)
{
//
// We assume here that if there is just one entry in the cost rate
// table, this is an open ended rate which covers any work, it won't
// have specific dates attached to it.
//
if (table.size() > 1)
{
//
// If we have multiple rates in the table, see if the same rate
// is in force at the start and the end of the aaaignment.
//
CostRateTableEntry startEntry = table.getEntryByDate(getStart());
CostRateTableEntry finishEntry = table.getEntryByDate(getFinish());
result = (startEntry != finishEntry);
}
}
return result;
}
|
java
|
private boolean hasMultipleCostRates()
{
boolean result = false;
CostRateTable table = getCostRateTable();
if (table != null)
{
//
// We assume here that if there is just one entry in the cost rate
// table, this is an open ended rate which covers any work, it won't
// have specific dates attached to it.
//
if (table.size() > 1)
{
//
// If we have multiple rates in the table, see if the same rate
// is in force at the start and the end of the aaaignment.
//
CostRateTableEntry startEntry = table.getEntryByDate(getStart());
CostRateTableEntry finishEntry = table.getEntryByDate(getFinish());
result = (startEntry != finishEntry);
}
}
return result;
}
|
[
"private",
"boolean",
"hasMultipleCostRates",
"(",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"CostRateTable",
"table",
"=",
"getCostRateTable",
"(",
")",
";",
"if",
"(",
"table",
"!=",
"null",
")",
"{",
"//",
"// We assume here that if there is just one entry in the cost rate",
"// table, this is an open ended rate which covers any work, it won't",
"// have specific dates attached to it.",
"//",
"if",
"(",
"table",
".",
"size",
"(",
")",
">",
"1",
")",
"{",
"//",
"// If we have multiple rates in the table, see if the same rate",
"// is in force at the start and the end of the aaaignment.",
"//",
"CostRateTableEntry",
"startEntry",
"=",
"table",
".",
"getEntryByDate",
"(",
"getStart",
"(",
")",
")",
";",
"CostRateTableEntry",
"finishEntry",
"=",
"table",
".",
"getEntryByDate",
"(",
"getFinish",
"(",
")",
")",
";",
"result",
"=",
"(",
"startEntry",
"!=",
"finishEntry",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Used to determine if multiple cost rates apply to this assignment.
@return true if multiple cost rates apply to this assignment
|
[
"Used",
"to",
"determine",
"if",
"multiple",
"cost",
"rates",
"apply",
"to",
"this",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1096-L1119
|
157,448
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getCostRateTableEntry
|
private CostRateTableEntry getCostRateTableEntry(Date date)
{
CostRateTableEntry result;
CostRateTable table = getCostRateTable();
if (table == null)
{
Resource resource = getResource();
result = new CostRateTableEntry(resource.getStandardRate(), TimeUnit.HOURS, resource.getOvertimeRate(), TimeUnit.HOURS, resource.getCostPerUse(), null);
}
else
{
if (table.size() == 1)
{
result = table.get(0);
}
else
{
result = table.getEntryByDate(date);
}
}
return result;
}
|
java
|
private CostRateTableEntry getCostRateTableEntry(Date date)
{
CostRateTableEntry result;
CostRateTable table = getCostRateTable();
if (table == null)
{
Resource resource = getResource();
result = new CostRateTableEntry(resource.getStandardRate(), TimeUnit.HOURS, resource.getOvertimeRate(), TimeUnit.HOURS, resource.getCostPerUse(), null);
}
else
{
if (table.size() == 1)
{
result = table.get(0);
}
else
{
result = table.getEntryByDate(date);
}
}
return result;
}
|
[
"private",
"CostRateTableEntry",
"getCostRateTableEntry",
"(",
"Date",
"date",
")",
"{",
"CostRateTableEntry",
"result",
";",
"CostRateTable",
"table",
"=",
"getCostRateTable",
"(",
")",
";",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"Resource",
"resource",
"=",
"getResource",
"(",
")",
";",
"result",
"=",
"new",
"CostRateTableEntry",
"(",
"resource",
".",
"getStandardRate",
"(",
")",
",",
"TimeUnit",
".",
"HOURS",
",",
"resource",
".",
"getOvertimeRate",
"(",
")",
",",
"TimeUnit",
".",
"HOURS",
",",
"resource",
".",
"getCostPerUse",
"(",
")",
",",
"null",
")",
";",
"}",
"else",
"{",
"if",
"(",
"table",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"result",
"=",
"table",
".",
"get",
"(",
"0",
")",
";",
"}",
"else",
"{",
"result",
"=",
"table",
".",
"getEntryByDate",
"(",
"date",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieves the cost rate table entry active on a given date.
@param date target date
@return cost rate table entry
|
[
"Retrieves",
"the",
"cost",
"rate",
"table",
"entry",
"active",
"on",
"a",
"given",
"date",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1127-L1150
|
157,449
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getCostRateTableEntryIndex
|
private int getCostRateTableEntryIndex(Date date)
{
int result = -1;
CostRateTable table = getCostRateTable();
if (table != null)
{
if (table.size() == 1)
{
result = 0;
}
else
{
result = table.getIndexByDate(date);
}
}
return result;
}
|
java
|
private int getCostRateTableEntryIndex(Date date)
{
int result = -1;
CostRateTable table = getCostRateTable();
if (table != null)
{
if (table.size() == 1)
{
result = 0;
}
else
{
result = table.getIndexByDate(date);
}
}
return result;
}
|
[
"private",
"int",
"getCostRateTableEntryIndex",
"(",
"Date",
"date",
")",
"{",
"int",
"result",
"=",
"-",
"1",
";",
"CostRateTable",
"table",
"=",
"getCostRateTable",
"(",
")",
";",
"if",
"(",
"table",
"!=",
"null",
")",
"{",
"if",
"(",
"table",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"result",
"=",
"0",
";",
"}",
"else",
"{",
"result",
"=",
"table",
".",
"getIndexByDate",
"(",
"date",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieves the index of a cost rate table entry active on a given date.
@param date target date
@return cost rate table entry index
|
[
"Retrieves",
"the",
"index",
"of",
"a",
"cost",
"rate",
"table",
"entry",
"active",
"on",
"a",
"given",
"date",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1158-L1176
|
157,450
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedBaselineWork
|
public List<TimephasedWork> getTimephasedBaselineWork(int index)
{
return m_timephasedBaselineWork[index] == null ? null : m_timephasedBaselineWork[index].getData();
}
|
java
|
public List<TimephasedWork> getTimephasedBaselineWork(int index)
{
return m_timephasedBaselineWork[index] == null ? null : m_timephasedBaselineWork[index].getData();
}
|
[
"public",
"List",
"<",
"TimephasedWork",
">",
"getTimephasedBaselineWork",
"(",
"int",
"index",
")",
"{",
"return",
"m_timephasedBaselineWork",
"[",
"index",
"]",
"==",
"null",
"?",
"null",
":",
"m_timephasedBaselineWork",
"[",
"index",
"]",
".",
"getData",
"(",
")",
";",
"}"
] |
Retrieve timephased baseline work. Note that index 0 represents "Baseline",
index 1 represents "Baseline1" and so on.
@param index baseline index
@return timephased work, or null if no baseline is present
|
[
"Retrieve",
"timephased",
"baseline",
"work",
".",
"Note",
"that",
"index",
"0",
"represents",
"Baseline",
"index",
"1",
"represents",
"Baseline1",
"and",
"so",
"on",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1220-L1223
|
157,451
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getTimephasedBaselineCost
|
public List<TimephasedCost> getTimephasedBaselineCost(int index)
{
return m_timephasedBaselineCost[index] == null ? null : m_timephasedBaselineCost[index].getData();
}
|
java
|
public List<TimephasedCost> getTimephasedBaselineCost(int index)
{
return m_timephasedBaselineCost[index] == null ? null : m_timephasedBaselineCost[index].getData();
}
|
[
"public",
"List",
"<",
"TimephasedCost",
">",
"getTimephasedBaselineCost",
"(",
"int",
"index",
")",
"{",
"return",
"m_timephasedBaselineCost",
"[",
"index",
"]",
"==",
"null",
"?",
"null",
":",
"m_timephasedBaselineCost",
"[",
"index",
"]",
".",
"getData",
"(",
")",
";",
"}"
] |
Retrieve timephased baseline cost. Note that index 0 represents "Baseline",
index 1 represents "Baseline1" and so on.
@param index baseline index
@return timephased work, or null if no baseline is present
|
[
"Retrieve",
"timephased",
"baseline",
"cost",
".",
"Note",
"that",
"index",
"0",
"represents",
"Baseline",
"index",
"1",
"represents",
"Baseline1",
"and",
"so",
"on",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1232-L1235
|
157,452
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getCalendar
|
public ProjectCalendar getCalendar()
{
ProjectCalendar calendar = null;
Resource resource = getResource();
if (resource != null)
{
calendar = resource.getResourceCalendar();
}
Task task = getTask();
if (calendar == null || task.getIgnoreResourceCalendar())
{
calendar = task.getEffectiveCalendar();
}
return calendar;
}
|
java
|
public ProjectCalendar getCalendar()
{
ProjectCalendar calendar = null;
Resource resource = getResource();
if (resource != null)
{
calendar = resource.getResourceCalendar();
}
Task task = getTask();
if (calendar == null || task.getIgnoreResourceCalendar())
{
calendar = task.getEffectiveCalendar();
}
return calendar;
}
|
[
"public",
"ProjectCalendar",
"getCalendar",
"(",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"null",
";",
"Resource",
"resource",
"=",
"getResource",
"(",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"calendar",
"=",
"resource",
".",
"getResourceCalendar",
"(",
")",
";",
"}",
"Task",
"task",
"=",
"getTask",
"(",
")",
";",
"if",
"(",
"calendar",
"==",
"null",
"||",
"task",
".",
"getIgnoreResourceCalendar",
"(",
")",
")",
"{",
"calendar",
"=",
"task",
".",
"getEffectiveCalendar",
"(",
")",
";",
"}",
"return",
"calendar",
";",
"}"
] |
Retrieves the calendar used for this resource assignment.
@return ProjectCalendar instance
|
[
"Retrieves",
"the",
"calendar",
"used",
"for",
"this",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1242-L1258
|
157,453
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.setEnterpriseCost
|
public void setEnterpriseCost(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value);
}
|
java
|
public void setEnterpriseCost(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value);
}
|
[
"public",
"void",
"setEnterpriseCost",
"(",
"int",
"index",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_COST",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] |
Set an enterprise cost value.
@param index cost index (1-30)
@param value cost value
|
[
"Set",
"an",
"enterprise",
"cost",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1694-L1697
|
157,454
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.setEnterpriseDate
|
public void setEnterpriseDate(int index, Date value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value);
}
|
java
|
public void setEnterpriseDate(int index, Date value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value);
}
|
[
"public",
"void",
"setEnterpriseDate",
"(",
"int",
"index",
",",
"Date",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_DATE",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] |
Set an enterprise date value.
@param index date index (1-30)
@param value date value
|
[
"Set",
"an",
"enterprise",
"date",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1716-L1719
|
157,455
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.setEnterpriseDuration
|
public void setEnterpriseDuration(int index, Duration value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value);
}
|
java
|
public void setEnterpriseDuration(int index, Duration value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value);
}
|
[
"public",
"void",
"setEnterpriseDuration",
"(",
"int",
"index",
",",
"Duration",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_DURATION",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] |
Set an enterprise duration value.
@param index duration index (1-30)
@param value duration value
|
[
"Set",
"an",
"enterprise",
"duration",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1738-L1741
|
157,456
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.setEnterpriseNumber
|
public void setEnterpriseNumber(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);
}
|
java
|
public void setEnterpriseNumber(int index, Number value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value);
}
|
[
"public",
"void",
"setEnterpriseNumber",
"(",
"int",
"index",
",",
"Number",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_NUMBER",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] |
Set an enterprise number value.
@param index number index (1-40)
@param value number value
|
[
"Set",
"an",
"enterprise",
"number",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1782-L1785
|
157,457
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.setEnterpriseText
|
public void setEnterpriseText(int index, String value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value);
}
|
java
|
public void setEnterpriseText(int index, String value)
{
set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value);
}
|
[
"public",
"void",
"setEnterpriseText",
"(",
"int",
"index",
",",
"String",
"value",
")",
"{",
"set",
"(",
"selectField",
"(",
"AssignmentFieldLists",
".",
"ENTERPRISE_TEXT",
",",
"index",
")",
",",
"value",
")",
";",
"}"
] |
Set an enterprise text value.
@param index text index (1-40)
@param value text value
|
[
"Set",
"an",
"enterprise",
"text",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1804-L1807
|
157,458
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getOvertimeCost
|
public Number getOvertimeCost()
{
Number cost = (Number) getCachedValue(AssignmentField.OVERTIME_COST);
if (cost == null)
{
Number actual = getActualOvertimeCost();
Number remaining = getRemainingOvertimeCost();
if (actual != null && remaining != null)
{
cost = NumberHelper.getDouble(actual.doubleValue() + remaining.doubleValue());
set(AssignmentField.OVERTIME_COST, cost);
}
}
return (cost);
}
|
java
|
public Number getOvertimeCost()
{
Number cost = (Number) getCachedValue(AssignmentField.OVERTIME_COST);
if (cost == null)
{
Number actual = getActualOvertimeCost();
Number remaining = getRemainingOvertimeCost();
if (actual != null && remaining != null)
{
cost = NumberHelper.getDouble(actual.doubleValue() + remaining.doubleValue());
set(AssignmentField.OVERTIME_COST, cost);
}
}
return (cost);
}
|
[
"public",
"Number",
"getOvertimeCost",
"(",
")",
"{",
"Number",
"cost",
"=",
"(",
"Number",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"OVERTIME_COST",
")",
";",
"if",
"(",
"cost",
"==",
"null",
")",
"{",
"Number",
"actual",
"=",
"getActualOvertimeCost",
"(",
")",
";",
"Number",
"remaining",
"=",
"getRemainingOvertimeCost",
"(",
")",
";",
"if",
"(",
"actual",
"!=",
"null",
"&&",
"remaining",
"!=",
"null",
")",
"{",
"cost",
"=",
"NumberHelper",
".",
"getDouble",
"(",
"actual",
".",
"doubleValue",
"(",
")",
"+",
"remaining",
".",
"doubleValue",
"(",
")",
")",
";",
"set",
"(",
"AssignmentField",
".",
"OVERTIME_COST",
",",
"cost",
")",
";",
"}",
"}",
"return",
"(",
"cost",
")",
";",
"}"
] |
Returns the overtime cost of this resource assignment.
@return cost
|
[
"Returns",
"the",
"overtime",
"cost",
"of",
"this",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1907-L1921
|
157,459
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getPercentageWorkComplete
|
public Number getPercentageWorkComplete()
{
Number pct = (Number) getCachedValue(AssignmentField.PERCENT_WORK_COMPLETE);
if (pct == null)
{
Duration actualWork = getActualWork();
Duration work = getWork();
if (actualWork != null && work != null && work.getDuration() != 0)
{
pct = Double.valueOf((actualWork.getDuration() * 100) / work.convertUnits(actualWork.getUnits(), getParentFile().getProjectProperties()).getDuration());
set(AssignmentField.PERCENT_WORK_COMPLETE, pct);
}
}
return pct;
}
|
java
|
public Number getPercentageWorkComplete()
{
Number pct = (Number) getCachedValue(AssignmentField.PERCENT_WORK_COMPLETE);
if (pct == null)
{
Duration actualWork = getActualWork();
Duration work = getWork();
if (actualWork != null && work != null && work.getDuration() != 0)
{
pct = Double.valueOf((actualWork.getDuration() * 100) / work.convertUnits(actualWork.getUnits(), getParentFile().getProjectProperties()).getDuration());
set(AssignmentField.PERCENT_WORK_COMPLETE, pct);
}
}
return pct;
}
|
[
"public",
"Number",
"getPercentageWorkComplete",
"(",
")",
"{",
"Number",
"pct",
"=",
"(",
"Number",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"PERCENT_WORK_COMPLETE",
")",
";",
"if",
"(",
"pct",
"==",
"null",
")",
"{",
"Duration",
"actualWork",
"=",
"getActualWork",
"(",
")",
";",
"Duration",
"work",
"=",
"getWork",
"(",
")",
";",
"if",
"(",
"actualWork",
"!=",
"null",
"&&",
"work",
"!=",
"null",
"&&",
"work",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
"{",
"pct",
"=",
"Double",
".",
"valueOf",
"(",
"(",
"actualWork",
".",
"getDuration",
"(",
")",
"*",
"100",
")",
"/",
"work",
".",
"convertUnits",
"(",
"actualWork",
".",
"getUnits",
"(",
")",
",",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
")",
".",
"getDuration",
"(",
")",
")",
";",
"set",
"(",
"AssignmentField",
".",
"PERCENT_WORK_COMPLETE",
",",
"pct",
")",
";",
"}",
"}",
"return",
"pct",
";",
"}"
] |
The % Work Complete field contains the current status of a task,
expressed as the percentage of the task's work that has been completed.
You can enter percent work complete, or you can have Microsoft Project
calculate it for you based on actual work on the task.
@return percentage as float
|
[
"The",
"%",
"Work",
"Complete",
"field",
"contains",
"the",
"current",
"status",
"of",
"a",
"task",
"expressed",
"as",
"the",
"percentage",
"of",
"the",
"task",
"s",
"work",
"that",
"has",
"been",
"completed",
".",
"You",
"can",
"enter",
"percent",
"work",
"complete",
"or",
"you",
"can",
"have",
"Microsoft",
"Project",
"calculate",
"it",
"for",
"you",
"based",
"on",
"actual",
"work",
"on",
"the",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2198-L2212
|
157,460
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getStartVariance
|
public Duration getStartVariance()
{
Duration variance = (Duration) getCachedValue(AssignmentField.START_VARIANCE);
if (variance == null)
{
TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits();
variance = DateHelper.getVariance(getTask(), getBaselineStart(), getStart(), format);
set(AssignmentField.START_VARIANCE, variance);
}
return (variance);
}
|
java
|
public Duration getStartVariance()
{
Duration variance = (Duration) getCachedValue(AssignmentField.START_VARIANCE);
if (variance == null)
{
TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits();
variance = DateHelper.getVariance(getTask(), getBaselineStart(), getStart(), format);
set(AssignmentField.START_VARIANCE, variance);
}
return (variance);
}
|
[
"public",
"Duration",
"getStartVariance",
"(",
")",
"{",
"Duration",
"variance",
"=",
"(",
"Duration",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"START_VARIANCE",
")",
";",
"if",
"(",
"variance",
"==",
"null",
")",
"{",
"TimeUnit",
"format",
"=",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getDefaultDurationUnits",
"(",
")",
";",
"variance",
"=",
"DateHelper",
".",
"getVariance",
"(",
"getTask",
"(",
")",
",",
"getBaselineStart",
"(",
")",
",",
"getStart",
"(",
")",
",",
"format",
")",
";",
"set",
"(",
"AssignmentField",
".",
"START_VARIANCE",
",",
"variance",
")",
";",
"}",
"return",
"(",
"variance",
")",
";",
"}"
] |
Calculate the start variance.
@return start variance
|
[
"Calculate",
"the",
"start",
"variance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2418-L2428
|
157,461
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getFinishVariance
|
public Duration getFinishVariance()
{
Duration variance = (Duration) getCachedValue(AssignmentField.FINISH_VARIANCE);
if (variance == null)
{
TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits();
variance = DateHelper.getVariance(getTask(), getBaselineFinish(), getFinish(), format);
set(AssignmentField.FINISH_VARIANCE, variance);
}
return (variance);
}
|
java
|
public Duration getFinishVariance()
{
Duration variance = (Duration) getCachedValue(AssignmentField.FINISH_VARIANCE);
if (variance == null)
{
TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits();
variance = DateHelper.getVariance(getTask(), getBaselineFinish(), getFinish(), format);
set(AssignmentField.FINISH_VARIANCE, variance);
}
return (variance);
}
|
[
"public",
"Duration",
"getFinishVariance",
"(",
")",
"{",
"Duration",
"variance",
"=",
"(",
"Duration",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"FINISH_VARIANCE",
")",
";",
"if",
"(",
"variance",
"==",
"null",
")",
"{",
"TimeUnit",
"format",
"=",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getDefaultDurationUnits",
"(",
")",
";",
"variance",
"=",
"DateHelper",
".",
"getVariance",
"(",
"getTask",
"(",
")",
",",
"getBaselineFinish",
"(",
")",
",",
"getFinish",
"(",
")",
",",
"format",
")",
";",
"set",
"(",
"AssignmentField",
".",
"FINISH_VARIANCE",
",",
"variance",
")",
";",
"}",
"return",
"(",
"variance",
")",
";",
"}"
] |
Calculate the finish variance.
@return finish variance
|
[
"Calculate",
"the",
"finish",
"variance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2447-L2457
|
157,462
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.getCostRateTableIndex
|
public int getCostRateTableIndex()
{
Integer value = (Integer) getCachedValue(AssignmentField.COST_RATE_TABLE);
return value == null ? 0 : value.intValue();
}
|
java
|
public int getCostRateTableIndex()
{
Integer value = (Integer) getCachedValue(AssignmentField.COST_RATE_TABLE);
return value == null ? 0 : value.intValue();
}
|
[
"public",
"int",
"getCostRateTableIndex",
"(",
")",
"{",
"Integer",
"value",
"=",
"(",
"Integer",
")",
"getCachedValue",
"(",
"AssignmentField",
".",
"COST_RATE_TABLE",
")",
";",
"return",
"value",
"==",
"null",
"?",
"0",
":",
"value",
".",
"intValue",
"(",
")",
";",
"}"
] |
Returns the cost rate table index for this assignment.
@return cost rate table index
|
[
"Returns",
"the",
"cost",
"rate",
"table",
"index",
"for",
"this",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2580-L2584
|
157,463
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ResourceAssignment.java
|
ResourceAssignment.selectField
|
private AssignmentField selectField(AssignmentField[] fields, int index)
{
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
}
|
java
|
private AssignmentField selectField(AssignmentField[] fields, int index)
{
if (index < 1 || index > fields.length)
{
throw new IllegalArgumentException(index + " is not a valid field index");
}
return (fields[index - 1]);
}
|
[
"private",
"AssignmentField",
"selectField",
"(",
"AssignmentField",
"[",
"]",
"fields",
",",
"int",
"index",
")",
"{",
"if",
"(",
"index",
"<",
"1",
"||",
"index",
">",
"fields",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"index",
"+",
"\" is not a valid field index\"",
")",
";",
"}",
"return",
"(",
"fields",
"[",
"index",
"-",
"1",
"]",
")",
";",
"}"
] |
Maps a field index to an AssignmentField instance.
@param fields array of fields used as the basis for the mapping.
@param index required field index
@return AssignmnetField instance
|
[
"Maps",
"a",
"field",
"index",
"to",
"an",
"AssignmentField",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2683-L2690
|
157,464
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/ActivitySorter.java
|
ActivitySorter.sort
|
public void sort(ChildTaskContainer container)
{
// Do we have any tasks?
List<Task> tasks = container.getChildTasks();
if (!tasks.isEmpty())
{
for (Task task : tasks)
{
//
// Sort child activities
//
sort(task);
//
// Sort Order:
// 1. Activities come first
// 2. WBS come last
// 3. Activities ordered by activity ID
// 4. WBS ordered by ID
//
Collections.sort(tasks, new Comparator<Task>()
{
@Override public int compare(Task t1, Task t2)
{
boolean t1IsWbs = m_wbsTasks.contains(t1);
boolean t2IsWbs = m_wbsTasks.contains(t2);
// Both are WBS
if (t1IsWbs && t2IsWbs)
{
return t1.getID().compareTo(t2.getID());
}
// Both are activities
if (!t1IsWbs && !t2IsWbs)
{
String activityID1 = (String) t1.getCurrentValue(m_activityIDField);
String activityID2 = (String) t2.getCurrentValue(m_activityIDField);
if (activityID1 == null || activityID2 == null)
{
return (activityID1 == null && activityID2 == null ? 0 : (activityID1 == null ? 1 : -1));
}
return activityID1.compareTo(activityID2);
}
// One activity one WBS
return t1IsWbs ? 1 : -1;
}
});
}
}
}
|
java
|
public void sort(ChildTaskContainer container)
{
// Do we have any tasks?
List<Task> tasks = container.getChildTasks();
if (!tasks.isEmpty())
{
for (Task task : tasks)
{
//
// Sort child activities
//
sort(task);
//
// Sort Order:
// 1. Activities come first
// 2. WBS come last
// 3. Activities ordered by activity ID
// 4. WBS ordered by ID
//
Collections.sort(tasks, new Comparator<Task>()
{
@Override public int compare(Task t1, Task t2)
{
boolean t1IsWbs = m_wbsTasks.contains(t1);
boolean t2IsWbs = m_wbsTasks.contains(t2);
// Both are WBS
if (t1IsWbs && t2IsWbs)
{
return t1.getID().compareTo(t2.getID());
}
// Both are activities
if (!t1IsWbs && !t2IsWbs)
{
String activityID1 = (String) t1.getCurrentValue(m_activityIDField);
String activityID2 = (String) t2.getCurrentValue(m_activityIDField);
if (activityID1 == null || activityID2 == null)
{
return (activityID1 == null && activityID2 == null ? 0 : (activityID1 == null ? 1 : -1));
}
return activityID1.compareTo(activityID2);
}
// One activity one WBS
return t1IsWbs ? 1 : -1;
}
});
}
}
}
|
[
"public",
"void",
"sort",
"(",
"ChildTaskContainer",
"container",
")",
"{",
"// Do we have any tasks?",
"List",
"<",
"Task",
">",
"tasks",
"=",
"container",
".",
"getChildTasks",
"(",
")",
";",
"if",
"(",
"!",
"tasks",
".",
"isEmpty",
"(",
")",
")",
"{",
"for",
"(",
"Task",
"task",
":",
"tasks",
")",
"{",
"//",
"// Sort child activities",
"//",
"sort",
"(",
"task",
")",
";",
"//",
"// Sort Order:",
"// 1. Activities come first",
"// 2. WBS come last",
"// 3. Activities ordered by activity ID",
"// 4. WBS ordered by ID",
"//",
"Collections",
".",
"sort",
"(",
"tasks",
",",
"new",
"Comparator",
"<",
"Task",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"int",
"compare",
"(",
"Task",
"t1",
",",
"Task",
"t2",
")",
"{",
"boolean",
"t1IsWbs",
"=",
"m_wbsTasks",
".",
"contains",
"(",
"t1",
")",
";",
"boolean",
"t2IsWbs",
"=",
"m_wbsTasks",
".",
"contains",
"(",
"t2",
")",
";",
"// Both are WBS",
"if",
"(",
"t1IsWbs",
"&&",
"t2IsWbs",
")",
"{",
"return",
"t1",
".",
"getID",
"(",
")",
".",
"compareTo",
"(",
"t2",
".",
"getID",
"(",
")",
")",
";",
"}",
"// Both are activities",
"if",
"(",
"!",
"t1IsWbs",
"&&",
"!",
"t2IsWbs",
")",
"{",
"String",
"activityID1",
"=",
"(",
"String",
")",
"t1",
".",
"getCurrentValue",
"(",
"m_activityIDField",
")",
";",
"String",
"activityID2",
"=",
"(",
"String",
")",
"t2",
".",
"getCurrentValue",
"(",
"m_activityIDField",
")",
";",
"if",
"(",
"activityID1",
"==",
"null",
"||",
"activityID2",
"==",
"null",
")",
"{",
"return",
"(",
"activityID1",
"==",
"null",
"&&",
"activityID2",
"==",
"null",
"?",
"0",
":",
"(",
"activityID1",
"==",
"null",
"?",
"1",
":",
"-",
"1",
")",
")",
";",
"}",
"return",
"activityID1",
".",
"compareTo",
"(",
"activityID2",
")",
";",
"}",
"// One activity one WBS",
"return",
"t1IsWbs",
"?",
"1",
":",
"-",
"1",
";",
"}",
"}",
")",
";",
"}",
"}",
"}"
] |
Recursively sort the supplied child tasks.
@param container child tasks
|
[
"Recursively",
"sort",
"the",
"supplied",
"child",
"tasks",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/ActivitySorter.java#L57-L110
|
157,465
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/p3/TableReader.java
|
TableReader.read
|
public void read(File file, Table table) throws IOException
{
//System.out.println("Reading " + file.getName());
InputStream is = null;
try
{
is = new FileInputStream(file);
read(is, table);
}
finally
{
StreamHelper.closeQuietly(is);
}
}
|
java
|
public void read(File file, Table table) throws IOException
{
//System.out.println("Reading " + file.getName());
InputStream is = null;
try
{
is = new FileInputStream(file);
read(is, table);
}
finally
{
StreamHelper.closeQuietly(is);
}
}
|
[
"public",
"void",
"read",
"(",
"File",
"file",
",",
"Table",
"table",
")",
"throws",
"IOException",
"{",
"//System.out.println(\"Reading \" + file.getName());",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"read",
"(",
"is",
",",
"table",
")",
";",
"}",
"finally",
"{",
"StreamHelper",
".",
"closeQuietly",
"(",
"is",
")",
";",
"}",
"}"
] |
Read the table from the file and populate the supplied Table instance.
@param file database file
@param table Table instance
|
[
"Read",
"the",
"table",
"from",
"the",
"file",
"and",
"populate",
"the",
"supplied",
"Table",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/TableReader.java#L60-L74
|
157,466
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/p3/TableReader.java
|
TableReader.readPage
|
private void readPage(byte[] buffer, Table table)
{
int magicNumber = getShort(buffer, 0);
if (magicNumber == 0x4400)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, ""));
int recordSize = m_definition.getRecordSize();
RowValidator rowValidator = m_definition.getRowValidator();
String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName();
int index = 6;
while (index + recordSize <= buffer.length)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, ""));
int btrieveValue = getShort(buffer, index);
if (btrieveValue != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
row.put("ROW_VERSION", Integer.valueOf(btrieveValue));
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(index, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
if (rowValidator == null || rowValidator.validRow(row))
{
table.addRow(primaryKeyColumnName, row);
}
}
index += recordSize;
}
}
}
|
java
|
private void readPage(byte[] buffer, Table table)
{
int magicNumber = getShort(buffer, 0);
if (magicNumber == 0x4400)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, ""));
int recordSize = m_definition.getRecordSize();
RowValidator rowValidator = m_definition.getRowValidator();
String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName();
int index = 6;
while (index + recordSize <= buffer.length)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, ""));
int btrieveValue = getShort(buffer, index);
if (btrieveValue != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
row.put("ROW_VERSION", Integer.valueOf(btrieveValue));
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(index, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
if (rowValidator == null || rowValidator.validRow(row))
{
table.addRow(primaryKeyColumnName, row);
}
}
index += recordSize;
}
}
}
|
[
"private",
"void",
"readPage",
"(",
"byte",
"[",
"]",
"buffer",
",",
"Table",
"table",
")",
"{",
"int",
"magicNumber",
"=",
"getShort",
"(",
"buffer",
",",
"0",
")",
";",
"if",
"(",
"magicNumber",
"==",
"0x4400",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, \"\"));",
"int",
"recordSize",
"=",
"m_definition",
".",
"getRecordSize",
"(",
")",
";",
"RowValidator",
"rowValidator",
"=",
"m_definition",
".",
"getRowValidator",
"(",
")",
";",
"String",
"primaryKeyColumnName",
"=",
"m_definition",
".",
"getPrimaryKeyColumnName",
"(",
")",
";",
"int",
"index",
"=",
"6",
";",
"while",
"(",
"index",
"+",
"recordSize",
"<=",
"buffer",
".",
"length",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, \"\"));",
"int",
"btrieveValue",
"=",
"getShort",
"(",
"buffer",
",",
"index",
")",
";",
"if",
"(",
"btrieveValue",
"!=",
"0",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"row",
".",
"put",
"(",
"\"ROW_VERSION\"",
",",
"Integer",
".",
"valueOf",
"(",
"btrieveValue",
")",
")",
";",
"for",
"(",
"ColumnDefinition",
"column",
":",
"m_definition",
".",
"getColumns",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"column",
".",
"read",
"(",
"index",
",",
"buffer",
")",
";",
"//System.out.println(column.getName() + \": \" + value);",
"row",
".",
"put",
"(",
"column",
".",
"getName",
"(",
")",
",",
"value",
")",
";",
"}",
"if",
"(",
"rowValidator",
"==",
"null",
"||",
"rowValidator",
".",
"validRow",
"(",
"row",
")",
")",
"{",
"table",
".",
"addRow",
"(",
"primaryKeyColumnName",
",",
"row",
")",
";",
"}",
"}",
"index",
"+=",
"recordSize",
";",
"}",
"}",
"}"
] |
Reads data from a single page of the database file.
@param buffer page from the database file
@param table Table instance
|
[
"Reads",
"data",
"from",
"a",
"single",
"page",
"of",
"the",
"database",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/TableReader.java#L108-L142
|
157,467
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/PropsBlock.java
|
PropsBlock.populateMap
|
private void populateMap(byte[] data, Integer previousItemOffset, Integer previousItemKey, Integer itemOffset)
{
if (previousItemOffset != null)
{
int itemSize = itemOffset.intValue() - previousItemOffset.intValue();
byte[] itemData = new byte[itemSize];
System.arraycopy(data, previousItemOffset.intValue(), itemData, 0, itemSize);
m_map.put(previousItemKey, itemData);
}
}
|
java
|
private void populateMap(byte[] data, Integer previousItemOffset, Integer previousItemKey, Integer itemOffset)
{
if (previousItemOffset != null)
{
int itemSize = itemOffset.intValue() - previousItemOffset.intValue();
byte[] itemData = new byte[itemSize];
System.arraycopy(data, previousItemOffset.intValue(), itemData, 0, itemSize);
m_map.put(previousItemKey, itemData);
}
}
|
[
"private",
"void",
"populateMap",
"(",
"byte",
"[",
"]",
"data",
",",
"Integer",
"previousItemOffset",
",",
"Integer",
"previousItemKey",
",",
"Integer",
"itemOffset",
")",
"{",
"if",
"(",
"previousItemOffset",
"!=",
"null",
")",
"{",
"int",
"itemSize",
"=",
"itemOffset",
".",
"intValue",
"(",
")",
"-",
"previousItemOffset",
".",
"intValue",
"(",
")",
";",
"byte",
"[",
"]",
"itemData",
"=",
"new",
"byte",
"[",
"itemSize",
"]",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"previousItemOffset",
".",
"intValue",
"(",
")",
",",
"itemData",
",",
"0",
",",
"itemSize",
")",
";",
"m_map",
".",
"put",
"(",
"previousItemKey",
",",
"itemData",
")",
";",
"}",
"}"
] |
Method used to extract data from the block of properties and
insert the key value pair into a map.
@param data block of property data
@param previousItemOffset previous offset
@param previousItemKey item key
@param itemOffset current item offset
|
[
"Method",
"used",
"to",
"extract",
"data",
"from",
"the",
"block",
"of",
"properties",
"and",
"insert",
"the",
"key",
"value",
"pair",
"into",
"a",
"map",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/PropsBlock.java#L83-L92
|
157,468
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/explorer/HexDumpController.java
|
HexDumpController.viewDocument
|
public void viewDocument(DocumentEntry entry)
{
InputStream is = null;
try
{
is = new DocumentInputStream(entry);
byte[] data = new byte[is.available()];
is.read(data);
m_model.setData(data);
updateTables();
}
catch (IOException ex)
{
throw new RuntimeException(ex);
}
finally
{
StreamHelper.closeQuietly(is);
}
}
|
java
|
public void viewDocument(DocumentEntry entry)
{
InputStream is = null;
try
{
is = new DocumentInputStream(entry);
byte[] data = new byte[is.available()];
is.read(data);
m_model.setData(data);
updateTables();
}
catch (IOException ex)
{
throw new RuntimeException(ex);
}
finally
{
StreamHelper.closeQuietly(is);
}
}
|
[
"public",
"void",
"viewDocument",
"(",
"DocumentEntry",
"entry",
")",
"{",
"InputStream",
"is",
"=",
"null",
";",
"try",
"{",
"is",
"=",
"new",
"DocumentInputStream",
"(",
"entry",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"is",
".",
"available",
"(",
")",
"]",
";",
"is",
".",
"read",
"(",
"data",
")",
";",
"m_model",
".",
"setData",
"(",
"data",
")",
";",
"updateTables",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"ex",
")",
";",
"}",
"finally",
"{",
"StreamHelper",
".",
"closeQuietly",
"(",
"is",
")",
";",
"}",
"}"
] |
Command to select a document from the POIFS for viewing.
@param entry document to view
|
[
"Command",
"to",
"select",
"a",
"document",
"from",
"the",
"POIFS",
"for",
"viewing",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/HexDumpController.java#L112-L135
|
157,469
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/explorer/HexDumpController.java
|
HexDumpController.updateTables
|
protected void updateTables()
{
byte[] data = m_model.getData();
int columns = m_model.getColumns();
int rows = (data.length / columns) + 1;
int offset = m_model.getOffset();
String[][] hexData = new String[rows][columns];
String[][] asciiData = new String[rows][columns];
int row = 0;
int column = 0;
StringBuilder hexValue = new StringBuilder();
for (int index = offset; index < data.length; index++)
{
int value = data[index];
hexValue.setLength(0);
hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]);
hexValue.append(HEX_DIGITS[value & 0x0F]);
char c = (char) value;
if ((c > 200) || (c < 27))
{
c = ' ';
}
hexData[row][column] = hexValue.toString();
asciiData[row][column] = Character.toString(c);
++column;
if (column == columns)
{
column = 0;
++row;
}
}
String[] columnHeadings = new String[columns];
TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings)
{
@Override public boolean isCellEditable(int r, int c)
{
return false;
}
};
TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings)
{
@Override public boolean isCellEditable(int r, int c)
{
return false;
}
};
m_model.setSizeValueLabel(Integer.toString(data.length));
m_model.setHexTableModel(hexTableModel);
m_model.setAsciiTableModel(asciiTableModel);
m_model.setCurrentSelectionIndex(0);
m_model.setPreviousSelectionIndex(0);
}
|
java
|
protected void updateTables()
{
byte[] data = m_model.getData();
int columns = m_model.getColumns();
int rows = (data.length / columns) + 1;
int offset = m_model.getOffset();
String[][] hexData = new String[rows][columns];
String[][] asciiData = new String[rows][columns];
int row = 0;
int column = 0;
StringBuilder hexValue = new StringBuilder();
for (int index = offset; index < data.length; index++)
{
int value = data[index];
hexValue.setLength(0);
hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]);
hexValue.append(HEX_DIGITS[value & 0x0F]);
char c = (char) value;
if ((c > 200) || (c < 27))
{
c = ' ';
}
hexData[row][column] = hexValue.toString();
asciiData[row][column] = Character.toString(c);
++column;
if (column == columns)
{
column = 0;
++row;
}
}
String[] columnHeadings = new String[columns];
TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings)
{
@Override public boolean isCellEditable(int r, int c)
{
return false;
}
};
TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings)
{
@Override public boolean isCellEditable(int r, int c)
{
return false;
}
};
m_model.setSizeValueLabel(Integer.toString(data.length));
m_model.setHexTableModel(hexTableModel);
m_model.setAsciiTableModel(asciiTableModel);
m_model.setCurrentSelectionIndex(0);
m_model.setPreviousSelectionIndex(0);
}
|
[
"protected",
"void",
"updateTables",
"(",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"m_model",
".",
"getData",
"(",
")",
";",
"int",
"columns",
"=",
"m_model",
".",
"getColumns",
"(",
")",
";",
"int",
"rows",
"=",
"(",
"data",
".",
"length",
"/",
"columns",
")",
"+",
"1",
";",
"int",
"offset",
"=",
"m_model",
".",
"getOffset",
"(",
")",
";",
"String",
"[",
"]",
"[",
"]",
"hexData",
"=",
"new",
"String",
"[",
"rows",
"]",
"[",
"columns",
"]",
";",
"String",
"[",
"]",
"[",
"]",
"asciiData",
"=",
"new",
"String",
"[",
"rows",
"]",
"[",
"columns",
"]",
";",
"int",
"row",
"=",
"0",
";",
"int",
"column",
"=",
"0",
";",
"StringBuilder",
"hexValue",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"offset",
";",
"index",
"<",
"data",
".",
"length",
";",
"index",
"++",
")",
"{",
"int",
"value",
"=",
"data",
"[",
"index",
"]",
";",
"hexValue",
".",
"setLength",
"(",
"0",
")",
";",
"hexValue",
".",
"append",
"(",
"HEX_DIGITS",
"[",
"(",
"value",
"&",
"0xF0",
")",
">>",
"4",
"]",
")",
";",
"hexValue",
".",
"append",
"(",
"HEX_DIGITS",
"[",
"value",
"&",
"0x0F",
"]",
")",
";",
"char",
"c",
"=",
"(",
"char",
")",
"value",
";",
"if",
"(",
"(",
"c",
">",
"200",
")",
"||",
"(",
"c",
"<",
"27",
")",
")",
"{",
"c",
"=",
"'",
"'",
";",
"}",
"hexData",
"[",
"row",
"]",
"[",
"column",
"]",
"=",
"hexValue",
".",
"toString",
"(",
")",
";",
"asciiData",
"[",
"row",
"]",
"[",
"column",
"]",
"=",
"Character",
".",
"toString",
"(",
"c",
")",
";",
"++",
"column",
";",
"if",
"(",
"column",
"==",
"columns",
")",
"{",
"column",
"=",
"0",
";",
"++",
"row",
";",
"}",
"}",
"String",
"[",
"]",
"columnHeadings",
"=",
"new",
"String",
"[",
"columns",
"]",
";",
"TableModel",
"hexTableModel",
"=",
"new",
"DefaultTableModel",
"(",
"hexData",
",",
"columnHeadings",
")",
"{",
"@",
"Override",
"public",
"boolean",
"isCellEditable",
"(",
"int",
"r",
",",
"int",
"c",
")",
"{",
"return",
"false",
";",
"}",
"}",
";",
"TableModel",
"asciiTableModel",
"=",
"new",
"DefaultTableModel",
"(",
"asciiData",
",",
"columnHeadings",
")",
"{",
"@",
"Override",
"public",
"boolean",
"isCellEditable",
"(",
"int",
"r",
",",
"int",
"c",
")",
"{",
"return",
"false",
";",
"}",
"}",
";",
"m_model",
".",
"setSizeValueLabel",
"(",
"Integer",
".",
"toString",
"(",
"data",
".",
"length",
")",
")",
";",
"m_model",
".",
"setHexTableModel",
"(",
"hexTableModel",
")",
";",
"m_model",
".",
"setAsciiTableModel",
"(",
"asciiTableModel",
")",
";",
"m_model",
".",
"setCurrentSelectionIndex",
"(",
"0",
")",
";",
"m_model",
".",
"setPreviousSelectionIndex",
"(",
"0",
")",
";",
"}"
] |
Update the content of the tables.
|
[
"Update",
"the",
"content",
"of",
"the",
"tables",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/HexDumpController.java#L140-L199
|
157,470
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
|
FieldTypeHelper.getInstance
|
public static final FieldType getInstance(int fieldID)
{
FieldType result;
int prefix = fieldID & 0xFFFF0000;
int index = fieldID & 0x0000FFFF;
switch (prefix)
{
case MPPTaskField.TASK_FIELD_BASE:
{
result = MPPTaskField.getInstance(index);
if (result == null)
{
result = getPlaceholder(TaskField.class, index);
}
break;
}
case MPPResourceField.RESOURCE_FIELD_BASE:
{
result = MPPResourceField.getInstance(index);
if (result == null)
{
result = getPlaceholder(ResourceField.class, index);
}
break;
}
case MPPAssignmentField.ASSIGNMENT_FIELD_BASE:
{
result = MPPAssignmentField.getInstance(index);
if (result == null)
{
result = getPlaceholder(AssignmentField.class, index);
}
break;
}
case MPPConstraintField.CONSTRAINT_FIELD_BASE:
{
result = MPPConstraintField.getInstance(index);
if (result == null)
{
result = getPlaceholder(ConstraintField.class, index);
}
break;
}
default:
{
result = getPlaceholder(null, index);
break;
}
}
return result;
}
|
java
|
public static final FieldType getInstance(int fieldID)
{
FieldType result;
int prefix = fieldID & 0xFFFF0000;
int index = fieldID & 0x0000FFFF;
switch (prefix)
{
case MPPTaskField.TASK_FIELD_BASE:
{
result = MPPTaskField.getInstance(index);
if (result == null)
{
result = getPlaceholder(TaskField.class, index);
}
break;
}
case MPPResourceField.RESOURCE_FIELD_BASE:
{
result = MPPResourceField.getInstance(index);
if (result == null)
{
result = getPlaceholder(ResourceField.class, index);
}
break;
}
case MPPAssignmentField.ASSIGNMENT_FIELD_BASE:
{
result = MPPAssignmentField.getInstance(index);
if (result == null)
{
result = getPlaceholder(AssignmentField.class, index);
}
break;
}
case MPPConstraintField.CONSTRAINT_FIELD_BASE:
{
result = MPPConstraintField.getInstance(index);
if (result == null)
{
result = getPlaceholder(ConstraintField.class, index);
}
break;
}
default:
{
result = getPlaceholder(null, index);
break;
}
}
return result;
}
|
[
"public",
"static",
"final",
"FieldType",
"getInstance",
"(",
"int",
"fieldID",
")",
"{",
"FieldType",
"result",
";",
"int",
"prefix",
"=",
"fieldID",
"&",
"0xFFFF0000",
";",
"int",
"index",
"=",
"fieldID",
"&",
"0x0000FFFF",
";",
"switch",
"(",
"prefix",
")",
"{",
"case",
"MPPTaskField",
".",
"TASK_FIELD_BASE",
":",
"{",
"result",
"=",
"MPPTaskField",
".",
"getInstance",
"(",
"index",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getPlaceholder",
"(",
"TaskField",
".",
"class",
",",
"index",
")",
";",
"}",
"break",
";",
"}",
"case",
"MPPResourceField",
".",
"RESOURCE_FIELD_BASE",
":",
"{",
"result",
"=",
"MPPResourceField",
".",
"getInstance",
"(",
"index",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getPlaceholder",
"(",
"ResourceField",
".",
"class",
",",
"index",
")",
";",
"}",
"break",
";",
"}",
"case",
"MPPAssignmentField",
".",
"ASSIGNMENT_FIELD_BASE",
":",
"{",
"result",
"=",
"MPPAssignmentField",
".",
"getInstance",
"(",
"index",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getPlaceholder",
"(",
"AssignmentField",
".",
"class",
",",
"index",
")",
";",
"}",
"break",
";",
"}",
"case",
"MPPConstraintField",
".",
"CONSTRAINT_FIELD_BASE",
":",
"{",
"result",
"=",
"MPPConstraintField",
".",
"getInstance",
"(",
"index",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"getPlaceholder",
"(",
"ConstraintField",
".",
"class",
",",
"index",
")",
";",
"}",
"break",
";",
"}",
"default",
":",
"{",
"result",
"=",
"getPlaceholder",
"(",
"null",
",",
"index",
")",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Retrieve a FieldType instance based on an ID value from
an MPP9 or MPP12 file.
@param fieldID field ID
@return FieldType instance
|
[
"Retrieve",
"a",
"FieldType",
"instance",
"based",
"on",
"an",
"ID",
"value",
"from",
"an",
"MPP9",
"or",
"MPP12",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L87-L143
|
157,471
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
|
FieldTypeHelper.getPlaceholder
|
private static FieldType getPlaceholder(final Class<?> type, final int fieldID)
{
return new FieldType()
{
@Override public FieldTypeClass getFieldTypeClass()
{
return FieldTypeClass.UNKNOWN;
}
@Override public String name()
{
return "UNKNOWN";
}
@Override public int getValue()
{
return fieldID;
}
@Override public String getName()
{
return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")");
}
@Override public String getName(Locale locale)
{
return getName();
}
@Override public DataType getDataType()
{
return null;
}
@Override public FieldType getUnitsType()
{
return null;
}
@Override public String toString()
{
return getName();
}
};
}
|
java
|
private static FieldType getPlaceholder(final Class<?> type, final int fieldID)
{
return new FieldType()
{
@Override public FieldTypeClass getFieldTypeClass()
{
return FieldTypeClass.UNKNOWN;
}
@Override public String name()
{
return "UNKNOWN";
}
@Override public int getValue()
{
return fieldID;
}
@Override public String getName()
{
return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")");
}
@Override public String getName(Locale locale)
{
return getName();
}
@Override public DataType getDataType()
{
return null;
}
@Override public FieldType getUnitsType()
{
return null;
}
@Override public String toString()
{
return getName();
}
};
}
|
[
"private",
"static",
"FieldType",
"getPlaceholder",
"(",
"final",
"Class",
"<",
"?",
">",
"type",
",",
"final",
"int",
"fieldID",
")",
"{",
"return",
"new",
"FieldType",
"(",
")",
"{",
"@",
"Override",
"public",
"FieldTypeClass",
"getFieldTypeClass",
"(",
")",
"{",
"return",
"FieldTypeClass",
".",
"UNKNOWN",
";",
"}",
"@",
"Override",
"public",
"String",
"name",
"(",
")",
"{",
"return",
"\"UNKNOWN\"",
";",
"}",
"@",
"Override",
"public",
"int",
"getValue",
"(",
")",
"{",
"return",
"fieldID",
";",
"}",
"@",
"Override",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"\"Unknown \"",
"+",
"(",
"type",
"==",
"null",
"?",
"\"\"",
":",
"type",
".",
"getSimpleName",
"(",
")",
"+",
"\"(\"",
"+",
"fieldID",
"+",
"\")\"",
")",
";",
"}",
"@",
"Override",
"public",
"String",
"getName",
"(",
"Locale",
"locale",
")",
"{",
"return",
"getName",
"(",
")",
";",
"}",
"@",
"Override",
"public",
"DataType",
"getDataType",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"FieldType",
"getUnitsType",
"(",
")",
"{",
"return",
"null",
";",
"}",
"@",
"Override",
"public",
"String",
"toString",
"(",
")",
"{",
"return",
"getName",
"(",
")",
";",
"}",
"}",
";",
"}"
] |
Generate a placeholder for an unknown type.
@param type expected type
@param fieldID field ID
@return placeholder
|
[
"Generate",
"a",
"placeholder",
"for",
"an",
"unknown",
"type",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L218-L262
|
157,472
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
|
FieldTypeHelper.valueIsNotDefault
|
public static final boolean valueIsNotDefault(FieldType type, Object value)
{
boolean result = true;
if (value == null)
{
result = false;
}
else
{
DataType dataType = type.getDataType();
switch (dataType)
{
case BOOLEAN:
{
result = ((Boolean) value).booleanValue();
break;
}
case CURRENCY:
case NUMERIC:
{
result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001);
break;
}
case DURATION:
{
result = (((Duration) value).getDuration() != 0);
break;
}
default:
{
break;
}
}
}
return result;
}
|
java
|
public static final boolean valueIsNotDefault(FieldType type, Object value)
{
boolean result = true;
if (value == null)
{
result = false;
}
else
{
DataType dataType = type.getDataType();
switch (dataType)
{
case BOOLEAN:
{
result = ((Boolean) value).booleanValue();
break;
}
case CURRENCY:
case NUMERIC:
{
result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001);
break;
}
case DURATION:
{
result = (((Duration) value).getDuration() != 0);
break;
}
default:
{
break;
}
}
}
return result;
}
|
[
"public",
"static",
"final",
"boolean",
"valueIsNotDefault",
"(",
"FieldType",
"type",
",",
"Object",
"value",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"result",
"=",
"false",
";",
"}",
"else",
"{",
"DataType",
"dataType",
"=",
"type",
".",
"getDataType",
"(",
")",
";",
"switch",
"(",
"dataType",
")",
"{",
"case",
"BOOLEAN",
":",
"{",
"result",
"=",
"(",
"(",
"Boolean",
")",
"value",
")",
".",
"booleanValue",
"(",
")",
";",
"break",
";",
"}",
"case",
"CURRENCY",
":",
"case",
"NUMERIC",
":",
"{",
"result",
"=",
"!",
"NumberHelper",
".",
"equals",
"(",
"(",
"(",
"Number",
")",
"value",
")",
".",
"doubleValue",
"(",
")",
",",
"0.0",
",",
"0.00001",
")",
";",
"break",
";",
"}",
"case",
"DURATION",
":",
"{",
"result",
"=",
"(",
"(",
"(",
"Duration",
")",
"value",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"break",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Determines if this value is the default value for the given field type.
@param type field type
@param value value
@return true if the value is not default
|
[
"Determines",
"if",
"this",
"value",
"is",
"the",
"default",
"value",
"for",
"the",
"given",
"field",
"type",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L313-L353
|
157,473
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.readAll
|
public List<ProjectFile> readAll(InputStream is, boolean linkCrossProjectRelations) throws MPXJException
{
try
{
m_tables = new HashMap<String, List<Row>>();
m_numberFormat = new DecimalFormat();
processFile(is);
List<Row> rows = getRows("project", null, null);
List<ProjectFile> result = new ArrayList<ProjectFile>(rows.size());
List<ExternalPredecessorRelation> externalPredecessors = new ArrayList<ExternalPredecessorRelation>();
for (Row row : rows)
{
setProjectID(row.getInt("proj_id"));
m_reader = new PrimaveraReader(m_taskUdfCounters, m_resourceUdfCounters, m_assignmentUdfCounters, m_resourceFields, m_wbsFields, m_taskFields, m_assignmentFields, m_aliases, m_matchPrimaveraWBS);
ProjectFile project = m_reader.getProject();
project.getEventManager().addProjectListeners(m_projectListeners);
processProjectProperties();
processUserDefinedFields();
processCalendars();
processResources();
processResourceRates();
processTasks();
processPredecessors();
processAssignments();
externalPredecessors.addAll(m_reader.getExternalPredecessors());
m_reader = null;
project.updateStructure();
result.add(project);
}
if (linkCrossProjectRelations)
{
for (ExternalPredecessorRelation externalRelation : externalPredecessors)
{
Task predecessorTask;
// we could aggregate the project task id maps but that's likely more work
// than just looping through the projects
for (ProjectFile proj : result)
{
predecessorTask = proj.getTaskByUniqueID(externalRelation.getSourceUniqueID());
if (predecessorTask != null)
{
Relation relation = externalRelation.getTargetTask().addPredecessor(predecessorTask, externalRelation.getType(), externalRelation.getLag());
relation.setUniqueID(externalRelation.getUniqueID());
break;
}
}
// if predecessorTask not found the external task is outside of the file so ignore
}
}
return result;
}
finally
{
m_reader = null;
m_tables = null;
m_currentTableName = null;
m_currentTable = null;
m_currentFieldNames = null;
m_defaultCurrencyName = null;
m_currencyMap.clear();
m_numberFormat = null;
m_defaultCurrencyData = null;
}
}
|
java
|
public List<ProjectFile> readAll(InputStream is, boolean linkCrossProjectRelations) throws MPXJException
{
try
{
m_tables = new HashMap<String, List<Row>>();
m_numberFormat = new DecimalFormat();
processFile(is);
List<Row> rows = getRows("project", null, null);
List<ProjectFile> result = new ArrayList<ProjectFile>(rows.size());
List<ExternalPredecessorRelation> externalPredecessors = new ArrayList<ExternalPredecessorRelation>();
for (Row row : rows)
{
setProjectID(row.getInt("proj_id"));
m_reader = new PrimaveraReader(m_taskUdfCounters, m_resourceUdfCounters, m_assignmentUdfCounters, m_resourceFields, m_wbsFields, m_taskFields, m_assignmentFields, m_aliases, m_matchPrimaveraWBS);
ProjectFile project = m_reader.getProject();
project.getEventManager().addProjectListeners(m_projectListeners);
processProjectProperties();
processUserDefinedFields();
processCalendars();
processResources();
processResourceRates();
processTasks();
processPredecessors();
processAssignments();
externalPredecessors.addAll(m_reader.getExternalPredecessors());
m_reader = null;
project.updateStructure();
result.add(project);
}
if (linkCrossProjectRelations)
{
for (ExternalPredecessorRelation externalRelation : externalPredecessors)
{
Task predecessorTask;
// we could aggregate the project task id maps but that's likely more work
// than just looping through the projects
for (ProjectFile proj : result)
{
predecessorTask = proj.getTaskByUniqueID(externalRelation.getSourceUniqueID());
if (predecessorTask != null)
{
Relation relation = externalRelation.getTargetTask().addPredecessor(predecessorTask, externalRelation.getType(), externalRelation.getLag());
relation.setUniqueID(externalRelation.getUniqueID());
break;
}
}
// if predecessorTask not found the external task is outside of the file so ignore
}
}
return result;
}
finally
{
m_reader = null;
m_tables = null;
m_currentTableName = null;
m_currentTable = null;
m_currentFieldNames = null;
m_defaultCurrencyName = null;
m_currencyMap.clear();
m_numberFormat = null;
m_defaultCurrencyData = null;
}
}
|
[
"public",
"List",
"<",
"ProjectFile",
">",
"readAll",
"(",
"InputStream",
"is",
",",
"boolean",
"linkCrossProjectRelations",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"m_tables",
"=",
"new",
"HashMap",
"<",
"String",
",",
"List",
"<",
"Row",
">",
">",
"(",
")",
";",
"m_numberFormat",
"=",
"new",
"DecimalFormat",
"(",
")",
";",
"processFile",
"(",
"is",
")",
";",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"project\"",
",",
"null",
",",
"null",
")",
";",
"List",
"<",
"ProjectFile",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"ProjectFile",
">",
"(",
"rows",
".",
"size",
"(",
")",
")",
";",
"List",
"<",
"ExternalPredecessorRelation",
">",
"externalPredecessors",
"=",
"new",
"ArrayList",
"<",
"ExternalPredecessorRelation",
">",
"(",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"setProjectID",
"(",
"row",
".",
"getInt",
"(",
"\"proj_id\"",
")",
")",
";",
"m_reader",
"=",
"new",
"PrimaveraReader",
"(",
"m_taskUdfCounters",
",",
"m_resourceUdfCounters",
",",
"m_assignmentUdfCounters",
",",
"m_resourceFields",
",",
"m_wbsFields",
",",
"m_taskFields",
",",
"m_assignmentFields",
",",
"m_aliases",
",",
"m_matchPrimaveraWBS",
")",
";",
"ProjectFile",
"project",
"=",
"m_reader",
".",
"getProject",
"(",
")",
";",
"project",
".",
"getEventManager",
"(",
")",
".",
"addProjectListeners",
"(",
"m_projectListeners",
")",
";",
"processProjectProperties",
"(",
")",
";",
"processUserDefinedFields",
"(",
")",
";",
"processCalendars",
"(",
")",
";",
"processResources",
"(",
")",
";",
"processResourceRates",
"(",
")",
";",
"processTasks",
"(",
")",
";",
"processPredecessors",
"(",
")",
";",
"processAssignments",
"(",
")",
";",
"externalPredecessors",
".",
"addAll",
"(",
"m_reader",
".",
"getExternalPredecessors",
"(",
")",
")",
";",
"m_reader",
"=",
"null",
";",
"project",
".",
"updateStructure",
"(",
")",
";",
"result",
".",
"add",
"(",
"project",
")",
";",
"}",
"if",
"(",
"linkCrossProjectRelations",
")",
"{",
"for",
"(",
"ExternalPredecessorRelation",
"externalRelation",
":",
"externalPredecessors",
")",
"{",
"Task",
"predecessorTask",
";",
"// we could aggregate the project task id maps but that's likely more work",
"// than just looping through the projects",
"for",
"(",
"ProjectFile",
"proj",
":",
"result",
")",
"{",
"predecessorTask",
"=",
"proj",
".",
"getTaskByUniqueID",
"(",
"externalRelation",
".",
"getSourceUniqueID",
"(",
")",
")",
";",
"if",
"(",
"predecessorTask",
"!=",
"null",
")",
"{",
"Relation",
"relation",
"=",
"externalRelation",
".",
"getTargetTask",
"(",
")",
".",
"addPredecessor",
"(",
"predecessorTask",
",",
"externalRelation",
".",
"getType",
"(",
")",
",",
"externalRelation",
".",
"getLag",
"(",
")",
")",
";",
"relation",
".",
"setUniqueID",
"(",
"externalRelation",
".",
"getUniqueID",
"(",
")",
")",
";",
"break",
";",
"}",
"}",
"// if predecessorTask not found the external task is outside of the file so ignore",
"}",
"}",
"return",
"result",
";",
"}",
"finally",
"{",
"m_reader",
"=",
"null",
";",
"m_tables",
"=",
"null",
";",
"m_currentTableName",
"=",
"null",
";",
"m_currentTable",
"=",
"null",
";",
"m_currentFieldNames",
"=",
"null",
";",
"m_defaultCurrencyName",
"=",
"null",
";",
"m_currencyMap",
".",
"clear",
"(",
")",
";",
"m_numberFormat",
"=",
"null",
";",
"m_defaultCurrencyData",
"=",
"null",
";",
"}",
"}"
] |
This is a convenience method which allows all projects in an
XER file to be read in a single pass.
@param is input stream
@param linkCrossProjectRelations add Relation links that cross ProjectFile boundaries
@return list of ProjectFile instances
@throws MPXJException
|
[
"This",
"is",
"a",
"convenience",
"method",
"which",
"allows",
"all",
"projects",
"in",
"an",
"XER",
"file",
"to",
"be",
"read",
"in",
"a",
"single",
"pass",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L177-L250
|
157,474
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.processFile
|
private void processFile(InputStream is) throws MPXJException
{
int line = 1;
try
{
//
// Test the header and extract the separator. If this is successful,
// we reset the stream back as far as we can. The design of the
// BufferedInputStream class means that we can't get back to character
// zero, so the first record we will read will get "RMHDR" rather than
// "ERMHDR" in the first field position.
//
BufferedInputStream bis = new BufferedInputStream(is);
byte[] data = new byte[6];
data[0] = (byte) bis.read();
bis.mark(1024);
bis.read(data, 1, 5);
if (!new String(data).equals("ERMHDR"))
{
throw new MPXJException(MPXJException.INVALID_FILE);
}
bis.reset();
InputStreamReader reader = new InputStreamReader(bis, getCharset());
Tokenizer tk = new ReaderTokenizer(reader);
tk.setDelimiter('\t');
List<String> record = new ArrayList<String>();
while (tk.getType() != Tokenizer.TT_EOF)
{
readRecord(tk, record);
if (!record.isEmpty())
{
if (processRecord(record))
{
break;
}
}
++line;
}
}
catch (Exception ex)
{
throw new MPXJException(MPXJException.READ_ERROR + " (failed at line " + line + ")", ex);
}
}
|
java
|
private void processFile(InputStream is) throws MPXJException
{
int line = 1;
try
{
//
// Test the header and extract the separator. If this is successful,
// we reset the stream back as far as we can. The design of the
// BufferedInputStream class means that we can't get back to character
// zero, so the first record we will read will get "RMHDR" rather than
// "ERMHDR" in the first field position.
//
BufferedInputStream bis = new BufferedInputStream(is);
byte[] data = new byte[6];
data[0] = (byte) bis.read();
bis.mark(1024);
bis.read(data, 1, 5);
if (!new String(data).equals("ERMHDR"))
{
throw new MPXJException(MPXJException.INVALID_FILE);
}
bis.reset();
InputStreamReader reader = new InputStreamReader(bis, getCharset());
Tokenizer tk = new ReaderTokenizer(reader);
tk.setDelimiter('\t');
List<String> record = new ArrayList<String>();
while (tk.getType() != Tokenizer.TT_EOF)
{
readRecord(tk, record);
if (!record.isEmpty())
{
if (processRecord(record))
{
break;
}
}
++line;
}
}
catch (Exception ex)
{
throw new MPXJException(MPXJException.READ_ERROR + " (failed at line " + line + ")", ex);
}
}
|
[
"private",
"void",
"processFile",
"(",
"InputStream",
"is",
")",
"throws",
"MPXJException",
"{",
"int",
"line",
"=",
"1",
";",
"try",
"{",
"//",
"// Test the header and extract the separator. If this is successful,",
"// we reset the stream back as far as we can. The design of the",
"// BufferedInputStream class means that we can't get back to character",
"// zero, so the first record we will read will get \"RMHDR\" rather than",
"// \"ERMHDR\" in the first field position.",
"//",
"BufferedInputStream",
"bis",
"=",
"new",
"BufferedInputStream",
"(",
"is",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"6",
"]",
";",
"data",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"bis",
".",
"read",
"(",
")",
";",
"bis",
".",
"mark",
"(",
"1024",
")",
";",
"bis",
".",
"read",
"(",
"data",
",",
"1",
",",
"5",
")",
";",
"if",
"(",
"!",
"new",
"String",
"(",
"data",
")",
".",
"equals",
"(",
"\"ERMHDR\"",
")",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"INVALID_FILE",
")",
";",
"}",
"bis",
".",
"reset",
"(",
")",
";",
"InputStreamReader",
"reader",
"=",
"new",
"InputStreamReader",
"(",
"bis",
",",
"getCharset",
"(",
")",
")",
";",
"Tokenizer",
"tk",
"=",
"new",
"ReaderTokenizer",
"(",
"reader",
")",
";",
"tk",
".",
"setDelimiter",
"(",
"'",
"'",
")",
";",
"List",
"<",
"String",
">",
"record",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"while",
"(",
"tk",
".",
"getType",
"(",
")",
"!=",
"Tokenizer",
".",
"TT_EOF",
")",
"{",
"readRecord",
"(",
"tk",
",",
"record",
")",
";",
"if",
"(",
"!",
"record",
".",
"isEmpty",
"(",
")",
")",
"{",
"if",
"(",
"processRecord",
"(",
"record",
")",
")",
"{",
"break",
";",
"}",
"}",
"++",
"line",
";",
"}",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"READ_ERROR",
"+",
"\" (failed at line \"",
"+",
"line",
"+",
"\")\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Reads the XER file table and row structure ready for processing.
@param is input stream
@throws MPXJException
|
[
"Reads",
"the",
"XER",
"file",
"table",
"and",
"row",
"structure",
"ready",
"for",
"processing",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L258-L307
|
157,475
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.getCharset
|
private Charset getCharset()
{
Charset result = m_charset;
if (result == null)
{
// We default to CP1252 as this seems to be the most common encoding
result = m_encoding == null ? CharsetHelper.CP1252 : Charset.forName(m_encoding);
}
return result;
}
|
java
|
private Charset getCharset()
{
Charset result = m_charset;
if (result == null)
{
// We default to CP1252 as this seems to be the most common encoding
result = m_encoding == null ? CharsetHelper.CP1252 : Charset.forName(m_encoding);
}
return result;
}
|
[
"private",
"Charset",
"getCharset",
"(",
")",
"{",
"Charset",
"result",
"=",
"m_charset",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"// We default to CP1252 as this seems to be the most common encoding",
"result",
"=",
"m_encoding",
"==",
"null",
"?",
"CharsetHelper",
".",
"CP1252",
":",
"Charset",
".",
"forName",
"(",
"m_encoding",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Retrieve the Charset used to read the file.
@return Charset instance
|
[
"Retrieve",
"the",
"Charset",
"used",
"to",
"read",
"the",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L314-L323
|
157,476
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.processProjectID
|
private void processProjectID()
{
if (m_projectID == null)
{
List<Row> rows = getRows("project", null, null);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_projectID = row.getInteger("proj_id");
}
}
}
|
java
|
private void processProjectID()
{
if (m_projectID == null)
{
List<Row> rows = getRows("project", null, null);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_projectID = row.getInteger("proj_id");
}
}
}
|
[
"private",
"void",
"processProjectID",
"(",
")",
"{",
"if",
"(",
"m_projectID",
"==",
"null",
")",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"project\"",
",",
"null",
",",
"null",
")",
";",
"if",
"(",
"!",
"rows",
".",
"isEmpty",
"(",
")",
")",
"{",
"Row",
"row",
"=",
"rows",
".",
"get",
"(",
"0",
")",
";",
"m_projectID",
"=",
"row",
".",
"getInteger",
"(",
"\"proj_id\"",
")",
";",
"}",
"}",
"}"
] |
If the user has not specified a project ID, this method
retrieves the ID of the first project in the file.
|
[
"If",
"the",
"user",
"has",
"not",
"specified",
"a",
"project",
"ID",
"this",
"method",
"retrieves",
"the",
"ID",
"of",
"the",
"first",
"project",
"in",
"the",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L329-L340
|
157,477
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.processCurrency
|
private void processCurrency(Row row)
{
String currencyName = row.getString("curr_short_name");
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(row.getString("decimal_symbol").charAt(0));
symbols.setGroupingSeparator(row.getString("digit_group_symbol").charAt(0));
DecimalFormat nf = new DecimalFormat();
nf.setDecimalFormatSymbols(symbols);
nf.applyPattern("#.#");
m_currencyMap.put(currencyName, nf);
if (currencyName.equalsIgnoreCase(m_defaultCurrencyName))
{
m_numberFormat = nf;
m_defaultCurrencyData = row;
}
}
|
java
|
private void processCurrency(Row row)
{
String currencyName = row.getString("curr_short_name");
DecimalFormatSymbols symbols = new DecimalFormatSymbols();
symbols.setDecimalSeparator(row.getString("decimal_symbol").charAt(0));
symbols.setGroupingSeparator(row.getString("digit_group_symbol").charAt(0));
DecimalFormat nf = new DecimalFormat();
nf.setDecimalFormatSymbols(symbols);
nf.applyPattern("#.#");
m_currencyMap.put(currencyName, nf);
if (currencyName.equalsIgnoreCase(m_defaultCurrencyName))
{
m_numberFormat = nf;
m_defaultCurrencyData = row;
}
}
|
[
"private",
"void",
"processCurrency",
"(",
"Row",
"row",
")",
"{",
"String",
"currencyName",
"=",
"row",
".",
"getString",
"(",
"\"curr_short_name\"",
")",
";",
"DecimalFormatSymbols",
"symbols",
"=",
"new",
"DecimalFormatSymbols",
"(",
")",
";",
"symbols",
".",
"setDecimalSeparator",
"(",
"row",
".",
"getString",
"(",
"\"decimal_symbol\"",
")",
".",
"charAt",
"(",
"0",
")",
")",
";",
"symbols",
".",
"setGroupingSeparator",
"(",
"row",
".",
"getString",
"(",
"\"digit_group_symbol\"",
")",
".",
"charAt",
"(",
"0",
")",
")",
";",
"DecimalFormat",
"nf",
"=",
"new",
"DecimalFormat",
"(",
")",
";",
"nf",
".",
"setDecimalFormatSymbols",
"(",
"symbols",
")",
";",
"nf",
".",
"applyPattern",
"(",
"\"#.#\"",
")",
";",
"m_currencyMap",
".",
"put",
"(",
"currencyName",
",",
"nf",
")",
";",
"if",
"(",
"currencyName",
".",
"equalsIgnoreCase",
"(",
"m_defaultCurrencyName",
")",
")",
"{",
"m_numberFormat",
"=",
"nf",
";",
"m_defaultCurrencyData",
"=",
"row",
";",
"}",
"}"
] |
Process a currency definition.
@param row record from XER file
|
[
"Process",
"a",
"currency",
"definition",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L347-L363
|
157,478
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.listProjects
|
public Map<Integer, String> listProjects(InputStream is) throws MPXJException
{
try
{
m_tables = new HashMap<String, List<Row>>();
processFile(is);
Map<Integer, String> result = new HashMap<Integer, String>();
List<Row> rows = getRows("project", null, null);
for (Row row : rows)
{
Integer id = row.getInteger("proj_id");
String name = row.getString("proj_short_name");
result.put(id, name);
}
return result;
}
finally
{
m_tables = null;
m_currentTable = null;
m_currentFieldNames = null;
}
}
|
java
|
public Map<Integer, String> listProjects(InputStream is) throws MPXJException
{
try
{
m_tables = new HashMap<String, List<Row>>();
processFile(is);
Map<Integer, String> result = new HashMap<Integer, String>();
List<Row> rows = getRows("project", null, null);
for (Row row : rows)
{
Integer id = row.getInteger("proj_id");
String name = row.getString("proj_short_name");
result.put(id, name);
}
return result;
}
finally
{
m_tables = null;
m_currentTable = null;
m_currentFieldNames = null;
}
}
|
[
"public",
"Map",
"<",
"Integer",
",",
"String",
">",
"listProjects",
"(",
"InputStream",
"is",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"m_tables",
"=",
"new",
"HashMap",
"<",
"String",
",",
"List",
"<",
"Row",
">",
">",
"(",
")",
";",
"processFile",
"(",
"is",
")",
";",
"Map",
"<",
"Integer",
",",
"String",
">",
"result",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"String",
">",
"(",
")",
";",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"project\"",
",",
"null",
",",
"null",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Integer",
"id",
"=",
"row",
".",
"getInteger",
"(",
"\"proj_id\"",
")",
";",
"String",
"name",
"=",
"row",
".",
"getString",
"(",
"\"proj_short_name\"",
")",
";",
"result",
".",
"put",
"(",
"id",
",",
"name",
")",
";",
"}",
"return",
"result",
";",
"}",
"finally",
"{",
"m_tables",
"=",
"null",
";",
"m_currentTable",
"=",
"null",
";",
"m_currentFieldNames",
"=",
"null",
";",
"}",
"}"
] |
Populates a Map instance representing the IDs and names of
projects available in the current file.
@param is input stream used to read XER file
@return Map instance containing ID and name pairs
@throws MPXJException
|
[
"Populates",
"a",
"Map",
"instance",
"representing",
"the",
"IDs",
"and",
"names",
"of",
"projects",
"available",
"in",
"the",
"current",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L373-L399
|
157,479
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.processScheduleOptions
|
private void processScheduleOptions()
{
List<Row> rows = getRows("schedoptions", "proj_id", m_projectID);
if (rows.isEmpty() == false)
{
Row row = rows.get(0);
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", row.getString("sched_calendar_on_relationship_lag"));
customProperties.put("RetainedLogic", Boolean.valueOf(row.getBoolean("sched_retained_logic")));
customProperties.put("ProgressOverride", Boolean.valueOf(row.getBoolean("sched_progress_override")));
customProperties.put("IgnoreOtherProjectRelationships", row.getString("sched_outer_depend_type"));
customProperties.put("StartToStartLagCalculationType", Boolean.valueOf(row.getBoolean("sched_lag_early_start_flag")));
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
}
}
|
java
|
private void processScheduleOptions()
{
List<Row> rows = getRows("schedoptions", "proj_id", m_projectID);
if (rows.isEmpty() == false)
{
Row row = rows.get(0);
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", row.getString("sched_calendar_on_relationship_lag"));
customProperties.put("RetainedLogic", Boolean.valueOf(row.getBoolean("sched_retained_logic")));
customProperties.put("ProgressOverride", Boolean.valueOf(row.getBoolean("sched_progress_override")));
customProperties.put("IgnoreOtherProjectRelationships", row.getString("sched_outer_depend_type"));
customProperties.put("StartToStartLagCalculationType", Boolean.valueOf(row.getBoolean("sched_lag_early_start_flag")));
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
}
}
|
[
"private",
"void",
"processScheduleOptions",
"(",
")",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"schedoptions\"",
",",
"\"proj_id\"",
",",
"m_projectID",
")",
";",
"if",
"(",
"rows",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"Row",
"row",
"=",
"rows",
".",
"get",
"(",
"0",
")",
";",
"Map",
"<",
"String",
",",
"Object",
">",
"customProperties",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"customProperties",
".",
"put",
"(",
"\"LagCalendar\"",
",",
"row",
".",
"getString",
"(",
"\"sched_calendar_on_relationship_lag\"",
")",
")",
";",
"customProperties",
".",
"put",
"(",
"\"RetainedLogic\"",
",",
"Boolean",
".",
"valueOf",
"(",
"row",
".",
"getBoolean",
"(",
"\"sched_retained_logic\"",
")",
")",
")",
";",
"customProperties",
".",
"put",
"(",
"\"ProgressOverride\"",
",",
"Boolean",
".",
"valueOf",
"(",
"row",
".",
"getBoolean",
"(",
"\"sched_progress_override\"",
")",
")",
")",
";",
"customProperties",
".",
"put",
"(",
"\"IgnoreOtherProjectRelationships\"",
",",
"row",
".",
"getString",
"(",
"\"sched_outer_depend_type\"",
")",
")",
";",
"customProperties",
".",
"put",
"(",
"\"StartToStartLagCalculationType\"",
",",
"Boolean",
".",
"valueOf",
"(",
"row",
".",
"getBoolean",
"(",
"\"sched_lag_early_start_flag\"",
")",
")",
")",
";",
"m_reader",
".",
"getProject",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"setCustomProperties",
"(",
"customProperties",
")",
";",
"}",
"}"
] |
Process schedule options from SCHEDOPTIONS. This table only seems to exist
in XER files, not P6 databases.
|
[
"Process",
"schedule",
"options",
"from",
"SCHEDOPTIONS",
".",
"This",
"table",
"only",
"seems",
"to",
"exist",
"in",
"XER",
"files",
"not",
"P6",
"databases",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L438-L452
|
157,480
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.readRecord
|
private void readRecord(Tokenizer tk, List<String> record) throws IOException
{
record.clear();
while (tk.nextToken() == Tokenizer.TT_WORD)
{
record.add(tk.getToken());
}
}
|
java
|
private void readRecord(Tokenizer tk, List<String> record) throws IOException
{
record.clear();
while (tk.nextToken() == Tokenizer.TT_WORD)
{
record.add(tk.getToken());
}
}
|
[
"private",
"void",
"readRecord",
"(",
"Tokenizer",
"tk",
",",
"List",
"<",
"String",
">",
"record",
")",
"throws",
"IOException",
"{",
"record",
".",
"clear",
"(",
")",
";",
"while",
"(",
"tk",
".",
"nextToken",
"(",
")",
"==",
"Tokenizer",
".",
"TT_WORD",
")",
"{",
"record",
".",
"add",
"(",
"tk",
".",
"getToken",
"(",
")",
")",
";",
"}",
"}"
] |
Reads each token from a single record and adds it to a list.
@param tk tokenizer
@param record list of tokens
@throws IOException
|
[
"Reads",
"each",
"token",
"from",
"a",
"single",
"record",
"and",
"adds",
"it",
"to",
"a",
"list",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L529-L536
|
157,481
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.processRecord
|
private boolean processRecord(List<String> record) throws MPXJException
{
boolean done = false;
XerRecordType type = RECORD_TYPE_MAP.get(record.get(0));
if (type == null)
{
throw new MPXJException(MPXJException.INVALID_FORMAT);
}
switch (type)
{
case HEADER:
{
processHeader(record);
break;
}
case TABLE:
{
m_currentTableName = record.get(1).toLowerCase();
m_skipTable = !REQUIRED_TABLES.contains(m_currentTableName);
if (m_skipTable)
{
m_currentTable = null;
}
else
{
m_currentTable = new LinkedList<Row>();
m_tables.put(m_currentTableName, m_currentTable);
}
break;
}
case FIELDS:
{
if (m_skipTable)
{
m_currentFieldNames = null;
}
else
{
m_currentFieldNames = record.toArray(new String[record.size()]);
for (int loop = 0; loop < m_currentFieldNames.length; loop++)
{
m_currentFieldNames[loop] = m_currentFieldNames[loop].toLowerCase();
}
}
break;
}
case DATA:
{
if (!m_skipTable)
{
Map<String, Object> map = new HashMap<String, Object>();
for (int loop = 1; loop < record.size(); loop++)
{
String fieldName = m_currentFieldNames[loop];
String fieldValue = record.get(loop);
XerFieldType fieldType = FIELD_TYPE_MAP.get(fieldName);
if (fieldType == null)
{
fieldType = XerFieldType.STRING;
}
Object objectValue;
if (fieldValue.length() == 0)
{
objectValue = null;
}
else
{
switch (fieldType)
{
case DATE:
{
try
{
objectValue = m_df.parseObject(fieldValue);
}
catch (ParseException ex)
{
objectValue = fieldValue;
}
break;
}
case CURRENCY:
case DOUBLE:
case DURATION:
{
try
{
objectValue = Double.valueOf(m_numberFormat.parse(fieldValue.trim()).doubleValue());
}
catch (ParseException ex)
{
objectValue = fieldValue;
}
break;
}
case INTEGER:
{
objectValue = Integer.valueOf(fieldValue.trim());
break;
}
default:
{
objectValue = fieldValue;
break;
}
}
}
map.put(fieldName, objectValue);
}
Row currentRow = new MapRow(map);
m_currentTable.add(currentRow);
//
// Special case - we need to know the default currency format
// ahead of time, so process each row as we get it so that
// we can correctly parse currency values in later tables.
//
if (m_currentTableName.equals("currtype"))
{
processCurrency(currentRow);
}
}
break;
}
case END:
{
done = true;
break;
}
default:
{
break;
}
}
return done;
}
|
java
|
private boolean processRecord(List<String> record) throws MPXJException
{
boolean done = false;
XerRecordType type = RECORD_TYPE_MAP.get(record.get(0));
if (type == null)
{
throw new MPXJException(MPXJException.INVALID_FORMAT);
}
switch (type)
{
case HEADER:
{
processHeader(record);
break;
}
case TABLE:
{
m_currentTableName = record.get(1).toLowerCase();
m_skipTable = !REQUIRED_TABLES.contains(m_currentTableName);
if (m_skipTable)
{
m_currentTable = null;
}
else
{
m_currentTable = new LinkedList<Row>();
m_tables.put(m_currentTableName, m_currentTable);
}
break;
}
case FIELDS:
{
if (m_skipTable)
{
m_currentFieldNames = null;
}
else
{
m_currentFieldNames = record.toArray(new String[record.size()]);
for (int loop = 0; loop < m_currentFieldNames.length; loop++)
{
m_currentFieldNames[loop] = m_currentFieldNames[loop].toLowerCase();
}
}
break;
}
case DATA:
{
if (!m_skipTable)
{
Map<String, Object> map = new HashMap<String, Object>();
for (int loop = 1; loop < record.size(); loop++)
{
String fieldName = m_currentFieldNames[loop];
String fieldValue = record.get(loop);
XerFieldType fieldType = FIELD_TYPE_MAP.get(fieldName);
if (fieldType == null)
{
fieldType = XerFieldType.STRING;
}
Object objectValue;
if (fieldValue.length() == 0)
{
objectValue = null;
}
else
{
switch (fieldType)
{
case DATE:
{
try
{
objectValue = m_df.parseObject(fieldValue);
}
catch (ParseException ex)
{
objectValue = fieldValue;
}
break;
}
case CURRENCY:
case DOUBLE:
case DURATION:
{
try
{
objectValue = Double.valueOf(m_numberFormat.parse(fieldValue.trim()).doubleValue());
}
catch (ParseException ex)
{
objectValue = fieldValue;
}
break;
}
case INTEGER:
{
objectValue = Integer.valueOf(fieldValue.trim());
break;
}
default:
{
objectValue = fieldValue;
break;
}
}
}
map.put(fieldName, objectValue);
}
Row currentRow = new MapRow(map);
m_currentTable.add(currentRow);
//
// Special case - we need to know the default currency format
// ahead of time, so process each row as we get it so that
// we can correctly parse currency values in later tables.
//
if (m_currentTableName.equals("currtype"))
{
processCurrency(currentRow);
}
}
break;
}
case END:
{
done = true;
break;
}
default:
{
break;
}
}
return done;
}
|
[
"private",
"boolean",
"processRecord",
"(",
"List",
"<",
"String",
">",
"record",
")",
"throws",
"MPXJException",
"{",
"boolean",
"done",
"=",
"false",
";",
"XerRecordType",
"type",
"=",
"RECORD_TYPE_MAP",
".",
"get",
"(",
"record",
".",
"get",
"(",
"0",
")",
")",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"INVALID_FORMAT",
")",
";",
"}",
"switch",
"(",
"type",
")",
"{",
"case",
"HEADER",
":",
"{",
"processHeader",
"(",
"record",
")",
";",
"break",
";",
"}",
"case",
"TABLE",
":",
"{",
"m_currentTableName",
"=",
"record",
".",
"get",
"(",
"1",
")",
".",
"toLowerCase",
"(",
")",
";",
"m_skipTable",
"=",
"!",
"REQUIRED_TABLES",
".",
"contains",
"(",
"m_currentTableName",
")",
";",
"if",
"(",
"m_skipTable",
")",
"{",
"m_currentTable",
"=",
"null",
";",
"}",
"else",
"{",
"m_currentTable",
"=",
"new",
"LinkedList",
"<",
"Row",
">",
"(",
")",
";",
"m_tables",
".",
"put",
"(",
"m_currentTableName",
",",
"m_currentTable",
")",
";",
"}",
"break",
";",
"}",
"case",
"FIELDS",
":",
"{",
"if",
"(",
"m_skipTable",
")",
"{",
"m_currentFieldNames",
"=",
"null",
";",
"}",
"else",
"{",
"m_currentFieldNames",
"=",
"record",
".",
"toArray",
"(",
"new",
"String",
"[",
"record",
".",
"size",
"(",
")",
"]",
")",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"m_currentFieldNames",
".",
"length",
";",
"loop",
"++",
")",
"{",
"m_currentFieldNames",
"[",
"loop",
"]",
"=",
"m_currentFieldNames",
"[",
"loop",
"]",
".",
"toLowerCase",
"(",
")",
";",
"}",
"}",
"break",
";",
"}",
"case",
"DATA",
":",
"{",
"if",
"(",
"!",
"m_skipTable",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"for",
"(",
"int",
"loop",
"=",
"1",
";",
"loop",
"<",
"record",
".",
"size",
"(",
")",
";",
"loop",
"++",
")",
"{",
"String",
"fieldName",
"=",
"m_currentFieldNames",
"[",
"loop",
"]",
";",
"String",
"fieldValue",
"=",
"record",
".",
"get",
"(",
"loop",
")",
";",
"XerFieldType",
"fieldType",
"=",
"FIELD_TYPE_MAP",
".",
"get",
"(",
"fieldName",
")",
";",
"if",
"(",
"fieldType",
"==",
"null",
")",
"{",
"fieldType",
"=",
"XerFieldType",
".",
"STRING",
";",
"}",
"Object",
"objectValue",
";",
"if",
"(",
"fieldValue",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"objectValue",
"=",
"null",
";",
"}",
"else",
"{",
"switch",
"(",
"fieldType",
")",
"{",
"case",
"DATE",
":",
"{",
"try",
"{",
"objectValue",
"=",
"m_df",
".",
"parseObject",
"(",
"fieldValue",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"objectValue",
"=",
"fieldValue",
";",
"}",
"break",
";",
"}",
"case",
"CURRENCY",
":",
"case",
"DOUBLE",
":",
"case",
"DURATION",
":",
"{",
"try",
"{",
"objectValue",
"=",
"Double",
".",
"valueOf",
"(",
"m_numberFormat",
".",
"parse",
"(",
"fieldValue",
".",
"trim",
"(",
")",
")",
".",
"doubleValue",
"(",
")",
")",
";",
"}",
"catch",
"(",
"ParseException",
"ex",
")",
"{",
"objectValue",
"=",
"fieldValue",
";",
"}",
"break",
";",
"}",
"case",
"INTEGER",
":",
"{",
"objectValue",
"=",
"Integer",
".",
"valueOf",
"(",
"fieldValue",
".",
"trim",
"(",
")",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"objectValue",
"=",
"fieldValue",
";",
"break",
";",
"}",
"}",
"}",
"map",
".",
"put",
"(",
"fieldName",
",",
"objectValue",
")",
";",
"}",
"Row",
"currentRow",
"=",
"new",
"MapRow",
"(",
"map",
")",
";",
"m_currentTable",
".",
"add",
"(",
"currentRow",
")",
";",
"//",
"// Special case - we need to know the default currency format",
"// ahead of time, so process each row as we get it so that",
"// we can correctly parse currency values in later tables.",
"//",
"if",
"(",
"m_currentTableName",
".",
"equals",
"(",
"\"currtype\"",
")",
")",
"{",
"processCurrency",
"(",
"currentRow",
")",
";",
"}",
"}",
"break",
";",
"}",
"case",
"END",
":",
"{",
"done",
"=",
"true",
";",
"break",
";",
"}",
"default",
":",
"{",
"break",
";",
"}",
"}",
"return",
"done",
";",
"}"
] |
Handles a complete record at a time, stores it in a form ready for
further processing.
@param record record to be processed
@return flag indicating if this is the last record in the file to be processed
@throws MPXJException
|
[
"Handles",
"a",
"complete",
"record",
"at",
"a",
"time",
"stores",
"it",
"in",
"a",
"form",
"ready",
"for",
"further",
"processing",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L546-L698
|
157,482
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
|
PrimaveraXERFileReader.getRows
|
private List<Row> getRows(String tableName, String columnName, Integer id)
{
List<Row> result;
List<Row> table = m_tables.get(tableName);
if (table == null)
{
result = Collections.<Row> emptyList();
}
else
{
if (columnName == null)
{
result = table;
}
else
{
result = new LinkedList<Row>();
for (Row row : table)
{
if (NumberHelper.equals(id, row.getInteger(columnName)))
{
result.add(row);
}
}
}
}
return result;
}
|
java
|
private List<Row> getRows(String tableName, String columnName, Integer id)
{
List<Row> result;
List<Row> table = m_tables.get(tableName);
if (table == null)
{
result = Collections.<Row> emptyList();
}
else
{
if (columnName == null)
{
result = table;
}
else
{
result = new LinkedList<Row>();
for (Row row : table)
{
if (NumberHelper.equals(id, row.getInteger(columnName)))
{
result.add(row);
}
}
}
}
return result;
}
|
[
"private",
"List",
"<",
"Row",
">",
"getRows",
"(",
"String",
"tableName",
",",
"String",
"columnName",
",",
"Integer",
"id",
")",
"{",
"List",
"<",
"Row",
">",
"result",
";",
"List",
"<",
"Row",
">",
"table",
"=",
"m_tables",
".",
"get",
"(",
"tableName",
")",
";",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"result",
"=",
"Collections",
".",
"<",
"Row",
">",
"emptyList",
"(",
")",
";",
"}",
"else",
"{",
"if",
"(",
"columnName",
"==",
"null",
")",
"{",
"result",
"=",
"table",
";",
"}",
"else",
"{",
"result",
"=",
"new",
"LinkedList",
"<",
"Row",
">",
"(",
")",
";",
"for",
"(",
"Row",
"row",
":",
"table",
")",
"{",
"if",
"(",
"NumberHelper",
".",
"equals",
"(",
"id",
",",
"row",
".",
"getInteger",
"(",
"columnName",
")",
")",
")",
"{",
"result",
".",
"add",
"(",
"row",
")",
";",
"}",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Filters a list of rows from the named table. If a column name and a value
are supplied, then use this to filter the rows. If no column name is
supplied, then return all rows.
@param tableName table name
@param columnName filter column name
@param id filter column value
@return filtered list of rows
|
[
"Filters",
"a",
"list",
"of",
"rows",
"from",
"the",
"named",
"table",
".",
"If",
"a",
"column",
"name",
"and",
"a",
"value",
"are",
"supplied",
"then",
"use",
"this",
"to",
"filter",
"the",
"rows",
".",
"If",
"no",
"column",
"name",
"is",
"supplied",
"then",
"return",
"all",
"rows",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L803-L830
|
157,483
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader.java
|
CustomFieldValueReader.getTypedValue
|
protected Object getTypedValue(int type, byte[] value)
{
Object result;
switch (type)
{
case 4: // Date
{
result = MPPUtility.getTimestamp(value, 0);
break;
}
case 6: // Duration
{
TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits());
result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units);
break;
}
case 9: // Cost
{
result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100);
break;
}
case 15: // Number
{
result = Double.valueOf(MPPUtility.getDouble(value, 0));
break;
}
case 36058:
case 21: // Text
{
result = MPPUtility.getUnicodeString(value, 0);
break;
}
default:
{
result = value;
break;
}
}
return result;
}
|
java
|
protected Object getTypedValue(int type, byte[] value)
{
Object result;
switch (type)
{
case 4: // Date
{
result = MPPUtility.getTimestamp(value, 0);
break;
}
case 6: // Duration
{
TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits());
result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units);
break;
}
case 9: // Cost
{
result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100);
break;
}
case 15: // Number
{
result = Double.valueOf(MPPUtility.getDouble(value, 0));
break;
}
case 36058:
case 21: // Text
{
result = MPPUtility.getUnicodeString(value, 0);
break;
}
default:
{
result = value;
break;
}
}
return result;
}
|
[
"protected",
"Object",
"getTypedValue",
"(",
"int",
"type",
",",
"byte",
"[",
"]",
"value",
")",
"{",
"Object",
"result",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"4",
":",
"// Date",
"{",
"result",
"=",
"MPPUtility",
".",
"getTimestamp",
"(",
"value",
",",
"0",
")",
";",
"break",
";",
"}",
"case",
"6",
":",
"// Duration",
"{",
"TimeUnit",
"units",
"=",
"MPPUtility",
".",
"getDurationTimeUnits",
"(",
"MPPUtility",
".",
"getShort",
"(",
"value",
",",
"4",
")",
",",
"m_properties",
".",
"getDefaultDurationUnits",
"(",
")",
")",
";",
"result",
"=",
"MPPUtility",
".",
"getAdjustedDuration",
"(",
"m_properties",
",",
"MPPUtility",
".",
"getInt",
"(",
"value",
",",
"0",
")",
",",
"units",
")",
";",
"break",
";",
"}",
"case",
"9",
":",
"// Cost",
"{",
"result",
"=",
"Double",
".",
"valueOf",
"(",
"MPPUtility",
".",
"getDouble",
"(",
"value",
",",
"0",
")",
"/",
"100",
")",
";",
"break",
";",
"}",
"case",
"15",
":",
"// Number",
"{",
"result",
"=",
"Double",
".",
"valueOf",
"(",
"MPPUtility",
".",
"getDouble",
"(",
"value",
",",
"0",
")",
")",
";",
"break",
";",
"}",
"case",
"36058",
":",
"case",
"21",
":",
"// Text",
"{",
"result",
"=",
"MPPUtility",
".",
"getUnicodeString",
"(",
"value",
",",
"0",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"result",
"=",
"value",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Convert raw value as read from the MPP file into a Java type.
@param type MPP value type
@param value raw value data
@return Java object
|
[
"Convert",
"raw",
"value",
"as",
"read",
"from",
"the",
"MPP",
"file",
"into",
"a",
"Java",
"type",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader.java#L71-L117
|
157,484
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/common/Table.java
|
Table.addRow
|
public void addRow(String primaryKeyColumnName, Map<String, Object> map)
{
Integer rowNumber = Integer.valueOf(m_rowNumber++);
map.put("ROW_NUMBER", rowNumber);
Object primaryKey = null;
if (primaryKeyColumnName != null)
{
primaryKey = map.get(primaryKeyColumnName);
}
if (primaryKey == null)
{
primaryKey = rowNumber;
}
MapRow newRow = new MapRow(map);
MapRow oldRow = m_rows.get(primaryKey);
if (oldRow == null)
{
m_rows.put(primaryKey, newRow);
}
else
{
int oldVersion = oldRow.getInteger("ROW_VERSION").intValue();
int newVersion = newRow.getInteger("ROW_VERSION").intValue();
if (newVersion > oldVersion)
{
m_rows.put(primaryKey, newRow);
}
}
}
|
java
|
public void addRow(String primaryKeyColumnName, Map<String, Object> map)
{
Integer rowNumber = Integer.valueOf(m_rowNumber++);
map.put("ROW_NUMBER", rowNumber);
Object primaryKey = null;
if (primaryKeyColumnName != null)
{
primaryKey = map.get(primaryKeyColumnName);
}
if (primaryKey == null)
{
primaryKey = rowNumber;
}
MapRow newRow = new MapRow(map);
MapRow oldRow = m_rows.get(primaryKey);
if (oldRow == null)
{
m_rows.put(primaryKey, newRow);
}
else
{
int oldVersion = oldRow.getInteger("ROW_VERSION").intValue();
int newVersion = newRow.getInteger("ROW_VERSION").intValue();
if (newVersion > oldVersion)
{
m_rows.put(primaryKey, newRow);
}
}
}
|
[
"public",
"void",
"addRow",
"(",
"String",
"primaryKeyColumnName",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"Integer",
"rowNumber",
"=",
"Integer",
".",
"valueOf",
"(",
"m_rowNumber",
"++",
")",
";",
"map",
".",
"put",
"(",
"\"ROW_NUMBER\"",
",",
"rowNumber",
")",
";",
"Object",
"primaryKey",
"=",
"null",
";",
"if",
"(",
"primaryKeyColumnName",
"!=",
"null",
")",
"{",
"primaryKey",
"=",
"map",
".",
"get",
"(",
"primaryKeyColumnName",
")",
";",
"}",
"if",
"(",
"primaryKey",
"==",
"null",
")",
"{",
"primaryKey",
"=",
"rowNumber",
";",
"}",
"MapRow",
"newRow",
"=",
"new",
"MapRow",
"(",
"map",
")",
";",
"MapRow",
"oldRow",
"=",
"m_rows",
".",
"get",
"(",
"primaryKey",
")",
";",
"if",
"(",
"oldRow",
"==",
"null",
")",
"{",
"m_rows",
".",
"put",
"(",
"primaryKey",
",",
"newRow",
")",
";",
"}",
"else",
"{",
"int",
"oldVersion",
"=",
"oldRow",
".",
"getInteger",
"(",
"\"ROW_VERSION\"",
")",
".",
"intValue",
"(",
")",
";",
"int",
"newVersion",
"=",
"newRow",
".",
"getInteger",
"(",
"\"ROW_VERSION\"",
")",
".",
"intValue",
"(",
")",
";",
"if",
"(",
"newVersion",
">",
"oldVersion",
")",
"{",
"m_rows",
".",
"put",
"(",
"primaryKey",
",",
"newRow",
")",
";",
"}",
"}",
"}"
] |
Add a row to the table. We have a limited understanding of the way
Btrieve handles outdated rows, so we use what we think is a version number
to try to ensure that we only have the latest rows.
@param primaryKeyColumnName primary key column name
@param map Map containing row data
|
[
"Add",
"a",
"row",
"to",
"the",
"table",
".",
"We",
"have",
"a",
"limited",
"understanding",
"of",
"the",
"way",
"Btrieve",
"handles",
"outdated",
"rows",
"so",
"we",
"use",
"what",
"we",
"think",
"is",
"a",
"version",
"number",
"to",
"try",
"to",
"ensure",
"that",
"we",
"only",
"have",
"the",
"latest",
"rows",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Table.java#L63-L93
|
157,485
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.getEmbeddedObjects
|
public static List<List<RTFEmbeddedObject>> getEmbeddedObjects(String text)
{
List<List<RTFEmbeddedObject>> objects = null;
List<RTFEmbeddedObject> objectData;
int offset = text.indexOf(OBJDATA);
if (offset != -1)
{
objects = new LinkedList<List<RTFEmbeddedObject>>();
while (offset != -1)
{
objectData = new LinkedList<RTFEmbeddedObject>();
objects.add(objectData);
offset = readObjectData(offset, text, objectData);
offset = text.indexOf(OBJDATA, offset);
}
}
return (objects);
}
|
java
|
public static List<List<RTFEmbeddedObject>> getEmbeddedObjects(String text)
{
List<List<RTFEmbeddedObject>> objects = null;
List<RTFEmbeddedObject> objectData;
int offset = text.indexOf(OBJDATA);
if (offset != -1)
{
objects = new LinkedList<List<RTFEmbeddedObject>>();
while (offset != -1)
{
objectData = new LinkedList<RTFEmbeddedObject>();
objects.add(objectData);
offset = readObjectData(offset, text, objectData);
offset = text.indexOf(OBJDATA, offset);
}
}
return (objects);
}
|
[
"public",
"static",
"List",
"<",
"List",
"<",
"RTFEmbeddedObject",
">",
">",
"getEmbeddedObjects",
"(",
"String",
"text",
")",
"{",
"List",
"<",
"List",
"<",
"RTFEmbeddedObject",
">>",
"objects",
"=",
"null",
";",
"List",
"<",
"RTFEmbeddedObject",
">",
"objectData",
";",
"int",
"offset",
"=",
"text",
".",
"indexOf",
"(",
"OBJDATA",
")",
";",
"if",
"(",
"offset",
"!=",
"-",
"1",
")",
"{",
"objects",
"=",
"new",
"LinkedList",
"<",
"List",
"<",
"RTFEmbeddedObject",
">",
">",
"(",
")",
";",
"while",
"(",
"offset",
"!=",
"-",
"1",
")",
"{",
"objectData",
"=",
"new",
"LinkedList",
"<",
"RTFEmbeddedObject",
">",
"(",
")",
";",
"objects",
".",
"add",
"(",
"objectData",
")",
";",
"offset",
"=",
"readObjectData",
"(",
"offset",
",",
"text",
",",
"objectData",
")",
";",
"offset",
"=",
"text",
".",
"indexOf",
"(",
"OBJDATA",
",",
"offset",
")",
";",
"}",
"}",
"return",
"(",
"objects",
")",
";",
"}"
] |
This method generates a list of lists. Each list represents the data
for an embedded object, and contains set set of RTFEmbeddedObject instances
that make up the embedded object. This method will return null
if there are no embedded objects in the RTF document.
@param text RTF document
@return list of lists of RTFEmbeddedObject instances
|
[
"This",
"method",
"generates",
"a",
"list",
"of",
"lists",
".",
"Each",
"list",
"represents",
"the",
"data",
"for",
"an",
"embedded",
"object",
"and",
"contains",
"set",
"set",
"of",
"RTFEmbeddedObject",
"instances",
"that",
"make",
"up",
"the",
"embedded",
"object",
".",
"This",
"method",
"will",
"return",
"null",
"if",
"there",
"are",
"no",
"embedded",
"objects",
"in",
"the",
"RTF",
"document",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L149-L169
|
157,486
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.getInt
|
private int getInt(List<byte[]> blocks)
{
int result;
if (blocks.isEmpty() == false)
{
byte[] data = blocks.remove(0);
result = MPPUtility.getInt(data, 0);
}
else
{
result = 0;
}
return (result);
}
|
java
|
private int getInt(List<byte[]> blocks)
{
int result;
if (blocks.isEmpty() == false)
{
byte[] data = blocks.remove(0);
result = MPPUtility.getInt(data, 0);
}
else
{
result = 0;
}
return (result);
}
|
[
"private",
"int",
"getInt",
"(",
"List",
"<",
"byte",
"[",
"]",
">",
"blocks",
")",
"{",
"int",
"result",
";",
"if",
"(",
"blocks",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"blocks",
".",
"remove",
"(",
"0",
")",
";",
"result",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"0",
")",
";",
"}",
"else",
"{",
"result",
"=",
"0",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Internal method used to retrieve a integer from an
embedded data block.
@param blocks list of data blocks
@return int value
|
[
"Internal",
"method",
"used",
"to",
"retrieve",
"a",
"integer",
"from",
"an",
"embedded",
"data",
"block",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L178-L191
|
157,487
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.getData
|
private byte[] getData(List<byte[]> blocks, int length)
{
byte[] result;
if (blocks.isEmpty() == false)
{
if (length < 4)
{
length = 4;
}
result = new byte[length];
int offset = 0;
byte[] data;
while (offset < length)
{
data = blocks.remove(0);
System.arraycopy(data, 0, result, offset, data.length);
offset += data.length;
}
}
else
{
result = null;
}
return (result);
}
|
java
|
private byte[] getData(List<byte[]> blocks, int length)
{
byte[] result;
if (blocks.isEmpty() == false)
{
if (length < 4)
{
length = 4;
}
result = new byte[length];
int offset = 0;
byte[] data;
while (offset < length)
{
data = blocks.remove(0);
System.arraycopy(data, 0, result, offset, data.length);
offset += data.length;
}
}
else
{
result = null;
}
return (result);
}
|
[
"private",
"byte",
"[",
"]",
"getData",
"(",
"List",
"<",
"byte",
"[",
"]",
">",
"blocks",
",",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"result",
";",
"if",
"(",
"blocks",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"if",
"(",
"length",
"<",
"4",
")",
"{",
"length",
"=",
"4",
";",
"}",
"result",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"int",
"offset",
"=",
"0",
";",
"byte",
"[",
"]",
"data",
";",
"while",
"(",
"offset",
"<",
"length",
")",
"{",
"data",
"=",
"blocks",
".",
"remove",
"(",
"0",
")",
";",
"System",
".",
"arraycopy",
"(",
"data",
",",
"0",
",",
"result",
",",
"offset",
",",
"data",
".",
"length",
")",
";",
"offset",
"+=",
"data",
".",
"length",
";",
"}",
"}",
"else",
"{",
"result",
"=",
"null",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Internal method used to retrieve a byte array from one
or more embedded data blocks. Consecutive data blocks may
need to be concatenated by this method in order to retrieve
the complete set of data.
@param blocks list of data blocks
@param length expected length of the data
@return byte array
|
[
"Internal",
"method",
"used",
"to",
"retrieve",
"a",
"byte",
"array",
"from",
"one",
"or",
"more",
"embedded",
"data",
"blocks",
".",
"Consecutive",
"data",
"blocks",
"may",
"need",
"to",
"be",
"concatenated",
"by",
"this",
"method",
"in",
"order",
"to",
"retrieve",
"the",
"complete",
"set",
"of",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L203-L231
|
157,488
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.readObjectData
|
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects)
{
LinkedList<byte[]> blocks = new LinkedList<byte[]>();
offset += (OBJDATA.length());
offset = skipEndOfLine(text, offset);
int length;
int lastOffset = offset;
while (offset != -1)
{
length = getBlockLength(text, offset);
lastOffset = readDataBlock(text, offset, length, blocks);
offset = skipEndOfLine(text, lastOffset);
}
RTFEmbeddedObject headerObject;
RTFEmbeddedObject dataObject;
while (blocks.isEmpty() == false)
{
headerObject = new RTFEmbeddedObject(blocks, 2);
objects.add(headerObject);
if (blocks.isEmpty() == false)
{
dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2());
objects.add(dataObject);
}
}
return (lastOffset);
}
|
java
|
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects)
{
LinkedList<byte[]> blocks = new LinkedList<byte[]>();
offset += (OBJDATA.length());
offset = skipEndOfLine(text, offset);
int length;
int lastOffset = offset;
while (offset != -1)
{
length = getBlockLength(text, offset);
lastOffset = readDataBlock(text, offset, length, blocks);
offset = skipEndOfLine(text, lastOffset);
}
RTFEmbeddedObject headerObject;
RTFEmbeddedObject dataObject;
while (blocks.isEmpty() == false)
{
headerObject = new RTFEmbeddedObject(blocks, 2);
objects.add(headerObject);
if (blocks.isEmpty() == false)
{
dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2());
objects.add(dataObject);
}
}
return (lastOffset);
}
|
[
"private",
"static",
"int",
"readObjectData",
"(",
"int",
"offset",
",",
"String",
"text",
",",
"List",
"<",
"RTFEmbeddedObject",
">",
"objects",
")",
"{",
"LinkedList",
"<",
"byte",
"[",
"]",
">",
"blocks",
"=",
"new",
"LinkedList",
"<",
"byte",
"[",
"]",
">",
"(",
")",
";",
"offset",
"+=",
"(",
"OBJDATA",
".",
"length",
"(",
")",
")",
";",
"offset",
"=",
"skipEndOfLine",
"(",
"text",
",",
"offset",
")",
";",
"int",
"length",
";",
"int",
"lastOffset",
"=",
"offset",
";",
"while",
"(",
"offset",
"!=",
"-",
"1",
")",
"{",
"length",
"=",
"getBlockLength",
"(",
"text",
",",
"offset",
")",
";",
"lastOffset",
"=",
"readDataBlock",
"(",
"text",
",",
"offset",
",",
"length",
",",
"blocks",
")",
";",
"offset",
"=",
"skipEndOfLine",
"(",
"text",
",",
"lastOffset",
")",
";",
"}",
"RTFEmbeddedObject",
"headerObject",
";",
"RTFEmbeddedObject",
"dataObject",
";",
"while",
"(",
"blocks",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"headerObject",
"=",
"new",
"RTFEmbeddedObject",
"(",
"blocks",
",",
"2",
")",
";",
"objects",
".",
"add",
"(",
"headerObject",
")",
";",
"if",
"(",
"blocks",
".",
"isEmpty",
"(",
")",
"==",
"false",
")",
"{",
"dataObject",
"=",
"new",
"RTFEmbeddedObject",
"(",
"blocks",
",",
"headerObject",
".",
"getTypeFlag2",
"(",
")",
")",
";",
"objects",
".",
"add",
"(",
"dataObject",
")",
";",
"}",
"}",
"return",
"(",
"lastOffset",
")",
";",
"}"
] |
This method extracts byte arrays from the embedded object data
and converts them into RTFEmbeddedObject instances, which
it then adds to the supplied list.
@param offset offset into the RTF document
@param text RTF document
@param objects destination for RTFEmbeddedObject instances
@return new offset into the RTF document
|
[
"This",
"method",
"extracts",
"byte",
"arrays",
"from",
"the",
"embedded",
"object",
"data",
"and",
"converts",
"them",
"into",
"RTFEmbeddedObject",
"instances",
"which",
"it",
"then",
"adds",
"to",
"the",
"supplied",
"list",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L243-L275
|
157,489
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.skipEndOfLine
|
private static int skipEndOfLine(String text, int offset)
{
char c;
boolean finished = false;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case ' ': // found that OBJDATA could be followed by a space the EOL
case '\r':
case '\n':
{
++offset;
break;
}
case '}':
{
offset = -1;
finished = true;
break;
}
default:
{
finished = true;
break;
}
}
}
return (offset);
}
|
java
|
private static int skipEndOfLine(String text, int offset)
{
char c;
boolean finished = false;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case ' ': // found that OBJDATA could be followed by a space the EOL
case '\r':
case '\n':
{
++offset;
break;
}
case '}':
{
offset = -1;
finished = true;
break;
}
default:
{
finished = true;
break;
}
}
}
return (offset);
}
|
[
"private",
"static",
"int",
"skipEndOfLine",
"(",
"String",
"text",
",",
"int",
"offset",
")",
"{",
"char",
"c",
";",
"boolean",
"finished",
"=",
"false",
";",
"while",
"(",
"finished",
"==",
"false",
")",
"{",
"c",
"=",
"text",
".",
"charAt",
"(",
"offset",
")",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"// found that OBJDATA could be followed by a space the EOL",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"{",
"++",
"offset",
";",
"break",
";",
"}",
"case",
"'",
"'",
":",
"{",
"offset",
"=",
"-",
"1",
";",
"finished",
"=",
"true",
";",
"break",
";",
"}",
"default",
":",
"{",
"finished",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"return",
"(",
"offset",
")",
";",
"}"
] |
This method skips the end-of-line markers in the RTF document.
It also indicates if the end of the embedded object has been reached.
@param text RTF document test
@param offset offset into the RTF document
@return new offset
|
[
"This",
"method",
"skips",
"the",
"end",
"-",
"of",
"-",
"line",
"markers",
"in",
"the",
"RTF",
"document",
".",
"It",
"also",
"indicates",
"if",
"the",
"end",
"of",
"the",
"embedded",
"object",
"has",
"been",
"reached",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L285-L319
|
157,490
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.getBlockLength
|
private static int getBlockLength(String text, int offset)
{
int startIndex = offset;
boolean finished = false;
char c;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case '\r':
case '\n':
case '}':
{
finished = true;
break;
}
default:
{
++offset;
break;
}
}
}
int length = offset - startIndex;
return (length);
}
|
java
|
private static int getBlockLength(String text, int offset)
{
int startIndex = offset;
boolean finished = false;
char c;
while (finished == false)
{
c = text.charAt(offset);
switch (c)
{
case '\r':
case '\n':
case '}':
{
finished = true;
break;
}
default:
{
++offset;
break;
}
}
}
int length = offset - startIndex;
return (length);
}
|
[
"private",
"static",
"int",
"getBlockLength",
"(",
"String",
"text",
",",
"int",
"offset",
")",
"{",
"int",
"startIndex",
"=",
"offset",
";",
"boolean",
"finished",
"=",
"false",
";",
"char",
"c",
";",
"while",
"(",
"finished",
"==",
"false",
")",
"{",
"c",
"=",
"text",
".",
"charAt",
"(",
"offset",
")",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"case",
"'",
"'",
":",
"{",
"finished",
"=",
"true",
";",
"break",
";",
"}",
"default",
":",
"{",
"++",
"offset",
";",
"break",
";",
"}",
"}",
"}",
"int",
"length",
"=",
"offset",
"-",
"startIndex",
";",
"return",
"(",
"length",
")",
";",
"}"
] |
Calculates the length of the next block of RTF data.
@param text RTF data
@param offset current offset into this data
@return block length
|
[
"Calculates",
"the",
"length",
"of",
"the",
"next",
"block",
"of",
"RTF",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L328-L358
|
157,491
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
|
RTFEmbeddedObject.readDataBlock
|
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks)
{
int bytes = length / 2;
byte[] data = new byte[bytes];
for (int index = 0; index < bytes; index++)
{
data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16);
offset += 2;
}
blocks.add(data);
return (offset);
}
|
java
|
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks)
{
int bytes = length / 2;
byte[] data = new byte[bytes];
for (int index = 0; index < bytes; index++)
{
data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16);
offset += 2;
}
blocks.add(data);
return (offset);
}
|
[
"private",
"static",
"int",
"readDataBlock",
"(",
"String",
"text",
",",
"int",
"offset",
",",
"int",
"length",
",",
"List",
"<",
"byte",
"[",
"]",
">",
"blocks",
")",
"{",
"int",
"bytes",
"=",
"length",
"/",
"2",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"bytes",
"]",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"bytes",
";",
"index",
"++",
")",
"{",
"data",
"[",
"index",
"]",
"=",
"(",
"byte",
")",
"Integer",
".",
"parseInt",
"(",
"text",
".",
"substring",
"(",
"offset",
",",
"offset",
"+",
"2",
")",
",",
"16",
")",
";",
"offset",
"+=",
"2",
";",
"}",
"blocks",
".",
"add",
"(",
"data",
")",
";",
"return",
"(",
"offset",
")",
";",
"}"
] |
Reads a data block and adds it to the list of blocks.
@param text RTF data
@param offset current offset
@param length next block length
@param blocks list of blocks
@return next offset
|
[
"Reads",
"a",
"data",
"block",
"and",
"adds",
"it",
"to",
"the",
"list",
"of",
"blocks",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L369-L382
|
157,492
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP12Reader.java
|
MPP12Reader.readSubProject
|
private SubProject readSubProject(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
try
{
SubProject sp = new SubProject();
int type = SUBPROJECT_TASKUNIQUEID0;
if (uniqueIDOffset != -1)
{
int value = MPPUtility.getInt(data, uniqueIDOffset);
type = MPPUtility.getInt(data, uniqueIDOffset + 4);
switch (type)
{
case SUBPROJECT_TASKUNIQUEID0:
case SUBPROJECT_TASKUNIQUEID1:
case SUBPROJECT_TASKUNIQUEID2:
case SUBPROJECT_TASKUNIQUEID3:
case SUBPROJECT_TASKUNIQUEID4:
case SUBPROJECT_TASKUNIQUEID5:
case SUBPROJECT_TASKUNIQUEID6:
{
sp.setTaskUniqueID(Integer.valueOf(value));
m_taskSubProjects.put(sp.getTaskUniqueID(), sp);
break;
}
default:
{
if (value != 0)
{
sp.addExternalTaskUniqueID(Integer.valueOf(value));
m_taskSubProjects.put(Integer.valueOf(value), sp);
}
break;
}
}
// Now get the unique id offset for this subproject
value = 0x00800000 + ((subprojectIndex - 1) * 0x00400000);
sp.setUniqueIDOffset(Integer.valueOf(value));
}
if (type == SUBPROJECT_TASKUNIQUEID4)
{
sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset));
}
else
{
//
// First block header
//
filePathOffset += 18;
//
// String size as a 4 byte int
//
filePathOffset += 4;
//
// Full DOS path
//
sp.setDosFullPath(MPPUtility.getString(data, filePathOffset));
filePathOffset += (sp.getDosFullPath().length() + 1);
//
// 24 byte block
//
filePathOffset += 24;
//
// 4 byte block size
//
int size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
if (size == 0)
{
sp.setFullPath(sp.getDosFullPath());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
//
// 2 byte data
//
filePathOffset += 2;
//
// Unicode string
//
sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset, size));
//filePathOffset += size;
}
//
// Second block header
//
fileNameOffset += 18;
//
// String size as a 4 byte int
//
fileNameOffset += 4;
//
// DOS file name
//
sp.setDosFileName(MPPUtility.getString(data, fileNameOffset));
fileNameOffset += (sp.getDosFileName().length() + 1);
//
// 24 byte block
//
fileNameOffset += 24;
//
// 4 byte block size
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
if (size == 0)
{
sp.setFileName(sp.getDosFileName());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
//
// 2 byte data
//
fileNameOffset += 2;
//
// Unicode string
//
sp.setFileName(MPPUtility.getUnicodeString(data, fileNameOffset, size));
//fileNameOffset += size;
}
}
//System.out.println(sp.toString());
// Add to the list of subprojects
m_file.getSubProjects().add(sp);
return (sp);
}
//
// Admit defeat at this point - we have probably stumbled
// upon a data format we don't understand, so we'll fail
// gracefully here. This will now be reported as a missing
// sub project error by end users of the library, rather
// than as an exception being thrown.
//
catch (ArrayIndexOutOfBoundsException ex)
{
return (null);
}
}
|
java
|
private SubProject readSubProject(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
try
{
SubProject sp = new SubProject();
int type = SUBPROJECT_TASKUNIQUEID0;
if (uniqueIDOffset != -1)
{
int value = MPPUtility.getInt(data, uniqueIDOffset);
type = MPPUtility.getInt(data, uniqueIDOffset + 4);
switch (type)
{
case SUBPROJECT_TASKUNIQUEID0:
case SUBPROJECT_TASKUNIQUEID1:
case SUBPROJECT_TASKUNIQUEID2:
case SUBPROJECT_TASKUNIQUEID3:
case SUBPROJECT_TASKUNIQUEID4:
case SUBPROJECT_TASKUNIQUEID5:
case SUBPROJECT_TASKUNIQUEID6:
{
sp.setTaskUniqueID(Integer.valueOf(value));
m_taskSubProjects.put(sp.getTaskUniqueID(), sp);
break;
}
default:
{
if (value != 0)
{
sp.addExternalTaskUniqueID(Integer.valueOf(value));
m_taskSubProjects.put(Integer.valueOf(value), sp);
}
break;
}
}
// Now get the unique id offset for this subproject
value = 0x00800000 + ((subprojectIndex - 1) * 0x00400000);
sp.setUniqueIDOffset(Integer.valueOf(value));
}
if (type == SUBPROJECT_TASKUNIQUEID4)
{
sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset));
}
else
{
//
// First block header
//
filePathOffset += 18;
//
// String size as a 4 byte int
//
filePathOffset += 4;
//
// Full DOS path
//
sp.setDosFullPath(MPPUtility.getString(data, filePathOffset));
filePathOffset += (sp.getDosFullPath().length() + 1);
//
// 24 byte block
//
filePathOffset += 24;
//
// 4 byte block size
//
int size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
if (size == 0)
{
sp.setFullPath(sp.getDosFullPath());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, filePathOffset);
filePathOffset += 4;
//
// 2 byte data
//
filePathOffset += 2;
//
// Unicode string
//
sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset, size));
//filePathOffset += size;
}
//
// Second block header
//
fileNameOffset += 18;
//
// String size as a 4 byte int
//
fileNameOffset += 4;
//
// DOS file name
//
sp.setDosFileName(MPPUtility.getString(data, fileNameOffset));
fileNameOffset += (sp.getDosFileName().length() + 1);
//
// 24 byte block
//
fileNameOffset += 24;
//
// 4 byte block size
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
if (size == 0)
{
sp.setFileName(sp.getDosFileName());
}
else
{
//
// 4 byte unicode string size in bytes
//
size = MPPUtility.getInt(data, fileNameOffset);
fileNameOffset += 4;
//
// 2 byte data
//
fileNameOffset += 2;
//
// Unicode string
//
sp.setFileName(MPPUtility.getUnicodeString(data, fileNameOffset, size));
//fileNameOffset += size;
}
}
//System.out.println(sp.toString());
// Add to the list of subprojects
m_file.getSubProjects().add(sp);
return (sp);
}
//
// Admit defeat at this point - we have probably stumbled
// upon a data format we don't understand, so we'll fail
// gracefully here. This will now be reported as a missing
// sub project error by end users of the library, rather
// than as an exception being thrown.
//
catch (ArrayIndexOutOfBoundsException ex)
{
return (null);
}
}
|
[
"private",
"SubProject",
"readSubProject",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"uniqueIDOffset",
",",
"int",
"filePathOffset",
",",
"int",
"fileNameOffset",
",",
"int",
"subprojectIndex",
")",
"{",
"try",
"{",
"SubProject",
"sp",
"=",
"new",
"SubProject",
"(",
")",
";",
"int",
"type",
"=",
"SUBPROJECT_TASKUNIQUEID0",
";",
"if",
"(",
"uniqueIDOffset",
"!=",
"-",
"1",
")",
"{",
"int",
"value",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"uniqueIDOffset",
")",
";",
"type",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"uniqueIDOffset",
"+",
"4",
")",
";",
"switch",
"(",
"type",
")",
"{",
"case",
"SUBPROJECT_TASKUNIQUEID0",
":",
"case",
"SUBPROJECT_TASKUNIQUEID1",
":",
"case",
"SUBPROJECT_TASKUNIQUEID2",
":",
"case",
"SUBPROJECT_TASKUNIQUEID3",
":",
"case",
"SUBPROJECT_TASKUNIQUEID4",
":",
"case",
"SUBPROJECT_TASKUNIQUEID5",
":",
"case",
"SUBPROJECT_TASKUNIQUEID6",
":",
"{",
"sp",
".",
"setTaskUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"m_taskSubProjects",
".",
"put",
"(",
"sp",
".",
"getTaskUniqueID",
"(",
")",
",",
"sp",
")",
";",
"break",
";",
"}",
"default",
":",
"{",
"if",
"(",
"value",
"!=",
"0",
")",
"{",
"sp",
".",
"addExternalTaskUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"m_taskSubProjects",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"value",
")",
",",
"sp",
")",
";",
"}",
"break",
";",
"}",
"}",
"// Now get the unique id offset for this subproject",
"value",
"=",
"0x00800000",
"+",
"(",
"(",
"subprojectIndex",
"-",
"1",
")",
"*",
"0x00400000",
")",
";",
"sp",
".",
"setUniqueIDOffset",
"(",
"Integer",
".",
"valueOf",
"(",
"value",
")",
")",
";",
"}",
"if",
"(",
"type",
"==",
"SUBPROJECT_TASKUNIQUEID4",
")",
"{",
"sp",
".",
"setFullPath",
"(",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"filePathOffset",
")",
")",
";",
"}",
"else",
"{",
"//",
"// First block header",
"//",
"filePathOffset",
"+=",
"18",
";",
"//",
"// String size as a 4 byte int",
"//",
"filePathOffset",
"+=",
"4",
";",
"//",
"// Full DOS path",
"//",
"sp",
".",
"setDosFullPath",
"(",
"MPPUtility",
".",
"getString",
"(",
"data",
",",
"filePathOffset",
")",
")",
";",
"filePathOffset",
"+=",
"(",
"sp",
".",
"getDosFullPath",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"//",
"// 24 byte block",
"//",
"filePathOffset",
"+=",
"24",
";",
"//",
"// 4 byte block size",
"//",
"int",
"size",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"filePathOffset",
")",
";",
"filePathOffset",
"+=",
"4",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"sp",
".",
"setFullPath",
"(",
"sp",
".",
"getDosFullPath",
"(",
")",
")",
";",
"}",
"else",
"{",
"//",
"// 4 byte unicode string size in bytes",
"//",
"size",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"filePathOffset",
")",
";",
"filePathOffset",
"+=",
"4",
";",
"//",
"// 2 byte data",
"//",
"filePathOffset",
"+=",
"2",
";",
"//",
"// Unicode string",
"//",
"sp",
".",
"setFullPath",
"(",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"filePathOffset",
",",
"size",
")",
")",
";",
"//filePathOffset += size;",
"}",
"//",
"// Second block header",
"//",
"fileNameOffset",
"+=",
"18",
";",
"//",
"// String size as a 4 byte int",
"//",
"fileNameOffset",
"+=",
"4",
";",
"//",
"// DOS file name",
"//",
"sp",
".",
"setDosFileName",
"(",
"MPPUtility",
".",
"getString",
"(",
"data",
",",
"fileNameOffset",
")",
")",
";",
"fileNameOffset",
"+=",
"(",
"sp",
".",
"getDosFileName",
"(",
")",
".",
"length",
"(",
")",
"+",
"1",
")",
";",
"//",
"// 24 byte block",
"//",
"fileNameOffset",
"+=",
"24",
";",
"//",
"// 4 byte block size",
"//",
"size",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"fileNameOffset",
")",
";",
"fileNameOffset",
"+=",
"4",
";",
"if",
"(",
"size",
"==",
"0",
")",
"{",
"sp",
".",
"setFileName",
"(",
"sp",
".",
"getDosFileName",
"(",
")",
")",
";",
"}",
"else",
"{",
"//",
"// 4 byte unicode string size in bytes",
"//",
"size",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"fileNameOffset",
")",
";",
"fileNameOffset",
"+=",
"4",
";",
"//",
"// 2 byte data",
"//",
"fileNameOffset",
"+=",
"2",
";",
"//",
"// Unicode string",
"//",
"sp",
".",
"setFileName",
"(",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"fileNameOffset",
",",
"size",
")",
")",
";",
"//fileNameOffset += size;",
"}",
"}",
"//System.out.println(sp.toString());",
"// Add to the list of subprojects",
"m_file",
".",
"getSubProjects",
"(",
")",
".",
"add",
"(",
"sp",
")",
";",
"return",
"(",
"sp",
")",
";",
"}",
"//",
"// Admit defeat at this point - we have probably stumbled",
"// upon a data format we don't understand, so we'll fail",
"// gracefully here. This will now be reported as a missing",
"// sub project error by end users of the library, rather",
"// than as an exception being thrown.",
"//",
"catch",
"(",
"ArrayIndexOutOfBoundsException",
"ex",
")",
"{",
"return",
"(",
"null",
")",
";",
"}",
"}"
] |
Method used to read the sub project details from a byte array.
@param data byte array
@param uniqueIDOffset offset of unique ID
@param filePathOffset offset of file path
@param fileNameOffset offset of file name
@param subprojectIndex index of the subproject, used to calculate unique id offset
@return new SubProject instance
|
[
"Method",
"used",
"to",
"read",
"the",
"sub",
"project",
"details",
"from",
"a",
"byte",
"array",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP12Reader.java#L569-L738
|
157,493
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/suretrak/TableReader.java
|
TableReader.readRecord
|
private void readRecord(byte[] buffer, Table table)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, ""));
int deletedFlag = getShort(buffer, 0);
if (deletedFlag != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(0, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
table.addRow(m_definition.getPrimaryKeyColumnName(), row);
}
}
|
java
|
private void readRecord(byte[] buffer, Table table)
{
//System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, ""));
int deletedFlag = getShort(buffer, 0);
if (deletedFlag != 0)
{
Map<String, Object> row = new HashMap<String, Object>();
for (ColumnDefinition column : m_definition.getColumns())
{
Object value = column.read(0, buffer);
//System.out.println(column.getName() + ": " + value);
row.put(column.getName(), value);
}
table.addRow(m_definition.getPrimaryKeyColumnName(), row);
}
}
|
[
"private",
"void",
"readRecord",
"(",
"byte",
"[",
"]",
"buffer",
",",
"Table",
"table",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, \"\"));",
"int",
"deletedFlag",
"=",
"getShort",
"(",
"buffer",
",",
"0",
")",
";",
"if",
"(",
"deletedFlag",
"!=",
"0",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"row",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Object",
">",
"(",
")",
";",
"for",
"(",
"ColumnDefinition",
"column",
":",
"m_definition",
".",
"getColumns",
"(",
")",
")",
"{",
"Object",
"value",
"=",
"column",
".",
"read",
"(",
"0",
",",
"buffer",
")",
";",
"//System.out.println(column.getName() + \": \" + value);",
"row",
".",
"put",
"(",
"column",
".",
"getName",
"(",
")",
",",
"value",
")",
";",
"}",
"table",
".",
"addRow",
"(",
"m_definition",
".",
"getPrimaryKeyColumnName",
"(",
")",
",",
"row",
")",
";",
"}",
"}"
] |
Reads a single record from the table.
@param buffer record data
@param table parent table
|
[
"Reads",
"a",
"single",
"record",
"from",
"the",
"table",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/TableReader.java#L118-L134
|
157,494
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.decodeBuffer
|
public static final void decodeBuffer(byte[] data, byte encryptionCode)
{
for (int i = 0; i < data.length; i++)
{
data[i] = (byte) (data[i] ^ encryptionCode);
}
}
|
java
|
public static final void decodeBuffer(byte[] data, byte encryptionCode)
{
for (int i = 0; i < data.length; i++)
{
data[i] = (byte) (data[i] ^ encryptionCode);
}
}
|
[
"public",
"static",
"final",
"void",
"decodeBuffer",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"encryptionCode",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"data",
".",
"length",
";",
"i",
"++",
")",
"{",
"data",
"[",
"i",
"]",
"=",
"(",
"byte",
")",
"(",
"data",
"[",
"i",
"]",
"^",
"encryptionCode",
")",
";",
"}",
"}"
] |
This method decodes a byte array with the given encryption code
using XOR encryption.
@param data Source data
@param encryptionCode Encryption code
|
[
"This",
"method",
"decodes",
"a",
"byte",
"array",
"with",
"the",
"given",
"encryption",
"code",
"using",
"XOR",
"encryption",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L64-L70
|
157,495
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.decodePassword
|
public static final String decodePassword(byte[] data, byte encryptionCode)
{
String result;
if (data.length < MINIMUM_PASSWORD_DATA_LENGTH)
{
result = null;
}
else
{
MPPUtility.decodeBuffer(data, encryptionCode);
StringBuilder buffer = new StringBuilder();
char c;
for (int i = 0; i < PASSWORD_MASK.length; i++)
{
int index = PASSWORD_MASK[i];
c = (char) data[index];
if (c == 0)
{
break;
}
buffer.append(c);
}
result = buffer.toString();
}
return (result);
}
|
java
|
public static final String decodePassword(byte[] data, byte encryptionCode)
{
String result;
if (data.length < MINIMUM_PASSWORD_DATA_LENGTH)
{
result = null;
}
else
{
MPPUtility.decodeBuffer(data, encryptionCode);
StringBuilder buffer = new StringBuilder();
char c;
for (int i = 0; i < PASSWORD_MASK.length; i++)
{
int index = PASSWORD_MASK[i];
c = (char) data[index];
if (c == 0)
{
break;
}
buffer.append(c);
}
result = buffer.toString();
}
return (result);
}
|
[
"public",
"static",
"final",
"String",
"decodePassword",
"(",
"byte",
"[",
"]",
"data",
",",
"byte",
"encryptionCode",
")",
"{",
"String",
"result",
";",
"if",
"(",
"data",
".",
"length",
"<",
"MINIMUM_PASSWORD_DATA_LENGTH",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"MPPUtility",
".",
"decodeBuffer",
"(",
"data",
",",
"encryptionCode",
")",
";",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"c",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"PASSWORD_MASK",
".",
"length",
";",
"i",
"++",
")",
"{",
"int",
"index",
"=",
"PASSWORD_MASK",
"[",
"i",
"]",
";",
"c",
"=",
"(",
"char",
")",
"data",
"[",
"index",
"]",
";",
"if",
"(",
"c",
"==",
"0",
")",
"{",
"break",
";",
"}",
"buffer",
".",
"append",
"(",
"c",
")",
";",
"}",
"result",
"=",
"buffer",
".",
"toString",
"(",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Decode the password from the given data. Will decode the data block as well.
@param data encrypted data block
@param encryptionCode encryption code
@return password
|
[
"Decode",
"the",
"password",
"from",
"the",
"given",
"data",
".",
"Will",
"decode",
"the",
"data",
"block",
"as",
"well",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L112-L143
|
157,496
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.getByteArray
|
public static final void getByteArray(byte[] data, int offset, int size, byte[] buffer, int bufferOffset)
{
System.arraycopy(data, offset, buffer, bufferOffset, size);
}
|
java
|
public static final void getByteArray(byte[] data, int offset, int size, byte[] buffer, int bufferOffset)
{
System.arraycopy(data, offset, buffer, bufferOffset, size);
}
|
[
"public",
"static",
"final",
"void",
"getByteArray",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"int",
"size",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"bufferOffset",
")",
"{",
"System",
".",
"arraycopy",
"(",
"data",
",",
"offset",
",",
"buffer",
",",
"bufferOffset",
",",
"size",
")",
";",
"}"
] |
This method extracts a portion of a byte array and writes it into
another byte array.
@param data Source data
@param offset Offset into source data
@param size Required size to be extracted from the source data
@param buffer Destination buffer
@param bufferOffset Offset into destination buffer
|
[
"This",
"method",
"extracts",
"a",
"portion",
"of",
"a",
"byte",
"array",
"and",
"writes",
"it",
"into",
"another",
"byte",
"array",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L155-L158
|
157,497
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.getLong6
|
public static final long getLong6(byte[] data, int offset)
{
long result = 0;
int i = offset;
for (int shiftBy = 0; shiftBy < 48; shiftBy += 8)
{
result |= ((long) (data[i] & 0xff)) << shiftBy;
++i;
}
return result;
}
|
java
|
public static final long getLong6(byte[] data, int offset)
{
long result = 0;
int i = offset;
for (int shiftBy = 0; shiftBy < 48; shiftBy += 8)
{
result |= ((long) (data[i] & 0xff)) << shiftBy;
++i;
}
return result;
}
|
[
"public",
"static",
"final",
"long",
"getLong6",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"long",
"result",
"=",
"0",
";",
"int",
"i",
"=",
"offset",
";",
"for",
"(",
"int",
"shiftBy",
"=",
"0",
";",
"shiftBy",
"<",
"48",
";",
"shiftBy",
"+=",
"8",
")",
"{",
"result",
"|=",
"(",
"(",
"long",
")",
"(",
"data",
"[",
"i",
"]",
"&",
"0xff",
")",
")",
"<<",
"shiftBy",
";",
"++",
"i",
";",
"}",
"return",
"result",
";",
"}"
] |
This method reads a six byte long from the input array.
@param data the input array
@param offset offset of integer data in the array
@return integer value
|
[
"This",
"method",
"reads",
"a",
"six",
"byte",
"long",
"from",
"the",
"input",
"array",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L237-L247
|
157,498
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.getTime
|
public static final Date getTime(byte[] data, int offset)
{
int time = getShort(data, offset) / 10;
Calendar cal = DateHelper.popCalendar(EPOCH_DATE);
cal.set(Calendar.HOUR_OF_DAY, (time / 60));
cal.set(Calendar.MINUTE, (time % 60));
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
DateHelper.pushCalendar(cal);
return (cal.getTime());
}
|
java
|
public static final Date getTime(byte[] data, int offset)
{
int time = getShort(data, offset) / 10;
Calendar cal = DateHelper.popCalendar(EPOCH_DATE);
cal.set(Calendar.HOUR_OF_DAY, (time / 60));
cal.set(Calendar.MINUTE, (time % 60));
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
DateHelper.pushCalendar(cal);
return (cal.getTime());
}
|
[
"public",
"static",
"final",
"Date",
"getTime",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"int",
"time",
"=",
"getShort",
"(",
"data",
",",
"offset",
")",
"/",
"10",
";",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
"(",
"EPOCH_DATE",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"(",
"time",
"/",
"60",
")",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"(",
"time",
"%",
"60",
")",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"SECOND",
",",
"0",
")",
";",
"cal",
".",
"set",
"(",
"Calendar",
".",
"MILLISECOND",
",",
"0",
")",
";",
"DateHelper",
".",
"pushCalendar",
"(",
"cal",
")",
";",
"return",
"(",
"cal",
".",
"getTime",
"(",
")",
")",
";",
"}"
] |
Reads a time value. The time is represented as tenths of a
minute since midnight.
@param data byte array of data
@param offset location of data as offset into the array
@return time value
|
[
"Reads",
"a",
"time",
"value",
".",
"The",
"time",
"is",
"represented",
"as",
"tenths",
"of",
"a",
"minute",
"since",
"midnight",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L337-L347
|
157,499
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
|
MPPUtility.getTimestamp
|
public static final Date getTimestamp(byte[] data, int offset)
{
Date result;
long days = getShort(data, offset + 2);
if (days < 100)
{
// We are seeing some files which have very small values for the number of days.
// When the relevant field is shown in MS Project it appears as NA.
// We try to mimic this behaviour here.
days = 0;
}
if (days == 0 || days == 65535)
{
result = null;
}
else
{
long time = getShort(data, offset);
if (time == 65535)
{
time = 0;
}
result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10)));
}
return (result);
}
|
java
|
public static final Date getTimestamp(byte[] data, int offset)
{
Date result;
long days = getShort(data, offset + 2);
if (days < 100)
{
// We are seeing some files which have very small values for the number of days.
// When the relevant field is shown in MS Project it appears as NA.
// We try to mimic this behaviour here.
days = 0;
}
if (days == 0 || days == 65535)
{
result = null;
}
else
{
long time = getShort(data, offset);
if (time == 65535)
{
time = 0;
}
result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10)));
}
return (result);
}
|
[
"public",
"static",
"final",
"Date",
"getTimestamp",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"Date",
"result",
";",
"long",
"days",
"=",
"getShort",
"(",
"data",
",",
"offset",
"+",
"2",
")",
";",
"if",
"(",
"days",
"<",
"100",
")",
"{",
"// We are seeing some files which have very small values for the number of days.",
"// When the relevant field is shown in MS Project it appears as NA.",
"// We try to mimic this behaviour here.",
"days",
"=",
"0",
";",
"}",
"if",
"(",
"days",
"==",
"0",
"||",
"days",
"==",
"65535",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
"long",
"time",
"=",
"getShort",
"(",
"data",
",",
"offset",
")",
";",
"if",
"(",
"time",
"==",
"65535",
")",
"{",
"time",
"=",
"0",
";",
"}",
"result",
"=",
"DateHelper",
".",
"getTimestampFromLong",
"(",
"(",
"EPOCH",
"+",
"(",
"days",
"*",
"DateHelper",
".",
"MS_PER_DAY",
")",
"+",
"(",
"(",
"time",
"*",
"DateHelper",
".",
"MS_PER_MINUTE",
")",
"/",
"10",
")",
")",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Reads a combined date and time value.
@param data byte array of data
@param offset location of data as offset into the array
@return time value
|
[
"Reads",
"a",
"combined",
"date",
"and",
"time",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L369-L397
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.