id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
157,000 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateProjectHeader | private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException
{
properties.setProjectTitle(record.getString(0));
properties.setCompany(record.getString(1));
properties.setManager(record.getString(2));
properties.setDefaultCalendarName(record.getString(3));
properties.setStartDate(record.getDateTime(4));
properties.setFinishDate(record.getDateTime(5));
properties.setScheduleFrom(record.getScheduleFrom(6));
properties.setCurrentDate(record.getDateTime(7));
properties.setComments(record.getString(8));
properties.setCost(record.getCurrency(9));
properties.setBaselineCost(record.getCurrency(10));
properties.setActualCost(record.getCurrency(11));
properties.setWork(record.getDuration(12));
properties.setBaselineWork(record.getDuration(13));
properties.setActualWork(record.getDuration(14));
properties.setWork2(record.getPercentage(15));
properties.setDuration(record.getDuration(16));
properties.setBaselineDuration(record.getDuration(17));
properties.setActualDuration(record.getDuration(18));
properties.setPercentageComplete(record.getPercentage(19));
properties.setBaselineStart(record.getDateTime(20));
properties.setBaselineFinish(record.getDateTime(21));
properties.setActualStart(record.getDateTime(22));
properties.setActualFinish(record.getDateTime(23));
properties.setStartVariance(record.getDuration(24));
properties.setFinishVariance(record.getDuration(25));
properties.setSubject(record.getString(26));
properties.setAuthor(record.getString(27));
properties.setKeywords(record.getString(28));
} | java | private void populateProjectHeader(Record record, ProjectProperties properties) throws MPXJException
{
properties.setProjectTitle(record.getString(0));
properties.setCompany(record.getString(1));
properties.setManager(record.getString(2));
properties.setDefaultCalendarName(record.getString(3));
properties.setStartDate(record.getDateTime(4));
properties.setFinishDate(record.getDateTime(5));
properties.setScheduleFrom(record.getScheduleFrom(6));
properties.setCurrentDate(record.getDateTime(7));
properties.setComments(record.getString(8));
properties.setCost(record.getCurrency(9));
properties.setBaselineCost(record.getCurrency(10));
properties.setActualCost(record.getCurrency(11));
properties.setWork(record.getDuration(12));
properties.setBaselineWork(record.getDuration(13));
properties.setActualWork(record.getDuration(14));
properties.setWork2(record.getPercentage(15));
properties.setDuration(record.getDuration(16));
properties.setBaselineDuration(record.getDuration(17));
properties.setActualDuration(record.getDuration(18));
properties.setPercentageComplete(record.getPercentage(19));
properties.setBaselineStart(record.getDateTime(20));
properties.setBaselineFinish(record.getDateTime(21));
properties.setActualStart(record.getDateTime(22));
properties.setActualFinish(record.getDateTime(23));
properties.setStartVariance(record.getDuration(24));
properties.setFinishVariance(record.getDuration(25));
properties.setSubject(record.getString(26));
properties.setAuthor(record.getString(27));
properties.setKeywords(record.getString(28));
} | [
"private",
"void",
"populateProjectHeader",
"(",
"Record",
"record",
",",
"ProjectProperties",
"properties",
")",
"throws",
"MPXJException",
"{",
"properties",
".",
"setProjectTitle",
"(",
"record",
".",
"getString",
"(",
"0",
")",
")",
";",
"properties",
".",
"... | Populates the project header.
@param record MPX record
@param properties project properties
@throws MPXJException | [
"Populates",
"the",
"project",
"header",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L592-L623 |
157,001 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateCalendarHours | private void populateCalendarHours(Record record, ProjectCalendarHours hours) throws MPXJException
{
hours.setDay(Day.getInstance(NumberHelper.getInt(record.getInteger(0))));
addDateRange(hours, record.getTime(1), record.getTime(2));
addDateRange(hours, record.getTime(3), record.getTime(4));
addDateRange(hours, record.getTime(5), record.getTime(6));
} | java | private void populateCalendarHours(Record record, ProjectCalendarHours hours) throws MPXJException
{
hours.setDay(Day.getInstance(NumberHelper.getInt(record.getInteger(0))));
addDateRange(hours, record.getTime(1), record.getTime(2));
addDateRange(hours, record.getTime(3), record.getTime(4));
addDateRange(hours, record.getTime(5), record.getTime(6));
} | [
"private",
"void",
"populateCalendarHours",
"(",
"Record",
"record",
",",
"ProjectCalendarHours",
"hours",
")",
"throws",
"MPXJException",
"{",
"hours",
".",
"setDay",
"(",
"Day",
".",
"getInstance",
"(",
"NumberHelper",
".",
"getInt",
"(",
"record",
".",
"getIn... | Populates a calendar hours instance.
@param record MPX record
@param hours calendar hours instance
@throws MPXJException | [
"Populates",
"a",
"calendar",
"hours",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L632-L638 |
157,002 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.addDateRange | private void addDateRange(ProjectCalendarHours hours, Date start, Date end)
{
if (start != null && end != null)
{
Calendar cal = DateHelper.popCalendar(end);
// If the time ends on midnight, the date should be the next day. Otherwise problems occur.
if (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0 && cal.get(Calendar.MILLISECOND) == 0)
{
cal.add(Calendar.DAY_OF_YEAR, 1);
}
end = cal.getTime();
DateHelper.pushCalendar(cal);
hours.addRange(new DateRange(start, end));
}
} | java | private void addDateRange(ProjectCalendarHours hours, Date start, Date end)
{
if (start != null && end != null)
{
Calendar cal = DateHelper.popCalendar(end);
// If the time ends on midnight, the date should be the next day. Otherwise problems occur.
if (cal.get(Calendar.HOUR_OF_DAY) == 0 && cal.get(Calendar.MINUTE) == 0 && cal.get(Calendar.SECOND) == 0 && cal.get(Calendar.MILLISECOND) == 0)
{
cal.add(Calendar.DAY_OF_YEAR, 1);
}
end = cal.getTime();
DateHelper.pushCalendar(cal);
hours.addRange(new DateRange(start, end));
}
} | [
"private",
"void",
"addDateRange",
"(",
"ProjectCalendarHours",
"hours",
",",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"if",
"(",
"start",
"!=",
"null",
"&&",
"end",
"!=",
"null",
")",
"{",
"Calendar",
"cal",
"=",
"DateHelper",
".",
"popCalendar",
... | Get a date range that correctly handles the case where the end time
is midnight. In this instance the end time should be the start of the
next day.
@param hours calendar hours
@param start start date
@param end end date | [
"Get",
"a",
"date",
"range",
"that",
"correctly",
"handles",
"the",
"case",
"where",
"the",
"end",
"time",
"is",
"midnight",
".",
"In",
"this",
"instance",
"the",
"end",
"time",
"should",
"be",
"the",
"start",
"of",
"the",
"next",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L649-L664 |
157,003 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateCalendarException | private void populateCalendarException(Record record, ProjectCalendar calendar) throws MPXJException
{
Date fromDate = record.getDate(0);
Date toDate = record.getDate(1);
boolean working = record.getNumericBoolean(2);
// I have found an example MPX file where a single day exception is expressed with just the start date set.
// If we find this for we assume that the end date is the same as the start date.
if (fromDate != null && toDate == null)
{
toDate = fromDate;
}
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (working)
{
addExceptionRange(exception, record.getTime(3), record.getTime(4));
addExceptionRange(exception, record.getTime(5), record.getTime(6));
addExceptionRange(exception, record.getTime(7), record.getTime(8));
}
} | java | private void populateCalendarException(Record record, ProjectCalendar calendar) throws MPXJException
{
Date fromDate = record.getDate(0);
Date toDate = record.getDate(1);
boolean working = record.getNumericBoolean(2);
// I have found an example MPX file where a single day exception is expressed with just the start date set.
// If we find this for we assume that the end date is the same as the start date.
if (fromDate != null && toDate == null)
{
toDate = fromDate;
}
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (working)
{
addExceptionRange(exception, record.getTime(3), record.getTime(4));
addExceptionRange(exception, record.getTime(5), record.getTime(6));
addExceptionRange(exception, record.getTime(7), record.getTime(8));
}
} | [
"private",
"void",
"populateCalendarException",
"(",
"Record",
"record",
",",
"ProjectCalendar",
"calendar",
")",
"throws",
"MPXJException",
"{",
"Date",
"fromDate",
"=",
"record",
".",
"getDate",
"(",
"0",
")",
";",
"Date",
"toDate",
"=",
"record",
".",
"getD... | Populates a calendar exception instance.
@param record MPX record
@param calendar calendar to which the exception will be added
@throws MPXJException | [
"Populates",
"a",
"calendar",
"exception",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L673-L693 |
157,004 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.addExceptionRange | private void addExceptionRange(ProjectCalendarException exception, Date start, Date finish)
{
if (start != null && finish != null)
{
exception.addRange(new DateRange(start, finish));
}
} | java | private void addExceptionRange(ProjectCalendarException exception, Date start, Date finish)
{
if (start != null && finish != null)
{
exception.addRange(new DateRange(start, finish));
}
} | [
"private",
"void",
"addExceptionRange",
"(",
"ProjectCalendarException",
"exception",
",",
"Date",
"start",
",",
"Date",
"finish",
")",
"{",
"if",
"(",
"start",
"!=",
"null",
"&&",
"finish",
"!=",
"null",
")",
"{",
"exception",
".",
"addRange",
"(",
"new",
... | Add a range to an exception, ensure that we don't try to add null ranges.
@param exception target exception
@param start exception start
@param finish exception finish | [
"Add",
"a",
"range",
"to",
"an",
"exception",
"ensure",
"that",
"we",
"don",
"t",
"try",
"to",
"add",
"null",
"ranges",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L702-L708 |
157,005 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateCalendar | private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar)
{
if (isBaseCalendar == true)
{
calendar.setName(record.getString(0));
}
else
{
calendar.setParent(m_projectFile.getCalendarByName(record.getString(0)));
}
calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1)));
calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2)));
calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3)));
calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4)));
calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5)));
calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6)));
calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7)));
m_eventManager.fireCalendarReadEvent(calendar);
} | java | private void populateCalendar(Record record, ProjectCalendar calendar, boolean isBaseCalendar)
{
if (isBaseCalendar == true)
{
calendar.setName(record.getString(0));
}
else
{
calendar.setParent(m_projectFile.getCalendarByName(record.getString(0)));
}
calendar.setWorkingDay(Day.SUNDAY, DayType.getInstance(record.getInteger(1)));
calendar.setWorkingDay(Day.MONDAY, DayType.getInstance(record.getInteger(2)));
calendar.setWorkingDay(Day.TUESDAY, DayType.getInstance(record.getInteger(3)));
calendar.setWorkingDay(Day.WEDNESDAY, DayType.getInstance(record.getInteger(4)));
calendar.setWorkingDay(Day.THURSDAY, DayType.getInstance(record.getInteger(5)));
calendar.setWorkingDay(Day.FRIDAY, DayType.getInstance(record.getInteger(6)));
calendar.setWorkingDay(Day.SATURDAY, DayType.getInstance(record.getInteger(7)));
m_eventManager.fireCalendarReadEvent(calendar);
} | [
"private",
"void",
"populateCalendar",
"(",
"Record",
"record",
",",
"ProjectCalendar",
"calendar",
",",
"boolean",
"isBaseCalendar",
")",
"{",
"if",
"(",
"isBaseCalendar",
"==",
"true",
")",
"{",
"calendar",
".",
"setName",
"(",
"record",
".",
"getString",
"(... | Populates a calendar instance.
@param record MPX record
@param calendar calendar instance
@param isBaseCalendar true if this is a base calendar | [
"Populates",
"a",
"calendar",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L717-L737 |
157,006 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateResource | private void populateResource(Resource resource, Record record) throws MPXJException
{
String falseText = LocaleData.getString(m_locale, LocaleData.NO);
int length = record.getLength();
int[] model = m_resourceModel.getModel();
for (int i = 0; i < length; i++)
{
int mpxFieldType = model[i];
if (mpxFieldType == -1)
{
break;
}
String field = record.getString(i);
if (field == null || field.length() == 0)
{
continue;
}
ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType);
switch (resourceField)
{
case OBJECTS:
{
resource.set(resourceField, record.getInteger(i));
break;
}
case ID:
{
resource.setID(record.getInteger(i));
break;
}
case UNIQUE_ID:
{
resource.setUniqueID(record.getInteger(i));
break;
}
case MAX_UNITS:
{
resource.set(resourceField, record.getUnits(i));
break;
}
case PERCENT_WORK_COMPLETE:
case PEAK:
{
resource.set(resourceField, record.getPercentage(i));
break;
}
case COST:
case COST_PER_USE:
case COST_VARIANCE:
case BASELINE_COST:
case ACTUAL_COST:
case REMAINING_COST:
{
resource.set(resourceField, record.getCurrency(i));
break;
}
case OVERTIME_RATE:
case STANDARD_RATE:
{
resource.set(resourceField, record.getRate(i));
break;
}
case REMAINING_WORK:
case OVERTIME_WORK:
case BASELINE_WORK:
case ACTUAL_WORK:
case WORK:
case WORK_VARIANCE:
{
resource.set(resourceField, record.getDuration(i));
break;
}
case ACCRUE_AT:
{
resource.set(resourceField, record.getAccrueType(i));
break;
}
case LINKED_FIELDS:
case OVERALLOCATED:
{
resource.set(resourceField, record.getBoolean(i, falseText));
break;
}
default:
{
resource.set(resourceField, field);
break;
}
}
}
if (m_projectConfig.getAutoResourceUniqueID() == true)
{
resource.setUniqueID(Integer.valueOf(m_projectConfig.getNextResourceUniqueID()));
}
if (m_projectConfig.getAutoResourceID() == true)
{
resource.setID(Integer.valueOf(m_projectConfig.getNextResourceID()));
}
//
// Handle malformed MPX files - ensure we have a unique ID
//
if (resource.getUniqueID() == null)
{
resource.setUniqueID(resource.getID());
}
} | java | private void populateResource(Resource resource, Record record) throws MPXJException
{
String falseText = LocaleData.getString(m_locale, LocaleData.NO);
int length = record.getLength();
int[] model = m_resourceModel.getModel();
for (int i = 0; i < length; i++)
{
int mpxFieldType = model[i];
if (mpxFieldType == -1)
{
break;
}
String field = record.getString(i);
if (field == null || field.length() == 0)
{
continue;
}
ResourceField resourceField = MPXResourceField.getMpxjField(mpxFieldType);
switch (resourceField)
{
case OBJECTS:
{
resource.set(resourceField, record.getInteger(i));
break;
}
case ID:
{
resource.setID(record.getInteger(i));
break;
}
case UNIQUE_ID:
{
resource.setUniqueID(record.getInteger(i));
break;
}
case MAX_UNITS:
{
resource.set(resourceField, record.getUnits(i));
break;
}
case PERCENT_WORK_COMPLETE:
case PEAK:
{
resource.set(resourceField, record.getPercentage(i));
break;
}
case COST:
case COST_PER_USE:
case COST_VARIANCE:
case BASELINE_COST:
case ACTUAL_COST:
case REMAINING_COST:
{
resource.set(resourceField, record.getCurrency(i));
break;
}
case OVERTIME_RATE:
case STANDARD_RATE:
{
resource.set(resourceField, record.getRate(i));
break;
}
case REMAINING_WORK:
case OVERTIME_WORK:
case BASELINE_WORK:
case ACTUAL_WORK:
case WORK:
case WORK_VARIANCE:
{
resource.set(resourceField, record.getDuration(i));
break;
}
case ACCRUE_AT:
{
resource.set(resourceField, record.getAccrueType(i));
break;
}
case LINKED_FIELDS:
case OVERALLOCATED:
{
resource.set(resourceField, record.getBoolean(i, falseText));
break;
}
default:
{
resource.set(resourceField, field);
break;
}
}
}
if (m_projectConfig.getAutoResourceUniqueID() == true)
{
resource.setUniqueID(Integer.valueOf(m_projectConfig.getNextResourceUniqueID()));
}
if (m_projectConfig.getAutoResourceID() == true)
{
resource.setID(Integer.valueOf(m_projectConfig.getNextResourceID()));
}
//
// Handle malformed MPX files - ensure we have a unique ID
//
if (resource.getUniqueID() == null)
{
resource.setUniqueID(resource.getID());
}
} | [
"private",
"void",
"populateResource",
"(",
"Resource",
"resource",
",",
"Record",
"record",
")",
"throws",
"MPXJException",
"{",
"String",
"falseText",
"=",
"LocaleData",
".",
"getString",
"(",
"m_locale",
",",
"LocaleData",
".",
"NO",
")",
";",
"int",
"lengt... | Populates a resource.
@param resource resource instance
@param record MPX record
@throws MPXJException | [
"Populates",
"a",
"resource",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L746-L869 |
157,007 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateRelationList | private void populateRelationList(Task task, TaskField field, String data)
{
DeferredRelationship dr = new DeferredRelationship();
dr.setTask(task);
dr.setField(field);
dr.setData(data);
m_deferredRelationships.add(dr);
} | java | private void populateRelationList(Task task, TaskField field, String data)
{
DeferredRelationship dr = new DeferredRelationship();
dr.setTask(task);
dr.setField(field);
dr.setData(data);
m_deferredRelationships.add(dr);
} | [
"private",
"void",
"populateRelationList",
"(",
"Task",
"task",
",",
"TaskField",
"field",
",",
"String",
"data",
")",
"{",
"DeferredRelationship",
"dr",
"=",
"new",
"DeferredRelationship",
"(",
")",
";",
"dr",
".",
"setTask",
"(",
"task",
")",
";",
"dr",
... | Populates a relation list.
@param task parent task
@param field target task field
@param data MPX relation list data | [
"Populates",
"a",
"relation",
"list",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L878-L885 |
157,008 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.processDeferredRelationship | private void processDeferredRelationship(DeferredRelationship dr) throws MPXJException
{
String data = dr.getData();
Task task = dr.getTask();
int length = data.length();
if (length != 0)
{
int start = 0;
int end = 0;
while (end != length)
{
end = data.indexOf(m_delimiter, start);
if (end == -1)
{
end = length;
}
populateRelation(dr.getField(), task, data.substring(start, end).trim());
start = end + 1;
}
}
} | java | private void processDeferredRelationship(DeferredRelationship dr) throws MPXJException
{
String data = dr.getData();
Task task = dr.getTask();
int length = data.length();
if (length != 0)
{
int start = 0;
int end = 0;
while (end != length)
{
end = data.indexOf(m_delimiter, start);
if (end == -1)
{
end = length;
}
populateRelation(dr.getField(), task, data.substring(start, end).trim());
start = end + 1;
}
}
} | [
"private",
"void",
"processDeferredRelationship",
"(",
"DeferredRelationship",
"dr",
")",
"throws",
"MPXJException",
"{",
"String",
"data",
"=",
"dr",
".",
"getData",
"(",
")",
";",
"Task",
"task",
"=",
"dr",
".",
"getTask",
"(",
")",
";",
"int",
"length",
... | This method processes a single deferred relationship list.
@param dr deferred relationship list data
@throws MPXJException | [
"This",
"method",
"processes",
"a",
"single",
"deferred",
"relationship",
"list",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L907-L933 |
157,009 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateRelation | private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException
{
int index = 0;
int length = relationship.length();
//
// Extract the identifier
//
while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true))
{
++index;
}
Integer taskID;
try
{
taskID = Integer.valueOf(relationship.substring(0, index));
}
catch (NumberFormatException ex)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
//
// Now find the task, so we can extract the unique ID
//
Task targetTask;
if (field == TaskField.PREDECESSORS)
{
targetTask = m_projectFile.getTaskByID(taskID);
}
else
{
targetTask = m_projectFile.getTaskByUniqueID(taskID);
}
//
// If we haven't reached the end, we next expect to find
// SF, SS, FS, FF
//
RelationType type = null;
Duration lag = null;
if (index == length)
{
type = RelationType.FINISH_START;
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
else
{
if ((index + 1) == length)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2));
index += 2;
if (index == length)
{
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
else
{
if (relationship.charAt(index) == '+')
{
++index;
}
lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale);
}
}
if (type == null)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
// We have seen at least one example MPX file where an invalid task ID
// is present. We'll ignore this as the schedule is otherwise valid.
if (targetTask != null)
{
Relation relation = sourceTask.addPredecessor(targetTask, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
} | java | private void populateRelation(TaskField field, Task sourceTask, String relationship) throws MPXJException
{
int index = 0;
int length = relationship.length();
//
// Extract the identifier
//
while ((index < length) && (Character.isDigit(relationship.charAt(index)) == true))
{
++index;
}
Integer taskID;
try
{
taskID = Integer.valueOf(relationship.substring(0, index));
}
catch (NumberFormatException ex)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
//
// Now find the task, so we can extract the unique ID
//
Task targetTask;
if (field == TaskField.PREDECESSORS)
{
targetTask = m_projectFile.getTaskByID(taskID);
}
else
{
targetTask = m_projectFile.getTaskByUniqueID(taskID);
}
//
// If we haven't reached the end, we next expect to find
// SF, SS, FS, FF
//
RelationType type = null;
Duration lag = null;
if (index == length)
{
type = RelationType.FINISH_START;
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
else
{
if ((index + 1) == length)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
type = RelationTypeUtility.getInstance(m_locale, relationship.substring(index, index + 2));
index += 2;
if (index == length)
{
lag = Duration.getInstance(0, TimeUnit.DAYS);
}
else
{
if (relationship.charAt(index) == '+')
{
++index;
}
lag = DurationUtility.getInstance(relationship.substring(index), m_formats.getDurationDecimalFormat(), m_locale);
}
}
if (type == null)
{
throw new MPXJException(MPXJException.INVALID_FORMAT + " '" + relationship + "'");
}
// We have seen at least one example MPX file where an invalid task ID
// is present. We'll ignore this as the schedule is otherwise valid.
if (targetTask != null)
{
Relation relation = sourceTask.addPredecessor(targetTask, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
} | [
"private",
"void",
"populateRelation",
"(",
"TaskField",
"field",
",",
"Task",
"sourceTask",
",",
"String",
"relationship",
")",
"throws",
"MPXJException",
"{",
"int",
"index",
"=",
"0",
";",
"int",
"length",
"=",
"relationship",
".",
"length",
"(",
")",
";"... | Creates and populates a new task relationship.
@param field which task field source of data
@param sourceTask relationship source task
@param relationship relationship string
@throws MPXJException | [
"Creates",
"and",
"populates",
"a",
"new",
"task",
"relationship",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L943-L1030 |
157,010 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateRecurringTask | private void populateRecurringTask(Record record, RecurringTask task) throws MPXJException
{
//System.out.println(record);
task.setStartDate(record.getDateTime(1));
task.setFinishDate(record.getDateTime(2));
task.setDuration(RecurrenceUtility.getDuration(m_projectFile.getProjectProperties(), record.getInteger(3), record.getInteger(4)));
task.setOccurrences(record.getInteger(5));
task.setRecurrenceType(RecurrenceUtility.getRecurrenceType(record.getInteger(6)));
task.setUseEndDate(NumberHelper.getInt(record.getInteger(8)) == 1);
task.setWorkingDaysOnly(NumberHelper.getInt(record.getInteger(9)) == 1);
task.setWeeklyDaysFromBitmap(RecurrenceUtility.getDays(record.getString(10)), RecurrenceUtility.RECURRING_TASK_DAY_MASKS);
RecurrenceType type = task.getRecurrenceType();
if (type != null)
{
switch (task.getRecurrenceType())
{
case DAILY:
{
task.setFrequency(record.getInteger(13));
break;
}
case WEEKLY:
{
task.setFrequency(record.getInteger(14));
break;
}
case MONTHLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(11)) == 1);
if (task.getRelative())
{
task.setFrequency(record.getInteger(17));
task.setDayNumber(record.getInteger(15));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(16)));
}
else
{
task.setFrequency(record.getInteger(19));
task.setDayNumber(record.getInteger(18));
}
break;
}
case YEARLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(12)) != 1);
if (task.getRelative())
{
task.setDayNumber(record.getInteger(20));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(21)));
task.setMonthNumber(record.getInteger(22));
}
else
{
task.setYearlyAbsoluteFromDate(record.getDateTime(23));
}
break;
}
}
}
//System.out.println(task);
} | java | private void populateRecurringTask(Record record, RecurringTask task) throws MPXJException
{
//System.out.println(record);
task.setStartDate(record.getDateTime(1));
task.setFinishDate(record.getDateTime(2));
task.setDuration(RecurrenceUtility.getDuration(m_projectFile.getProjectProperties(), record.getInteger(3), record.getInteger(4)));
task.setOccurrences(record.getInteger(5));
task.setRecurrenceType(RecurrenceUtility.getRecurrenceType(record.getInteger(6)));
task.setUseEndDate(NumberHelper.getInt(record.getInteger(8)) == 1);
task.setWorkingDaysOnly(NumberHelper.getInt(record.getInteger(9)) == 1);
task.setWeeklyDaysFromBitmap(RecurrenceUtility.getDays(record.getString(10)), RecurrenceUtility.RECURRING_TASK_DAY_MASKS);
RecurrenceType type = task.getRecurrenceType();
if (type != null)
{
switch (task.getRecurrenceType())
{
case DAILY:
{
task.setFrequency(record.getInteger(13));
break;
}
case WEEKLY:
{
task.setFrequency(record.getInteger(14));
break;
}
case MONTHLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(11)) == 1);
if (task.getRelative())
{
task.setFrequency(record.getInteger(17));
task.setDayNumber(record.getInteger(15));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(16)));
}
else
{
task.setFrequency(record.getInteger(19));
task.setDayNumber(record.getInteger(18));
}
break;
}
case YEARLY:
{
task.setRelative(NumberHelper.getInt(record.getInteger(12)) != 1);
if (task.getRelative())
{
task.setDayNumber(record.getInteger(20));
task.setDayOfWeek(RecurrenceUtility.getDay(record.getInteger(21)));
task.setMonthNumber(record.getInteger(22));
}
else
{
task.setYearlyAbsoluteFromDate(record.getDateTime(23));
}
break;
}
}
}
//System.out.println(task);
} | [
"private",
"void",
"populateRecurringTask",
"(",
"Record",
"record",
",",
"RecurringTask",
"task",
")",
"throws",
"MPXJException",
"{",
"//System.out.println(record);",
"task",
".",
"setStartDate",
"(",
"record",
".",
"getDateTime",
"(",
"1",
")",
")",
";",
"task"... | Populates a recurring task.
@param record MPX record
@param task recurring task
@throws MPXJException | [
"Populates",
"a",
"recurring",
"task",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1329-L1394 |
157,011 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateResourceAssignment | private void populateResourceAssignment(Record record, ResourceAssignment assignment) throws MPXJException
{
//
// Handle malformed MPX files - ensure that we can locate the resource
// using either the Unique ID attribute or the ID attribute.
//
Resource resource = m_projectFile.getResourceByUniqueID(record.getInteger(12));
if (resource == null)
{
resource = m_projectFile.getResourceByID(record.getInteger(0));
}
assignment.setUnits(record.getUnits(1));
assignment.setWork(record.getDuration(2));
assignment.setBaselineWork(record.getDuration(3));
assignment.setActualWork(record.getDuration(4));
assignment.setOvertimeWork(record.getDuration(5));
assignment.setCost(record.getCurrency(6));
assignment.setBaselineCost(record.getCurrency(7));
assignment.setActualCost(record.getCurrency(8));
assignment.setStart(record.getDateTime(9));
assignment.setFinish(record.getDateTime(10));
assignment.setDelay(record.getDuration(11));
//
// Calculate the remaining work
//
Duration work = assignment.getWork();
Duration actualWork = assignment.getActualWork();
if (work != null && actualWork != null)
{
if (work.getUnits() != actualWork.getUnits())
{
actualWork = actualWork.convertUnits(work.getUnits(), m_projectFile.getProjectProperties());
}
assignment.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));
}
if (resource != null)
{
assignment.setResourceUniqueID(resource.getUniqueID());
resource.addResourceAssignment(assignment);
}
m_eventManager.fireAssignmentReadEvent(assignment);
} | java | private void populateResourceAssignment(Record record, ResourceAssignment assignment) throws MPXJException
{
//
// Handle malformed MPX files - ensure that we can locate the resource
// using either the Unique ID attribute or the ID attribute.
//
Resource resource = m_projectFile.getResourceByUniqueID(record.getInteger(12));
if (resource == null)
{
resource = m_projectFile.getResourceByID(record.getInteger(0));
}
assignment.setUnits(record.getUnits(1));
assignment.setWork(record.getDuration(2));
assignment.setBaselineWork(record.getDuration(3));
assignment.setActualWork(record.getDuration(4));
assignment.setOvertimeWork(record.getDuration(5));
assignment.setCost(record.getCurrency(6));
assignment.setBaselineCost(record.getCurrency(7));
assignment.setActualCost(record.getCurrency(8));
assignment.setStart(record.getDateTime(9));
assignment.setFinish(record.getDateTime(10));
assignment.setDelay(record.getDuration(11));
//
// Calculate the remaining work
//
Duration work = assignment.getWork();
Duration actualWork = assignment.getActualWork();
if (work != null && actualWork != null)
{
if (work.getUnits() != actualWork.getUnits())
{
actualWork = actualWork.convertUnits(work.getUnits(), m_projectFile.getProjectProperties());
}
assignment.setRemainingWork(Duration.getInstance(work.getDuration() - actualWork.getDuration(), work.getUnits()));
}
if (resource != null)
{
assignment.setResourceUniqueID(resource.getUniqueID());
resource.addResourceAssignment(assignment);
}
m_eventManager.fireAssignmentReadEvent(assignment);
} | [
"private",
"void",
"populateResourceAssignment",
"(",
"Record",
"record",
",",
"ResourceAssignment",
"assignment",
")",
"throws",
"MPXJException",
"{",
"//",
"// Handle malformed MPX files - ensure that we can locate the resource",
"// using either the Unique ID attribute or the ID att... | Populate a resource assignment.
@param record MPX record
@param assignment resource assignment
@throws MPXJException | [
"Populate",
"a",
"resource",
"assignment",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1403-L1449 |
157,012 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateResourceAssignmentWorkgroupFields | private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException
{
workgroup.setMessageUniqueID(record.getString(0));
workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setResponsePending(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setUpdateStart(record.getDateTime(3));
workgroup.setUpdateFinish(record.getDateTime(4));
workgroup.setScheduleID(record.getString(5));
} | java | private void populateResourceAssignmentWorkgroupFields(Record record, ResourceAssignmentWorkgroupFields workgroup) throws MPXJException
{
workgroup.setMessageUniqueID(record.getString(0));
workgroup.setConfirmed(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setResponsePending(NumberHelper.getInt(record.getInteger(1)) == 1);
workgroup.setUpdateStart(record.getDateTime(3));
workgroup.setUpdateFinish(record.getDateTime(4));
workgroup.setScheduleID(record.getString(5));
} | [
"private",
"void",
"populateResourceAssignmentWorkgroupFields",
"(",
"Record",
"record",
",",
"ResourceAssignmentWorkgroupFields",
"workgroup",
")",
"throws",
"MPXJException",
"{",
"workgroup",
".",
"setMessageUniqueID",
"(",
"record",
".",
"getString",
"(",
"0",
")",
"... | Populate a resource assignment workgroup instance.
@param record MPX record
@param workgroup workgroup instance
@throws MPXJException | [
"Populate",
"a",
"resource",
"assignment",
"workgroup",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1458-L1466 |
157,013 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXReader.java | MPXReader.populateFileCreationRecord | static void populateFileCreationRecord(Record record, ProjectProperties properties)
{
properties.setMpxProgramName(record.getString(0));
properties.setMpxFileVersion(FileVersion.getInstance(record.getString(1)));
properties.setMpxCodePage(record.getCodePage(2));
} | java | static void populateFileCreationRecord(Record record, ProjectProperties properties)
{
properties.setMpxProgramName(record.getString(0));
properties.setMpxFileVersion(FileVersion.getInstance(record.getString(1)));
properties.setMpxCodePage(record.getCodePage(2));
} | [
"static",
"void",
"populateFileCreationRecord",
"(",
"Record",
"record",
",",
"ProjectProperties",
"properties",
")",
"{",
"properties",
".",
"setMpxProgramName",
"(",
"record",
".",
"getString",
"(",
"0",
")",
")",
";",
"properties",
".",
"setMpxFileVersion",
"("... | Populate a file creation record.
@param record MPX record
@param properties project properties | [
"Populate",
"a",
"file",
"creation",
"record",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L1474-L1479 |
157,014 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java | RelationTypeUtility.getInstance | public static RelationType getInstance(Locale locale, String type)
{
int index = -1;
String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES);
for (int loop = 0; loop < relationTypes.length; loop++)
{
if (relationTypes[loop].equalsIgnoreCase(type) == true)
{
index = loop;
break;
}
}
RelationType result = null;
if (index != -1)
{
result = RelationType.getInstance(index);
}
return (result);
} | java | public static RelationType getInstance(Locale locale, String type)
{
int index = -1;
String[] relationTypes = LocaleData.getStringArray(locale, LocaleData.RELATION_TYPES);
for (int loop = 0; loop < relationTypes.length; loop++)
{
if (relationTypes[loop].equalsIgnoreCase(type) == true)
{
index = loop;
break;
}
}
RelationType result = null;
if (index != -1)
{
result = RelationType.getInstance(index);
}
return (result);
} | [
"public",
"static",
"RelationType",
"getInstance",
"(",
"Locale",
"locale",
",",
"String",
"type",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"String",
"[",
"]",
"relationTypes",
"=",
"LocaleData",
".",
"getStringArray",
"(",
"locale",
",",
"LocaleData",
... | This method takes the textual version of a relation type
and returns an appropriate class instance. Note that unrecognised
values will cause this method to return null.
@param locale target locale
@param type text version of the relation type
@return RelationType instance | [
"This",
"method",
"takes",
"the",
"textual",
"version",
"of",
"a",
"relation",
"type",
"and",
"returns",
"an",
"appropriate",
"class",
"instance",
".",
"Note",
"that",
"unrecognised",
"values",
"will",
"cause",
"this",
"method",
"to",
"return",
"null",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/RelationTypeUtility.java#L53-L74 |
157,015 | joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java | DatatypeConverter.parseDuration | public static final Duration parseDuration(String value)
{
Duration result = null;
if (value != null)
{
int split = value.indexOf(' ');
if (split != -1)
{
double durationValue = Double.parseDouble(value.substring(0, split));
TimeUnit durationUnits = parseTimeUnits(value.substring(split + 1));
result = Duration.getInstance(durationValue, durationUnits);
}
}
return result;
} | java | public static final Duration parseDuration(String value)
{
Duration result = null;
if (value != null)
{
int split = value.indexOf(' ');
if (split != -1)
{
double durationValue = Double.parseDouble(value.substring(0, split));
TimeUnit durationUnits = parseTimeUnits(value.substring(split + 1));
result = Duration.getInstance(durationValue, durationUnits);
}
}
return result;
} | [
"public",
"static",
"final",
"Duration",
"parseDuration",
"(",
"String",
"value",
")",
"{",
"Duration",
"result",
"=",
"null",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"int",
"split",
"=",
"value",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if... | Convert the Phoenix representation of a duration into a Duration instance.
@param value Phoenix duration
@return Duration instance | [
"Convert",
"the",
"Phoenix",
"representation",
"of",
"a",
"duration",
"into",
"a",
"Duration",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java#L201-L217 |
157,016 | joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java | DatatypeConverter.printDuration | public static final String printDuration(Duration duration)
{
String result = null;
if (duration != null)
{
result = duration.getDuration() + " " + printTimeUnits(duration.getUnits());
}
return result;
} | java | public static final String printDuration(Duration duration)
{
String result = null;
if (duration != null)
{
result = duration.getDuration() + " " + printTimeUnits(duration.getUnits());
}
return result;
} | [
"public",
"static",
"final",
"String",
"printDuration",
"(",
"Duration",
"duration",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"duration",
"!=",
"null",
")",
"{",
"result",
"=",
"duration",
".",
"getDuration",
"(",
")",
"+",
"\" \"",
"+"... | Retrieve a duration in the form required by Phoenix.
@param duration Duration instance
@return formatted duration | [
"Retrieve",
"a",
"duration",
"in",
"the",
"form",
"required",
"by",
"Phoenix",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java#L225-L233 |
157,017 | joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java | DatatypeConverter.printFinishDateTime | public static final String printFinishDateTime(Date value)
{
if (value != null)
{
value = DateHelper.addDays(value, 1);
}
return (value == null ? null : DATE_FORMAT.get().format(value));
} | java | public static final String printFinishDateTime(Date value)
{
if (value != null)
{
value = DateHelper.addDays(value, 1);
}
return (value == null ? null : DATE_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printFinishDateTime",
"(",
"Date",
"value",
")",
"{",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"value",
"=",
"DateHelper",
".",
"addDays",
"(",
"value",
",",
"1",
")",
";",
"}",
"return",
"(",
"value",
"==",
... | Retrieve a finish date time in the form required by Phoenix.
@param value Date instance
@return formatted date time | [
"Retrieve",
"a",
"finish",
"date",
"time",
"in",
"the",
"form",
"required",
"by",
"Phoenix",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java#L252-L259 |
157,018 | joniles/mpxj | src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java | DatatypeConverter.parseFinishDateTime | public static final Date parseFinishDateTime(String value)
{
Date result = parseDateTime(value);
if (result != null)
{
result = DateHelper.addDays(result, -1);
}
return result;
} | java | public static final Date parseFinishDateTime(String value)
{
Date result = parseDateTime(value);
if (result != null)
{
result = DateHelper.addDays(result, -1);
}
return result;
} | [
"public",
"static",
"final",
"Date",
"parseFinishDateTime",
"(",
"String",
"value",
")",
"{",
"Date",
"result",
"=",
"parseDateTime",
"(",
"value",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"result",
"=",
"DateHelper",
".",
"addDays",
"(",
"... | Convert the Phoenix representation of a finish date time into a Date instance.
@param value Phoenix date time
@return Date instance | [
"Convert",
"the",
"Phoenix",
"representation",
"of",
"a",
"finish",
"date",
"time",
"into",
"a",
"Date",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/DatatypeConverter.java#L267-L275 |
157,019 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/GanttChartView14.java | GanttChartView14.getFieldType | private FieldType getFieldType(byte[] data, int offset)
{
int fieldIndex = MPPUtility.getInt(data, offset);
return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex));
} | java | private FieldType getFieldType(byte[] data, int offset)
{
int fieldIndex = MPPUtility.getInt(data, offset);
return FieldTypeHelper.mapTextFields(FieldTypeHelper.getInstance14(fieldIndex));
} | [
"private",
"FieldType",
"getFieldType",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
")",
"{",
"int",
"fieldIndex",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"offset",
")",
";",
"return",
"FieldTypeHelper",
".",
"mapTextFields",
"(",
"Fie... | Retrieves a field type from a location in a data block.
@param data data block
@param offset offset into data block
@return field type | [
"Retrieves",
"a",
"field",
"type",
"from",
"a",
"location",
"in",
"a",
"data",
"block",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/GanttChartView14.java#L127-L131 |
157,020 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.readFile | private ProjectFile readFile(File file) throws MPXJException
{
try
{
String url = "jdbc:sqlite:" + file.getAbsolutePath();
Properties props = new Properties();
m_connection = org.sqlite.JDBC.createConnection(url, props);
m_documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
m_dayTimeIntervals = xpath.compile("/array/dayTimeInterval");
m_entityMap = new HashMap<String, Integer>();
return read();
}
catch (Exception ex)
{
throw new MPXJException(MPXJException.INVALID_FORMAT, ex);
}
finally
{
if (m_connection != null)
{
try
{
m_connection.close();
}
catch (SQLException ex)
{
// silently ignore exceptions when closing connection
}
}
m_documentBuilder = null;
m_dayTimeIntervals = null;
m_entityMap = null;
}
} | java | private ProjectFile readFile(File file) throws MPXJException
{
try
{
String url = "jdbc:sqlite:" + file.getAbsolutePath();
Properties props = new Properties();
m_connection = org.sqlite.JDBC.createConnection(url, props);
m_documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
XPathFactory xPathfactory = XPathFactory.newInstance();
XPath xpath = xPathfactory.newXPath();
m_dayTimeIntervals = xpath.compile("/array/dayTimeInterval");
m_entityMap = new HashMap<String, Integer>();
return read();
}
catch (Exception ex)
{
throw new MPXJException(MPXJException.INVALID_FORMAT, ex);
}
finally
{
if (m_connection != null)
{
try
{
m_connection.close();
}
catch (SQLException ex)
{
// silently ignore exceptions when closing connection
}
}
m_documentBuilder = null;
m_dayTimeIntervals = null;
m_entityMap = null;
}
} | [
"private",
"ProjectFile",
"readFile",
"(",
"File",
"file",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"String",
"url",
"=",
"\"jdbc:sqlite:\"",
"+",
"file",
".",
"getAbsolutePath",
"(",
")",
";",
"Properties",
"props",
"=",
"new",
"Properties",
"(",
")... | By the time we reach this method, we should be looking at the SQLite
database file itself.
@param file SQLite database file
@return ProjectFile instance | [
"By",
"the",
"time",
"we",
"reach",
"this",
"method",
"we",
"should",
"be",
"looking",
"at",
"the",
"SQLite",
"database",
"file",
"itself",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L160-L201 |
157,021 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.read | private ProjectFile read() throws Exception
{
m_project = new ProjectFile();
m_eventManager = m_project.getEventManager();
ProjectConfig config = m_project.getProjectConfig();
config.setAutoCalendarUniqueID(false);
config.setAutoTaskUniqueID(false);
config.setAutoResourceUniqueID(false);
m_project.getProjectProperties().setFileApplication("Merlin");
m_project.getProjectProperties().setFileType("SQLITE");
m_eventManager.addProjectListeners(m_projectListeners);
populateEntityMap();
processProject();
processCalendars();
processResources();
processTasks();
processAssignments();
processDependencies();
return m_project;
} | java | private ProjectFile read() throws Exception
{
m_project = new ProjectFile();
m_eventManager = m_project.getEventManager();
ProjectConfig config = m_project.getProjectConfig();
config.setAutoCalendarUniqueID(false);
config.setAutoTaskUniqueID(false);
config.setAutoResourceUniqueID(false);
m_project.getProjectProperties().setFileApplication("Merlin");
m_project.getProjectProperties().setFileType("SQLITE");
m_eventManager.addProjectListeners(m_projectListeners);
populateEntityMap();
processProject();
processCalendars();
processResources();
processTasks();
processAssignments();
processDependencies();
return m_project;
} | [
"private",
"ProjectFile",
"read",
"(",
")",
"throws",
"Exception",
"{",
"m_project",
"=",
"new",
"ProjectFile",
"(",
")",
";",
"m_eventManager",
"=",
"m_project",
".",
"getEventManager",
"(",
")",
";",
"ProjectConfig",
"config",
"=",
"m_project",
".",
"getProj... | Read the project data and return a ProjectFile instance.
@return ProjectFile instance | [
"Read",
"the",
"project",
"data",
"and",
"return",
"a",
"ProjectFile",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L208-L232 |
157,022 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.populateEntityMap | private void populateEntityMap() throws SQLException
{
for (Row row : getRows("select * from z_primarykey"))
{
m_entityMap.put(row.getString("Z_NAME"), row.getInteger("Z_ENT"));
}
} | java | private void populateEntityMap() throws SQLException
{
for (Row row : getRows("select * from z_primarykey"))
{
m_entityMap.put(row.getString("Z_NAME"), row.getInteger("Z_ENT"));
}
} | [
"private",
"void",
"populateEntityMap",
"(",
")",
"throws",
"SQLException",
"{",
"for",
"(",
"Row",
"row",
":",
"getRows",
"(",
"\"select * from z_primarykey\"",
")",
")",
"{",
"m_entityMap",
".",
"put",
"(",
"row",
".",
"getString",
"(",
"\"Z_NAME\"",
")",
... | Create a mapping from entity names to entity ID values. | [
"Create",
"a",
"mapping",
"from",
"entity",
"names",
"to",
"entity",
"ID",
"values",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L237-L243 |
157,023 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processCalendars | private void processCalendars() throws Exception
{
List<Row> rows = getRows("select * from zcalendar where zproject=?", m_projectID);
for (Row row : rows)
{
ProjectCalendar calendar = m_project.addCalendar();
calendar.setUniqueID(row.getInteger("Z_PK"));
calendar.setName(row.getString("ZTITLE"));
processDays(calendar);
processExceptions(calendar);
m_eventManager.fireCalendarReadEvent(calendar);
}
} | java | private void processCalendars() throws Exception
{
List<Row> rows = getRows("select * from zcalendar where zproject=?", m_projectID);
for (Row row : rows)
{
ProjectCalendar calendar = m_project.addCalendar();
calendar.setUniqueID(row.getInteger("Z_PK"));
calendar.setName(row.getString("ZTITLE"));
processDays(calendar);
processExceptions(calendar);
m_eventManager.fireCalendarReadEvent(calendar);
}
} | [
"private",
"void",
"processCalendars",
"(",
")",
"throws",
"Exception",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from zcalendar where zproject=?\"",
",",
"m_projectID",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
... | Read calendar data. | [
"Read",
"calendar",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L266-L278 |
157,024 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processDays | private void processDays(ProjectCalendar calendar) throws Exception
{
// Default all days to non-working
for (Day day : Day.values())
{
calendar.setWorkingDay(day, false);
}
List<Row> rows = getRows("select * from zcalendarrule where zcalendar1=? and z_ent=?", calendar.getUniqueID(), m_entityMap.get("CalendarWeekDayRule"));
for (Row row : rows)
{
Day day = row.getDay("ZWEEKDAY");
String timeIntervals = row.getString("ZTIMEINTERVALS");
if (timeIntervals == null)
{
calendar.setWorkingDay(day, false);
}
else
{
ProjectCalendarHours hours = calendar.addCalendarHours(day);
NodeList nodes = getNodeList(timeIntervals, m_dayTimeIntervals);
calendar.setWorkingDay(day, nodes.getLength() > 0);
for (int loop = 0; loop < nodes.getLength(); loop++)
{
NamedNodeMap attributes = nodes.item(loop).getAttributes();
Date startTime = m_calendarTimeFormat.parse(attributes.getNamedItem("startTime").getTextContent());
Date endTime = m_calendarTimeFormat.parse(attributes.getNamedItem("endTime").getTextContent());
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
} | java | private void processDays(ProjectCalendar calendar) throws Exception
{
// Default all days to non-working
for (Day day : Day.values())
{
calendar.setWorkingDay(day, false);
}
List<Row> rows = getRows("select * from zcalendarrule where zcalendar1=? and z_ent=?", calendar.getUniqueID(), m_entityMap.get("CalendarWeekDayRule"));
for (Row row : rows)
{
Day day = row.getDay("ZWEEKDAY");
String timeIntervals = row.getString("ZTIMEINTERVALS");
if (timeIntervals == null)
{
calendar.setWorkingDay(day, false);
}
else
{
ProjectCalendarHours hours = calendar.addCalendarHours(day);
NodeList nodes = getNodeList(timeIntervals, m_dayTimeIntervals);
calendar.setWorkingDay(day, nodes.getLength() > 0);
for (int loop = 0; loop < nodes.getLength(); loop++)
{
NamedNodeMap attributes = nodes.item(loop).getAttributes();
Date startTime = m_calendarTimeFormat.parse(attributes.getNamedItem("startTime").getTextContent());
Date endTime = m_calendarTimeFormat.parse(attributes.getNamedItem("endTime").getTextContent());
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
} | [
"private",
"void",
"processDays",
"(",
"ProjectCalendar",
"calendar",
")",
"throws",
"Exception",
"{",
"// Default all days to non-working",
"for",
"(",
"Day",
"day",
":",
"Day",
".",
"values",
"(",
")",
")",
"{",
"calendar",
".",
"setWorkingDay",
"(",
"day",
... | Process normal calendar working and non-working days.
@param calendar parent calendar | [
"Process",
"normal",
"calendar",
"working",
"and",
"non",
"-",
"working",
"days",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L285-L323 |
157,025 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processResources | private void processResources() throws SQLException
{
List<Row> rows = getRows("select * from zresource where zproject=? order by zorderinproject", m_projectID);
for (Row row : rows)
{
Resource resource = m_project.addResource();
resource.setUniqueID(row.getInteger("Z_PK"));
resource.setEmailAddress(row.getString("ZEMAIL"));
resource.setInitials(row.getString("ZINITIALS"));
resource.setName(row.getString("ZTITLE_"));
resource.setGUID(row.getUUID("ZUNIQUEID"));
resource.setType(row.getResourceType("ZTYPE"));
resource.setMaterialLabel(row.getString("ZMATERIALUNIT"));
if (resource.getType() == ResourceType.WORK)
{
resource.setMaxUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("ZAVAILABLEUNITS_")) * 100.0));
}
Integer calendarID = row.getInteger("ZRESOURCECALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
calendar.setName(resource.getName());
resource.setResourceCalendar(calendar);
}
}
m_eventManager.fireResourceReadEvent(resource);
}
} | java | private void processResources() throws SQLException
{
List<Row> rows = getRows("select * from zresource where zproject=? order by zorderinproject", m_projectID);
for (Row row : rows)
{
Resource resource = m_project.addResource();
resource.setUniqueID(row.getInteger("Z_PK"));
resource.setEmailAddress(row.getString("ZEMAIL"));
resource.setInitials(row.getString("ZINITIALS"));
resource.setName(row.getString("ZTITLE_"));
resource.setGUID(row.getUUID("ZUNIQUEID"));
resource.setType(row.getResourceType("ZTYPE"));
resource.setMaterialLabel(row.getString("ZMATERIALUNIT"));
if (resource.getType() == ResourceType.WORK)
{
resource.setMaxUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("ZAVAILABLEUNITS_")) * 100.0));
}
Integer calendarID = row.getInteger("ZRESOURCECALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
calendar.setName(resource.getName());
resource.setResourceCalendar(calendar);
}
}
m_eventManager.fireResourceReadEvent(resource);
}
} | [
"private",
"void",
"processResources",
"(",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from zresource where zproject=? order by zorderinproject\"",
",",
"m_projectID",
")",
";",
"for",
"(",
"Row",
"row",
":"... | Read resource data. | [
"Read",
"resource",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L363-L395 |
157,026 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processTasks | private void processTasks() throws SQLException
{
//
// Yes... we could probably read this in one query in the right order
// using a CTE... but life's too short.
//
List<Row> rows = getRows("select * from zscheduleitem where zproject=? and zparentactivity_ is null and z_ent=? order by zorderinparentactivity", m_projectID, m_entityMap.get("Activity"));
for (Row row : rows)
{
Task task = m_project.addTask();
populateTask(row, task);
processChildTasks(task);
}
} | java | private void processTasks() throws SQLException
{
//
// Yes... we could probably read this in one query in the right order
// using a CTE... but life's too short.
//
List<Row> rows = getRows("select * from zscheduleitem where zproject=? and zparentactivity_ is null and z_ent=? order by zorderinparentactivity", m_projectID, m_entityMap.get("Activity"));
for (Row row : rows)
{
Task task = m_project.addTask();
populateTask(row, task);
processChildTasks(task);
}
} | [
"private",
"void",
"processTasks",
"(",
")",
"throws",
"SQLException",
"{",
"//",
"// Yes... we could probably read this in one query in the right order",
"// using a CTE... but life's too short.",
"//",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from z... | Read all top level tasks. | [
"Read",
"all",
"top",
"level",
"tasks",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L400-L413 |
157,027 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processChildTasks | private void processChildTasks(Task parentTask) throws SQLException
{
List<Row> rows = getRows("select * from zscheduleitem where zparentactivity_=? and z_ent=? order by zorderinparentactivity", parentTask.getUniqueID(), m_entityMap.get("Activity"));
for (Row row : rows)
{
Task task = parentTask.addTask();
populateTask(row, task);
processChildTasks(task);
}
} | java | private void processChildTasks(Task parentTask) throws SQLException
{
List<Row> rows = getRows("select * from zscheduleitem where zparentactivity_=? and z_ent=? order by zorderinparentactivity", parentTask.getUniqueID(), m_entityMap.get("Activity"));
for (Row row : rows)
{
Task task = parentTask.addTask();
populateTask(row, task);
processChildTasks(task);
}
} | [
"private",
"void",
"processChildTasks",
"(",
"Task",
"parentTask",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from zscheduleitem where zparentactivity_=? and z_ent=? order by zorderinparentactivity\"",
",",
"parentTas... | Read all child tasks for a given parent.
@param parentTask parent task | [
"Read",
"all",
"child",
"tasks",
"for",
"a",
"given",
"parent",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L420-L429 |
157,028 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.populateTask | private void populateTask(Row row, Task task)
{
task.setUniqueID(row.getInteger("Z_PK"));
task.setName(row.getString("ZTITLE"));
task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY")));
task.setMilestone(row.getBoolean("ZISMILESTONE"));
task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
task.setNotes(row.getString("ZOBJECTDESCRIPTION"));
task.setDuration(row.getDuration("ZGIVENDURATION_"));
task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_"));
task.setWork(row.getWork("ZGIVENWORK_"));
task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_"));
task.setActualWork(row.getWork("ZGIVENACTUALWORK_"));
task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_"));
task.setGUID(row.getUUID("ZUNIQUEID"));
Integer calendarID = row.getInteger("ZGIVENCALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
task.setCalendar(calendar);
}
}
populateConstraints(row, task);
// Percent complete is calculated bottom up from assignments and actual work vs. planned work
m_eventManager.fireTaskReadEvent(task);
} | java | private void populateTask(Row row, Task task)
{
task.setUniqueID(row.getInteger("Z_PK"));
task.setName(row.getString("ZTITLE"));
task.setPriority(Priority.getInstance(row.getInt("ZPRIORITY")));
task.setMilestone(row.getBoolean("ZISMILESTONE"));
task.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
task.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
task.setNotes(row.getString("ZOBJECTDESCRIPTION"));
task.setDuration(row.getDuration("ZGIVENDURATION_"));
task.setOvertimeWork(row.getWork("ZGIVENWORKOVERTIME_"));
task.setWork(row.getWork("ZGIVENWORK_"));
task.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
task.setActualOvertimeWork(row.getWork("ZGIVENACTUALWORKOVERTIME_"));
task.setActualWork(row.getWork("ZGIVENACTUALWORK_"));
task.setRemainingWork(row.getWork("ZGIVENACTUALWORK_"));
task.setGUID(row.getUUID("ZUNIQUEID"));
Integer calendarID = row.getInteger("ZGIVENCALENDAR");
if (calendarID != null)
{
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
if (calendar != null)
{
task.setCalendar(calendar);
}
}
populateConstraints(row, task);
// Percent complete is calculated bottom up from assignments and actual work vs. planned work
m_eventManager.fireTaskReadEvent(task);
} | [
"private",
"void",
"populateTask",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"task",
".",
"setUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"Z_PK\"",
")",
")",
";",
"task",
".",
"setName",
"(",
"row",
".",
"getString",
"(",
"\"ZTITLE\"",
")"... | Read data for an individual task.
@param row task data from database
@param task Task instance | [
"Read",
"data",
"for",
"an",
"individual",
"task",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L437-L470 |
157,029 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.populateConstraints | private void populateConstraints(Row row, Task task)
{
Date endDateMax = row.getTimestamp("ZGIVENENDDATEMAX_");
Date endDateMin = row.getTimestamp("ZGIVENENDDATEMIN_");
Date startDateMax = row.getTimestamp("ZGIVENSTARTDATEMAX_");
Date startDateMin = row.getTimestamp("ZGIVENSTARTDATEMIN_");
ConstraintType constraintType = null;
Date constraintDate = null;
if (endDateMax != null)
{
constraintType = ConstraintType.FINISH_NO_LATER_THAN;
constraintDate = endDateMax;
}
if (endDateMin != null)
{
constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;
constraintDate = endDateMin;
}
if (endDateMin != null && endDateMin == endDateMax)
{
constraintType = ConstraintType.MUST_FINISH_ON;
constraintDate = endDateMin;
}
if (startDateMax != null)
{
constraintType = ConstraintType.START_NO_LATER_THAN;
constraintDate = startDateMax;
}
if (startDateMin != null)
{
constraintType = ConstraintType.START_NO_EARLIER_THAN;
constraintDate = startDateMin;
}
if (startDateMin != null && startDateMin == endDateMax)
{
constraintType = ConstraintType.MUST_START_ON;
constraintDate = endDateMin;
}
task.setConstraintType(constraintType);
task.setConstraintDate(constraintDate);
} | java | private void populateConstraints(Row row, Task task)
{
Date endDateMax = row.getTimestamp("ZGIVENENDDATEMAX_");
Date endDateMin = row.getTimestamp("ZGIVENENDDATEMIN_");
Date startDateMax = row.getTimestamp("ZGIVENSTARTDATEMAX_");
Date startDateMin = row.getTimestamp("ZGIVENSTARTDATEMIN_");
ConstraintType constraintType = null;
Date constraintDate = null;
if (endDateMax != null)
{
constraintType = ConstraintType.FINISH_NO_LATER_THAN;
constraintDate = endDateMax;
}
if (endDateMin != null)
{
constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;
constraintDate = endDateMin;
}
if (endDateMin != null && endDateMin == endDateMax)
{
constraintType = ConstraintType.MUST_FINISH_ON;
constraintDate = endDateMin;
}
if (startDateMax != null)
{
constraintType = ConstraintType.START_NO_LATER_THAN;
constraintDate = startDateMax;
}
if (startDateMin != null)
{
constraintType = ConstraintType.START_NO_EARLIER_THAN;
constraintDate = startDateMin;
}
if (startDateMin != null && startDateMin == endDateMax)
{
constraintType = ConstraintType.MUST_START_ON;
constraintDate = endDateMin;
}
task.setConstraintType(constraintType);
task.setConstraintDate(constraintDate);
} | [
"private",
"void",
"populateConstraints",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"Date",
"endDateMax",
"=",
"row",
".",
"getTimestamp",
"(",
"\"ZGIVENENDDATEMAX_\"",
")",
";",
"Date",
"endDateMin",
"=",
"row",
".",
"getTimestamp",
"(",
"\"ZGIVENENDD... | Populate the constraint type and constraint date.
Note that Merlin allows both start and end constraints simultaneously.
As we can't have both, we'll prefer the start constraint.
@param row task data from database
@param task Task instance | [
"Populate",
"the",
"constraint",
"type",
"and",
"constraint",
"date",
".",
"Note",
"that",
"Merlin",
"allows",
"both",
"start",
"and",
"end",
"constraints",
"simultaneously",
".",
"As",
"we",
"can",
"t",
"have",
"both",
"we",
"ll",
"prefer",
"the",
"start",
... | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L480-L528 |
157,030 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processAssignments | private void processAssignments() throws SQLException
{
List<Row> rows = getRows("select * from zscheduleitem where zproject=? and z_ent=? order by zorderinactivity", m_projectID, m_entityMap.get("Assignment"));
for (Row row : rows)
{
Task task = m_project.getTaskByUniqueID(row.getInteger("ZACTIVITY_"));
Resource resource = m_project.getResourceByUniqueID(row.getInteger("ZRESOURCE"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
assignment.setGUID(row.getUUID("ZUNIQUEID"));
assignment.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
assignment.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
assignment.setWork(assignmentDuration(task, row.getWork("ZGIVENWORK_")));
assignment.setOvertimeWork(assignmentDuration(task, row.getWork("ZGIVENWORKOVERTIME_")));
assignment.setActualWork(assignmentDuration(task, row.getWork("ZGIVENACTUALWORK_")));
assignment.setActualOvertimeWork(assignmentDuration(task, row.getWork("ZGIVENACTUALWORKOVERTIME_")));
assignment.setRemainingWork(assignmentDuration(task, row.getWork("ZGIVENREMAININGWORK_")));
assignment.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
if (assignment.getRemainingWork() == null)
{
assignment.setRemainingWork(assignment.getWork());
}
if (resource.getType() == ResourceType.WORK)
{
assignment.setUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("ZRESOURCEUNITS_")) * 100.0));
}
}
}
} | java | private void processAssignments() throws SQLException
{
List<Row> rows = getRows("select * from zscheduleitem where zproject=? and z_ent=? order by zorderinactivity", m_projectID, m_entityMap.get("Assignment"));
for (Row row : rows)
{
Task task = m_project.getTaskByUniqueID(row.getInteger("ZACTIVITY_"));
Resource resource = m_project.getResourceByUniqueID(row.getInteger("ZRESOURCE"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
assignment.setGUID(row.getUUID("ZUNIQUEID"));
assignment.setActualFinish(row.getTimestamp("ZGIVENACTUALENDDATE_"));
assignment.setActualStart(row.getTimestamp("ZGIVENACTUALSTARTDATE_"));
assignment.setWork(assignmentDuration(task, row.getWork("ZGIVENWORK_")));
assignment.setOvertimeWork(assignmentDuration(task, row.getWork("ZGIVENWORKOVERTIME_")));
assignment.setActualWork(assignmentDuration(task, row.getWork("ZGIVENACTUALWORK_")));
assignment.setActualOvertimeWork(assignmentDuration(task, row.getWork("ZGIVENACTUALWORKOVERTIME_")));
assignment.setRemainingWork(assignmentDuration(task, row.getWork("ZGIVENREMAININGWORK_")));
assignment.setLevelingDelay(row.getDuration("ZLEVELINGDELAY_"));
if (assignment.getRemainingWork() == null)
{
assignment.setRemainingWork(assignment.getWork());
}
if (resource.getType() == ResourceType.WORK)
{
assignment.setUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("ZRESOURCEUNITS_")) * 100.0));
}
}
}
} | [
"private",
"void",
"processAssignments",
"(",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from zscheduleitem where zproject=? and z_ent=? order by zorderinactivity\"",
",",
"m_projectID",
",",
"m_entityMap",
".",
"... | Read assignment data. | [
"Read",
"assignment",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L533-L566 |
157,031 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.assignmentDuration | private Duration assignmentDuration(Task task, Duration work)
{
Duration result = work;
if (result != null)
{
if (result.getUnits() == TimeUnit.PERCENT)
{
Duration taskWork = task.getWork();
if (taskWork != null)
{
result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits());
}
}
}
return result;
} | java | private Duration assignmentDuration(Task task, Duration work)
{
Duration result = work;
if (result != null)
{
if (result.getUnits() == TimeUnit.PERCENT)
{
Duration taskWork = task.getWork();
if (taskWork != null)
{
result = Duration.getInstance(taskWork.getDuration() * result.getDuration(), taskWork.getUnits());
}
}
}
return result;
} | [
"private",
"Duration",
"assignmentDuration",
"(",
"Task",
"task",
",",
"Duration",
"work",
")",
"{",
"Duration",
"result",
"=",
"work",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"if",
"(",
"result",
".",
"getUnits",
"(",
")",
"==",
"TimeUnit",
... | Extract a duration amount from the assignment, converting a percentage
into an actual duration.
@param task parent task
@param work duration from assignment
@return Duration instance | [
"Extract",
"a",
"duration",
"amount",
"from",
"the",
"assignment",
"converting",
"a",
"percentage",
"into",
"an",
"actual",
"duration",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L576-L592 |
157,032 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.processDependencies | private void processDependencies() throws SQLException
{
List<Row> rows = getRows("select * from zdependency where zproject=?", m_projectID);
for (Row row : rows)
{
Task nextTask = m_project.getTaskByUniqueID(row.getInteger("ZNEXTACTIVITY_"));
Task prevTask = m_project.getTaskByUniqueID(row.getInteger("ZPREVIOUSACTIVITY_"));
Duration lag = row.getDuration("ZLAG_");
RelationType type = row.getRelationType("ZTYPE");
Relation relation = nextTask.addPredecessor(prevTask, type, lag);
relation.setUniqueID(row.getInteger("Z_PK"));
}
} | java | private void processDependencies() throws SQLException
{
List<Row> rows = getRows("select * from zdependency where zproject=?", m_projectID);
for (Row row : rows)
{
Task nextTask = m_project.getTaskByUniqueID(row.getInteger("ZNEXTACTIVITY_"));
Task prevTask = m_project.getTaskByUniqueID(row.getInteger("ZPREVIOUSACTIVITY_"));
Duration lag = row.getDuration("ZLAG_");
RelationType type = row.getRelationType("ZTYPE");
Relation relation = nextTask.addPredecessor(prevTask, type, lag);
relation.setUniqueID(row.getInteger("Z_PK"));
}
} | [
"private",
"void",
"processDependencies",
"(",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from zdependency where zproject=?\"",
",",
"m_projectID",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
... | Read relation data. | [
"Read",
"relation",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L597-L609 |
157,033 | joniles/mpxj | src/main/java/net/sf/mpxj/merlin/MerlinReader.java | MerlinReader.getNodeList | private NodeList getNodeList(String document, XPathExpression expression) throws Exception
{
Document doc = m_documentBuilder.parse(new InputSource(new StringReader(document)));
return (NodeList) expression.evaluate(doc, XPathConstants.NODESET);
} | java | private NodeList getNodeList(String document, XPathExpression expression) throws Exception
{
Document doc = m_documentBuilder.parse(new InputSource(new StringReader(document)));
return (NodeList) expression.evaluate(doc, XPathConstants.NODESET);
} | [
"private",
"NodeList",
"getNodeList",
"(",
"String",
"document",
",",
"XPathExpression",
"expression",
")",
"throws",
"Exception",
"{",
"Document",
"doc",
"=",
"m_documentBuilder",
".",
"parse",
"(",
"new",
"InputSource",
"(",
"new",
"StringReader",
"(",
"document... | Retrieve a node list based on an XPath expression.
@param document XML document to process
@param expression compiled XPath expression
@return node list | [
"Retrieve",
"a",
"node",
"list",
"based",
"on",
"an",
"XPath",
"expression",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/merlin/MerlinReader.java#L666-L670 |
157,034 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/FilterReader.java | FilterReader.process | public void process(ProjectProperties properties, FilterContainer filters, FixedData fixedData, Var2Data varData)
{
int filterCount = fixedData.getItemCount();
boolean[] criteriaType = new boolean[2];
CriteriaReader criteriaReader = getCriteriaReader();
for (int filterLoop = 0; filterLoop < filterCount; filterLoop++)
{
byte[] filterFixedData = fixedData.getByteArrayValue(filterLoop);
if (filterFixedData == null || filterFixedData.length < 4)
{
continue;
}
Filter filter = new Filter();
filter.setID(Integer.valueOf(MPPUtility.getInt(filterFixedData, 0)));
filter.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(filterFixedData, 4)));
byte[] filterVarData = varData.getByteArray(filter.getID(), getVarDataType());
if (filterVarData == null)
{
continue;
}
//System.out.println(ByteArrayHelper.hexdump(filterVarData, true, 16, ""));
List<GenericCriteriaPrompt> prompts = new LinkedList<GenericCriteriaPrompt>();
filter.setShowRelatedSummaryRows(MPPUtility.getByte(filterVarData, 4) != 0);
filter.setCriteria(criteriaReader.process(properties, filterVarData, 0, -1, prompts, null, criteriaType));
filter.setIsTaskFilter(criteriaType[0]);
filter.setIsResourceFilter(criteriaType[1]);
filter.setPrompts(prompts);
filters.addFilter(filter);
//System.out.println(filter);
}
} | java | public void process(ProjectProperties properties, FilterContainer filters, FixedData fixedData, Var2Data varData)
{
int filterCount = fixedData.getItemCount();
boolean[] criteriaType = new boolean[2];
CriteriaReader criteriaReader = getCriteriaReader();
for (int filterLoop = 0; filterLoop < filterCount; filterLoop++)
{
byte[] filterFixedData = fixedData.getByteArrayValue(filterLoop);
if (filterFixedData == null || filterFixedData.length < 4)
{
continue;
}
Filter filter = new Filter();
filter.setID(Integer.valueOf(MPPUtility.getInt(filterFixedData, 0)));
filter.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(filterFixedData, 4)));
byte[] filterVarData = varData.getByteArray(filter.getID(), getVarDataType());
if (filterVarData == null)
{
continue;
}
//System.out.println(ByteArrayHelper.hexdump(filterVarData, true, 16, ""));
List<GenericCriteriaPrompt> prompts = new LinkedList<GenericCriteriaPrompt>();
filter.setShowRelatedSummaryRows(MPPUtility.getByte(filterVarData, 4) != 0);
filter.setCriteria(criteriaReader.process(properties, filterVarData, 0, -1, prompts, null, criteriaType));
filter.setIsTaskFilter(criteriaType[0]);
filter.setIsResourceFilter(criteriaType[1]);
filter.setPrompts(prompts);
filters.addFilter(filter);
//System.out.println(filter);
}
} | [
"public",
"void",
"process",
"(",
"ProjectProperties",
"properties",
",",
"FilterContainer",
"filters",
",",
"FixedData",
"fixedData",
",",
"Var2Data",
"varData",
")",
"{",
"int",
"filterCount",
"=",
"fixedData",
".",
"getItemCount",
"(",
")",
";",
"boolean",
"[... | Entry point for processing filter definitions.
@param properties project properties
@param filters project filters
@param fixedData filter fixed data
@param varData filter var data | [
"Entry",
"point",
"for",
"processing",
"filter",
"definitions",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/FilterReader.java#L61-L97 |
157,035 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/TimeUnitUtility.java | TimeUnitUtility.getInstance | @SuppressWarnings("unchecked") public static TimeUnit getInstance(String units, Locale locale) throws MPXJException
{
Map<String, Integer> map = LocaleData.getMap(locale, LocaleData.TIME_UNITS_MAP);
Integer result = map.get(units.toLowerCase());
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_TIME_UNIT + " " + units);
}
return (TimeUnit.getInstance(result.intValue()));
} | java | @SuppressWarnings("unchecked") public static TimeUnit getInstance(String units, Locale locale) throws MPXJException
{
Map<String, Integer> map = LocaleData.getMap(locale, LocaleData.TIME_UNITS_MAP);
Integer result = map.get(units.toLowerCase());
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_TIME_UNIT + " " + units);
}
return (TimeUnit.getInstance(result.intValue()));
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"TimeUnit",
"getInstance",
"(",
"String",
"units",
",",
"Locale",
"locale",
")",
"throws",
"MPXJException",
"{",
"Map",
"<",
"String",
",",
"Integer",
">",
"map",
"=",
"LocaleData",
".",
... | This method is used to parse a string representation of a time
unit, and return the appropriate constant value.
@param units string representation of a time unit
@param locale target locale
@return numeric constant
@throws MPXJException normally thrown when parsing fails | [
"This",
"method",
"is",
"used",
"to",
"parse",
"a",
"string",
"representation",
"of",
"a",
"time",
"unit",
"and",
"return",
"the",
"appropriate",
"constant",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/TimeUnitUtility.java#L55-L64 |
157,036 | joniles/mpxj | src/main/java/net/sf/mpxj/fasttrack/BlockHeader.java | BlockHeader.read | public BlockHeader read(byte[] buffer, int offset, int postHeaderSkipBytes)
{
m_offset = offset;
System.arraycopy(buffer, m_offset, m_header, 0, 8);
m_offset += 8;
int nameLength = FastTrackUtility.getInt(buffer, m_offset);
m_offset += 4;
if (nameLength < 1 || nameLength > 255)
{
throw new UnexpectedStructureException();
}
m_name = new String(buffer, m_offset, nameLength, CharsetHelper.UTF16LE);
m_offset += nameLength;
m_columnType = FastTrackUtility.getShort(buffer, m_offset);
m_offset += 2;
m_flags = FastTrackUtility.getShort(buffer, m_offset);
m_offset += 2;
m_skip = new byte[postHeaderSkipBytes];
System.arraycopy(buffer, m_offset, m_skip, 0, postHeaderSkipBytes);
m_offset += postHeaderSkipBytes;
return this;
} | java | public BlockHeader read(byte[] buffer, int offset, int postHeaderSkipBytes)
{
m_offset = offset;
System.arraycopy(buffer, m_offset, m_header, 0, 8);
m_offset += 8;
int nameLength = FastTrackUtility.getInt(buffer, m_offset);
m_offset += 4;
if (nameLength < 1 || nameLength > 255)
{
throw new UnexpectedStructureException();
}
m_name = new String(buffer, m_offset, nameLength, CharsetHelper.UTF16LE);
m_offset += nameLength;
m_columnType = FastTrackUtility.getShort(buffer, m_offset);
m_offset += 2;
m_flags = FastTrackUtility.getShort(buffer, m_offset);
m_offset += 2;
m_skip = new byte[postHeaderSkipBytes];
System.arraycopy(buffer, m_offset, m_skip, 0, postHeaderSkipBytes);
m_offset += postHeaderSkipBytes;
return this;
} | [
"public",
"BlockHeader",
"read",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"offset",
",",
"int",
"postHeaderSkipBytes",
")",
"{",
"m_offset",
"=",
"offset",
";",
"System",
".",
"arraycopy",
"(",
"buffer",
",",
"m_offset",
",",
"m_header",
",",
"0",
",... | Reads the header data from a block.
@param buffer block data
@param offset current offset into block data
@param postHeaderSkipBytes bytes to skip after reading the header
@return current BlockHeader instance | [
"Reads",
"the",
"header",
"data",
"from",
"a",
"block",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/BlockHeader.java#L45-L74 |
157,037 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ViewStateReader.java | ViewStateReader.process | public void process(ProjectFile file, Var2Data varData, byte[] fixedData) throws IOException
{
Props props = getProps(varData);
//System.out.println(props);
if (props != null)
{
String viewName = MPPUtility.removeAmpersands(props.getUnicodeString(VIEW_NAME));
byte[] listData = props.getByteArray(VIEW_CONTENTS);
List<Integer> uniqueIdList = new LinkedList<Integer>();
if (listData != null)
{
for (int index = 0; index < listData.length; index += 4)
{
Integer uniqueID = Integer.valueOf(MPPUtility.getInt(listData, index));
//
// Ensure that we have a valid task, and that if we have and
// ID of zero, this is the first task shown.
//
if (file.getTaskByUniqueID(uniqueID) != null && (uniqueID.intValue() != 0 || index == 0))
{
uniqueIdList.add(uniqueID);
}
}
}
int filterID = MPPUtility.getShort(fixedData, 128);
ViewState state = new ViewState(file, viewName, uniqueIdList, filterID);
file.getViews().setViewState(state);
}
} | java | public void process(ProjectFile file, Var2Data varData, byte[] fixedData) throws IOException
{
Props props = getProps(varData);
//System.out.println(props);
if (props != null)
{
String viewName = MPPUtility.removeAmpersands(props.getUnicodeString(VIEW_NAME));
byte[] listData = props.getByteArray(VIEW_CONTENTS);
List<Integer> uniqueIdList = new LinkedList<Integer>();
if (listData != null)
{
for (int index = 0; index < listData.length; index += 4)
{
Integer uniqueID = Integer.valueOf(MPPUtility.getInt(listData, index));
//
// Ensure that we have a valid task, and that if we have and
// ID of zero, this is the first task shown.
//
if (file.getTaskByUniqueID(uniqueID) != null && (uniqueID.intValue() != 0 || index == 0))
{
uniqueIdList.add(uniqueID);
}
}
}
int filterID = MPPUtility.getShort(fixedData, 128);
ViewState state = new ViewState(file, viewName, uniqueIdList, filterID);
file.getViews().setViewState(state);
}
} | [
"public",
"void",
"process",
"(",
"ProjectFile",
"file",
",",
"Var2Data",
"varData",
",",
"byte",
"[",
"]",
"fixedData",
")",
"throws",
"IOException",
"{",
"Props",
"props",
"=",
"getProps",
"(",
"varData",
")",
";",
"//System.out.println(props);",
"if",
"(",
... | Entry point for processing saved view state.
@param file project file
@param varData view state var data
@param fixedData view state fixed data
@throws IOException | [
"Entry",
"point",
"for",
"processing",
"saved",
"view",
"state",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ViewStateReader.java#L55-L86 |
157,038 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/MapRow.java | MapRow.getRows | @SuppressWarnings("unchecked") public final List<MapRow> getRows(String name)
{
return (List<MapRow>) getObject(name);
} | java | @SuppressWarnings("unchecked") public final List<MapRow> getRows(String name)
{
return (List<MapRow>) getObject(name);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"final",
"List",
"<",
"MapRow",
">",
"getRows",
"(",
"String",
"name",
")",
"{",
"return",
"(",
"List",
"<",
"MapRow",
">",
")",
"getObject",
"(",
"name",
")",
";",
"}"
] | Retrieve row from a nested table.
@param name column name
@return nested table rows | [
"Retrieve",
"row",
"from",
"a",
"nested",
"table",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/MapRow.java#L153-L156 |
157,039 | joniles/mpxj | src/main/java/net/sf/mpxj/common/RtfHelper.java | RtfHelper.strip | public static String strip(String text)
{
String result = text;
if (text != null && !text.isEmpty())
{
try
{
boolean formalRTF = isFormalRTF(text);
StringTextConverter stc = new StringTextConverter();
stc.convert(new RtfStringSource(text));
result = stripExtraLineEnd(stc.getText(), formalRTF);
}
catch (IOException ex)
{
result = "";
}
}
return result;
} | java | public static String strip(String text)
{
String result = text;
if (text != null && !text.isEmpty())
{
try
{
boolean formalRTF = isFormalRTF(text);
StringTextConverter stc = new StringTextConverter();
stc.convert(new RtfStringSource(text));
result = stripExtraLineEnd(stc.getText(), formalRTF);
}
catch (IOException ex)
{
result = "";
}
}
return result;
} | [
"public",
"static",
"String",
"strip",
"(",
"String",
"text",
")",
"{",
"String",
"result",
"=",
"text",
";",
"if",
"(",
"text",
"!=",
"null",
"&&",
"!",
"text",
".",
"isEmpty",
"(",
")",
")",
"{",
"try",
"{",
"boolean",
"formalRTF",
"=",
"isFormalRT... | This method removes all RTF formatting from a given piece of text.
@param text Text from which the RTF formatting is to be removed.
@return Plain text | [
"This",
"method",
"removes",
"all",
"RTF",
"formatting",
"from",
"a",
"given",
"piece",
"of",
"text",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/RtfHelper.java#L54-L73 |
157,040 | joniles/mpxj | src/main/java/net/sf/mpxj/common/RtfHelper.java | RtfHelper.stripExtraLineEnd | private static String stripExtraLineEnd(String text, boolean formalRTF)
{
if (formalRTF && text.endsWith("\n"))
{
text = text.substring(0, text.length() - 1);
}
return text;
} | java | private static String stripExtraLineEnd(String text, boolean formalRTF)
{
if (formalRTF && text.endsWith("\n"))
{
text = text.substring(0, text.length() - 1);
}
return text;
} | [
"private",
"static",
"String",
"stripExtraLineEnd",
"(",
"String",
"text",
",",
"boolean",
"formalRTF",
")",
"{",
"if",
"(",
"formalRTF",
"&&",
"text",
".",
"endsWith",
"(",
"\"\\n\"",
")",
")",
"{",
"text",
"=",
"text",
".",
"substring",
"(",
"0",
",",
... | Remove the trailing line end from an RTF block.
@param text source text
@param formalRTF true if this is a real RTF block
@return text with line end stripped | [
"Remove",
"the",
"trailing",
"line",
"end",
"from",
"an",
"RTF",
"block",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/RtfHelper.java#L82-L89 |
157,041 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java | AbstractCalendarAndExceptionFactory.processWorkWeeks | private void processWorkWeeks(byte[] data, int offset, ProjectCalendar cal)
{
// System.out.println("Calendar=" + cal.getName());
// System.out.println("Work week block start offset=" + offset);
// System.out.println(ByteArrayHelper.hexdump(data, true, 16, ""));
// skip 4 byte header
offset += 4;
while (data.length >= offset + ((7 * 60) + 2 + 2 + 8 + 4))
{
//System.out.println("Week start offset=" + offset);
ProjectCalendarWeek week = cal.addWorkWeek();
for (Day day : Day.values())
{
// 60 byte block per day
processWorkWeekDay(data, offset, week, day);
offset += 60;
}
Date startDate = DateHelper.getDayStartDate(MPPUtility.getDate(data, offset));
offset += 2;
Date finishDate = DateHelper.getDayEndDate(MPPUtility.getDate(data, offset));
offset += 2;
// skip unknown 8 bytes
//System.out.println(ByteArrayHelper.hexdump(data, offset, 8, false));
offset += 8;
//
// Extract the name length - ensure that it is aligned to a 4 byte boundary
//
int nameLength = MPPUtility.getInt(data, offset);
if (nameLength % 4 != 0)
{
nameLength = ((nameLength / 4) + 1) * 4;
}
offset += 4;
if (nameLength != 0)
{
String name = MPPUtility.getUnicodeString(data, offset, nameLength);
offset += nameLength;
week.setName(name);
}
week.setDateRange(new DateRange(startDate, finishDate));
// System.out.println(week);
}
} | java | private void processWorkWeeks(byte[] data, int offset, ProjectCalendar cal)
{
// System.out.println("Calendar=" + cal.getName());
// System.out.println("Work week block start offset=" + offset);
// System.out.println(ByteArrayHelper.hexdump(data, true, 16, ""));
// skip 4 byte header
offset += 4;
while (data.length >= offset + ((7 * 60) + 2 + 2 + 8 + 4))
{
//System.out.println("Week start offset=" + offset);
ProjectCalendarWeek week = cal.addWorkWeek();
for (Day day : Day.values())
{
// 60 byte block per day
processWorkWeekDay(data, offset, week, day);
offset += 60;
}
Date startDate = DateHelper.getDayStartDate(MPPUtility.getDate(data, offset));
offset += 2;
Date finishDate = DateHelper.getDayEndDate(MPPUtility.getDate(data, offset));
offset += 2;
// skip unknown 8 bytes
//System.out.println(ByteArrayHelper.hexdump(data, offset, 8, false));
offset += 8;
//
// Extract the name length - ensure that it is aligned to a 4 byte boundary
//
int nameLength = MPPUtility.getInt(data, offset);
if (nameLength % 4 != 0)
{
nameLength = ((nameLength / 4) + 1) * 4;
}
offset += 4;
if (nameLength != 0)
{
String name = MPPUtility.getUnicodeString(data, offset, nameLength);
offset += nameLength;
week.setName(name);
}
week.setDateRange(new DateRange(startDate, finishDate));
// System.out.println(week);
}
} | [
"private",
"void",
"processWorkWeeks",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"ProjectCalendar",
"cal",
")",
"{",
"// System.out.println(\"Calendar=\" + cal.getName());",
"// System.out.println(\"Work week block start offset=\" + offset);",
"// S... | Read the work weeks.
@param data calendar data
@param offset current offset into data
@param cal parent calendar | [
"Read",
"the",
"work",
"weeks",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java#L221-L271 |
157,042 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java | AbstractCalendarAndExceptionFactory.processWorkWeekDay | private void processWorkWeekDay(byte[] data, int offset, ProjectCalendarWeek week, Day day)
{
//System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false));
int dayType = MPPUtility.getShort(data, offset + 0);
if (dayType == 1)
{
week.setWorkingDay(day, DayType.DEFAULT);
}
else
{
ProjectCalendarHours hours = week.addCalendarHours(day);
int rangeCount = MPPUtility.getShort(data, offset + 2);
if (rangeCount == 0)
{
week.setWorkingDay(day, DayType.NON_WORKING);
}
else
{
week.setWorkingDay(day, DayType.WORKING);
Calendar cal = DateHelper.popCalendar();
for (int index = 0; index < rangeCount; index++)
{
Date startTime = DateHelper.getCanonicalTime(MPPUtility.getTime(data, offset + 8 + (index * 2)));
int durationInSeconds = MPPUtility.getInt(data, offset + 20 + (index * 4)) * 6;
cal.setTime(startTime);
cal.add(Calendar.SECOND, durationInSeconds);
Date finishTime = DateHelper.getCanonicalTime(cal.getTime());
hours.addRange(new DateRange(startTime, finishTime));
}
DateHelper.pushCalendar(cal);
}
}
} | java | private void processWorkWeekDay(byte[] data, int offset, ProjectCalendarWeek week, Day day)
{
//System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false));
int dayType = MPPUtility.getShort(data, offset + 0);
if (dayType == 1)
{
week.setWorkingDay(day, DayType.DEFAULT);
}
else
{
ProjectCalendarHours hours = week.addCalendarHours(day);
int rangeCount = MPPUtility.getShort(data, offset + 2);
if (rangeCount == 0)
{
week.setWorkingDay(day, DayType.NON_WORKING);
}
else
{
week.setWorkingDay(day, DayType.WORKING);
Calendar cal = DateHelper.popCalendar();
for (int index = 0; index < rangeCount; index++)
{
Date startTime = DateHelper.getCanonicalTime(MPPUtility.getTime(data, offset + 8 + (index * 2)));
int durationInSeconds = MPPUtility.getInt(data, offset + 20 + (index * 4)) * 6;
cal.setTime(startTime);
cal.add(Calendar.SECOND, durationInSeconds);
Date finishTime = DateHelper.getCanonicalTime(cal.getTime());
hours.addRange(new DateRange(startTime, finishTime));
}
DateHelper.pushCalendar(cal);
}
}
} | [
"private",
"void",
"processWorkWeekDay",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"offset",
",",
"ProjectCalendarWeek",
"week",
",",
"Day",
"day",
")",
"{",
"//System.out.println(ByteArrayHelper.hexdump(data, offset, 60, false));",
"int",
"dayType",
"=",
"MPPUtility",... | Process an individual work week day.
@param data calendar data
@param offset current offset into data
@param week parent week
@param day current day | [
"Process",
"an",
"individual",
"work",
"week",
"day",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java#L281-L314 |
157,043 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java | AbstractCalendarAndExceptionFactory.getRecurrenceType | private RecurrenceType getRecurrenceType(int value)
{
RecurrenceType result;
if (value < 0 || value >= RECURRENCE_TYPES.length)
{
result = null;
}
else
{
result = RECURRENCE_TYPES[value];
}
return result;
} | java | private RecurrenceType getRecurrenceType(int value)
{
RecurrenceType result;
if (value < 0 || value >= RECURRENCE_TYPES.length)
{
result = null;
}
else
{
result = RECURRENCE_TYPES[value];
}
return result;
} | [
"private",
"RecurrenceType",
"getRecurrenceType",
"(",
"int",
"value",
")",
"{",
"RecurrenceType",
"result",
";",
"if",
"(",
"value",
"<",
"0",
"||",
"value",
">=",
"RECURRENCE_TYPES",
".",
"length",
")",
"{",
"result",
"=",
"null",
";",
"}",
"else",
"{",
... | Retrieve the recurrence type.
@param value integer value
@return RecurrenceType instance | [
"Retrieve",
"the",
"recurrence",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java#L322-L335 |
157,044 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java | AbstractCalendarAndExceptionFactory.getRelative | private boolean getRelative(int value)
{
boolean result;
if (value < 0 || value >= RELATIVE_MAP.length)
{
result = false;
}
else
{
result = RELATIVE_MAP[value];
}
return result;
} | java | private boolean getRelative(int value)
{
boolean result;
if (value < 0 || value >= RELATIVE_MAP.length)
{
result = false;
}
else
{
result = RELATIVE_MAP[value];
}
return result;
} | [
"private",
"boolean",
"getRelative",
"(",
"int",
"value",
")",
"{",
"boolean",
"result",
";",
"if",
"(",
"value",
"<",
"0",
"||",
"value",
">=",
"RELATIVE_MAP",
".",
"length",
")",
"{",
"result",
"=",
"false",
";",
"}",
"else",
"{",
"result",
"=",
"R... | Determine if the exception is relative based on the recurrence type integer value.
@param value integer value
@return true if the recurrence is relative | [
"Determine",
"if",
"the",
"exception",
"is",
"relative",
"based",
"on",
"the",
"recurrence",
"type",
"integer",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarAndExceptionFactory.java#L343-L356 |
157,045 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/schema/GanttDesignerRemark.java | GanttDesignerRemark.getTask | public List<GanttDesignerRemark.Task> getTask()
{
if (task == null)
{
task = new ArrayList<GanttDesignerRemark.Task>();
}
return this.task;
} | java | public List<GanttDesignerRemark.Task> getTask()
{
if (task == null)
{
task = new ArrayList<GanttDesignerRemark.Task>();
}
return this.task;
} | [
"public",
"List",
"<",
"GanttDesignerRemark",
".",
"Task",
">",
"getTask",
"(",
")",
"{",
"if",
"(",
"task",
"==",
"null",
")",
"{",
"task",
"=",
"new",
"ArrayList",
"<",
"GanttDesignerRemark",
".",
"Task",
">",
"(",
")",
";",
"}",
"return",
"this",
... | Gets the value of the task 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 task property.
<p>
For example, to add a new item, do as follows:
<pre>
getTask().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link GanttDesignerRemark.Task } | [
"Gets",
"the",
"value",
"of",
"the",
"task",
"property",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/schema/GanttDesignerRemark.java#L76-L83 |
157,046 | joniles/mpxj | src/main/java/net/sf/mpxj/explorer/JTablePanel.java | JTablePanel.setLeftTableModel | public void setLeftTableModel(TableModel model)
{
TableModel old = m_leftTable.getModel();
m_leftTable.setModel(model);
firePropertyChange("leftTableModel", old, model);
} | java | public void setLeftTableModel(TableModel model)
{
TableModel old = m_leftTable.getModel();
m_leftTable.setModel(model);
firePropertyChange("leftTableModel", old, model);
} | [
"public",
"void",
"setLeftTableModel",
"(",
"TableModel",
"model",
")",
"{",
"TableModel",
"old",
"=",
"m_leftTable",
".",
"getModel",
"(",
")",
";",
"m_leftTable",
".",
"setModel",
"(",
"model",
")",
";",
"firePropertyChange",
"(",
"\"leftTableModel\"",
",",
... | Set the model used by the left table.
@param model table model | [
"Set",
"the",
"model",
"used",
"by",
"the",
"left",
"table",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/JTablePanel.java#L91-L96 |
157,047 | joniles/mpxj | src/main/java/net/sf/mpxj/explorer/JTablePanel.java | JTablePanel.setRightTableModel | public void setRightTableModel(TableModel model)
{
TableModel old = m_rightTable.getModel();
m_rightTable.setModel(model);
firePropertyChange("rightTableModel", old, model);
} | java | public void setRightTableModel(TableModel model)
{
TableModel old = m_rightTable.getModel();
m_rightTable.setModel(model);
firePropertyChange("rightTableModel", old, model);
} | [
"public",
"void",
"setRightTableModel",
"(",
"TableModel",
"model",
")",
"{",
"TableModel",
"old",
"=",
"m_rightTable",
".",
"getModel",
"(",
")",
";",
"m_rightTable",
".",
"setModel",
"(",
"model",
")",
";",
"firePropertyChange",
"(",
"\"rightTableModel\"",
","... | Set the model used by the right table.
@param model table model | [
"Set",
"the",
"model",
"used",
"by",
"the",
"right",
"table",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/JTablePanel.java#L113-L118 |
157,048 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.process | public void process(InputStream is) throws Exception
{
readHeader(is);
readVersion(is);
readTableData(readTableHeaders(is), is);
} | java | public void process(InputStream is) throws Exception
{
readHeader(is);
readVersion(is);
readTableData(readTableHeaders(is), is);
} | [
"public",
"void",
"process",
"(",
"InputStream",
"is",
")",
"throws",
"Exception",
"{",
"readHeader",
"(",
"is",
")",
";",
"readVersion",
"(",
"is",
")",
";",
"readTableData",
"(",
"readTableHeaders",
"(",
"is",
")",
",",
"is",
")",
";",
"}"
] | Extract raw table data from the input stream.
@param is input stream | [
"Extract",
"raw",
"table",
"data",
"from",
"the",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L55-L60 |
157,049 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.getTableData | public StreamReader getTableData(String name) throws IOException
{
InputStream stream = new ByteArrayInputStream(m_tableData.get(name));
if (m_majorVersion > 5)
{
byte[] header = new byte[24];
stream.read(header);
SynchroLogger.log("TABLE HEADER", header);
}
return new StreamReader(m_majorVersion, stream);
} | java | public StreamReader getTableData(String name) throws IOException
{
InputStream stream = new ByteArrayInputStream(m_tableData.get(name));
if (m_majorVersion > 5)
{
byte[] header = new byte[24];
stream.read(header);
SynchroLogger.log("TABLE HEADER", header);
}
return new StreamReader(m_majorVersion, stream);
} | [
"public",
"StreamReader",
"getTableData",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
"=",
"new",
"ByteArrayInputStream",
"(",
"m_tableData",
".",
"get",
"(",
"name",
")",
")",
";",
"if",
"(",
"m_majorVersion",
">",
"5",
... | Return an input stream to read the data from the named table.
@param name table name
@return InputStream instance
@throws IOException | [
"Return",
"an",
"input",
"stream",
"to",
"read",
"the",
"data",
"from",
"the",
"named",
"table",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L69-L79 |
157,050 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableHeaders | private List<SynchroTable> readTableHeaders(InputStream is) throws IOException
{
// Read the headers
List<SynchroTable> tables = new ArrayList<SynchroTable>();
byte[] header = new byte[48];
while (true)
{
is.read(header);
m_offset += 48;
SynchroTable table = readTableHeader(header);
if (table == null)
{
break;
}
tables.add(table);
}
// Ensure sorted by offset
Collections.sort(tables, new Comparator<SynchroTable>()
{
@Override public int compare(SynchroTable o1, SynchroTable o2)
{
return o1.getOffset() - o2.getOffset();
}
});
// Calculate lengths
SynchroTable previousTable = null;
for (SynchroTable table : tables)
{
if (previousTable != null)
{
previousTable.setLength(table.getOffset() - previousTable.getOffset());
}
previousTable = table;
}
for (SynchroTable table : tables)
{
SynchroLogger.log("TABLE", table);
}
return tables;
} | java | private List<SynchroTable> readTableHeaders(InputStream is) throws IOException
{
// Read the headers
List<SynchroTable> tables = new ArrayList<SynchroTable>();
byte[] header = new byte[48];
while (true)
{
is.read(header);
m_offset += 48;
SynchroTable table = readTableHeader(header);
if (table == null)
{
break;
}
tables.add(table);
}
// Ensure sorted by offset
Collections.sort(tables, new Comparator<SynchroTable>()
{
@Override public int compare(SynchroTable o1, SynchroTable o2)
{
return o1.getOffset() - o2.getOffset();
}
});
// Calculate lengths
SynchroTable previousTable = null;
for (SynchroTable table : tables)
{
if (previousTable != null)
{
previousTable.setLength(table.getOffset() - previousTable.getOffset());
}
previousTable = table;
}
for (SynchroTable table : tables)
{
SynchroLogger.log("TABLE", table);
}
return tables;
} | [
"private",
"List",
"<",
"SynchroTable",
">",
"readTableHeaders",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// Read the headers",
"List",
"<",
"SynchroTable",
">",
"tables",
"=",
"new",
"ArrayList",
"<",
"SynchroTable",
">",
"(",
")",
";",
"... | Read the table headers. This allows us to break the file into chunks
representing the individual tables.
@param is input stream
@return list of tables in the file | [
"Read",
"the",
"table",
"headers",
".",
"This",
"allows",
"us",
"to",
"break",
"the",
"file",
"into",
"chunks",
"representing",
"the",
"individual",
"tables",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L88-L132 |
157,051 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableHeader | private SynchroTable readTableHeader(byte[] header)
{
SynchroTable result = null;
String tableName = DatatypeConverter.getSimpleString(header, 0);
if (!tableName.isEmpty())
{
int offset = DatatypeConverter.getInt(header, 40);
result = new SynchroTable(tableName, offset);
}
return result;
} | java | private SynchroTable readTableHeader(byte[] header)
{
SynchroTable result = null;
String tableName = DatatypeConverter.getSimpleString(header, 0);
if (!tableName.isEmpty())
{
int offset = DatatypeConverter.getInt(header, 40);
result = new SynchroTable(tableName, offset);
}
return result;
} | [
"private",
"SynchroTable",
"readTableHeader",
"(",
"byte",
"[",
"]",
"header",
")",
"{",
"SynchroTable",
"result",
"=",
"null",
";",
"String",
"tableName",
"=",
"DatatypeConverter",
".",
"getSimpleString",
"(",
"header",
",",
"0",
")",
";",
"if",
"(",
"!",
... | Read the header data for a single file.
@param header header data
@return SynchroTable instance | [
"Read",
"the",
"header",
"data",
"for",
"a",
"single",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L140-L150 |
157,052 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTableData | private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException
{
for (SynchroTable table : tables)
{
if (REQUIRED_TABLES.contains(table.getName()))
{
readTable(is, table);
}
}
} | java | private void readTableData(List<SynchroTable> tables, InputStream is) throws IOException
{
for (SynchroTable table : tables)
{
if (REQUIRED_TABLES.contains(table.getName()))
{
readTable(is, table);
}
}
} | [
"private",
"void",
"readTableData",
"(",
"List",
"<",
"SynchroTable",
">",
"tables",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"for",
"(",
"SynchroTable",
"table",
":",
"tables",
")",
"{",
"if",
"(",
"REQUIRED_TABLES",
".",
"contains",
"("... | Read the data for all of the tables we're interested in.
@param tables list of all available tables
@param is input stream | [
"Read",
"the",
"data",
"for",
"all",
"of",
"the",
"tables",
"we",
"re",
"interested",
"in",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L158-L167 |
157,053 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readTable | private void readTable(InputStream is, SynchroTable table) throws IOException
{
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | java | private void readTable(InputStream is, SynchroTable table) throws IOException
{
int skip = table.getOffset() - m_offset;
if (skip != 0)
{
StreamHelper.skip(is, skip);
m_offset += skip;
}
String tableName = DatatypeConverter.getString(is);
int tableNameLength = 2 + tableName.length();
m_offset += tableNameLength;
int dataLength;
if (table.getLength() == -1)
{
dataLength = is.available();
}
else
{
dataLength = table.getLength() - tableNameLength;
}
SynchroLogger.log("READ", tableName);
byte[] compressedTableData = new byte[dataLength];
is.read(compressedTableData);
m_offset += dataLength;
Inflater inflater = new Inflater();
inflater.setInput(compressedTableData);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream(compressedTableData.length);
byte[] buffer = new byte[1024];
while (!inflater.finished())
{
int count;
try
{
count = inflater.inflate(buffer);
}
catch (DataFormatException ex)
{
throw new IOException(ex);
}
outputStream.write(buffer, 0, count);
}
outputStream.close();
byte[] uncompressedTableData = outputStream.toByteArray();
SynchroLogger.log(uncompressedTableData);
m_tableData.put(table.getName(), uncompressedTableData);
} | [
"private",
"void",
"readTable",
"(",
"InputStream",
"is",
",",
"SynchroTable",
"table",
")",
"throws",
"IOException",
"{",
"int",
"skip",
"=",
"table",
".",
"getOffset",
"(",
")",
"-",
"m_offset",
";",
"if",
"(",
"skip",
"!=",
"0",
")",
"{",
"StreamHelpe... | Read data for a single table and store it.
@param is input stream
@param table table header | [
"Read",
"data",
"for",
"a",
"single",
"table",
"and",
"store",
"it",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L175-L228 |
157,054 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readHeader | private void readHeader(InputStream is) throws IOException
{
byte[] header = new byte[20];
is.read(header);
m_offset += 20;
SynchroLogger.log("HEADER", header);
} | java | private void readHeader(InputStream is) throws IOException
{
byte[] header = new byte[20];
is.read(header);
m_offset += 20;
SynchroLogger.log("HEADER", header);
} | [
"private",
"void",
"readHeader",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"header",
"=",
"new",
"byte",
"[",
"20",
"]",
";",
"is",
".",
"read",
"(",
"header",
")",
";",
"m_offset",
"+=",
"20",
";",
"SynchroLogger",... | Read the file header data.
@param is input stream | [
"Read",
"the",
"file",
"header",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L235-L241 |
157,055 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/SynchroData.java | SynchroData.readVersion | private void readVersion(InputStream is) throws IOException
{
BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);
String version = DatatypeConverter.getString(bytesReadStream);
m_offset += bytesReadStream.getBytesRead();
SynchroLogger.log("VERSION", version);
String[] versionArray = version.split("\\.");
m_majorVersion = Integer.parseInt(versionArray[0]);
} | java | private void readVersion(InputStream is) throws IOException
{
BytesReadInputStream bytesReadStream = new BytesReadInputStream(is);
String version = DatatypeConverter.getString(bytesReadStream);
m_offset += bytesReadStream.getBytesRead();
SynchroLogger.log("VERSION", version);
String[] versionArray = version.split("\\.");
m_majorVersion = Integer.parseInt(versionArray[0]);
} | [
"private",
"void",
"readVersion",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"BytesReadInputStream",
"bytesReadStream",
"=",
"new",
"BytesReadInputStream",
"(",
"is",
")",
";",
"String",
"version",
"=",
"DatatypeConverter",
".",
"getString",
"(",
... | Read the version number.
@param is input stream | [
"Read",
"the",
"version",
"number",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroData.java#L248-L257 |
157,056 | joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.readAll | public List<ProjectFile> readAll() throws MPXJException
{
Map<Integer, String> projects = listProjects();
List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());
for (Integer id : projects.keySet())
{
setProjectID(id.intValue());
result.add(read());
}
return result;
} | java | public List<ProjectFile> readAll() throws MPXJException
{
Map<Integer, String> projects = listProjects();
List<ProjectFile> result = new ArrayList<ProjectFile>(projects.keySet().size());
for (Integer id : projects.keySet())
{
setProjectID(id.intValue());
result.add(read());
}
return result;
} | [
"public",
"List",
"<",
"ProjectFile",
">",
"readAll",
"(",
")",
"throws",
"MPXJException",
"{",
"Map",
"<",
"Integer",
",",
"String",
">",
"projects",
"=",
"listProjects",
"(",
")",
";",
"List",
"<",
"ProjectFile",
">",
"result",
"=",
"new",
"ArrayList",
... | Convenience method which allows all projects in the database to
be read in a single operation.
@return list of ProjectFile instances
@throws MPXJException | [
"Convenience",
"method",
"which",
"allows",
"all",
"projects",
"in",
"the",
"database",
"to",
"be",
"read",
"in",
"a",
"single",
"operation",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L161-L171 |
157,057 | joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processAnalytics | private void processAnalytics() throws SQLException
{
allocateConnection();
try
{
DatabaseMetaData meta = m_connection.getMetaData();
String productName = meta.getDatabaseProductName();
if (productName == null || productName.isEmpty())
{
productName = "DATABASE";
}
else
{
productName = productName.toUpperCase();
}
ProjectProperties properties = m_reader.getProject().getProjectProperties();
properties.setFileApplication("Primavera");
properties.setFileType(productName);
}
finally
{
releaseConnection();
}
} | java | private void processAnalytics() throws SQLException
{
allocateConnection();
try
{
DatabaseMetaData meta = m_connection.getMetaData();
String productName = meta.getDatabaseProductName();
if (productName == null || productName.isEmpty())
{
productName = "DATABASE";
}
else
{
productName = productName.toUpperCase();
}
ProjectProperties properties = m_reader.getProject().getProjectProperties();
properties.setFileApplication("Primavera");
properties.setFileType(productName);
}
finally
{
releaseConnection();
}
} | [
"private",
"void",
"processAnalytics",
"(",
")",
"throws",
"SQLException",
"{",
"allocateConnection",
"(",
")",
";",
"try",
"{",
"DatabaseMetaData",
"meta",
"=",
"m_connection",
".",
"getMetaData",
"(",
")",
";",
"String",
"productName",
"=",
"meta",
".",
"get... | Populate data for analytics. | [
"Populate",
"data",
"for",
"analytics",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L176-L202 |
157,058 | joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processSchedulingProjectProperties | private void processSchedulingProjectProperties() throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'", m_projectID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
Record record = Record.getRecord(row.getString("prop_value"));
if (record != null)
{
String[] keyValues = record.getValue().split("\\|");
for (int i = 0; i < keyValues.length - 1; ++i)
{
if ("sched_calendar_on_relationship_lag".equals(keyValues[i]))
{
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", keyValues[i + 1]);
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
break;
}
}
}
}
} | java | private void processSchedulingProjectProperties() throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'", m_projectID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
Record record = Record.getRecord(row.getString("prop_value"));
if (record != null)
{
String[] keyValues = record.getValue().split("\\|");
for (int i = 0; i < keyValues.length - 1; ++i)
{
if ("sched_calendar_on_relationship_lag".equals(keyValues[i]))
{
Map<String, Object> customProperties = new HashMap<String, Object>();
customProperties.put("LagCalendar", keyValues[i + 1]);
m_reader.getProject().getProjectProperties().setCustomProperties(customProperties);
break;
}
}
}
}
} | [
"private",
"void",
"processSchedulingProjectProperties",
"(",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from \"",
"+",
"m_schema",
"+",
"\"projprop where proj_id=? and prop_name='scheduling'\"",
",",
"m_projectID... | Process the scheduling project property from PROJPROP. This table only seems to exist
in P6 databases, not XER files.
@throws SQLException | [
"Process",
"the",
"scheduling",
"project",
"property",
"from",
"PROJPROP",
".",
"This",
"table",
"only",
"seems",
"to",
"exist",
"in",
"P6",
"databases",
"not",
"XER",
"files",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L264-L286 |
157,059 | joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.processDefaultCurrency | private void processDefaultCurrency(Integer currencyID) throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "currtype where curr_id=?", currencyID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_reader.processDefaultCurrency(row);
}
} | java | private void processDefaultCurrency(Integer currencyID) throws SQLException
{
List<Row> rows = getRows("select * from " + m_schema + "currtype where curr_id=?", currencyID);
if (!rows.isEmpty())
{
Row row = rows.get(0);
m_reader.processDefaultCurrency(row);
}
} | [
"private",
"void",
"processDefaultCurrency",
"(",
"Integer",
"currencyID",
")",
"throws",
"SQLException",
"{",
"List",
"<",
"Row",
">",
"rows",
"=",
"getRows",
"(",
"\"select * from \"",
"+",
"m_schema",
"+",
"\"currtype where curr_id=?\"",
",",
"currencyID",
")",
... | Select the default currency properties from the database.
@param currencyID default currency ID | [
"Select",
"the",
"default",
"currency",
"properties",
"from",
"the",
"database",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L293-L301 |
157,060 | joniles/mpxj | src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java | PrimaveraDatabaseReader.setSchema | public void setSchema(String schema)
{
if (schema == null)
{
schema = "";
}
else
{
if (!schema.isEmpty() && !schema.endsWith("."))
{
schema = schema + '.';
}
}
m_schema = schema;
} | java | public void setSchema(String schema)
{
if (schema == null)
{
schema = "";
}
else
{
if (!schema.isEmpty() && !schema.endsWith("."))
{
schema = schema + '.';
}
}
m_schema = schema;
} | [
"public",
"void",
"setSchema",
"(",
"String",
"schema",
")",
"{",
"if",
"(",
"schema",
"==",
"null",
")",
"{",
"schema",
"=",
"\"\"",
";",
"}",
"else",
"{",
"if",
"(",
"!",
"schema",
".",
"isEmpty",
"(",
")",
"&&",
"!",
"schema",
".",
"endsWith",
... | Set the name of the schema containing the Primavera tables.
@param schema schema name. | [
"Set",
"the",
"name",
"of",
"the",
"schema",
"containing",
"the",
"Primavera",
"tables",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraDatabaseReader.java#L568-L582 |
157,061 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java | MPXJNumberFormat.applyPattern | public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator)
{
m_symbols.setDecimalSeparator(decimalSeparator);
m_symbols.setGroupingSeparator(groupingSeparator);
setDecimalFormatSymbols(m_symbols);
applyPattern(primaryPattern);
if (alternativePatterns != null && alternativePatterns.length != 0)
{
int loop;
if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length)
{
m_alternativeFormats = new DecimalFormat[alternativePatterns.length];
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop] = new DecimalFormat();
}
}
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols);
m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]);
}
}
} | java | public void applyPattern(String primaryPattern, String[] alternativePatterns, char decimalSeparator, char groupingSeparator)
{
m_symbols.setDecimalSeparator(decimalSeparator);
m_symbols.setGroupingSeparator(groupingSeparator);
setDecimalFormatSymbols(m_symbols);
applyPattern(primaryPattern);
if (alternativePatterns != null && alternativePatterns.length != 0)
{
int loop;
if (m_alternativeFormats == null || m_alternativeFormats.length != alternativePatterns.length)
{
m_alternativeFormats = new DecimalFormat[alternativePatterns.length];
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop] = new DecimalFormat();
}
}
for (loop = 0; loop < alternativePatterns.length; loop++)
{
m_alternativeFormats[loop].setDecimalFormatSymbols(m_symbols);
m_alternativeFormats[loop].applyPattern(alternativePatterns[loop]);
}
}
} | [
"public",
"void",
"applyPattern",
"(",
"String",
"primaryPattern",
",",
"String",
"[",
"]",
"alternativePatterns",
",",
"char",
"decimalSeparator",
",",
"char",
"groupingSeparator",
")",
"{",
"m_symbols",
".",
"setDecimalSeparator",
"(",
"decimalSeparator",
")",
";"... | This method is used to configure the primary and alternative
format patterns.
@param primaryPattern new format pattern
@param alternativePatterns alternative format patterns
@param decimalSeparator Locale specific decimal separator to replace placeholder
@param groupingSeparator Locale specific grouping separator to replace placeholder | [
"This",
"method",
"is",
"used",
"to",
"configure",
"the",
"primary",
"and",
"alternative",
"format",
"patterns",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJNumberFormat.java#L47-L73 |
157,062 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/ResourceModel.java | ResourceModel.getResourceField | private String getResourceField(int key)
{
String result = null;
if (key > 0 && key < m_resourceNames.length)
{
result = m_resourceNames[key];
}
return (result);
} | java | private String getResourceField(int key)
{
String result = null;
if (key > 0 && key < m_resourceNames.length)
{
result = m_resourceNames[key];
}
return (result);
} | [
"private",
"String",
"getResourceField",
"(",
"int",
"key",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"key",
">",
"0",
"&&",
"key",
"<",
"m_resourceNames",
".",
"length",
")",
"{",
"result",
"=",
"m_resourceNames",
"[",
"key",
"]",
";"... | Given a resource field number, this method returns the resource field name.
@param key resource field number
@return resource field name | [
"Given",
"a",
"resource",
"field",
"number",
"this",
"method",
"returns",
"the",
"resource",
"field",
"name",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ResourceModel.java#L213-L223 |
157,063 | joniles/mpxj | src/main/java/net/sf/mpxj/mpx/ResourceModel.java | ResourceModel.getResourceCode | private int getResourceCode(String field) throws MPXJException
{
Integer result = m_resourceNumbers.get(field);
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_RESOURCE_FIELD_NAME + " " + field);
}
return (result.intValue());
} | java | private int getResourceCode(String field) throws MPXJException
{
Integer result = m_resourceNumbers.get(field);
if (result == null)
{
throw new MPXJException(MPXJException.INVALID_RESOURCE_FIELD_NAME + " " + field);
}
return (result.intValue());
} | [
"private",
"int",
"getResourceCode",
"(",
"String",
"field",
")",
"throws",
"MPXJException",
"{",
"Integer",
"result",
"=",
"m_resourceNumbers",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"throw",
"new",
"MPXJException",... | Given a resource field name, this method returns the resource field number.
@param field resource field name
@return resource field number | [
"Given",
"a",
"resource",
"field",
"name",
"this",
"method",
"returns",
"the",
"resource",
"field",
"number",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ResourceModel.java#L231-L241 |
157,064 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttproject/CustomProperty.java | CustomProperty.getField | public FieldType getField()
{
FieldType result = null;
if (m_index < m_fields.length)
{
result = m_fields[m_index++];
}
return result;
} | java | public FieldType getField()
{
FieldType result = null;
if (m_index < m_fields.length)
{
result = m_fields[m_index++];
}
return result;
} | [
"public",
"FieldType",
"getField",
"(",
")",
"{",
"FieldType",
"result",
"=",
"null",
";",
"if",
"(",
"m_index",
"<",
"m_fields",
".",
"length",
")",
"{",
"result",
"=",
"m_fields",
"[",
"m_index",
"++",
"]",
";",
"}",
"return",
"result",
";",
"}"
] | Retrieve the next available field.
@return FieldType instance for the next available field | [
"Retrieve",
"the",
"next",
"available",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttproject/CustomProperty.java#L61-L70 |
157,065 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTable | public List<MapRow> readTable(TableReader reader) throws IOException
{
reader.read();
return reader.getRows();
} | java | public List<MapRow> readTable(TableReader reader) throws IOException
{
reader.read();
return reader.getRows();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTable",
"(",
"TableReader",
"reader",
")",
"throws",
"IOException",
"{",
"reader",
".",
"read",
"(",
")",
";",
"return",
"reader",
".",
"getRows",
"(",
")",
";",
"}"
] | Read a nested table. Instantiates the supplied reader class to
extract the data.
@param reader table reader class
@return table rows | [
"Read",
"a",
"nested",
"table",
".",
"Instantiates",
"the",
"supplied",
"reader",
"class",
"to",
"extract",
"the",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L80-L84 |
157,066 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readUnknownTable | public List<MapRow> readUnknownTable(int rowSize, int rowMagicNumber) throws IOException
{
TableReader reader = new UnknownTableReader(this, rowSize, rowMagicNumber);
reader.read();
return reader.getRows();
} | java | public List<MapRow> readUnknownTable(int rowSize, int rowMagicNumber) throws IOException
{
TableReader reader = new UnknownTableReader(this, rowSize, rowMagicNumber);
reader.read();
return reader.getRows();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readUnknownTable",
"(",
"int",
"rowSize",
",",
"int",
"rowMagicNumber",
")",
"throws",
"IOException",
"{",
"TableReader",
"reader",
"=",
"new",
"UnknownTableReader",
"(",
"this",
",",
"rowSize",
",",
"rowMagicNumber",
")",
... | Read a nested table whose contents we don't understand.
@param rowSize fixed row size
@param rowMagicNumber row magic number
@return table rows | [
"Read",
"a",
"nested",
"table",
"whose",
"contents",
"we",
"don",
"t",
"understand",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L93-L98 |
157,067 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTable | public List<MapRow> readTable(Class<? extends TableReader> readerClass) throws IOException
{
TableReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return readTable(reader);
} | java | public List<MapRow> readTable(Class<? extends TableReader> readerClass) throws IOException
{
TableReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return readTable(reader);
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTable",
"(",
"Class",
"<",
"?",
"extends",
"TableReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"TableReader",
"reader",
";",
"try",
"{",
"reader",
"=",
"readerClass",
".",
"getConstructor",
"(",
"S... | Reads a nested table. Uses the supplied reader class instance.
@param readerClass reader class instance
@return table rows | [
"Reads",
"a",
"nested",
"table",
".",
"Uses",
"the",
"supplied",
"reader",
"class",
"instance",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L106-L120 |
157,068 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readTableConditional | public List<MapRow> readTableConditional(Class<? extends TableReader> readerClass) throws IOException
{
List<MapRow> result;
if (DatatypeConverter.getBoolean(m_stream))
{
result = readTable(readerClass);
}
else
{
result = Collections.emptyList();
}
return result;
} | java | public List<MapRow> readTableConditional(Class<? extends TableReader> readerClass) throws IOException
{
List<MapRow> result;
if (DatatypeConverter.getBoolean(m_stream))
{
result = readTable(readerClass);
}
else
{
result = Collections.emptyList();
}
return result;
} | [
"public",
"List",
"<",
"MapRow",
">",
"readTableConditional",
"(",
"Class",
"<",
"?",
"extends",
"TableReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"List",
"<",
"MapRow",
">",
"result",
";",
"if",
"(",
"DatatypeConverter",
".",
"getBoolean",... | Conditionally read a nested table based in the value of a boolean flag which precedes the table data.
@param readerClass reader class
@return table rows or empty list if table not present | [
"Conditionally",
"read",
"a",
"nested",
"table",
"based",
"in",
"the",
"value",
"of",
"a",
"boolean",
"flag",
"which",
"precedes",
"the",
"table",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L128-L140 |
157,069 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readBytes | public ByteArray readBytes(int size) throws IOException
{
byte[] data = new byte[size];
m_stream.read(data);
return new ByteArray(data);
} | java | public ByteArray readBytes(int size) throws IOException
{
byte[] data = new byte[size];
m_stream.read(data);
return new ByteArray(data);
} | [
"public",
"ByteArray",
"readBytes",
"(",
"int",
"size",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"m_stream",
".",
"read",
"(",
"data",
")",
";",
"return",
"new",
"ByteArray",
"(",
"data",
... | Read an array of bytes of a specified size.
@param size number of bytes to read
@return ByteArray instance | [
"Read",
"an",
"array",
"of",
"bytes",
"of",
"a",
"specified",
"size",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L148-L153 |
157,070 | joniles/mpxj | src/main/java/net/sf/mpxj/synchro/StreamReader.java | StreamReader.readBlocks | public List<MapRow> readBlocks(Class<? extends BlockReader> readerClass) throws IOException
{
BlockReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return reader.read();
} | java | public List<MapRow> readBlocks(Class<? extends BlockReader> readerClass) throws IOException
{
BlockReader reader;
try
{
reader = readerClass.getConstructor(StreamReader.class).newInstance(this);
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
return reader.read();
} | [
"public",
"List",
"<",
"MapRow",
">",
"readBlocks",
"(",
"Class",
"<",
"?",
"extends",
"BlockReader",
">",
"readerClass",
")",
"throws",
"IOException",
"{",
"BlockReader",
"reader",
";",
"try",
"{",
"reader",
"=",
"readerClass",
".",
"getConstructor",
"(",
"... | Read a list of fixed size blocks using an instance of the supplied reader class.
@param readerClass reader class
@return list of blocks | [
"Read",
"a",
"list",
"of",
"fixed",
"size",
"blocks",
"using",
"an",
"instance",
"of",
"the",
"supplied",
"reader",
"class",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/StreamReader.java#L252-L266 |
157,071 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readFile | private void readFile(InputStream is) throws IOException
{
StreamHelper.skip(is, 64);
int index = 64;
ArrayList<Integer> offsetList = new ArrayList<Integer>();
List<String> nameList = new ArrayList<String>();
while (true)
{
byte[] table = new byte[32];
is.read(table);
index += 32;
int offset = PEPUtility.getInt(table, 0);
offsetList.add(Integer.valueOf(offset));
if (offset == 0)
{
break;
}
nameList.add(PEPUtility.getString(table, 5).toUpperCase());
}
StreamHelper.skip(is, offsetList.get(0).intValue() - index);
for (int offsetIndex = 1; offsetIndex < offsetList.size() - 1; offsetIndex++)
{
String name = nameList.get(offsetIndex - 1);
Class<? extends Table> tableClass = TABLE_CLASSES.get(name);
if (tableClass == null)
{
tableClass = Table.class;
}
Table table;
try
{
table = tableClass.newInstance();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
m_tables.put(name, table);
table.read(is);
}
} | java | private void readFile(InputStream is) throws IOException
{
StreamHelper.skip(is, 64);
int index = 64;
ArrayList<Integer> offsetList = new ArrayList<Integer>();
List<String> nameList = new ArrayList<String>();
while (true)
{
byte[] table = new byte[32];
is.read(table);
index += 32;
int offset = PEPUtility.getInt(table, 0);
offsetList.add(Integer.valueOf(offset));
if (offset == 0)
{
break;
}
nameList.add(PEPUtility.getString(table, 5).toUpperCase());
}
StreamHelper.skip(is, offsetList.get(0).intValue() - index);
for (int offsetIndex = 1; offsetIndex < offsetList.size() - 1; offsetIndex++)
{
String name = nameList.get(offsetIndex - 1);
Class<? extends Table> tableClass = TABLE_CLASSES.get(name);
if (tableClass == null)
{
tableClass = Table.class;
}
Table table;
try
{
table = tableClass.newInstance();
}
catch (Exception ex)
{
throw new RuntimeException(ex);
}
m_tables.put(name, table);
table.read(is);
}
} | [
"private",
"void",
"readFile",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"StreamHelper",
".",
"skip",
"(",
"is",
",",
"64",
")",
";",
"int",
"index",
"=",
"64",
";",
"ArrayList",
"<",
"Integer",
">",
"offsetList",
"=",
"new",
"ArrayLis... | Reads a PEP file from the input stream.
@param is input stream representing a PEP file | [
"Reads",
"a",
"PEP",
"file",
"from",
"the",
"input",
"stream",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L138-L187 |
157,072 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readCalendars | private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID"));
calendar.setName(row.getString("NAME"));
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY"));
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY"));
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY"));
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY"));
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY"));
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY"));
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY"));
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day);
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent);
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID"));
m_eventManager.fireCalendarReadEvent(child);
}
} | java | private void readCalendars()
{
//
// Create the calendars
//
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar calendar = m_projectFile.addCalendar();
calendar.setUniqueID(row.getInteger("UNIQUE_ID"));
calendar.setName(row.getString("NAME"));
calendar.setWorkingDay(Day.SUNDAY, row.getBoolean("SUNDAY"));
calendar.setWorkingDay(Day.MONDAY, row.getBoolean("MONDAY"));
calendar.setWorkingDay(Day.TUESDAY, row.getBoolean("TUESDAY"));
calendar.setWorkingDay(Day.WEDNESDAY, row.getBoolean("WEDNESDAY"));
calendar.setWorkingDay(Day.THURSDAY, row.getBoolean("THURSDAY"));
calendar.setWorkingDay(Day.FRIDAY, row.getBoolean("FRIDAY"));
calendar.setWorkingDay(Day.SATURDAY, row.getBoolean("SATURDAY"));
for (Day day : Day.values())
{
if (calendar.isWorkingDay(day))
{
// TODO: this is an approximation
calendar.addDefaultCalendarHours(day);
}
}
}
//
// Set up the hierarchy and add exceptions
//
Table exceptionsTable = getTable("CALXTAB");
for (MapRow row : getTable("NCALTAB"))
{
ProjectCalendar child = m_projectFile.getCalendarByUniqueID(row.getInteger("UNIQUE_ID"));
ProjectCalendar parent = m_projectFile.getCalendarByUniqueID(row.getInteger("BASE_CALENDAR_ID"));
if (child != null && parent != null)
{
child.setParent(parent);
}
addCalendarExceptions(exceptionsTable, child, row.getInteger("FIRST_CALENDAR_EXCEPTION_ID"));
m_eventManager.fireCalendarReadEvent(child);
}
} | [
"private",
"void",
"readCalendars",
"(",
")",
"{",
"//",
"// Create the calendars",
"//",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"NCALTAB\"",
")",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"m_projectFile",
".",
"addCalendar",
"(",
")",
";",
... | Read calendar data from a PEP file. | [
"Read",
"calendar",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L192-L237 |
157,073 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.addCalendarExceptions | private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID)
{
Integer currentExceptionID = exceptionID;
while (true)
{
MapRow row = table.find(currentExceptionID);
if (row == null)
{
break;
}
Date date = row.getDate("DATE");
ProjectCalendarException exception = calendar.addCalendarException(date, date);
if (row.getBoolean("WORKING"))
{
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID");
}
} | java | private void addCalendarExceptions(Table table, ProjectCalendar calendar, Integer exceptionID)
{
Integer currentExceptionID = exceptionID;
while (true)
{
MapRow row = table.find(currentExceptionID);
if (row == null)
{
break;
}
Date date = row.getDate("DATE");
ProjectCalendarException exception = calendar.addCalendarException(date, date);
if (row.getBoolean("WORKING"))
{
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING);
exception.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON);
}
currentExceptionID = row.getInteger("NEXT_CALENDAR_EXCEPTION_ID");
}
} | [
"private",
"void",
"addCalendarExceptions",
"(",
"Table",
"table",
",",
"ProjectCalendar",
"calendar",
",",
"Integer",
"exceptionID",
")",
"{",
"Integer",
"currentExceptionID",
"=",
"exceptionID",
";",
"while",
"(",
"true",
")",
"{",
"MapRow",
"row",
"=",
"table... | Read exceptions for a calendar.
@param table calendar exception data
@param calendar calendar
@param exceptionID first exception ID | [
"Read",
"exceptions",
"for",
"a",
"calendar",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L246-L267 |
157,074 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readResources | private void readResources()
{
for (MapRow row : getTable("RTAB"))
{
Resource resource = m_projectFile.addResource();
setFields(RESOURCE_FIELDS, row, resource);
m_eventManager.fireResourceReadEvent(resource);
// TODO: Correctly handle calendar
}
} | java | private void readResources()
{
for (MapRow row : getTable("RTAB"))
{
Resource resource = m_projectFile.addResource();
setFields(RESOURCE_FIELDS, row, resource);
m_eventManager.fireResourceReadEvent(resource);
// TODO: Correctly handle calendar
}
} | [
"private",
"void",
"readResources",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"RTAB\"",
")",
")",
"{",
"Resource",
"resource",
"=",
"m_projectFile",
".",
"addResource",
"(",
")",
";",
"setFields",
"(",
"RESOURCE_FIELDS",
",",
"row... | Read resource data from a PEP file. | [
"Read",
"resource",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L272-L281 |
157,075 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTasks | private void readTasks()
{
Integer rootID = Integer.valueOf(1);
readWBS(m_projectFile, rootID);
readTasks(rootID);
m_projectFile.getTasks().synchronizeTaskIDToHierarchy();
} | java | private void readTasks()
{
Integer rootID = Integer.valueOf(1);
readWBS(m_projectFile, rootID);
readTasks(rootID);
m_projectFile.getTasks().synchronizeTaskIDToHierarchy();
} | [
"private",
"void",
"readTasks",
"(",
")",
"{",
"Integer",
"rootID",
"=",
"Integer",
".",
"valueOf",
"(",
"1",
")",
";",
"readWBS",
"(",
"m_projectFile",
",",
"rootID",
")",
";",
"readTasks",
"(",
"rootID",
")",
";",
"m_projectFile",
".",
"getTasks",
"(",... | Read task data from a PEP file. | [
"Read",
"task",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L286-L292 |
157,076 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readWBS | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | java | private void readWBS(ChildTaskContainer parent, Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Integer taskID = row.getInteger("TASK_ID");
Task task = readTask(parent, taskID);
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readWBS(task, childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | [
"private",
"void",
"readWBS",
"(",
"ChildTaskContainer",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"WBSTAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",... | Recursively read the WBS structure from a PEP file.
@param parent parent container for tasks
@param id initial WBS ID | [
"Recursively",
"read",
"the",
"WBS",
"structure",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L300-L317 |
157,077 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTasks | private void readTasks(Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
readLeafTasks(task, row.getInteger("FIRST_CHILD_TASK_ID"));
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readTasks(childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | java | private void readTasks(Integer id)
{
Integer currentID = id;
Table table = getTable("WBSTAB");
while (currentID.intValue() != 0)
{
MapRow row = table.find(currentID);
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
readLeafTasks(task, row.getInteger("FIRST_CHILD_TASK_ID"));
Integer childID = row.getInteger("CHILD_ID");
if (childID.intValue() != 0)
{
readTasks(childID);
}
currentID = row.getInteger("NEXT_ID");
}
} | [
"private",
"void",
"readTasks",
"(",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"WBSTAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"MapRow",... | Read leaf tasks attached to the WBS.
@param id initial WBS ID | [
"Read",
"leaf",
"tasks",
"attached",
"to",
"the",
"WBS",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L324-L341 |
157,078 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readLeafTasks | private void readLeafTasks(Task parent, Integer id)
{
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | java | private void readLeafTasks(Task parent, Integer id)
{
Integer currentID = id;
Table table = getTable("A1TAB");
while (currentID.intValue() != 0)
{
if (m_projectFile.getTaskByUniqueID(currentID) == null)
{
readTask(parent, currentID);
}
currentID = table.find(currentID).getInteger("NEXT_TASK_ID");
}
} | [
"private",
"void",
"readLeafTasks",
"(",
"Task",
"parent",
",",
"Integer",
"id",
")",
"{",
"Integer",
"currentID",
"=",
"id",
";",
"Table",
"table",
"=",
"getTable",
"(",
"\"A1TAB\"",
")",
";",
"while",
"(",
"currentID",
".",
"intValue",
"(",
")",
"!=",
... | Read the leaf tasks for an individual WBS node.
@param parent parent task
@param id first task ID | [
"Read",
"the",
"leaf",
"tasks",
"for",
"an",
"individual",
"WBS",
"node",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L349-L361 |
157,079 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readTask | private Task readTask(ChildTaskContainer parent, Integer id)
{
Table a0 = getTable("A0TAB");
Table a1 = getTable("A1TAB");
Table a2 = getTable("A2TAB");
Table a3 = getTable("A3TAB");
Table a4 = getTable("A4TAB");
Task task = parent.addTask();
MapRow a1Row = a1.find(id);
MapRow a2Row = a2.find(id);
setFields(A0TAB_FIELDS, a0.find(id), task);
setFields(A1TAB_FIELDS, a1Row, task);
setFields(A2TAB_FIELDS, a2Row, task);
setFields(A3TAB_FIELDS, a3.find(id), task);
setFields(A5TAB_FIELDS, a4.find(id), task);
task.setStart(task.getEarlyStart());
task.setFinish(task.getEarlyFinish());
if (task.getName() == null)
{
task.setName(task.getText(1));
}
m_eventManager.fireTaskReadEvent(task);
return task;
} | java | private Task readTask(ChildTaskContainer parent, Integer id)
{
Table a0 = getTable("A0TAB");
Table a1 = getTable("A1TAB");
Table a2 = getTable("A2TAB");
Table a3 = getTable("A3TAB");
Table a4 = getTable("A4TAB");
Task task = parent.addTask();
MapRow a1Row = a1.find(id);
MapRow a2Row = a2.find(id);
setFields(A0TAB_FIELDS, a0.find(id), task);
setFields(A1TAB_FIELDS, a1Row, task);
setFields(A2TAB_FIELDS, a2Row, task);
setFields(A3TAB_FIELDS, a3.find(id), task);
setFields(A5TAB_FIELDS, a4.find(id), task);
task.setStart(task.getEarlyStart());
task.setFinish(task.getEarlyFinish());
if (task.getName() == null)
{
task.setName(task.getText(1));
}
m_eventManager.fireTaskReadEvent(task);
return task;
} | [
"private",
"Task",
"readTask",
"(",
"ChildTaskContainer",
"parent",
",",
"Integer",
"id",
")",
"{",
"Table",
"a0",
"=",
"getTable",
"(",
"\"A0TAB\"",
")",
";",
"Table",
"a1",
"=",
"getTable",
"(",
"\"A1TAB\"",
")",
";",
"Table",
"a2",
"=",
"getTable",
"(... | Read data for an individual task from the tables in a PEP file.
@param parent parent task
@param id task ID
@return task instance | [
"Read",
"data",
"for",
"an",
"individual",
"task",
"from",
"the",
"tables",
"in",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L370-L398 |
157,080 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readRelationships | private void readRelationships()
{
for (MapRow row : getTable("CONTAB"))
{
Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1"));
Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2"));
if (task1 != null && task2 != null)
{
RelationType type = row.getRelationType("TYPE");
Duration lag = row.getDuration("LAG");
Relation relation = task2.addPredecessor(task1, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
}
} | java | private void readRelationships()
{
for (MapRow row : getTable("CONTAB"))
{
Task task1 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_1"));
Task task2 = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID_2"));
if (task1 != null && task2 != null)
{
RelationType type = row.getRelationType("TYPE");
Duration lag = row.getDuration("LAG");
Relation relation = task2.addPredecessor(task1, type, lag);
m_eventManager.fireRelationReadEvent(relation);
}
}
} | [
"private",
"void",
"readRelationships",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"CONTAB\"",
")",
")",
"{",
"Task",
"task1",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"TASK_ID_1\"",
")",
... | Read relationship data from a PEP file. | [
"Read",
"relationship",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L403-L418 |
157,081 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.readResourceAssignments | private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment);
}
}
} | java | private void readResourceAssignments()
{
for (MapRow row : getTable("USGTAB"))
{
Task task = m_projectFile.getTaskByUniqueID(row.getInteger("TASK_ID"));
Resource resource = m_projectFile.getResourceByUniqueID(row.getInteger("RESOURCE_ID"));
if (task != null && resource != null)
{
ResourceAssignment assignment = task.addResourceAssignment(resource);
m_eventManager.fireAssignmentReadEvent(assignment);
}
}
} | [
"private",
"void",
"readResourceAssignments",
"(",
")",
"{",
"for",
"(",
"MapRow",
"row",
":",
"getTable",
"(",
"\"USGTAB\"",
")",
")",
"{",
"Task",
"task",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"TASK_ID\"",
")... | Read resource assignment data from a PEP file. | [
"Read",
"resource",
"assignment",
"data",
"from",
"a",
"PEP",
"file",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L423-L435 |
157,082 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.getTable | private Table getTable(String name)
{
Table table = m_tables.get(name);
if (table == null)
{
table = EMPTY_TABLE;
}
return table;
} | java | private Table getTable(String name)
{
Table table = m_tables.get(name);
if (table == null)
{
table = EMPTY_TABLE;
}
return table;
} | [
"private",
"Table",
"getTable",
"(",
"String",
"name",
")",
"{",
"Table",
"table",
"=",
"m_tables",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"table",
"=",
"EMPTY_TABLE",
";",
"}",
"return",
"table",
";",
"}"
] | Retrieve a table by name.
@param name table name
@return Table instance | [
"Retrieve",
"a",
"table",
"by",
"name",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L443-L451 |
157,083 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.applyAliases | private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue());
}
} | java | private void applyAliases()
{
CustomFieldContainer fields = m_projectFile.getCustomFields();
for (Map.Entry<FieldType, String> entry : ALIASES.entrySet())
{
fields.getCustomField(entry.getKey()).setAlias(entry.getValue());
}
} | [
"private",
"void",
"applyAliases",
"(",
")",
"{",
"CustomFieldContainer",
"fields",
"=",
"m_projectFile",
".",
"getCustomFields",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"FieldType",
",",
"String",
">",
"entry",
":",
"ALIASES",
".",
"entrySet",
... | Configure column aliases. | [
"Configure",
"column",
"aliases",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L456-L463 |
157,084 | joniles/mpxj | src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java | TurboProjectReader.defineField | private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)
{
container.put(name, type);
if (alias != null)
{
ALIASES.put(type, alias);
}
} | java | private static void defineField(Map<String, FieldType> container, String name, FieldType type, String alias)
{
container.put(name, type);
if (alias != null)
{
ALIASES.put(type, alias);
}
} | [
"private",
"static",
"void",
"defineField",
"(",
"Map",
"<",
"String",
",",
"FieldType",
">",
"container",
",",
"String",
"name",
",",
"FieldType",
"type",
",",
"String",
"alias",
")",
"{",
"container",
".",
"put",
"(",
"name",
",",
"type",
")",
";",
"... | Configure the mapping between a database column and a field, including definition of
an alias.
@param container column to field map
@param name column name
@param type field type
@param alias field alias | [
"Configure",
"the",
"mapping",
"between",
"a",
"database",
"column",
"and",
"a",
"field",
"including",
"definition",
"of",
"an",
"alias",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/TurboProjectReader.java#L504-L511 |
157,085 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getString | public String getString(Integer type)
{
String result = null;
byte[] item = m_map.get(type);
if (item != null)
{
result = m_data.getString(getOffset(item));
}
return (result);
} | java | public String getString(Integer type)
{
String result = null;
byte[] item = m_map.get(type);
if (item != null)
{
result = m_data.getString(getOffset(item));
}
return (result);
} | [
"public",
"String",
"getString",
"(",
"Integer",
"type",
")",
"{",
"String",
"result",
"=",
"null",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"m_data",
... | Retrieves a string value from the extended data.
@param type Type identifier
@return string value | [
"Retrieves",
"a",
"string",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L79-L90 |
157,086 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getInt | public int getInt(Integer type)
{
int result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getInt(item, 0);
}
return (result);
} | java | public int getInt(Integer type)
{
int result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getInt(item, 0);
}
return (result);
} | [
"public",
"int",
"getInt",
"(",
"Integer",
"type",
")",
"{",
"int",
"result",
"=",
"0",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"MPPUtility",
".",
... | Retrieves an integer value from the extended data.
@param type Type identifier
@return integer value | [
"Retrieves",
"an",
"integer",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L136-L147 |
157,087 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ExtendedData.java | ExtendedData.getLong | public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0);
}
return (result);
} | java | public long getLong(Integer type)
{
long result = 0;
byte[] item = m_map.get(type);
if (item != null)
{
result = MPPUtility.getLong6(item, 0);
}
return (result);
} | [
"public",
"long",
"getLong",
"(",
"Integer",
"type",
")",
"{",
"long",
"result",
"=",
"0",
";",
"byte",
"[",
"]",
"item",
"=",
"m_map",
".",
"get",
"(",
"type",
")",
";",
"if",
"(",
"item",
"!=",
"null",
")",
"{",
"result",
"=",
"MPPUtility",
"."... | Retrieves a long value from the extended data.
@param type Type identifier
@return long value | [
"Retrieves",
"a",
"long",
"value",
"from",
"the",
"extended",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ExtendedData.java#L155-L166 |
157,088 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java | ResourceAssignmentFactory.processHyperlinkData | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | java | private void processHyperlinkData(ResourceAssignment assignment, byte[] data)
{
if (data != null)
{
int offset = 12;
offset += 12;
String hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
String address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
String subaddress = MPPUtility.getUnicodeString(data, offset);
offset += ((subaddress.length() + 1) * 2);
offset += 12;
String screentip = MPPUtility.getUnicodeString(data, offset);
assignment.setHyperlink(hyperlink);
assignment.setHyperlinkAddress(address);
assignment.setHyperlinkSubAddress(subaddress);
assignment.setHyperlinkScreenTip(screentip);
}
} | [
"private",
"void",
"processHyperlinkData",
"(",
"ResourceAssignment",
"assignment",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"12",
";",
"offset",
"+=",
"12",
";",
"String",
"hyperlink",
"="... | Extract assignment hyperlink data.
@param assignment assignment instance
@param data hyperlink data | [
"Extract",
"assignment",
"hyperlink",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L277-L303 |
157,089 | joniles/mpxj | src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java | ResourceAssignmentFactory.createTimephasedData | private void createTimephasedData(ProjectFile file, ResourceAssignment assignment, List<TimephasedWork> timephasedPlanned, List<TimephasedWork> timephasedComplete)
{
if (timephasedPlanned.isEmpty() && timephasedComplete.isEmpty())
{
Duration totalMinutes = assignment.getWork().convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
Duration workPerDay;
if (assignment.getResource() == null || assignment.getResource().getType() == ResourceType.WORK)
{
workPerDay = totalMinutes.getDuration() == 0 ? totalMinutes : ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
int units = NumberHelper.getInt(assignment.getUnits());
if (units != 100)
{
workPerDay = Duration.getInstance((workPerDay.getDuration() * units) / 100.0, workPerDay.getUnits());
}
}
else
{
if (assignment.getVariableRateUnits() == null)
{
Duration workingDays = assignment.getCalendar().getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.DAYS);
double units = NumberHelper.getDouble(assignment.getUnits());
double unitsPerDayAsMinutes = (units * 60) / (workingDays.getDuration() * 100);
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
else
{
double unitsPerHour = NumberHelper.getDouble(assignment.getUnits());
workPerDay = ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
Duration hoursPerDay = workPerDay.convertUnits(TimeUnit.HOURS, file.getProjectProperties());
double unitsPerDayAsHours = (unitsPerHour * hoursPerDay.getDuration()) / 100;
double unitsPerDayAsMinutes = unitsPerDayAsHours * 60;
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
}
Duration overtimeWork = assignment.getOvertimeWork();
if (overtimeWork != null && overtimeWork.getDuration() != 0)
{
Duration totalOvertimeMinutes = overtimeWork.convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
totalMinutes = Duration.getInstance(totalMinutes.getDuration() - totalOvertimeMinutes.getDuration(), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(assignment.getStart());
tra.setAmountPerDay(workPerDay);
tra.setModified(false);
tra.setFinish(assignment.getFinish());
tra.setTotalAmount(totalMinutes);
timephasedPlanned.add(tra);
}
} | java | private void createTimephasedData(ProjectFile file, ResourceAssignment assignment, List<TimephasedWork> timephasedPlanned, List<TimephasedWork> timephasedComplete)
{
if (timephasedPlanned.isEmpty() && timephasedComplete.isEmpty())
{
Duration totalMinutes = assignment.getWork().convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
Duration workPerDay;
if (assignment.getResource() == null || assignment.getResource().getType() == ResourceType.WORK)
{
workPerDay = totalMinutes.getDuration() == 0 ? totalMinutes : ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
int units = NumberHelper.getInt(assignment.getUnits());
if (units != 100)
{
workPerDay = Duration.getInstance((workPerDay.getDuration() * units) / 100.0, workPerDay.getUnits());
}
}
else
{
if (assignment.getVariableRateUnits() == null)
{
Duration workingDays = assignment.getCalendar().getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.DAYS);
double units = NumberHelper.getDouble(assignment.getUnits());
double unitsPerDayAsMinutes = (units * 60) / (workingDays.getDuration() * 100);
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
else
{
double unitsPerHour = NumberHelper.getDouble(assignment.getUnits());
workPerDay = ResourceAssignmentFactory.DEFAULT_NORMALIZER_WORK_PER_DAY;
Duration hoursPerDay = workPerDay.convertUnits(TimeUnit.HOURS, file.getProjectProperties());
double unitsPerDayAsHours = (unitsPerHour * hoursPerDay.getDuration()) / 100;
double unitsPerDayAsMinutes = unitsPerDayAsHours * 60;
workPerDay = Duration.getInstance(unitsPerDayAsMinutes, TimeUnit.MINUTES);
}
}
Duration overtimeWork = assignment.getOvertimeWork();
if (overtimeWork != null && overtimeWork.getDuration() != 0)
{
Duration totalOvertimeMinutes = overtimeWork.convertUnits(TimeUnit.MINUTES, file.getProjectProperties());
totalMinutes = Duration.getInstance(totalMinutes.getDuration() - totalOvertimeMinutes.getDuration(), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(assignment.getStart());
tra.setAmountPerDay(workPerDay);
tra.setModified(false);
tra.setFinish(assignment.getFinish());
tra.setTotalAmount(totalMinutes);
timephasedPlanned.add(tra);
}
} | [
"private",
"void",
"createTimephasedData",
"(",
"ProjectFile",
"file",
",",
"ResourceAssignment",
"assignment",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedPlanned",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedComplete",
")",
"{",
"if",
"(",
"timepha... | Method used to create missing timephased data.
@param file project file
@param assignment resource assignment
@param timephasedPlanned planned timephased data
@param timephasedComplete complete timephased data | [
"Method",
"used",
"to",
"create",
"missing",
"timephased",
"data",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/ResourceAssignmentFactory.java#L313-L365 |
157,090 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printTimestamp | public static final String printTimestamp(Date value)
{
return (value == null ? null : TIMESTAMP_FORMAT.get().format(value));
} | java | public static final String printTimestamp(Date value)
{
return (value == null ? null : TIMESTAMP_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printTimestamp",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"TIMESTAMP_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print a timestamp value.
@param value time value
@return time value | [
"Print",
"a",
"timestamp",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L72-L75 |
157,091 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.parseDuration | public static final Duration parseDuration(String value)
{
return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);
} | java | public static final Duration parseDuration(String value)
{
return value == null ? null : Duration.getInstance(Double.parseDouble(value), TimeUnit.DAYS);
} | [
"public",
"static",
"final",
"Duration",
"parseDuration",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Duration",
".",
"getInstance",
"(",
"Double",
".",
"parseDouble",
"(",
"value",
")",
",",
"TimeUnit",
".",
"DAYS... | Parse a duration value.
@param value duration value
@return Duration instance | [
"Parse",
"a",
"duration",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L83-L86 |
157,092 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printDuration | public static final String printDuration(Duration value)
{
return value == null ? null : Double.toString(value.getDuration());
} | java | public static final String printDuration(Duration value)
{
return value == null ? null : Double.toString(value.getDuration());
} | [
"public",
"static",
"final",
"String",
"printDuration",
"(",
"Duration",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"toString",
"(",
"value",
".",
"getDuration",
"(",
")",
")",
";",
"}"
] | Print a duration value.
@param value Duration instance
@return string representation of a duration | [
"Print",
"a",
"duration",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L94-L97 |
157,093 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printDate | public static final String printDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | java | public static final String printDate(Date value)
{
return (value == null ? null : DATE_FORMAT.get().format(value));
} | [
"public",
"static",
"final",
"String",
"printDate",
"(",
"Date",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
"?",
"null",
":",
"DATE_FORMAT",
".",
"get",
"(",
")",
".",
"format",
"(",
"value",
")",
")",
";",
"}"
] | Print a date.
@param value Date instance
@return string representation of a date | [
"Print",
"a",
"date",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L131-L134 |
157,094 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.parsePercent | public static final Double parsePercent(String value)
{
return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);
} | java | public static final Double parsePercent(String value)
{
return value == null ? null : Double.valueOf(Double.parseDouble(value) * 100.0);
} | [
"public",
"static",
"final",
"Double",
"parsePercent",
"(",
"String",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"valueOf",
"(",
"Double",
".",
"parseDouble",
"(",
"value",
")",
"*",
"100.0",
")",
";",
"}"
] | Parse a percent complete value.
@param value sting representation of a percent complete value.
@return Double instance | [
"Parse",
"a",
"percent",
"complete",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L142-L145 |
157,095 | joniles/mpxj | src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java | DatatypeConverter.printPercent | public static final String printPercent(Double value)
{
return value == null ? null : Double.toString(value.doubleValue() / 100.0);
} | java | public static final String printPercent(Double value)
{
return value == null ? null : Double.toString(value.doubleValue() / 100.0);
} | [
"public",
"static",
"final",
"String",
"printPercent",
"(",
"Double",
"value",
")",
"{",
"return",
"value",
"==",
"null",
"?",
"null",
":",
"Double",
".",
"toString",
"(",
"value",
".",
"doubleValue",
"(",
")",
"/",
"100.0",
")",
";",
"}"
] | Print a percent complete value.
@param value Double instance
@return percent complete value | [
"Print",
"a",
"percent",
"complete",
"value",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ganttdesigner/DatatypeConverter.java#L153-L156 |
157,096 | joniles/mpxj | src/main/java/net/sf/mpxj/conceptdraw/schema/PPVItemsType.java | PPVItemsType.getPPVItem | public List<PPVItemsType.PPVItem> getPPVItem()
{
if (ppvItem == null)
{
ppvItem = new ArrayList<PPVItemsType.PPVItem>();
}
return this.ppvItem;
} | java | public List<PPVItemsType.PPVItem> getPPVItem()
{
if (ppvItem == null)
{
ppvItem = new ArrayList<PPVItemsType.PPVItem>();
}
return this.ppvItem;
} | [
"public",
"List",
"<",
"PPVItemsType",
".",
"PPVItem",
">",
"getPPVItem",
"(",
")",
"{",
"if",
"(",
"ppvItem",
"==",
"null",
")",
"{",
"ppvItem",
"=",
"new",
"ArrayList",
"<",
"PPVItemsType",
".",
"PPVItem",
">",
"(",
")",
";",
"}",
"return",
"this",
... | Gets the value of the ppvItem property.
<p>
This accessor method returns a reference to the live list,
not a snapshot. Therefore any modification you make to the
returned list will be present inside the JAXB object.
This is why there is not a <CODE>set</CODE> method for the ppvItem property.
<p>
For example, to add a new item, do as follows:
<pre>
getPPVItem().add(newItem);
</pre>
<p>
Objects of the following type(s) are allowed in the list
{@link PPVItemsType.PPVItem } | [
"Gets",
"the",
"value",
"of",
"the",
"ppvItem",
"property",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/conceptdraw/schema/PPVItemsType.java#L112-L119 |
157,097 | joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getCustomField | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | java | public CustomField getCustomField(FieldType field)
{
CustomField result = m_configMap.get(field);
if (result == null)
{
result = new CustomField(field, this);
m_configMap.put(field, result);
}
return result;
} | [
"public",
"CustomField",
"getCustomField",
"(",
"FieldType",
"field",
")",
"{",
"CustomField",
"result",
"=",
"m_configMap",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"new",
"CustomField",
"(",
"field",... | Retrieve configuration details for a given custom field.
@param field required custom field
@return configuration detail | [
"Retrieve",
"configuration",
"details",
"for",
"a",
"given",
"custom",
"field",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L44-L53 |
157,098 | joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.registerAlias | void registerAlias(FieldType type, String alias)
{
m_aliasMap.put(new Pair<FieldTypeClass, String>(type.getFieldTypeClass(), alias), type);
} | java | void registerAlias(FieldType type, String alias)
{
m_aliasMap.put(new Pair<FieldTypeClass, String>(type.getFieldTypeClass(), alias), type);
} | [
"void",
"registerAlias",
"(",
"FieldType",
"type",
",",
"String",
"alias",
")",
"{",
"m_aliasMap",
".",
"put",
"(",
"new",
"Pair",
"<",
"FieldTypeClass",
",",
"String",
">",
"(",
"type",
".",
"getFieldTypeClass",
"(",
")",
",",
"alias",
")",
",",
"type",... | When an alias for a field is added, index it here to allow lookup by alias and type.
@param type field type
@param alias field alias | [
"When",
"an",
"alias",
"for",
"a",
"field",
"is",
"added",
"index",
"it",
"here",
"to",
"allow",
"lookup",
"by",
"alias",
"and",
"type",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L107-L110 |
157,099 | joniles/mpxj | src/main/java/net/sf/mpxj/CustomFieldContainer.java | CustomFieldContainer.getFieldByAlias | public FieldType getFieldByAlias(FieldTypeClass typeClass, String alias)
{
return m_aliasMap.get(new Pair<FieldTypeClass, String>(typeClass, alias));
} | java | public FieldType getFieldByAlias(FieldTypeClass typeClass, String alias)
{
return m_aliasMap.get(new Pair<FieldTypeClass, String>(typeClass, alias));
} | [
"public",
"FieldType",
"getFieldByAlias",
"(",
"FieldTypeClass",
"typeClass",
",",
"String",
"alias",
")",
"{",
"return",
"m_aliasMap",
".",
"get",
"(",
"new",
"Pair",
"<",
"FieldTypeClass",
",",
"String",
">",
"(",
"typeClass",
",",
"alias",
")",
")",
";",
... | Retrieve a field from a particular entity using its alias.
@param typeClass the type of entity we are interested in
@param alias the alias
@return the field type referred to be the alias, or null if not found | [
"Retrieve",
"a",
"field",
"from",
"a",
"particular",
"entity",
"using",
"its",
"alias",
"."
] | 143ea0e195da59cd108f13b3b06328e9542337e8 | https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/CustomFieldContainer.java#L119-L122 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.