repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableHeader | private SynchroTable readTableHeader(byte[] header)
{
SynchroTable result = null;
String tableName = DatatypeConverter.getSimpleString(header, 0);
if (!tableName.isEmpty())
{
int offset = DatatypeConverter.getInt(header, 40);
result = new SynchroTable(tableName, offset);
}
return result;
} | java | private SynchroTable readTableHeader(byte[] header)
{
SynchroTable result = null;
String tableName = DatatypeConverter.getSimpleString(header, 0);
if (!tableName.isEmpty())
{
int offset = DatatypeConverter.getInt(header, 40);
result = new SynchroTable(tableName, offset);
}
return result;
} | [
"private",
"SynchroTable",
"readTableHeader",
"(",
"byte",
"[",
"]",
"header",
")",
"{",
"SynchroTable",
"result",
"=",
"null",
";",
"String",
"tableName",
"=",
"DatatypeConverter",
".",
"getSimpleString",
"(",
"header",
",",
"0",
")",
";",
"if",
"(",
"!",
... | Read the header data for a single file.
@param header header data
@return SynchroTable instance | [
"Read",
"the",
"header",
"data",
"for",
"a",
"single",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L140-L150 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableData | private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException
{
for (SynchroTable table : tables)
{
if (REQUIRED_TABLES.contains(table.getName()))
{
readTable(is, table);
}
}
} | java | private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException
{
for (SynchroTable table : tables)
{
if (REQUIRED_TABLES.contains(table.getName()))
{
readTable(is, table);
}
}
} | [
"private",
"void",
"readTableData",
"(",
"List",
"<",
"SynchroTable",
">",
"tables",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"for",
"(",
"SynchroTable",
"table",
":",
"tables",
")",
"{",
"if",
"(",
"REQUIRED_TABLES",
".",
"contains",
"("... | Read the data for all of the tables we're interested in.
@param tables list of all available tables
@param is input stream | [
"Read",
"the",
"data",
"for",
"all",
"of",
"the",
"tables",
"we",
"re",
"interested",
"in",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L158-L167 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTable | private void readTable(InputStream is, SynchroTable table) throws IOException
{
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | java | private void readTable(InputStream is, SynchroTable table) throws IOException
{
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | [
"private",
"void",
"readTable",
"(",
"InputStream",
"is",
",",
"SynchroTable",
"table",
")",
"throws",
"IOException",
"{",
"int",
"skip",
"=",
"table",
".",
"getOffset",
"(",
")",
"-",
"m_offset",
";",
"if",
"(",
"skip",
"!=",
"0",
")",
"{",
"StreamHelpe... | Read data for a single table and store it.
@param is input stream
@param table table header | [
"Read",
"data",
"for",
"a",
"single",
"table",
"and",
"store",
"it",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L175-L228 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readHeader | private void readHeader(InputStream is) throws IOException
{
byte[] header = new byte[20];
is.read(header);
m_offset += 20;
SynchroLogger.log("HEADER", header);
} | java | private void readHeader(InputStream is) throws IOException
{
byte[] header = new byte[20];
is.read(header);
m_offset += 20;
SynchroLogger.log("HEADER", header);
} | [
"private",
"void",
"readHeader",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"header",
"=",
"new",
"byte",
"[",
"20",
"]",
";",
"is",
".",
"read",
"(",
"header",
")",
";",
"m_offset",
"+=",
"20",
";",
"SynchroLogger",... | Read the file header data.
@param is input stream | [
"Read",
"the",
"file",
"header",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L235-L241 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readVersion | private void readVersion(InputStream is) throws IOException
{
BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);
String version = DatatypeConverter.getString(bytesReadStream);
m_offset += bytesReadStream.getBytesRead();
SynchroLogger.log("VERSION", version);
String[] versionArray = version.split("\\.");
m_majorVersion = Integer.parseInt(versionArray[0]);
} | java | private void readVersion(InputStream is) throws IOException
{
BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);
String version = DatatypeConverter.getString(bytesReadStream);
m_offset += bytesReadStream.getBytesRead();
SynchroLogger.log("VERSION", version);
String[] versionArray = version.split("\\.");
m_majorVersion = Integer.parseInt(versionArray[0]);
} | [
"private",
"void",
"readVersion",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"BytesReadInputStream",
"bytesReadStream",
"=",
"new",
"BytesReadInputStream",
"(",
"is",
")",
";",
"String",
"version",
"=",
"DatatypeConverter",
".",
"getString",
"(",
... | Read the version number.
@param is input stream | [
"Read",
"the",
"version",
"number",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L248-L257 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.readAll | public List<ProjectFile> readAll() throws MPXJException
{
Map<Integer, String> projects = listProjects();
List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());
for (Integer id : projects.keySet())
{
setProjectID(id.intValue());
result.add(read());
}
return result;
} | java | public List<ProjectFile> readAll() throws MPXJException
{
Map<Integer, String> projects = listProjects();
List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());
for (Integer id : projects.keySet())
{
setProjectID(id.intValue());
result.add(read());
}
return result;
} | [
"public",
"List",
"<",
"ProjectFile",
">",
"readAll",
"(",
")",
"throws",
"MPXJException",
"{",
"Map",
"<",
"Integer",
",",
"String",
">",
"projects",
"=",
"listProjects",
"(",
")",
";",
"List",
"<",
"ProjectFile",
">",
"result",
"=",
"new",
"ArrayList",
... | Convenience method which allows all projects in the database to
be read in a single operation.
@return list of ProjectFile instances
@throws MPXJException | [
"Convenience",
"method",
"which",
"allows",
"all",
"projects",
"in",
"the",
"database",
"to",
"be",
"read",
"in",
"a",
"single",
"operation",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L161-L171 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processAnalytics | private void processAnalytics() throws SQLException
{
allocateConnection();
try
{
DatabaseMetaData meta = m_connection.getMetaData();
String productName = meta.getDatabaseProductName();
if (productName == null || productName.isEmpty())
{
productName = "DATABASE";
}
else
{
productName = productName.toUpperCase();
}
ProjectProperties properties = m_reader.getProject().getProjectProperties();
properties.setFileApplication("Primavera");
properties.setFileType(productName);
}
finally
{
releaseConnection();
}
} | java | private void processAnalytics() throws SQLException
{
allocateConnection();
try
{
DatabaseMetaData meta = m_connection.getMetaData();
String productName = meta.getDatabaseProductName();
if (productName == null || productName.isEmpty())
{
productName = "DATABASE";
}
else
{
productName = productName.toUpperCase();
}
ProjectProperties properties = m_reader.getProject().getProjectProperties();
properties.setFileApplication("Primavera");
properties.setFileType(productName);
}
finally
{
releaseConnection();
}
} | [
"private",
"void",
"processAnalytics",
"(",
")",
"throws",
"SQLException",
"{",
"allocateConnection",
"(",
")",
";",
"try",
"{",
"DatabaseMetaData",
"meta",
"=",
"m_connection",
".",
"getMetaData",
"(",
")",
";",
"String",
"productName",
"=",
"meta",
".",
"get... | Populate data for analytics. | [
"Populate",
"data",
"for",
"analytics",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L176-L202 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processSchedulingProjectProperties | private void processSchedulingProjectProperties() throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'", m_projectID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
Record record = Record.getRecord(row.getString("prop_value"));
if (record != null)
{
String[] keyValues = record.getValue().split("\\|");
for (int i = 0; i < keyValues.length - 1; ++i)
{
if ("sched_calendar_on_relationship_lag".equals(keyValues[i]))
{
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", keyValues[i + 1]);
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
break;
}
}
}
}
} | java | private void processSchedulingProjectProperties() throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'", m_projectID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
Record record = Record.getRecord(row.getString("prop_value"));
if (record != null)
{
String[] keyValues = record.getValue().split("\\|");
for (int i = 0; i < keyValues.length - 1; ++i)
{
if ("sched_calendar_on_relationship_lag".equals(keyValues[i]))
{
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", keyValues[i + 1]);
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
break;
}
}
}
}
} | [
"private",
"void",
"processSchedulingProjectProperties",
"(",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from \"",
"+",
"m_schema",
"+",
"\"projprop where proj_id=? and prop_name='scheduling'\"",
",",
"m_projectID... | Process the scheduling project property from PROJPROP. This table only seems to exist
in P6 databases, not XER files.
@throws SQLException | [
"Process",
"the",
"scheduling",
"project",
"property",
"from",
"PROJPROP",
".",
"This",
"table",
"only",
"seems",
"to",
"exist",
"in",
"P6",
"databases",
"not",
"XER",
"files",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L264-L286 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processDefaultCurrency | private void processDefaultCurrency(Integer currencyID) throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "currtype where curr_id=?", currencyID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_reader.processDefaultCurrency(row);
}
} | java | private void processDefaultCurrency(Integer currencyID) throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "currtype where curr_id=?", currencyID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_reader.processDefaultCurrency(row);
}
} | [
"private",
"void",
"processDefaultCurrency",
"(",
"Integer",
"currencyID",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from \"",
"+",
"m_schema",
"+",
"\"currtype where curr_id=?\"",
",",
"currencyID",
")",
... | Select the default currency properties from the database.
@param currencyID default currency ID | [
"Select",
"the",
"default",
"currency",
"properties",
"from",
"the",
"database",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L293-L301 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.setSchema | public void setSchema(String schema)
{
if (schema == null)
{
schema = "";
}
else
{
if (!schema.isEmpty() && !schema.endsWith("."))
{
schema = schema + '.';
}
}
m_schema = schema;
} | java | public void setSchema(String schema)
{
if (schema == null)
{
schema = "";
}
else
{
if (!schema.isEmpty() && !schema.endsWith("."))
{
schema = schema + '.';
}
}
m_schema = schema;
} | [
"public",
"void",
"setSchema",
"(",
"String",
"schema",
")",
"{",
"if",
"(",
"schema",
"==",
"null",
")",
"{",
"schema",
"=",
"\"\"",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"schema",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"schema",
".",
"endsWith",
... | Set the name of the schema containing the Primavera tables.
@param schema schema name. | [
"Set",
"the",
"name",
"of",
"the",
"schema",
"containing",
"the",
"Primavera",
"tables",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L568-L582 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java | MPXJNumberFormat.applyPattern | public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator)
{
m_symbols.setDecimalSeparator(decimalSeparator);
m_symbols.setGroupingSeparator(groupingSeparator);
setDecimalFormatSymbols(m_symbols);
applyPattern(primaryPattern);
if (alternativePatterns != null && alternativePatterns.length != 0)
{
int loop;
if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length)
{
m_alternativeFormats = new DecimalFormat[alternativePatterns.length];
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop] = new DecimalFormat();
}
}
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols);
m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]);
}
}
} | java | public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator)
{
m_symbols.setDecimalSeparator(decimalSeparator);
m_symbols.setGroupingSeparator(groupingSeparator);
setDecimalFormatSymbols(m_symbols);
applyPattern(primaryPattern);
if (alternativePatterns != null && alternativePatterns.length != 0)
{
int loop;
if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length)
{
m_alternativeFormats = new DecimalFormat[alternativePatterns.length];
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop] = new DecimalFormat();
}
}
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols);
m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]);
}
}
} | [
"public",
"void",
"applyPattern",
"(",
"String",
"primaryPattern",
",",
"String",
"[",
"]",
"alternativePatterns",
",",
"char",
"decimalSeparator",
",",
"char",
"groupingSeparator",
")",
"{",
"m_symbols",
".",
"setDecimalSeparator",
"(",
"decimalSeparator",
")",
";"... | This method is used to configure the primary and alternative
format patterns.
@param primaryPattern new format pattern
@param alternativePatterns alternative format patterns
@param decimalSeparator Locale specific decimal separator to replace placeholder
@param groupingSeparator Locale specific grouping separator to replace placeholder | [
"This",
"method",
"is",
"used",
"to",
"configure",
"the",
"primary",
"and",
"alternative",
"format",
"patterns",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java#L47-L73 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/ResourceModel.java | ResourceModel.getResourceField | private String getResourceField(int key)
{
String result = null;
if (key > 0 && key < m_resourceNames.length)
{
result = m_resourceNames[key];
}
return (result);
} | java | private String getResourceField(int key)
{
String result = null;
if (key > 0 && key < m_resourceNames.length)
{
result = m_resourceNames[key];
}
return (result);
} | [
"private",
"String",
"getResourceField",
"(",
"int",
"key",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"key",
">",
"0",
"&&",
"key",
"<",
"m_resourceNames",
".",
"length",
")",
"{",
"result",
"=",
"m_resourceNames",
"[",
"key",
"]",
";"... | Given a resource field number, this method returns the resource field name.
@param key resource field number
@return resource field name | [
"Given",
"a",
"resource",
"field",
"number",
"this",
"method",
"returns",
"the",
"resource",
"field",
"name",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ResourceModel.java#L213-L223 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpx/ResourceModel.java | ResourceModel.getResourceCode | private int getResourceCode(String field) throws MPXJException
{
Integer result = m_resourceNumbers.get(field);
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_RESOURCE_FIELD_NAME + " " + field);
}
return (result.intValue());
} | java | private int getResourceCode(String field) throws MPXJException
{
Integer result = m_resourceNumbers.get(field);
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_RESOURCE_FIELD_NAME + " " + field);
}
return (result.intValue());
} | [
"private",
"int",
"getResourceCode",
"(",
"String",
"field",
")",
"throws",
"MPXJException",
"{",
"Integer",
"result",
"=",
"m_resourceNumbers",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"MPXJException",... | Given a resource field name, this method returns the resource field number.
@param field resource field name
@return resource field number | [
"Given",
"a",
"resource",
"field",
"name",
"this",
"method",
"returns",
"the",
"resource",
"field",
"number",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ResourceModel.java#L231-L241 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttproject/CustomProperty.java | CustomProperty.getField | public FieldType getField()
{
FieldType result = null;
if (m_index < m_fields.length)
{
result = m_fields[m_index++];
}
return result;
} | java | public FieldType getField()
{
FieldType result = null;
if (m_index < m_fields.length)
{
result = m_fields[m_index++];
}
return result;
} | [
"public",
"FieldType",
"getField",
"(",
")",
"{",
"FieldType",
"result",
"=",
"null",
";",
"if",
"(",
"m_index",
"<",
"m_fields",
".",
"length",
")",
"{",
"result",
"=",
"m_fields",
"[",
"m_index",
"++",
"]",
";",
"}",
"return",
"result",
";",
"}"
] | Retrieve the next available field.
@return FieldType instance for the next available field | [
"Retrieve",
"the",
"next",
"available",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/CustomProperty.java#L61-L70 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTable | public List<MapRow> readTable(TableReader reader) throws IOException
{
reader.read();
return reader.getRows();
} | java | public List<MapRow> readTable(TableReader reader) throws IOException
{
reader.read();
return reader.getRows();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTable",
"(",
"TableReader",
"reader",
")",
"throws",
"IOException",
"{",
"reader",
".",
"read",
"(",
")",
";",
"return",
"reader",
".",
"getRows",
"(",
")",
";",
"}"
] | Read a nested table. Instantiates the supplied reader class to
extract the data.
@param reader table reader class
@return table rows | [
"Read",
"a",
"nested",
"table",
".",
"Instantiates",
"the",
"supplied",
"reader",
"class",
"to",
"extract",
"the",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L80-L84 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readUnknownTable | public List<MapRow> readUnknownTable(int rowSize, int rowMagicNumber) throws IOException
{
TableReader reader = new UnknownTableReader(this, rowSize, rowMagicNumber);
reader.read();
return reader.getRows();
} | java | public List<MapRow> readUnknownTable(int rowSize, int rowMagicNumber) throws IOException
{
TableReader reader = new UnknownTableReader(this, rowSize, rowMagicNumber);
reader.read();
return reader.getRows();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readUnknownTable",
"(",
"int",
"rowSize",
",",
"int",
"rowMagicNumber",
")",
"throws",
"IOException",
"{",
"TableReader",
"reader",
"=",
"new",
"UnknownTableReader",
"(",
"this",
",",
"rowSize",
",",
"rowMagicNumber",
")",
... | Read a nested table whose contents we don't understand.
@param rowSize fixed row size
@param rowMagicNumber row magic number
@return table rows | [
"Read",
"a",
"nested",
"table",
"whose",
"contents",
"we",
"don",
"t",
"understand",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L93-L98 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTable | public List<MapRow> readTable(Class<? extends TableReader> readerClass) throws IOException
{
TableReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return readTable(reader);
} | java | public List<MapRow> readTable(Class<? extends TableReader> readerClass) throws IOException
{
TableReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return readTable(reader);
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTable",
"(",
"Class",
"<",
"?",
"extends",
"TableReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"TableReader",
"reader",
";",
"try",
"{",
"reader",
"=",
"readerClass",
".",
"getConstructor",
"(",
"S... | Reads a nested table. Uses the supplied reader class instance.
@param readerClass reader class instance
@return table rows | [
"Reads",
"a",
"nested",
"table",
".",
"Uses",
"the",
"supplied",
"reader",
"class",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L106-L120 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTableConditional | public List<MapRow> readTableConditional(Class<? extends TableReader> readerClass) throws IOException
{
List<MapRow> result;
if (DatatypeConverter.getBoolean(m_stream))
{
result = readTable(readerClass);
}
else
{
result = Collections.emptyList();
}
return result;
} | java | public List<MapRow> readTableConditional(Class<? extends TableReader> readerClass) throws IOException
{
List<MapRow> result;
if (DatatypeConverter.getBoolean(m_stream))
{
result = readTable(readerClass);
}
else
{
result = Collections.emptyList();
}
return result;
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTableConditional",
"(",
"Class",
"<",
"?",
"extends",
"TableReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"List",
"<",
"MapRow",
">",
"result",
";",
"if",
"(",
"DatatypeConverter",
".",
"getBoolean",... | Conditionally read a nested table based in the value of a boolean flag which precedes the table data.
@param readerClass reader class
@return table rows or empty list if table not present | [
"Conditionally",
"read",
"a",
"nested",
"table",
"based",
"in",
"the",
"value",
"of",
"a",
"boolean",
"flag",
"which",
"precedes",
"the",
"table",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L128-L140 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readBytes | public ByteArray readBytes(int size) throws IOException
{
byte[] data = new byte[size];
m_stream.read(data);
return new ByteArray(data);
} | java | public ByteArray readBytes(int size) throws IOException
{
byte[] data = new byte[size];
m_stream.read(data);
return new ByteArray(data);
} | [
"public",
"ByteArray",
"readBytes",
"(",
"int",
"size",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"m_stream",
".",
"read",
"(",
"data",
")",
";",
"return",
"new",
"ByteArray",
"(",
"data",
... | Read an array of bytes of a specified size.
@param size number of bytes to read
@return ByteArray instance | [
"Read",
"an",
"array",
"of",
"bytes",
"of",
"a",
"specified",
"size",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L148-L153 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readBlocks | public List<MapRow> readBlocks(Class<? extends BlockReader> readerClass) throws IOException
{
BlockReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return reader.read();
} | java | public List<MapRow> readBlocks(Class<? extends BlockReader> readerClass) throws IOException
{
BlockReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return reader.read();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readBlocks",
"(",
"Class",
"<",
"?",
"extends",
"BlockReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"BlockReader",
"reader",
";",
"try",
"{",
"reader",
"=",
"readerClass",
".",
"getConstructor",
"(",
"... | Read a list of fixed size blocks using an instance of the supplied reader class.
@param readerClass reader class
@return list of blocks | [
"Read",
"a",
"list",
"of",
"fixed",
"size",
"blocks",
"using",
"an",
"instance",
"of",
"the",
"supplied",
"reader",
"class",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L252-L266 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readFile | private void readFile(InputStream is) throws IOException
{
StreamHelper.skip(is, 64);
int index = 64;
ArrayList<Integer> offsetList = new ArrayList<Integer>();
List<String> nameList = new ArrayList<String>();
while (true)
{
byte[] table = new byte[32];
is.read(table);
index += 32;
int offset = PEPUtility.getInt(table, 0);
offsetList.add(Integer.valueOf(offset));
if (offset == 0)
{
break;
}
nameList.add(PEPUtility.getString(table, 5).toUpperCase());
}
StreamHelper.skip(is, offsetList.get(0).intValue() - index);
for (int offsetIndex = 1; offsetIndex < offsetList.size() - 1; offsetIndex++)
{
String name = nameList.get(offsetIndex - 1);
Class<? extends Table> tableClass = TABLE_CLASSES.get(name);
if (tableClass == null)
{
tableClass = Table.class;
}
Table table;
try
{
table = tableClass.newInstance();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
m_tables.put(name, table);
table.read(is);
}
} | java | private void readFile(InputStream is) throws IOException
{
StreamHelper.skip(is, 64);
int index = 64;
ArrayList<Integer> offsetList = new ArrayList<Integer>();
List<String> nameList = new ArrayList<String>();
while (true)
{
byte[] table = new byte[32];
is.read(table);
index += 32;
int offset = PEPUtility.getInt(table, 0);
offsetList.add(Integer.valueOf(offset));
if (offset == 0)
{
break;
}
nameList.add(PEPUtility.getString(table, 5).toUpperCase());
}
StreamHelper.skip(is, offsetList.get(0).intValue() - index);
for (int offsetIndex = 1; offsetIndex < offsetList.size() - 1; offsetIndex++)
{
String name = nameList.get(offsetIndex - 1);
Class<? extends Table> tableClass = TABLE_CLASSES.get(name);
if (tableClass == null)
{
tableClass = Table.class;
}
Table table;
try
{
table = tableClass.newInstance();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
m_tables.put(name, table);
table.read(is);
}
} | [
"private",
"void",
"readFile",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"StreamHelper",
".",
"skip",
"(",
"is",
",",
"64",
")",
";",
"int",
"index",
"=",
"64",
";",
"ArrayList",
"<",
"Integer",
">",
"offsetList",
"=",
"new",
"ArrayLis... | Reads a PEP file from the input stream.
@param is input stream representing a PEP file | [
"Reads",
"a",
"PEP",
"file",
"from",
"the",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L138-L187 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readCalendars | private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID"));
calendar.setName(row.getString("NAME"));
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY"));
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY"));
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY"));
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY"));
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY"));
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY"));
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY"));
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day);
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent);
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID"));
m_eventManager.fireCalendarReadEvent(child);
}
} | java | private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID"));
calendar.setName(row.getString("NAME"));
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY"));
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY"));
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY"));
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY"));
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY"));
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY"));
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY"));
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day);
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent);
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID"));
m_eventManager.fireCalendarReadEvent(child);
}
} | [
"private",
"void",
"readCalendars",
"(",
")",
"{",
"//",
"// Create the calendars",
"//",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"NCALTAB\"",
")",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"m_projectFile",
".",
"addCalendar",
"(",
")",
";",
... | Read calendar data from a PEP file. | [
"Read",
"calendar",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L192-L237 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.addCalendarExceptions | private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID)
{
Integer currentExceptionID = exceptionID;
while (true)
{
MapRow row = table.find(currentExceptionID);
if (row == null)
{
break;
}
Date date = row.getDate("DATE");
ProjectCalendarException exception = calendar.addCalendarException(date, date);
if (row.getBoolean("WORKING"))
{
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID");
}
} | java | private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID)
{
Integer currentExceptionID = exceptionID;
while (true)
{
MapRow row = table.find(currentExceptionID);
if (row == null)
{
break;
}
Date date = row.getDate("DATE");
ProjectCalendarException exception = calendar.addCalendarException(date, date);
if (row.getBoolean("WORKING"))
{
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID");
}
} | [
"private",
"void",
"addCalendarExceptions",
"(",
"Table",
"table",
",",
"ProjectCalendar",
"calendar",
",",
"Integer",
"exceptionID",
")",
"{",
"Integer",
"currentExceptionID",
"=",
"exceptionID",
";",
"while",
"(",
"true",
")",
"{",
"MapRow",
"row",
"=",
"table... | Read exceptions for a calendar.
@param table calendar exception data
@param calendar calendar
@param exceptionID first exception ID | [
"Read",
"exceptions",
"for",
"a",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L246-L267 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readResources | private void readResources()
{
for (MapRow row : getTable("RTAB"))
{
Resource resource = m_projectFile.addResource();
setFields(RESOURCE_FIELDS, row, resource);
m_eventManager.fireResourceReadEvent(resource);
// TODO: Correctly handle calendar
}
} | java | private void readResources()
{
for (MapRow row : getTable("RTAB"))
{
Resource resource = m_projectFile.addResource();
setFields(RESOURCE_FIELDS, row, resource);
m_eventManager.fireResourceReadEvent(resource);
// TODO: Correctly handle calendar
}
} | [
"private",
"void",
"readResources",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"RTAB\"",
")",
")",
"{",
"Resource",
"resource",
"=",
"m_projectFile",
".",
"addResource",
"(",
")",
";",
"setFields",
"(",
"RESOURCE_FIELDS",
",",
"row... | Read resource data from a PEP file. | [
"Read",
"resource",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L272-L281 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTasks | private void readTasks()
{
Integer rootID = Integer.valueOf(1);
readWBS(m_projectFile, rootID);
readTasks(rootID);
m_projectFile.getTasks().synchronizeTaskIDToHierarchy();
} | java | private void readTasks()
{
Integer rootID = Integer.valueOf(1);
readWBS(m_projectFile, rootID);
readTasks(rootID);
m_projectFile.getTasks().synchronizeTaskIDToHierarchy();
} | [
"private",
"void",
"readTasks",
"(",
")",
"{",
"Integer",
"rootID",
"=",
"Integer",
".",
"valueOf",
"(",
"1",
")",
";",
"readWBS",
"(",
"m_projectFile",
",",
"rootID",
")",
";",
"readTasks",
"(",
"rootID",
")",
";",
"m_projectFile",
".",
"getTasks",
"(",... | Read task data from a PEP file. | [
"Read",
"task",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L286-L292 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readWBS | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | java | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | [
"private",
"void",
"readWBS",
"(",
"ChildTaskContainer",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"WBSTAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",... | Recursively read the WBS structure from a PEP file.
@param parent parent container for tasks
@param id initial WBS ID | [
"Recursively",
"read",
"the",
"WBS",
"structure",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L300-L317 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTasks | private void readTasks(Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
readLeafTasks(task, row.getInteger("FIRST_CHILD_TASK_ID"));
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readTasks(childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | java | private void readTasks(Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
readLeafTasks(task, row.getInteger("FIRST_CHILD_TASK_ID"));
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readTasks(childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | [
"private",
"void",
"readTasks",
"(",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"WBSTAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"MapRow",... | Read leaf tasks attached to the WBS.
@param id initial WBS ID | [
"Read",
"leaf",
"tasks",
"attached",
"to",
"the",
"WBS",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L324-L341 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readLeafTasks | private void readLeafTasks(Task parent, Integer id)
{
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | java | private void readLeafTasks(Task parent, Integer id)
{
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | [
"private",
"void",
"readLeafTasks",
"(",
"Task",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"A1TAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",
"!=",
... | Read the leaf tasks for an individual WBS node.
@param parent parent task
@param id first task ID | [
"Read",
"the",
"leaf",
"tasks",
"for",
"an",
"individual",
"WBS",
"node",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L349-L361 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTask | private Task readTask(ChildTaskContainer parent, Integer id)
{
Table a0 = getTable("A0TAB");
Table a1 = getTable("A1TAB");
Table a2 = getTable("A2TAB");
Table a3 = getTable("A3TAB");
Table a4 = getTable("A4TAB");
Task task = parent.addTask();
MapRow a1Row = a1.find(id);
MapRow a2Row = a2.find(id);
setFields(A0TAB_FIELDS, a0.find(id), task);
setFields(A1TAB_FIELDS, a1Row, task);
setFields(A2TAB_FIELDS, a2Row, task);
setFields(A3TAB_FIELDS, a3.find(id), task);
setFields(A5TAB_FIELDS, a4.find(id), task);
task.setStart(task.getEarlyStart());
task.setFinish(task.getEarlyFinish());
if (task.getName() == null)
{
task.setName(task.getText(1));
}
m_eventManager.fireTaskReadEvent(task);
return task;
} | java | private Task readTask(ChildTaskContainer parent, Integer id)
{
Table a0 = getTable("A0TAB");
Table a1 = getTable("A1TAB");
Table a2 = getTable("A2TAB");
Table a3 = getTable("A3TAB");
Table a4 = getTable("A4TAB");
Task task = parent.addTask();
MapRow a1Row = a1.find(id);
MapRow a2Row = a2.find(id);
setFields(A0TAB_FIELDS, a0.find(id), task);
setFields(A1TAB_FIELDS, a1Row, task);
setFields(A2TAB_FIELDS, a2Row, task);
setFields(A3TAB_FIELDS, a3.find(id), task);
setFields(A5TAB_FIELDS, a4.find(id), task);
task.setStart(task.getEarlyStart());
task.setFinish(task.getEarlyFinish());
if (task.getName() == null)
{
task.setName(task.getText(1));
}
m_eventManager.fireTaskReadEvent(task);
return task;
} | [
"private",
"Task",
"readTask",
"(",
"ChildTaskContainer",
"parent",
",",
"Integer",
"id",
")",
"{",
"Table",
"a0",
"=",
"getTable",
"(",
"\"A0TAB\"",
")",
";",
"Table",
"a1",
"=",
"getTable",
"(",
"\"A1TAB\"",
")",
";",
"Table",
"a2",
"=",
"getTable",
"(... | Read data for an individual task from the tables in a PEP file.
@param parent parent task
@param id task ID
@return task instance | [
"Read",
"data",
"for",
"an",
"individual",
"task",
"from",
"the",
"tables",
"in",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L370-L398 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readRelationships | private void readRelationships()
{
for (MapRow row : getTable("CONTAB"))
{
Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1"));
Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2"));
if (task1 != null && task2 != null)
{
RelationType type = row.getRelationType("TYPE");
Duration lag = row.getDuration("LAG");
Relation relation = task2.addPredecessor(task1, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
}
} | java | private void readRelationships()
{
for (MapRow row : getTable("CONTAB"))
{
Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1"));
Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2"));
if (task1 != null && task2 != null)
{
RelationType type = row.getRelationType("TYPE");
Duration lag = row.getDuration("LAG");
Relation relation = task2.addPredecessor(task1, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
}
} | [
"private",
"void",
"readRelationships",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"CONTAB\"",
")",
")",
"{",
"Task",
"task1",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"TASK_ID_1\"",
")",
... | Read relationship data from a PEP file. | [
"Read",
"relationship",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L403-L418 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readResourceAssignments | private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment);
}
}
} | java | private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment);
}
}
} | [
"private",
"void",
"readResourceAssignments",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"USGTAB\"",
")",
")",
"{",
"Task",
"task",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"TASK_ID\"",
")... | Read resource assignment data from a PEP file. | [
"Read",
"resource",
"assignment",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L423-L435 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.getTable | private Table getTable(String name)
{
Table table = m_tables.get(name);
if (table == null)
{
table = EMPTY_TABLE;
}
return table;
} | java | private Table getTable(String name)
{
Table table = m_tables.get(name);
if (table == null)
{
table = EMPTY_TABLE;
}
return table;
} | [
"private",
"Table",
"getTable",
"(",
"String",
"name",
")",
"{",
"Table",
"table",
"=",
"m_tables",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"table",
"=",
"EMPTY_TABLE",
";",
"}",
"return",
"table",
";",
"}"
] | Retrieve a table by name.
@param name table name
@return Table instance | [
"Retrieve",
"a",
"table",
"by",
"name",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L443-L451 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.applyAliases | private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue());
}
} | java | private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue());
}
} | [
"private",
"void",
"applyAliases",
"(",
")",
"{",
"CustomFieldContainer",
"fields",
"=",
"m_projectFile",
".",
"getCustomFields",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"FieldType",
",",
"String",
">",
"entry",
":",
"ALIASES",
".",
"entrySet",
... | Configure column aliases. | [
"Configure",
"column",
"aliases",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L456-L463 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.defineField | private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)
{
container.put(name, type);
if (alias != null)
{
ALIASES.put(type, alias);
}
} | java | private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)
{
container.put(name, type);
if (alias != null)
{
ALIASES.put(type, alias);
}
} | [
"private",
"static",
"void",
"defineField",
"(",
"Map",
"<",
"String",
",",
"FieldType",
">",
"container",
",",
"String",
"name",
",",
"FieldType",
"type",
",",
"String",
"alias",
")",
"{",
"container",
".",
"put",
"(",
"name",
",",
"type",
")",
";",
"... | Configure the mapping between a database column and a field, including definition of
an alias.
@param container column to field map
@param name column name
@param type field type
@param alias field alias | [
"Configure",
"the",
"mapping",
"between",
"a",
"database",
"column",
"and",
"a",
"field",
"including",
"definition",
"of",
"an",
"alias",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L504-L511 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getString | public String getString(Integer type)
{
String result = null;
byte[] item = m_map.get(type);
if (item != null)
{
result = m_data.getString(getOffset(item));
}
return (result);
} | java | public String getString(Integer type)
{
String result = null;
byte[] item = m_map.get(type);
if (item != null)
{
result = m_data.getString(getOffset(item));
}
return (result);
} | [
"public",
"String",
"getString",
"(",
"Integer",
"type",
")",
"{",
"String",
"result",
"=",
"null",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"m_data",
... | Retrieves a string value from the extended data.
@param type Type identifier
@return string value | [
"Retrieves",
"a",
"string",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L79-L90 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getInt | public int getInt(Integer type)
{
int result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getInt(item, 0);
}
return (result);
} | java | public int getInt(Integer type)
{
int result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getInt(item, 0);
}
return (result);
} | [
"public",
"int",
"getInt",
"(",
"Integer",
"type",
")",
"{",
"int",
"result",
"=",
"0",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"MPPUtility",
".",
... | Retrieves an integer value from the extended data.
@param type Type identifier
@return integer value | [
"Retrieves",
"an",
"integer",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L136-L147 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getLong | public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0);
}
return (result);
} | java | public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0);
}
return (result);
} | [
"public",
"long",
"getLong",
"(",
"Integer",
"type",
")",
"{",
"long",
"result",
"=",
"0",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"MPPUtility",
"."... | Retrieves a long value from the extended data.
@param type Type identifier
@return long value | [
"Retrieves",
"a",
"long",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L155-L166 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java | ResourceAssignmentFactory.processHyperlinkData | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | java | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | [
"private",
"void",
"processHyperlinkData",
"(",
"ResourceAssignment",
"assignment",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"12",
";",
"offset",
"+=",
"12",
";",
"String",
"hyperlink",
"="... | Extract assignment hyperlink data.
@param assignment assignment instance
@param data hyperlink data | [
"Extract",
"assignment",
"hyperlink",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L277-L303 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java | ResourceAssignmentFactory.createTimephasedData | private void createTimephasedData(ProjectFile file, ResourceAssignment assignment, List<TimephasedWork> timephasedPlanned, List<TimephasedWork> timephasedComplete)
{
if (timephasedPlanned.isEmpty() && timephasedComplete.isEmpty())
{
Duration totalMinutes = assignment.getWork().convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
Duration workPerDay;
if (assignment.getResource() == null || assignment.getResource().getType() == ResourceType.WORK)
{
workPerDay = totalMinutes.getDuration() == 0 ? totalMinutes : ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
int units = NumberHelper.getInt(assignment.getUnits());
if (units != 100)
{
workPerDay = Duration.getInstance((workPerDay.getDuration() * units) / 100.0, workPerDay.getUnits());
}
}
else
{
if (assignment.getVariableRateUnits() == null)
{
Duration workingDays = assignment.getCalendar().getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.DAYS);
double units = NumberHelper.getDouble(assignment.getUnits());
double unitsPerDayAsMinutes = (units * 60) / (workingDays.getDuration() * 100);
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
else
{
double unitsPerHour = NumberHelper.getDouble(assignment.getUnits());
workPerDay = ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
Duration hoursPerDay = workPerDay.convertUnits(TimeUnit.HOURS, file.getProjectProperties());
double unitsPerDayAsHours = (unitsPerHour * hoursPerDay.getDuration()) / 100;
double unitsPerDayAsMinutes = unitsPerDayAsHours * 60;
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
}
Duration overtimeWork = assignment.getOvertimeWork();
if (overtimeWork != null && overtimeWork.getDuration() != 0)
{
Duration totalOvertimeMinutes = overtimeWork.convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
totalMinutes = Duration.getInstance(totalMinutes.getDuration() - totalOvertimeMinutes.getDuration(), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(assignment.getStart());
tra.setAmountPerDay(workPerDay);
tra.setModified(false);
tra.setFinish(assignment.getFinish());
tra.setTotalAmount(totalMinutes);
timephasedPlanned.add(tra);
}
} | java | private void createTimephasedData(ProjectFile file, ResourceAssignment assignment, List<TimephasedWork> timephasedPlanned, List<TimephasedWork> timephasedComplete)
{
if (timephasedPlanned.isEmpty() && timephasedComplete.isEmpty())
{
Duration totalMinutes = assignment.getWork().convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
Duration workPerDay;
if (assignment.getResource() == null || assignment.getResource().getType() == ResourceType.WORK)
{
workPerDay = totalMinutes.getDuration() == 0 ? totalMinutes : ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
int units = NumberHelper.getInt(assignment.getUnits());
if (units != 100)
{
workPerDay = Duration.getInstance((workPerDay.getDuration() * units) / 100.0, workPerDay.getUnits());
}
}
else
{
if (assignment.getVariableRateUnits() == null)
{
Duration workingDays = assignment.getCalendar().getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.DAYS);
double units = NumberHelper.getDouble(assignment.getUnits());
double unitsPerDayAsMinutes = (units * 60) / (workingDays.getDuration() * 100);
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
else
{
double unitsPerHour = NumberHelper.getDouble(assignment.getUnits());
workPerDay = ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
Duration hoursPerDay = workPerDay.convertUnits(TimeUnit.HOURS, file.getProjectProperties());
double unitsPerDayAsHours = (unitsPerHour * hoursPerDay.getDuration()) / 100;
double unitsPerDayAsMinutes = unitsPerDayAsHours * 60;
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
}
Duration overtimeWork = assignment.getOvertimeWork();
if (overtimeWork != null && overtimeWork.getDuration() != 0)
{
Duration totalOvertimeMinutes = overtimeWork.convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
totalMinutes = Duration.getInstance(totalMinutes.getDuration() - totalOvertimeMinutes.getDuration(), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(assignment.getStart());
tra.setAmountPerDay(workPerDay);
tra.setModified(false);
tra.setFinish(assignment.getFinish());
tra.setTotalAmount(totalMinutes);
timephasedPlanned.add(tra);
}
} | [
"private",
"void",
"createTimephasedData",
"(",
"ProjectFile",
"file",
",",
"ResourceAssignment",
"assignment",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedPlanned",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedComplete",
")",
"{",
"if",
"(",
"timepha... | Method used to create missing timephased data.
@param file project file
@param assignment resource assignment
@param timephasedPlanned planned timephased data
@param timephasedComplete complete timephased data | [
"Method",
"used",
"to",
"create",
"missing",
"timephased",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L313-L365 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printTimestamp | public static final String printTimestamp(Date value)
{
return (value == null ? null : TIMESTAMP_FORMAT.get().format(value));
} | java | public static final String printTimestamp(Date value)
{
return (value == null ? null : TIMESTAMP_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printTimestamp",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"TIMESTAMP_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print a timestamp value.
@param value time value
@return time value | [
"Print",
"a",
"timestamp",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L72-L75 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.parseDuration | public static final Duration parseDuration(String value)
{
return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);
} | java | public static final Duration parseDuration(String value)
{
return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);
} | [
"public",
"static",
"final",
"Duration",
"parseDuration",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Duration",
".",
"getInstance",
"(",
"Double",
".",
"parseDouble",
"(",
"value",
")",
",",
"TimeUnit",
".",
"DAYS... | Parse a duration value.
@param value duration value
@return Duration instance | [
"Parse",
"a",
"duration",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L83-L86 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printDuration | public static final String printDuration(Duration value)
{
return value == null ? null : Double.toString(value.getDuration());
} | java | public static final String printDuration(Duration value)
{
return value == null ? null : Double.toString(value.getDuration());
} | [
"public",
"static",
"final",
"String",
"printDuration",
"(",
"Duration",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"toString",
"(",
"value",
".",
"getDuration",
"(",
")",
")",
";",
"}"
] | Print a duration value.
@param value Duration instance
@return string representation of a duration | [
"Print",
"a",
"duration",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L94-L97 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printDate | public static final String printDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | java | public static final String printDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printDate",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"DATE_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print a date.
@param value Date instance
@return string representation of a date | [
"Print",
"a",
"date",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L131-L134 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.parsePercent | public static final Double parsePercent(String value)
{
return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);
} | java | public static final Double parsePercent(String value)
{
return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);
} | [
"public",
"static",
"final",
"Double",
"parsePercent",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"valueOf",
"(",
"Double",
".",
"parseDouble",
"(",
"value",
")",
"*",
"100.0",
")",
";",
"}"
] | Parse a percent complete value.
@param value sting representation of a percent complete value.
@return Double instance | [
"Parse",
"a",
"percent",
"complete",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L142-L145 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printPercent | public static final String printPercent(Double value)
{
return value == null ? null : Double.toString(value.doubleValue() / 100.0);
} | java | public static final String printPercent(Double value)
{
return value == null ? null : Double.toString(value.doubleValue() / 100.0);
} | [
"public",
"static",
"final",
"String",
"printPercent",
"(",
"Double",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"toString",
"(",
"value",
".",
"doubleValue",
"(",
")",
"/",
"100.0",
")",
";",
"}"
] | Print a percent complete value.
@param value Double instance
@return percent complete value | [
"Print",
"a",
"percent",
"complete",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L153-L156 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/conceptdraw/schema/PPVItemsType.java | PPVItemsType.getPPVItem | public List<PPVItemsType.PPVItem> getPPVItem()
{
if (ppvItem == null)
{
ppvItem = new ArrayList<PPVItemsType.PPVItem>();
}
return this.ppvItem;
} | java | public List<PPVItemsType.PPVItem> getPPVItem()
{
if (ppvItem == null)
{
ppvItem = new ArrayList<PPVItemsType.PPVItem>();
}
return this.ppvItem;
} | [
"public",
"List",
"<",
"PPVItemsType",
".",
"PPVItem",
">",
"getPPVItem",
"(",
")",
"{",
"if",
"(",
"ppvItem",
"==",
"null",
")",
"{",
"ppvItem",
"=",
"new",
"ArrayList",
"<",
"PPVItemsType",
".",
"PPVItem",
">",
"(",
")",
";",
"}",
"return",
"this",
... | Gets the value of the ppvItem property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the ppvItem property.
<p>
For example, to add a new item, do as follows:
<pre>
getPPVItem().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link PPVItemsType.PPVItem } | [
"Gets",
"the",
"value",
"of",
"the",
"ppvItem",
"property",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/schema/PPVItemsType.java#L112-L119 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getCustomField | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | java | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | [
"public",
"CustomField",
"getCustomField",
"(",
"FieldType",
"field",
")",
"{",
"CustomField",
"result",
"=",
"m_configMap",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"CustomField",
"(",
"field",... | Retrieve configuration details for a given custom field.
@param field required custom field
@return configuration detail | [
"Retrieve",
"configuration",
"details",
"for",
"a",
"given",
"custom",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L44-L53 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.registerAlias | void registerAlias(FieldType type, String alias)
{
m_aliasMap.put(new Pair<FieldTypeClass, String>(type.getFieldTypeClass(), alias), type);
} | java | void registerAlias(FieldType type, String alias)
{
m_aliasMap.put(new Pair<FieldTypeClass, String>(type.getFieldTypeClass(), alias), type);
} | [
"void",
"registerAlias",
"(",
"FieldType",
"type",
",",
"String",
"alias",
")",
"{",
"m_aliasMap",
".",
"put",
"(",
"new",
"Pair",
"<",
"FieldTypeClass",
",",
"String",
">",
"(",
"type",
".",
"getFieldTypeClass",
"(",
")",
",",
"alias",
")",
",",
"type",... | When an alias for a field is added, index it here to allow lookup by alias and type.
@param type field type
@param alias field alias | [
"When",
"an",
"alias",
"for",
"a",
"field",
"is",
"added",
"index",
"it",
"here",
"to",
"allow",
"lookup",
"by",
"alias",
"and",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L107-L110 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getFieldByAlias | public FieldType getFieldByAlias(FieldTypeClass typeClass, String alias)
{
return m_aliasMap.get(new Pair<FieldTypeClass, String>(typeClass, alias));
} | java | public FieldType getFieldByAlias(FieldTypeClass typeClass, String alias)
{
return m_aliasMap.get(new Pair<FieldTypeClass, String>(typeClass, alias));
} | [
"public",
"FieldType",
"getFieldByAlias",
"(",
"FieldTypeClass",
"typeClass",
",",
"String",
"alias",
")",
"{",
"return",
"m_aliasMap",
".",
"get",
"(",
"new",
"Pair",
"<",
"FieldTypeClass",
",",
"String",
">",
"(",
"typeClass",
",",
"alias",
")",
")",
";",
... | Retrieve a field from a particular entity using its alias.
@param typeClass the type of entity we are interested in
@param alias the alias
@return the field type referred to be the alias, or null if not found | [
"Retrieve",
"a",
"field",
"from",
"a",
"particular",
"entity",
"using",
"its",
"alias",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L119-L122 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createFieldMap | private void createFieldMap(byte[] data)
{
int index = 0;
int lastDataBlockOffset = 0;
int dataBlockIndex = 0;
while (index < data.length)
{
long mask = MPPUtility.getInt(data, index + 0);
//mask = mask << 4;
int dataBlockOffset = MPPUtility.getShort(data, index + 4);
//int metaFlags = MPPUtility.getByte(data, index + 8);
FieldType type = getFieldType(MPPUtility.getInt(data, index + 12));
int category = MPPUtility.getShort(data, index + 20);
//int sizeInBytes = MPPUtility.getShort(data, index + 22);
//int metaIndex = MPPUtility.getInt(data, index + 24);
//
// Categories
//
// 02 - Short values [RATE_UNITS, WORKGROUP, ACCRUE, TIME_UNITS, PRIORITY, TASK_TYPE, CONSTRAINT, ACCRUE, PERCENTAGE, SHORT, WORK_UNITS] - BOOKING_TYPE, EARNED_VALUE_METHOD, DELIVERABLE_TYPE, RESOURCE_REQUEST_TYPE - we have as string in MPXJ????
// 03 - Int values [DURATION, INTEGER] - Recalc outline codes as Boolean?
// 05 - Rate, Number [RATE, NUMERIC]
// 08 - String (and some durations!!!) [STRING, DURATION]
// 0B - Boolean (meta block 0?) - [BOOLEAN]
// 13 - Date - [DATE]
// 48 - GUID - [GUID]
// 64 - Boolean (meta block 1?)- [BOOLEAN]
// 65 - Work, Currency [WORK, CURRENCY]
// 66 - Units [UNITS]
// 1D - Raw bytes [BINARY, ASCII_STRING] - Exception: outline code indexes, they are integers, but stored as part of a binary block
int varDataKey;
if (useTypeAsVarDataKey())
{
Integer substitute = substituteVarDataKey(type);
if (substitute == null)
{
varDataKey = (MPPUtility.getInt(data, index + 12) & 0x0000FFFF);
}
else
{
varDataKey = substitute.intValue();
}
}
else
{
varDataKey = MPPUtility.getByte(data, index + 6);
}
FieldLocation location;
int metaBlock;
switch (category)
{
case 0x0B:
{
location = FieldLocation.META_DATA;
metaBlock = 0;
break;
}
case 0x64:
{
location = FieldLocation.META_DATA;
metaBlock = 1;
break;
}
default:
{
metaBlock = 0;
if (dataBlockOffset != 65535)
{
location = FieldLocation.FIXED_DATA;
if (dataBlockOffset < lastDataBlockOffset)
{
++dataBlockIndex;
}
lastDataBlockOffset = dataBlockOffset;
int typeSize = getFixedDataFieldSize(type);
if (dataBlockOffset + typeSize > m_maxFixedDataSize[dataBlockIndex])
{
m_maxFixedDataSize[dataBlockIndex] = dataBlockOffset + typeSize;
}
}
else
{
if (varDataKey != 0)
{
location = FieldLocation.VAR_DATA;
}
else
{
location = FieldLocation.UNKNOWN;
}
}
break;
}
}
FieldItem item = new FieldItem(type, location, dataBlockIndex, dataBlockOffset, varDataKey, mask, metaBlock);
if (m_debug)
{
System.out.println(ByteArrayHelper.hexdump(data, index, 28, false) + " " + item + " mpxjDataType=" + item.getType().getDataType() + " index=" + index);
}
m_map.put(type, item);
index += 28;
}
} | java | private void createFieldMap(byte[] data)
{
int index = 0;
int lastDataBlockOffset = 0;
int dataBlockIndex = 0;
while (index < data.length)
{
long mask = MPPUtility.getInt(data, index + 0);
//mask = mask << 4;
int dataBlockOffset = MPPUtility.getShort(data, index + 4);
//int metaFlags = MPPUtility.getByte(data, index + 8);
FieldType type = getFieldType(MPPUtility.getInt(data, index + 12));
int category = MPPUtility.getShort(data, index + 20);
//int sizeInBytes = MPPUtility.getShort(data, index + 22);
//int metaIndex = MPPUtility.getInt(data, index + 24);
//
// Categories
//
// 02 - Short values [RATE_UNITS, WORKGROUP, ACCRUE, TIME_UNITS, PRIORITY, TASK_TYPE, CONSTRAINT, ACCRUE, PERCENTAGE, SHORT, WORK_UNITS] - BOOKING_TYPE, EARNED_VALUE_METHOD, DELIVERABLE_TYPE, RESOURCE_REQUEST_TYPE - we have as string in MPXJ????
// 03 - Int values [DURATION, INTEGER] - Recalc outline codes as Boolean?
// 05 - Rate, Number [RATE, NUMERIC]
// 08 - String (and some durations!!!) [STRING, DURATION]
// 0B - Boolean (meta block 0?) - [BOOLEAN]
// 13 - Date - [DATE]
// 48 - GUID - [GUID]
// 64 - Boolean (meta block 1?)- [BOOLEAN]
// 65 - Work, Currency [WORK, CURRENCY]
// 66 - Units [UNITS]
// 1D - Raw bytes [BINARY, ASCII_STRING] - Exception: outline code indexes, they are integers, but stored as part of a binary block
int varDataKey;
if (useTypeAsVarDataKey())
{
Integer substitute = substituteVarDataKey(type);
if (substitute == null)
{
varDataKey = (MPPUtility.getInt(data, index + 12) & 0x0000FFFF);
}
else
{
varDataKey = substitute.intValue();
}
}
else
{
varDataKey = MPPUtility.getByte(data, index + 6);
}
FieldLocation location;
int metaBlock;
switch (category)
{
case 0x0B:
{
location = FieldLocation.META_DATA;
metaBlock = 0;
break;
}
case 0x64:
{
location = FieldLocation.META_DATA;
metaBlock = 1;
break;
}
default:
{
metaBlock = 0;
if (dataBlockOffset != 65535)
{
location = FieldLocation.FIXED_DATA;
if (dataBlockOffset < lastDataBlockOffset)
{
++dataBlockIndex;
}
lastDataBlockOffset = dataBlockOffset;
int typeSize = getFixedDataFieldSize(type);
if (dataBlockOffset + typeSize > m_maxFixedDataSize[dataBlockIndex])
{
m_maxFixedDataSize[dataBlockIndex] = dataBlockOffset + typeSize;
}
}
else
{
if (varDataKey != 0)
{
location = FieldLocation.VAR_DATA;
}
else
{
location = FieldLocation.UNKNOWN;
}
}
break;
}
}
FieldItem item = new FieldItem(type, location, dataBlockIndex, dataBlockOffset, varDataKey, mask, metaBlock);
if (m_debug)
{
System.out.println(ByteArrayHelper.hexdump(data, index, 28, false) + " " + item + " mpxjDataType=" + item.getType().getDataType() + " index=" + index);
}
m_map.put(type, item);
index += 28;
}
} | [
"private",
"void",
"createFieldMap",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"lastDataBlockOffset",
"=",
"0",
";",
"int",
"dataBlockIndex",
"=",
"0",
";",
"while",
"(",
"index",
"<",
"data",
".",
"length",
")",
... | Generic method used to create a field map from a block of data.
@param data field map data | [
"Generic",
"method",
"used",
"to",
"create",
"a",
"field",
"map",
"from",
"a",
"block",
"of",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L88-L200 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createTaskFieldMap | public void createTaskFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : TASK_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultTaskData());
}
else
{
createFieldMap(fieldMapData);
}
} | java | public void createTaskFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : TASK_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultTaskData());
}
else
{
createFieldMap(fieldMapData);
}
} | [
"public",
"void",
"createTaskFieldMap",
"(",
"Props",
"props",
")",
"{",
"byte",
"[",
"]",
"fieldMapData",
"=",
"null",
";",
"for",
"(",
"Integer",
"key",
":",
"TASK_KEYS",
")",
"{",
"fieldMapData",
"=",
"props",
".",
"getByteArray",
"(",
"key",
")",
";"... | Creates a field map for tasks.
@param props props data | [
"Creates",
"a",
"field",
"map",
"for",
"tasks",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L261-L281 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createRelationFieldMap | public void createRelationFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : RELATION_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultRelationData());
}
else
{
createFieldMap(fieldMapData);
}
} | java | public void createRelationFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : RELATION_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultRelationData());
}
else
{
createFieldMap(fieldMapData);
}
} | [
"public",
"void",
"createRelationFieldMap",
"(",
"Props",
"props",
")",
"{",
"byte",
"[",
"]",
"fieldMapData",
"=",
"null",
";",
"for",
"(",
"Integer",
"key",
":",
"RELATION_KEYS",
")",
"{",
"fieldMapData",
"=",
"props",
".",
"getByteArray",
"(",
"key",
")... | Creates a field map for relations.
@param props props data | [
"Creates",
"a",
"field",
"map",
"for",
"relations",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L288-L308 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createEnterpriseCustomFieldMap | public void createEnterpriseCustomFieldMap(Props props, Class<?> c)
{
byte[] fieldMapData = null;
for (Integer key : ENTERPRISE_CUSTOM_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData != null)
{
int index = 4;
while (index < fieldMapData.length)
{
//Looks like the custom fields have varying types, it may be that the last byte of the four represents the type?
//System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false));
int typeValue = MPPUtility.getInt(fieldMapData, index);
FieldType type = getFieldType(typeValue);
if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field"))
{
int varDataKey = (typeValue & 0xFFFF);
FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0);
m_map.put(type, item);
//System.out.println(item);
}
//System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue));
index += 4;
}
}
} | java | public void createEnterpriseCustomFieldMap(Props props, Class<?> c)
{
byte[] fieldMapData = null;
for (Integer key : ENTERPRISE_CUSTOM_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData != null)
{
int index = 4;
while (index < fieldMapData.length)
{
//Looks like the custom fields have varying types, it may be that the last byte of the four represents the type?
//System.out.println(ByteArrayHelper.hexdump(fieldMapData, index, 4, false));
int typeValue = MPPUtility.getInt(fieldMapData, index);
FieldType type = getFieldType(typeValue);
if (type != null && type.getClass() == c && type.toString().startsWith("Enterprise Custom Field"))
{
int varDataKey = (typeValue & 0xFFFF);
FieldItem item = new FieldItem(type, FieldLocation.VAR_DATA, 0, 0, varDataKey, 0, 0);
m_map.put(type, item);
//System.out.println(item);
}
//System.out.println((type == null ? "?" : type.getClass().getSimpleName() + "." + type) + " " + Integer.toHexString(typeValue));
index += 4;
}
}
} | [
"public",
"void",
"createEnterpriseCustomFieldMap",
"(",
"Props",
"props",
",",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"byte",
"[",
"]",
"fieldMapData",
"=",
"null",
";",
"for",
"(",
"Integer",
"key",
":",
"ENTERPRISE_CUSTOM_KEYS",
")",
"{",
"fieldMapData",
... | Create a field map for enterprise custom fields.
@param props props data
@param c target class | [
"Create",
"a",
"field",
"map",
"for",
"enterprise",
"custom",
"fields",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L316-L349 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createResourceFieldMap | public void createResourceFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : RESOURCE_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultResourceData());
}
else
{
createFieldMap(fieldMapData);
}
} | java | public void createResourceFieldMap(Props props)
{
byte[] fieldMapData = null;
for (Integer key : RESOURCE_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultResourceData());
}
else
{
createFieldMap(fieldMapData);
}
} | [
"public",
"void",
"createResourceFieldMap",
"(",
"Props",
"props",
")",
"{",
"byte",
"[",
"]",
"fieldMapData",
"=",
"null",
";",
"for",
"(",
"Integer",
"key",
":",
"RESOURCE_KEYS",
")",
"{",
"fieldMapData",
"=",
"props",
".",
"getByteArray",
"(",
"key",
")... | Creates a field map for resources.
@param props props data | [
"Creates",
"a",
"field",
"map",
"for",
"resources",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L356-L376 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.createAssignmentFieldMap | public void createAssignmentFieldMap(Props props)
{
//System.out.println("ASSIGN");
byte[] fieldMapData = null;
for (Integer key : ASSIGNMENT_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultAssignmentData());
}
else
{
createFieldMap(fieldMapData);
}
} | java | public void createAssignmentFieldMap(Props props)
{
//System.out.println("ASSIGN");
byte[] fieldMapData = null;
for (Integer key : ASSIGNMENT_KEYS)
{
fieldMapData = props.getByteArray(key);
if (fieldMapData != null)
{
break;
}
}
if (fieldMapData == null)
{
populateDefaultData(getDefaultAssignmentData());
}
else
{
createFieldMap(fieldMapData);
}
} | [
"public",
"void",
"createAssignmentFieldMap",
"(",
"Props",
"props",
")",
"{",
"//System.out.println(\"ASSIGN\");",
"byte",
"[",
"]",
"fieldMapData",
"=",
"null",
";",
"for",
"(",
"Integer",
"key",
":",
"ASSIGNMENT_KEYS",
")",
"{",
"fieldMapData",
"=",
"props",
... | Creates a field map for assignments.
@param props props data | [
"Creates",
"a",
"field",
"map",
"for",
"assignments",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L383-L404 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.populateDefaultData | private void populateDefaultData(FieldItem[] defaultData)
{
for (FieldItem item : defaultData)
{
m_map.put(item.getType(), item);
}
} | java | private void populateDefaultData(FieldItem[] defaultData)
{
for (FieldItem item : defaultData)
{
m_map.put(item.getType(), item);
}
} | [
"private",
"void",
"populateDefaultData",
"(",
"FieldItem",
"[",
"]",
"defaultData",
")",
"{",
"for",
"(",
"FieldItem",
"item",
":",
"defaultData",
")",
"{",
"m_map",
".",
"put",
"(",
"item",
".",
"getType",
"(",
")",
",",
"item",
")",
";",
"}",
"}"
] | This method takes an array of data and uses this to populate the
field map.
@param defaultData field map default data | [
"This",
"method",
"takes",
"an",
"array",
"of",
"data",
"and",
"uses",
"this",
"to",
"populate",
"the",
"field",
"map",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L412-L418 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.populateContainer | public void populateContainer(Class<? extends FieldType> type, FieldContainer container, Integer id, byte[][] fixedData, Var2Data varData)
{
//System.out.println(container.getClass().getSimpleName()+": " + id);
for (FieldItem item : m_map.values())
{
if (item.getType().getClass().equals(type))
{
//System.out.println(item.m_type);
Object value = item.read(id, fixedData, varData);
//System.out.println(item.m_type.getClass().getSimpleName() + "." + item.m_type + ": " + value);
container.set(item.getType(), value);
}
}
} | java | public void populateContainer(Class<? extends FieldType> type, FieldContainer container, Integer id, byte[][] fixedData, Var2Data varData)
{
//System.out.println(container.getClass().getSimpleName()+": " + id);
for (FieldItem item : m_map.values())
{
if (item.getType().getClass().equals(type))
{
//System.out.println(item.m_type);
Object value = item.read(id, fixedData, varData);
//System.out.println(item.m_type.getClass().getSimpleName() + "." + item.m_type + ": " + value);
container.set(item.getType(), value);
}
}
} | [
"public",
"void",
"populateContainer",
"(",
"Class",
"<",
"?",
"extends",
"FieldType",
">",
"type",
",",
"FieldContainer",
"container",
",",
"Integer",
"id",
",",
"byte",
"[",
"]",
"[",
"]",
"fixedData",
",",
"Var2Data",
"varData",
")",
"{",
"//System.out.pr... | Given a container, and a set of raw data blocks, this method extracts
the field data and writes it into the container.
@param type expected type
@param container field container
@param id entity ID
@param fixedData fixed data block
@param varData var data block | [
"Given",
"a",
"container",
"and",
"a",
"set",
"of",
"raw",
"data",
"blocks",
"this",
"method",
"extracts",
"the",
"field",
"data",
"and",
"writes",
"it",
"into",
"the",
"container",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L430-L443 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getFixedDataOffset | public int getFixedDataOffset(FieldType type)
{
int result;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFixedDataOffset();
}
else
{
result = -1;
}
return result;
} | java | public int getFixedDataOffset(FieldType type)
{
int result;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFixedDataOffset();
}
else
{
result = -1;
}
return result;
} | [
"public",
"int",
"getFixedDataOffset",
"(",
"FieldType",
"type",
")",
"{",
"int",
"result",
";",
"FieldItem",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"item",
".",
"getFixedDataO... | Retrieve the fixed data offset for a specific field.
@param type field type
@return offset | [
"Retrieve",
"the",
"fixed",
"data",
"offset",
"for",
"a",
"specific",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L462-L475 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getVarDataKey | public Integer getVarDataKey(FieldType type)
{
Integer result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getVarDataKey();
}
return result;
} | java | public Integer getVarDataKey(FieldType type)
{
Integer result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getVarDataKey();
}
return result;
} | [
"public",
"Integer",
"getVarDataKey",
"(",
"FieldType",
"type",
")",
"{",
"Integer",
"result",
"=",
"null",
";",
"FieldItem",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"item",
"... | Retrieve the var data key for a specific field.
@param type field type
@return var data key | [
"Retrieve",
"the",
"var",
"data",
"key",
"for",
"a",
"specific",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L483-L492 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getFieldTypeFromVarDataKey | public FieldType getFieldTypeFromVarDataKey(Integer key)
{
FieldType result = null;
for (Entry<FieldType, FieldMap.FieldItem> entry : m_map.entrySet())
{
if (entry.getValue().getFieldLocation() == FieldLocation.VAR_DATA && entry.getValue().getVarDataKey().equals(key))
{
result = entry.getKey();
break;
}
}
return result;
} | java | public FieldType getFieldTypeFromVarDataKey(Integer key)
{
FieldType result = null;
for (Entry<FieldType, FieldMap.FieldItem> entry : m_map.entrySet())
{
if (entry.getValue().getFieldLocation() == FieldLocation.VAR_DATA && entry.getValue().getVarDataKey().equals(key))
{
result = entry.getKey();
break;
}
}
return result;
} | [
"public",
"FieldType",
"getFieldTypeFromVarDataKey",
"(",
"Integer",
"key",
")",
"{",
"FieldType",
"result",
"=",
"null",
";",
"for",
"(",
"Entry",
"<",
"FieldType",
",",
"FieldMap",
".",
"FieldItem",
">",
"entry",
":",
"m_map",
".",
"entrySet",
"(",
")",
... | Used to map from a var data key to a field type. Note this
is designed for diagnostic use only, and uses an inefficient search.
@param key var data key
@return field type | [
"Used",
"to",
"map",
"from",
"a",
"var",
"data",
"key",
"to",
"a",
"field",
"type",
".",
"Note",
"this",
"is",
"designed",
"for",
"diagnostic",
"use",
"only",
"and",
"uses",
"an",
"inefficient",
"search",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L501-L513 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getFieldLocation | public FieldLocation getFieldLocation(FieldType type)
{
FieldLocation result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFieldLocation();
}
return result;
} | java | public FieldLocation getFieldLocation(FieldType type)
{
FieldLocation result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.getFieldLocation();
}
return result;
} | [
"public",
"FieldLocation",
"getFieldLocation",
"(",
"FieldType",
"type",
")",
"{",
"FieldLocation",
"result",
"=",
"null",
";",
"FieldItem",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"="... | Retrieve the field location for a specific field.
@param type field type
@return field location | [
"Retrieve",
"the",
"field",
"location",
"for",
"a",
"specific",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L521-L531 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getFieldData | protected Object getFieldData(Integer id, FieldType type, byte[][] fixedData, Var2Data varData)
{
Object result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.read(id, fixedData, varData);
}
return result;
} | java | protected Object getFieldData(Integer id, FieldType type, byte[][] fixedData, Var2Data varData)
{
Object result = null;
FieldItem item = m_map.get(type);
if (item != null)
{
result = item.read(id, fixedData, varData);
}
return result;
} | [
"protected",
"Object",
"getFieldData",
"(",
"Integer",
"id",
",",
"FieldType",
"type",
",",
"byte",
"[",
"]",
"[",
"]",
"fixedData",
",",
"Var2Data",
"varData",
")",
"{",
"Object",
"result",
"=",
"null",
";",
"FieldItem",
"item",
"=",
"m_map",
".",
"get"... | Retrieve a single field value.
@param id parent entity ID
@param type field type
@param fixedData fixed data block
@param varData var data block
@return field value | [
"Retrieve",
"a",
"single",
"field",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L542-L553 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.dumpKnownFieldMaps | public void dumpKnownFieldMaps(Props props)
{
//for (int key=131092; key < 131098; key++)
for (int key = 50331668; key < 50331674; key++)
{
byte[] fieldMapData = props.getByteArray(Integer.valueOf(key));
if (fieldMapData != null)
{
System.out.println("KEY: " + key);
createFieldMap(fieldMapData);
System.out.println(toString());
clear();
}
}
} | java | public void dumpKnownFieldMaps(Props props)
{
//for (int key=131092; key < 131098; key++)
for (int key = 50331668; key < 50331674; key++)
{
byte[] fieldMapData = props.getByteArray(Integer.valueOf(key));
if (fieldMapData != null)
{
System.out.println("KEY: " + key);
createFieldMap(fieldMapData);
System.out.println(toString());
clear();
}
}
} | [
"public",
"void",
"dumpKnownFieldMaps",
"(",
"Props",
"props",
")",
"{",
"//for (int key=131092; key < 131098; key++)",
"for",
"(",
"int",
"key",
"=",
"50331668",
";",
"key",
"<",
"50331674",
";",
"key",
"++",
")",
"{",
"byte",
"[",
"]",
"fieldMapData",
"=",
... | Diagnostic method used to dump known field map data.
@param props props block containing field map data | [
"Diagnostic",
"method",
"used",
"to",
"dump",
"known",
"field",
"map",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L579-L593 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FieldMap.java | FieldMap.getFixedDataFieldSize | private int getFixedDataFieldSize(FieldType type)
{
int result = 0;
DataType dataType = type.getDataType();
if (dataType != null)
{
switch (dataType)
{
case DATE:
case INTEGER:
case DURATION:
{
result = 4;
break;
}
case TIME_UNITS:
case CONSTRAINT:
case PRIORITY:
case PERCENTAGE:
case TASK_TYPE:
case ACCRUE:
case SHORT:
case BOOLEAN:
case DELAY:
case WORKGROUP:
case RATE_UNITS:
case EARNED_VALUE_METHOD:
case RESOURCE_REQUEST_TYPE:
{
result = 2;
break;
}
case CURRENCY:
case UNITS:
case RATE:
case WORK:
{
result = 8;
break;
}
case WORK_UNITS:
{
result = 1;
break;
}
case GUID:
{
result = 16;
break;
}
default:
{
result = 0;
break;
}
}
}
return result;
} | java | private int getFixedDataFieldSize(FieldType type)
{
int result = 0;
DataType dataType = type.getDataType();
if (dataType != null)
{
switch (dataType)
{
case DATE:
case INTEGER:
case DURATION:
{
result = 4;
break;
}
case TIME_UNITS:
case CONSTRAINT:
case PRIORITY:
case PERCENTAGE:
case TASK_TYPE:
case ACCRUE:
case SHORT:
case BOOLEAN:
case DELAY:
case WORKGROUP:
case RATE_UNITS:
case EARNED_VALUE_METHOD:
case RESOURCE_REQUEST_TYPE:
{
result = 2;
break;
}
case CURRENCY:
case UNITS:
case RATE:
case WORK:
{
result = 8;
break;
}
case WORK_UNITS:
{
result = 1;
break;
}
case GUID:
{
result = 16;
break;
}
default:
{
result = 0;
break;
}
}
}
return result;
} | [
"private",
"int",
"getFixedDataFieldSize",
"(",
"FieldType",
"type",
")",
"{",
"int",
"result",
"=",
"0",
";",
"DataType",
"dataType",
"=",
"type",
".",
"getDataType",
"(",
")",
";",
"if",
"(",
"dataType",
"!=",
"null",
")",
"{",
"switch",
"(",
"dataType... | Determine the size of a field in a fixed data block.
@param type field data type
@return field size in bytes | [
"Determine",
"the",
"size",
"of",
"a",
"field",
"in",
"a",
"fixed",
"data",
"block",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FieldMap.java#L601-L665 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.setParent | void setParent(ProjectCalendarWeek parent)
{
m_parent = parent;
for (int loop = 0; loop < m_days.length; loop++)
{
if (m_days[loop] == null)
{
m_days[loop] = DayType.DEFAULT;
}
}
} | java | void setParent(ProjectCalendarWeek parent)
{
m_parent = parent;
for (int loop = 0; loop < m_days.length; loop++)
{
if (m_days[loop] == null)
{
m_days[loop] = DayType.DEFAULT;
}
}
} | [
"void",
"setParent",
"(",
"ProjectCalendarWeek",
"parent",
")",
"{",
"m_parent",
"=",
"parent",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"m_days",
".",
"length",
";",
"loop",
"++",
")",
"{",
"if",
"(",
"m_days",
"[",
"loop",
"]",
... | Set the parent from which this week is derived.
@param parent parent week | [
"Set",
"the",
"parent",
"from",
"which",
"this",
"week",
"is",
"derived",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L94-L105 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.getHours | public ProjectCalendarHours getHours(Day day)
{
ProjectCalendarHours result = getCalendarHours(day);
if (result == null)
{
//
// If this is a base calendar and we have no hours, then we
// have a problem - so we add the default hours and try again
//
if (m_parent == null)
{
// Only add default hours for the day that is 'missing' to avoid overwriting real calendar hours
addDefaultCalendarHours(day);
result = getCalendarHours(day);
}
else
{
result = m_parent.getHours(day);
}
}
return result;
} | java | public ProjectCalendarHours getHours(Day day)
{
ProjectCalendarHours result = getCalendarHours(day);
if (result == null)
{
//
// If this is a base calendar and we have no hours, then we
// have a problem - so we add the default hours and try again
//
if (m_parent == null)
{
// Only add default hours for the day that is 'missing' to avoid overwriting real calendar hours
addDefaultCalendarHours(day);
result = getCalendarHours(day);
}
else
{
result = m_parent.getHours(day);
}
}
return result;
} | [
"public",
"ProjectCalendarHours",
"getHours",
"(",
"Day",
"day",
")",
"{",
"ProjectCalendarHours",
"result",
"=",
"getCalendarHours",
"(",
"day",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"//",
"// If this is a base calendar and we have no hours, then we"... | This method retrieves the calendar hours for the specified day.
Note that if this is a derived calendar, then this method
will refer to the base calendar where no hours are specified
in the derived calendar.
@param day Day instance
@return calendar hours | [
"This",
"method",
"retrieves",
"the",
"calendar",
"hours",
"for",
"the",
"specified",
"day",
".",
"Note",
"that",
"if",
"this",
"is",
"a",
"derived",
"calendar",
"then",
"this",
"method",
"will",
"refer",
"to",
"the",
"base",
"calendar",
"where",
"no",
"ho... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L162-L183 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.addDefaultCalendarHours | public void addDefaultCalendarHours(Day day)
{
ProjectCalendarHours hours = addCalendarHours(day);
if (day != Day.SATURDAY && day != Day.SUNDAY)
{
hours.addRange(DEFAULT_WORKING_MORNING);
hours.addRange(DEFAULT_WORKING_AFTERNOON);
}
} | java | public void addDefaultCalendarHours(Day day)
{
ProjectCalendarHours hours = addCalendarHours(day);
if (day != Day.SATURDAY && day != Day.SUNDAY)
{
hours.addRange(DEFAULT_WORKING_MORNING);
hours.addRange(DEFAULT_WORKING_AFTERNOON);
}
} | [
"public",
"void",
"addDefaultCalendarHours",
"(",
"Day",
"day",
")",
"{",
"ProjectCalendarHours",
"hours",
"=",
"addCalendarHours",
"(",
"day",
")",
";",
"if",
"(",
"day",
"!=",
"Day",
".",
"SATURDAY",
"&&",
"day",
"!=",
"Day",
".",
"SUNDAY",
")",
"{",
"... | This is a convenience method used to add a default set of calendar
hours to a calendar.
@param day Day for which to add default hours for | [
"This",
"is",
"a",
"convenience",
"method",
"used",
"to",
"add",
"a",
"default",
"set",
"of",
"calendar",
"hours",
"to",
"a",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L203-L212 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.addCalendarHours | public ProjectCalendarHours addCalendarHours(Day day)
{
ProjectCalendarHours bch = new ProjectCalendarHours(this);
bch.setDay(day);
m_hours[day.getValue() - 1] = bch;
return (bch);
} | java | public ProjectCalendarHours addCalendarHours(Day day)
{
ProjectCalendarHours bch = new ProjectCalendarHours(this);
bch.setDay(day);
m_hours[day.getValue() - 1] = bch;
return (bch);
} | [
"public",
"ProjectCalendarHours",
"addCalendarHours",
"(",
"Day",
"day",
")",
"{",
"ProjectCalendarHours",
"bch",
"=",
"new",
"ProjectCalendarHours",
"(",
"this",
")",
";",
"bch",
".",
"setDay",
"(",
"day",
")",
";",
"m_hours",
"[",
"day",
".",
"getValue",
"... | Used to add working hours to the calendar. Note that the MPX file
definition allows a maximum of 7 calendar hours records to be added to
a single calendar.
@param day day number
@return new ProjectCalendarHours instance | [
"Used",
"to",
"add",
"working",
"hours",
"to",
"the",
"calendar",
".",
"Note",
"that",
"the",
"MPX",
"file",
"definition",
"allows",
"a",
"maximum",
"of",
"7",
"calendar",
"hours",
"records",
"to",
"be",
"added",
"to",
"a",
"single",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L222-L228 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.attachHoursToDay | public void attachHoursToDay(ProjectCalendarHours hours)
{
if (hours.getParentCalendar() != this)
{
throw new IllegalArgumentException();
}
m_hours[hours.getDay().getValue() - 1] = hours;
} | java | public void attachHoursToDay(ProjectCalendarHours hours)
{
if (hours.getParentCalendar() != this)
{
throw new IllegalArgumentException();
}
m_hours[hours.getDay().getValue() - 1] = hours;
} | [
"public",
"void",
"attachHoursToDay",
"(",
"ProjectCalendarHours",
"hours",
")",
"{",
"if",
"(",
"hours",
".",
"getParentCalendar",
"(",
")",
"!=",
"this",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"m_hours",
"[",
"hours",
"."... | Attaches a pre-existing set of hours to the correct
day within the calendar.
@param hours calendar hours instance | [
"Attaches",
"a",
"pre",
"-",
"existing",
"set",
"of",
"hours",
"to",
"the",
"correct",
"day",
"within",
"the",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L236-L243 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.removeHoursFromDay | public void removeHoursFromDay(ProjectCalendarHours hours)
{
if (hours.getParentCalendar() != this)
{
throw new IllegalArgumentException();
}
m_hours[hours.getDay().getValue() - 1] = null;
} | java | public void removeHoursFromDay(ProjectCalendarHours hours)
{
if (hours.getParentCalendar() != this)
{
throw new IllegalArgumentException();
}
m_hours[hours.getDay().getValue() - 1] = null;
} | [
"public",
"void",
"removeHoursFromDay",
"(",
"ProjectCalendarHours",
"hours",
")",
"{",
"if",
"(",
"hours",
".",
"getParentCalendar",
"(",
")",
"!=",
"this",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"m_hours",
"[",
"hours",
"... | Removes a set of calendar hours from the day to which they
are currently attached.
@param hours calendar hours instance | [
"Removes",
"a",
"set",
"of",
"calendar",
"hours",
"from",
"the",
"day",
"to",
"which",
"they",
"are",
"currently",
"attached",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L251-L258 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.setWorkingDay | public void setWorkingDay(Day day, boolean working)
{
setWorkingDay(day, (working ? DayType.WORKING : DayType.NON_WORKING));
} | java | public void setWorkingDay(Day day, boolean working)
{
setWorkingDay(day, (working ? DayType.WORKING : DayType.NON_WORKING));
} | [
"public",
"void",
"setWorkingDay",
"(",
"Day",
"day",
",",
"boolean",
"working",
")",
"{",
"setWorkingDay",
"(",
"day",
",",
"(",
"working",
"?",
"DayType",
".",
"WORKING",
":",
"DayType",
".",
"NON_WORKING",
")",
")",
";",
"}"
] | convenience method for setting working or non-working days.
@param day required day
@param working flag indicating if the day is a working day | [
"convenience",
"method",
"for",
"setting",
"working",
"or",
"non",
"-",
"working",
"days",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L294-L297 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendarWeek.java | ProjectCalendarWeek.setWorkingDay | public void setWorkingDay(Day day, DayType working)
{
DayType value;
if (working == null)
{
if (isDerived())
{
value = DayType.DEFAULT;
}
else
{
value = DayType.WORKING;
}
}
else
{
value = working;
}
m_days[day.getValue() - 1] = value;
} | java | public void setWorkingDay(Day day, DayType working)
{
DayType value;
if (working == null)
{
if (isDerived())
{
value = DayType.DEFAULT;
}
else
{
value = DayType.WORKING;
}
}
else
{
value = working;
}
m_days[day.getValue() - 1] = value;
} | [
"public",
"void",
"setWorkingDay",
"(",
"Day",
"day",
",",
"DayType",
"working",
")",
"{",
"DayType",
"value",
";",
"if",
"(",
"working",
"==",
"null",
")",
"{",
"if",
"(",
"isDerived",
"(",
")",
")",
"{",
"value",
"=",
"DayType",
".",
"DEFAULT",
";"... | This is a convenience method provided to allow a day to be set
as working or non-working, by using the day number to
identify the required day.
@param day required day
@param working flag indicating if the day is a working day | [
"This",
"is",
"a",
"convenience",
"method",
"provided",
"to",
"allow",
"a",
"day",
"to",
"be",
"set",
"as",
"working",
"or",
"non",
"-",
"working",
"by",
"using",
"the",
"day",
"number",
"to",
"identify",
"the",
"required",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarWeek.java#L307-L328 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.readCalendar | private void readCalendar(Gantt gantt)
{
Gantt.Calendar ganttCalendar = gantt.getCalendar();
m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart());
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setName("Standard");
m_projectFile.setDefaultCalendar(calendar);
String workingDays = ganttCalendar.getWorkDays();
calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1');
calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1');
calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1');
calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1');
calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1');
calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1');
calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1');
for (int i = 1; i <= 7; i++)
{
Day day = Day.getInstance(i);
ProjectCalendarHours hours = calendar.addCalendarHours(day);
if (calendar.isWorkingDay(day))
{
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
}
for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday())
{
ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate());
exception.setName(holiday.getContent());
}
} | java | private void readCalendar(Gantt gantt)
{
Gantt.Calendar ganttCalendar = gantt.getCalendar();
m_projectFile.getProjectProperties().setWeekStartDay(ganttCalendar.getWeekStart());
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setName("Standard");
m_projectFile.setDefaultCalendar(calendar);
String workingDays = ganttCalendar.getWorkDays();
calendar.setWorkingDay(Day.SUNDAY, workingDays.charAt(0) == '1');
calendar.setWorkingDay(Day.MONDAY, workingDays.charAt(1) == '1');
calendar.setWorkingDay(Day.TUESDAY, workingDays.charAt(2) == '1');
calendar.setWorkingDay(Day.WEDNESDAY, workingDays.charAt(3) == '1');
calendar.setWorkingDay(Day.THURSDAY, workingDays.charAt(4) == '1');
calendar.setWorkingDay(Day.FRIDAY, workingDays.charAt(5) == '1');
calendar.setWorkingDay(Day.SATURDAY, workingDays.charAt(6) == '1');
for (int i = 1; i <= 7; i++)
{
Day day = Day.getInstance(i);
ProjectCalendarHours hours = calendar.addCalendarHours(day);
if (calendar.isWorkingDay(day))
{
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
}
for (Gantt.Holidays.Holiday holiday : gantt.getHolidays().getHoliday())
{
ProjectCalendarException exception = calendar.addCalendarException(holiday.getDate(), holiday.getDate());
exception.setName(holiday.getContent());
}
} | [
"private",
"void",
"readCalendar",
"(",
"Gantt",
"gantt",
")",
"{",
"Gantt",
".",
"Calendar",
"ganttCalendar",
"=",
"gantt",
".",
"getCalendar",
"(",
")",
";",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
".",
"setWeekStartDay",
"(",
"ganttCalendar",
... | Read the calendar data from a Gantt Designer file.
@param gantt Gantt Designer file. | [
"Read",
"the",
"calendar",
"data",
"from",
"a",
"Gantt",
"Designer",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L162-L196 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.processTasks | private void processTasks(Gantt gantt)
{
ProjectCalendar calendar = m_projectFile.getDefaultCalendar();
for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
{
String wbs = ganttTask.getID();
ChildTaskContainer parentTask = getParentTask(wbs);
Task task = parentTask.addTask();
//ganttTask.getB() // bar type
//ganttTask.getBC() // bar color
task.setCost(ganttTask.getC());
task.setName(ganttTask.getContent());
task.setDuration(ganttTask.getD());
task.setDeadline(ganttTask.getDL());
//ganttTask.getH() // height
//ganttTask.getIn(); // indent
task.setWBS(wbs);
task.setPercentageComplete(ganttTask.getPC());
task.setStart(ganttTask.getS());
//ganttTask.getU(); // Unknown
//ganttTask.getVA(); // Valign
task.setFinish(calendar.getDate(task.getStart(), task.getDuration(), false));
m_taskMap.put(wbs, task);
}
} | java | private void processTasks(Gantt gantt)
{
ProjectCalendar calendar = m_projectFile.getDefaultCalendar();
for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
{
String wbs = ganttTask.getID();
ChildTaskContainer parentTask = getParentTask(wbs);
Task task = parentTask.addTask();
//ganttTask.getB() // bar type
//ganttTask.getBC() // bar color
task.setCost(ganttTask.getC());
task.setName(ganttTask.getContent());
task.setDuration(ganttTask.getD());
task.setDeadline(ganttTask.getDL());
//ganttTask.getH() // height
//ganttTask.getIn(); // indent
task.setWBS(wbs);
task.setPercentageComplete(ganttTask.getPC());
task.setStart(ganttTask.getS());
//ganttTask.getU(); // Unknown
//ganttTask.getVA(); // Valign
task.setFinish(calendar.getDate(task.getStart(), task.getDuration(), false));
m_taskMap.put(wbs, task);
}
} | [
"private",
"void",
"processTasks",
"(",
"Gantt",
"gantt",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"m_projectFile",
".",
"getDefaultCalendar",
"(",
")",
";",
"for",
"(",
"Gantt",
".",
"Tasks",
".",
"Task",
"ganttTask",
":",
"gantt",
".",
"getTasks",
"("... | Read task data from a Gantt Designer file.
@param gantt Gantt Designer file | [
"Read",
"task",
"data",
"from",
"a",
"Gantt",
"Designer",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L215-L242 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.processPredecessors | private void processPredecessors(Gantt gantt)
{
for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
{
String predecessors = ganttTask.getP();
if (predecessors != null && !predecessors.isEmpty())
{
String wbs = ganttTask.getID();
Task task = m_taskMap.get(wbs);
for (String predecessor : predecessors.split(";"))
{
Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor));
task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL());
}
}
}
} | java | private void processPredecessors(Gantt gantt)
{
for (Gantt.Tasks.Task ganttTask : gantt.getTasks().getTask())
{
String predecessors = ganttTask.getP();
if (predecessors != null && !predecessors.isEmpty())
{
String wbs = ganttTask.getID();
Task task = m_taskMap.get(wbs);
for (String predecessor : predecessors.split(";"))
{
Task predecessorTask = m_projectFile.getTaskByID(Integer.valueOf(predecessor));
task.addPredecessor(predecessorTask, RelationType.FINISH_START, ganttTask.getL());
}
}
}
} | [
"private",
"void",
"processPredecessors",
"(",
"Gantt",
"gantt",
")",
"{",
"for",
"(",
"Gantt",
".",
"Tasks",
".",
"Task",
"ganttTask",
":",
"gantt",
".",
"getTasks",
"(",
")",
".",
"getTask",
"(",
")",
")",
"{",
"String",
"predecessors",
"=",
"ganttTask... | Read predecessors from a Gantt Designer file.
@param gantt Gantt Designer file | [
"Read",
"predecessors",
"from",
"a",
"Gantt",
"Designer",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L249-L265 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.processRemarks | private void processRemarks(Gantt gantt)
{
processRemarks(gantt.getRemarks());
processRemarks(gantt.getRemarks1());
processRemarks(gantt.getRemarks2());
processRemarks(gantt.getRemarks3());
processRemarks(gantt.getRemarks4());
} | java | private void processRemarks(Gantt gantt)
{
processRemarks(gantt.getRemarks());
processRemarks(gantt.getRemarks1());
processRemarks(gantt.getRemarks2());
processRemarks(gantt.getRemarks3());
processRemarks(gantt.getRemarks4());
} | [
"private",
"void",
"processRemarks",
"(",
"Gantt",
"gantt",
")",
"{",
"processRemarks",
"(",
"gantt",
".",
"getRemarks",
"(",
")",
")",
";",
"processRemarks",
"(",
"gantt",
".",
"getRemarks1",
"(",
")",
")",
";",
"processRemarks",
"(",
"gantt",
".",
"getRe... | Read remarks from a Gantt Designer file.
@param gantt Gantt Designer file | [
"Read",
"remarks",
"from",
"a",
"Gantt",
"Designer",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L272-L279 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.processRemarks | private void processRemarks(GanttDesignerRemark remark)
{
for (GanttDesignerRemark.Task remarkTask : remark.getTask())
{
Integer id = remarkTask.getRow();
Task task = m_projectFile.getTaskByID(id);
String notes = task.getNotes();
if (notes.isEmpty())
{
notes = remarkTask.getContent();
}
else
{
notes = notes + '\n' + remarkTask.getContent();
}
task.setNotes(notes);
}
} | java | private void processRemarks(GanttDesignerRemark remark)
{
for (GanttDesignerRemark.Task remarkTask : remark.getTask())
{
Integer id = remarkTask.getRow();
Task task = m_projectFile.getTaskByID(id);
String notes = task.getNotes();
if (notes.isEmpty())
{
notes = remarkTask.getContent();
}
else
{
notes = notes + '\n' + remarkTask.getContent();
}
task.setNotes(notes);
}
} | [
"private",
"void",
"processRemarks",
"(",
"GanttDesignerRemark",
"remark",
")",
"{",
"for",
"(",
"GanttDesignerRemark",
".",
"Task",
"remarkTask",
":",
"remark",
".",
"getTask",
"(",
")",
")",
"{",
"Integer",
"id",
"=",
"remarkTask",
".",
"getRow",
"(",
")",... | Read an individual remark type from a Gantt Designer file.
@param remark remark type | [
"Read",
"an",
"individual",
"remark",
"type",
"from",
"a",
"Gantt",
"Designer",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L286-L303 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.getParentWBS | private String getParentWBS(String wbs)
{
String result;
int index = wbs.lastIndexOf('.');
if (index == -1)
{
result = null;
}
else
{
result = wbs.substring(0, index);
}
return result;
} | java | private String getParentWBS(String wbs)
{
String result;
int index = wbs.lastIndexOf('.');
if (index == -1)
{
result = null;
}
else
{
result = wbs.substring(0, index);
}
return result;
} | [
"private",
"String",
"getParentWBS",
"(",
"String",
"wbs",
")",
"{",
"String",
"result",
";",
"int",
"index",
"=",
"wbs",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"result",
"=",
"null",
";",
"}",
... | Extract the parent WBS from a WBS.
@param wbs current WBS
@return parent WBS | [
"Extract",
"the",
"parent",
"WBS",
"from",
"a",
"WBS",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L311-L324 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java | GanttDesignerReader.getParentTask | private ChildTaskContainer getParentTask(String wbs)
{
ChildTaskContainer result;
String parentWbs = getParentWBS(wbs);
if (parentWbs == null)
{
result = m_projectFile;
}
else
{
result = m_taskMap.get(parentWbs);
}
return result;
} | java | private ChildTaskContainer getParentTask(String wbs)
{
ChildTaskContainer result;
String parentWbs = getParentWBS(wbs);
if (parentWbs == null)
{
result = m_projectFile;
}
else
{
result = m_taskMap.get(parentWbs);
}
return result;
} | [
"private",
"ChildTaskContainer",
"getParentTask",
"(",
"String",
"wbs",
")",
"{",
"ChildTaskContainer",
"result",
";",
"String",
"parentWbs",
"=",
"getParentWBS",
"(",
"wbs",
")",
";",
"if",
"(",
"parentWbs",
"==",
"null",
")",
"{",
"result",
"=",
"m_projectFi... | Retrieve the parent task based on its WBS.
@param wbs parent WBS
@return parent task | [
"Retrieve",
"the",
"parent",
"task",
"based",
"on",
"its",
"WBS",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/GanttDesignerReader.java#L332-L345 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/PoiTreeModel.java | PoiTreeModel.getChildNodes | private List<Entry> getChildNodes(DirectoryEntry parent)
{
List<Entry> result = new ArrayList<Entry>();
Iterator<Entry> entries = parent.getEntries();
while (entries.hasNext())
{
result.add(entries.next());
}
return result;
} | java | private List<Entry> getChildNodes(DirectoryEntry parent)
{
List<Entry> result = new ArrayList<Entry>();
Iterator<Entry> entries = parent.getEntries();
while (entries.hasNext())
{
result.add(entries.next());
}
return result;
} | [
"private",
"List",
"<",
"Entry",
">",
"getChildNodes",
"(",
"DirectoryEntry",
"parent",
")",
"{",
"List",
"<",
"Entry",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Entry",
">",
"(",
")",
";",
"Iterator",
"<",
"Entry",
">",
"entries",
"=",
"parent",
"... | Retrieves child nodes from a directory entry.
@param parent parent directory entry
@return list of child nodes | [
"Retrieves",
"child",
"nodes",
"from",
"a",
"directory",
"entry",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/PoiTreeModel.java#L136-L145 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/explorer/PoiTreeModel.java | PoiTreeModel.fireTreeStructureChanged | private void fireTreeStructureChanged()
{
// Guaranteed to return a non-null array
Object[] listeners = m_listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2)
{
if (listeners[i] == TreeModelListener.class)
{
// Lazily create the event:
if (e == null)
{
e = new TreeModelEvent(getRoot(), new Object[]
{
getRoot()
}, null, null);
}
((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
}
}
} | java | private void fireTreeStructureChanged()
{
// Guaranteed to return a non-null array
Object[] listeners = m_listenerList.getListenerList();
TreeModelEvent e = null;
// Process the listeners last to first, notifying
// those that are interested in this event
for (int i = listeners.length - 2; i >= 0; i -= 2)
{
if (listeners[i] == TreeModelListener.class)
{
// Lazily create the event:
if (e == null)
{
e = new TreeModelEvent(getRoot(), new Object[]
{
getRoot()
}, null, null);
}
((TreeModelListener) listeners[i + 1]).treeStructureChanged(e);
}
}
} | [
"private",
"void",
"fireTreeStructureChanged",
"(",
")",
"{",
"// Guaranteed to return a non-null array",
"Object",
"[",
"]",
"listeners",
"=",
"m_listenerList",
".",
"getListenerList",
"(",
")",
";",
"TreeModelEvent",
"e",
"=",
"null",
";",
"// Process the listeners la... | Notify listeners that the tree structure has changed. | [
"Notify",
"listeners",
"that",
"the",
"tree",
"structure",
"has",
"changed",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/PoiTreeModel.java#L150-L172 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getMinutesPerDay | public int getMinutesPerDay()
{
return m_minutesPerDay == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerDay()) : m_minutesPerDay.intValue();
} | java | public int getMinutesPerDay()
{
return m_minutesPerDay == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerDay()) : m_minutesPerDay.intValue();
} | [
"public",
"int",
"getMinutesPerDay",
"(",
")",
"{",
"return",
"m_minutesPerDay",
"==",
"null",
"?",
"NumberHelper",
".",
"getInt",
"(",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getMinutesPerDay",
"(",
")",
")",
":",
"m_minutesPer... | Retrieve the number of minutes per day for this calendar.
@return minutes per day | [
"Retrieve",
"the",
"number",
"of",
"minutes",
"per",
"day",
"for",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L67-L70 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getMinutesPerWeek | public int getMinutesPerWeek()
{
return m_minutesPerWeek == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerWeek()) : m_minutesPerWeek.intValue();
} | java | public int getMinutesPerWeek()
{
return m_minutesPerWeek == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerWeek()) : m_minutesPerWeek.intValue();
} | [
"public",
"int",
"getMinutesPerWeek",
"(",
")",
"{",
"return",
"m_minutesPerWeek",
"==",
"null",
"?",
"NumberHelper",
".",
"getInt",
"(",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getMinutesPerWeek",
"(",
")",
")",
":",
"m_minutes... | Retrieve the number of minutes per week for this calendar.
@return minutes per week | [
"Retrieve",
"the",
"number",
"of",
"minutes",
"per",
"week",
"for",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L77-L80 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getMinutesPerMonth | public int getMinutesPerMonth()
{
return m_minutesPerMonth == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerMonth()) : m_minutesPerMonth.intValue();
} | java | public int getMinutesPerMonth()
{
return m_minutesPerMonth == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerMonth()) : m_minutesPerMonth.intValue();
} | [
"public",
"int",
"getMinutesPerMonth",
"(",
")",
"{",
"return",
"m_minutesPerMonth",
"==",
"null",
"?",
"NumberHelper",
".",
"getInt",
"(",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getMinutesPerMonth",
"(",
")",
")",
":",
"m_minu... | Retrieve the number of minutes per month for this calendar.
@return minutes per month | [
"Retrieve",
"the",
"number",
"of",
"minutes",
"per",
"month",
"for",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L87-L90 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getMinutesPerYear | public int getMinutesPerYear()
{
return m_minutesPerYear == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerYear()) : m_minutesPerYear.intValue();
} | java | public int getMinutesPerYear()
{
return m_minutesPerYear == null ? NumberHelper.getInt(getParentFile().getProjectProperties().getMinutesPerYear()) : m_minutesPerYear.intValue();
} | [
"public",
"int",
"getMinutesPerYear",
"(",
")",
"{",
"return",
"m_minutesPerYear",
"==",
"null",
"?",
"NumberHelper",
".",
"getInt",
"(",
"getParentFile",
"(",
")",
".",
"getProjectProperties",
"(",
")",
".",
"getMinutesPerYear",
"(",
")",
")",
":",
"m_minutes... | Retrieve the number of minutes per year for this calendar.
@return minutes per year | [
"Retrieve",
"the",
"number",
"of",
"minutes",
"per",
"year",
"for",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L97-L100 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.addWorkWeek | public ProjectCalendarWeek addWorkWeek()
{
ProjectCalendarWeek week = new ProjectCalendarWeek();
week.setParent(this);
m_workWeeks.add(week);
m_weeksSorted = false;
clearWorkingDateCache();
return week;
} | java | public ProjectCalendarWeek addWorkWeek()
{
ProjectCalendarWeek week = new ProjectCalendarWeek();
week.setParent(this);
m_workWeeks.add(week);
m_weeksSorted = false;
clearWorkingDateCache();
return week;
} | [
"public",
"ProjectCalendarWeek",
"addWorkWeek",
"(",
")",
"{",
"ProjectCalendarWeek",
"week",
"=",
"new",
"ProjectCalendarWeek",
"(",
")",
";",
"week",
".",
"setParent",
"(",
"this",
")",
";",
"m_workWeeks",
".",
"add",
"(",
"week",
")",
";",
"m_weeksSorted",
... | Add an empty work week.
@return new work week | [
"Add",
"an",
"empty",
"work",
"week",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L147-L155 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.addCalendarException | public ProjectCalendarException addCalendarException(Date fromDate, Date toDate)
{
ProjectCalendarException bce = new ProjectCalendarException(fromDate, toDate);
m_exceptions.add(bce);
m_expandedExceptions.clear();
m_exceptionsSorted = false;
clearWorkingDateCache();
return bce;
} | java | public ProjectCalendarException addCalendarException(Date fromDate, Date toDate)
{
ProjectCalendarException bce = new ProjectCalendarException(fromDate, toDate);
m_exceptions.add(bce);
m_expandedExceptions.clear();
m_exceptionsSorted = false;
clearWorkingDateCache();
return bce;
} | [
"public",
"ProjectCalendarException",
"addCalendarException",
"(",
"Date",
"fromDate",
",",
"Date",
"toDate",
")",
"{",
"ProjectCalendarException",
"bce",
"=",
"new",
"ProjectCalendarException",
"(",
"fromDate",
",",
"toDate",
")",
";",
"m_exceptions",
".",
"add",
"... | Used to add exceptions to the calendar. The MPX standard defines
a limit of 250 exceptions per calendar.
@param fromDate exception start date
@param toDate exception end date
@return ProjectCalendarException instance | [
"Used",
"to",
"add",
"exceptions",
"to",
"the",
"calendar",
".",
"The",
"MPX",
"standard",
"defines",
"a",
"limit",
"of",
"250",
"exceptions",
"per",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L185-L193 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.setParent | public void setParent(ProjectCalendar calendar)
{
// I've seen a malformed MSPDI file which sets the parent calendar to itself.
// Silently ignore this here.
if (calendar != this)
{
if (getParent() != null)
{
getParent().removeDerivedCalendar(this);
}
super.setParent(calendar);
if (calendar != null)
{
calendar.addDerivedCalendar(this);
}
clearWorkingDateCache();
}
} | java | public void setParent(ProjectCalendar calendar)
{
// I've seen a malformed MSPDI file which sets the parent calendar to itself.
// Silently ignore this here.
if (calendar != this)
{
if (getParent() != null)
{
getParent().removeDerivedCalendar(this);
}
super.setParent(calendar);
if (calendar != null)
{
calendar.addDerivedCalendar(this);
}
clearWorkingDateCache();
}
} | [
"public",
"void",
"setParent",
"(",
"ProjectCalendar",
"calendar",
")",
"{",
"// I've seen a malformed MSPDI file which sets the parent calendar to itself.",
"// Silently ignore this here.",
"if",
"(",
"calendar",
"!=",
"this",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
... | Sets the ProjectCalendar instance from which this calendar is derived.
@param calendar base calendar instance | [
"Sets",
"the",
"ProjectCalendar",
"instance",
"from",
"which",
"this",
"calendar",
"is",
"derived",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L260-L279 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.isWorkingDay | public boolean isWorkingDay(Day day)
{
DayType value = getWorkingDay(day);
boolean result;
if (value == DayType.DEFAULT)
{
ProjectCalendar cal = getParent();
if (cal != null)
{
result = cal.isWorkingDay(day);
}
else
{
result = (day != Day.SATURDAY && day != Day.SUNDAY);
}
}
else
{
result = (value == DayType.WORKING);
}
return (result);
} | java | public boolean isWorkingDay(Day day)
{
DayType value = getWorkingDay(day);
boolean result;
if (value == DayType.DEFAULT)
{
ProjectCalendar cal = getParent();
if (cal != null)
{
result = cal.isWorkingDay(day);
}
else
{
result = (day != Day.SATURDAY && day != Day.SUNDAY);
}
}
else
{
result = (value == DayType.WORKING);
}
return (result);
} | [
"public",
"boolean",
"isWorkingDay",
"(",
"Day",
"day",
")",
"{",
"DayType",
"value",
"=",
"getWorkingDay",
"(",
"day",
")",
";",
"boolean",
"result",
";",
"if",
"(",
"value",
"==",
"DayType",
".",
"DEFAULT",
")",
"{",
"ProjectCalendar",
"cal",
"=",
"get... | Method indicating whether a day is a working or non-working day.
@param day required day
@return true if this is a working day | [
"Method",
"indicating",
"whether",
"a",
"day",
"is",
"a",
"working",
"or",
"non",
"-",
"working",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L292-L315 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getDuration | public Duration getDuration(Date startDate, Date endDate)
{
Calendar cal = DateHelper.popCalendar(startDate);
int days = getDaysInRange(startDate, endDate);
int duration = 0;
Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
while (days > 0)
{
if (isWorkingDate(cal.getTime(), day) == true)
{
++duration;
}
--days;
day = day.getNextDay();
cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);
}
DateHelper.pushCalendar(cal);
return (Duration.getInstance(duration, TimeUnit.DAYS));
} | java | public Duration getDuration(Date startDate, Date endDate)
{
Calendar cal = DateHelper.popCalendar(startDate);
int days = getDaysInRange(startDate, endDate);
int duration = 0;
Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
while (days > 0)
{
if (isWorkingDate(cal.getTime(), day) == true)
{
++duration;
}
--days;
day = day.getNextDay();
cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);
}
DateHelper.pushCalendar(cal);
return (Duration.getInstance(duration, TimeUnit.DAYS));
} | [
"public",
"Duration",
"getDuration",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
"(",
"startDate",
")",
";",
"int",
"days",
"=",
"getDaysInRange",
"(",
"startDate",
",",
"endDate",
")"... | This method is provided to allow an absolute period of time
represented by start and end dates into a duration in working
days based on this calendar instance. This method takes account
of any exceptions defined for this calendar.
@param startDate start of the period
@param endDate end of the period
@return new Duration object | [
"This",
"method",
"is",
"provided",
"to",
"allow",
"an",
"absolute",
"period",
"of",
"time",
"represented",
"by",
"start",
"and",
"end",
"dates",
"into",
"a",
"duration",
"in",
"working",
"days",
"based",
"on",
"this",
"calendar",
"instance",
".",
"This",
... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L327-L348 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getStartTime | public Date getStartTime(Date date)
{
Date result = m_startTimeCache.get(date);
if (result == null)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
if (ranges == null)
{
result = getParentFile().getProjectProperties().getDefaultStartTime();
}
else
{
result = ranges.getRange(0).getStart();
}
result = DateHelper.getCanonicalTime(result);
m_startTimeCache.put(new Date(date.getTime()), result);
}
return result;
} | java | public Date getStartTime(Date date)
{
Date result = m_startTimeCache.get(date);
if (result == null)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
if (ranges == null)
{
result = getParentFile().getProjectProperties().getDefaultStartTime();
}
else
{
result = ranges.getRange(0).getStart();
}
result = DateHelper.getCanonicalTime(result);
m_startTimeCache.put(new Date(date.getTime()), result);
}
return result;
} | [
"public",
"Date",
"getStartTime",
"(",
"Date",
"date",
")",
"{",
"Date",
"result",
"=",
"m_startTimeCache",
".",
"get",
"(",
"date",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"ProjectCalendarDateRanges",
"ranges",
"=",
"getRanges",
"(",
"date"... | Retrieves the time at which work starts on the given date, or returns
null if this is a non-working day.
@param date Date instance
@return start time, or null for non-working day | [
"Retrieves",
"the",
"time",
"at",
"which",
"work",
"starts",
"on",
"the",
"given",
"date",
"or",
"returns",
"null",
"if",
"this",
"is",
"a",
"non",
"-",
"working",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L357-L375 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getFinishTime | public Date getFinishTime(Date date)
{
Date result = null;
if (date != null)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
if (ranges == null)
{
result = getParentFile().getProjectProperties().getDefaultEndTime();
result = DateHelper.getCanonicalTime(result);
}
else
{
Date rangeStart = result = ranges.getRange(0).getStart();
Date rangeFinish = ranges.getRange(ranges.getRangeCount() - 1).getEnd();
Date startDay = DateHelper.getDayStartDate(rangeStart);
Date finishDay = DateHelper.getDayStartDate(rangeFinish);
result = DateHelper.getCanonicalTime(rangeFinish);
//
// Handle the case where the end of the range is at midnight -
// this will show up as the start and end days not matching
//
if (startDay != null && finishDay != null && startDay.getTime() != finishDay.getTime())
{
result = DateHelper.addDays(result, 1);
}
}
}
return result;
} | java | public Date getFinishTime(Date date)
{
Date result = null;
if (date != null)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, null);
if (ranges == null)
{
result = getParentFile().getProjectProperties().getDefaultEndTime();
result = DateHelper.getCanonicalTime(result);
}
else
{
Date rangeStart = result = ranges.getRange(0).getStart();
Date rangeFinish = ranges.getRange(ranges.getRangeCount() - 1).getEnd();
Date startDay = DateHelper.getDayStartDate(rangeStart);
Date finishDay = DateHelper.getDayStartDate(rangeFinish);
result = DateHelper.getCanonicalTime(rangeFinish);
//
// Handle the case where the end of the range is at midnight -
// this will show up as the start and end days not matching
//
if (startDay != null && finishDay != null && startDay.getTime() != finishDay.getTime())
{
result = DateHelper.addDays(result, 1);
}
}
}
return result;
} | [
"public",
"Date",
"getFinishTime",
"(",
"Date",
"date",
")",
"{",
"Date",
"result",
"=",
"null",
";",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"ProjectCalendarDateRanges",
"ranges",
"=",
"getRanges",
"(",
"date",
",",
"null",
",",
"null",
")",
";",
"... | Retrieves the time at which work finishes on the given date, or returns
null if this is a non-working day.
@param date Date instance
@return finish time, or null for non-working day | [
"Retrieves",
"the",
"time",
"at",
"which",
"work",
"finishes",
"on",
"the",
"given",
"date",
"or",
"returns",
"null",
"if",
"this",
"is",
"a",
"non",
"-",
"working",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L384-L416 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.updateToNextWorkStart | private void updateToNextWorkStart(Calendar cal)
{
Date originalDate = cal.getTime();
//
// Find the date ranges for the current day
//
ProjectCalendarDateRanges ranges = getRanges(originalDate, cal, null);
if (ranges != null)
{
//
// Do we have a start time today?
//
Date calTime = DateHelper.getCanonicalTime(cal.getTime());
Date startTime = null;
for (DateRange range : ranges)
{
Date rangeStart = DateHelper.getCanonicalTime(range.getStart());
Date rangeEnd = DateHelper.getCanonicalTime(range.getEnd());
Date rangeStartDay = DateHelper.getDayStartDate(range.getStart());
Date rangeEndDay = DateHelper.getDayStartDate(range.getEnd());
if (rangeStartDay.getTime() != rangeEndDay.getTime())
{
rangeEnd = DateHelper.addDays(rangeEnd, 1);
}
if (calTime.getTime() < rangeEnd.getTime())
{
if (calTime.getTime() > rangeStart.getTime())
{
startTime = calTime;
}
else
{
startTime = rangeStart;
}
break;
}
}
//
// If we don't have a start time today - find the next working day
// then retrieve the start time.
//
if (startTime == null)
{
Day day;
int nonWorkingDayCount = 0;
do
{
cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);
day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
++nonWorkingDayCount;
if (nonWorkingDayCount > MAX_NONWORKING_DAYS)
{
cal.setTime(originalDate);
break;
}
}
while (!isWorkingDate(cal.getTime(), day));
startTime = getStartTime(cal.getTime());
}
DateHelper.setTime(cal, startTime);
}
} | java | private void updateToNextWorkStart(Calendar cal)
{
Date originalDate = cal.getTime();
//
// Find the date ranges for the current day
//
ProjectCalendarDateRanges ranges = getRanges(originalDate, cal, null);
if (ranges != null)
{
//
// Do we have a start time today?
//
Date calTime = DateHelper.getCanonicalTime(cal.getTime());
Date startTime = null;
for (DateRange range : ranges)
{
Date rangeStart = DateHelper.getCanonicalTime(range.getStart());
Date rangeEnd = DateHelper.getCanonicalTime(range.getEnd());
Date rangeStartDay = DateHelper.getDayStartDate(range.getStart());
Date rangeEndDay = DateHelper.getDayStartDate(range.getEnd());
if (rangeStartDay.getTime() != rangeEndDay.getTime())
{
rangeEnd = DateHelper.addDays(rangeEnd, 1);
}
if (calTime.getTime() < rangeEnd.getTime())
{
if (calTime.getTime() > rangeStart.getTime())
{
startTime = calTime;
}
else
{
startTime = rangeStart;
}
break;
}
}
//
// If we don't have a start time today - find the next working day
// then retrieve the start time.
//
if (startTime == null)
{
Day day;
int nonWorkingDayCount = 0;
do
{
cal.set(Calendar.DAY_OF_YEAR, cal.get(Calendar.DAY_OF_YEAR) + 1);
day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
++nonWorkingDayCount;
if (nonWorkingDayCount > MAX_NONWORKING_DAYS)
{
cal.setTime(originalDate);
break;
}
}
while (!isWorkingDate(cal.getTime(), day));
startTime = getStartTime(cal.getTime());
}
DateHelper.setTime(cal, startTime);
}
} | [
"private",
"void",
"updateToNextWorkStart",
"(",
"Calendar",
"cal",
")",
"{",
"Date",
"originalDate",
"=",
"cal",
".",
"getTime",
"(",
")",
";",
"//",
"// Find the date ranges for the current day",
"//",
"ProjectCalendarDateRanges",
"ranges",
"=",
"getRanges",
"(",
... | This method finds the start of the next working period.
@param cal current Calendar instance | [
"This",
"method",
"finds",
"the",
"start",
"of",
"the",
"next",
"working",
"period",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L770-L838 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getNextWorkStart | public Date getNextWorkStart(Date date)
{
Calendar cal = Calendar.getInstance();
cal.setTime(date);
updateToNextWorkStart(cal);
return cal.getTime();
} | java | public Date getNextWorkStart(Date date)
{
Calendar cal = Calendar.getInstance();
cal.setTime(date);
updateToNextWorkStart(cal);
return cal.getTime();
} | [
"public",
"Date",
"getNextWorkStart",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"updateToNextWorkStart",
"(",
"cal",
")",
";",
"return",
"cal",
".",... | Utility method to retrieve the next working date start time, given
a date and time as a starting point.
@param date date and time start point
@return date and time of next work start | [
"Utility",
"method",
"to",
"retrieve",
"the",
"next",
"working",
"date",
"start",
"time",
"given",
"a",
"date",
"and",
"time",
"as",
"a",
"starting",
"point",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L913-L919 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getPreviousWorkFinish | public Date getPreviousWorkFinish(Date date)
{
Calendar cal = Calendar.getInstance();
cal.setTime(date);
updateToPreviousWorkFinish(cal);
return cal.getTime();
} | java | public Date getPreviousWorkFinish(Date date)
{
Calendar cal = Calendar.getInstance();
cal.setTime(date);
updateToPreviousWorkFinish(cal);
return cal.getTime();
} | [
"public",
"Date",
"getPreviousWorkFinish",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"cal",
".",
"setTime",
"(",
"date",
")",
";",
"updateToPreviousWorkFinish",
"(",
"cal",
")",
";",
"return",
"ca... | Utility method to retrieve the previous working date finish time, given
a date and time as a starting point.
@param date date and time start point
@return date and time of previous work finish | [
"Utility",
"method",
"to",
"retrieve",
"the",
"previous",
"working",
"date",
"finish",
"time",
"given",
"a",
"date",
"and",
"time",
"as",
"a",
"starting",
"point",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L928-L934 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.isWorkingDate | public boolean isWorkingDate(Date date)
{
Calendar cal = DateHelper.popCalendar(date);
Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
DateHelper.pushCalendar(cal);
return isWorkingDate(date, day);
} | java | public boolean isWorkingDate(Date date)
{
Calendar cal = DateHelper.popCalendar(date);
Day day = Day.getInstance(cal.get(Calendar.DAY_OF_WEEK));
DateHelper.pushCalendar(cal);
return isWorkingDate(date, day);
} | [
"public",
"boolean",
"isWorkingDate",
"(",
"Date",
"date",
")",
"{",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
"(",
"date",
")",
";",
"Day",
"day",
"=",
"Day",
".",
"getInstance",
"(",
"cal",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_WEEK... | This method allows the caller to determine if a given date is a
working day. This method takes account of calendar exceptions.
@param date Date to be tested
@return boolean value | [
"This",
"method",
"allows",
"the",
"caller",
"to",
"determine",
"if",
"a",
"given",
"date",
"is",
"a",
"working",
"day",
".",
"This",
"method",
"takes",
"account",
"of",
"calendar",
"exceptions",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L943-L949 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.isWorkingDate | private boolean isWorkingDate(Date date, Day day)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, day);
return ranges.getRangeCount() != 0;
} | java | private boolean isWorkingDate(Date date, Day day)
{
ProjectCalendarDateRanges ranges = getRanges(date, null, day);
return ranges.getRangeCount() != 0;
} | [
"private",
"boolean",
"isWorkingDate",
"(",
"Date",
"date",
",",
"Day",
"day",
")",
"{",
"ProjectCalendarDateRanges",
"ranges",
"=",
"getRanges",
"(",
"date",
",",
"null",
",",
"day",
")",
";",
"return",
"ranges",
".",
"getRangeCount",
"(",
")",
"!=",
"0",... | This private method allows the caller to determine if a given date is a
working day. This method takes account of calendar exceptions. It assumes
that the caller has already calculated the day of the week on which
the given day falls.
@param date Date to be tested
@param day Day of the week for the date under test
@return boolean flag | [
"This",
"private",
"method",
"allows",
"the",
"caller",
"to",
"determine",
"if",
"a",
"given",
"date",
"is",
"a",
"working",
"day",
".",
"This",
"method",
"takes",
"account",
"of",
"calendar",
"exceptions",
".",
"It",
"assumes",
"that",
"the",
"caller",
"h... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L961-L965 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.getDaysInRange | private int getDaysInRange(Date startDate, Date endDate)
{
int result;
Calendar cal = DateHelper.popCalendar(endDate);
int endDateYear = cal.get(Calendar.YEAR);
int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR);
cal.setTime(startDate);
if (endDateYear == cal.get(Calendar.YEAR))
{
result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1;
}
else
{
result = 0;
do
{
result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1;
cal.roll(Calendar.YEAR, 1);
cal.set(Calendar.DAY_OF_YEAR, 1);
}
while (cal.get(Calendar.YEAR) < endDateYear);
result += endDateDayOfYear;
}
DateHelper.pushCalendar(cal);
return result;
} | java | private int getDaysInRange(Date startDate, Date endDate)
{
int result;
Calendar cal = DateHelper.popCalendar(endDate);
int endDateYear = cal.get(Calendar.YEAR);
int endDateDayOfYear = cal.get(Calendar.DAY_OF_YEAR);
cal.setTime(startDate);
if (endDateYear == cal.get(Calendar.YEAR))
{
result = (endDateDayOfYear - cal.get(Calendar.DAY_OF_YEAR)) + 1;
}
else
{
result = 0;
do
{
result += (cal.getActualMaximum(Calendar.DAY_OF_YEAR) - cal.get(Calendar.DAY_OF_YEAR)) + 1;
cal.roll(Calendar.YEAR, 1);
cal.set(Calendar.DAY_OF_YEAR, 1);
}
while (cal.get(Calendar.YEAR) < endDateYear);
result += endDateDayOfYear;
}
DateHelper.pushCalendar(cal);
return result;
} | [
"private",
"int",
"getDaysInRange",
"(",
"Date",
"startDate",
",",
"Date",
"endDate",
")",
"{",
"int",
"result",
";",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
"(",
"endDate",
")",
";",
"int",
"endDateYear",
"=",
"cal",
".",
"get",
"(",
"... | This method calculates the absolute number of days between two dates.
Note that where two date objects are provided that fall on the same
day, this method will return one not zero. Note also that this method
assumes that the dates are passed in the correct order, i.e.
startDate < endDate.
@param startDate Start date
@param endDate End date
@return number of days in the date range | [
"This",
"method",
"calculates",
"the",
"absolute",
"number",
"of",
"days",
"between",
"two",
"dates",
".",
"Note",
"that",
"where",
"two",
"date",
"objects",
"are",
"provided",
"that",
"fall",
"on",
"the",
"same",
"day",
"this",
"method",
"will",
"return",
... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L978-L1006 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.setUniqueID | @Override public void setUniqueID(Integer uniqueID)
{
ProjectFile parent = getParentFile();
if (m_uniqueID != null)
{
parent.getCalendars().unmapUniqueID(m_uniqueID);
}
parent.getCalendars().mapUniqueID(uniqueID, this);
m_uniqueID = uniqueID;
} | java | @Override public void setUniqueID(Integer uniqueID)
{
ProjectFile parent = getParentFile();
if (m_uniqueID != null)
{
parent.getCalendars().unmapUniqueID(m_uniqueID);
}
parent.getCalendars().mapUniqueID(uniqueID, this);
m_uniqueID = uniqueID;
} | [
"@",
"Override",
"public",
"void",
"setUniqueID",
"(",
"Integer",
"uniqueID",
")",
"{",
"ProjectFile",
"parent",
"=",
"getParentFile",
"(",
")",
";",
"if",
"(",
"m_uniqueID",
"!=",
"null",
")",
"{",
"parent",
".",
"getCalendars",
"(",
")",
".",
"unmapUniqu... | Modifier method to set the unique ID of this calendar.
@param uniqueID unique identifier | [
"Modifier",
"method",
"to",
"set",
"the",
"unique",
"ID",
"of",
"this",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1013-L1025 | train |
joniles/mpxj | src/main/java/net/sf/mpxj/ProjectCalendar.java | ProjectCalendar.setResource | public void setResource(Resource resource)
{
m_resource = resource;
String name = m_resource.getName();
if (name == null || name.length() == 0)
{
name = "Unnamed Resource";
}
setName(name);
} | java | public void setResource(Resource resource)
{
m_resource = resource;
String name = m_resource.getName();
if (name == null || name.length() == 0)
{
name = "Unnamed Resource";
}
setName(name);
} | [
"public",
"void",
"setResource",
"(",
"Resource",
"resource",
")",
"{",
"m_resource",
"=",
"resource",
";",
"String",
"name",
"=",
"m_resource",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"length",
"(",
")",
"=="... | Sets the resource to which this calendar is linked. Note that this
method updates the calendar's name to be the same as the resource name.
If the resource does not yet have a name, then the calendar is given
a default name.
@param resource resource instance | [
"Sets",
"the",
"resource",
"to",
"which",
"this",
"calendar",
"is",
"linked",
".",
"Note",
"that",
"this",
"method",
"updates",
"the",
"calendar",
"s",
"name",
"to",
"be",
"the",
"same",
"as",
"the",
"resource",
"name",
".",
"If",
"the",
"resource",
"doe... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendar.java#L1055-L1064 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.