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/ResourceAssignment.java
ResourceAssignment.getTimephasedBaselineCost
public List<TimephasedCost> getTimephasedBaselineCost(int index) { return m_timephasedBaselineCost[index] == null ? null : m_timephasedBaselineCost[index].getData(); }
java
public List<TimephasedCost> getTimephasedBaselineCost(int index) { return m_timephasedBaselineCost[index] == null ? null : m_timephasedBaselineCost[index].getData(); }
[ "public", "List", "<", "TimephasedCost", ">", "getTimephasedBaselineCost", "(", "int", "index", ")", "{", "return", "m_timephasedBaselineCost", "[", "index", "]", "==", "null", "?", "null", ":", "m_timephasedBaselineCost", "[", "index", "]", ".", "getData", "(",...
Retrieve timephased baseline cost. Note that index 0 represents "Baseline", index 1 represents "Baseline1" and so on. @param index baseline index @return timephased work, or null if no baseline is present
[ "Retrieve", "timephased", "baseline", "cost", ".", "Note", "that", "index", "0", "represents", "Baseline", "index", "1", "represents", "Baseline1", "and", "so", "on", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1232-L1235
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getCalendar
public ProjectCalendar getCalendar() { ProjectCalendar calendar = null; Resource resource = getResource(); if (resource != null) { calendar = resource.getResourceCalendar(); } Task task = getTask(); if (calendar == null || task.getIgnoreResourceCalendar()) { calendar = task.getEffectiveCalendar(); } return calendar; }
java
public ProjectCalendar getCalendar() { ProjectCalendar calendar = null; Resource resource = getResource(); if (resource != null) { calendar = resource.getResourceCalendar(); } Task task = getTask(); if (calendar == null || task.getIgnoreResourceCalendar()) { calendar = task.getEffectiveCalendar(); } return calendar; }
[ "public", "ProjectCalendar", "getCalendar", "(", ")", "{", "ProjectCalendar", "calendar", "=", "null", ";", "Resource", "resource", "=", "getResource", "(", ")", ";", "if", "(", "resource", "!=", "null", ")", "{", "calendar", "=", "resource", ".", "getResour...
Retrieves the calendar used for this resource assignment. @return ProjectCalendar instance
[ "Retrieves", "the", "calendar", "used", "for", "this", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1242-L1258
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseCost
public void setEnterpriseCost(int index, Number value) { set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value); }
java
public void setEnterpriseCost(int index, Number value) { set(selectField(AssignmentFieldLists.ENTERPRISE_COST, index), value); }
[ "public", "void", "setEnterpriseCost", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_COST", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise cost value. @param index cost index (1-30) @param value cost value
[ "Set", "an", "enterprise", "cost", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1694-L1697
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseDate
public void setEnterpriseDate(int index, Date value) { set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value); }
java
public void setEnterpriseDate(int index, Date value) { set(selectField(AssignmentFieldLists.ENTERPRISE_DATE, index), value); }
[ "public", "void", "setEnterpriseDate", "(", "int", "index", ",", "Date", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_DATE", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise date value. @param index date index (1-30) @param value date value
[ "Set", "an", "enterprise", "date", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1716-L1719
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseDuration
public void setEnterpriseDuration(int index, Duration value) { set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value); }
java
public void setEnterpriseDuration(int index, Duration value) { set(selectField(AssignmentFieldLists.ENTERPRISE_DURATION, index), value); }
[ "public", "void", "setEnterpriseDuration", "(", "int", "index", ",", "Duration", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_DURATION", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise duration value. @param index duration index (1-30) @param value duration value
[ "Set", "an", "enterprise", "duration", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1738-L1741
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseNumber
public void setEnterpriseNumber(int index, Number value) { set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value); }
java
public void setEnterpriseNumber(int index, Number value) { set(selectField(AssignmentFieldLists.ENTERPRISE_NUMBER, index), value); }
[ "public", "void", "setEnterpriseNumber", "(", "int", "index", ",", "Number", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_NUMBER", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise number value. @param index number index (1-40) @param value number value
[ "Set", "an", "enterprise", "number", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1782-L1785
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.setEnterpriseText
public void setEnterpriseText(int index, String value) { set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value); }
java
public void setEnterpriseText(int index, String value) { set(selectField(AssignmentFieldLists.ENTERPRISE_TEXT, index), value); }
[ "public", "void", "setEnterpriseText", "(", "int", "index", ",", "String", "value", ")", "{", "set", "(", "selectField", "(", "AssignmentFieldLists", ".", "ENTERPRISE_TEXT", ",", "index", ")", ",", "value", ")", ";", "}" ]
Set an enterprise text value. @param index text index (1-40) @param value text value
[ "Set", "an", "enterprise", "text", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1804-L1807
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getOvertimeCost
public Number getOvertimeCost() { Number cost = (Number) getCachedValue(AssignmentField.OVERTIME_COST); if (cost == null) { Number actual = getActualOvertimeCost(); Number remaining = getRemainingOvertimeCost(); if (actual != null && remaining != null) { cost = NumberHelper.getDouble(actual.doubleValue() + remaining.doubleValue()); set(AssignmentField.OVERTIME_COST, cost); } } return (cost); }
java
public Number getOvertimeCost() { Number cost = (Number) getCachedValue(AssignmentField.OVERTIME_COST); if (cost == null) { Number actual = getActualOvertimeCost(); Number remaining = getRemainingOvertimeCost(); if (actual != null && remaining != null) { cost = NumberHelper.getDouble(actual.doubleValue() + remaining.doubleValue()); set(AssignmentField.OVERTIME_COST, cost); } } return (cost); }
[ "public", "Number", "getOvertimeCost", "(", ")", "{", "Number", "cost", "=", "(", "Number", ")", "getCachedValue", "(", "AssignmentField", ".", "OVERTIME_COST", ")", ";", "if", "(", "cost", "==", "null", ")", "{", "Number", "actual", "=", "getActualOvertimeC...
Returns the overtime cost of this resource assignment. @return cost
[ "Returns", "the", "overtime", "cost", "of", "this", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L1907-L1921
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getPercentageWorkComplete
public Number getPercentageWorkComplete() { Number pct = (Number) getCachedValue(AssignmentField.PERCENT_WORK_COMPLETE); if (pct == null) { Duration actualWork = getActualWork(); Duration work = getWork(); if (actualWork != null && work != null && work.getDuration() != 0) { pct = Double.valueOf((actualWork.getDuration() * 100) / work.convertUnits(actualWork.getUnits(), getParentFile().getProjectProperties()).getDuration()); set(AssignmentField.PERCENT_WORK_COMPLETE, pct); } } return pct; }
java
public Number getPercentageWorkComplete() { Number pct = (Number) getCachedValue(AssignmentField.PERCENT_WORK_COMPLETE); if (pct == null) { Duration actualWork = getActualWork(); Duration work = getWork(); if (actualWork != null && work != null && work.getDuration() != 0) { pct = Double.valueOf((actualWork.getDuration() * 100) / work.convertUnits(actualWork.getUnits(), getParentFile().getProjectProperties()).getDuration()); set(AssignmentField.PERCENT_WORK_COMPLETE, pct); } } return pct; }
[ "public", "Number", "getPercentageWorkComplete", "(", ")", "{", "Number", "pct", "=", "(", "Number", ")", "getCachedValue", "(", "AssignmentField", ".", "PERCENT_WORK_COMPLETE", ")", ";", "if", "(", "pct", "==", "null", ")", "{", "Duration", "actualWork", "=",...
The % Work Complete field contains the current status of a task, expressed as the percentage of the task's work that has been completed. You can enter percent work complete, or you can have Microsoft Project calculate it for you based on actual work on the task. @return percentage as float
[ "The", "%", "Work", "Complete", "field", "contains", "the", "current", "status", "of", "a", "task", "expressed", "as", "the", "percentage", "of", "the", "task", "s", "work", "that", "has", "been", "completed", ".", "You", "can", "enter", "percent", "work",...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2198-L2212
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getStartVariance
public Duration getStartVariance() { Duration variance = (Duration) getCachedValue(AssignmentField.START_VARIANCE); if (variance == null) { TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits(); variance = DateHelper.getVariance(getTask(), getBaselineStart(), getStart(), format); set(AssignmentField.START_VARIANCE, variance); } return (variance); }
java
public Duration getStartVariance() { Duration variance = (Duration) getCachedValue(AssignmentField.START_VARIANCE); if (variance == null) { TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits(); variance = DateHelper.getVariance(getTask(), getBaselineStart(), getStart(), format); set(AssignmentField.START_VARIANCE, variance); } return (variance); }
[ "public", "Duration", "getStartVariance", "(", ")", "{", "Duration", "variance", "=", "(", "Duration", ")", "getCachedValue", "(", "AssignmentField", ".", "START_VARIANCE", ")", ";", "if", "(", "variance", "==", "null", ")", "{", "TimeUnit", "format", "=", "...
Calculate the start variance. @return start variance
[ "Calculate", "the", "start", "variance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2418-L2428
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getFinishVariance
public Duration getFinishVariance() { Duration variance = (Duration) getCachedValue(AssignmentField.FINISH_VARIANCE); if (variance == null) { TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits(); variance = DateHelper.getVariance(getTask(), getBaselineFinish(), getFinish(), format); set(AssignmentField.FINISH_VARIANCE, variance); } return (variance); }
java
public Duration getFinishVariance() { Duration variance = (Duration) getCachedValue(AssignmentField.FINISH_VARIANCE); if (variance == null) { TimeUnit format = getParentFile().getProjectProperties().getDefaultDurationUnits(); variance = DateHelper.getVariance(getTask(), getBaselineFinish(), getFinish(), format); set(AssignmentField.FINISH_VARIANCE, variance); } return (variance); }
[ "public", "Duration", "getFinishVariance", "(", ")", "{", "Duration", "variance", "=", "(", "Duration", ")", "getCachedValue", "(", "AssignmentField", ".", "FINISH_VARIANCE", ")", ";", "if", "(", "variance", "==", "null", ")", "{", "TimeUnit", "format", "=", ...
Calculate the finish variance. @return finish variance
[ "Calculate", "the", "finish", "variance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2447-L2457
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.getCostRateTableIndex
public int getCostRateTableIndex() { Integer value = (Integer) getCachedValue(AssignmentField.COST_RATE_TABLE); return value == null ? 0 : value.intValue(); }
java
public int getCostRateTableIndex() { Integer value = (Integer) getCachedValue(AssignmentField.COST_RATE_TABLE); return value == null ? 0 : value.intValue(); }
[ "public", "int", "getCostRateTableIndex", "(", ")", "{", "Integer", "value", "=", "(", "Integer", ")", "getCachedValue", "(", "AssignmentField", ".", "COST_RATE_TABLE", ")", ";", "return", "value", "==", "null", "?", "0", ":", "value", ".", "intValue", "(", ...
Returns the cost rate table index for this assignment. @return cost rate table index
[ "Returns", "the", "cost", "rate", "table", "index", "for", "this", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2580-L2584
train
joniles/mpxj
src/main/java/net/sf/mpxj/ResourceAssignment.java
ResourceAssignment.selectField
private AssignmentField selectField(AssignmentField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
java
private AssignmentField selectField(AssignmentField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
[ "private", "AssignmentField", "selectField", "(", "AssignmentField", "[", "]", "fields", ",", "int", "index", ")", "{", "if", "(", "index", "<", "1", "||", "index", ">", "fields", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "i...
Maps a field index to an AssignmentField instance. @param fields array of fields used as the basis for the mapping. @param index required field index @return AssignmnetField instance
[ "Maps", "a", "field", "index", "to", "an", "AssignmentField", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ResourceAssignment.java#L2683-L2690
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/ActivitySorter.java
ActivitySorter.sort
public void sort(ChildTaskContainer container) { // Do we have any tasks? List<Task> tasks = container.getChildTasks(); if (!tasks.isEmpty()) { for (Task task : tasks) { // // Sort child activities // sort(task); // // Sort Order: // 1. Activities come first // 2. WBS come last // 3. Activities ordered by activity ID // 4. WBS ordered by ID // Collections.sort(tasks, new Comparator<Task>() { @Override public int compare(Task t1, Task t2) { boolean t1IsWbs = m_wbsTasks.contains(t1); boolean t2IsWbs = m_wbsTasks.contains(t2); // Both are WBS if (t1IsWbs && t2IsWbs) { return t1.getID().compareTo(t2.getID()); } // Both are activities if (!t1IsWbs && !t2IsWbs) { String activityID1 = (String) t1.getCurrentValue(m_activityIDField); String activityID2 = (String) t2.getCurrentValue(m_activityIDField); if (activityID1 == null || activityID2 == null) { return (activityID1 == null && activityID2 == null ? 0 : (activityID1 == null ? 1 : -1)); } return activityID1.compareTo(activityID2); } // One activity one WBS return t1IsWbs ? 1 : -1; } }); } } }
java
public void sort(ChildTaskContainer container) { // Do we have any tasks? List<Task> tasks = container.getChildTasks(); if (!tasks.isEmpty()) { for (Task task : tasks) { // // Sort child activities // sort(task); // // Sort Order: // 1. Activities come first // 2. WBS come last // 3. Activities ordered by activity ID // 4. WBS ordered by ID // Collections.sort(tasks, new Comparator<Task>() { @Override public int compare(Task t1, Task t2) { boolean t1IsWbs = m_wbsTasks.contains(t1); boolean t2IsWbs = m_wbsTasks.contains(t2); // Both are WBS if (t1IsWbs && t2IsWbs) { return t1.getID().compareTo(t2.getID()); } // Both are activities if (!t1IsWbs && !t2IsWbs) { String activityID1 = (String) t1.getCurrentValue(m_activityIDField); String activityID2 = (String) t2.getCurrentValue(m_activityIDField); if (activityID1 == null || activityID2 == null) { return (activityID1 == null && activityID2 == null ? 0 : (activityID1 == null ? 1 : -1)); } return activityID1.compareTo(activityID2); } // One activity one WBS return t1IsWbs ? 1 : -1; } }); } } }
[ "public", "void", "sort", "(", "ChildTaskContainer", "container", ")", "{", "// Do we have any tasks?", "List", "<", "Task", ">", "tasks", "=", "container", ".", "getChildTasks", "(", ")", ";", "if", "(", "!", "tasks", ".", "isEmpty", "(", ")", ")", "{", ...
Recursively sort the supplied child tasks. @param container child tasks
[ "Recursively", "sort", "the", "supplied", "child", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/ActivitySorter.java#L57-L110
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/TableReader.java
TableReader.read
public void read(File file, Table table) throws IOException { //System.out.println("Reading " + file.getName()); InputStream is = null; try { is = new FileInputStream(file); read(is, table); } finally { StreamHelper.closeQuietly(is); } }
java
public void read(File file, Table table) throws IOException { //System.out.println("Reading " + file.getName()); InputStream is = null; try { is = new FileInputStream(file); read(is, table); } finally { StreamHelper.closeQuietly(is); } }
[ "public", "void", "read", "(", "File", "file", ",", "Table", "table", ")", "throws", "IOException", "{", "//System.out.println(\"Reading \" + file.getName());", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "FileInputStream", "(", "file", ...
Read the table from the file and populate the supplied Table instance. @param file database file @param table Table instance
[ "Read", "the", "table", "from", "the", "file", "and", "populate", "the", "supplied", "Table", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/TableReader.java#L60-L74
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/TableReader.java
TableReader.readPage
private void readPage(byte[] buffer, Table table) { int magicNumber = getShort(buffer, 0); if (magicNumber == 0x4400) { //System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, "")); int recordSize = m_definition.getRecordSize(); RowValidator rowValidator = m_definition.getRowValidator(); String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName(); int index = 6; while (index + recordSize <= buffer.length) { //System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, "")); int btrieveValue = getShort(buffer, index); if (btrieveValue != 0) { Map<String, Object> row = new HashMap<String, Object>(); row.put("ROW_VERSION", Integer.valueOf(btrieveValue)); for (ColumnDefinition column : m_definition.getColumns()) { Object value = column.read(index, buffer); //System.out.println(column.getName() + ": " + value); row.put(column.getName(), value); } if (rowValidator == null || rowValidator.validRow(row)) { table.addRow(primaryKeyColumnName, row); } } index += recordSize; } } }
java
private void readPage(byte[] buffer, Table table) { int magicNumber = getShort(buffer, 0); if (magicNumber == 0x4400) { //System.out.println(ByteArrayHelper.hexdump(buffer, 0, 6, true, 16, "")); int recordSize = m_definition.getRecordSize(); RowValidator rowValidator = m_definition.getRowValidator(); String primaryKeyColumnName = m_definition.getPrimaryKeyColumnName(); int index = 6; while (index + recordSize <= buffer.length) { //System.out.println(ByteArrayHelper.hexdump(buffer, index, recordSize, true, 16, "")); int btrieveValue = getShort(buffer, index); if (btrieveValue != 0) { Map<String, Object> row = new HashMap<String, Object>(); row.put("ROW_VERSION", Integer.valueOf(btrieveValue)); for (ColumnDefinition column : m_definition.getColumns()) { Object value = column.read(index, buffer); //System.out.println(column.getName() + ": " + value); row.put(column.getName(), value); } if (rowValidator == null || rowValidator.validRow(row)) { table.addRow(primaryKeyColumnName, row); } } index += recordSize; } } }
[ "private", "void", "readPage", "(", "byte", "[", "]", "buffer", ",", "Table", "table", ")", "{", "int", "magicNumber", "=", "getShort", "(", "buffer", ",", "0", ")", ";", "if", "(", "magicNumber", "==", "0x4400", ")", "{", "//System.out.println(ByteArrayHe...
Reads data from a single page of the database file. @param buffer page from the database file @param table Table instance
[ "Reads", "data", "from", "a", "single", "page", "of", "the", "database", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/TableReader.java#L108-L142
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/PropsBlock.java
PropsBlock.populateMap
private void populateMap(byte[] data, Integer previousItemOffset, Integer previousItemKey, Integer itemOffset) { if (previousItemOffset != null) { int itemSize = itemOffset.intValue() - previousItemOffset.intValue(); byte[] itemData = new byte[itemSize]; System.arraycopy(data, previousItemOffset.intValue(), itemData, 0, itemSize); m_map.put(previousItemKey, itemData); } }
java
private void populateMap(byte[] data, Integer previousItemOffset, Integer previousItemKey, Integer itemOffset) { if (previousItemOffset != null) { int itemSize = itemOffset.intValue() - previousItemOffset.intValue(); byte[] itemData = new byte[itemSize]; System.arraycopy(data, previousItemOffset.intValue(), itemData, 0, itemSize); m_map.put(previousItemKey, itemData); } }
[ "private", "void", "populateMap", "(", "byte", "[", "]", "data", ",", "Integer", "previousItemOffset", ",", "Integer", "previousItemKey", ",", "Integer", "itemOffset", ")", "{", "if", "(", "previousItemOffset", "!=", "null", ")", "{", "int", "itemSize", "=", ...
Method used to extract data from the block of properties and insert the key value pair into a map. @param data block of property data @param previousItemOffset previous offset @param previousItemKey item key @param itemOffset current item offset
[ "Method", "used", "to", "extract", "data", "from", "the", "block", "of", "properties", "and", "insert", "the", "key", "value", "pair", "into", "a", "map", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/PropsBlock.java#L83-L92
train
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/HexDumpController.java
HexDumpController.viewDocument
public void viewDocument(DocumentEntry entry) { InputStream is = null; try { is = new DocumentInputStream(entry); byte[] data = new byte[is.available()]; is.read(data); m_model.setData(data); updateTables(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { StreamHelper.closeQuietly(is); } }
java
public void viewDocument(DocumentEntry entry) { InputStream is = null; try { is = new DocumentInputStream(entry); byte[] data = new byte[is.available()]; is.read(data); m_model.setData(data); updateTables(); } catch (IOException ex) { throw new RuntimeException(ex); } finally { StreamHelper.closeQuietly(is); } }
[ "public", "void", "viewDocument", "(", "DocumentEntry", "entry", ")", "{", "InputStream", "is", "=", "null", ";", "try", "{", "is", "=", "new", "DocumentInputStream", "(", "entry", ")", ";", "byte", "[", "]", "data", "=", "new", "byte", "[", "is", ".",...
Command to select a document from the POIFS for viewing. @param entry document to view
[ "Command", "to", "select", "a", "document", "from", "the", "POIFS", "for", "viewing", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/HexDumpController.java#L112-L135
train
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/HexDumpController.java
HexDumpController.updateTables
protected void updateTables() { byte[] data = m_model.getData(); int columns = m_model.getColumns(); int rows = (data.length / columns) + 1; int offset = m_model.getOffset(); String[][] hexData = new String[rows][columns]; String[][] asciiData = new String[rows][columns]; int row = 0; int column = 0; StringBuilder hexValue = new StringBuilder(); for (int index = offset; index < data.length; index++) { int value = data[index]; hexValue.setLength(0); hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]); hexValue.append(HEX_DIGITS[value & 0x0F]); char c = (char) value; if ((c > 200) || (c < 27)) { c = ' '; } hexData[row][column] = hexValue.toString(); asciiData[row][column] = Character.toString(c); ++column; if (column == columns) { column = 0; ++row; } } String[] columnHeadings = new String[columns]; TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; m_model.setSizeValueLabel(Integer.toString(data.length)); m_model.setHexTableModel(hexTableModel); m_model.setAsciiTableModel(asciiTableModel); m_model.setCurrentSelectionIndex(0); m_model.setPreviousSelectionIndex(0); }
java
protected void updateTables() { byte[] data = m_model.getData(); int columns = m_model.getColumns(); int rows = (data.length / columns) + 1; int offset = m_model.getOffset(); String[][] hexData = new String[rows][columns]; String[][] asciiData = new String[rows][columns]; int row = 0; int column = 0; StringBuilder hexValue = new StringBuilder(); for (int index = offset; index < data.length; index++) { int value = data[index]; hexValue.setLength(0); hexValue.append(HEX_DIGITS[(value & 0xF0) >> 4]); hexValue.append(HEX_DIGITS[value & 0x0F]); char c = (char) value; if ((c > 200) || (c < 27)) { c = ' '; } hexData[row][column] = hexValue.toString(); asciiData[row][column] = Character.toString(c); ++column; if (column == columns) { column = 0; ++row; } } String[] columnHeadings = new String[columns]; TableModel hexTableModel = new DefaultTableModel(hexData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; TableModel asciiTableModel = new DefaultTableModel(asciiData, columnHeadings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; m_model.setSizeValueLabel(Integer.toString(data.length)); m_model.setHexTableModel(hexTableModel); m_model.setAsciiTableModel(asciiTableModel); m_model.setCurrentSelectionIndex(0); m_model.setPreviousSelectionIndex(0); }
[ "protected", "void", "updateTables", "(", ")", "{", "byte", "[", "]", "data", "=", "m_model", ".", "getData", "(", ")", ";", "int", "columns", "=", "m_model", ".", "getColumns", "(", ")", ";", "int", "rows", "=", "(", "data", ".", "length", "/", "c...
Update the content of the tables.
[ "Update", "the", "content", "of", "the", "tables", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/HexDumpController.java#L140-L199
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
FieldTypeHelper.getInstance
public static final FieldType getInstance(int fieldID) { FieldType result; int prefix = fieldID & 0xFFFF0000; int index = fieldID & 0x0000FFFF; switch (prefix) { case MPPTaskField.TASK_FIELD_BASE: { result = MPPTaskField.getInstance(index); if (result == null) { result = getPlaceholder(TaskField.class, index); } break; } case MPPResourceField.RESOURCE_FIELD_BASE: { result = MPPResourceField.getInstance(index); if (result == null) { result = getPlaceholder(ResourceField.class, index); } break; } case MPPAssignmentField.ASSIGNMENT_FIELD_BASE: { result = MPPAssignmentField.getInstance(index); if (result == null) { result = getPlaceholder(AssignmentField.class, index); } break; } case MPPConstraintField.CONSTRAINT_FIELD_BASE: { result = MPPConstraintField.getInstance(index); if (result == null) { result = getPlaceholder(ConstraintField.class, index); } break; } default: { result = getPlaceholder(null, index); break; } } return result; }
java
public static final FieldType getInstance(int fieldID) { FieldType result; int prefix = fieldID & 0xFFFF0000; int index = fieldID & 0x0000FFFF; switch (prefix) { case MPPTaskField.TASK_FIELD_BASE: { result = MPPTaskField.getInstance(index); if (result == null) { result = getPlaceholder(TaskField.class, index); } break; } case MPPResourceField.RESOURCE_FIELD_BASE: { result = MPPResourceField.getInstance(index); if (result == null) { result = getPlaceholder(ResourceField.class, index); } break; } case MPPAssignmentField.ASSIGNMENT_FIELD_BASE: { result = MPPAssignmentField.getInstance(index); if (result == null) { result = getPlaceholder(AssignmentField.class, index); } break; } case MPPConstraintField.CONSTRAINT_FIELD_BASE: { result = MPPConstraintField.getInstance(index); if (result == null) { result = getPlaceholder(ConstraintField.class, index); } break; } default: { result = getPlaceholder(null, index); break; } } return result; }
[ "public", "static", "final", "FieldType", "getInstance", "(", "int", "fieldID", ")", "{", "FieldType", "result", ";", "int", "prefix", "=", "fieldID", "&", "0xFFFF0000", ";", "int", "index", "=", "fieldID", "&", "0x0000FFFF", ";", "switch", "(", "prefix", ...
Retrieve a FieldType instance based on an ID value from an MPP9 or MPP12 file. @param fieldID field ID @return FieldType instance
[ "Retrieve", "a", "FieldType", "instance", "based", "on", "an", "ID", "value", "from", "an", "MPP9", "or", "MPP12", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L87-L143
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
FieldTypeHelper.getPlaceholder
private static FieldType getPlaceholder(final Class<?> type, final int fieldID) { return new FieldType() { @Override public FieldTypeClass getFieldTypeClass() { return FieldTypeClass.UNKNOWN; } @Override public String name() { return "UNKNOWN"; } @Override public int getValue() { return fieldID; } @Override public String getName() { return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")"); } @Override public String getName(Locale locale) { return getName(); } @Override public DataType getDataType() { return null; } @Override public FieldType getUnitsType() { return null; } @Override public String toString() { return getName(); } }; }
java
private static FieldType getPlaceholder(final Class<?> type, final int fieldID) { return new FieldType() { @Override public FieldTypeClass getFieldTypeClass() { return FieldTypeClass.UNKNOWN; } @Override public String name() { return "UNKNOWN"; } @Override public int getValue() { return fieldID; } @Override public String getName() { return "Unknown " + (type == null ? "" : type.getSimpleName() + "(" + fieldID + ")"); } @Override public String getName(Locale locale) { return getName(); } @Override public DataType getDataType() { return null; } @Override public FieldType getUnitsType() { return null; } @Override public String toString() { return getName(); } }; }
[ "private", "static", "FieldType", "getPlaceholder", "(", "final", "Class", "<", "?", ">", "type", ",", "final", "int", "fieldID", ")", "{", "return", "new", "FieldType", "(", ")", "{", "@", "Override", "public", "FieldTypeClass", "getFieldTypeClass", "(", ")...
Generate a placeholder for an unknown type. @param type expected type @param fieldID field ID @return placeholder
[ "Generate", "a", "placeholder", "for", "an", "unknown", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L218-L262
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/FieldTypeHelper.java
FieldTypeHelper.valueIsNotDefault
public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; }
java
public static final boolean valueIsNotDefault(FieldType type, Object value) { boolean result = true; if (value == null) { result = false; } else { DataType dataType = type.getDataType(); switch (dataType) { case BOOLEAN: { result = ((Boolean) value).booleanValue(); break; } case CURRENCY: case NUMERIC: { result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001); break; } case DURATION: { result = (((Duration) value).getDuration() != 0); break; } default: { break; } } } return result; }
[ "public", "static", "final", "boolean", "valueIsNotDefault", "(", "FieldType", "type", ",", "Object", "value", ")", "{", "boolean", "result", "=", "true", ";", "if", "(", "value", "==", "null", ")", "{", "result", "=", "false", ";", "}", "else", "{", "...
Determines if this value is the default value for the given field type. @param type field type @param value value @return true if the value is not default
[ "Determines", "if", "this", "value", "is", "the", "default", "value", "for", "the", "given", "field", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FieldTypeHelper.java#L313-L353
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.readAll
public List<ProjectFile> readAll(InputStream is, boolean linkCrossProjectRelations) throws MPXJException { try { m_tables = new HashMap<String, List<Row>>(); m_numberFormat = new DecimalFormat(); processFile(is); List<Row> rows = getRows("project", null, null); List<ProjectFile> result = new ArrayList<ProjectFile>(rows.size()); List<ExternalPredecessorRelation> externalPredecessors = new ArrayList<ExternalPredecessorRelation>(); for (Row row : rows) { setProjectID(row.getInt("proj_id")); m_reader = new PrimaveraReader(m_taskUdfCounters, m_resourceUdfCounters, m_assignmentUdfCounters, m_resourceFields, m_wbsFields, m_taskFields, m_assignmentFields, m_aliases, m_matchPrimaveraWBS); ProjectFile project = m_reader.getProject(); project.getEventManager().addProjectListeners(m_projectListeners); processProjectProperties(); processUserDefinedFields(); processCalendars(); processResources(); processResourceRates(); processTasks(); processPredecessors(); processAssignments(); externalPredecessors.addAll(m_reader.getExternalPredecessors()); m_reader = null; project.updateStructure(); result.add(project); } if (linkCrossProjectRelations) { for (ExternalPredecessorRelation externalRelation : externalPredecessors) { Task predecessorTask; // we could aggregate the project task id maps but that's likely more work // than just looping through the projects for (ProjectFile proj : result) { predecessorTask = proj.getTaskByUniqueID(externalRelation.getSourceUniqueID()); if (predecessorTask != null) { Relation relation = externalRelation.getTargetTask().addPredecessor(predecessorTask, externalRelation.getType(), externalRelation.getLag()); relation.setUniqueID(externalRelation.getUniqueID()); break; } } // if predecessorTask not found the external task is outside of the file so ignore } } return result; } finally { m_reader = null; m_tables = null; m_currentTableName = null; m_currentTable = null; m_currentFieldNames = null; m_defaultCurrencyName = null; m_currencyMap.clear(); m_numberFormat = null; m_defaultCurrencyData = null; } }
java
public List<ProjectFile> readAll(InputStream is, boolean linkCrossProjectRelations) throws MPXJException { try { m_tables = new HashMap<String, List<Row>>(); m_numberFormat = new DecimalFormat(); processFile(is); List<Row> rows = getRows("project", null, null); List<ProjectFile> result = new ArrayList<ProjectFile>(rows.size()); List<ExternalPredecessorRelation> externalPredecessors = new ArrayList<ExternalPredecessorRelation>(); for (Row row : rows) { setProjectID(row.getInt("proj_id")); m_reader = new PrimaveraReader(m_taskUdfCounters, m_resourceUdfCounters, m_assignmentUdfCounters, m_resourceFields, m_wbsFields, m_taskFields, m_assignmentFields, m_aliases, m_matchPrimaveraWBS); ProjectFile project = m_reader.getProject(); project.getEventManager().addProjectListeners(m_projectListeners); processProjectProperties(); processUserDefinedFields(); processCalendars(); processResources(); processResourceRates(); processTasks(); processPredecessors(); processAssignments(); externalPredecessors.addAll(m_reader.getExternalPredecessors()); m_reader = null; project.updateStructure(); result.add(project); } if (linkCrossProjectRelations) { for (ExternalPredecessorRelation externalRelation : externalPredecessors) { Task predecessorTask; // we could aggregate the project task id maps but that's likely more work // than just looping through the projects for (ProjectFile proj : result) { predecessorTask = proj.getTaskByUniqueID(externalRelation.getSourceUniqueID()); if (predecessorTask != null) { Relation relation = externalRelation.getTargetTask().addPredecessor(predecessorTask, externalRelation.getType(), externalRelation.getLag()); relation.setUniqueID(externalRelation.getUniqueID()); break; } } // if predecessorTask not found the external task is outside of the file so ignore } } return result; } finally { m_reader = null; m_tables = null; m_currentTableName = null; m_currentTable = null; m_currentFieldNames = null; m_defaultCurrencyName = null; m_currencyMap.clear(); m_numberFormat = null; m_defaultCurrencyData = null; } }
[ "public", "List", "<", "ProjectFile", ">", "readAll", "(", "InputStream", "is", ",", "boolean", "linkCrossProjectRelations", ")", "throws", "MPXJException", "{", "try", "{", "m_tables", "=", "new", "HashMap", "<", "String", ",", "List", "<", "Row", ">", ">",...
This is a convenience method which allows all projects in an XER file to be read in a single pass. @param is input stream @param linkCrossProjectRelations add Relation links that cross ProjectFile boundaries @return list of ProjectFile instances @throws MPXJException
[ "This", "is", "a", "convenience", "method", "which", "allows", "all", "projects", "in", "an", "XER", "file", "to", "be", "read", "in", "a", "single", "pass", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L177-L250
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.processFile
private void processFile(InputStream is) throws MPXJException { int line = 1; try { // // Test the header and extract the separator. If this is successful, // we reset the stream back as far as we can. The design of the // BufferedInputStream class means that we can't get back to character // zero, so the first record we will read will get "RMHDR" rather than // "ERMHDR" in the first field position. // BufferedInputStream bis = new BufferedInputStream(is); byte[] data = new byte[6]; data[0] = (byte) bis.read(); bis.mark(1024); bis.read(data, 1, 5); if (!new String(data).equals("ERMHDR")) { throw new MPXJException(MPXJException.INVALID_FILE); } bis.reset(); InputStreamReader reader = new InputStreamReader(bis, getCharset()); Tokenizer tk = new ReaderTokenizer(reader); tk.setDelimiter('\t'); List<String> record = new ArrayList<String>(); while (tk.getType() != Tokenizer.TT_EOF) { readRecord(tk, record); if (!record.isEmpty()) { if (processRecord(record)) { break; } } ++line; } } catch (Exception ex) { throw new MPXJException(MPXJException.READ_ERROR + " (failed at line " + line + ")", ex); } }
java
private void processFile(InputStream is) throws MPXJException { int line = 1; try { // // Test the header and extract the separator. If this is successful, // we reset the stream back as far as we can. The design of the // BufferedInputStream class means that we can't get back to character // zero, so the first record we will read will get "RMHDR" rather than // "ERMHDR" in the first field position. // BufferedInputStream bis = new BufferedInputStream(is); byte[] data = new byte[6]; data[0] = (byte) bis.read(); bis.mark(1024); bis.read(data, 1, 5); if (!new String(data).equals("ERMHDR")) { throw new MPXJException(MPXJException.INVALID_FILE); } bis.reset(); InputStreamReader reader = new InputStreamReader(bis, getCharset()); Tokenizer tk = new ReaderTokenizer(reader); tk.setDelimiter('\t'); List<String> record = new ArrayList<String>(); while (tk.getType() != Tokenizer.TT_EOF) { readRecord(tk, record); if (!record.isEmpty()) { if (processRecord(record)) { break; } } ++line; } } catch (Exception ex) { throw new MPXJException(MPXJException.READ_ERROR + " (failed at line " + line + ")", ex); } }
[ "private", "void", "processFile", "(", "InputStream", "is", ")", "throws", "MPXJException", "{", "int", "line", "=", "1", ";", "try", "{", "//", "// Test the header and extract the separator. If this is successful,", "// we reset the stream back as far as we can. The design of ...
Reads the XER file table and row structure ready for processing. @param is input stream @throws MPXJException
[ "Reads", "the", "XER", "file", "table", "and", "row", "structure", "ready", "for", "processing", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L258-L307
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.getCharset
private Charset getCharset() { Charset result = m_charset; if (result == null) { // We default to CP1252 as this seems to be the most common encoding result = m_encoding == null ? CharsetHelper.CP1252 : Charset.forName(m_encoding); } return result; }
java
private Charset getCharset() { Charset result = m_charset; if (result == null) { // We default to CP1252 as this seems to be the most common encoding result = m_encoding == null ? CharsetHelper.CP1252 : Charset.forName(m_encoding); } return result; }
[ "private", "Charset", "getCharset", "(", ")", "{", "Charset", "result", "=", "m_charset", ";", "if", "(", "result", "==", "null", ")", "{", "// We default to CP1252 as this seems to be the most common encoding", "result", "=", "m_encoding", "==", "null", "?", "Chars...
Retrieve the Charset used to read the file. @return Charset instance
[ "Retrieve", "the", "Charset", "used", "to", "read", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L314-L323
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.processProjectID
private void processProjectID() { if (m_projectID == null) { List<Row> rows = getRows("project", null, null); if (!rows.isEmpty()) { Row row = rows.get(0); m_projectID = row.getInteger("proj_id"); } } }
java
private void processProjectID() { if (m_projectID == null) { List<Row> rows = getRows("project", null, null); if (!rows.isEmpty()) { Row row = rows.get(0); m_projectID = row.getInteger("proj_id"); } } }
[ "private", "void", "processProjectID", "(", ")", "{", "if", "(", "m_projectID", "==", "null", ")", "{", "List", "<", "Row", ">", "rows", "=", "getRows", "(", "\"project\"", ",", "null", ",", "null", ")", ";", "if", "(", "!", "rows", ".", "isEmpty", ...
If the user has not specified a project ID, this method retrieves the ID of the first project in the file.
[ "If", "the", "user", "has", "not", "specified", "a", "project", "ID", "this", "method", "retrieves", "the", "ID", "of", "the", "first", "project", "in", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L329-L340
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.processCurrency
private void processCurrency(Row row) { String currencyName = row.getString("curr_short_name"); DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); symbols.setGroupingSeparator(row.getString("digit_group_symbol").charAt(0)); DecimalFormat nf = new DecimalFormat(); nf.setDecimalFormatSymbols(symbols); nf.applyPattern("#.#"); m_currencyMap.put(currencyName, nf); if (currencyName.equalsIgnoreCase(m_defaultCurrencyName)) { m_numberFormat = nf; m_defaultCurrencyData = row; } }
java
private void processCurrency(Row row) { String currencyName = row.getString("curr_short_name"); DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); symbols.setGroupingSeparator(row.getString("digit_group_symbol").charAt(0)); DecimalFormat nf = new DecimalFormat(); nf.setDecimalFormatSymbols(symbols); nf.applyPattern("#.#"); m_currencyMap.put(currencyName, nf); if (currencyName.equalsIgnoreCase(m_defaultCurrencyName)) { m_numberFormat = nf; m_defaultCurrencyData = row; } }
[ "private", "void", "processCurrency", "(", "Row", "row", ")", "{", "String", "currencyName", "=", "row", ".", "getString", "(", "\"curr_short_name\"", ")", ";", "DecimalFormatSymbols", "symbols", "=", "new", "DecimalFormatSymbols", "(", ")", ";", "symbols", ".",...
Process a currency definition. @param row record from XER file
[ "Process", "a", "currency", "definition", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L347-L363
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.listProjects
public Map<Integer, String> listProjects(InputStream is) throws MPXJException { try { m_tables = new HashMap<String, List<Row>>(); processFile(is); Map<Integer, String> result = new HashMap<Integer, String>(); List<Row> rows = getRows("project", null, null); for (Row row : rows) { Integer id = row.getInteger("proj_id"); String name = row.getString("proj_short_name"); result.put(id, name); } return result; } finally { m_tables = null; m_currentTable = null; m_currentFieldNames = null; } }
java
public Map<Integer, String> listProjects(InputStream is) throws MPXJException { try { m_tables = new HashMap<String, List<Row>>(); processFile(is); Map<Integer, String> result = new HashMap<Integer, String>(); List<Row> rows = getRows("project", null, null); for (Row row : rows) { Integer id = row.getInteger("proj_id"); String name = row.getString("proj_short_name"); result.put(id, name); } return result; } finally { m_tables = null; m_currentTable = null; m_currentFieldNames = null; } }
[ "public", "Map", "<", "Integer", ",", "String", ">", "listProjects", "(", "InputStream", "is", ")", "throws", "MPXJException", "{", "try", "{", "m_tables", "=", "new", "HashMap", "<", "String", ",", "List", "<", "Row", ">", ">", "(", ")", ";", "process...
Populates a Map instance representing the IDs and names of projects available in the current file. @param is input stream used to read XER file @return Map instance containing ID and name pairs @throws MPXJException
[ "Populates", "a", "Map", "instance", "representing", "the", "IDs", "and", "names", "of", "projects", "available", "in", "the", "current", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L373-L399
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.processScheduleOptions
private void processScheduleOptions() { List<Row> rows = getRows("schedoptions", "proj_id", m_projectID); if (rows.isEmpty() == false) { Row row = rows.get(0); Map<String, Object> customProperties = new HashMap<String, Object>(); customProperties.put("LagCalendar", row.getString("sched_calendar_on_relationship_lag")); customProperties.put("RetainedLogic", Boolean.valueOf(row.getBoolean("sched_retained_logic"))); customProperties.put("ProgressOverride", Boolean.valueOf(row.getBoolean("sched_progress_override"))); customProperties.put("IgnoreOtherProjectRelationships", row.getString("sched_outer_depend_type")); customProperties.put("StartToStartLagCalculationType", Boolean.valueOf(row.getBoolean("sched_lag_early_start_flag"))); m_reader.getProject().getProjectProperties().setCustomProperties(customProperties); } }
java
private void processScheduleOptions() { List<Row> rows = getRows("schedoptions", "proj_id", m_projectID); if (rows.isEmpty() == false) { Row row = rows.get(0); Map<String, Object> customProperties = new HashMap<String, Object>(); customProperties.put("LagCalendar", row.getString("sched_calendar_on_relationship_lag")); customProperties.put("RetainedLogic", Boolean.valueOf(row.getBoolean("sched_retained_logic"))); customProperties.put("ProgressOverride", Boolean.valueOf(row.getBoolean("sched_progress_override"))); customProperties.put("IgnoreOtherProjectRelationships", row.getString("sched_outer_depend_type")); customProperties.put("StartToStartLagCalculationType", Boolean.valueOf(row.getBoolean("sched_lag_early_start_flag"))); m_reader.getProject().getProjectProperties().setCustomProperties(customProperties); } }
[ "private", "void", "processScheduleOptions", "(", ")", "{", "List", "<", "Row", ">", "rows", "=", "getRows", "(", "\"schedoptions\"", ",", "\"proj_id\"", ",", "m_projectID", ")", ";", "if", "(", "rows", ".", "isEmpty", "(", ")", "==", "false", ")", "{", ...
Process schedule options from SCHEDOPTIONS. This table only seems to exist in XER files, not P6 databases.
[ "Process", "schedule", "options", "from", "SCHEDOPTIONS", ".", "This", "table", "only", "seems", "to", "exist", "in", "XER", "files", "not", "P6", "databases", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L438-L452
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.readRecord
private void readRecord(Tokenizer tk, List<String> record) throws IOException { record.clear(); while (tk.nextToken() == Tokenizer.TT_WORD) { record.add(tk.getToken()); } }
java
private void readRecord(Tokenizer tk, List<String> record) throws IOException { record.clear(); while (tk.nextToken() == Tokenizer.TT_WORD) { record.add(tk.getToken()); } }
[ "private", "void", "readRecord", "(", "Tokenizer", "tk", ",", "List", "<", "String", ">", "record", ")", "throws", "IOException", "{", "record", ".", "clear", "(", ")", ";", "while", "(", "tk", ".", "nextToken", "(", ")", "==", "Tokenizer", ".", "TT_WO...
Reads each token from a single record and adds it to a list. @param tk tokenizer @param record list of tokens @throws IOException
[ "Reads", "each", "token", "from", "a", "single", "record", "and", "adds", "it", "to", "a", "list", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L529-L536
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.processRecord
private boolean processRecord(List<String> record) throws MPXJException { boolean done = false; XerRecordType type = RECORD_TYPE_MAP.get(record.get(0)); if (type == null) { throw new MPXJException(MPXJException.INVALID_FORMAT); } switch (type) { case HEADER: { processHeader(record); break; } case TABLE: { m_currentTableName = record.get(1).toLowerCase(); m_skipTable = !REQUIRED_TABLES.contains(m_currentTableName); if (m_skipTable) { m_currentTable = null; } else { m_currentTable = new LinkedList<Row>(); m_tables.put(m_currentTableName, m_currentTable); } break; } case FIELDS: { if (m_skipTable) { m_currentFieldNames = null; } else { m_currentFieldNames = record.toArray(new String[record.size()]); for (int loop = 0; loop < m_currentFieldNames.length; loop++) { m_currentFieldNames[loop] = m_currentFieldNames[loop].toLowerCase(); } } break; } case DATA: { if (!m_skipTable) { Map<String, Object> map = new HashMap<String, Object>(); for (int loop = 1; loop < record.size(); loop++) { String fieldName = m_currentFieldNames[loop]; String fieldValue = record.get(loop); XerFieldType fieldType = FIELD_TYPE_MAP.get(fieldName); if (fieldType == null) { fieldType = XerFieldType.STRING; } Object objectValue; if (fieldValue.length() == 0) { objectValue = null; } else { switch (fieldType) { case DATE: { try { objectValue = m_df.parseObject(fieldValue); } catch (ParseException ex) { objectValue = fieldValue; } break; } case CURRENCY: case DOUBLE: case DURATION: { try { objectValue = Double.valueOf(m_numberFormat.parse(fieldValue.trim()).doubleValue()); } catch (ParseException ex) { objectValue = fieldValue; } break; } case INTEGER: { objectValue = Integer.valueOf(fieldValue.trim()); break; } default: { objectValue = fieldValue; break; } } } map.put(fieldName, objectValue); } Row currentRow = new MapRow(map); m_currentTable.add(currentRow); // // Special case - we need to know the default currency format // ahead of time, so process each row as we get it so that // we can correctly parse currency values in later tables. // if (m_currentTableName.equals("currtype")) { processCurrency(currentRow); } } break; } case END: { done = true; break; } default: { break; } } return done; }
java
private boolean processRecord(List<String> record) throws MPXJException { boolean done = false; XerRecordType type = RECORD_TYPE_MAP.get(record.get(0)); if (type == null) { throw new MPXJException(MPXJException.INVALID_FORMAT); } switch (type) { case HEADER: { processHeader(record); break; } case TABLE: { m_currentTableName = record.get(1).toLowerCase(); m_skipTable = !REQUIRED_TABLES.contains(m_currentTableName); if (m_skipTable) { m_currentTable = null; } else { m_currentTable = new LinkedList<Row>(); m_tables.put(m_currentTableName, m_currentTable); } break; } case FIELDS: { if (m_skipTable) { m_currentFieldNames = null; } else { m_currentFieldNames = record.toArray(new String[record.size()]); for (int loop = 0; loop < m_currentFieldNames.length; loop++) { m_currentFieldNames[loop] = m_currentFieldNames[loop].toLowerCase(); } } break; } case DATA: { if (!m_skipTable) { Map<String, Object> map = new HashMap<String, Object>(); for (int loop = 1; loop < record.size(); loop++) { String fieldName = m_currentFieldNames[loop]; String fieldValue = record.get(loop); XerFieldType fieldType = FIELD_TYPE_MAP.get(fieldName); if (fieldType == null) { fieldType = XerFieldType.STRING; } Object objectValue; if (fieldValue.length() == 0) { objectValue = null; } else { switch (fieldType) { case DATE: { try { objectValue = m_df.parseObject(fieldValue); } catch (ParseException ex) { objectValue = fieldValue; } break; } case CURRENCY: case DOUBLE: case DURATION: { try { objectValue = Double.valueOf(m_numberFormat.parse(fieldValue.trim()).doubleValue()); } catch (ParseException ex) { objectValue = fieldValue; } break; } case INTEGER: { objectValue = Integer.valueOf(fieldValue.trim()); break; } default: { objectValue = fieldValue; break; } } } map.put(fieldName, objectValue); } Row currentRow = new MapRow(map); m_currentTable.add(currentRow); // // Special case - we need to know the default currency format // ahead of time, so process each row as we get it so that // we can correctly parse currency values in later tables. // if (m_currentTableName.equals("currtype")) { processCurrency(currentRow); } } break; } case END: { done = true; break; } default: { break; } } return done; }
[ "private", "boolean", "processRecord", "(", "List", "<", "String", ">", "record", ")", "throws", "MPXJException", "{", "boolean", "done", "=", "false", ";", "XerRecordType", "type", "=", "RECORD_TYPE_MAP", ".", "get", "(", "record", ".", "get", "(", "0", "...
Handles a complete record at a time, stores it in a form ready for further processing. @param record record to be processed @return flag indicating if this is the last record in the file to be processed @throws MPXJException
[ "Handles", "a", "complete", "record", "at", "a", "time", "stores", "it", "in", "a", "form", "ready", "for", "further", "processing", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L546-L698
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java
PrimaveraXERFileReader.getRows
private List<Row> getRows(String tableName, String columnName, Integer id) { List<Row> result; List<Row> table = m_tables.get(tableName); if (table == null) { result = Collections.<Row> emptyList(); } else { if (columnName == null) { result = table; } else { result = new LinkedList<Row>(); for (Row row : table) { if (NumberHelper.equals(id, row.getInteger(columnName))) { result.add(row); } } } } return result; }
java
private List<Row> getRows(String tableName, String columnName, Integer id) { List<Row> result; List<Row> table = m_tables.get(tableName); if (table == null) { result = Collections.<Row> emptyList(); } else { if (columnName == null) { result = table; } else { result = new LinkedList<Row>(); for (Row row : table) { if (NumberHelper.equals(id, row.getInteger(columnName))) { result.add(row); } } } } return result; }
[ "private", "List", "<", "Row", ">", "getRows", "(", "String", "tableName", ",", "String", "columnName", ",", "Integer", "id", ")", "{", "List", "<", "Row", ">", "result", ";", "List", "<", "Row", ">", "table", "=", "m_tables", ".", "get", "(", "table...
Filters a list of rows from the named table. If a column name and a value are supplied, then use this to filter the rows. If no column name is supplied, then return all rows. @param tableName table name @param columnName filter column name @param id filter column value @return filtered list of rows
[ "Filters", "a", "list", "of", "rows", "from", "the", "named", "table", ".", "If", "a", "column", "name", "and", "a", "value", "are", "supplied", "then", "use", "this", "to", "filter", "the", "rows", ".", "If", "no", "column", "name", "is", "supplied", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraXERFileReader.java#L803-L830
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader.java
CustomFieldValueReader.getTypedValue
protected Object getTypedValue(int type, byte[] value) { Object result; switch (type) { case 4: // Date { result = MPPUtility.getTimestamp(value, 0); break; } case 6: // Duration { TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits()); result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units); break; } case 9: // Cost { result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100); break; } case 15: // Number { result = Double.valueOf(MPPUtility.getDouble(value, 0)); break; } case 36058: case 21: // Text { result = MPPUtility.getUnicodeString(value, 0); break; } default: { result = value; break; } } return result; }
java
protected Object getTypedValue(int type, byte[] value) { Object result; switch (type) { case 4: // Date { result = MPPUtility.getTimestamp(value, 0); break; } case 6: // Duration { TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(value, 4), m_properties.getDefaultDurationUnits()); result = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(value, 0), units); break; } case 9: // Cost { result = Double.valueOf(MPPUtility.getDouble(value, 0) / 100); break; } case 15: // Number { result = Double.valueOf(MPPUtility.getDouble(value, 0)); break; } case 36058: case 21: // Text { result = MPPUtility.getUnicodeString(value, 0); break; } default: { result = value; break; } } return result; }
[ "protected", "Object", "getTypedValue", "(", "int", "type", ",", "byte", "[", "]", "value", ")", "{", "Object", "result", ";", "switch", "(", "type", ")", "{", "case", "4", ":", "// Date", "{", "result", "=", "MPPUtility", ".", "getTimestamp", "(", "va...
Convert raw value as read from the MPP file into a Java type. @param type MPP value type @param value raw value data @return Java object
[ "Convert", "raw", "value", "as", "read", "from", "the", "MPP", "file", "into", "a", "Java", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader.java#L71-L117
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/Table.java
Table.addRow
public void addRow(String primaryKeyColumnName, Map<String, Object> map) { Integer rowNumber = Integer.valueOf(m_rowNumber++); map.put("ROW_NUMBER", rowNumber); Object primaryKey = null; if (primaryKeyColumnName != null) { primaryKey = map.get(primaryKeyColumnName); } if (primaryKey == null) { primaryKey = rowNumber; } MapRow newRow = new MapRow(map); MapRow oldRow = m_rows.get(primaryKey); if (oldRow == null) { m_rows.put(primaryKey, newRow); } else { int oldVersion = oldRow.getInteger("ROW_VERSION").intValue(); int newVersion = newRow.getInteger("ROW_VERSION").intValue(); if (newVersion > oldVersion) { m_rows.put(primaryKey, newRow); } } }
java
public void addRow(String primaryKeyColumnName, Map<String, Object> map) { Integer rowNumber = Integer.valueOf(m_rowNumber++); map.put("ROW_NUMBER", rowNumber); Object primaryKey = null; if (primaryKeyColumnName != null) { primaryKey = map.get(primaryKeyColumnName); } if (primaryKey == null) { primaryKey = rowNumber; } MapRow newRow = new MapRow(map); MapRow oldRow = m_rows.get(primaryKey); if (oldRow == null) { m_rows.put(primaryKey, newRow); } else { int oldVersion = oldRow.getInteger("ROW_VERSION").intValue(); int newVersion = newRow.getInteger("ROW_VERSION").intValue(); if (newVersion > oldVersion) { m_rows.put(primaryKey, newRow); } } }
[ "public", "void", "addRow", "(", "String", "primaryKeyColumnName", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "Integer", "rowNumber", "=", "Integer", ".", "valueOf", "(", "m_rowNumber", "++", ")", ";", "map", ".", "put", "(", "\"ROW_...
Add a row to the table. We have a limited understanding of the way Btrieve handles outdated rows, so we use what we think is a version number to try to ensure that we only have the latest rows. @param primaryKeyColumnName primary key column name @param map Map containing row data
[ "Add", "a", "row", "to", "the", "table", ".", "We", "have", "a", "limited", "understanding", "of", "the", "way", "Btrieve", "handles", "outdated", "rows", "so", "we", "use", "what", "we", "think", "is", "a", "version", "number", "to", "try", "to", "ens...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Table.java#L63-L93
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.getEmbeddedObjects
public static List<List<RTFEmbeddedObject>> getEmbeddedObjects(String text) { List<List<RTFEmbeddedObject>> objects = null; List<RTFEmbeddedObject> objectData; int offset = text.indexOf(OBJDATA); if (offset != -1) { objects = new LinkedList<List<RTFEmbeddedObject>>(); while (offset != -1) { objectData = new LinkedList<RTFEmbeddedObject>(); objects.add(objectData); offset = readObjectData(offset, text, objectData); offset = text.indexOf(OBJDATA, offset); } } return (objects); }
java
public static List<List<RTFEmbeddedObject>> getEmbeddedObjects(String text) { List<List<RTFEmbeddedObject>> objects = null; List<RTFEmbeddedObject> objectData; int offset = text.indexOf(OBJDATA); if (offset != -1) { objects = new LinkedList<List<RTFEmbeddedObject>>(); while (offset != -1) { objectData = new LinkedList<RTFEmbeddedObject>(); objects.add(objectData); offset = readObjectData(offset, text, objectData); offset = text.indexOf(OBJDATA, offset); } } return (objects); }
[ "public", "static", "List", "<", "List", "<", "RTFEmbeddedObject", ">", ">", "getEmbeddedObjects", "(", "String", "text", ")", "{", "List", "<", "List", "<", "RTFEmbeddedObject", ">>", "objects", "=", "null", ";", "List", "<", "RTFEmbeddedObject", ">", "obje...
This method generates a list of lists. Each list represents the data for an embedded object, and contains set set of RTFEmbeddedObject instances that make up the embedded object. This method will return null if there are no embedded objects in the RTF document. @param text RTF document @return list of lists of RTFEmbeddedObject instances
[ "This", "method", "generates", "a", "list", "of", "lists", ".", "Each", "list", "represents", "the", "data", "for", "an", "embedded", "object", "and", "contains", "set", "set", "of", "RTFEmbeddedObject", "instances", "that", "make", "up", "the", "embedded", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L149-L169
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.getInt
private int getInt(List<byte[]> blocks) { int result; if (blocks.isEmpty() == false) { byte[] data = blocks.remove(0); result = MPPUtility.getInt(data, 0); } else { result = 0; } return (result); }
java
private int getInt(List<byte[]> blocks) { int result; if (blocks.isEmpty() == false) { byte[] data = blocks.remove(0); result = MPPUtility.getInt(data, 0); } else { result = 0; } return (result); }
[ "private", "int", "getInt", "(", "List", "<", "byte", "[", "]", ">", "blocks", ")", "{", "int", "result", ";", "if", "(", "blocks", ".", "isEmpty", "(", ")", "==", "false", ")", "{", "byte", "[", "]", "data", "=", "blocks", ".", "remove", "(", ...
Internal method used to retrieve a integer from an embedded data block. @param blocks list of data blocks @return int value
[ "Internal", "method", "used", "to", "retrieve", "a", "integer", "from", "an", "embedded", "data", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L178-L191
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.getData
private byte[] getData(List<byte[]> blocks, int length) { byte[] result; if (blocks.isEmpty() == false) { if (length < 4) { length = 4; } result = new byte[length]; int offset = 0; byte[] data; while (offset < length) { data = blocks.remove(0); System.arraycopy(data, 0, result, offset, data.length); offset += data.length; } } else { result = null; } return (result); }
java
private byte[] getData(List<byte[]> blocks, int length) { byte[] result; if (blocks.isEmpty() == false) { if (length < 4) { length = 4; } result = new byte[length]; int offset = 0; byte[] data; while (offset < length) { data = blocks.remove(0); System.arraycopy(data, 0, result, offset, data.length); offset += data.length; } } else { result = null; } return (result); }
[ "private", "byte", "[", "]", "getData", "(", "List", "<", "byte", "[", "]", ">", "blocks", ",", "int", "length", ")", "{", "byte", "[", "]", "result", ";", "if", "(", "blocks", ".", "isEmpty", "(", ")", "==", "false", ")", "{", "if", "(", "leng...
Internal method used to retrieve a byte array from one or more embedded data blocks. Consecutive data blocks may need to be concatenated by this method in order to retrieve the complete set of data. @param blocks list of data blocks @param length expected length of the data @return byte array
[ "Internal", "method", "used", "to", "retrieve", "a", "byte", "array", "from", "one", "or", "more", "embedded", "data", "blocks", ".", "Consecutive", "data", "blocks", "may", "need", "to", "be", "concatenated", "by", "this", "method", "in", "order", "to", "...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L203-L231
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.readObjectData
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects) { LinkedList<byte[]> blocks = new LinkedList<byte[]>(); offset += (OBJDATA.length()); offset = skipEndOfLine(text, offset); int length; int lastOffset = offset; while (offset != -1) { length = getBlockLength(text, offset); lastOffset = readDataBlock(text, offset, length, blocks); offset = skipEndOfLine(text, lastOffset); } RTFEmbeddedObject headerObject; RTFEmbeddedObject dataObject; while (blocks.isEmpty() == false) { headerObject = new RTFEmbeddedObject(blocks, 2); objects.add(headerObject); if (blocks.isEmpty() == false) { dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2()); objects.add(dataObject); } } return (lastOffset); }
java
private static int readObjectData(int offset, String text, List<RTFEmbeddedObject> objects) { LinkedList<byte[]> blocks = new LinkedList<byte[]>(); offset += (OBJDATA.length()); offset = skipEndOfLine(text, offset); int length; int lastOffset = offset; while (offset != -1) { length = getBlockLength(text, offset); lastOffset = readDataBlock(text, offset, length, blocks); offset = skipEndOfLine(text, lastOffset); } RTFEmbeddedObject headerObject; RTFEmbeddedObject dataObject; while (blocks.isEmpty() == false) { headerObject = new RTFEmbeddedObject(blocks, 2); objects.add(headerObject); if (blocks.isEmpty() == false) { dataObject = new RTFEmbeddedObject(blocks, headerObject.getTypeFlag2()); objects.add(dataObject); } } return (lastOffset); }
[ "private", "static", "int", "readObjectData", "(", "int", "offset", ",", "String", "text", ",", "List", "<", "RTFEmbeddedObject", ">", "objects", ")", "{", "LinkedList", "<", "byte", "[", "]", ">", "blocks", "=", "new", "LinkedList", "<", "byte", "[", "]...
This method extracts byte arrays from the embedded object data and converts them into RTFEmbeddedObject instances, which it then adds to the supplied list. @param offset offset into the RTF document @param text RTF document @param objects destination for RTFEmbeddedObject instances @return new offset into the RTF document
[ "This", "method", "extracts", "byte", "arrays", "from", "the", "embedded", "object", "data", "and", "converts", "them", "into", "RTFEmbeddedObject", "instances", "which", "it", "then", "adds", "to", "the", "supplied", "list", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L243-L275
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.skipEndOfLine
private static int skipEndOfLine(String text, int offset) { char c; boolean finished = false; while (finished == false) { c = text.charAt(offset); switch (c) { case ' ': // found that OBJDATA could be followed by a space the EOL case '\r': case '\n': { ++offset; break; } case '}': { offset = -1; finished = true; break; } default: { finished = true; break; } } } return (offset); }
java
private static int skipEndOfLine(String text, int offset) { char c; boolean finished = false; while (finished == false) { c = text.charAt(offset); switch (c) { case ' ': // found that OBJDATA could be followed by a space the EOL case '\r': case '\n': { ++offset; break; } case '}': { offset = -1; finished = true; break; } default: { finished = true; break; } } } return (offset); }
[ "private", "static", "int", "skipEndOfLine", "(", "String", "text", ",", "int", "offset", ")", "{", "char", "c", ";", "boolean", "finished", "=", "false", ";", "while", "(", "finished", "==", "false", ")", "{", "c", "=", "text", ".", "charAt", "(", "...
This method skips the end-of-line markers in the RTF document. It also indicates if the end of the embedded object has been reached. @param text RTF document test @param offset offset into the RTF document @return new offset
[ "This", "method", "skips", "the", "end", "-", "of", "-", "line", "markers", "in", "the", "RTF", "document", ".", "It", "also", "indicates", "if", "the", "end", "of", "the", "embedded", "object", "has", "been", "reached", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L285-L319
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.getBlockLength
private static int getBlockLength(String text, int offset) { int startIndex = offset; boolean finished = false; char c; while (finished == false) { c = text.charAt(offset); switch (c) { case '\r': case '\n': case '}': { finished = true; break; } default: { ++offset; break; } } } int length = offset - startIndex; return (length); }
java
private static int getBlockLength(String text, int offset) { int startIndex = offset; boolean finished = false; char c; while (finished == false) { c = text.charAt(offset); switch (c) { case '\r': case '\n': case '}': { finished = true; break; } default: { ++offset; break; } } } int length = offset - startIndex; return (length); }
[ "private", "static", "int", "getBlockLength", "(", "String", "text", ",", "int", "offset", ")", "{", "int", "startIndex", "=", "offset", ";", "boolean", "finished", "=", "false", ";", "char", "c", ";", "while", "(", "finished", "==", "false", ")", "{", ...
Calculates the length of the next block of RTF data. @param text RTF data @param offset current offset into this data @return block length
[ "Calculates", "the", "length", "of", "the", "next", "block", "of", "RTF", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L328-L358
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java
RTFEmbeddedObject.readDataBlock
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
java
private static int readDataBlock(String text, int offset, int length, List<byte[]> blocks) { int bytes = length / 2; byte[] data = new byte[bytes]; for (int index = 0; index < bytes; index++) { data[index] = (byte) Integer.parseInt(text.substring(offset, offset + 2), 16); offset += 2; } blocks.add(data); return (offset); }
[ "private", "static", "int", "readDataBlock", "(", "String", "text", ",", "int", "offset", ",", "int", "length", ",", "List", "<", "byte", "[", "]", ">", "blocks", ")", "{", "int", "bytes", "=", "length", "/", "2", ";", "byte", "[", "]", "data", "="...
Reads a data block and adds it to the list of blocks. @param text RTF data @param offset current offset @param length next block length @param blocks list of blocks @return next offset
[ "Reads", "a", "data", "block", "and", "adds", "it", "to", "the", "list", "of", "blocks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/RTFEmbeddedObject.java#L369-L382
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP12Reader.java
MPP12Reader.readSubProject
private SubProject readSubProject(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { try { SubProject sp = new SubProject(); int type = SUBPROJECT_TASKUNIQUEID0; if (uniqueIDOffset != -1) { int value = MPPUtility.getInt(data, uniqueIDOffset); type = MPPUtility.getInt(data, uniqueIDOffset + 4); switch (type) { case SUBPROJECT_TASKUNIQUEID0: case SUBPROJECT_TASKUNIQUEID1: case SUBPROJECT_TASKUNIQUEID2: case SUBPROJECT_TASKUNIQUEID3: case SUBPROJECT_TASKUNIQUEID4: case SUBPROJECT_TASKUNIQUEID5: case SUBPROJECT_TASKUNIQUEID6: { sp.setTaskUniqueID(Integer.valueOf(value)); m_taskSubProjects.put(sp.getTaskUniqueID(), sp); break; } default: { if (value != 0) { sp.addExternalTaskUniqueID(Integer.valueOf(value)); m_taskSubProjects.put(Integer.valueOf(value), sp); } break; } } // Now get the unique id offset for this subproject value = 0x00800000 + ((subprojectIndex - 1) * 0x00400000); sp.setUniqueIDOffset(Integer.valueOf(value)); } if (type == SUBPROJECT_TASKUNIQUEID4) { sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset)); } else { // // First block header // filePathOffset += 18; // // String size as a 4 byte int // filePathOffset += 4; // // Full DOS path // sp.setDosFullPath(MPPUtility.getString(data, filePathOffset)); filePathOffset += (sp.getDosFullPath().length() + 1); // // 24 byte block // filePathOffset += 24; // // 4 byte block size // int size = MPPUtility.getInt(data, filePathOffset); filePathOffset += 4; if (size == 0) { sp.setFullPath(sp.getDosFullPath()); } else { // // 4 byte unicode string size in bytes // size = MPPUtility.getInt(data, filePathOffset); filePathOffset += 4; // // 2 byte data // filePathOffset += 2; // // Unicode string // sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset, size)); //filePathOffset += size; } // // Second block header // fileNameOffset += 18; // // String size as a 4 byte int // fileNameOffset += 4; // // DOS file name // sp.setDosFileName(MPPUtility.getString(data, fileNameOffset)); fileNameOffset += (sp.getDosFileName().length() + 1); // // 24 byte block // fileNameOffset += 24; // // 4 byte block size // size = MPPUtility.getInt(data, fileNameOffset); fileNameOffset += 4; if (size == 0) { sp.setFileName(sp.getDosFileName()); } else { // // 4 byte unicode string size in bytes // size = MPPUtility.getInt(data, fileNameOffset); fileNameOffset += 4; // // 2 byte data // fileNameOffset += 2; // // Unicode string // sp.setFileName(MPPUtility.getUnicodeString(data, fileNameOffset, size)); //fileNameOffset += size; } } //System.out.println(sp.toString()); // Add to the list of subprojects m_file.getSubProjects().add(sp); return (sp); } // // Admit defeat at this point - we have probably stumbled // upon a data format we don't understand, so we'll fail // gracefully here. This will now be reported as a missing // sub project error by end users of the library, rather // than as an exception being thrown. // catch (ArrayIndexOutOfBoundsException ex) { return (null); } }
java
private SubProject readSubProject(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { try { SubProject sp = new SubProject(); int type = SUBPROJECT_TASKUNIQUEID0; if (uniqueIDOffset != -1) { int value = MPPUtility.getInt(data, uniqueIDOffset); type = MPPUtility.getInt(data, uniqueIDOffset + 4); switch (type) { case SUBPROJECT_TASKUNIQUEID0: case SUBPROJECT_TASKUNIQUEID1: case SUBPROJECT_TASKUNIQUEID2: case SUBPROJECT_TASKUNIQUEID3: case SUBPROJECT_TASKUNIQUEID4: case SUBPROJECT_TASKUNIQUEID5: case SUBPROJECT_TASKUNIQUEID6: { sp.setTaskUniqueID(Integer.valueOf(value)); m_taskSubProjects.put(sp.getTaskUniqueID(), sp); break; } default: { if (value != 0) { sp.addExternalTaskUniqueID(Integer.valueOf(value)); m_taskSubProjects.put(Integer.valueOf(value), sp); } break; } } // Now get the unique id offset for this subproject value = 0x00800000 + ((subprojectIndex - 1) * 0x00400000); sp.setUniqueIDOffset(Integer.valueOf(value)); } if (type == SUBPROJECT_TASKUNIQUEID4) { sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset)); } else { // // First block header // filePathOffset += 18; // // String size as a 4 byte int // filePathOffset += 4; // // Full DOS path // sp.setDosFullPath(MPPUtility.getString(data, filePathOffset)); filePathOffset += (sp.getDosFullPath().length() + 1); // // 24 byte block // filePathOffset += 24; // // 4 byte block size // int size = MPPUtility.getInt(data, filePathOffset); filePathOffset += 4; if (size == 0) { sp.setFullPath(sp.getDosFullPath()); } else { // // 4 byte unicode string size in bytes // size = MPPUtility.getInt(data, filePathOffset); filePathOffset += 4; // // 2 byte data // filePathOffset += 2; // // Unicode string // sp.setFullPath(MPPUtility.getUnicodeString(data, filePathOffset, size)); //filePathOffset += size; } // // Second block header // fileNameOffset += 18; // // String size as a 4 byte int // fileNameOffset += 4; // // DOS file name // sp.setDosFileName(MPPUtility.getString(data, fileNameOffset)); fileNameOffset += (sp.getDosFileName().length() + 1); // // 24 byte block // fileNameOffset += 24; // // 4 byte block size // size = MPPUtility.getInt(data, fileNameOffset); fileNameOffset += 4; if (size == 0) { sp.setFileName(sp.getDosFileName()); } else { // // 4 byte unicode string size in bytes // size = MPPUtility.getInt(data, fileNameOffset); fileNameOffset += 4; // // 2 byte data // fileNameOffset += 2; // // Unicode string // sp.setFileName(MPPUtility.getUnicodeString(data, fileNameOffset, size)); //fileNameOffset += size; } } //System.out.println(sp.toString()); // Add to the list of subprojects m_file.getSubProjects().add(sp); return (sp); } // // Admit defeat at this point - we have probably stumbled // upon a data format we don't understand, so we'll fail // gracefully here. This will now be reported as a missing // sub project error by end users of the library, rather // than as an exception being thrown. // catch (ArrayIndexOutOfBoundsException ex) { return (null); } }
[ "private", "SubProject", "readSubProject", "(", "byte", "[", "]", "data", ",", "int", "uniqueIDOffset", ",", "int", "filePathOffset", ",", "int", "fileNameOffset", ",", "int", "subprojectIndex", ")", "{", "try", "{", "SubProject", "sp", "=", "new", "SubProject...
Method used to read the sub project details from a byte array. @param data byte array @param uniqueIDOffset offset of unique ID @param filePathOffset offset of file path @param fileNameOffset offset of file name @param subprojectIndex index of the subproject, used to calculate unique id offset @return new SubProject instance
[ "Method", "used", "to", "read", "the", "sub", "project", "details", "from", "a", "byte", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP12Reader.java#L569-L738
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/TableReader.java
TableReader.readRecord
private void readRecord(byte[] buffer, Table table) { //System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, "")); int deletedFlag = getShort(buffer, 0); if (deletedFlag != 0) { Map<String, Object> row = new HashMap<String, Object>(); for (ColumnDefinition column : m_definition.getColumns()) { Object value = column.read(0, buffer); //System.out.println(column.getName() + ": " + value); row.put(column.getName(), value); } table.addRow(m_definition.getPrimaryKeyColumnName(), row); } }
java
private void readRecord(byte[] buffer, Table table) { //System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, "")); int deletedFlag = getShort(buffer, 0); if (deletedFlag != 0) { Map<String, Object> row = new HashMap<String, Object>(); for (ColumnDefinition column : m_definition.getColumns()) { Object value = column.read(0, buffer); //System.out.println(column.getName() + ": " + value); row.put(column.getName(), value); } table.addRow(m_definition.getPrimaryKeyColumnName(), row); } }
[ "private", "void", "readRecord", "(", "byte", "[", "]", "buffer", ",", "Table", "table", ")", "{", "//System.out.println(ByteArrayHelper.hexdump(buffer, true, 16, \"\"));", "int", "deletedFlag", "=", "getShort", "(", "buffer", ",", "0", ")", ";", "if", "(", "delet...
Reads a single record from the table. @param buffer record data @param table parent table
[ "Reads", "a", "single", "record", "from", "the", "table", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/TableReader.java#L118-L134
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.decodeBuffer
public static final void decodeBuffer(byte[] data, byte encryptionCode) { for (int i = 0; i < data.length; i++) { data[i] = (byte) (data[i] ^ encryptionCode); } }
java
public static final void decodeBuffer(byte[] data, byte encryptionCode) { for (int i = 0; i < data.length; i++) { data[i] = (byte) (data[i] ^ encryptionCode); } }
[ "public", "static", "final", "void", "decodeBuffer", "(", "byte", "[", "]", "data", ",", "byte", "encryptionCode", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "{", "data", "[", "i", "]", ...
This method decodes a byte array with the given encryption code using XOR encryption. @param data Source data @param encryptionCode Encryption code
[ "This", "method", "decodes", "a", "byte", "array", "with", "the", "given", "encryption", "code", "using", "XOR", "encryption", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L64-L70
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.decodePassword
public static final String decodePassword(byte[] data, byte encryptionCode) { String result; if (data.length < MINIMUM_PASSWORD_DATA_LENGTH) { result = null; } else { MPPUtility.decodeBuffer(data, encryptionCode); StringBuilder buffer = new StringBuilder(); char c; for (int i = 0; i < PASSWORD_MASK.length; i++) { int index = PASSWORD_MASK[i]; c = (char) data[index]; if (c == 0) { break; } buffer.append(c); } result = buffer.toString(); } return (result); }
java
public static final String decodePassword(byte[] data, byte encryptionCode) { String result; if (data.length < MINIMUM_PASSWORD_DATA_LENGTH) { result = null; } else { MPPUtility.decodeBuffer(data, encryptionCode); StringBuilder buffer = new StringBuilder(); char c; for (int i = 0; i < PASSWORD_MASK.length; i++) { int index = PASSWORD_MASK[i]; c = (char) data[index]; if (c == 0) { break; } buffer.append(c); } result = buffer.toString(); } return (result); }
[ "public", "static", "final", "String", "decodePassword", "(", "byte", "[", "]", "data", ",", "byte", "encryptionCode", ")", "{", "String", "result", ";", "if", "(", "data", ".", "length", "<", "MINIMUM_PASSWORD_DATA_LENGTH", ")", "{", "result", "=", "null", ...
Decode the password from the given data. Will decode the data block as well. @param data encrypted data block @param encryptionCode encryption code @return password
[ "Decode", "the", "password", "from", "the", "given", "data", ".", "Will", "decode", "the", "data", "block", "as", "well", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L112-L143
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getByteArray
public static final void getByteArray(byte[] data, int offset, int size, byte[] buffer, int bufferOffset) { System.arraycopy(data, offset, buffer, bufferOffset, size); }
java
public static final void getByteArray(byte[] data, int offset, int size, byte[] buffer, int bufferOffset) { System.arraycopy(data, offset, buffer, bufferOffset, size); }
[ "public", "static", "final", "void", "getByteArray", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "size", ",", "byte", "[", "]", "buffer", ",", "int", "bufferOffset", ")", "{", "System", ".", "arraycopy", "(", "data", ",", "offset",...
This method extracts a portion of a byte array and writes it into another byte array. @param data Source data @param offset Offset into source data @param size Required size to be extracted from the source data @param buffer Destination buffer @param bufferOffset Offset into destination buffer
[ "This", "method", "extracts", "a", "portion", "of", "a", "byte", "array", "and", "writes", "it", "into", "another", "byte", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L155-L158
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getLong6
public static final long getLong6(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 48; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
public static final long getLong6(byte[] data, int offset) { long result = 0; int i = offset; for (int shiftBy = 0; shiftBy < 48; shiftBy += 8) { result |= ((long) (data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "public", "static", "final", "long", "getLong6", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "long", "result", "=", "0", ";", "int", "i", "=", "offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "48", ";...
This method reads a six byte long from the input array. @param data the input array @param offset offset of integer data in the array @return integer value
[ "This", "method", "reads", "a", "six", "byte", "long", "from", "the", "input", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L237-L247
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getTime
public static final Date getTime(byte[] data, int offset) { int time = getShort(data, offset) / 10; Calendar cal = DateHelper.popCalendar(EPOCH_DATE); cal.set(Calendar.HOUR_OF_DAY, (time / 60)); cal.set(Calendar.MINUTE, (time % 60)); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); DateHelper.pushCalendar(cal); return (cal.getTime()); }
java
public static final Date getTime(byte[] data, int offset) { int time = getShort(data, offset) / 10; Calendar cal = DateHelper.popCalendar(EPOCH_DATE); cal.set(Calendar.HOUR_OF_DAY, (time / 60)); cal.set(Calendar.MINUTE, (time % 60)); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); DateHelper.pushCalendar(cal); return (cal.getTime()); }
[ "public", "static", "final", "Date", "getTime", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "time", "=", "getShort", "(", "data", ",", "offset", ")", "/", "10", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", ...
Reads a time value. The time is represented as tenths of a minute since midnight. @param data byte array of data @param offset location of data as offset into the array @return time value
[ "Reads", "a", "time", "value", ".", "The", "time", "is", "represented", "as", "tenths", "of", "a", "minute", "since", "midnight", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L337-L347
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getTimestamp
public static final Date getTimestamp(byte[] data, int offset) { Date result; long days = getShort(data, offset + 2); if (days < 100) { // We are seeing some files which have very small values for the number of days. // When the relevant field is shown in MS Project it appears as NA. // We try to mimic this behaviour here. days = 0; } if (days == 0 || days == 65535) { result = null; } else { long time = getShort(data, offset); if (time == 65535) { time = 0; } result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10))); } return (result); }
java
public static final Date getTimestamp(byte[] data, int offset) { Date result; long days = getShort(data, offset + 2); if (days < 100) { // We are seeing some files which have very small values for the number of days. // When the relevant field is shown in MS Project it appears as NA. // We try to mimic this behaviour here. days = 0; } if (days == 0 || days == 65535) { result = null; } else { long time = getShort(data, offset); if (time == 65535) { time = 0; } result = DateHelper.getTimestampFromLong((EPOCH + (days * DateHelper.MS_PER_DAY) + ((time * DateHelper.MS_PER_MINUTE) / 10))); } return (result); }
[ "public", "static", "final", "Date", "getTimestamp", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Date", "result", ";", "long", "days", "=", "getShort", "(", "data", ",", "offset", "+", "2", ")", ";", "if", "(", "days", "<", "100...
Reads a combined date and time value. @param data byte array of data @param offset location of data as offset into the array @return time value
[ "Reads", "a", "combined", "date", "and", "time", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L369-L397
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getTimestampFromTenths
public static final Date getTimestampFromTenths(byte[] data, int offset) { long ms = ((long) getInt(data, offset)) * 6000; return (DateHelper.getTimestampFromLong(EPOCH + ms)); }
java
public static final Date getTimestampFromTenths(byte[] data, int offset) { long ms = ((long) getInt(data, offset)) * 6000; return (DateHelper.getTimestampFromLong(EPOCH + ms)); }
[ "public", "static", "final", "Date", "getTimestampFromTenths", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "long", "ms", "=", "(", "(", "long", ")", "getInt", "(", "data", ",", "offset", ")", ")", "*", "6000", ";", "return", "(", ...
Reads a combined date and time value expressed in tenths of a minute. @param data byte array of data @param offset location of data as offset into the array @return time value
[ "Reads", "a", "combined", "date", "and", "time", "value", "expressed", "in", "tenths", "of", "a", "minute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L406-L410
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getUnicodeString
public static final String getUnicodeString(byte[] data, int offset) { int length = getUnicodeStringLengthInBytes(data, offset); return length == 0 ? "" : new String(data, offset, length, CharsetHelper.UTF16LE); }
java
public static final String getUnicodeString(byte[] data, int offset) { int length = getUnicodeStringLengthInBytes(data, offset); return length == 0 ? "" : new String(data, offset, length, CharsetHelper.UTF16LE); }
[ "public", "static", "final", "String", "getUnicodeString", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "length", "=", "getUnicodeStringLengthInBytes", "(", "data", ",", "offset", ")", ";", "return", "length", "==", "0", "?", "\"\"...
Reads a string of two byte characters from the input array. This method assumes that the string finishes either at the end of the array, or when char zero is encountered. The value starts at the position specified by the offset parameter. @param data byte array of data @param offset start point of unicode string @return string value
[ "Reads", "a", "string", "of", "two", "byte", "characters", "from", "the", "input", "array", ".", "This", "method", "assumes", "that", "the", "string", "finishes", "either", "at", "the", "end", "of", "the", "array", "or", "when", "char", "zero", "is", "en...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L423-L427
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getUnicodeStringLengthInBytes
private static final int getUnicodeStringLengthInBytes(byte[] data, int offset) { int result; if (data == null || offset >= data.length) { result = 0; } else { result = data.length - offset; for (int loop = offset; loop < (data.length - 1); loop += 2) { if (data[loop] == 0 && data[loop + 1] == 0) { result = loop - offset; break; } } } return result; }
java
private static final int getUnicodeStringLengthInBytes(byte[] data, int offset) { int result; if (data == null || offset >= data.length) { result = 0; } else { result = data.length - offset; for (int loop = offset; loop < (data.length - 1); loop += 2) { if (data[loop] == 0 && data[loop + 1] == 0) { result = loop - offset; break; } } } return result; }
[ "private", "static", "final", "int", "getUnicodeStringLengthInBytes", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "result", ";", "if", "(", "data", "==", "null", "||", "offset", ">=", "data", ".", "length", ")", "{", "result", ...
Determine the length of a nul terminated UTF16LE string in bytes. @param data string data @param offset offset into string data @return length in bytes
[ "Determine", "the", "length", "of", "a", "nul", "terminated", "UTF16LE", "string", "in", "bytes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L459-L480
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getString
public static final String getString(byte[] data, int offset) { StringBuilder buffer = new StringBuilder(); char c; for (int loop = 0; offset + loop < data.length; loop++) { c = (char) data[offset + loop]; if (c == 0) { break; } buffer.append(c); } return (buffer.toString()); }
java
public static final String getString(byte[] data, int offset) { StringBuilder buffer = new StringBuilder(); char c; for (int loop = 0; offset + loop < data.length; loop++) { c = (char) data[offset + loop]; if (c == 0) { break; } buffer.append(c); } return (buffer.toString()); }
[ "public", "static", "final", "String", "getString", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "StringBuilder", "buffer", "=", "new", "StringBuilder", "(", ")", ";", "char", "c", ";", "for", "(", "int", "loop", "=", "0", ";", "off...
Reads a string of single byte characters from the input array. This method assumes that the string finishes either at the end of the array, or when char zero is encountered. Reading begins at the supplied offset into the array. @param data byte array of data @param offset offset into the array @return string value
[ "Reads", "a", "string", "of", "single", "byte", "characters", "from", "the", "input", "array", ".", "This", "method", "assumes", "that", "the", "string", "finishes", "either", "at", "the", "end", "of", "the", "array", "or", "when", "char", "zero", "is", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L492-L510
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getColor
public static final Color getColor(byte[] data, int offset) { Color result = null; if (getByte(data, offset + 3) == 0) { int r = getByte(data, offset); int g = getByte(data, offset + 1); int b = getByte(data, offset + 2); result = new Color(r, g, b); } return result; }
java
public static final Color getColor(byte[] data, int offset) { Color result = null; if (getByte(data, offset + 3) == 0) { int r = getByte(data, offset); int g = getByte(data, offset + 1); int b = getByte(data, offset + 2); result = new Color(r, g, b); } return result; }
[ "public", "static", "final", "Color", "getColor", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Color", "result", "=", "null", ";", "if", "(", "getByte", "(", "data", ",", "offset", "+", "3", ")", "==", "0", ")", "{", "int", "r"...
Reads a color value represented by three bytes, for R, G, and B components, plus a flag byte indicating if this is an automatic color. Returns null if the color type is "Automatic". @param data byte array of data @param offset offset into array @return new Color instance
[ "Reads", "a", "color", "value", "represented", "by", "three", "bytes", "for", "R", "G", "and", "B", "components", "plus", "a", "flag", "byte", "indicating", "if", "this", "is", "an", "automatic", "color", ".", "Returns", "null", "if", "the", "color", "ty...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L534-L547
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.removeAmpersands
public static final String removeAmpersands(String name) { if (name != null) { if (name.indexOf('&') != -1) { StringBuilder sb = new StringBuilder(); int index = 0; char c; while (index < name.length()) { c = name.charAt(index); if (c != '&') { sb.append(c); } ++index; } name = sb.toString(); } } return (name); }
java
public static final String removeAmpersands(String name) { if (name != null) { if (name.indexOf('&') != -1) { StringBuilder sb = new StringBuilder(); int index = 0; char c; while (index < name.length()) { c = name.charAt(index); if (c != '&') { sb.append(c); } ++index; } name = sb.toString(); } } return (name); }
[ "public", "static", "final", "String", "removeAmpersands", "(", "String", "name", ")", "{", "if", "(", "name", "!=", "null", ")", "{", "if", "(", "name", ".", "indexOf", "(", "'", "'", ")", "!=", "-", "1", ")", "{", "StringBuilder", "sb", "=", "new...
Utility method to remove ampersands embedded in names. @param name name text @return name text without embedded ampersands
[ "Utility", "method", "to", "remove", "ampersands", "embedded", "in", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L889-L914
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.getPercentage
public static final Double getPercentage(byte[] data, int offset) { int value = MPPUtility.getShort(data, offset); Double result = null; if (value >= 0 && value <= 100) { result = NumberHelper.getDouble(value); } return result; }
java
public static final Double getPercentage(byte[] data, int offset) { int value = MPPUtility.getShort(data, offset); Double result = null; if (value >= 0 && value <= 100) { result = NumberHelper.getDouble(value); } return result; }
[ "public", "static", "final", "Double", "getPercentage", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "int", "value", "=", "MPPUtility", ".", "getShort", "(", "data", ",", "offset", ")", ";", "Double", "result", "=", "null", ";", "if",...
Utility method to read a percentage value. @param data data block @param offset offset into data block @return percentage value
[ "Utility", "method", "to", "read", "a", "percentage", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L923-L932
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.cloneSubArray
public static final byte[] cloneSubArray(byte[] data, int offset, int size) { byte[] newData = new byte[size]; System.arraycopy(data, offset, newData, 0, size); return (newData); }
java
public static final byte[] cloneSubArray(byte[] data, int offset, int size) { byte[] newData = new byte[size]; System.arraycopy(data, offset, newData, 0, size); return (newData); }
[ "public", "static", "final", "byte", "[", "]", "cloneSubArray", "(", "byte", "[", "]", "data", ",", "int", "offset", ",", "int", "size", ")", "{", "byte", "[", "]", "newData", "=", "new", "byte", "[", "size", "]", ";", "System", ".", "arraycopy", "...
This method allows a subsection of a byte array to be copied. @param data source data @param offset offset into the source data @param size length of the source data to copy @return new byte array containing copied data
[ "This", "method", "allows", "a", "subsection", "of", "a", "byte", "array", "to", "be", "copied", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L942-L947
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPUtility.java
MPPUtility.dumpBlockData
public static void dumpBlockData(int headerSize, int blockSize, byte[] data) { if (data != null) { System.out.println(ByteArrayHelper.hexdump(data, 0, headerSize, false)); int index = headerSize; while (index < data.length) { System.out.println(ByteArrayHelper.hexdump(data, index, blockSize, false)); index += blockSize; } } }
java
public static void dumpBlockData(int headerSize, int blockSize, byte[] data) { if (data != null) { System.out.println(ByteArrayHelper.hexdump(data, 0, headerSize, false)); int index = headerSize; while (index < data.length) { System.out.println(ByteArrayHelper.hexdump(data, index, blockSize, false)); index += blockSize; } } }
[ "public", "static", "void", "dumpBlockData", "(", "int", "headerSize", ",", "int", "blockSize", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "ByteArrayHelper", ".", "hexd...
Dumps the contents of a structured block made up from a header and fixed sized records. @param headerSize header zie @param blockSize block size @param data data block
[ "Dumps", "the", "contents", "of", "a", "structured", "block", "made", "up", "from", "a", "header", "and", "fixed", "sized", "records", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPUtility.java#L1256-L1268
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getDuration
@Deprecated public Duration getDuration(Date startDate, Date endDate) throws MPXJException { return (getDuration("Standard", startDate, endDate)); }
java
@Deprecated public Duration getDuration(Date startDate, Date endDate) throws MPXJException { return (getDuration("Standard", startDate, endDate)); }
[ "@", "Deprecated", "public", "Duration", "getDuration", "(", "Date", "startDate", ",", "Date", "endDate", ")", "throws", "MPXJException", "{", "return", "(", "getDuration", "(", "\"Standard\"", ",", "startDate", ",", "endDate", ")", ")", ";", "}" ]
This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar. The calendar used is the "Standard" calendar. If this calendar does not exist, and exception will be thrown. @param startDate start of the period @param endDate end of the period @return new Duration object @throws MPXJException normally when no Standard calendar is available @deprecated use calendar.getDuration(startDate, endDate)
[ "This", "method", "is", "used", "to", "calculate", "the", "duration", "of", "work", "between", "two", "fixed", "dates", "according", "to", "the", "work", "schedule", "defined", "in", "the", "named", "calendar", ".", "The", "calendar", "used", "is", "the", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L336-L339
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getDuration
@Deprecated public Duration getDuration(String calendarName, Date startDate, Date endDate) throws MPXJException { ProjectCalendar calendar = getCalendarByName(calendarName); if (calendar == null) { throw new MPXJException(MPXJException.CALENDAR_ERROR + ": " + calendarName); } return (calendar.getDuration(startDate, endDate)); }
java
@Deprecated public Duration getDuration(String calendarName, Date startDate, Date endDate) throws MPXJException { ProjectCalendar calendar = getCalendarByName(calendarName); if (calendar == null) { throw new MPXJException(MPXJException.CALENDAR_ERROR + ": " + calendarName); } return (calendar.getDuration(startDate, endDate)); }
[ "@", "Deprecated", "public", "Duration", "getDuration", "(", "String", "calendarName", ",", "Date", "startDate", ",", "Date", "endDate", ")", "throws", "MPXJException", "{", "ProjectCalendar", "calendar", "=", "getCalendarByName", "(", "calendarName", ")", ";", "i...
This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar. The name of the calendar to be used is passed as an argument. @param calendarName name of the calendar to use @param startDate start of the period @param endDate end of the period @return new Duration object @throws MPXJException normally when no Standard calendar is available @deprecated use calendar.getDuration(startDate, endDate)
[ "This", "method", "is", "used", "to", "calculate", "the", "duration", "of", "work", "between", "two", "fixed", "dates", "according", "to", "the", "work", "schedule", "defined", "in", "the", "named", "calendar", ".", "The", "name", "of", "the", "calendar", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L353-L363
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getStartDate
public Date getStartDate() { Date startDate = null; for (Task task : m_tasks) { // // If a hidden "summary" task is present we ignore it // if (NumberHelper.getInt(task.getUniqueID()) == 0) { continue; } // // Select the actual or forecast start date. Note that the // behaviour is different for milestones. The milestone end date // is always correct, the milestone start date may be different // to reflect a missed deadline. // Date taskStartDate; if (task.getMilestone() == true) { taskStartDate = task.getActualFinish(); if (taskStartDate == null) { taskStartDate = task.getFinish(); } } else { taskStartDate = task.getActualStart(); if (taskStartDate == null) { taskStartDate = task.getStart(); } } if (taskStartDate != null) { if (startDate == null) { startDate = taskStartDate; } else { if (taskStartDate.getTime() < startDate.getTime()) { startDate = taskStartDate; } } } } return (startDate); }
java
public Date getStartDate() { Date startDate = null; for (Task task : m_tasks) { // // If a hidden "summary" task is present we ignore it // if (NumberHelper.getInt(task.getUniqueID()) == 0) { continue; } // // Select the actual or forecast start date. Note that the // behaviour is different for milestones. The milestone end date // is always correct, the milestone start date may be different // to reflect a missed deadline. // Date taskStartDate; if (task.getMilestone() == true) { taskStartDate = task.getActualFinish(); if (taskStartDate == null) { taskStartDate = task.getFinish(); } } else { taskStartDate = task.getActualStart(); if (taskStartDate == null) { taskStartDate = task.getStart(); } } if (taskStartDate != null) { if (startDate == null) { startDate = taskStartDate; } else { if (taskStartDate.getTime() < startDate.getTime()) { startDate = taskStartDate; } } } } return (startDate); }
[ "public", "Date", "getStartDate", "(", ")", "{", "Date", "startDate", "=", "null", ";", "for", "(", "Task", "task", ":", "m_tasks", ")", "{", "//", "// If a hidden \"summary\" task is present we ignore it", "//", "if", "(", "NumberHelper", ".", "getInt", "(", ...
Find the earliest task start date. We treat this as the start date for the project. @return start date
[ "Find", "the", "earliest", "task", "start", "date", ".", "We", "treat", "this", "as", "the", "start", "date", "for", "the", "project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L430-L485
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getFinishDate
public Date getFinishDate() { Date finishDate = null; for (Task task : m_tasks) { // // If a hidden "summary" task is present we ignore it // if (NumberHelper.getInt(task.getUniqueID()) == 0) { continue; } // // Select the actual or forecast start date // Date taskFinishDate; taskFinishDate = task.getActualFinish(); if (taskFinishDate == null) { taskFinishDate = task.getFinish(); } if (taskFinishDate != null) { if (finishDate == null) { finishDate = taskFinishDate; } else { if (taskFinishDate.getTime() > finishDate.getTime()) { finishDate = taskFinishDate; } } } } return (finishDate); }
java
public Date getFinishDate() { Date finishDate = null; for (Task task : m_tasks) { // // If a hidden "summary" task is present we ignore it // if (NumberHelper.getInt(task.getUniqueID()) == 0) { continue; } // // Select the actual or forecast start date // Date taskFinishDate; taskFinishDate = task.getActualFinish(); if (taskFinishDate == null) { taskFinishDate = task.getFinish(); } if (taskFinishDate != null) { if (finishDate == null) { finishDate = taskFinishDate; } else { if (taskFinishDate.getTime() > finishDate.getTime()) { finishDate = taskFinishDate; } } } } return (finishDate); }
[ "public", "Date", "getFinishDate", "(", ")", "{", "Date", "finishDate", "=", "null", ";", "for", "(", "Task", "task", ":", "m_tasks", ")", "{", "//", "// If a hidden \"summary\" task is present we ignore it", "//", "if", "(", "NumberHelper", ".", "getInt", "(", ...
Find the latest task finish date. We treat this as the finish date for the project. @return finish date
[ "Find", "the", "latest", "task", "finish", "date", ".", "We", "treat", "this", "as", "the", "finish", "date", "for", "the", "project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L493-L534
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getDefaultCalendar
public ProjectCalendar getDefaultCalendar() { String calendarName = m_properties.getDefaultCalendarName(); ProjectCalendar calendar = getCalendarByName(calendarName); if (calendar == null) { if (m_calendars.isEmpty()) { calendar = addDefaultBaseCalendar(); } else { calendar = m_calendars.get(0); } } return calendar; }
java
public ProjectCalendar getDefaultCalendar() { String calendarName = m_properties.getDefaultCalendarName(); ProjectCalendar calendar = getCalendarByName(calendarName); if (calendar == null) { if (m_calendars.isEmpty()) { calendar = addDefaultBaseCalendar(); } else { calendar = m_calendars.get(0); } } return calendar; }
[ "public", "ProjectCalendar", "getDefaultCalendar", "(", ")", "{", "String", "calendarName", "=", "m_properties", ".", "getDefaultCalendarName", "(", ")", ";", "ProjectCalendar", "calendar", "=", "getCalendarByName", "(", "calendarName", ")", ";", "if", "(", "calenda...
Retrieves the default calendar for this project based on the calendar name given in the project properties. If a calendar of this name cannot be found, then the first calendar listed for the project will be returned. If the project contains no calendars, then a default calendar is added. @return default projectCalendar instance
[ "Retrieves", "the", "default", "calendar", "for", "this", "project", "based", "on", "the", "calendar", "name", "given", "in", "the", "project", "properties", ".", "If", "a", "calendar", "of", "this", "name", "cannot", "be", "found", "then", "the", "first", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L624-L640
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectFile.java
ProjectFile.getBaselineCalendar
public ProjectCalendar getBaselineCalendar() { // // Attempt to locate the calendar normally used by baselines // If this isn't present, fall back to using the default // project calendar. // ProjectCalendar result = getCalendarByName("Used for Microsoft Project 98 Baseline Calendar"); if (result == null) { result = getDefaultCalendar(); } return result; }
java
public ProjectCalendar getBaselineCalendar() { // // Attempt to locate the calendar normally used by baselines // If this isn't present, fall back to using the default // project calendar. // ProjectCalendar result = getCalendarByName("Used for Microsoft Project 98 Baseline Calendar"); if (result == null) { result = getDefaultCalendar(); } return result; }
[ "public", "ProjectCalendar", "getBaselineCalendar", "(", ")", "{", "//", "// Attempt to locate the calendar normally used by baselines", "// If this isn't present, fall back to using the default", "// project calendar.", "//", "ProjectCalendar", "result", "=", "getCalendarByName", "(",...
Retrieve the calendar used internally for timephased baseline calculation. @return baseline calendar
[ "Retrieve", "the", "calendar", "used", "internally", "for", "timephased", "baseline", "calculation", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectFile.java#L657-L670
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java
GraphicalIndicatorReader.process
public void process(CustomFieldContainer indicators, ProjectProperties properties, Props props) { m_container = indicators; m_properties = properties; m_data = props.getByteArray(Props.TASK_FIELD_ATTRIBUTES); if (m_data != null) { int columnsCount = MPPUtility.getInt(m_data, 4); m_headerOffset = 8; for (int loop = 0; loop < columnsCount; loop++) { processColumns(); } } }
java
public void process(CustomFieldContainer indicators, ProjectProperties properties, Props props) { m_container = indicators; m_properties = properties; m_data = props.getByteArray(Props.TASK_FIELD_ATTRIBUTES); if (m_data != null) { int columnsCount = MPPUtility.getInt(m_data, 4); m_headerOffset = 8; for (int loop = 0; loop < columnsCount; loop++) { processColumns(); } } }
[ "public", "void", "process", "(", "CustomFieldContainer", "indicators", ",", "ProjectProperties", "properties", ",", "Props", "props", ")", "{", "m_container", "=", "indicators", ";", "m_properties", "=", "properties", ";", "m_data", "=", "props", ".", "getByteArr...
The main entry point for processing graphical indicator definitions. @param indicators graphical indicators container @param properties project properties @param props properties data
[ "The", "main", "entry", "point", "for", "processing", "graphical", "indicator", "definitions", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java#L50-L65
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java
GraphicalIndicatorReader.processColumns
private void processColumns() { int fieldID = MPPUtility.getInt(m_data, m_headerOffset); m_headerOffset += 4; m_dataOffset = MPPUtility.getInt(m_data, m_headerOffset); m_headerOffset += 4; FieldType type = FieldTypeHelper.getInstance(fieldID); if (type.getDataType() != null) { processKnownType(type); } }
java
private void processColumns() { int fieldID = MPPUtility.getInt(m_data, m_headerOffset); m_headerOffset += 4; m_dataOffset = MPPUtility.getInt(m_data, m_headerOffset); m_headerOffset += 4; FieldType type = FieldTypeHelper.getInstance(fieldID); if (type.getDataType() != null) { processKnownType(type); } }
[ "private", "void", "processColumns", "(", ")", "{", "int", "fieldID", "=", "MPPUtility", ".", "getInt", "(", "m_data", ",", "m_headerOffset", ")", ";", "m_headerOffset", "+=", "4", ";", "m_dataOffset", "=", "MPPUtility", ".", "getInt", "(", "m_data", ",", ...
Processes graphical indicator definitions for each column.
[ "Processes", "graphical", "indicator", "definitions", "for", "each", "column", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java#L70-L83
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java
GraphicalIndicatorReader.processKnownType
private void processKnownType(FieldType type) { //System.out.println("Header: " + type); //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, 36, false, 16, "")); GraphicalIndicator indicator = m_container.getCustomField(type).getGraphicalIndicator(); indicator.setFieldType(type); int flags = m_data[m_dataOffset]; indicator.setProjectSummaryInheritsFromSummaryRows((flags & 0x08) != 0); indicator.setSummaryRowsInheritFromNonSummaryRows((flags & 0x04) != 0); indicator.setDisplayGraphicalIndicators((flags & 0x02) != 0); indicator.setShowDataValuesInToolTips((flags & 0x01) != 0); m_dataOffset += 20; int nonSummaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int summaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int projectSummaryOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int dataSize = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; //System.out.println("Data"); //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, dataSize, false, 16, "")); int maxNonSummaryRowOffset = m_dataOffset + summaryRowOffset; int maxSummaryRowOffset = m_dataOffset + projectSummaryOffset; int maxProjectSummaryOffset = m_dataOffset + dataSize; m_dataOffset += nonSummaryRowOffset; while (m_dataOffset + 2 < maxNonSummaryRowOffset) { indicator.addNonSummaryRowCriteria(processCriteria(type)); } while (m_dataOffset + 2 < maxSummaryRowOffset) { indicator.addSummaryRowCriteria(processCriteria(type)); } while (m_dataOffset + 2 < maxProjectSummaryOffset) { indicator.addProjectSummaryCriteria(processCriteria(type)); } }
java
private void processKnownType(FieldType type) { //System.out.println("Header: " + type); //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, 36, false, 16, "")); GraphicalIndicator indicator = m_container.getCustomField(type).getGraphicalIndicator(); indicator.setFieldType(type); int flags = m_data[m_dataOffset]; indicator.setProjectSummaryInheritsFromSummaryRows((flags & 0x08) != 0); indicator.setSummaryRowsInheritFromNonSummaryRows((flags & 0x04) != 0); indicator.setDisplayGraphicalIndicators((flags & 0x02) != 0); indicator.setShowDataValuesInToolTips((flags & 0x01) != 0); m_dataOffset += 20; int nonSummaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int summaryRowOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int projectSummaryOffset = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; int dataSize = MPPUtility.getInt(m_data, m_dataOffset) - 36; m_dataOffset += 4; //System.out.println("Data"); //System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, dataSize, false, 16, "")); int maxNonSummaryRowOffset = m_dataOffset + summaryRowOffset; int maxSummaryRowOffset = m_dataOffset + projectSummaryOffset; int maxProjectSummaryOffset = m_dataOffset + dataSize; m_dataOffset += nonSummaryRowOffset; while (m_dataOffset + 2 < maxNonSummaryRowOffset) { indicator.addNonSummaryRowCriteria(processCriteria(type)); } while (m_dataOffset + 2 < maxSummaryRowOffset) { indicator.addSummaryRowCriteria(processCriteria(type)); } while (m_dataOffset + 2 < maxProjectSummaryOffset) { indicator.addProjectSummaryCriteria(processCriteria(type)); } }
[ "private", "void", "processKnownType", "(", "FieldType", "type", ")", "{", "//System.out.println(\"Header: \" + type);", "//System.out.println(ByteArrayHelper.hexdump(m_data, m_dataOffset, 36, false, 16, \"\"));", "GraphicalIndicator", "indicator", "=", "m_container", ".", "getCustomFi...
Process a graphical indicator definition for a known type. @param type field type
[ "Process", "a", "graphical", "indicator", "definition", "for", "a", "known", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java#L90-L139
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java
GraphicalIndicatorReader.processCriteria
private GraphicalIndicatorCriteria processCriteria(FieldType type) { GraphicalIndicatorCriteria criteria = new GraphicalIndicatorCriteria(m_properties); criteria.setLeftValue(type); int indicatorType = MPPUtility.getInt(m_data, m_dataOffset); m_dataOffset += 4; criteria.setIndicator(indicatorType); if (m_dataOffset + 4 < m_data.length) { int operatorValue = MPPUtility.getInt(m_data, m_dataOffset); m_dataOffset += 4; TestOperator operator = (operatorValue == 0 ? TestOperator.IS_ANY_VALUE : TestOperator.getInstance(operatorValue - 0x3E7)); criteria.setOperator(operator); if (operator != TestOperator.IS_ANY_VALUE) { processOperandValue(0, type, criteria); if (operator == TestOperator.IS_WITHIN || operator == TestOperator.IS_NOT_WITHIN) { processOperandValue(1, type, criteria); } } } return (criteria); }
java
private GraphicalIndicatorCriteria processCriteria(FieldType type) { GraphicalIndicatorCriteria criteria = new GraphicalIndicatorCriteria(m_properties); criteria.setLeftValue(type); int indicatorType = MPPUtility.getInt(m_data, m_dataOffset); m_dataOffset += 4; criteria.setIndicator(indicatorType); if (m_dataOffset + 4 < m_data.length) { int operatorValue = MPPUtility.getInt(m_data, m_dataOffset); m_dataOffset += 4; TestOperator operator = (operatorValue == 0 ? TestOperator.IS_ANY_VALUE : TestOperator.getInstance(operatorValue - 0x3E7)); criteria.setOperator(operator); if (operator != TestOperator.IS_ANY_VALUE) { processOperandValue(0, type, criteria); if (operator == TestOperator.IS_WITHIN || operator == TestOperator.IS_NOT_WITHIN) { processOperandValue(1, type, criteria); } } } return (criteria); }
[ "private", "GraphicalIndicatorCriteria", "processCriteria", "(", "FieldType", "type", ")", "{", "GraphicalIndicatorCriteria", "criteria", "=", "new", "GraphicalIndicatorCriteria", "(", "m_properties", ")", ";", "criteria", ".", "setLeftValue", "(", "type", ")", ";", "...
Process the graphical indicator criteria for a single column. @param type field type @return indicator criteria data
[ "Process", "the", "graphical", "indicator", "criteria", "for", "a", "single", "column", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java#L147-L175
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java
GraphicalIndicatorReader.processOperandValue
private void processOperandValue(int index, FieldType type, GraphicalIndicatorCriteria criteria) { boolean valueFlag = (MPPUtility.getInt(m_data, m_dataOffset) == 1); m_dataOffset += 4; if (valueFlag == false) { int fieldID = MPPUtility.getInt(m_data, m_dataOffset); criteria.setRightValue(index, FieldTypeHelper.getInstance(fieldID)); m_dataOffset += 4; } else { //int dataTypeValue = MPPUtility.getShort(m_data, m_dataOffset); m_dataOffset += 2; switch (type.getDataType()) { case DURATION: // 0x03 { Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(m_data, m_dataOffset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(m_data, m_dataOffset + 4))); m_dataOffset += 6; criteria.setRightValue(index, value); break; } case NUMERIC: // 0x05 { Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset)); m_dataOffset += 8; criteria.setRightValue(index, value); break; } case CURRENCY: // 0x06 { Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset) / 100); m_dataOffset += 8; criteria.setRightValue(index, value); break; } case STRING: // 0x08 { String value = MPPUtility.getUnicodeString(m_data, m_dataOffset); m_dataOffset += ((value.length() + 1) * 2); criteria.setRightValue(index, value); break; } case BOOLEAN: // 0x0B { int value = MPPUtility.getShort(m_data, m_dataOffset); m_dataOffset += 2; criteria.setRightValue(index, value == 1 ? Boolean.TRUE : Boolean.FALSE); break; } case DATE: // 0x13 { Date value = MPPUtility.getTimestamp(m_data, m_dataOffset); m_dataOffset += 4; criteria.setRightValue(index, value); break; } default: { break; } } } }
java
private void processOperandValue(int index, FieldType type, GraphicalIndicatorCriteria criteria) { boolean valueFlag = (MPPUtility.getInt(m_data, m_dataOffset) == 1); m_dataOffset += 4; if (valueFlag == false) { int fieldID = MPPUtility.getInt(m_data, m_dataOffset); criteria.setRightValue(index, FieldTypeHelper.getInstance(fieldID)); m_dataOffset += 4; } else { //int dataTypeValue = MPPUtility.getShort(m_data, m_dataOffset); m_dataOffset += 2; switch (type.getDataType()) { case DURATION: // 0x03 { Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(m_data, m_dataOffset), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(m_data, m_dataOffset + 4))); m_dataOffset += 6; criteria.setRightValue(index, value); break; } case NUMERIC: // 0x05 { Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset)); m_dataOffset += 8; criteria.setRightValue(index, value); break; } case CURRENCY: // 0x06 { Double value = Double.valueOf(MPPUtility.getDouble(m_data, m_dataOffset) / 100); m_dataOffset += 8; criteria.setRightValue(index, value); break; } case STRING: // 0x08 { String value = MPPUtility.getUnicodeString(m_data, m_dataOffset); m_dataOffset += ((value.length() + 1) * 2); criteria.setRightValue(index, value); break; } case BOOLEAN: // 0x0B { int value = MPPUtility.getShort(m_data, m_dataOffset); m_dataOffset += 2; criteria.setRightValue(index, value == 1 ? Boolean.TRUE : Boolean.FALSE); break; } case DATE: // 0x13 { Date value = MPPUtility.getTimestamp(m_data, m_dataOffset); m_dataOffset += 4; criteria.setRightValue(index, value); break; } default: { break; } } } }
[ "private", "void", "processOperandValue", "(", "int", "index", ",", "FieldType", "type", ",", "GraphicalIndicatorCriteria", "criteria", ")", "{", "boolean", "valueFlag", "=", "(", "MPPUtility", ".", "getInt", "(", "m_data", ",", "m_dataOffset", ")", "==", "1", ...
Process an operand value used in the definition of the graphical indicator criteria. @param index position in operand list @param type field type @param criteria indicator criteria
[ "Process", "an", "operand", "value", "used", "in", "the", "definition", "of", "the", "graphical", "indicator", "criteria", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GraphicalIndicatorReader.java#L185-L257
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/GanttChartView12.java
GanttChartView12.getGridLines
private GridLines getGridLines(byte[] data, int offset) { Color normalLineColor = ColorType.getInstance(data[offset]).getColor(); LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]); int intervalNumber = data[offset + 4]; LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]); Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor(); return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor); }
java
private GridLines getGridLines(byte[] data, int offset) { Color normalLineColor = ColorType.getInstance(data[offset]).getColor(); LineStyle normalLineStyle = LineStyle.getInstance(data[offset + 3]); int intervalNumber = data[offset + 4]; LineStyle intervalLineStyle = LineStyle.getInstance(data[offset + 5]); Color intervalLineColor = ColorType.getInstance(data[offset + 6]).getColor(); return new GridLines(normalLineColor, normalLineStyle, intervalNumber, intervalLineStyle, intervalLineColor); }
[ "private", "GridLines", "getGridLines", "(", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Color", "normalLineColor", "=", "ColorType", ".", "getInstance", "(", "data", "[", "offset", "]", ")", ".", "getColor", "(", ")", ";", "LineStyle", "n...
Creates a new GridLines instance. @param data data block @param offset offset into data block @return new GridLines instance
[ "Creates", "a", "new", "GridLines", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView12.java#L229-L237
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getByteArray
public byte[] getByteArray(Integer offset) { byte[] result = null; if (offset != null) { result = m_map.get(offset); } return (result); }
java
public byte[] getByteArray(Integer offset) { byte[] result = null; if (offset != null) { result = m_map.get(offset); } return (result); }
[ "public", "byte", "[", "]", "getByteArray", "(", "Integer", "offset", ")", "{", "byte", "[", "]", "result", "=", "null", ";", "if", "(", "offset", "!=", "null", ")", "{", "result", "=", "m_map", ".", "get", "(", "offset", ")", ";", "}", "return", ...
This method retrieves a byte array containing the data at the given offset in the block. If no data is found at the given offset this method returns null. @param offset offset of required data @return byte array containing required data
[ "This", "method", "retrieves", "a", "byte", "array", "containing", "the", "data", "at", "the", "given", "offset", "in", "the", "block", ".", "If", "no", "data", "is", "found", "at", "the", "given", "offset", "this", "method", "returns", "null", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L119-L129
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getByteArray
public byte[] getByteArray(Integer id, Integer type) { return (getByteArray(m_meta.getOffset(id, type))); }
java
public byte[] getByteArray(Integer id, Integer type) { return (getByteArray(m_meta.getOffset(id, type))); }
[ "public", "byte", "[", "]", "getByteArray", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "return", "(", "getByteArray", "(", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ")", ")", ";", "}" ]
This method retrieves a byte array of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return byte array containing required data
[ "This", "method", "retrieves", "a", "byte", "array", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L139-L142
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getUnicodeString
public String getUnicodeString(Integer id, Integer type) { return (getUnicodeString(m_meta.getOffset(id, type))); }
java
public String getUnicodeString(Integer id, Integer type) { return (getUnicodeString(m_meta.getOffset(id, type))); }
[ "public", "String", "getUnicodeString", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "return", "(", "getUnicodeString", "(", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ")", ")", ";", "}" ]
This method retrieves a String of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return string containing required data
[ "This", "method", "retrieves", "a", "String", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L176-L179
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getString
public String getString(Integer offset) { String result = null; if (offset != null) { byte[] value = m_map.get(offset); if (value != null) { result = MPPUtility.getString(value, 0); } } return (result); }
java
public String getString(Integer offset) { String result = null; if (offset != null) { byte[] value = m_map.get(offset); if (value != null) { result = MPPUtility.getString(value, 0); } } return (result); }
[ "public", "String", "getString", "(", "Integer", "offset", ")", "{", "String", "result", "=", "null", ";", "if", "(", "offset", "!=", "null", ")", "{", "byte", "[", "]", "value", "=", "m_map", ".", "get", "(", "offset", ")", ";", "if", "(", "value"...
This method retrieves the data at the given offset and returns it as a String, assuming the underlying data is composed of single byte characters. @param offset offset of required data @return string containing required data
[ "This", "method", "retrieves", "the", "data", "at", "the", "given", "offset", "and", "returns", "it", "as", "a", "String", "assuming", "the", "underlying", "data", "is", "composed", "of", "single", "byte", "characters", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L215-L229
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getString
public String getString(Integer id, Integer type) { return (getString(m_meta.getOffset(id, type))); }
java
public String getString(Integer id, Integer type) { return (getString(m_meta.getOffset(id, type))); }
[ "public", "String", "getString", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "return", "(", "getString", "(", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ")", ")", ";", "}" ]
This method retrieves a string of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return required string data
[ "This", "method", "retrieves", "a", "string", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L239-L242
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getShort
public int getShort(Integer id, Integer type) { int result = 0; Integer offset = m_meta.getOffset(id, type); if (offset != null) { byte[] value = m_map.get(offset); if (value != null && value.length >= 2) { result = MPPUtility.getShort(value, 0); } } return (result); }
java
public int getShort(Integer id, Integer type) { int result = 0; Integer offset = m_meta.getOffset(id, type); if (offset != null) { byte[] value = m_map.get(offset); if (value != null && value.length >= 2) { result = MPPUtility.getShort(value, 0); } } return (result); }
[ "public", "int", "getShort", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "int", "result", "=", "0", ";", "Integer", "offset", "=", "m_meta", ".", "getOffset", "(", "id", ",", "type", ")", ";", "if", "(", "offset", "!=", "null", ")", "{"...
This method retrieves an integer of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return required integer data
[ "This", "method", "retrieves", "an", "integer", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L252-L269
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Var2Data.java
Var2Data.getDouble
public double getDouble(Integer id, Integer type) { double result = Double.longBitsToDouble(getLong(id, type)); if (Double.isNaN(result)) { result = 0; } return result; }
java
public double getDouble(Integer id, Integer type) { double result = Double.longBitsToDouble(getLong(id, type)); if (Double.isNaN(result)) { result = 0; } return result; }
[ "public", "double", "getDouble", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "double", "result", "=", "Double", ".", "longBitsToDouble", "(", "getLong", "(", "id", ",", "type", ")", ")", ";", "if", "(", "Double", ".", "isNaN", "(", "result"...
This method retrieves a double of the specified type, belonging to the item with the specified unique ID. @param id unique ID of entity to which this data belongs @param type data type identifier @return required double data
[ "This", "method", "retrieves", "a", "double", "of", "the", "specified", "type", "belonging", "to", "the", "item", "with", "the", "specified", "unique", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Var2Data.java#L390-L398
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarDateRanges.java
ProjectCalendarDateRanges.getRange
public DateRange getRange(int index) { DateRange result; if (index >= 0 && index < m_ranges.size()) { result = m_ranges.get(index); } else { result = DateRange.EMPTY_RANGE; } return (result); }
java
public DateRange getRange(int index) { DateRange result; if (index >= 0 && index < m_ranges.size()) { result = m_ranges.get(index); } else { result = DateRange.EMPTY_RANGE; } return (result); }
[ "public", "DateRange", "getRange", "(", "int", "index", ")", "{", "DateRange", "result", ";", "if", "(", "index", ">=", "0", "&&", "index", "<", "m_ranges", ".", "size", "(", ")", ")", "{", "result", "=", "m_ranges", ".", "get", "(", "index", ")", ...
Retrieve the date range at the specified index. The index is zero based, and this method will return null if the requested date range does not exist. @param index range index @return date range instance
[ "Retrieve", "the", "date", "range", "at", "the", "specified", "index", ".", "The", "index", "is", "zero", "based", "and", "this", "method", "will", "return", "null", "if", "the", "requested", "date", "range", "does", "not", "exist", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarDateRanges.java#L53-L67
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.process
public GenericCriteria process(ProjectProperties properties, byte[] data, int dataOffset, int entryOffset, List<GenericCriteriaPrompt> prompts, List<FieldType> fields, boolean[] criteriaType) { m_properties = properties; m_prompts = prompts; m_fields = fields; m_criteriaType = criteriaType; m_dataOffset = dataOffset; if (m_criteriaType != null) { m_criteriaType[0] = true; m_criteriaType[1] = true; } m_criteriaBlockMap.clear(); m_criteriaData = data; m_criteriaTextStart = MPPUtility.getShort(m_criteriaData, m_dataOffset + getCriteriaTextStartOffset()); // // Populate the map // int criteriaStartOffset = getCriteriaStartOffset(); int criteriaBlockSize = getCriteriaBlockSize(); //System.out.println(); //System.out.println(ByteArrayHelper.hexdump(data, dataOffset, criteriaStartOffset, false)); if (m_criteriaData.length <= m_criteriaTextStart) { return null; // bad data } while (criteriaStartOffset + criteriaBlockSize <= m_criteriaTextStart) { byte[] block = new byte[criteriaBlockSize]; System.arraycopy(m_criteriaData, m_dataOffset + criteriaStartOffset, block, 0, criteriaBlockSize); m_criteriaBlockMap.put(Integer.valueOf(criteriaStartOffset), block); //System.out.println(Integer.toHexString(criteriaStartOffset) + ": " + ByteArrayHelper.hexdump(block, false)); criteriaStartOffset += criteriaBlockSize; } if (entryOffset == -1) { entryOffset = getCriteriaStartOffset(); } List<GenericCriteria> list = new LinkedList<GenericCriteria>(); processBlock(list, m_criteriaBlockMap.get(Integer.valueOf(entryOffset))); GenericCriteria criteria; if (list.isEmpty()) { criteria = null; } else { criteria = list.get(0); } return criteria; }
java
public GenericCriteria process(ProjectProperties properties, byte[] data, int dataOffset, int entryOffset, List<GenericCriteriaPrompt> prompts, List<FieldType> fields, boolean[] criteriaType) { m_properties = properties; m_prompts = prompts; m_fields = fields; m_criteriaType = criteriaType; m_dataOffset = dataOffset; if (m_criteriaType != null) { m_criteriaType[0] = true; m_criteriaType[1] = true; } m_criteriaBlockMap.clear(); m_criteriaData = data; m_criteriaTextStart = MPPUtility.getShort(m_criteriaData, m_dataOffset + getCriteriaTextStartOffset()); // // Populate the map // int criteriaStartOffset = getCriteriaStartOffset(); int criteriaBlockSize = getCriteriaBlockSize(); //System.out.println(); //System.out.println(ByteArrayHelper.hexdump(data, dataOffset, criteriaStartOffset, false)); if (m_criteriaData.length <= m_criteriaTextStart) { return null; // bad data } while (criteriaStartOffset + criteriaBlockSize <= m_criteriaTextStart) { byte[] block = new byte[criteriaBlockSize]; System.arraycopy(m_criteriaData, m_dataOffset + criteriaStartOffset, block, 0, criteriaBlockSize); m_criteriaBlockMap.put(Integer.valueOf(criteriaStartOffset), block); //System.out.println(Integer.toHexString(criteriaStartOffset) + ": " + ByteArrayHelper.hexdump(block, false)); criteriaStartOffset += criteriaBlockSize; } if (entryOffset == -1) { entryOffset = getCriteriaStartOffset(); } List<GenericCriteria> list = new LinkedList<GenericCriteria>(); processBlock(list, m_criteriaBlockMap.get(Integer.valueOf(entryOffset))); GenericCriteria criteria; if (list.isEmpty()) { criteria = null; } else { criteria = list.get(0); } return criteria; }
[ "public", "GenericCriteria", "process", "(", "ProjectProperties", "properties", ",", "byte", "[", "]", "data", ",", "int", "dataOffset", ",", "int", "entryOffset", ",", "List", "<", "GenericCriteriaPrompt", ">", "prompts", ",", "List", "<", "FieldType", ">", "...
Main entry point to read criteria data. @param properties project properties @param data criteria data block @param dataOffset offset of the data start within the larger data block @param entryOffset offset of start node for walking the tree @param prompts optional list to hold prompts @param fields optional list of hold fields @param criteriaType optional array representing criteria types @return first node of the criteria
[ "Main", "entry", "point", "to", "read", "criteria", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L131-L189
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.processBlock
private void processBlock(List<GenericCriteria> list, byte[] block) { if (block != null) { if (MPPUtility.getShort(block, 0) > 0x3E6) { addCriteria(list, block); } else { switch (block[0]) { case (byte) 0x0B: { processBlock(list, getChildBlock(block)); break; } case (byte) 0x06: { processBlock(list, getListNextBlock(block)); break; } case (byte) 0xED: // EQUALS { addCriteria(list, block); break; } case (byte) 0x19: // AND case (byte) 0x1B: { addBlock(list, block, TestOperator.AND); break; } case (byte) 0x1A: // OR case (byte) 0x1C: { addBlock(list, block, TestOperator.OR); break; } } } } }
java
private void processBlock(List<GenericCriteria> list, byte[] block) { if (block != null) { if (MPPUtility.getShort(block, 0) > 0x3E6) { addCriteria(list, block); } else { switch (block[0]) { case (byte) 0x0B: { processBlock(list, getChildBlock(block)); break; } case (byte) 0x06: { processBlock(list, getListNextBlock(block)); break; } case (byte) 0xED: // EQUALS { addCriteria(list, block); break; } case (byte) 0x19: // AND case (byte) 0x1B: { addBlock(list, block, TestOperator.AND); break; } case (byte) 0x1A: // OR case (byte) 0x1C: { addBlock(list, block, TestOperator.OR); break; } } } } }
[ "private", "void", "processBlock", "(", "List", "<", "GenericCriteria", ">", "list", ",", "byte", "[", "]", "block", ")", "{", "if", "(", "block", "!=", "null", ")", "{", "if", "(", "MPPUtility", ".", "getShort", "(", "block", ",", "0", ")", ">", "...
Process a single criteria block. @param list parent criteria list @param block current block
[ "Process", "a", "single", "criteria", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L197-L243
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.addCriteria
private void addCriteria(List<GenericCriteria> list, byte[] block) { byte[] leftBlock = getChildBlock(block); byte[] rightBlock1 = getListNextBlock(leftBlock); byte[] rightBlock2 = getListNextBlock(rightBlock1); TestOperator operator = TestOperator.getInstance(MPPUtility.getShort(block, 0) - 0x3E7); FieldType leftValue = getFieldType(leftBlock); Object rightValue1 = getValue(leftValue, rightBlock1); Object rightValue2 = rightBlock2 == null ? null : getValue(leftValue, rightBlock2); GenericCriteria criteria = new GenericCriteria(m_properties); criteria.setLeftValue(leftValue); criteria.setOperator(operator); criteria.setRightValue(0, rightValue1); criteria.setRightValue(1, rightValue2); list.add(criteria); if (m_criteriaType != null) { m_criteriaType[0] = leftValue.getFieldTypeClass() == FieldTypeClass.TASK; m_criteriaType[1] = !m_criteriaType[0]; } if (m_fields != null) { m_fields.add(leftValue); } processBlock(list, getListNextBlock(block)); }
java
private void addCriteria(List<GenericCriteria> list, byte[] block) { byte[] leftBlock = getChildBlock(block); byte[] rightBlock1 = getListNextBlock(leftBlock); byte[] rightBlock2 = getListNextBlock(rightBlock1); TestOperator operator = TestOperator.getInstance(MPPUtility.getShort(block, 0) - 0x3E7); FieldType leftValue = getFieldType(leftBlock); Object rightValue1 = getValue(leftValue, rightBlock1); Object rightValue2 = rightBlock2 == null ? null : getValue(leftValue, rightBlock2); GenericCriteria criteria = new GenericCriteria(m_properties); criteria.setLeftValue(leftValue); criteria.setOperator(operator); criteria.setRightValue(0, rightValue1); criteria.setRightValue(1, rightValue2); list.add(criteria); if (m_criteriaType != null) { m_criteriaType[0] = leftValue.getFieldTypeClass() == FieldTypeClass.TASK; m_criteriaType[1] = !m_criteriaType[0]; } if (m_fields != null) { m_fields.add(leftValue); } processBlock(list, getListNextBlock(block)); }
[ "private", "void", "addCriteria", "(", "List", "<", "GenericCriteria", ">", "list", ",", "byte", "[", "]", "block", ")", "{", "byte", "[", "]", "leftBlock", "=", "getChildBlock", "(", "block", ")", ";", "byte", "[", "]", "rightBlock1", "=", "getListNextB...
Adds a basic LHS OPERATOR RHS block. @param list parent criteria list @param block current block
[ "Adds", "a", "basic", "LHS", "OPERATOR", "RHS", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L251-L280
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.addBlock
private void addBlock(List<GenericCriteria> list, byte[] block, TestOperator operator) { GenericCriteria result = new GenericCriteria(m_properties); result.setOperator(operator); list.add(result); processBlock(result.getCriteriaList(), getChildBlock(block)); processBlock(list, getListNextBlock(block)); }
java
private void addBlock(List<GenericCriteria> list, byte[] block, TestOperator operator) { GenericCriteria result = new GenericCriteria(m_properties); result.setOperator(operator); list.add(result); processBlock(result.getCriteriaList(), getChildBlock(block)); processBlock(list, getListNextBlock(block)); }
[ "private", "void", "addBlock", "(", "List", "<", "GenericCriteria", ">", "list", ",", "byte", "[", "]", "block", ",", "TestOperator", "operator", ")", "{", "GenericCriteria", "result", "=", "new", "GenericCriteria", "(", "m_properties", ")", ";", "result", "...
Adds a logical operator block. @param list parent criteria list @param block current block @param operator logical operator represented by this block
[ "Adds", "a", "logical", "operator", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L289-L296
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.getValue
private Object getValue(FieldType field, byte[] block) { Object result = null; switch (block[0]) { case 0x07: // Field { result = getFieldType(block); break; } case 0x01: // Constant value { result = getConstantValue(field, block); break; } case 0x00: // Prompt { result = getPromptValue(field, block); break; } } return result; }
java
private Object getValue(FieldType field, byte[] block) { Object result = null; switch (block[0]) { case 0x07: // Field { result = getFieldType(block); break; } case 0x01: // Constant value { result = getConstantValue(field, block); break; } case 0x00: // Prompt { result = getPromptValue(field, block); break; } } return result; }
[ "private", "Object", "getValue", "(", "FieldType", "field", ",", "byte", "[", "]", "block", ")", "{", "Object", "result", "=", "null", ";", "switch", "(", "block", "[", "0", "]", ")", "{", "case", "0x07", ":", "// Field", "{", "result", "=", "getFiel...
Retrieves the value component of a criteria expression. @param field field type @param block block data @return field value
[ "Retrieves", "the", "value", "component", "of", "a", "criteria", "expression", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L305-L331
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.getConstantValue
private Object getConstantValue(FieldType type, byte[] block) { Object value; DataType dataType = type.getDataType(); if (dataType == null) { value = null; } else { switch (dataType) { case DURATION: { value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset()))); break; } case NUMERIC: { value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset())); break; } case PERCENTAGE: { value = Double.valueOf(MPPUtility.getShort(block, getValueOffset())); break; } case CURRENCY: { value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100); break; } case STRING: { int textOffset = getTextOffset(block); value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset); break; } case BOOLEAN: { int intValue = MPPUtility.getShort(block, getValueOffset()); value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE); break; } case DATE: { value = MPPUtility.getTimestamp(block, getValueOffset()); break; } default: { value = null; break; } } } return value; }
java
private Object getConstantValue(FieldType type, byte[] block) { Object value; DataType dataType = type.getDataType(); if (dataType == null) { value = null; } else { switch (dataType) { case DURATION: { value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(block, getValueOffset()), MPPUtility.getDurationTimeUnits(MPPUtility.getShort(block, getTimeUnitsOffset()))); break; } case NUMERIC: { value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset())); break; } case PERCENTAGE: { value = Double.valueOf(MPPUtility.getShort(block, getValueOffset())); break; } case CURRENCY: { value = Double.valueOf(MPPUtility.getDouble(block, getValueOffset()) / 100); break; } case STRING: { int textOffset = getTextOffset(block); value = MPPUtility.getUnicodeString(m_criteriaData, m_dataOffset + m_criteriaTextStart + textOffset); break; } case BOOLEAN: { int intValue = MPPUtility.getShort(block, getValueOffset()); value = (intValue == 1 ? Boolean.TRUE : Boolean.FALSE); break; } case DATE: { value = MPPUtility.getTimestamp(block, getValueOffset()); break; } default: { value = null; break; } } } return value; }
[ "private", "Object", "getConstantValue", "(", "FieldType", "type", ",", "byte", "[", "]", "block", ")", "{", "Object", "value", ";", "DataType", "dataType", "=", "type", ".", "getDataType", "(", ")", ";", "if", "(", "dataType", "==", "null", ")", "{", ...
Retrieves a constant value. @param type field type @param block criteria data block @return constant value
[ "Retrieves", "a", "constant", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L340-L406
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CriteriaReader.java
CriteriaReader.getPromptValue
private GenericCriteriaPrompt getPromptValue(FieldType field, byte[] block) { int textOffset = getPromptOffset(block); String value = MPPUtility.getUnicodeString(m_criteriaData, m_criteriaTextStart + textOffset); GenericCriteriaPrompt prompt = new GenericCriteriaPrompt(field.getDataType(), value); if (m_prompts != null) { m_prompts.add(prompt); } return prompt; }
java
private GenericCriteriaPrompt getPromptValue(FieldType field, byte[] block) { int textOffset = getPromptOffset(block); String value = MPPUtility.getUnicodeString(m_criteriaData, m_criteriaTextStart + textOffset); GenericCriteriaPrompt prompt = new GenericCriteriaPrompt(field.getDataType(), value); if (m_prompts != null) { m_prompts.add(prompt); } return prompt; }
[ "private", "GenericCriteriaPrompt", "getPromptValue", "(", "FieldType", "field", ",", "byte", "[", "]", "block", ")", "{", "int", "textOffset", "=", "getPromptOffset", "(", "block", ")", ";", "String", "value", "=", "MPPUtility", ".", "getUnicodeString", "(", ...
Retrieves a prompt value. @param field field type @param block criteria data block @return prompt value
[ "Retrieves", "a", "prompt", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CriteriaReader.java#L415-L425
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/PredecessorReader.java
PredecessorReader.getRelationType
private RelationType getRelationType(int type) { RelationType result; if (type > 0 && type < RELATION_TYPES.length) { result = RELATION_TYPES[type]; } else { result = RelationType.FINISH_START; } return result; }
java
private RelationType getRelationType(int type) { RelationType result; if (type > 0 && type < RELATION_TYPES.length) { result = RELATION_TYPES[type]; } else { result = RelationType.FINISH_START; } return result; }
[ "private", "RelationType", "getRelationType", "(", "int", "type", ")", "{", "RelationType", "result", ";", "if", "(", "type", ">", "0", "&&", "type", "<", "RELATION_TYPES", ".", "length", ")", "{", "result", "=", "RELATION_TYPES", "[", "type", "]", ";", ...
Convert an integer to a RelationType instance. @param type integer value @return RelationType instance
[ "Convert", "an", "integer", "to", "a", "RelationType", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/PredecessorReader.java#L77-L89
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/FixFix.java
FixFix.getByteArrayValue
public byte[] getByteArrayValue(int index) { byte[] result = null; if (m_array[index] != null) { result = (byte[]) m_array[index]; } return (result); }
java
public byte[] getByteArrayValue(int index) { byte[] result = null; if (m_array[index] != null) { result = (byte[]) m_array[index]; } return (result); }
[ "public", "byte", "[", "]", "getByteArrayValue", "(", "int", "index", ")", "{", "byte", "[", "]", "result", "=", "null", ";", "if", "(", "m_array", "[", "index", "]", "!=", "null", ")", "{", "result", "=", "(", "byte", "[", "]", ")", "m_array", "...
This method retrieves a byte array containing the data at the given index in the block. If no data is found at the given index this method returns null. @param index index of the data item to be retrieved @return byte array containing the requested data
[ "This", "method", "retrieves", "a", "byte", "array", "containing", "the", "data", "at", "the", "given", "index", "in", "the", "block", ".", "If", "no", "data", "is", "found", "at", "the", "given", "index", "this", "method", "returns", "null", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FixFix.java#L97-L107
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Props.java
Props.getByte
public byte getByte(Integer type) { byte result = 0; byte[] item = m_map.get(type); if (item != null) { result = item[0]; } return (result); }
java
public byte getByte(Integer type) { byte result = 0; byte[] item = m_map.get(type); if (item != null) { result = item[0]; } return (result); }
[ "public", "byte", "getByte", "(", "Integer", "type", ")", "{", "byte", "result", "=", "0", ";", "byte", "[", "]", "item", "=", "m_map", ".", "get", "(", "type", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "result", "=", "item", "[", "0...
Retrieves a byte value from the property data. @param type Type identifier @return byte value
[ "Retrieves", "a", "byte", "value", "from", "the", "property", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Props.java#L61-L72
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Props.java
Props.getTime
public Date getTime(Integer type) { Date result = null; byte[] item = m_map.get(type); if (item != null) { result = MPPUtility.getTime(item, 0); } return (result); }
java
public Date getTime(Integer type) { Date result = null; byte[] item = m_map.get(type); if (item != null) { result = MPPUtility.getTime(item, 0); } return (result); }
[ "public", "Date", "getTime", "(", "Integer", "type", ")", "{", "Date", "result", "=", "null", ";", "byte", "[", "]", "item", "=", "m_map", ".", "get", "(", "type", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "result", "=", "MPPUtility", ...
Retrieves a timestamp from the property data. @param type Type identifier @return timestamp
[ "Retrieves", "a", "timestamp", "from", "the", "property", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Props.java#L137-L148
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/Props.java
Props.getUnicodeString
public String getUnicodeString(Integer type) { String result = null; byte[] item = m_map.get(type); if (item != null) { result = MPPUtility.getUnicodeString(item, 0); } return (result); }
java
public String getUnicodeString(Integer type) { String result = null; byte[] item = m_map.get(type); if (item != null) { result = MPPUtility.getUnicodeString(item, 0); } return (result); }
[ "public", "String", "getUnicodeString", "(", "Integer", "type", ")", "{", "String", "result", "=", "null", ";", "byte", "[", "]", "item", "=", "m_map", ".", "get", "(", "type", ")", ";", "if", "(", "item", "!=", "null", ")", "{", "result", "=", "MP...
Retrieves a string value from the property data. @param type Type identifier @return string value
[ "Retrieves", "a", "string", "value", "from", "the", "property", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/Props.java#L194-L205
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeStartObject
public void writeStartObject(String name) throws IOException { writeComma(); writeNewLineIndent(); if (name != null) { writeName(name); writeNewLineIndent(); } m_writer.write("{"); increaseIndent(); }
java
public void writeStartObject(String name) throws IOException { writeComma(); writeNewLineIndent(); if (name != null) { writeName(name); writeNewLineIndent(); } m_writer.write("{"); increaseIndent(); }
[ "public", "void", "writeStartObject", "(", "String", "name", ")", "throws", "IOException", "{", "writeComma", "(", ")", ";", "writeNewLineIndent", "(", ")", ";", "if", "(", "name", "!=", "null", ")", "{", "writeName", "(", "name", ")", ";", "writeNewLineIn...
Begin writing a named object attribute. @param name attribute name
[ "Begin", "writing", "a", "named", "object", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L86-L99
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeStartList
public void writeStartList(String name) throws IOException { writeComma(); writeNewLineIndent(); writeName(name); writeNewLineIndent(); m_writer.write("["); increaseIndent(); }
java
public void writeStartList(String name) throws IOException { writeComma(); writeNewLineIndent(); writeName(name); writeNewLineIndent(); m_writer.write("["); increaseIndent(); }
[ "public", "void", "writeStartList", "(", "String", "name", ")", "throws", "IOException", "{", "writeComma", "(", ")", ";", "writeNewLineIndent", "(", ")", ";", "writeName", "(", "name", ")", ";", "writeNewLineIndent", "(", ")", ";", "m_writer", ".", "write",...
Begin writing a named list attribute. @param name attribute name
[ "Begin", "writing", "a", "named", "list", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L106-L114
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeNameValuePair
public void writeNameValuePair(String name, String value) throws IOException { internalWriteNameValuePair(name, escapeString(value)); }
java
public void writeNameValuePair(String name, String value) throws IOException { internalWriteNameValuePair(name, escapeString(value)); }
[ "public", "void", "writeNameValuePair", "(", "String", "name", ",", "String", "value", ")", "throws", "IOException", "{", "internalWriteNameValuePair", "(", "name", ",", "escapeString", "(", "value", ")", ")", ";", "}" ]
Write a string attribute. @param name attribute name @param value attribute value
[ "Write", "a", "string", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L140-L143
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeNameValuePair
public void writeNameValuePair(String name, int value) throws IOException { internalWriteNameValuePair(name, Integer.toString(value)); }
java
public void writeNameValuePair(String name, int value) throws IOException { internalWriteNameValuePair(name, Integer.toString(value)); }
[ "public", "void", "writeNameValuePair", "(", "String", "name", ",", "int", "value", ")", "throws", "IOException", "{", "internalWriteNameValuePair", "(", "name", ",", "Integer", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Write an int attribute. @param name attribute name @param value attribute value
[ "Write", "an", "int", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L151-L154
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeNameValuePair
public void writeNameValuePair(String name, long value) throws IOException { internalWriteNameValuePair(name, Long.toString(value)); }
java
public void writeNameValuePair(String name, long value) throws IOException { internalWriteNameValuePair(name, Long.toString(value)); }
[ "public", "void", "writeNameValuePair", "(", "String", "name", ",", "long", "value", ")", "throws", "IOException", "{", "internalWriteNameValuePair", "(", "name", ",", "Long", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Write a long attribute. @param name attribute name @param value attribute value
[ "Write", "a", "long", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L162-L165
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeNameValuePair
public void writeNameValuePair(String name, double value) throws IOException { internalWriteNameValuePair(name, Double.toString(value)); }
java
public void writeNameValuePair(String name, double value) throws IOException { internalWriteNameValuePair(name, Double.toString(value)); }
[ "public", "void", "writeNameValuePair", "(", "String", "name", ",", "double", "value", ")", "throws", "IOException", "{", "internalWriteNameValuePair", "(", "name", ",", "Double", ".", "toString", "(", "value", ")", ")", ";", "}" ]
Write a double attribute. @param name attribute name @param value attribute value
[ "Write", "a", "double", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L173-L176
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeNameValuePair
public void writeNameValuePair(String name, Date value) throws IOException { internalWriteNameValuePair(name, m_format.format(value)); }
java
public void writeNameValuePair(String name, Date value) throws IOException { internalWriteNameValuePair(name, m_format.format(value)); }
[ "public", "void", "writeNameValuePair", "(", "String", "name", ",", "Date", "value", ")", "throws", "IOException", "{", "internalWriteNameValuePair", "(", "name", ",", "m_format", ".", "format", "(", "value", ")", ")", ";", "}" ]
Write a Date attribute. @param name attribute name @param value attribute value
[ "Write", "a", "Date", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L195-L198
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.internalWriteNameValuePair
private void internalWriteNameValuePair(String name, String value) throws IOException { writeComma(); writeNewLineIndent(); writeName(name); if (m_pretty) { m_writer.write(' '); } m_writer.write(value); }
java
private void internalWriteNameValuePair(String name, String value) throws IOException { writeComma(); writeNewLineIndent(); writeName(name); if (m_pretty) { m_writer.write(' '); } m_writer.write(value); }
[ "private", "void", "internalWriteNameValuePair", "(", "String", "name", ",", "String", "value", ")", "throws", "IOException", "{", "writeComma", "(", ")", ";", "writeNewLineIndent", "(", ")", ";", "writeName", "(", "name", ")", ";", "if", "(", "m_pretty", ")...
Core write attribute implementation. @param name attribute name @param value attribute value
[ "Core", "write", "attribute", "implementation", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L206-L218
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.escapeString
private String escapeString(String value) { m_buffer.setLength(0); m_buffer.append('"'); for (int index = 0; index < value.length(); index++) { char c = value.charAt(index); switch (c) { case '"': { m_buffer.append("\\\""); break; } case '\\': { m_buffer.append("\\\\"); break; } case '/': { m_buffer.append("\\/"); break; } case '\b': { m_buffer.append("\\b"); break; } case '\f': { m_buffer.append("\\f"); break; } case '\n': { m_buffer.append("\\n"); break; } case '\r': { m_buffer.append("\\r"); break; } case '\t': { m_buffer.append("\\t"); break; } default: { // Append if it's not a control character (0x00 to 0x1f) if (c > 0x1f) { m_buffer.append(c); } break; } } } m_buffer.append('"'); return m_buffer.toString(); }
java
private String escapeString(String value) { m_buffer.setLength(0); m_buffer.append('"'); for (int index = 0; index < value.length(); index++) { char c = value.charAt(index); switch (c) { case '"': { m_buffer.append("\\\""); break; } case '\\': { m_buffer.append("\\\\"); break; } case '/': { m_buffer.append("\\/"); break; } case '\b': { m_buffer.append("\\b"); break; } case '\f': { m_buffer.append("\\f"); break; } case '\n': { m_buffer.append("\\n"); break; } case '\r': { m_buffer.append("\\r"); break; } case '\t': { m_buffer.append("\\t"); break; } default: { // Append if it's not a control character (0x00 to 0x1f) if (c > 0x1f) { m_buffer.append(c); } break; } } } m_buffer.append('"'); return m_buffer.toString(); }
[ "private", "String", "escapeString", "(", "String", "value", ")", "{", "m_buffer", ".", "setLength", "(", "0", ")", ";", "m_buffer", ".", "append", "(", "'", "'", ")", ";", "for", "(", "int", "index", "=", "0", ";", "index", "<", "value", ".", "len...
Escape text to ensure valid JSON. @param value value @return escaped value
[ "Escape", "text", "to", "ensure", "valid", "JSON", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L226-L296
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeComma
private void writeComma() throws IOException { if (m_firstNameValuePair.peek().booleanValue()) { m_firstNameValuePair.pop(); m_firstNameValuePair.push(Boolean.FALSE); } else { m_writer.write(','); } }
java
private void writeComma() throws IOException { if (m_firstNameValuePair.peek().booleanValue()) { m_firstNameValuePair.pop(); m_firstNameValuePair.push(Boolean.FALSE); } else { m_writer.write(','); } }
[ "private", "void", "writeComma", "(", ")", "throws", "IOException", "{", "if", "(", "m_firstNameValuePair", ".", "peek", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "m_firstNameValuePair", ".", "pop", "(", ")", ";", "m_firstNameValuePair", ".", "push"...
Write a comma to the output stream if required.
[ "Write", "a", "comma", "to", "the", "output", "stream", "if", "required", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L301-L312
train