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/json/JsonStreamWriter.java
JsonStreamWriter.writeNewLineIndent
private void writeNewLineIndent() throws IOException { if (m_pretty) { if (!m_indent.isEmpty()) { m_writer.write('\n'); m_writer.write(m_indent); } } }
java
private void writeNewLineIndent() throws IOException { if (m_pretty) { if (!m_indent.isEmpty()) { m_writer.write('\n'); m_writer.write(m_indent); } } }
[ "private", "void", "writeNewLineIndent", "(", ")", "throws", "IOException", "{", "if", "(", "m_pretty", ")", "{", "if", "(", "!", "m_indent", ".", "isEmpty", "(", ")", ")", "{", "m_writer", ".", "write", "(", "'", "'", ")", ";", "m_writer", ".", "wri...
Write a new line and indent.
[ "Write", "a", "new", "line", "and", "indent", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L317-L327
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.writeName
private void writeName(String name) throws IOException { m_writer.write('"'); m_writer.write(name); m_writer.write('"'); m_writer.write(":"); }
java
private void writeName(String name) throws IOException { m_writer.write('"'); m_writer.write(name); m_writer.write('"'); m_writer.write(":"); }
[ "private", "void", "writeName", "(", "String", "name", ")", "throws", "IOException", "{", "m_writer", ".", "write", "(", "'", "'", ")", ";", "m_writer", ".", "write", "(", "name", ")", ";", "m_writer", ".", "write", "(", "'", "'", ")", ";", "m_writer...
Write an attribute name. @param name attribute name
[ "Write", "an", "attribute", "name", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L334-L340
train
joniles/mpxj
src/main/java/net/sf/mpxj/json/JsonStreamWriter.java
JsonStreamWriter.decreaseIndent
private void decreaseIndent() throws IOException { if (m_pretty) { m_writer.write('\n'); m_indent = m_indent.substring(0, m_indent.length() - INDENT.length()); m_writer.write(m_indent); } m_firstNameValuePair.pop(); }
java
private void decreaseIndent() throws IOException { if (m_pretty) { m_writer.write('\n'); m_indent = m_indent.substring(0, m_indent.length() - INDENT.length()); m_writer.write(m_indent); } m_firstNameValuePair.pop(); }
[ "private", "void", "decreaseIndent", "(", ")", "throws", "IOException", "{", "if", "(", "m_pretty", ")", "{", "m_writer", ".", "write", "(", "'", "'", ")", ";", "m_indent", "=", "m_indent", ".", "substring", "(", "0", ",", "m_indent", ".", "length", "(...
Decrease the indent level.
[ "Decrease", "the", "indent", "level", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/json/JsonStreamWriter.java#L357-L366
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AvailabilityFactory.java
AvailabilityFactory.process
public void process(AvailabilityTable table, byte[] data) { if (data != null) { Calendar cal = DateHelper.popCalendar(); int items = MPPUtility.getShort(data, 0); int offset = 12; for (int loop = 0; loop < items; loop++) { double unitsValue = MPPUtility.getDouble(data, offset + 4); if (unitsValue != 0) { Date startDate = MPPUtility.getTimestampFromTenths(data, offset); Date endDate = MPPUtility.getTimestampFromTenths(data, offset + 20); cal.setTime(endDate); cal.add(Calendar.MINUTE, -1); endDate = cal.getTime(); Double units = NumberHelper.getDouble(unitsValue / 100); Availability item = new Availability(startDate, endDate, units); table.add(item); } offset += 20; } DateHelper.pushCalendar(cal); Collections.sort(table); } }
java
public void process(AvailabilityTable table, byte[] data) { if (data != null) { Calendar cal = DateHelper.popCalendar(); int items = MPPUtility.getShort(data, 0); int offset = 12; for (int loop = 0; loop < items; loop++) { double unitsValue = MPPUtility.getDouble(data, offset + 4); if (unitsValue != 0) { Date startDate = MPPUtility.getTimestampFromTenths(data, offset); Date endDate = MPPUtility.getTimestampFromTenths(data, offset + 20); cal.setTime(endDate); cal.add(Calendar.MINUTE, -1); endDate = cal.getTime(); Double units = NumberHelper.getDouble(unitsValue / 100); Availability item = new Availability(startDate, endDate, units); table.add(item); } offset += 20; } DateHelper.pushCalendar(cal); Collections.sort(table); } }
[ "public", "void", "process", "(", "AvailabilityTable", "table", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", ")", ";", "int", "items", "=", "MPPUtilit...
Populates a resource availability table. @param table resource availability table @param data file data
[ "Populates", "a", "resource", "availability", "table", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AvailabilityFactory.java#L46-L73
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/LocaleData.java
LocaleData.getObject
public static final Object getObject(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getObject(key)); }
java
public static final Object getObject(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getObject(key)); }
[ "public", "static", "final", "Object", "getObject", "(", "Locale", "locale", ",", "String", "key", ")", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "LocaleData", ".", "class", ".", "getName", "(", ")", ",", "locale", ")", ...
Convenience method for retrieving an Object resource. @param locale locale identifier @param key resource key @return resource value
[ "Convenience", "method", "for", "retrieving", "an", "Object", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L99-L103
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/LocaleData.java
LocaleData.getMap
@SuppressWarnings("rawtypes") public static final Map getMap(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return ((Map) bundle.getObject(key)); }
java
@SuppressWarnings("rawtypes") public static final Map getMap(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return ((Map) bundle.getObject(key)); }
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "public", "static", "final", "Map", "getMap", "(", "Locale", "locale", ",", "String", "key", ")", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "LocaleData", ".", "class", ".",...
Convenience method for retrieving a Map resource. @param locale locale identifier @param key resource key @return resource value
[ "Convenience", "method", "for", "retrieving", "a", "Map", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L112-L116
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/LocaleData.java
LocaleData.getInteger
public static final Integer getInteger(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return ((Integer) bundle.getObject(key)); }
java
public static final Integer getInteger(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return ((Integer) bundle.getObject(key)); }
[ "public", "static", "final", "Integer", "getInteger", "(", "Locale", "locale", ",", "String", "key", ")", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "LocaleData", ".", "class", ".", "getName", "(", ")", ",", "locale", ")",...
Convenience method for retrieving an Integer resource. @param locale locale identifier @param key resource key @return resource value
[ "Convenience", "method", "for", "retrieving", "an", "Integer", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L125-L129
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/LocaleData.java
LocaleData.getChar
public static final char getChar(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getString(key).charAt(0)); }
java
public static final char getChar(Locale locale, String key) { ResourceBundle bundle = ResourceBundle.getBundle(LocaleData.class.getName(), locale); return (bundle.getString(key).charAt(0)); }
[ "public", "static", "final", "char", "getChar", "(", "Locale", "locale", ",", "String", "key", ")", "{", "ResourceBundle", "bundle", "=", "ResourceBundle", ".", "getBundle", "(", "LocaleData", ".", "class", ".", "getName", "(", ")", ",", "locale", ")", ";"...
Convenience method for retrieving a char resource. @param locale locale identifier @param key resource key @return resource value
[ "Convenience", "method", "for", "retrieving", "a", "char", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/LocaleData.java#L138-L142
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.getOverAllocated
public boolean getOverAllocated() { Boolean overallocated = (Boolean) getCachedValue(ResourceField.OVERALLOCATED); if (overallocated == null) { Number peakUnits = getPeakUnits(); Number maxUnits = getMaxUnits(); overallocated = Boolean.valueOf(NumberHelper.getDouble(peakUnits) > NumberHelper.getDouble(maxUnits)); set(ResourceField.OVERALLOCATED, overallocated); } return (overallocated.booleanValue()); }
java
public boolean getOverAllocated() { Boolean overallocated = (Boolean) getCachedValue(ResourceField.OVERALLOCATED); if (overallocated == null) { Number peakUnits = getPeakUnits(); Number maxUnits = getMaxUnits(); overallocated = Boolean.valueOf(NumberHelper.getDouble(peakUnits) > NumberHelper.getDouble(maxUnits)); set(ResourceField.OVERALLOCATED, overallocated); } return (overallocated.booleanValue()); }
[ "public", "boolean", "getOverAllocated", "(", ")", "{", "Boolean", "overallocated", "=", "(", "Boolean", ")", "getCachedValue", "(", "ResourceField", ".", "OVERALLOCATED", ")", ";", "if", "(", "overallocated", "==", "null", ")", "{", "Number", "peakUnits", "="...
Retrieves the overallocated flag. @return overallocated flag
[ "Retrieves", "the", "overallocated", "flag", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L401-L412
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.getStart
public Date getStart() { Date result = null; for (ResourceAssignment assignment : m_assignments) { if (result == null || DateHelper.compare(result, assignment.getStart()) > 0) { result = assignment.getStart(); } } return (result); }
java
public Date getStart() { Date result = null; for (ResourceAssignment assignment : m_assignments) { if (result == null || DateHelper.compare(result, assignment.getStart()) > 0) { result = assignment.getStart(); } } return (result); }
[ "public", "Date", "getStart", "(", ")", "{", "Date", "result", "=", "null", ";", "for", "(", "ResourceAssignment", "assignment", ":", "m_assignments", ")", "{", "if", "(", "result", "==", "null", "||", "DateHelper", ".", "compare", "(", "result", ",", "a...
Retrieves the earliest start date for all assigned tasks. @return start date
[ "Retrieves", "the", "earliest", "start", "date", "for", "all", "assigned", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L459-L470
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.getWorkVariance
public Duration getWorkVariance() { Duration variance = (Duration) getCachedValue(ResourceField.WORK_VARIANCE); if (variance == null) { Duration work = getWork(); Duration baselineWork = getBaselineWork(); if (work != null && baselineWork != null) { variance = Duration.getInstance(work.getDuration() - baselineWork.convertUnits(work.getUnits(), getParentFile().getProjectProperties()).getDuration(), work.getUnits()); set(ResourceField.WORK_VARIANCE, variance); } } return (variance); }
java
public Duration getWorkVariance() { Duration variance = (Duration) getCachedValue(ResourceField.WORK_VARIANCE); if (variance == null) { Duration work = getWork(); Duration baselineWork = getBaselineWork(); if (work != null && baselineWork != null) { variance = Duration.getInstance(work.getDuration() - baselineWork.convertUnits(work.getUnits(), getParentFile().getProjectProperties()).getDuration(), work.getUnits()); set(ResourceField.WORK_VARIANCE, variance); } } return (variance); }
[ "public", "Duration", "getWorkVariance", "(", ")", "{", "Duration", "variance", "=", "(", "Duration", ")", "getCachedValue", "(", "ResourceField", ".", "WORK_VARIANCE", ")", ";", "if", "(", "variance", "==", "null", ")", "{", "Duration", "work", "=", "getWor...
Retrieves the work variance. @return work variance
[ "Retrieves", "the", "work", "variance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L935-L949
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.getNotes
public String getNotes() { String notes = (String) getCachedValue(ResourceField.NOTES); return (notes == null ? "" : notes); }
java
public String getNotes() { String notes = (String) getCachedValue(ResourceField.NOTES); return (notes == null ? "" : notes); }
[ "public", "String", "getNotes", "(", ")", "{", "String", "notes", "=", "(", "String", ")", "getCachedValue", "(", "ResourceField", ".", "NOTES", ")", ";", "return", "(", "notes", "==", "null", "?", "\"\"", ":", "notes", ")", ";", "}" ]
Retrieves the notes text for this resource. @return notes text
[ "Retrieves", "the", "notes", "text", "for", "this", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1074-L1078
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setResourceCalendar
public void setResourceCalendar(ProjectCalendar calendar) { set(ResourceField.CALENDAR, calendar); if (calendar == null) { setResourceCalendarUniqueID(null); } else { calendar.setResource(this); setResourceCalendarUniqueID(calendar.getUniqueID()); } }
java
public void setResourceCalendar(ProjectCalendar calendar) { set(ResourceField.CALENDAR, calendar); if (calendar == null) { setResourceCalendarUniqueID(null); } else { calendar.setResource(this); setResourceCalendarUniqueID(calendar.getUniqueID()); } }
[ "public", "void", "setResourceCalendar", "(", "ProjectCalendar", "calendar", ")", "{", "set", "(", "ResourceField", ".", "CALENDAR", ",", "calendar", ")", ";", "if", "(", "calendar", "==", "null", ")", "{", "setResourceCalendarUniqueID", "(", "null", ")", ";",...
This method allows a pre-existing resource calendar to be attached to a resource. @param calendar resource calendar
[ "This", "method", "allows", "a", "pre", "-", "existing", "resource", "calendar", "to", "be", "attached", "to", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1340-L1352
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.addResourceCalendar
public ProjectCalendar addResourceCalendar() throws MPXJException { if (getResourceCalendar() != null) { throw new MPXJException(MPXJException.MAXIMUM_RECORDS); } ProjectCalendar calendar = new ProjectCalendar(getParentFile()); setResourceCalendar(calendar); return calendar; }
java
public ProjectCalendar addResourceCalendar() throws MPXJException { if (getResourceCalendar() != null) { throw new MPXJException(MPXJException.MAXIMUM_RECORDS); } ProjectCalendar calendar = new ProjectCalendar(getParentFile()); setResourceCalendar(calendar); return calendar; }
[ "public", "ProjectCalendar", "addResourceCalendar", "(", ")", "throws", "MPXJException", "{", "if", "(", "getResourceCalendar", "(", ")", "!=", "null", ")", "{", "throw", "new", "MPXJException", "(", "MPXJException", ".", "MAXIMUM_RECORDS", ")", ";", "}", "Proje...
This method allows a resource calendar to be added to a resource. @return ResourceCalendar @throws MPXJException if more than one calendar is added
[ "This", "method", "allows", "a", "resource", "calendar", "to", "be", "added", "to", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1380-L1390
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setBaseCalendar
public void setBaseCalendar(String val) { set(ResourceField.BASE_CALENDAR, val == null || val.length() == 0 ? "Standard" : val); }
java
public void setBaseCalendar(String val) { set(ResourceField.BASE_CALENDAR, val == null || val.length() == 0 ? "Standard" : val); }
[ "public", "void", "setBaseCalendar", "(", "String", "val", ")", "{", "set", "(", "ResourceField", ".", "BASE_CALENDAR", ",", "val", "==", "null", "||", "val", ".", "length", "(", ")", "==", "0", "?", "\"Standard\"", ":", "val", ")", ";", "}" ]
Sets the Base Calendar field indicates which calendar is the base calendar for a resource calendar. The list includes the three built-in calendars, as well as any new base calendars you have created in the Change Working Time dialog box. @param val calendar name
[ "Sets", "the", "Base", "Calendar", "field", "indicates", "which", "calendar", "is", "the", "base", "calendar", "for", "a", "resource", "calendar", ".", "The", "list", "includes", "the", "three", "built", "-", "in", "calendars", "as", "well", "as", "any", "...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1400-L1403
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.setID
@Override public void setID(Integer val) { ProjectFile parent = getParentFile(); Integer previous = getID(); if (previous != null) { parent.getResources().unmapID(previous); } parent.getResources().mapID(val, this); set(ResourceField.ID, val); }
java
@Override public void setID(Integer val) { ProjectFile parent = getParentFile(); Integer previous = getID(); if (previous != null) { parent.getResources().unmapID(previous); } parent.getResources().mapID(val, this); set(ResourceField.ID, val); }
[ "@", "Override", "public", "void", "setID", "(", "Integer", "val", ")", "{", "ProjectFile", "parent", "=", "getParentFile", "(", ")", ";", "Integer", "previous", "=", "getID", "(", ")", ";", "if", "(", "previous", "!=", "null", ")", "{", "parent", ".",...
Sets ID field value. @param val value
[ "Sets", "ID", "field", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1431-L1442
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.getFlag
public boolean getFlag(int index) { return BooleanHelper.getBoolean((Boolean) getCachedValue(selectField(ResourceFieldLists.CUSTOM_FLAG, index))); }
java
public boolean getFlag(int index) { return BooleanHelper.getBoolean((Boolean) getCachedValue(selectField(ResourceFieldLists.CUSTOM_FLAG, index))); }
[ "public", "boolean", "getFlag", "(", "int", "index", ")", "{", "return", "BooleanHelper", ".", "getBoolean", "(", "(", "Boolean", ")", "getCachedValue", "(", "selectField", "(", "ResourceFieldLists", ".", "CUSTOM_FLAG", ",", "index", ")", ")", ")", ";", "}" ...
Retrieve a flag value. @param index flag index (1-20) @return flag value
[ "Retrieve", "a", "flag", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L1738-L1741
train
joniles/mpxj
src/main/java/net/sf/mpxj/Resource.java
Resource.selectField
private ResourceField selectField(ResourceField[] 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 ResourceField selectField(ResourceField[] fields, int index) { if (index < 1 || index > fields.length) { throw new IllegalArgumentException(index + " is not a valid field index"); } return (fields[index - 1]); }
[ "private", "ResourceField", "selectField", "(", "ResourceField", "[", "]", "fields", ",", "int", "index", ")", "{", "if", "(", "index", "<", "1", "||", "index", ">", "fields", ".", "length", ")", "{", "throw", "new", "IllegalArgumentException", "(", "index...
Maps a field index to a ResourceField instance. @param fields array of fields used as the basis for the mapping. @param index required field index @return ResourceField instance
[ "Maps", "a", "field", "index", "to", "a", "ResourceField", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Resource.java#L2317-L2324
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/AbstractTimephasedWorkNormaliser.java
AbstractTimephasedWorkNormaliser.mergeSameWork
protected void mergeSameWork(LinkedList<TimephasedWork> list) { LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>(); TimephasedWork previousAssignment = null; for (TimephasedWork assignment : list) { if (previousAssignment == null) { assignment.setAmountPerDay(assignment.getTotalAmount()); result.add(assignment); } else { Duration previousAssignmentWork = previousAssignment.getAmountPerDay(); Duration assignmentWork = assignment.getTotalAmount(); if (NumberHelper.equals(previousAssignmentWork.getDuration(), assignmentWork.getDuration(), 0.01)) { Date assignmentStart = previousAssignment.getStart(); Date assignmentFinish = assignment.getFinish(); double total = previousAssignment.getTotalAmount().getDuration(); total += assignmentWork.getDuration(); Duration totalWork = Duration.getInstance(total, TimeUnit.MINUTES); TimephasedWork merged = new TimephasedWork(); merged.setStart(assignmentStart); merged.setFinish(assignmentFinish); merged.setAmountPerDay(assignmentWork); merged.setTotalAmount(totalWork); result.removeLast(); assignment = merged; } else { assignment.setAmountPerDay(assignment.getTotalAmount()); } result.add(assignment); } previousAssignment = assignment; } list.clear(); list.addAll(result); }
java
protected void mergeSameWork(LinkedList<TimephasedWork> list) { LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>(); TimephasedWork previousAssignment = null; for (TimephasedWork assignment : list) { if (previousAssignment == null) { assignment.setAmountPerDay(assignment.getTotalAmount()); result.add(assignment); } else { Duration previousAssignmentWork = previousAssignment.getAmountPerDay(); Duration assignmentWork = assignment.getTotalAmount(); if (NumberHelper.equals(previousAssignmentWork.getDuration(), assignmentWork.getDuration(), 0.01)) { Date assignmentStart = previousAssignment.getStart(); Date assignmentFinish = assignment.getFinish(); double total = previousAssignment.getTotalAmount().getDuration(); total += assignmentWork.getDuration(); Duration totalWork = Duration.getInstance(total, TimeUnit.MINUTES); TimephasedWork merged = new TimephasedWork(); merged.setStart(assignmentStart); merged.setFinish(assignmentFinish); merged.setAmountPerDay(assignmentWork); merged.setTotalAmount(totalWork); result.removeLast(); assignment = merged; } else { assignment.setAmountPerDay(assignment.getTotalAmount()); } result.add(assignment); } previousAssignment = assignment; } list.clear(); list.addAll(result); }
[ "protected", "void", "mergeSameWork", "(", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "LinkedList", "<", "TimephasedWork", ">", "result", "=", "new", "LinkedList", "<", "TimephasedWork", ">", "(", ")", ";", "TimephasedWork", "previousAssignment", ...
Merges individual days together into time spans where the same work is undertaken each day. @param list assignment data
[ "Merges", "individual", "days", "together", "into", "time", "spans", "where", "the", "same", "work", "is", "undertaken", "each", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/AbstractTimephasedWorkNormaliser.java#L55-L101
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/AbstractTimephasedWorkNormaliser.java
AbstractTimephasedWorkNormaliser.convertToHours
protected void convertToHours(LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Duration totalWork = assignment.getTotalAmount(); Duration workPerDay = assignment.getAmountPerDay(); totalWork = Duration.getInstance(totalWork.getDuration() / 60, TimeUnit.HOURS); workPerDay = Duration.getInstance(workPerDay.getDuration() / 60, TimeUnit.HOURS); assignment.setTotalAmount(totalWork); assignment.setAmountPerDay(workPerDay); } }
java
protected void convertToHours(LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Duration totalWork = assignment.getTotalAmount(); Duration workPerDay = assignment.getAmountPerDay(); totalWork = Duration.getInstance(totalWork.getDuration() / 60, TimeUnit.HOURS); workPerDay = Duration.getInstance(workPerDay.getDuration() / 60, TimeUnit.HOURS); assignment.setTotalAmount(totalWork); assignment.setAmountPerDay(workPerDay); } }
[ "protected", "void", "convertToHours", "(", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "Duration", "totalWork", "=", "assignment", ".", "getTotalAmount", "(", ")", ";", "Durati...
Converts assignment duration values from minutes to hours. @param list assignment data
[ "Converts", "assignment", "duration", "values", "from", "minutes", "to", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/AbstractTimephasedWorkNormaliser.java#L108-L119
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java
FastTrackTable.addColumn
public void addColumn(FastTrackColumn column) { FastTrackField type = column.getType(); Object[] data = column.getData(); for (int index = 0; index < data.length; index++) { MapRow row = getRow(index); row.getMap().put(type, data[index]); } }
java
public void addColumn(FastTrackColumn column) { FastTrackField type = column.getType(); Object[] data = column.getData(); for (int index = 0; index < data.length; index++) { MapRow row = getRow(index); row.getMap().put(type, data[index]); } }
[ "public", "void", "addColumn", "(", "FastTrackColumn", "column", ")", "{", "FastTrackField", "type", "=", "column", ".", "getType", "(", ")", ";", "Object", "[", "]", "data", "=", "column", ".", "getData", "(", ")", ";", "for", "(", "int", "index", "="...
Add data for a column to this table. @param column column data
[ "Add", "data", "for", "a", "column", "to", "this", "table", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java#L83-L92
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java
FastTrackTable.getRow
private MapRow getRow(int index) { MapRow result; if (index == m_rows.size()) { result = new MapRow(this, new HashMap<FastTrackField, Object>()); m_rows.add(result); } else { result = m_rows.get(index); } return result; }
java
private MapRow getRow(int index) { MapRow result; if (index == m_rows.size()) { result = new MapRow(this, new HashMap<FastTrackField, Object>()); m_rows.add(result); } else { result = m_rows.get(index); } return result; }
[ "private", "MapRow", "getRow", "(", "int", "index", ")", "{", "MapRow", "result", ";", "if", "(", "index", "==", "m_rows", ".", "size", "(", ")", ")", "{", "result", "=", "new", "MapRow", "(", "this", ",", "new", "HashMap", "<", "FastTrackField", ","...
Retrieve a specific row by index number, creating a blank row if this row does not exist. @param index index number @return MapRow instance
[ "Retrieve", "a", "specific", "row", "by", "index", "number", "creating", "a", "blank", "row", "if", "this", "row", "does", "not", "exist", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackTable.java#L108-L123
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.setRecordNumber
private void setRecordNumber(LinkedList<String> list) { try { String number = list.remove(0); m_recordNumber = Integer.valueOf(number); } catch (NumberFormatException ex) { // Malformed MPX file: the record number isn't a valid integer // Catch the exception here, leaving m_recordNumber as null // so we will skip this record entirely. } }
java
private void setRecordNumber(LinkedList<String> list) { try { String number = list.remove(0); m_recordNumber = Integer.valueOf(number); } catch (NumberFormatException ex) { // Malformed MPX file: the record number isn't a valid integer // Catch the exception here, leaving m_recordNumber as null // so we will skip this record entirely. } }
[ "private", "void", "setRecordNumber", "(", "LinkedList", "<", "String", ">", "list", ")", "{", "try", "{", "String", "number", "=", "list", ".", "remove", "(", "0", ")", ";", "m_recordNumber", "=", "Integer", ".", "valueOf", "(", "number", ")", ";", "}...
Pop the record number from the front of the list, and parse it to ensure that it is a valid integer. @param list MPX record
[ "Pop", "the", "record", "number", "from", "the", "front", "of", "the", "list", "and", "parse", "it", "to", "ensure", "that", "it", "is", "a", "valid", "integer", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L95-L108
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getString
public String getString(int field) { String result; if (field < m_fields.length) { result = m_fields[field]; if (result != null) { result = result.replace(MPXConstants.EOL_PLACEHOLDER, '\n'); } } else { result = null; } return (result); }
java
public String getString(int field) { String result; if (field < m_fields.length) { result = m_fields[field]; if (result != null) { result = result.replace(MPXConstants.EOL_PLACEHOLDER, '\n'); } } else { result = null; } return (result); }
[ "public", "String", "getString", "(", "int", "field", ")", "{", "String", "result", ";", "if", "(", "field", "<", "m_fields", ".", "length", ")", "{", "result", "=", "m_fields", "[", "field", "]", ";", "if", "(", "result", "!=", "null", ")", "{", "...
Accessor method used to retrieve a String object representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field
[ "Accessor", "method", "used", "to", "retrieve", "a", "String", "object", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L128-L147
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getCharacter
public Character getCharacter(int field) { Character result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = Character.valueOf(m_fields[field].charAt(0)); } else { result = null; } return (result); }
java
public Character getCharacter(int field) { Character result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = Character.valueOf(m_fields[field].charAt(0)); } else { result = null; } return (result); }
[ "public", "Character", "getCharacter", "(", "int", "field", ")", "{", "Character", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", "0", ")", ")", ...
Accessor method used to retrieve a char representing the contents of an individual field. If the field does not exist in the record, the default character is returned. @param field the index number of the field to be retrieved @return the value of the required field
[ "Accessor", "method", "used", "to", "retrieve", "a", "char", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "the", "default", "character", "is", "returned", "." ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L157-L171
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getFloat
public Number getFloat(int field) throws MPXJException { try { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = m_formats.getDecimalFormat().parse(m_fields[field]); } else { result = null; } return (result); } catch (ParseException ex) { throw new MPXJException("Failed to parse float", ex); } }
java
public Number getFloat(int field) throws MPXJException { try { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = m_formats.getDecimalFormat().parse(m_fields[field]); } else { result = null; } return (result); } catch (ParseException ex) { throw new MPXJException("Failed to parse float", ex); } }
[ "public", "Number", "getFloat", "(", "int", "field", ")", "throws", "MPXJException", "{", "try", "{", "Number", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ...
Accessor method used to retrieve a Float object representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field
[ "Accessor", "method", "used", "to", "retrieve", "a", "Float", "object", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L181-L203
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getNumericBoolean
public boolean getNumericBoolean(int field) { boolean result = false; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = Integer.parseInt(m_fields[field]) == 1; } return (result); }
java
public boolean getNumericBoolean(int field) { boolean result = false; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = Integer.parseInt(m_fields[field]) == 1; } return (result); }
[ "public", "boolean", "getNumericBoolean", "(", "int", "field", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", "0...
Accessor method used to retrieve a Boolean object representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field
[ "Accessor", "method", "used", "to", "retrieve", "a", "Boolean", "object", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L348-L358
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getRate
public Rate getRate(int field) throws MPXJException { Rate result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { String rate = m_fields[field]; int index = rate.indexOf('/'); double amount; TimeUnit units; if (index == -1) { amount = m_formats.getCurrencyFormat().parse(rate).doubleValue(); units = TimeUnit.HOURS; } else { amount = m_formats.getCurrencyFormat().parse(rate.substring(0, index)).doubleValue(); units = TimeUnitUtility.getInstance(rate.substring(index + 1), m_locale); } result = new Rate(amount, units); } catch (ParseException ex) { throw new MPXJException("Failed to parse rate", ex); } } else { result = null; } return (result); }
java
public Rate getRate(int field) throws MPXJException { Rate result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { String rate = m_fields[field]; int index = rate.indexOf('/'); double amount; TimeUnit units; if (index == -1) { amount = m_formats.getCurrencyFormat().parse(rate).doubleValue(); units = TimeUnit.HOURS; } else { amount = m_formats.getCurrencyFormat().parse(rate.substring(0, index)).doubleValue(); units = TimeUnitUtility.getInstance(rate.substring(index + 1), m_locale); } result = new Rate(amount, units); } catch (ParseException ex) { throw new MPXJException("Failed to parse rate", ex); } } else { result = null; } return (result); }
[ "public", "Rate", "getRate", "(", "int", "field", ")", "throws", "MPXJException", "{", "Rate", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", "0", ...
Accessor method used to retrieve an Rate object representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field @throws MPXJException normally thrown when parsing fails
[ "Accessor", "method", "used", "to", "retrieve", "an", "Rate", "object", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L369-L407
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getDuration
public Duration getDuration(int field) throws MPXJException { Duration result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = DurationUtility.getInstance(m_fields[field], m_formats.getDurationDecimalFormat(), m_locale); } else { result = null; } return (result); }
java
public Duration getDuration(int field) throws MPXJException { Duration result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = DurationUtility.getInstance(m_fields[field], m_formats.getDurationDecimalFormat(), m_locale); } else { result = null; } return (result); }
[ "public", "Duration", "getDuration", "(", "int", "field", ")", "throws", "MPXJException", "{", "Duration", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "...
Accessor method used to retrieve an Duration object representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field @throws MPXJException normally thrown when parsing fails
[ "Accessor", "method", "used", "to", "retrieve", "an", "Duration", "object", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L484-L498
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getUnits
public Number getUnits(int field) throws MPXJException { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { result = Double.valueOf(m_formats.getUnitsDecimalFormat().parse(m_fields[field]).doubleValue() * 100); } catch (ParseException ex) { throw new MPXJException("Failed to parse units", ex); } } else { result = null; } return (result); }
java
public Number getUnits(int field) throws MPXJException { Number result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { try { result = Double.valueOf(m_formats.getUnitsDecimalFormat().parse(m_fields[field]).doubleValue() * 100); } catch (ParseException ex) { throw new MPXJException("Failed to parse units", ex); } } else { result = null; } return (result); }
[ "public", "Number", "getUnits", "(", "int", "field", ")", "throws", "MPXJException", "{", "Number", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", ...
Accessor method used to retrieve a Number instance representing the contents of an individual field. If the field does not exist in the record, null is returned. @param field the index number of the field to be retrieved @return the value of the required field @throws MPXJException normally thrown when parsing fails
[ "Accessor", "method", "used", "to", "retrieve", "a", "Number", "instance", "representing", "the", "contents", "of", "an", "individual", "field", ".", "If", "the", "field", "does", "not", "exist", "in", "the", "record", "null", "is", "returned", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L509-L531
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getCodePage
public CodePage getCodePage(int field) { CodePage result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = CodePage.getInstance(m_fields[field]); } else { result = CodePage.getInstance(null); } return (result); }
java
public CodePage getCodePage(int field) { CodePage result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = CodePage.getInstance(m_fields[field]); } else { result = CodePage.getInstance(null); } return (result); }
[ "public", "CodePage", "getCodePage", "(", "int", "field", ")", "{", "CodePage", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", "0", ")", ")", "{"...
Retrieves a CodePage instance. Defaults to ANSI. @param field the index number of the field to be retrieved @return the value of the required field
[ "Retrieves", "a", "CodePage", "instance", ".", "Defaults", "to", "ANSI", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L683-L697
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getAccrueType
public AccrueType getAccrueType(int field) { AccrueType result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = AccrueTypeUtility.getInstance(m_fields[field], m_locale); } else { result = null; } return (result); }
java
public AccrueType getAccrueType(int field) { AccrueType result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = AccrueTypeUtility.getInstance(m_fields[field], m_locale); } else { result = null; } return (result); }
[ "public", "AccrueType", "getAccrueType", "(", "int", "field", ")", "{", "AccrueType", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "!=", "0", ")", ")",...
Accessor method to retrieve an accrue type instance. @param field the index number of the field to be retrieved @return the value of the required field
[ "Accessor", "method", "to", "retrieve", "an", "accrue", "type", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L705-L719
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/Record.java
Record.getBoolean
public Boolean getBoolean(int field, String falseText) { Boolean result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE); } else { result = null; } return (result); }
java
public Boolean getBoolean(int field, String falseText) { Boolean result; if ((field < m_fields.length) && (m_fields[field].length() != 0)) { result = ((m_fields[field].equalsIgnoreCase(falseText) == true) ? Boolean.FALSE : Boolean.TRUE); } else { result = null; } return (result); }
[ "public", "Boolean", "getBoolean", "(", "int", "field", ",", "String", "falseText", ")", "{", "Boolean", "result", ";", "if", "(", "(", "field", "<", "m_fields", ".", "length", ")", "&&", "(", "m_fields", "[", "field", "]", ".", "length", "(", ")", "...
Accessor method to retrieve a Boolean instance. @param field the index number of the field to be retrieved @param falseText locale specific text representing false @return the value of the required field
[ "Accessor", "method", "to", "retrieve", "a", "Boolean", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/Record.java#L728-L742
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/FixedData.java
FixedData.getIndexFromOffset
public int getIndexFromOffset(int offset) { int result = -1; for (int loop = 0; loop < m_offset.length; loop++) { if (m_offset[loop] == offset) { result = loop; break; } } return (result); }
java
public int getIndexFromOffset(int offset) { int result = -1; for (int loop = 0; loop < m_offset.length; loop++) { if (m_offset[loop] == offset) { result = loop; break; } } return (result); }
[ "public", "int", "getIndexFromOffset", "(", "int", "offset", ")", "{", "int", "result", "=", "-", "1", ";", "for", "(", "int", "loop", "=", "0", ";", "loop", "<", "m_offset", ".", "length", ";", "loop", "++", ")", "{", "if", "(", "m_offset", "[", ...
This method converts an offset value into an array index, which in turn allows the data present in the fixed block to be retrieved. Note that if the requested offset is not found, then this method returns -1. @param offset Offset of the data in the fixed block @return Index of data item within the fixed data block
[ "This", "method", "converts", "an", "offset", "value", "into", "an", "array", "index", "which", "in", "turn", "allows", "the", "data", "present", "in", "the", "fixed", "block", "to", "be", "retrieved", ".", "Note", "that", "if", "the", "requested", "offset...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FixedData.java#L344-L358
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/FixDeferFix.java
FixDeferFix.getByteArray
public byte[] getByteArray(int offset) { byte[] result = null; if (offset > 0 && offset < m_data.length) { int nextBlockOffset = MPPUtility.getInt(m_data, offset); offset += 4; int itemSize = MPPUtility.getInt(m_data, offset); offset += 4; if (itemSize > 0 && itemSize < m_data.length) { int blockRemainingSize = 28; if (nextBlockOffset != -1 || itemSize <= blockRemainingSize) { int itemRemainingSize = itemSize; result = new byte[itemSize]; int resultOffset = 0; while (nextBlockOffset != -1) { MPPUtility.getByteArray(m_data, offset, blockRemainingSize, result, resultOffset); resultOffset += blockRemainingSize; offset += blockRemainingSize; itemRemainingSize -= blockRemainingSize; if (offset != nextBlockOffset) { offset = nextBlockOffset; } nextBlockOffset = MPPUtility.getInt(m_data, offset); offset += 4; blockRemainingSize = 32; } MPPUtility.getByteArray(m_data, offset, itemRemainingSize, result, resultOffset); } } } return (result); }
java
public byte[] getByteArray(int offset) { byte[] result = null; if (offset > 0 && offset < m_data.length) { int nextBlockOffset = MPPUtility.getInt(m_data, offset); offset += 4; int itemSize = MPPUtility.getInt(m_data, offset); offset += 4; if (itemSize > 0 && itemSize < m_data.length) { int blockRemainingSize = 28; if (nextBlockOffset != -1 || itemSize <= blockRemainingSize) { int itemRemainingSize = itemSize; result = new byte[itemSize]; int resultOffset = 0; while (nextBlockOffset != -1) { MPPUtility.getByteArray(m_data, offset, blockRemainingSize, result, resultOffset); resultOffset += blockRemainingSize; offset += blockRemainingSize; itemRemainingSize -= blockRemainingSize; if (offset != nextBlockOffset) { offset = nextBlockOffset; } nextBlockOffset = MPPUtility.getInt(m_data, offset); offset += 4; blockRemainingSize = 32; } MPPUtility.getByteArray(m_data, offset, itemRemainingSize, result, resultOffset); } } } return (result); }
[ "public", "byte", "[", "]", "getByteArray", "(", "int", "offset", ")", "{", "byte", "[", "]", "result", "=", "null", ";", "if", "(", "offset", ">", "0", "&&", "offset", "<", "m_data", ".", "length", ")", "{", "int", "nextBlockOffset", "=", "MPPUtilit...
Retrieve a byte array of containing the data starting at the supplied offset in the FixDeferFix file. Note that this method will return null if the requested data is not found for some reason. @param offset Offset into the file @return Byte array containing the requested data
[ "Retrieve", "a", "byte", "array", "of", "containing", "the", "data", "starting", "at", "the", "supplied", "offset", "in", "the", "FixDeferFix", "file", ".", "Note", "that", "this", "method", "will", "return", "null", "if", "the", "requested", "data", "is", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FixDeferFix.java#L61-L106
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/schema/ResourceRequestType.java
ResourceRequestType.getResourceRequestCriterion
public List<ResourceRequestType.ResourceRequestCriterion> getResourceRequestCriterion() { if (resourceRequestCriterion == null) { resourceRequestCriterion = new ArrayList<ResourceRequestType.ResourceRequestCriterion>(); } return this.resourceRequestCriterion; }
java
public List<ResourceRequestType.ResourceRequestCriterion> getResourceRequestCriterion() { if (resourceRequestCriterion == null) { resourceRequestCriterion = new ArrayList<ResourceRequestType.ResourceRequestCriterion>(); } return this.resourceRequestCriterion; }
[ "public", "List", "<", "ResourceRequestType", ".", "ResourceRequestCriterion", ">", "getResourceRequestCriterion", "(", ")", "{", "if", "(", "resourceRequestCriterion", "==", "null", ")", "{", "resourceRequestCriterion", "=", "new", "ArrayList", "<", "ResourceRequestTyp...
Gets the value of the resourceRequestCriterion property. <p> This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make to the returned list will be present inside the JAXB object. This is why there is not a <CODE>set</CODE> method for the resourceRequestCriterion property. <p> For example, to add a new item, do as follows: <pre> getResourceRequestCriterion().add(newItem); </pre> <p> Objects of the following type(s) are allowed in the list {@link ResourceRequestType.ResourceRequestCriterion }
[ "Gets", "the", "value", "of", "the", "resourceRequestCriterion", "property", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/schema/ResourceRequestType.java#L390-L397
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader12.java
CustomFieldValueReader12.populateCustomFieldMap
private Map<UUID, FieldType> populateCustomFieldMap() { byte[] data = m_taskProps.getByteArray(Props.CUSTOM_FIELDS); int length = MPPUtility.getInt(data, 0); int index = length + 36; // 4 byte record count int recordCount = MPPUtility.getInt(data, index); index += 4; // 8 bytes per record index += (8 * recordCount); Map<UUID, FieldType> map = new HashMap<UUID, FieldType>(); while (index < data.length) { int blockLength = MPPUtility.getInt(data, index); if (blockLength <= 0 || index + blockLength > data.length) { break; } int fieldID = MPPUtility.getInt(data, index + 4); FieldType field = FieldTypeHelper.getInstance(fieldID); UUID guid = MPPUtility.getGUID(data, index + 160); map.put(guid, field); index += blockLength; } return map; }
java
private Map<UUID, FieldType> populateCustomFieldMap() { byte[] data = m_taskProps.getByteArray(Props.CUSTOM_FIELDS); int length = MPPUtility.getInt(data, 0); int index = length + 36; // 4 byte record count int recordCount = MPPUtility.getInt(data, index); index += 4; // 8 bytes per record index += (8 * recordCount); Map<UUID, FieldType> map = new HashMap<UUID, FieldType>(); while (index < data.length) { int blockLength = MPPUtility.getInt(data, index); if (blockLength <= 0 || index + blockLength > data.length) { break; } int fieldID = MPPUtility.getInt(data, index + 4); FieldType field = FieldTypeHelper.getInstance(fieldID); UUID guid = MPPUtility.getGUID(data, index + 160); map.put(guid, field); index += blockLength; } return map; }
[ "private", "Map", "<", "UUID", ",", "FieldType", ">", "populateCustomFieldMap", "(", ")", "{", "byte", "[", "]", "data", "=", "m_taskProps", ".", "getByteArray", "(", "Props", ".", "CUSTOM_FIELDS", ")", ";", "int", "length", "=", "MPPUtility", ".", "getInt...
Generate a map of UUID values to field types. @return UUID field value map
[ "Generate", "a", "map", "of", "UUID", "values", "to", "field", "types", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader12.java#L94-L123
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/FileHelper.java
FileHelper.deleteQuietly
public static final void deleteQuietly(File file) { if (file != null) { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { deleteQuietly(child); } } } file.delete(); } }
java
public static final void deleteQuietly(File file) { if (file != null) { if (file.isDirectory()) { File[] children = file.listFiles(); if (children != null) { for (File child : children) { deleteQuietly(child); } } } file.delete(); } }
[ "public", "static", "final", "void", "deleteQuietly", "(", "File", "file", ")", "{", "if", "(", "file", "!=", "null", ")", "{", "if", "(", "file", ".", "isDirectory", "(", ")", ")", "{", "File", "[", "]", "children", "=", "file", ".", "listFiles", ...
Delete a file ignoring failures. @param file file to delete
[ "Delete", "a", "file", "ignoring", "failures", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/FileHelper.java#L55-L72
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/P3PRXFileReader.java
P3PRXFileReader.extractFile
private void extractFile(InputStream stream, File dir) throws IOException { byte[] header = new byte[8]; byte[] fileName = new byte[13]; byte[] dataSize = new byte[4]; stream.read(header); stream.read(fileName); stream.read(dataSize); int dataSizeValue = getInt(dataSize, 0); String fileNameValue = getString(fileName, 0); File file = new File(dir, fileNameValue); if (dataSizeValue == 0) { FileHelper.createNewFile(file); } else { OutputStream os = new FileOutputStream(file); FixedLengthInputStream inputStream = new FixedLengthInputStream(stream, dataSizeValue); Blast blast = new Blast(); blast.blast(inputStream, os); os.close(); } }
java
private void extractFile(InputStream stream, File dir) throws IOException { byte[] header = new byte[8]; byte[] fileName = new byte[13]; byte[] dataSize = new byte[4]; stream.read(header); stream.read(fileName); stream.read(dataSize); int dataSizeValue = getInt(dataSize, 0); String fileNameValue = getString(fileName, 0); File file = new File(dir, fileNameValue); if (dataSizeValue == 0) { FileHelper.createNewFile(file); } else { OutputStream os = new FileOutputStream(file); FixedLengthInputStream inputStream = new FixedLengthInputStream(stream, dataSizeValue); Blast blast = new Blast(); blast.blast(inputStream, os); os.close(); } }
[ "private", "void", "extractFile", "(", "InputStream", "stream", ",", "File", "dir", ")", "throws", "IOException", "{", "byte", "[", "]", "header", "=", "new", "byte", "[", "8", "]", ";", "byte", "[", "]", "fileName", "=", "new", "byte", "[", "13", "]...
Extracts the data for a single file from the input stream and writes it to a target directory. @param stream input stream @param dir target directory
[ "Extracts", "the", "data", "for", "a", "single", "file", "from", "the", "input", "stream", "and", "writes", "it", "to", "a", "target", "directory", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/P3PRXFileReader.java#L105-L131
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.matchesFingerprint
private boolean matchesFingerprint(byte[] buffer, byte[] fingerprint) { return Arrays.equals(fingerprint, Arrays.copyOf(buffer, fingerprint.length)); }
java
private boolean matchesFingerprint(byte[] buffer, byte[] fingerprint) { return Arrays.equals(fingerprint, Arrays.copyOf(buffer, fingerprint.length)); }
[ "private", "boolean", "matchesFingerprint", "(", "byte", "[", "]", "buffer", ",", "byte", "[", "]", "fingerprint", ")", "{", "return", "Arrays", ".", "equals", "(", "fingerprint", ",", "Arrays", ".", "copyOf", "(", "buffer", ",", "fingerprint", ".", "lengt...
Determine if the start of the buffer matches a fingerprint byte array. @param buffer bytes from file @param fingerprint fingerprint bytes @return true if the file matches the fingerprint
[ "Determine", "if", "the", "start", "of", "the", "buffer", "matches", "a", "fingerprint", "byte", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L329-L332
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.matchesFingerprint
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
java
private boolean matchesFingerprint(byte[] buffer, Pattern fingerprint) { return fingerprint.matcher(m_charset == null ? new String(buffer) : new String(buffer, m_charset)).matches(); }
[ "private", "boolean", "matchesFingerprint", "(", "byte", "[", "]", "buffer", ",", "Pattern", "fingerprint", ")", "{", "return", "fingerprint", ".", "matcher", "(", "m_charset", "==", "null", "?", "new", "String", "(", "buffer", ")", ":", "new", "String", "...
Determine if the buffer, when expressed as text, matches a fingerprint regular expression. @param buffer bytes from file @param fingerprint fingerprint regular expression @return true if the file matches the fingerprint
[ "Determine", "if", "the", "buffer", "when", "expressed", "as", "text", "matches", "a", "fingerprint", "regular", "expression", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L341-L344
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.readProjectFile
private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException { addListeners(reader); return reader.read(stream); }
java
private ProjectFile readProjectFile(ProjectReader reader, InputStream stream) throws MPXJException { addListeners(reader); return reader.read(stream); }
[ "private", "ProjectFile", "readProjectFile", "(", "ProjectReader", "reader", ",", "InputStream", "stream", ")", "throws", "MPXJException", "{", "addListeners", "(", "reader", ")", ";", "return", "reader", ".", "read", "(", "stream", ")", ";", "}" ]
Adds listeners and reads from a stream. @param reader reader for file type @param stream schedule data @return ProjectFile instance
[ "Adds", "listeners", "and", "reads", "from", "a", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L353-L357
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.readProjectFile
private ProjectFile readProjectFile(ProjectReader reader, File file) throws MPXJException { addListeners(reader); return reader.read(file); }
java
private ProjectFile readProjectFile(ProjectReader reader, File file) throws MPXJException { addListeners(reader); return reader.read(file); }
[ "private", "ProjectFile", "readProjectFile", "(", "ProjectReader", "reader", ",", "File", "file", ")", "throws", "MPXJException", "{", "addListeners", "(", "reader", ")", ";", "return", "reader", ".", "read", "(", "file", ")", ";", "}" ]
Adds listeners and reads from a file. @param reader reader for file type @param file schedule data @return ProjectFile instance
[ "Adds", "listeners", "and", "reads", "from", "a", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L366-L370
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleOleCompoundDocument
private ProjectFile handleOleCompoundDocument(InputStream stream) throws Exception { POIFSFileSystem fs = new POIFSFileSystem(POIFSFileSystem.createNonClosingInputStream(stream)); String fileFormat = MPPReader.getFileFormat(fs); if (fileFormat != null && fileFormat.startsWith("MSProject")) { MPPReader reader = new MPPReader(); addListeners(reader); return reader.read(fs); } return null; }
java
private ProjectFile handleOleCompoundDocument(InputStream stream) throws Exception { POIFSFileSystem fs = new POIFSFileSystem(POIFSFileSystem.createNonClosingInputStream(stream)); String fileFormat = MPPReader.getFileFormat(fs); if (fileFormat != null && fileFormat.startsWith("MSProject")) { MPPReader reader = new MPPReader(); addListeners(reader); return reader.read(fs); } return null; }
[ "private", "ProjectFile", "handleOleCompoundDocument", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "POIFSFileSystem", "fs", "=", "new", "POIFSFileSystem", "(", "POIFSFileSystem", ".", "createNonClosingInputStream", "(", "stream", ")", ")", ";", "Str...
We have an OLE compound document... but is it an MPP file? @param stream file input stream @return ProjectFile instance
[ "We", "have", "an", "OLE", "compound", "document", "...", "but", "is", "it", "an", "MPP", "file?" ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L378-L389
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleMDBFile
private ProjectFile handleMDBFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".mdb"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + file.getCanonicalPath(); Set<String> tableNames = populateTableNames(url); if (tableNames.contains("MSP_PROJECTS")) { return readProjectFile(new MPDDatabaseReader(), file); } if (tableNames.contains("EXCEPTIONN")) { return readProjectFile(new AstaDatabaseReader(), file); } return null; } finally { FileHelper.deleteQuietly(file); } }
java
private ProjectFile handleMDBFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".mdb"); try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + file.getCanonicalPath(); Set<String> tableNames = populateTableNames(url); if (tableNames.contains("MSP_PROJECTS")) { return readProjectFile(new MPDDatabaseReader(), file); } if (tableNames.contains("EXCEPTIONN")) { return readProjectFile(new AstaDatabaseReader(), file); } return null; } finally { FileHelper.deleteQuietly(file); } }
[ "private", "ProjectFile", "handleMDBFile", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "File", "file", "=", "InputStreamHelper", ".", "writeStreamToTempFile", "(", "stream", ",", "\".mdb\"", ")", ";", "try", "{", "Class", ".", "forName", "(", ...
We have identified that we have an MDB file. This could be a Microsoft Project database or an Asta database. Open the database and use the table names present to determine which type this is. @param stream schedule data @return ProjectFile instance
[ "We", "have", "identified", "that", "we", "have", "an", "MDB", "file", ".", "This", "could", "be", "a", "Microsoft", "Project", "database", "or", "an", "Asta", "database", ".", "Open", "the", "database", "and", "use", "the", "table", "names", "present", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L417-L444
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleSQLiteFile
private ProjectFile handleSQLiteFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".sqlite"); try { Class.forName("org.sqlite.JDBC"); String url = "jdbc:sqlite:" + file.getCanonicalPath(); Set<String> tableNames = populateTableNames(url); if (tableNames.contains("EXCEPTIONN")) { return readProjectFile(new AstaDatabaseFileReader(), file); } if (tableNames.contains("PROJWBS")) { Connection connection = null; try { Properties props = new Properties(); props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); connection = DriverManager.getConnection(url, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(connection); addListeners(reader); return reader.read(); } finally { if (connection != null) { connection.close(); } } } if (tableNames.contains("ZSCHEDULEITEM")) { return readProjectFile(new MerlinReader(), file); } return null; } finally { FileHelper.deleteQuietly(file); } }
java
private ProjectFile handleSQLiteFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".sqlite"); try { Class.forName("org.sqlite.JDBC"); String url = "jdbc:sqlite:" + file.getCanonicalPath(); Set<String> tableNames = populateTableNames(url); if (tableNames.contains("EXCEPTIONN")) { return readProjectFile(new AstaDatabaseFileReader(), file); } if (tableNames.contains("PROJWBS")) { Connection connection = null; try { Properties props = new Properties(); props.setProperty("date_string_format", "yyyy-MM-dd HH:mm:ss"); connection = DriverManager.getConnection(url, props); PrimaveraDatabaseReader reader = new PrimaveraDatabaseReader(); reader.setConnection(connection); addListeners(reader); return reader.read(); } finally { if (connection != null) { connection.close(); } } } if (tableNames.contains("ZSCHEDULEITEM")) { return readProjectFile(new MerlinReader(), file); } return null; } finally { FileHelper.deleteQuietly(file); } }
[ "private", "ProjectFile", "handleSQLiteFile", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "File", "file", "=", "InputStreamHelper", ".", "writeStreamToTempFile", "(", "stream", ",", "\".sqlite\"", ")", ";", "try", "{", "Class", ".", "forName", ...
We have identified that we have a SQLite file. This could be a Primavera Project database or an Asta database. Open the database and use the table names present to determine which type this is. @param stream schedule data @return ProjectFile instance
[ "We", "have", "identified", "that", "we", "have", "a", "SQLite", "file", ".", "This", "could", "be", "a", "Primavera", "Project", "database", "or", "an", "Asta", "database", ".", "Open", "the", "database", "and", "use", "the", "table", "names", "present", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L454-L503
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleZipFile
private ProjectFile handleZipFile(InputStream stream) throws Exception { File dir = null; try { dir = InputStreamHelper.writeZipStreamToTempDir(stream); ProjectFile result = handleDirectory(dir); if (result != null) { return result; } } finally { FileHelper.deleteQuietly(dir); } return null; }
java
private ProjectFile handleZipFile(InputStream stream) throws Exception { File dir = null; try { dir = InputStreamHelper.writeZipStreamToTempDir(stream); ProjectFile result = handleDirectory(dir); if (result != null) { return result; } } finally { FileHelper.deleteQuietly(dir); } return null; }
[ "private", "ProjectFile", "handleZipFile", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "File", "dir", "=", "null", ";", "try", "{", "dir", "=", "InputStreamHelper", ".", "writeZipStreamToTempDir", "(", "stream", ")", ";", "ProjectFile", "resul...
We have identified that we have a zip file. Extract the contents into a temporary directory and process. @param stream schedule data @return ProjectFile instance
[ "We", "have", "identified", "that", "we", "have", "a", "zip", "file", ".", "Extract", "the", "contents", "into", "a", "temporary", "directory", "and", "process", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L512-L532
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleDirectory
private ProjectFile handleDirectory(File directory) throws Exception { ProjectFile result = handleDatabaseInDirectory(directory); if (result == null) { result = handleFileInDirectory(directory); } return result; }
java
private ProjectFile handleDirectory(File directory) throws Exception { ProjectFile result = handleDatabaseInDirectory(directory); if (result == null) { result = handleFileInDirectory(directory); } return result; }
[ "private", "ProjectFile", "handleDirectory", "(", "File", "directory", ")", "throws", "Exception", "{", "ProjectFile", "result", "=", "handleDatabaseInDirectory", "(", "directory", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "handleFile...
We have a directory. Determine if this contains a multi-file database we understand, if so process it. If it does not contain a database, test each file within the directory structure to determine if it contains a file whose format we understand. @param directory directory to process @return ProjectFile instance if we can process anything, or null
[ "We", "have", "a", "directory", ".", "Determine", "if", "this", "contains", "a", "multi", "-", "file", "database", "we", "understand", "if", "so", "process", "it", ".", "If", "it", "does", "not", "contain", "a", "database", "test", "each", "file", "withi...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L542-L550
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleDatabaseInDirectory
private ProjectFile handleDatabaseInDirectory(File directory) throws Exception { byte[] buffer = new byte[BUFFER_SIZE]; File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { continue; } FileInputStream fis = new FileInputStream(file); int bytesRead = fis.read(buffer); fis.close(); // // If the file is smaller than the buffer we are peeking into, // it's probably not a valid schedule file. // if (bytesRead != BUFFER_SIZE) { continue; } if (matchesFingerprint(buffer, BTRIEVE_FINGERPRINT)) { return handleP3BtrieveDatabase(directory); } if (matchesFingerprint(buffer, STW_FINGERPRINT)) { return handleSureTrakDatabase(directory); } } } return null; }
java
private ProjectFile handleDatabaseInDirectory(File directory) throws Exception { byte[] buffer = new byte[BUFFER_SIZE]; File[] files = directory.listFiles(); if (files != null) { for (File file : files) { if (file.isDirectory()) { continue; } FileInputStream fis = new FileInputStream(file); int bytesRead = fis.read(buffer); fis.close(); // // If the file is smaller than the buffer we are peeking into, // it's probably not a valid schedule file. // if (bytesRead != BUFFER_SIZE) { continue; } if (matchesFingerprint(buffer, BTRIEVE_FINGERPRINT)) { return handleP3BtrieveDatabase(directory); } if (matchesFingerprint(buffer, STW_FINGERPRINT)) { return handleSureTrakDatabase(directory); } } } return null; }
[ "private", "ProjectFile", "handleDatabaseInDirectory", "(", "File", "directory", ")", "throws", "Exception", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "BUFFER_SIZE", "]", ";", "File", "[", "]", "files", "=", "directory", ".", "listFiles", "("...
Given a directory, determine if it contains a multi-file database whose format we can process. @param directory directory to process @return ProjectFile instance if we can process anything, or null
[ "Given", "a", "directory", "determine", "if", "it", "contains", "a", "multi", "-", "file", "database", "whose", "format", "we", "can", "process", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L559-L597
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleByteOrderMark
private ProjectFile handleByteOrderMark(InputStream stream, int length, Charset charset) throws Exception { UniversalProjectReader reader = new UniversalProjectReader(); reader.setSkipBytes(length); reader.setCharset(charset); return reader.read(stream); }
java
private ProjectFile handleByteOrderMark(InputStream stream, int length, Charset charset) throws Exception { UniversalProjectReader reader = new UniversalProjectReader(); reader.setSkipBytes(length); reader.setCharset(charset); return reader.read(stream); }
[ "private", "ProjectFile", "handleByteOrderMark", "(", "InputStream", "stream", ",", "int", "length", ",", "Charset", "charset", ")", "throws", "Exception", "{", "UniversalProjectReader", "reader", "=", "new", "UniversalProjectReader", "(", ")", ";", "reader", ".", ...
The file we are working with has a byte order mark. Skip this and try again to read the file. @param stream schedule data @param length length of the byte order mark @param charset charset indicated by byte order mark @return ProjectFile instance
[ "The", "file", "we", "are", "working", "with", "has", "a", "byte", "order", "mark", ".", "Skip", "this", "and", "try", "again", "to", "read", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L674-L680
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleDosExeFile
private ProjectFile handleDosExeFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".tmp"); InputStream is = null; try { is = new FileInputStream(file); if (is.available() > 1350) { StreamHelper.skip(is, 1024); // Bytes at offset 1024 byte[] data = new byte[2]; is.read(data); if (matchesFingerprint(data, WINDOWS_NE_EXE_FINGERPRINT)) { StreamHelper.skip(is, 286); // Bytes at offset 1312 data = new byte[34]; is.read(data); if (matchesFingerprint(data, PRX_FINGERPRINT)) { is.close(); is = null; return readProjectFile(new P3PRXFileReader(), file); } } if (matchesFingerprint(data, STX_FINGERPRINT)) { StreamHelper.skip(is, 31742); // Bytes at offset 32768 data = new byte[4]; is.read(data); if (matchesFingerprint(data, PRX3_FINGERPRINT)) { is.close(); is = null; return readProjectFile(new SureTrakSTXFileReader(), file); } } } return null; } finally { StreamHelper.closeQuietly(is); FileHelper.deleteQuietly(file); } }
java
private ProjectFile handleDosExeFile(InputStream stream) throws Exception { File file = InputStreamHelper.writeStreamToTempFile(stream, ".tmp"); InputStream is = null; try { is = new FileInputStream(file); if (is.available() > 1350) { StreamHelper.skip(is, 1024); // Bytes at offset 1024 byte[] data = new byte[2]; is.read(data); if (matchesFingerprint(data, WINDOWS_NE_EXE_FINGERPRINT)) { StreamHelper.skip(is, 286); // Bytes at offset 1312 data = new byte[34]; is.read(data); if (matchesFingerprint(data, PRX_FINGERPRINT)) { is.close(); is = null; return readProjectFile(new P3PRXFileReader(), file); } } if (matchesFingerprint(data, STX_FINGERPRINT)) { StreamHelper.skip(is, 31742); // Bytes at offset 32768 data = new byte[4]; is.read(data); if (matchesFingerprint(data, PRX3_FINGERPRINT)) { is.close(); is = null; return readProjectFile(new SureTrakSTXFileReader(), file); } } } return null; } finally { StreamHelper.closeQuietly(is); FileHelper.deleteQuietly(file); } }
[ "private", "ProjectFile", "handleDosExeFile", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "File", "file", "=", "InputStreamHelper", ".", "writeStreamToTempFile", "(", "stream", ",", "\".tmp\"", ")", ";", "InputStream", "is", "=", "null", ";", ...
This could be a self-extracting archive. If we understand the format, expand it and check the content for files we can read. @param stream schedule data @return ProjectFile instance
[ "This", "could", "be", "a", "self", "-", "extracting", "archive", ".", "If", "we", "understand", "the", "format", "expand", "it", "and", "check", "the", "content", "for", "files", "we", "can", "read", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L689-L742
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.handleXerFile
private ProjectFile handleXerFile(InputStream stream) throws Exception { PrimaveraXERFileReader reader = new PrimaveraXERFileReader(); reader.setCharset(m_charset); List<ProjectFile> projects = reader.readAll(stream); ProjectFile project = null; for (ProjectFile file : projects) { if (file.getProjectProperties().getExportFlag()) { project = file; break; } } if (project == null && !projects.isEmpty()) { project = projects.get(0); } return project; }
java
private ProjectFile handleXerFile(InputStream stream) throws Exception { PrimaveraXERFileReader reader = new PrimaveraXERFileReader(); reader.setCharset(m_charset); List<ProjectFile> projects = reader.readAll(stream); ProjectFile project = null; for (ProjectFile file : projects) { if (file.getProjectProperties().getExportFlag()) { project = file; break; } } if (project == null && !projects.isEmpty()) { project = projects.get(0); } return project; }
[ "private", "ProjectFile", "handleXerFile", "(", "InputStream", "stream", ")", "throws", "Exception", "{", "PrimaveraXERFileReader", "reader", "=", "new", "PrimaveraXERFileReader", "(", ")", ";", "reader", ".", "setCharset", "(", "m_charset", ")", ";", "List", "<",...
XER files can contain multiple projects when there are cross-project dependencies. As the UniversalProjectReader is designed just to read a single project, we need to select one project from those available in the XER file. The original project selected for export by the user will have its "export flag" set to true. We'll return the first project we find where the export flag is set to true, otherwise we'll just return the first project we find in the file. @param stream schedule data @return ProjectFile instance
[ "XER", "files", "can", "contain", "multiple", "projects", "when", "there", "are", "cross", "-", "project", "dependencies", ".", "As", "the", "UniversalProjectReader", "is", "designed", "just", "to", "read", "a", "single", "project", "we", "need", "to", "select...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L755-L774
train
joniles/mpxj
src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java
UniversalProjectReader.populateTableNames
private Set<String> populateTableNames(String url) throws SQLException { Set<String> tableNames = new HashSet<String>(); Connection connection = null; ResultSet rs = null; try { connection = DriverManager.getConnection(url); DatabaseMetaData dmd = connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tableNames.add(rs.getString("TABLE_NAME").toUpperCase()); } } finally { if (rs != null) { rs.close(); } if (connection != null) { connection.close(); } } return tableNames; }
java
private Set<String> populateTableNames(String url) throws SQLException { Set<String> tableNames = new HashSet<String>(); Connection connection = null; ResultSet rs = null; try { connection = DriverManager.getConnection(url); DatabaseMetaData dmd = connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tableNames.add(rs.getString("TABLE_NAME").toUpperCase()); } } finally { if (rs != null) { rs.close(); } if (connection != null) { connection.close(); } } return tableNames; }
[ "private", "Set", "<", "String", ">", "populateTableNames", "(", "String", "url", ")", "throws", "SQLException", "{", "Set", "<", "String", ">", "tableNames", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "Connection", "connection", "=", "null"...
Open a database and build a set of table names. @param url database URL @return set containing table names
[ "Open", "a", "database", "and", "build", "a", "set", "of", "table", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/reader/UniversalProjectReader.java#L782-L813
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/StreamHelper.java
StreamHelper.skip
public static void skip(InputStream stream, long skip) throws IOException { long count = skip; while (count > 0) { count -= stream.skip(count); } }
java
public static void skip(InputStream stream, long skip) throws IOException { long count = skip; while (count > 0) { count -= stream.skip(count); } }
[ "public", "static", "void", "skip", "(", "InputStream", "stream", ",", "long", "skip", ")", "throws", "IOException", "{", "long", "count", "=", "skip", ";", "while", "(", "count", ">", "0", ")", "{", "count", "-=", "stream", ".", "skip", "(", "count", ...
The documentation for InputStream.skip indicates that it can bail out early, and not skip the requested number of bytes. I've encountered this in practice, hence this helper method. @param stream InputStream instance @param skip number of bytes to skip
[ "The", "documentation", "for", "InputStream", ".", "skip", "indicates", "that", "it", "can", "bail", "out", "early", "and", "not", "skip", "the", "requested", "number", "of", "bytes", ".", "I", "ve", "encountered", "this", "in", "practice", "hence", "this", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/StreamHelper.java#L41-L48
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP9Reader.java
MPP9Reader.processCustomValueLists
private void processCustomValueLists() throws IOException { CustomFieldValueReader9 reader = new CustomFieldValueReader9(m_projectDir, m_file.getProjectProperties(), m_projectProps, m_file.getCustomFields()); reader.process(); }
java
private void processCustomValueLists() throws IOException { CustomFieldValueReader9 reader = new CustomFieldValueReader9(m_projectDir, m_file.getProjectProperties(), m_projectProps, m_file.getCustomFields()); reader.process(); }
[ "private", "void", "processCustomValueLists", "(", ")", "throws", "IOException", "{", "CustomFieldValueReader9", "reader", "=", "new", "CustomFieldValueReader9", "(", "m_projectDir", ",", "m_file", ".", "getProjectProperties", "(", ")", ",", "m_projectProps", ",", "m_...
Retrieve any task field value lists defined in the MPP file.
[ "Retrieve", "any", "task", "field", "value", "lists", "defined", "in", "the", "MPP", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L750-L754
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP9Reader.java
MPP9Reader.processFieldNameAliases
private void processFieldNameAliases(Map<Integer, FieldType> map, byte[] data) { if (data != null) { int offset = 0; int index = 0; CustomFieldContainer fields = m_file.getCustomFields(); while (offset < data.length) { String alias = MPPUtility.getUnicodeString(data, offset); if (!alias.isEmpty()) { FieldType field = map.get(Integer.valueOf(index)); if (field != null) { fields.getCustomField(field).setAlias(alias); } } offset += (alias.length() + 1) * 2; index++; } } }
java
private void processFieldNameAliases(Map<Integer, FieldType> map, byte[] data) { if (data != null) { int offset = 0; int index = 0; CustomFieldContainer fields = m_file.getCustomFields(); while (offset < data.length) { String alias = MPPUtility.getUnicodeString(data, offset); if (!alias.isEmpty()) { FieldType field = map.get(Integer.valueOf(index)); if (field != null) { fields.getCustomField(field).setAlias(alias); } } offset += (alias.length() + 1) * 2; index++; } } }
[ "private", "void", "processFieldNameAliases", "(", "Map", "<", "Integer", ",", "FieldType", ">", "map", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "int", "offset", "=", "0", ";", "int", "index", "=", "0", ";...
Retrieve any resource field aliases defined in the MPP file. @param map index to field map @param data resource field name alias data
[ "Retrieve", "any", "resource", "field", "aliases", "defined", "in", "the", "MPP", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L864-L886
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP9Reader.java
MPP9Reader.createResourceMap
private TreeMap<Integer, Integer> createResourceMap(FieldMap fieldMap, FixedMeta rscFixedMeta, FixedData rscFixedData) { TreeMap<Integer, Integer> resourceMap = new TreeMap<Integer, Integer>(); int itemCount = rscFixedMeta.getAdjustedItemCount(); for (int loop = 0; loop < itemCount; loop++) { byte[] data = rscFixedData.getByteArrayValue(loop); if (data == null || data.length < fieldMap.getMaxFixedDataSize(0)) { continue; } Integer uniqueID = Integer.valueOf(MPPUtility.getShort(data, 0)); resourceMap.put(uniqueID, Integer.valueOf(loop)); } return (resourceMap); }
java
private TreeMap<Integer, Integer> createResourceMap(FieldMap fieldMap, FixedMeta rscFixedMeta, FixedData rscFixedData) { TreeMap<Integer, Integer> resourceMap = new TreeMap<Integer, Integer>(); int itemCount = rscFixedMeta.getAdjustedItemCount(); for (int loop = 0; loop < itemCount; loop++) { byte[] data = rscFixedData.getByteArrayValue(loop); if (data == null || data.length < fieldMap.getMaxFixedDataSize(0)) { continue; } Integer uniqueID = Integer.valueOf(MPPUtility.getShort(data, 0)); resourceMap.put(uniqueID, Integer.valueOf(loop)); } return (resourceMap); }
[ "private", "TreeMap", "<", "Integer", ",", "Integer", ">", "createResourceMap", "(", "FieldMap", "fieldMap", ",", "FixedMeta", "rscFixedMeta", ",", "FixedData", "rscFixedData", ")", "{", "TreeMap", "<", "Integer", ",", "Integer", ">", "resourceMap", "=", "new", ...
This method maps the resource unique identifiers to their index number within the FixedData block. @param fieldMap field map @param rscFixedMeta resource fixed meta data @param rscFixedData resource fixed data @return map of resource IDs to resource data
[ "This", "method", "maps", "the", "resource", "unique", "identifiers", "to", "their", "index", "number", "within", "the", "FixedData", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L986-L1004
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP9Reader.java
MPP9Reader.postProcessTasks
private void postProcessTasks() { List<Task> allTasks = m_file.getTasks(); if (allTasks.size() > 1) { Collections.sort(allTasks); int taskID = -1; int lastTaskID = -1; for (int i = 0; i < allTasks.size(); i++) { Task task = allTasks.get(i); taskID = NumberHelper.getInt(task.getID()); // In Project the tasks IDs are always contiguous so we can spot invalid tasks by making sure all // IDs are represented. if (!task.getNull() && lastTaskID != -1 && taskID > lastTaskID + 1) { // This task looks to be invalid. task.setNull(true); } else { lastTaskID = taskID; } } } }
java
private void postProcessTasks() { List<Task> allTasks = m_file.getTasks(); if (allTasks.size() > 1) { Collections.sort(allTasks); int taskID = -1; int lastTaskID = -1; for (int i = 0; i < allTasks.size(); i++) { Task task = allTasks.get(i); taskID = NumberHelper.getInt(task.getID()); // In Project the tasks IDs are always contiguous so we can spot invalid tasks by making sure all // IDs are represented. if (!task.getNull() && lastTaskID != -1 && taskID > lastTaskID + 1) { // This task looks to be invalid. task.setNull(true); } else { lastTaskID = taskID; } } } }
[ "private", "void", "postProcessTasks", "(", ")", "{", "List", "<", "Task", ">", "allTasks", "=", "m_file", ".", "getTasks", "(", ")", ";", "if", "(", "allTasks", ".", "size", "(", ")", ">", "1", ")", "{", "Collections", ".", "sort", "(", "allTasks", ...
This method is called to try to catch any invalid tasks that may have sneaked past all our other checks. This is done by validating the tasks by task ID.
[ "This", "method", "is", "called", "to", "try", "to", "catch", "any", "invalid", "tasks", "that", "may", "have", "sneaked", "past", "all", "our", "other", "checks", ".", "This", "is", "done", "by", "validating", "the", "tasks", "by", "task", "ID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP9Reader.java#L2050-L2077
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/TaskDateDump.java
TaskDateDump.process
public void process(String name) throws Exception { ProjectFile file = new UniversalProjectReader().read(name); for (Task task : file.getTasks()) { if (!task.getSummary()) { System.out.print(task.getWBS()); System.out.print("\t"); System.out.print(task.getName()); System.out.print("\t"); System.out.print(format(task.getStart())); System.out.print("\t"); System.out.print(format(task.getActualStart())); System.out.print("\t"); System.out.print(format(task.getFinish())); System.out.print("\t"); System.out.print(format(task.getActualFinish())); System.out.println(); } } }
java
public void process(String name) throws Exception { ProjectFile file = new UniversalProjectReader().read(name); for (Task task : file.getTasks()) { if (!task.getSummary()) { System.out.print(task.getWBS()); System.out.print("\t"); System.out.print(task.getName()); System.out.print("\t"); System.out.print(format(task.getStart())); System.out.print("\t"); System.out.print(format(task.getActualStart())); System.out.print("\t"); System.out.print(format(task.getFinish())); System.out.print("\t"); System.out.print(format(task.getActualFinish())); System.out.println(); } } }
[ "public", "void", "process", "(", "String", "name", ")", "throws", "Exception", "{", "ProjectFile", "file", "=", "new", "UniversalProjectReader", "(", ")", ".", "read", "(", "name", ")", ";", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(",...
Dump data for all non-summary tasks to stdout. @param name file name
[ "Dump", "data", "for", "all", "non", "-", "summary", "tasks", "to", "stdout", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/TaskDateDump.java#L73-L94
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readProjectProperties
private void readProjectProperties(Document cdp) { WorkspaceProperties props = cdp.getWorkspaceProperties(); ProjectProperties mpxjProps = m_projectFile.getProjectProperties(); mpxjProps.setSymbolPosition(props.getCurrencyPosition()); mpxjProps.setCurrencyDigits(props.getCurrencyDigits()); mpxjProps.setCurrencySymbol(props.getCurrencySymbol()); mpxjProps.setDaysPerMonth(props.getDaysPerMonth()); mpxjProps.setMinutesPerDay(props.getHoursPerDay()); mpxjProps.setMinutesPerWeek(props.getHoursPerWeek()); m_workHoursPerDay = mpxjProps.getMinutesPerDay().doubleValue() / 60.0; }
java
private void readProjectProperties(Document cdp) { WorkspaceProperties props = cdp.getWorkspaceProperties(); ProjectProperties mpxjProps = m_projectFile.getProjectProperties(); mpxjProps.setSymbolPosition(props.getCurrencyPosition()); mpxjProps.setCurrencyDigits(props.getCurrencyDigits()); mpxjProps.setCurrencySymbol(props.getCurrencySymbol()); mpxjProps.setDaysPerMonth(props.getDaysPerMonth()); mpxjProps.setMinutesPerDay(props.getHoursPerDay()); mpxjProps.setMinutesPerWeek(props.getHoursPerWeek()); m_workHoursPerDay = mpxjProps.getMinutesPerDay().doubleValue() / 60.0; }
[ "private", "void", "readProjectProperties", "(", "Document", "cdp", ")", "{", "WorkspaceProperties", "props", "=", "cdp", ".", "getWorkspaceProperties", "(", ")", ";", "ProjectProperties", "mpxjProps", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";"...
Extracts project properties from a ConceptDraw PROJECT file. @param cdp ConceptDraw PROJECT file
[ "Extracts", "project", "properties", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L184-L196
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readCalendars
private void readCalendars(Document cdp) { for (Calendar calendar : cdp.getCalendars().getCalendar()) { readCalendar(calendar); } for (Calendar calendar : cdp.getCalendars().getCalendar()) { ProjectCalendar child = m_calendarMap.get(calendar.getID()); ProjectCalendar parent = m_calendarMap.get(calendar.getBaseCalendarID()); if (parent == null) { m_projectFile.setDefaultCalendar(child); } else { child.setParent(parent); } } }
java
private void readCalendars(Document cdp) { for (Calendar calendar : cdp.getCalendars().getCalendar()) { readCalendar(calendar); } for (Calendar calendar : cdp.getCalendars().getCalendar()) { ProjectCalendar child = m_calendarMap.get(calendar.getID()); ProjectCalendar parent = m_calendarMap.get(calendar.getBaseCalendarID()); if (parent == null) { m_projectFile.setDefaultCalendar(child); } else { child.setParent(parent); } } }
[ "private", "void", "readCalendars", "(", "Document", "cdp", ")", "{", "for", "(", "Calendar", "calendar", ":", "cdp", ".", "getCalendars", "(", ")", ".", "getCalendar", "(", ")", ")", "{", "readCalendar", "(", "calendar", ")", ";", "}", "for", "(", "Ca...
Extracts calendar data from a ConceptDraw PROJECT file. @param cdp ConceptDraw PROJECT file
[ "Extracts", "calendar", "data", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L203-L223
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readWeekDay
private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
java
private void readWeekDay(ProjectCalendar mpxjCalendar, WeekDay day) { if (day.isIsDayWorking()) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day.getDay()); for (Document.Calendars.Calendar.WeekDays.WeekDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { hours.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
[ "private", "void", "readWeekDay", "(", "ProjectCalendar", "mpxjCalendar", ",", "WeekDay", "day", ")", "{", "if", "(", "day", ".", "isIsDayWorking", "(", ")", ")", "{", "ProjectCalendarHours", "hours", "=", "mpxjCalendar", ".", "addCalendarHours", "(", "day", "...
Reads a single day for a calendar. @param mpxjCalendar ProjectCalendar instance @param day ConceptDraw PROJECT week day
[ "Reads", "a", "single", "day", "for", "a", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L253-L263
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readExceptionDay
private void readExceptionDay(ProjectCalendar mpxjCalendar, ExceptedDay day) { ProjectCalendarException mpxjException = mpxjCalendar.addCalendarException(day.getDate(), day.getDate()); if (day.isIsDayWorking()) { for (Document.Calendars.Calendar.ExceptedDays.ExceptedDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { mpxjException.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
java
private void readExceptionDay(ProjectCalendar mpxjCalendar, ExceptedDay day) { ProjectCalendarException mpxjException = mpxjCalendar.addCalendarException(day.getDate(), day.getDate()); if (day.isIsDayWorking()) { for (Document.Calendars.Calendar.ExceptedDays.ExceptedDay.TimePeriods.TimePeriod period : day.getTimePeriods().getTimePeriod()) { mpxjException.addRange(new DateRange(period.getFrom(), period.getTo())); } } }
[ "private", "void", "readExceptionDay", "(", "ProjectCalendar", "mpxjCalendar", ",", "ExceptedDay", "day", ")", "{", "ProjectCalendarException", "mpxjException", "=", "mpxjCalendar", ".", "addCalendarException", "(", "day", ".", "getDate", "(", ")", ",", "day", ".", ...
Read an exception day for a calendar. @param mpxjCalendar ProjectCalendar instance @param day ConceptDraw PROJECT exception day
[ "Read", "an", "exception", "day", "for", "a", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L271-L281
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readResources
private void readResources(Document cdp) { for (Document.Resources.Resource resource : cdp.getResources().getResource()) { readResource(resource); } }
java
private void readResources(Document cdp) { for (Document.Resources.Resource resource : cdp.getResources().getResource()) { readResource(resource); } }
[ "private", "void", "readResources", "(", "Document", "cdp", ")", "{", "for", "(", "Document", ".", "Resources", ".", "Resource", "resource", ":", "cdp", ".", "getResources", "(", ")", ".", "getResource", "(", ")", ")", "{", "readResource", "(", "resource",...
Reads resource data from a ConceptDraw PROJECT file. @param cdp ConceptDraw PROJECT file
[ "Reads", "resource", "data", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L288-L294
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readResource
private void readResource(Document.Resources.Resource resource) { Resource mpxjResource = m_projectFile.addResource(); mpxjResource.setName(resource.getName()); mpxjResource.setResourceCalendar(m_calendarMap.get(resource.getCalendarID())); mpxjResource.setStandardRate(new Rate(resource.getCost(), resource.getCostTimeUnit())); mpxjResource.setEmailAddress(resource.getEMail()); mpxjResource.setGroup(resource.getGroup()); //resource.getHyperlinks() mpxjResource.setUniqueID(resource.getID()); //resource.getMarkerID() mpxjResource.setNotes(resource.getNote()); mpxjResource.setID(Integer.valueOf(resource.getOutlineNumber())); //resource.getStyleProject() mpxjResource.setType(resource.getSubType() == null ? resource.getType() : resource.getSubType()); }
java
private void readResource(Document.Resources.Resource resource) { Resource mpxjResource = m_projectFile.addResource(); mpxjResource.setName(resource.getName()); mpxjResource.setResourceCalendar(m_calendarMap.get(resource.getCalendarID())); mpxjResource.setStandardRate(new Rate(resource.getCost(), resource.getCostTimeUnit())); mpxjResource.setEmailAddress(resource.getEMail()); mpxjResource.setGroup(resource.getGroup()); //resource.getHyperlinks() mpxjResource.setUniqueID(resource.getID()); //resource.getMarkerID() mpxjResource.setNotes(resource.getNote()); mpxjResource.setID(Integer.valueOf(resource.getOutlineNumber())); //resource.getStyleProject() mpxjResource.setType(resource.getSubType() == null ? resource.getType() : resource.getSubType()); }
[ "private", "void", "readResource", "(", "Document", ".", "Resources", ".", "Resource", "resource", ")", "{", "Resource", "mpxjResource", "=", "m_projectFile", ".", "addResource", "(", ")", ";", "mpxjResource", ".", "setName", "(", "resource", ".", "getName", "...
Reads a single resource from a ConceptDraw PROJECT file. @param resource ConceptDraw PROJECT resource
[ "Reads", "a", "single", "resource", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L301-L316
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readTasks
private void readTasks(Document cdp) { // // Sort the projects into the correct order // List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(projects, new Comparator<Project>() { @Override public int compare(Project o1, Project o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); for (Project project : cdp.getProjects().getProject()) { readProject(project); } }
java
private void readTasks(Document cdp) { // // Sort the projects into the correct order // List<Project> projects = new ArrayList<Project>(cdp.getProjects().getProject()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(projects, new Comparator<Project>() { @Override public int compare(Project o1, Project o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); for (Project project : cdp.getProjects().getProject()) { readProject(project); } }
[ "private", "void", "readTasks", "(", "Document", "cdp", ")", "{", "//", "// Sort the projects into the correct order", "//", "List", "<", "Project", ">", "projects", "=", "new", "ArrayList", "<", "Project", ">", "(", "cdp", ".", "getProjects", "(", ")", ".", ...
Read the projects from a ConceptDraw PROJECT file as top level tasks. @param cdp ConceptDraw PROJECT file
[ "Read", "the", "projects", "from", "a", "ConceptDraw", "PROJECT", "file", "as", "top", "level", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L323-L343
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readProject
private void readProject(Project project) { Task mpxjTask = m_projectFile.addTask(); //project.getAuthor() mpxjTask.setBaselineCost(project.getBaselineCost()); mpxjTask.setBaselineFinish(project.getBaselineFinishDate()); mpxjTask.setBaselineStart(project.getBaselineStartDate()); //project.getBudget(); //project.getCompany() mpxjTask.setFinish(project.getFinishDate()); //project.getGoal() //project.getHyperlinks() //project.getMarkerID() mpxjTask.setName(project.getName()); mpxjTask.setNotes(project.getNote()); mpxjTask.setPriority(project.getPriority()); // project.getSite() mpxjTask.setStart(project.getStartDate()); // project.getStyleProject() // project.getTask() // project.getTimeScale() // project.getViewProperties() String projectIdentifier = project.getID().toString(); mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes())); // // Sort the tasks into the correct order // List<Document.Projects.Project.Task> tasks = new ArrayList<Document.Projects.Project.Task>(project.getTask()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>() { @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); Map<String, Task> map = new HashMap<String, Task>(); map.put("", mpxjTask); for (Document.Projects.Project.Task task : tasks) { readTask(projectIdentifier, map, task); } }
java
private void readProject(Project project) { Task mpxjTask = m_projectFile.addTask(); //project.getAuthor() mpxjTask.setBaselineCost(project.getBaselineCost()); mpxjTask.setBaselineFinish(project.getBaselineFinishDate()); mpxjTask.setBaselineStart(project.getBaselineStartDate()); //project.getBudget(); //project.getCompany() mpxjTask.setFinish(project.getFinishDate()); //project.getGoal() //project.getHyperlinks() //project.getMarkerID() mpxjTask.setName(project.getName()); mpxjTask.setNotes(project.getNote()); mpxjTask.setPriority(project.getPriority()); // project.getSite() mpxjTask.setStart(project.getStartDate()); // project.getStyleProject() // project.getTask() // project.getTimeScale() // project.getViewProperties() String projectIdentifier = project.getID().toString(); mpxjTask.setGUID(UUID.nameUUIDFromBytes(projectIdentifier.getBytes())); // // Sort the tasks into the correct order // List<Document.Projects.Project.Task> tasks = new ArrayList<Document.Projects.Project.Task>(project.getTask()); final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(tasks, new Comparator<Document.Projects.Project.Task>() { @Override public int compare(Document.Projects.Project.Task o1, Document.Projects.Project.Task o2) { return comparator.compare(o1.getOutlineNumber(), o2.getOutlineNumber()); } }); Map<String, Task> map = new HashMap<String, Task>(); map.put("", mpxjTask); for (Document.Projects.Project.Task task : tasks) { readTask(projectIdentifier, map, task); } }
[ "private", "void", "readProject", "(", "Project", "project", ")", "{", "Task", "mpxjTask", "=", "m_projectFile", ".", "addTask", "(", ")", ";", "//project.getAuthor()", "mpxjTask", ".", "setBaselineCost", "(", "project", ".", "getBaselineCost", "(", ")", ")", ...
Read a project from a ConceptDraw PROJECT file. @param project ConceptDraw PROJECT project
[ "Read", "a", "project", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L350-L397
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readTask
private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task) { Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber())); Task mpxjTask = parentTask.addTask(); TimeUnit units = task.getBaseDurationTimeUnit(); mpxjTask.setCost(task.getActualCost()); mpxjTask.setDuration(getDuration(units, task.getActualDuration())); mpxjTask.setFinish(task.getActualFinishDate()); mpxjTask.setStart(task.getActualStartDate()); mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration())); mpxjTask.setBaselineFinish(task.getBaseFinishDate()); mpxjTask.setBaselineCost(task.getBaselineCost()); // task.getBaselineFinishDate() // task.getBaselineFinishTemplateOffset() // task.getBaselineStartDate() // task.getBaselineStartTemplateOffset() mpxjTask.setBaselineStart(task.getBaseStartDate()); // task.getCallouts() mpxjTask.setPercentageComplete(task.getComplete()); mpxjTask.setDeadline(task.getDeadlineDate()); // task.getDeadlineTemplateOffset() // task.getHyperlinks() // task.getMarkerID() mpxjTask.setName(task.getName()); mpxjTask.setNotes(task.getNote()); mpxjTask.setPriority(task.getPriority()); // task.getRecalcBase1() // task.getRecalcBase2() mpxjTask.setType(task.getSchedulingType()); // task.getStyleProject() // task.getTemplateOffset() // task.getValidatedByProject() if (task.isIsMilestone()) { mpxjTask.setMilestone(true); mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS)); mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS)); } String taskIdentifier = projectIdentifier + "." + task.getID(); m_taskIdMap.put(task.getID(), mpxjTask); mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes())); map.put(task.getOutlineNumber(), mpxjTask); for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment()) { readResourceAssignment(mpxjTask, assignment); } }
java
private void readTask(String projectIdentifier, Map<String, Task> map, Document.Projects.Project.Task task) { Task parentTask = map.get(getParentOutlineNumber(task.getOutlineNumber())); Task mpxjTask = parentTask.addTask(); TimeUnit units = task.getBaseDurationTimeUnit(); mpxjTask.setCost(task.getActualCost()); mpxjTask.setDuration(getDuration(units, task.getActualDuration())); mpxjTask.setFinish(task.getActualFinishDate()); mpxjTask.setStart(task.getActualStartDate()); mpxjTask.setBaselineDuration(getDuration(units, task.getBaseDuration())); mpxjTask.setBaselineFinish(task.getBaseFinishDate()); mpxjTask.setBaselineCost(task.getBaselineCost()); // task.getBaselineFinishDate() // task.getBaselineFinishTemplateOffset() // task.getBaselineStartDate() // task.getBaselineStartTemplateOffset() mpxjTask.setBaselineStart(task.getBaseStartDate()); // task.getCallouts() mpxjTask.setPercentageComplete(task.getComplete()); mpxjTask.setDeadline(task.getDeadlineDate()); // task.getDeadlineTemplateOffset() // task.getHyperlinks() // task.getMarkerID() mpxjTask.setName(task.getName()); mpxjTask.setNotes(task.getNote()); mpxjTask.setPriority(task.getPriority()); // task.getRecalcBase1() // task.getRecalcBase2() mpxjTask.setType(task.getSchedulingType()); // task.getStyleProject() // task.getTemplateOffset() // task.getValidatedByProject() if (task.isIsMilestone()) { mpxjTask.setMilestone(true); mpxjTask.setDuration(Duration.getInstance(0, TimeUnit.HOURS)); mpxjTask.setBaselineDuration(Duration.getInstance(0, TimeUnit.HOURS)); } String taskIdentifier = projectIdentifier + "." + task.getID(); m_taskIdMap.put(task.getID(), mpxjTask); mpxjTask.setGUID(UUID.nameUUIDFromBytes(taskIdentifier.getBytes())); map.put(task.getOutlineNumber(), mpxjTask); for (Document.Projects.Project.Task.ResourceAssignments.ResourceAssignment assignment : task.getResourceAssignments().getResourceAssignment()) { readResourceAssignment(mpxjTask, assignment); } }
[ "private", "void", "readTask", "(", "String", "projectIdentifier", ",", "Map", "<", "String", ",", "Task", ">", "map", ",", "Document", ".", "Projects", ".", "Project", ".", "Task", "task", ")", "{", "Task", "parentTask", "=", "map", ".", "get", "(", "...
Read a task from a ConceptDraw PROJECT file. @param projectIdentifier parent project identifier @param map outline number to task map @param task ConceptDraw PROJECT task
[ "Read", "a", "task", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L406-L458
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readRelationships
private void readRelationships(Document cdp) { for (Link link : cdp.getLinks().getLink()) { readRelationship(link); } }
java
private void readRelationships(Document cdp) { for (Link link : cdp.getLinks().getLink()) { readRelationship(link); } }
[ "private", "void", "readRelationships", "(", "Document", "cdp", ")", "{", "for", "(", "Link", "link", ":", "cdp", ".", "getLinks", "(", ")", ".", "getLink", "(", ")", ")", "{", "readRelationship", "(", "link", ")", ";", "}", "}" ]
Read all task relationships from a ConceptDraw PROJECT file. @param cdp ConceptDraw PROJECT file
[ "Read", "all", "task", "relationships", "from", "a", "ConceptDraw", "PROJECT", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L483-L489
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.readRelationship
private void readRelationship(Link link) { Task sourceTask = m_taskIdMap.get(link.getSourceTaskID()); Task destinationTask = m_taskIdMap.get(link.getDestinationTaskID()); if (sourceTask != null && destinationTask != null) { Duration lag = getDuration(link.getLagUnit(), link.getLag()); RelationType type = link.getType(); Relation relation = destinationTask.addPredecessor(sourceTask, type, lag); relation.setUniqueID(link.getID()); } }
java
private void readRelationship(Link link) { Task sourceTask = m_taskIdMap.get(link.getSourceTaskID()); Task destinationTask = m_taskIdMap.get(link.getDestinationTaskID()); if (sourceTask != null && destinationTask != null) { Duration lag = getDuration(link.getLagUnit(), link.getLag()); RelationType type = link.getType(); Relation relation = destinationTask.addPredecessor(sourceTask, type, lag); relation.setUniqueID(link.getID()); } }
[ "private", "void", "readRelationship", "(", "Link", "link", ")", "{", "Task", "sourceTask", "=", "m_taskIdMap", ".", "get", "(", "link", ".", "getSourceTaskID", "(", ")", ")", ";", "Task", "destinationTask", "=", "m_taskIdMap", ".", "get", "(", "link", "."...
Read a task relationship. @param link ConceptDraw PROJECT task link
[ "Read", "a", "task", "relationship", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L496-L507
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.getDuration
private Duration getDuration(TimeUnit units, Double duration) { Duration result = null; if (duration != null) { double durationValue = duration.doubleValue() * 100.0; switch (units) { case MINUTES: { durationValue *= MINUTES_PER_DAY; break; } case HOURS: { durationValue *= HOURS_PER_DAY; break; } case DAYS: { durationValue *= 3.0; break; } case WEEKS: { durationValue *= 0.6; break; } case MONTHS: { durationValue *= 0.15; break; } default: { throw new IllegalArgumentException("Unsupported time units " + units); } } durationValue = Math.round(durationValue) / 100.0; result = Duration.getInstance(durationValue, units); } return result; }
java
private Duration getDuration(TimeUnit units, Double duration) { Duration result = null; if (duration != null) { double durationValue = duration.doubleValue() * 100.0; switch (units) { case MINUTES: { durationValue *= MINUTES_PER_DAY; break; } case HOURS: { durationValue *= HOURS_PER_DAY; break; } case DAYS: { durationValue *= 3.0; break; } case WEEKS: { durationValue *= 0.6; break; } case MONTHS: { durationValue *= 0.15; break; } default: { throw new IllegalArgumentException("Unsupported time units " + units); } } durationValue = Math.round(durationValue) / 100.0; result = Duration.getInstance(durationValue, units); } return result; }
[ "private", "Duration", "getDuration", "(", "TimeUnit", "units", ",", "Double", "duration", ")", "{", "Duration", "result", "=", "null", ";", "if", "(", "duration", "!=", "null", ")", "{", "double", "durationValue", "=", "duration", ".", "doubleValue", "(", ...
Read a duration. @param units duration units @param duration duration value @return Duration instance
[ "Read", "a", "duration", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L516-L567
train
joniles/mpxj
src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java
ConceptDrawProjectReader.getParentOutlineNumber
private String getParentOutlineNumber(String outlineNumber) { String result; int index = outlineNumber.lastIndexOf('.'); if (index == -1) { result = ""; } else { result = outlineNumber.substring(0, index); } return result; }
java
private String getParentOutlineNumber(String outlineNumber) { String result; int index = outlineNumber.lastIndexOf('.'); if (index == -1) { result = ""; } else { result = outlineNumber.substring(0, index); } return result; }
[ "private", "String", "getParentOutlineNumber", "(", "String", "outlineNumber", ")", "{", "String", "result", ";", "int", "index", "=", "outlineNumber", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "result", "...
Return the parent outline number, or an empty string if we have a root task. @param outlineNumber child outline number @return parent outline number
[ "Return", "the", "parent", "outline", "number", "or", "an", "empty", "string", "if", "we", "have", "a", "root", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/ConceptDrawProjectReader.java#L576-L589
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/MPPConstraintField.java
MPPConstraintField.getInstance
public static ConstraintField getInstance(int value) { ConstraintField result = null; if (value >= 0 && value < FIELD_ARRAY.length) { result = FIELD_ARRAY[value]; } return (result); }
java
public static ConstraintField getInstance(int value) { ConstraintField result = null; if (value >= 0 && value < FIELD_ARRAY.length) { result = FIELD_ARRAY[value]; } return (result); }
[ "public", "static", "ConstraintField", "getInstance", "(", "int", "value", ")", "{", "ConstraintField", "result", "=", "null", ";", "if", "(", "value", ">=", "0", "&&", "value", "<", "FIELD_ARRAY", ".", "length", ")", "{", "result", "=", "FIELD_ARRAY", "["...
Retrieve an instance of the ConstraintField class based on the data read from an MS Project file. @param value value from an MS Project file @return ConstraintField instance
[ "Retrieve", "an", "instance", "of", "the", "ConstraintField", "class", "based", "on", "the", "data", "read", "from", "an", "MS", "Project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/MPPConstraintField.java#L44-L54
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.update
public void update() { ProjectProperties properties = m_projectFile.getProjectProperties(); char decimalSeparator = properties.getDecimalSeparator(); char thousandsSeparator = properties.getThousandsSeparator(); m_unitsDecimalFormat.applyPattern("#.##", null, decimalSeparator, thousandsSeparator); m_decimalFormat.applyPattern("0.00#", null, decimalSeparator, thousandsSeparator); m_durationDecimalFormat.applyPattern("#.##", null, decimalSeparator, thousandsSeparator); m_percentageDecimalFormat.applyPattern("##0.##", null, decimalSeparator, thousandsSeparator); updateCurrencyFormats(properties, decimalSeparator, thousandsSeparator); updateDateTimeFormats(properties); }
java
public void update() { ProjectProperties properties = m_projectFile.getProjectProperties(); char decimalSeparator = properties.getDecimalSeparator(); char thousandsSeparator = properties.getThousandsSeparator(); m_unitsDecimalFormat.applyPattern("#.##", null, decimalSeparator, thousandsSeparator); m_decimalFormat.applyPattern("0.00#", null, decimalSeparator, thousandsSeparator); m_durationDecimalFormat.applyPattern("#.##", null, decimalSeparator, thousandsSeparator); m_percentageDecimalFormat.applyPattern("##0.##", null, decimalSeparator, thousandsSeparator); updateCurrencyFormats(properties, decimalSeparator, thousandsSeparator); updateDateTimeFormats(properties); }
[ "public", "void", "update", "(", ")", "{", "ProjectProperties", "properties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "char", "decimalSeparator", "=", "properties", ".", "getDecimalSeparator", "(", ")", ";", "char", "thousandsSeparator", ...
Called to update the cached formats when something changes.
[ "Called", "to", "update", "the", "cached", "formats", "when", "something", "changes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L62-L73
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.updateCurrencyFormats
private void updateCurrencyFormats(ProjectProperties properties, char decimalSeparator, char thousandsSeparator) { String prefix = ""; String suffix = ""; String currencySymbol = quoteFormatCharacters(properties.getCurrencySymbol()); switch (properties.getSymbolPosition()) { case AFTER: { suffix = currencySymbol; break; } case BEFORE: { prefix = currencySymbol; break; } case AFTER_WITH_SPACE: { suffix = " " + currencySymbol; break; } case BEFORE_WITH_SPACE: { prefix = currencySymbol + " "; break; } } StringBuilder pattern = new StringBuilder(prefix); pattern.append("#0"); int digits = properties.getCurrencyDigits().intValue(); if (digits > 0) { pattern.append('.'); for (int i = 0; i < digits; i++) { pattern.append("0"); } } pattern.append(suffix); String primaryPattern = pattern.toString(); String[] alternativePatterns = new String[7]; alternativePatterns[0] = primaryPattern + ";(" + primaryPattern + ")"; pattern.insert(prefix.length(), "#,#"); String secondaryPattern = pattern.toString(); alternativePatterns[1] = secondaryPattern; alternativePatterns[2] = secondaryPattern + ";(" + secondaryPattern + ")"; pattern.setLength(0); pattern.append("#0"); if (digits > 0) { pattern.append('.'); for (int i = 0; i < digits; i++) { pattern.append("0"); } } String noSymbolPrimaryPattern = pattern.toString(); alternativePatterns[3] = noSymbolPrimaryPattern; alternativePatterns[4] = noSymbolPrimaryPattern + ";(" + noSymbolPrimaryPattern + ")"; pattern.insert(0, "#,#"); String noSymbolSecondaryPattern = pattern.toString(); alternativePatterns[5] = noSymbolSecondaryPattern; alternativePatterns[6] = noSymbolSecondaryPattern + ";(" + noSymbolSecondaryPattern + ")"; m_currencyFormat.applyPattern(primaryPattern, alternativePatterns, decimalSeparator, thousandsSeparator); }
java
private void updateCurrencyFormats(ProjectProperties properties, char decimalSeparator, char thousandsSeparator) { String prefix = ""; String suffix = ""; String currencySymbol = quoteFormatCharacters(properties.getCurrencySymbol()); switch (properties.getSymbolPosition()) { case AFTER: { suffix = currencySymbol; break; } case BEFORE: { prefix = currencySymbol; break; } case AFTER_WITH_SPACE: { suffix = " " + currencySymbol; break; } case BEFORE_WITH_SPACE: { prefix = currencySymbol + " "; break; } } StringBuilder pattern = new StringBuilder(prefix); pattern.append("#0"); int digits = properties.getCurrencyDigits().intValue(); if (digits > 0) { pattern.append('.'); for (int i = 0; i < digits; i++) { pattern.append("0"); } } pattern.append(suffix); String primaryPattern = pattern.toString(); String[] alternativePatterns = new String[7]; alternativePatterns[0] = primaryPattern + ";(" + primaryPattern + ")"; pattern.insert(prefix.length(), "#,#"); String secondaryPattern = pattern.toString(); alternativePatterns[1] = secondaryPattern; alternativePatterns[2] = secondaryPattern + ";(" + secondaryPattern + ")"; pattern.setLength(0); pattern.append("#0"); if (digits > 0) { pattern.append('.'); for (int i = 0; i < digits; i++) { pattern.append("0"); } } String noSymbolPrimaryPattern = pattern.toString(); alternativePatterns[3] = noSymbolPrimaryPattern; alternativePatterns[4] = noSymbolPrimaryPattern + ";(" + noSymbolPrimaryPattern + ")"; pattern.insert(0, "#,#"); String noSymbolSecondaryPattern = pattern.toString(); alternativePatterns[5] = noSymbolSecondaryPattern; alternativePatterns[6] = noSymbolSecondaryPattern + ";(" + noSymbolSecondaryPattern + ")"; m_currencyFormat.applyPattern(primaryPattern, alternativePatterns, decimalSeparator, thousandsSeparator); }
[ "private", "void", "updateCurrencyFormats", "(", "ProjectProperties", "properties", ",", "char", "decimalSeparator", ",", "char", "thousandsSeparator", ")", "{", "String", "prefix", "=", "\"\"", ";", "String", "suffix", "=", "\"\"", ";", "String", "currencySymbol", ...
Update the currency format. @param properties project properties @param decimalSeparator decimal separator @param thousandsSeparator thousands separator
[ "Update", "the", "currency", "format", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L82-L160
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.quoteFormatCharacters
private String quoteFormatCharacters(String literal) { StringBuilder sb = new StringBuilder(); int length = literal.length(); char c; for (int loop = 0; loop < length; loop++) { c = literal.charAt(loop); switch (c) { case '0': case '#': case '.': case '-': case ',': case 'E': case ';': case '%': { sb.append("'"); sb.append(c); sb.append("'"); break; } default: { sb.append(c); break; } } } return (sb.toString()); }
java
private String quoteFormatCharacters(String literal) { StringBuilder sb = new StringBuilder(); int length = literal.length(); char c; for (int loop = 0; loop < length; loop++) { c = literal.charAt(loop); switch (c) { case '0': case '#': case '.': case '-': case ',': case 'E': case ';': case '%': { sb.append("'"); sb.append(c); sb.append("'"); break; } default: { sb.append(c); break; } } } return (sb.toString()); }
[ "private", "String", "quoteFormatCharacters", "(", "String", "literal", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "int", "length", "=", "literal", ".", "length", "(", ")", ";", "char", "c", ";", "for", "(", "int", "loop...
This method is used to quote any special characters that appear in literal text that is required as part of the currency format. @param literal Literal text @return literal text with special characters in quotes
[ "This", "method", "is", "used", "to", "quote", "any", "special", "characters", "that", "appear", "in", "literal", "text", "that", "is", "required", "as", "part", "of", "the", "currency", "format", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L169-L204
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.updateDateTimeFormats
private void updateDateTimeFormats(ProjectProperties properties) { String[] timePatterns = getTimePatterns(properties); String[] datePatterns = getDatePatterns(properties); String[] dateTimePatterns = getDateTimePatterns(properties, timePatterns); m_dateTimeFormat.applyPatterns(dateTimePatterns); m_dateFormat.applyPatterns(datePatterns); m_timeFormat.applyPatterns(timePatterns); m_dateTimeFormat.setLocale(m_locale); m_dateFormat.setLocale(m_locale); m_dateTimeFormat.setNullText(m_nullText); m_dateFormat.setNullText(m_nullText); m_timeFormat.setNullText(m_nullText); m_dateTimeFormat.setAmPmText(properties.getAMText(), properties.getPMText()); m_timeFormat.setAmPmText(properties.getAMText(), properties.getPMText()); }
java
private void updateDateTimeFormats(ProjectProperties properties) { String[] timePatterns = getTimePatterns(properties); String[] datePatterns = getDatePatterns(properties); String[] dateTimePatterns = getDateTimePatterns(properties, timePatterns); m_dateTimeFormat.applyPatterns(dateTimePatterns); m_dateFormat.applyPatterns(datePatterns); m_timeFormat.applyPatterns(timePatterns); m_dateTimeFormat.setLocale(m_locale); m_dateFormat.setLocale(m_locale); m_dateTimeFormat.setNullText(m_nullText); m_dateFormat.setNullText(m_nullText); m_timeFormat.setNullText(m_nullText); m_dateTimeFormat.setAmPmText(properties.getAMText(), properties.getPMText()); m_timeFormat.setAmPmText(properties.getAMText(), properties.getPMText()); }
[ "private", "void", "updateDateTimeFormats", "(", "ProjectProperties", "properties", ")", "{", "String", "[", "]", "timePatterns", "=", "getTimePatterns", "(", "properties", ")", ";", "String", "[", "]", "datePatterns", "=", "getDatePatterns", "(", "properties", ")...
Updates the date and time formats. @param properties project properties
[ "Updates", "the", "date", "and", "time", "formats", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L211-L230
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.getDatePatterns
private String[] getDatePatterns(ProjectProperties properties) { String pattern = ""; char datesep = properties.getDateSeparator(); DateOrder dateOrder = properties.getDateOrder(); switch (dateOrder) { case DMY: { pattern = "dd" + datesep + "MM" + datesep + "yy"; break; } case MDY: { pattern = "MM" + datesep + "dd" + datesep + "yy"; break; } case YMD: { pattern = "yy" + datesep + "MM" + datesep + "dd"; break; } } return new String[] { pattern }; }
java
private String[] getDatePatterns(ProjectProperties properties) { String pattern = ""; char datesep = properties.getDateSeparator(); DateOrder dateOrder = properties.getDateOrder(); switch (dateOrder) { case DMY: { pattern = "dd" + datesep + "MM" + datesep + "yy"; break; } case MDY: { pattern = "MM" + datesep + "dd" + datesep + "yy"; break; } case YMD: { pattern = "yy" + datesep + "MM" + datesep + "dd"; break; } } return new String[] { pattern }; }
[ "private", "String", "[", "]", "getDatePatterns", "(", "ProjectProperties", "properties", ")", "{", "String", "pattern", "=", "\"\"", ";", "char", "datesep", "=", "properties", ".", "getDateSeparator", "(", ")", ";", "DateOrder", "dateOrder", "=", "properties", ...
Generate date patterns based on the project configuration. @param properties project properties @return date patterns
[ "Generate", "date", "patterns", "based", "on", "the", "project", "configuration", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L238-L270
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJFormats.java
MPXJFormats.generateDateTimePatterns
private List<String> generateDateTimePatterns(String datePattern, String[] timePatterns) { List<String> patterns = new ArrayList<String>(); for (String timePattern : timePatterns) { patterns.add(datePattern + " " + timePattern); } // Always fall back on the date-only pattern patterns.add(datePattern); return patterns; }
java
private List<String> generateDateTimePatterns(String datePattern, String[] timePatterns) { List<String> patterns = new ArrayList<String>(); for (String timePattern : timePatterns) { patterns.add(datePattern + " " + timePattern); } // Always fall back on the date-only pattern patterns.add(datePattern); return patterns; }
[ "private", "List", "<", "String", ">", "generateDateTimePatterns", "(", "String", "datePattern", ",", "String", "[", "]", "timePatterns", ")", "{", "List", "<", "String", ">", "patterns", "=", "new", "ArrayList", "<", "String", ">", "(", ")", ";", "for", ...
Generate a set of datetime patterns to accommodate variations in MPX files. @param datePattern date pattern element @param timePatterns time patterns @return datetime patterns
[ "Generate", "a", "set", "of", "datetime", "patterns", "to", "accommodate", "variations", "in", "MPX", "files", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJFormats.java#L680-L692
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AbstractVarMeta.java
AbstractVarMeta.getUniqueIdentifierArray
@Override public Integer[] getUniqueIdentifierArray() { Integer[] result = new Integer[m_table.size()]; int index = 0; for (Integer value : m_table.keySet()) { result[index] = value; ++index; } return (result); }
java
@Override public Integer[] getUniqueIdentifierArray() { Integer[] result = new Integer[m_table.size()]; int index = 0; for (Integer value : m_table.keySet()) { result[index] = value; ++index; } return (result); }
[ "@", "Override", "public", "Integer", "[", "]", "getUniqueIdentifierArray", "(", ")", "{", "Integer", "[", "]", "result", "=", "new", "Integer", "[", "m_table", ".", "size", "(", ")", "]", ";", "int", "index", "=", "0", ";", "for", "(", "Integer", "v...
This method returns an array containing all of the unique identifiers for which data has been stored in the Var2Data block. @return array of unique identifiers
[ "This", "method", "returns", "an", "array", "containing", "all", "of", "the", "unique", "identifiers", "for", "which", "data", "has", "been", "stored", "in", "the", "Var2Data", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractVarMeta.java#L70-L80
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AbstractVarMeta.java
AbstractVarMeta.getOffset
@Override public Integer getOffset(Integer id, Integer type) { Integer result = null; Map<Integer, Integer> map = m_table.get(id); if (map != null && type != null) { result = map.get(type); } return (result); }
java
@Override public Integer getOffset(Integer id, Integer type) { Integer result = null; Map<Integer, Integer> map = m_table.get(id); if (map != null && type != null) { result = map.get(type); } return (result); }
[ "@", "Override", "public", "Integer", "getOffset", "(", "Integer", "id", ",", "Integer", "type", ")", "{", "Integer", "result", "=", "null", ";", "Map", "<", "Integer", ",", "Integer", ">", "map", "=", "m_table", ".", "get", "(", "id", ")", ";", "if"...
This method retrieves the offset of a given entry in the Var2Data block. Each entry can be uniquely located by the identifier of the object to which the data belongs, and the type of the data. @param id unique identifier of an entity @param type data type identifier @return offset of requested item
[ "This", "method", "retrieves", "the", "offset", "of", "a", "given", "entry", "in", "the", "Var2Data", "block", ".", "Each", "entry", "can", "be", "uniquely", "located", "by", "the", "identifier", "of", "the", "object", "to", "which", "the", "data", "belong...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractVarMeta.java#L102-L113
train
joniles/mpxj
src/main/java/net/sf/mpxj/GenericCriteria.java
GenericCriteria.setRightValue
public void setRightValue(int index, Object value) { m_definedRightValues[index] = value; if (value instanceof FieldType) { m_symbolicValues = true; } else { if (value instanceof Duration) { if (((Duration) value).getUnits() != TimeUnit.HOURS) { value = ((Duration) value).convertUnits(TimeUnit.HOURS, m_properties); } } } m_workingRightValues[index] = value; }
java
public void setRightValue(int index, Object value) { m_definedRightValues[index] = value; if (value instanceof FieldType) { m_symbolicValues = true; } else { if (value instanceof Duration) { if (((Duration) value).getUnits() != TimeUnit.HOURS) { value = ((Duration) value).convertUnits(TimeUnit.HOURS, m_properties); } } } m_workingRightValues[index] = value; }
[ "public", "void", "setRightValue", "(", "int", "index", ",", "Object", "value", ")", "{", "m_definedRightValues", "[", "index", "]", "=", "value", ";", "if", "(", "value", "instanceof", "FieldType", ")", "{", "m_symbolicValues", "=", "true", ";", "}", "els...
Add the value to list of values to be used as part of the evaluation of this indicator. @param index position in the list @param value evaluation value
[ "Add", "the", "value", "to", "list", "of", "values", "to", "be", "used", "as", "part", "of", "the", "evaluation", "of", "this", "indicator", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/GenericCriteria.java#L95-L115
train
joniles/mpxj
src/main/java/net/sf/mpxj/GenericCriteria.java
GenericCriteria.evaluate
public boolean evaluate(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues) { // // Retrieve the LHS value // FieldType field = m_leftValue; Object lhs; if (field == null) { lhs = null; } else { lhs = container.getCurrentValue(field); switch (field.getDataType()) { case DATE: { if (lhs != null) { lhs = DateHelper.getDayStartDate((Date) lhs); } break; } case DURATION: { if (lhs != null) { Duration dur = (Duration) lhs; lhs = dur.convertUnits(TimeUnit.HOURS, m_properties); } else { lhs = Duration.getInstance(0, TimeUnit.HOURS); } break; } case STRING: { lhs = lhs == null ? "" : lhs; break; } default: { break; } } } // // Retrieve the RHS values // Object[] rhs; if (m_symbolicValues == true) { rhs = processSymbolicValues(m_workingRightValues, container, promptValues); } else { rhs = m_workingRightValues; } // // Evaluate // boolean result; switch (m_operator) { case AND: case OR: { result = evaluateLogicalOperator(container, promptValues); break; } default: { result = m_operator.evaluate(lhs, rhs); break; } } return result; }
java
public boolean evaluate(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues) { // // Retrieve the LHS value // FieldType field = m_leftValue; Object lhs; if (field == null) { lhs = null; } else { lhs = container.getCurrentValue(field); switch (field.getDataType()) { case DATE: { if (lhs != null) { lhs = DateHelper.getDayStartDate((Date) lhs); } break; } case DURATION: { if (lhs != null) { Duration dur = (Duration) lhs; lhs = dur.convertUnits(TimeUnit.HOURS, m_properties); } else { lhs = Duration.getInstance(0, TimeUnit.HOURS); } break; } case STRING: { lhs = lhs == null ? "" : lhs; break; } default: { break; } } } // // Retrieve the RHS values // Object[] rhs; if (m_symbolicValues == true) { rhs = processSymbolicValues(m_workingRightValues, container, promptValues); } else { rhs = m_workingRightValues; } // // Evaluate // boolean result; switch (m_operator) { case AND: case OR: { result = evaluateLogicalOperator(container, promptValues); break; } default: { result = m_operator.evaluate(lhs, rhs); break; } } return result; }
[ "public", "boolean", "evaluate", "(", "FieldContainer", "container", ",", "Map", "<", "GenericCriteriaPrompt", ",", "Object", ">", "promptValues", ")", "{", "//", "// Retrieve the LHS value", "//", "FieldType", "field", "=", "m_leftValue", ";", "Object", "lhs", ";...
Evaluate the criteria and return a boolean result. @param container field container @param promptValues responses to prompts @return boolean flag
[ "Evaluate", "the", "criteria", "and", "return", "a", "boolean", "result", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/GenericCriteria.java#L135-L222
train
joniles/mpxj
src/main/java/net/sf/mpxj/GenericCriteria.java
GenericCriteria.evaluateLogicalOperator
private boolean evaluateLogicalOperator(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues) { boolean result = false; if (m_criteriaList.size() == 0) { result = true; } else { for (GenericCriteria criteria : m_criteriaList) { result = criteria.evaluate(container, promptValues); if ((m_operator == TestOperator.AND && !result) || (m_operator == TestOperator.OR && result)) { break; } } } return result; }
java
private boolean evaluateLogicalOperator(FieldContainer container, Map<GenericCriteriaPrompt, Object> promptValues) { boolean result = false; if (m_criteriaList.size() == 0) { result = true; } else { for (GenericCriteria criteria : m_criteriaList) { result = criteria.evaluate(container, promptValues); if ((m_operator == TestOperator.AND && !result) || (m_operator == TestOperator.OR && result)) { break; } } } return result; }
[ "private", "boolean", "evaluateLogicalOperator", "(", "FieldContainer", "container", ",", "Map", "<", "GenericCriteriaPrompt", ",", "Object", ">", "promptValues", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "m_criteriaList", ".", "size", "(", ")...
Evalutes AND and OR operators. @param container data context @param promptValues responses to prompts @return operator result
[ "Evalutes", "AND", "and", "OR", "operators", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/GenericCriteria.java#L231-L252
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.read
private ProjectFile read() throws Exception { m_project = new ProjectFile(); m_eventManager = m_project.getEventManager(); m_project.getProjectProperties().setFileApplication("Synchro"); m_project.getProjectProperties().setFileType("SP"); CustomFieldContainer fields = m_project.getCustomFields(); fields.getCustomField(TaskField.TEXT1).setAlias("Code"); m_eventManager.addProjectListeners(m_projectListeners); processCalendars(); processResources(); processTasks(); processPredecessors(); return m_project; }
java
private ProjectFile read() throws Exception { m_project = new ProjectFile(); m_eventManager = m_project.getEventManager(); m_project.getProjectProperties().setFileApplication("Synchro"); m_project.getProjectProperties().setFileType("SP"); CustomFieldContainer fields = m_project.getCustomFields(); fields.getCustomField(TaskField.TEXT1).setAlias("Code"); m_eventManager.addProjectListeners(m_projectListeners); processCalendars(); processResources(); processTasks(); processPredecessors(); return m_project; }
[ "private", "ProjectFile", "read", "(", ")", "throws", "Exception", "{", "m_project", "=", "new", "ProjectFile", "(", ")", ";", "m_eventManager", "=", "m_project", ".", "getEventManager", "(", ")", ";", "m_project", ".", "getProjectProperties", "(", ")", ".", ...
Reads data from the SP file. @return Project File instance
[ "Reads", "data", "from", "the", "SP", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L114-L133
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processCalendars
private void processCalendars() throws IOException { CalendarReader reader = new CalendarReader(m_data.getTableData("Calendars")); reader.read(); for (MapRow row : reader.getRows()) { processCalendar(row); } m_project.setDefaultCalendar(m_calendarMap.get(reader.getDefaultCalendarUUID())); }
java
private void processCalendars() throws IOException { CalendarReader reader = new CalendarReader(m_data.getTableData("Calendars")); reader.read(); for (MapRow row : reader.getRows()) { processCalendar(row); } m_project.setDefaultCalendar(m_calendarMap.get(reader.getDefaultCalendarUUID())); }
[ "private", "void", "processCalendars", "(", ")", "throws", "IOException", "{", "CalendarReader", "reader", "=", "new", "CalendarReader", "(", "m_data", ".", "getTableData", "(", "\"Calendars\"", ")", ")", ";", "reader", ".", "read", "(", ")", ";", "for", "("...
Extract calendar data.
[ "Extract", "calendar", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L138-L149
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processCalendar
private void processCalendar(MapRow row) { ProjectCalendar calendar = m_project.addCalendar(); Map<UUID, List<DateRange>> dayTypeMap = processDayTypes(row.getRows("DAY_TYPES")); calendar.setName(row.getString("NAME")); processRanges(dayTypeMap.get(row.getUUID("SUNDAY_DAY_TYPE")), calendar.addCalendarHours(Day.SUNDAY)); processRanges(dayTypeMap.get(row.getUUID("MONDAY_DAY_TYPE")), calendar.addCalendarHours(Day.MONDAY)); processRanges(dayTypeMap.get(row.getUUID("TUESDAY_DAY_TYPE")), calendar.addCalendarHours(Day.TUESDAY)); processRanges(dayTypeMap.get(row.getUUID("WEDNESDAY_DAY_TYPE")), calendar.addCalendarHours(Day.WEDNESDAY)); processRanges(dayTypeMap.get(row.getUUID("THURSDAY_DAY_TYPE")), calendar.addCalendarHours(Day.THURSDAY)); processRanges(dayTypeMap.get(row.getUUID("FRIDAY_DAY_TYPE")), calendar.addCalendarHours(Day.FRIDAY)); processRanges(dayTypeMap.get(row.getUUID("SATURDAY_DAY_TYPE")), calendar.addCalendarHours(Day.SATURDAY)); for (MapRow assignment : row.getRows("DAY_TYPE_ASSIGNMENTS")) { Date date = assignment.getDate("DATE"); processRanges(dayTypeMap.get(assignment.getUUID("DAY_TYPE_UUID")), calendar.addCalendarException(date, date)); } m_calendarMap.put(row.getUUID("UUID"), calendar); }
java
private void processCalendar(MapRow row) { ProjectCalendar calendar = m_project.addCalendar(); Map<UUID, List<DateRange>> dayTypeMap = processDayTypes(row.getRows("DAY_TYPES")); calendar.setName(row.getString("NAME")); processRanges(dayTypeMap.get(row.getUUID("SUNDAY_DAY_TYPE")), calendar.addCalendarHours(Day.SUNDAY)); processRanges(dayTypeMap.get(row.getUUID("MONDAY_DAY_TYPE")), calendar.addCalendarHours(Day.MONDAY)); processRanges(dayTypeMap.get(row.getUUID("TUESDAY_DAY_TYPE")), calendar.addCalendarHours(Day.TUESDAY)); processRanges(dayTypeMap.get(row.getUUID("WEDNESDAY_DAY_TYPE")), calendar.addCalendarHours(Day.WEDNESDAY)); processRanges(dayTypeMap.get(row.getUUID("THURSDAY_DAY_TYPE")), calendar.addCalendarHours(Day.THURSDAY)); processRanges(dayTypeMap.get(row.getUUID("FRIDAY_DAY_TYPE")), calendar.addCalendarHours(Day.FRIDAY)); processRanges(dayTypeMap.get(row.getUUID("SATURDAY_DAY_TYPE")), calendar.addCalendarHours(Day.SATURDAY)); for (MapRow assignment : row.getRows("DAY_TYPE_ASSIGNMENTS")) { Date date = assignment.getDate("DATE"); processRanges(dayTypeMap.get(assignment.getUUID("DAY_TYPE_UUID")), calendar.addCalendarException(date, date)); } m_calendarMap.put(row.getUUID("UUID"), calendar); }
[ "private", "void", "processCalendar", "(", "MapRow", "row", ")", "{", "ProjectCalendar", "calendar", "=", "m_project", ".", "addCalendar", "(", ")", ";", "Map", "<", "UUID", ",", "List", "<", "DateRange", ">", ">", "dayTypeMap", "=", "processDayTypes", "(", ...
Extract data for a single calendar. @param row calendar data
[ "Extract", "data", "for", "a", "single", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L156-L179
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processRanges
private void processRanges(List<DateRange> ranges, ProjectCalendarDateRanges container) { if (ranges != null) { for (DateRange range : ranges) { container.addRange(range); } } }
java
private void processRanges(List<DateRange> ranges, ProjectCalendarDateRanges container) { if (ranges != null) { for (DateRange range : ranges) { container.addRange(range); } } }
[ "private", "void", "processRanges", "(", "List", "<", "DateRange", ">", "ranges", ",", "ProjectCalendarDateRanges", "container", ")", "{", "if", "(", "ranges", "!=", "null", ")", "{", "for", "(", "DateRange", "range", ":", "ranges", ")", "{", "container", ...
Populate time ranges. @param ranges time ranges from a Synchro table @param container time range container
[ "Populate", "time", "ranges", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L187-L196
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processDayTypes
private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types) { Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>(); for (MapRow row : types) { List<DateRange> ranges = new ArrayList<DateRange>(); for (MapRow range : row.getRows("TIME_RANGES")) { ranges.add(new DateRange(range.getDate("START"), range.getDate("END"))); } map.put(row.getUUID("UUID"), ranges); } return map; }
java
private Map<UUID, List<DateRange>> processDayTypes(List<MapRow> types) { Map<UUID, List<DateRange>> map = new HashMap<UUID, List<DateRange>>(); for (MapRow row : types) { List<DateRange> ranges = new ArrayList<DateRange>(); for (MapRow range : row.getRows("TIME_RANGES")) { ranges.add(new DateRange(range.getDate("START"), range.getDate("END"))); } map.put(row.getUUID("UUID"), ranges); } return map; }
[ "private", "Map", "<", "UUID", ",", "List", "<", "DateRange", ">", ">", "processDayTypes", "(", "List", "<", "MapRow", ">", "types", ")", "{", "Map", "<", "UUID", ",", "List", "<", "DateRange", ">", ">", "map", "=", "new", "HashMap", "<", "UUID", "...
Extract day type definitions. @param types Synchro day type rows @return Map of day types by UUID
[ "Extract", "day", "type", "definitions", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L204-L218
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processResources
private void processResources() throws IOException { CompanyReader reader = new CompanyReader(m_data.getTableData("Companies")); reader.read(); for (MapRow companyRow : reader.getRows()) { // TODO: need to sort by type as well as by name! for (MapRow resourceRow : sort(companyRow.getRows("RESOURCES"), "NAME")) { processResource(resourceRow); } } }
java
private void processResources() throws IOException { CompanyReader reader = new CompanyReader(m_data.getTableData("Companies")); reader.read(); for (MapRow companyRow : reader.getRows()) { // TODO: need to sort by type as well as by name! for (MapRow resourceRow : sort(companyRow.getRows("RESOURCES"), "NAME")) { processResource(resourceRow); } } }
[ "private", "void", "processResources", "(", ")", "throws", "IOException", "{", "CompanyReader", "reader", "=", "new", "CompanyReader", "(", "m_data", ".", "getTableData", "(", "\"Companies\"", ")", ")", ";", "reader", ".", "read", "(", ")", ";", "for", "(", ...
Extract resource data.
[ "Extract", "resource", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L223-L235
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processResource
private void processResource(MapRow row) throws IOException { Resource resource = m_project.addResource(); resource.setName(row.getString("NAME")); resource.setGUID(row.getUUID("UUID")); resource.setEmailAddress(row.getString("EMAIL")); resource.setHyperlink(row.getString("URL")); resource.setNotes(getNotes(row.getRows("COMMENTARY"))); resource.setText(1, row.getString("DESCRIPTION")); resource.setText(2, row.getString("SUPPLY_REFERENCE")); resource.setActive(true); List<MapRow> resources = row.getRows("RESOURCES"); if (resources != null) { for (MapRow childResource : sort(resources, "NAME")) { processResource(childResource); } } m_resourceMap.put(resource.getGUID(), resource); }
java
private void processResource(MapRow row) throws IOException { Resource resource = m_project.addResource(); resource.setName(row.getString("NAME")); resource.setGUID(row.getUUID("UUID")); resource.setEmailAddress(row.getString("EMAIL")); resource.setHyperlink(row.getString("URL")); resource.setNotes(getNotes(row.getRows("COMMENTARY"))); resource.setText(1, row.getString("DESCRIPTION")); resource.setText(2, row.getString("SUPPLY_REFERENCE")); resource.setActive(true); List<MapRow> resources = row.getRows("RESOURCES"); if (resources != null) { for (MapRow childResource : sort(resources, "NAME")) { processResource(childResource); } } m_resourceMap.put(resource.getGUID(), resource); }
[ "private", "void", "processResource", "(", "MapRow", "row", ")", "throws", "IOException", "{", "Resource", "resource", "=", "m_project", ".", "addResource", "(", ")", ";", "resource", ".", "setName", "(", "row", ".", "getString", "(", "\"NAME\"", ")", ")", ...
Extract data for a single resource. @param row Synchro resource data
[ "Extract", "data", "for", "a", "single", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L242-L264
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processTasks
private void processTasks() throws IOException { TaskReader reader = new TaskReader(m_data.getTableData("Tasks")); reader.read(); for (MapRow row : reader.getRows()) { processTask(m_project, row); } updateDates(); }
java
private void processTasks() throws IOException { TaskReader reader = new TaskReader(m_data.getTableData("Tasks")); reader.read(); for (MapRow row : reader.getRows()) { processTask(m_project, row); } updateDates(); }
[ "private", "void", "processTasks", "(", ")", "throws", "IOException", "{", "TaskReader", "reader", "=", "new", "TaskReader", "(", "m_data", ".", "getTableData", "(", "\"Tasks\"", ")", ")", ";", "reader", ".", "read", "(", ")", ";", "for", "(", "MapRow", ...
Extract task data.
[ "Extract", "task", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L269-L278
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processTask
private void processTask(ChildTaskContainer parent, MapRow row) throws IOException { Task task = parent.addTask(); task.setName(row.getString("NAME")); task.setGUID(row.getUUID("UUID")); task.setText(1, row.getString("ID")); task.setDuration(row.getDuration("PLANNED_DURATION")); task.setRemainingDuration(row.getDuration("REMAINING_DURATION")); task.setHyperlink(row.getString("URL")); task.setPercentageComplete(row.getDouble("PERCENT_COMPLETE")); task.setNotes(getNotes(row.getRows("COMMENTARY"))); task.setMilestone(task.getDuration().getDuration() == 0); ProjectCalendar calendar = m_calendarMap.get(row.getUUID("CALENDAR_UUID")); if (calendar != m_project.getDefaultCalendar()) { task.setCalendar(calendar); } switch (row.getInteger("STATUS").intValue()) { case 1: // Planned { task.setStart(row.getDate("PLANNED_START")); task.setFinish(task.getEffectiveCalendar().getDate(task.getStart(), task.getDuration(), false)); break; } case 2: // Started { task.setActualStart(row.getDate("ACTUAL_START")); task.setStart(task.getActualStart()); task.setFinish(row.getDate("ESTIMATED_FINISH")); if (task.getFinish() == null) { task.setFinish(row.getDate("PLANNED_FINISH")); } break; } case 3: // Finished { task.setActualStart(row.getDate("ACTUAL_START")); task.setActualFinish(row.getDate("ACTUAL_FINISH")); task.setPercentageComplete(Double.valueOf(100.0)); task.setStart(task.getActualStart()); task.setFinish(task.getActualFinish()); break; } } setConstraints(task, row); processChildTasks(task, row); m_taskMap.put(task.getGUID(), task); List<MapRow> predecessors = row.getRows("PREDECESSORS"); if (predecessors != null && !predecessors.isEmpty()) { m_predecessorMap.put(task, predecessors); } List<MapRow> resourceAssignmnets = row.getRows("RESOURCE_ASSIGNMENTS"); if (resourceAssignmnets != null && !resourceAssignmnets.isEmpty()) { processResourceAssignments(task, resourceAssignmnets); } }
java
private void processTask(ChildTaskContainer parent, MapRow row) throws IOException { Task task = parent.addTask(); task.setName(row.getString("NAME")); task.setGUID(row.getUUID("UUID")); task.setText(1, row.getString("ID")); task.setDuration(row.getDuration("PLANNED_DURATION")); task.setRemainingDuration(row.getDuration("REMAINING_DURATION")); task.setHyperlink(row.getString("URL")); task.setPercentageComplete(row.getDouble("PERCENT_COMPLETE")); task.setNotes(getNotes(row.getRows("COMMENTARY"))); task.setMilestone(task.getDuration().getDuration() == 0); ProjectCalendar calendar = m_calendarMap.get(row.getUUID("CALENDAR_UUID")); if (calendar != m_project.getDefaultCalendar()) { task.setCalendar(calendar); } switch (row.getInteger("STATUS").intValue()) { case 1: // Planned { task.setStart(row.getDate("PLANNED_START")); task.setFinish(task.getEffectiveCalendar().getDate(task.getStart(), task.getDuration(), false)); break; } case 2: // Started { task.setActualStart(row.getDate("ACTUAL_START")); task.setStart(task.getActualStart()); task.setFinish(row.getDate("ESTIMATED_FINISH")); if (task.getFinish() == null) { task.setFinish(row.getDate("PLANNED_FINISH")); } break; } case 3: // Finished { task.setActualStart(row.getDate("ACTUAL_START")); task.setActualFinish(row.getDate("ACTUAL_FINISH")); task.setPercentageComplete(Double.valueOf(100.0)); task.setStart(task.getActualStart()); task.setFinish(task.getActualFinish()); break; } } setConstraints(task, row); processChildTasks(task, row); m_taskMap.put(task.getGUID(), task); List<MapRow> predecessors = row.getRows("PREDECESSORS"); if (predecessors != null && !predecessors.isEmpty()) { m_predecessorMap.put(task, predecessors); } List<MapRow> resourceAssignmnets = row.getRows("RESOURCE_ASSIGNMENTS"); if (resourceAssignmnets != null && !resourceAssignmnets.isEmpty()) { processResourceAssignments(task, resourceAssignmnets); } }
[ "private", "void", "processTask", "(", "ChildTaskContainer", "parent", ",", "MapRow", "row", ")", "throws", "IOException", "{", "Task", "task", "=", "parent", ".", "addTask", "(", ")", ";", "task", ".", "setName", "(", "row", ".", "getString", "(", "\"NAME...
Extract data for a single task. @param parent task parent @param row Synchro task data
[ "Extract", "data", "for", "a", "single", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L286-L354
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processChildTasks
private void processChildTasks(Task task, MapRow row) throws IOException { List<MapRow> tasks = row.getRows("TASKS"); if (tasks != null) { for (MapRow childTask : tasks) { processTask(task, childTask); } } }
java
private void processChildTasks(Task task, MapRow row) throws IOException { List<MapRow> tasks = row.getRows("TASKS"); if (tasks != null) { for (MapRow childTask : tasks) { processTask(task, childTask); } } }
[ "private", "void", "processChildTasks", "(", "Task", "task", ",", "MapRow", "row", ")", "throws", "IOException", "{", "List", "<", "MapRow", ">", "tasks", "=", "row", ".", "getRows", "(", "\"TASKS\"", ")", ";", "if", "(", "tasks", "!=", "null", ")", "{...
Extract child task data. @param task MPXJ task @param row Synchro task data
[ "Extract", "child", "task", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L362-L372
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processPredecessors
private void processPredecessors() { for (Map.Entry<Task, List<MapRow>> entry : m_predecessorMap.entrySet()) { Task task = entry.getKey(); List<MapRow> predecessors = entry.getValue(); for (MapRow predecessor : predecessors) { processPredecessor(task, predecessor); } } }
java
private void processPredecessors() { for (Map.Entry<Task, List<MapRow>> entry : m_predecessorMap.entrySet()) { Task task = entry.getKey(); List<MapRow> predecessors = entry.getValue(); for (MapRow predecessor : predecessors) { processPredecessor(task, predecessor); } } }
[ "private", "void", "processPredecessors", "(", ")", "{", "for", "(", "Map", ".", "Entry", "<", "Task", ",", "List", "<", "MapRow", ">", ">", "entry", ":", "m_predecessorMap", ".", "entrySet", "(", ")", ")", "{", "Task", "task", "=", "entry", ".", "ge...
Extract predecessor data.
[ "Extract", "predecessor", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L377-L388
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processPredecessor
private void processPredecessor(Task task, MapRow row) { Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
java
private void processPredecessor(Task task, MapRow row) { Task predecessor = m_taskMap.get(row.getUUID("PREDECESSOR_UUID")); if (predecessor != null) { task.addPredecessor(predecessor, row.getRelationType("RELATION_TYPE"), row.getDuration("LAG")); } }
[ "private", "void", "processPredecessor", "(", "Task", "task", ",", "MapRow", "row", ")", "{", "Task", "predecessor", "=", "m_taskMap", ".", "get", "(", "row", ".", "getUUID", "(", "\"PREDECESSOR_UUID\"", ")", ")", ";", "if", "(", "predecessor", "!=", "null...
Extract data for a single predecessor. @param task parent task @param row Synchro predecessor data
[ "Extract", "data", "for", "a", "single", "predecessor", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L396-L403
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processResourceAssignments
private void processResourceAssignments(Task task, List<MapRow> assignments) { for (MapRow row : assignments) { processResourceAssignment(task, row); } }
java
private void processResourceAssignments(Task task, List<MapRow> assignments) { for (MapRow row : assignments) { processResourceAssignment(task, row); } }
[ "private", "void", "processResourceAssignments", "(", "Task", "task", ",", "List", "<", "MapRow", ">", "assignments", ")", "{", "for", "(", "MapRow", "row", ":", "assignments", ")", "{", "processResourceAssignment", "(", "task", ",", "row", ")", ";", "}", ...
Extract resource assignments for a task. @param task parent task @param assignments list of Synchro resource assignment data
[ "Extract", "resource", "assignments", "for", "a", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L411-L417
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.processResourceAssignment
private void processResourceAssignment(Task task, MapRow row) { Resource resource = m_resourceMap.get(row.getUUID("RESOURCE_UUID")); task.addResourceAssignment(resource); }
java
private void processResourceAssignment(Task task, MapRow row) { Resource resource = m_resourceMap.get(row.getUUID("RESOURCE_UUID")); task.addResourceAssignment(resource); }
[ "private", "void", "processResourceAssignment", "(", "Task", "task", ",", "MapRow", "row", ")", "{", "Resource", "resource", "=", "m_resourceMap", ".", "get", "(", "row", ".", "getUUID", "(", "\"RESOURCE_UUID\"", ")", ")", ";", "task", ".", "addResourceAssignm...
Extract data for a single resource assignment. @param task parent task @param row Synchro resource assignment
[ "Extract", "data", "for", "a", "single", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L425-L429
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.setConstraints
private void setConstraints(Task task, MapRow row) { ConstraintType constraintType = null; Date constraintDate = null; Date lateDate = row.getDate("CONSTRAINT_LATE_DATE"); Date earlyDate = row.getDate("CONSTRAINT_EARLY_DATE"); switch (row.getInteger("CONSTRAINT_TYPE").intValue()) { case 2: // Cannot Reschedule { constraintType = ConstraintType.MUST_START_ON; constraintDate = task.getStart(); break; } case 12: //Finish Between { constraintType = ConstraintType.MUST_FINISH_ON; constraintDate = lateDate; break; } case 10: // Finish On or After { constraintType = ConstraintType.FINISH_NO_EARLIER_THAN; constraintDate = earlyDate; break; } case 11: // Finish On or Before { constraintType = ConstraintType.FINISH_NO_LATER_THAN; constraintDate = lateDate; break; } case 13: // Mandatory Start case 5: // Start On case 9: // Finish On { constraintType = ConstraintType.MUST_START_ON; constraintDate = earlyDate; break; } case 14: // Mandatory Finish { constraintType = ConstraintType.MUST_FINISH_ON; constraintDate = earlyDate; break; } case 4: // Start As Late As Possible { constraintType = ConstraintType.AS_LATE_AS_POSSIBLE; break; } case 3: // Start As Soon As Possible { constraintType = ConstraintType.AS_SOON_AS_POSSIBLE; break; } case 8: // Start Between { constraintType = ConstraintType.AS_SOON_AS_POSSIBLE; constraintDate = earlyDate; break; } case 6: // Start On or Before { constraintType = ConstraintType.START_NO_LATER_THAN; constraintDate = earlyDate; break; } case 15: // Work Between { constraintType = ConstraintType.START_NO_EARLIER_THAN; constraintDate = earlyDate; break; } } task.setConstraintType(constraintType); task.setConstraintDate(constraintDate); }
java
private void setConstraints(Task task, MapRow row) { ConstraintType constraintType = null; Date constraintDate = null; Date lateDate = row.getDate("CONSTRAINT_LATE_DATE"); Date earlyDate = row.getDate("CONSTRAINT_EARLY_DATE"); switch (row.getInteger("CONSTRAINT_TYPE").intValue()) { case 2: // Cannot Reschedule { constraintType = ConstraintType.MUST_START_ON; constraintDate = task.getStart(); break; } case 12: //Finish Between { constraintType = ConstraintType.MUST_FINISH_ON; constraintDate = lateDate; break; } case 10: // Finish On or After { constraintType = ConstraintType.FINISH_NO_EARLIER_THAN; constraintDate = earlyDate; break; } case 11: // Finish On or Before { constraintType = ConstraintType.FINISH_NO_LATER_THAN; constraintDate = lateDate; break; } case 13: // Mandatory Start case 5: // Start On case 9: // Finish On { constraintType = ConstraintType.MUST_START_ON; constraintDate = earlyDate; break; } case 14: // Mandatory Finish { constraintType = ConstraintType.MUST_FINISH_ON; constraintDate = earlyDate; break; } case 4: // Start As Late As Possible { constraintType = ConstraintType.AS_LATE_AS_POSSIBLE; break; } case 3: // Start As Soon As Possible { constraintType = ConstraintType.AS_SOON_AS_POSSIBLE; break; } case 8: // Start Between { constraintType = ConstraintType.AS_SOON_AS_POSSIBLE; constraintDate = earlyDate; break; } case 6: // Start On or Before { constraintType = ConstraintType.START_NO_LATER_THAN; constraintDate = earlyDate; break; } case 15: // Work Between { constraintType = ConstraintType.START_NO_EARLIER_THAN; constraintDate = earlyDate; break; } } task.setConstraintType(constraintType); task.setConstraintDate(constraintDate); }
[ "private", "void", "setConstraints", "(", "Task", "task", ",", "MapRow", "row", ")", "{", "ConstraintType", "constraintType", "=", "null", ";", "Date", "constraintDate", "=", "null", ";", "Date", "lateDate", "=", "row", ".", "getDate", "(", "\"CONSTRAINT_LATE_...
Map Synchro constraints to MPXJ constraints. @param task task @param row Synchro constraint data
[ "Map", "Synchro", "constraints", "to", "MPXJ", "constraints", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L437-L525
train
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroReader.java
SynchroReader.getNotes
private String getNotes(List<MapRow> rows) { String result = null; if (rows != null && !rows.isEmpty()) { StringBuilder sb = new StringBuilder(); for (MapRow row : rows) { sb.append(row.getString("TITLE")); sb.append('\n'); sb.append(row.getString("TEXT")); sb.append("\n\n"); } result = sb.toString(); } return result; }
java
private String getNotes(List<MapRow> rows) { String result = null; if (rows != null && !rows.isEmpty()) { StringBuilder sb = new StringBuilder(); for (MapRow row : rows) { sb.append(row.getString("TITLE")); sb.append('\n'); sb.append(row.getString("TEXT")); sb.append("\n\n"); } result = sb.toString(); } return result; }
[ "private", "String", "getNotes", "(", "List", "<", "MapRow", ">", "rows", ")", "{", "String", "result", "=", "null", ";", "if", "(", "rows", "!=", "null", "&&", "!", "rows", ".", "isEmpty", "(", ")", ")", "{", "StringBuilder", "sb", "=", "new", "St...
Common mechanism to convert Synchro commentary recorss into notes. @param rows commentary table rows @return note text
[ "Common", "mechanism", "to", "convert", "Synchro", "commentary", "recorss", "into", "notes", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroReader.java#L533-L549
train