repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectEntityContainer.java
ProjectEntityContainer.renumberUniqueIDs
public void renumberUniqueIDs() { int uid = firstUniqueID(); for (T entity : this) { entity.setUniqueID(Integer.valueOf(uid++)); } }
java
public void renumberUniqueIDs() { int uid = firstUniqueID(); for (T entity : this) { entity.setUniqueID(Integer.valueOf(uid++)); } }
[ "public", "void", "renumberUniqueIDs", "(", ")", "{", "int", "uid", "=", "firstUniqueID", "(", ")", ";", "for", "(", "T", "entity", ":", "this", ")", "{", "entity", ".", "setUniqueID", "(", "Integer", ".", "valueOf", "(", "uid", "++", ")", ")", ";", ...
Renumbers all entity unique IDs.
[ "Renumbers", "all", "entity", "unique", "IDs", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectEntityContainer.java#L61-L68
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectEntityContainer.java
ProjectEntityContainer.validateUniqueIDsForMicrosoftProject
public void validateUniqueIDsForMicrosoftProject() { if (!isEmpty()) { for (T entity : this) { if (NumberHelper.getInt(entity.getUniqueID()) > MS_PROJECT_MAX_UNIQUE_ID) { renumberUniqueIDs(); break; } } } }
java
public void validateUniqueIDsForMicrosoftProject() { if (!isEmpty()) { for (T entity : this) { if (NumberHelper.getInt(entity.getUniqueID()) > MS_PROJECT_MAX_UNIQUE_ID) { renumberUniqueIDs(); break; } } } }
[ "public", "void", "validateUniqueIDsForMicrosoftProject", "(", ")", "{", "if", "(", "!", "isEmpty", "(", ")", ")", "{", "for", "(", "T", "entity", ":", "this", ")", "{", "if", "(", "NumberHelper", ".", "getInt", "(", "entity", ".", "getUniqueID", "(", ...
Validate that the Unique IDs for the entities in this container are valid for MS Project. If they are not valid, i.e one or more of them are too large, renumber them.
[ "Validate", "that", "the", "Unique", "IDs", "for", "the", "entities", "in", "this", "container", "are", "valid", "for", "MS", "Project", ".", "If", "they", "are", "not", "valid", "i", ".", "e", "one", "or", "more", "of", "them", "are", "too", "large", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectEntityContainer.java#L74-L87
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readDefinitions
private void readDefinitions() { for (MapRow row : m_tables.get("TTL")) { Integer id = row.getInteger("DEFINITION_ID"); List<MapRow> list = m_definitions.get(id); if (list == null) { list = new ArrayList<MapRow>(); m_definitions.put(id, list); } list.add(row); } List<MapRow> rows = m_definitions.get(WBS_FORMAT_ID); if (rows != null) { m_wbsFormat = new SureTrakWbsFormat(rows.get(0)); } }
java
private void readDefinitions() { for (MapRow row : m_tables.get("TTL")) { Integer id = row.getInteger("DEFINITION_ID"); List<MapRow> list = m_definitions.get(id); if (list == null) { list = new ArrayList<MapRow>(); m_definitions.put(id, list); } list.add(row); } List<MapRow> rows = m_definitions.get(WBS_FORMAT_ID); if (rows != null) { m_wbsFormat = new SureTrakWbsFormat(rows.get(0)); } }
[ "private", "void", "readDefinitions", "(", ")", "{", "for", "(", "MapRow", "row", ":", "m_tables", ".", "get", "(", "\"TTL\"", ")", ")", "{", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"DEFINITION_ID\"", ")", ";", "List", "<", "MapRow", ">"...
Extract definition records from the table and divide into groups.
[ "Extract", "definition", "records", "from", "the", "table", "and", "divide", "into", "groups", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L280-L299
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readCalendars
private void readCalendars() { Table cal = m_tables.get("CAL"); for (MapRow row : cal) { ProjectCalendar calendar = m_projectFile.addCalendar(); m_calendarMap.put(row.getInteger("CALENDAR_ID"), calendar); Integer[] days = { row.getInteger("SUNDAY_HOURS"), row.getInteger("MONDAY_HOURS"), row.getInteger("TUESDAY_HOURS"), row.getInteger("WEDNESDAY_HOURS"), row.getInteger("THURSDAY_HOURS"), row.getInteger("FRIDAY_HOURS"), row.getInteger("SATURDAY_HOURS") }; calendar.setName(row.getString("NAME")); readHours(calendar, Day.SUNDAY, days[0]); readHours(calendar, Day.MONDAY, days[1]); readHours(calendar, Day.TUESDAY, days[2]); readHours(calendar, Day.WEDNESDAY, days[3]); readHours(calendar, Day.THURSDAY, days[4]); readHours(calendar, Day.FRIDAY, days[5]); readHours(calendar, Day.SATURDAY, days[6]); int workingDaysPerWeek = 0; for (Day day : Day.values()) { if (calendar.isWorkingDay(day)) { ++workingDaysPerWeek; } } Integer workingHours = null; for (int index = 0; index < 7; index++) { if (days[index].intValue() != 0) { workingHours = days[index]; break; } } if (workingHours != null) { int workingHoursPerDay = countHours(workingHours); int minutesPerDay = workingHoursPerDay * 60; int minutesPerWeek = minutesPerDay * workingDaysPerWeek; int minutesPerMonth = 4 * minutesPerWeek; int minutesPerYear = 52 * minutesPerWeek; calendar.setMinutesPerDay(Integer.valueOf(minutesPerDay)); calendar.setMinutesPerWeek(Integer.valueOf(minutesPerWeek)); calendar.setMinutesPerMonth(Integer.valueOf(minutesPerMonth)); calendar.setMinutesPerYear(Integer.valueOf(minutesPerYear)); } } }
java
private void readCalendars() { Table cal = m_tables.get("CAL"); for (MapRow row : cal) { ProjectCalendar calendar = m_projectFile.addCalendar(); m_calendarMap.put(row.getInteger("CALENDAR_ID"), calendar); Integer[] days = { row.getInteger("SUNDAY_HOURS"), row.getInteger("MONDAY_HOURS"), row.getInteger("TUESDAY_HOURS"), row.getInteger("WEDNESDAY_HOURS"), row.getInteger("THURSDAY_HOURS"), row.getInteger("FRIDAY_HOURS"), row.getInteger("SATURDAY_HOURS") }; calendar.setName(row.getString("NAME")); readHours(calendar, Day.SUNDAY, days[0]); readHours(calendar, Day.MONDAY, days[1]); readHours(calendar, Day.TUESDAY, days[2]); readHours(calendar, Day.WEDNESDAY, days[3]); readHours(calendar, Day.THURSDAY, days[4]); readHours(calendar, Day.FRIDAY, days[5]); readHours(calendar, Day.SATURDAY, days[6]); int workingDaysPerWeek = 0; for (Day day : Day.values()) { if (calendar.isWorkingDay(day)) { ++workingDaysPerWeek; } } Integer workingHours = null; for (int index = 0; index < 7; index++) { if (days[index].intValue() != 0) { workingHours = days[index]; break; } } if (workingHours != null) { int workingHoursPerDay = countHours(workingHours); int minutesPerDay = workingHoursPerDay * 60; int minutesPerWeek = minutesPerDay * workingDaysPerWeek; int minutesPerMonth = 4 * minutesPerWeek; int minutesPerYear = 52 * minutesPerWeek; calendar.setMinutesPerDay(Integer.valueOf(minutesPerDay)); calendar.setMinutesPerWeek(Integer.valueOf(minutesPerWeek)); calendar.setMinutesPerMonth(Integer.valueOf(minutesPerMonth)); calendar.setMinutesPerYear(Integer.valueOf(minutesPerYear)); } } }
[ "private", "void", "readCalendars", "(", ")", "{", "Table", "cal", "=", "m_tables", ".", "get", "(", "\"CAL\"", ")", ";", "for", "(", "MapRow", "row", ":", "cal", ")", "{", "ProjectCalendar", "calendar", "=", "m_projectFile", ".", "addCalendar", "(", ")"...
Read project calendars.
[ "Read", "project", "calendars", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L304-L364
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readHours
private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; ++startHour; } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; ++endHour; } cal.set(Calendar.HOUR_OF_DAY, startHour); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); calendar.setWorkingDay(day, true); } calendarHours.addRange(new DateRange(startDate, endDate)); startHour = endHour; } DateHelper.pushCalendar(cal); }
java
private void readHours(ProjectCalendar calendar, Day day, Integer hours) { int value = hours.intValue(); int startHour = 0; ProjectCalendarHours calendarHours = null; Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); calendar.setWorkingDay(day, false); while (value != 0) { // Move forward until we find a working hour while (startHour < 24 && (value & 0x1) == 0) { value = value >> 1; ++startHour; } // No more working hours, bail out if (startHour >= 24) { break; } // Move forward until we find the end of the working hours int endHour = startHour; while (endHour < 24 && (value & 0x1) != 0) { value = value >> 1; ++endHour; } cal.set(Calendar.HOUR_OF_DAY, startHour); Date startDate = cal.getTime(); cal.set(Calendar.HOUR_OF_DAY, endHour); Date endDate = cal.getTime(); if (calendarHours == null) { calendarHours = calendar.addCalendarHours(day); calendar.setWorkingDay(day, true); } calendarHours.addRange(new DateRange(startDate, endDate)); startHour = endHour; } DateHelper.pushCalendar(cal); }
[ "private", "void", "readHours", "(", "ProjectCalendar", "calendar", ",", "Day", "day", ",", "Integer", "hours", ")", "{", "int", "value", "=", "hours", ".", "intValue", "(", ")", ";", "int", "startHour", "=", "0", ";", "ProjectCalendarHours", "calendarHours"...
Reads the integer representation of calendar hours for a given day and populates the calendar. @param calendar parent calendar @param day target day @param hours working hours
[ "Reads", "the", "integer", "representation", "of", "calendar", "hours", "for", "a", "given", "day", "and", "populates", "the", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L374-L426
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.countHours
private int countHours(Integer hours) { int value = hours.intValue(); int hoursPerDay = 0; int hour = 0; while (value > 0) { // Move forward until we find a working hour while (hour < 24) { if ((value & 0x1) != 0) { ++hoursPerDay; } value = value >> 1; ++hour; } } return hoursPerDay; }
java
private int countHours(Integer hours) { int value = hours.intValue(); int hoursPerDay = 0; int hour = 0; while (value > 0) { // Move forward until we find a working hour while (hour < 24) { if ((value & 0x1) != 0) { ++hoursPerDay; } value = value >> 1; ++hour; } } return hoursPerDay; }
[ "private", "int", "countHours", "(", "Integer", "hours", ")", "{", "int", "value", "=", "hours", ".", "intValue", "(", ")", ";", "int", "hoursPerDay", "=", "0", ";", "int", "hour", "=", "0", ";", "while", "(", "value", ">", "0", ")", "{", "// Move ...
Count the number of working hours in a day, based in the integer representation of the working hours. @param hours working hours @return number of hours
[ "Count", "the", "number", "of", "working", "hours", "in", "a", "day", "based", "in", "the", "integer", "representation", "of", "the", "working", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L435-L454
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readHolidays
private void readHolidays() { for (MapRow row : m_tables.get("HOL")) { ProjectCalendar calendar = m_calendarMap.get(row.getInteger("CALENDAR_ID")); if (calendar != null) { Date date = row.getDate("DATE"); ProjectCalendarException exception = calendar.addCalendarException(date, date); if (row.getBoolean("ANNUAL")) { RecurringData recurring = new RecurringData(); recurring.setRecurrenceType(RecurrenceType.YEARLY); recurring.setYearlyAbsoluteFromDate(date); recurring.setStartDate(date); exception.setRecurring(recurring); // TODO set end date based on project end date } } } }
java
private void readHolidays() { for (MapRow row : m_tables.get("HOL")) { ProjectCalendar calendar = m_calendarMap.get(row.getInteger("CALENDAR_ID")); if (calendar != null) { Date date = row.getDate("DATE"); ProjectCalendarException exception = calendar.addCalendarException(date, date); if (row.getBoolean("ANNUAL")) { RecurringData recurring = new RecurringData(); recurring.setRecurrenceType(RecurrenceType.YEARLY); recurring.setYearlyAbsoluteFromDate(date); recurring.setStartDate(date); exception.setRecurring(recurring); // TODO set end date based on project end date } } } }
[ "private", "void", "readHolidays", "(", ")", "{", "for", "(", "MapRow", "row", ":", "m_tables", ".", "get", "(", "\"HOL\"", ")", ")", "{", "ProjectCalendar", "calendar", "=", "m_calendarMap", ".", "get", "(", "row", ".", "getInteger", "(", "\"CALENDAR_ID\"...
Read holidays from the database and create calendar exceptions.
[ "Read", "holidays", "from", "the", "database", "and", "create", "calendar", "exceptions", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L459-L479
train
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java
SureTrakDatabaseReader.readActivities
private void readActivities() { List<MapRow> items = new ArrayList<MapRow>(); for (MapRow row : m_tables.get("ACT")) { items.add(row); } final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(items, new Comparator<MapRow>() { @Override public int compare(MapRow o1, MapRow o2) { return comparator.compare(o1.getString("ACTIVITY_ID"), o2.getString("ACTIVITY_ID")); } }); for (MapRow row : items) { String activityID = row.getString("ACTIVITY_ID"); String wbs; if (m_wbsFormat == null) { wbs = null; } else { m_wbsFormat.parseRawValue(row.getString("WBS")); wbs = m_wbsFormat.getFormattedValue(); } ChildTaskContainer parent = m_wbsMap.get(wbs); if (parent == null) { parent = m_projectFile; } Task task = parent.addTask(); setFields(TASK_FIELDS, row, task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); task.setMilestone(task.getDuration().getDuration() == 0); task.setWBS(wbs); Duration duration = task.getDuration(); Duration remainingDuration = task.getRemainingDuration(); task.setActualDuration(Duration.getInstance(duration.getDuration() - remainingDuration.getDuration(), TimeUnit.HOURS)); m_activityMap.put(activityID, task); } }
java
private void readActivities() { List<MapRow> items = new ArrayList<MapRow>(); for (MapRow row : m_tables.get("ACT")) { items.add(row); } final AlphanumComparator comparator = new AlphanumComparator(); Collections.sort(items, new Comparator<MapRow>() { @Override public int compare(MapRow o1, MapRow o2) { return comparator.compare(o1.getString("ACTIVITY_ID"), o2.getString("ACTIVITY_ID")); } }); for (MapRow row : items) { String activityID = row.getString("ACTIVITY_ID"); String wbs; if (m_wbsFormat == null) { wbs = null; } else { m_wbsFormat.parseRawValue(row.getString("WBS")); wbs = m_wbsFormat.getFormattedValue(); } ChildTaskContainer parent = m_wbsMap.get(wbs); if (parent == null) { parent = m_projectFile; } Task task = parent.addTask(); setFields(TASK_FIELDS, row, task); task.setStart(task.getEarlyStart()); task.setFinish(task.getEarlyFinish()); task.setMilestone(task.getDuration().getDuration() == 0); task.setWBS(wbs); Duration duration = task.getDuration(); Duration remainingDuration = task.getRemainingDuration(); task.setActualDuration(Duration.getInstance(duration.getDuration() - remainingDuration.getDuration(), TimeUnit.HOURS)); m_activityMap.put(activityID, task); } }
[ "private", "void", "readActivities", "(", ")", "{", "List", "<", "MapRow", ">", "items", "=", "new", "ArrayList", "<", "MapRow", ">", "(", ")", ";", "for", "(", "MapRow", "row", ":", "m_tables", ".", "get", "(", "\"ACT\"", ")", ")", "{", "items", "...
Read activities.
[ "Read", "activities", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L588-L636
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java
CostRateTableFactory.process
public void process(Resource resource, int index, byte[] data) { CostRateTable result = new CostRateTable(); if (data != null) { for (int i = 16; i + 44 <= data.length; i += 44) { Rate standardRate = new Rate(MPPUtility.getDouble(data, i), TimeUnit.HOURS); TimeUnit standardRateFormat = getFormat(MPPUtility.getShort(data, i + 8)); Rate overtimeRate = new Rate(MPPUtility.getDouble(data, i + 16), TimeUnit.HOURS); TimeUnit overtimeRateFormat = getFormat(MPPUtility.getShort(data, i + 24)); Double costPerUse = NumberHelper.getDouble(MPPUtility.getDouble(data, i + 32) / 100.0); Date endDate = MPPUtility.getTimestampFromTenths(data, i + 40); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); result.add(entry); } Collections.sort(result); } else { // // MS Project economises by not actually storing the first cost rate // table if it doesn't need to, so we take this into account here. // if (index == 0) { Rate standardRate = resource.getStandardRate(); Rate overtimeRate = resource.getOvertimeRate(); Number costPerUse = resource.getCostPerUse(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRate.getUnits(), overtimeRate, overtimeRate.getUnits(), costPerUse, CostRateTableEntry.DEFAULT_ENTRY.getEndDate()); result.add(entry); } else { result.add(CostRateTableEntry.DEFAULT_ENTRY); } } resource.setCostRateTable(index, result); }
java
public void process(Resource resource, int index, byte[] data) { CostRateTable result = new CostRateTable(); if (data != null) { for (int i = 16; i + 44 <= data.length; i += 44) { Rate standardRate = new Rate(MPPUtility.getDouble(data, i), TimeUnit.HOURS); TimeUnit standardRateFormat = getFormat(MPPUtility.getShort(data, i + 8)); Rate overtimeRate = new Rate(MPPUtility.getDouble(data, i + 16), TimeUnit.HOURS); TimeUnit overtimeRateFormat = getFormat(MPPUtility.getShort(data, i + 24)); Double costPerUse = NumberHelper.getDouble(MPPUtility.getDouble(data, i + 32) / 100.0); Date endDate = MPPUtility.getTimestampFromTenths(data, i + 40); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); result.add(entry); } Collections.sort(result); } else { // // MS Project economises by not actually storing the first cost rate // table if it doesn't need to, so we take this into account here. // if (index == 0) { Rate standardRate = resource.getStandardRate(); Rate overtimeRate = resource.getOvertimeRate(); Number costPerUse = resource.getCostPerUse(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRate.getUnits(), overtimeRate, overtimeRate.getUnits(), costPerUse, CostRateTableEntry.DEFAULT_ENTRY.getEndDate()); result.add(entry); } else { result.add(CostRateTableEntry.DEFAULT_ENTRY); } } resource.setCostRateTable(index, result); }
[ "public", "void", "process", "(", "Resource", "resource", ",", "int", "index", ",", "byte", "[", "]", "data", ")", "{", "CostRateTable", "result", "=", "new", "CostRateTable", "(", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "for", "(", "int...
Creates a CostRateTable instance from a block of data. @param resource parent resource @param index cost rate table index @param data data block
[ "Creates", "a", "CostRateTable", "instance", "from", "a", "block", "of", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java#L48-L88
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java
CostRateTableFactory.getFormat
private TimeUnit getFormat(int format) { TimeUnit result; if (format == 0xFFFF) { result = TimeUnit.HOURS; } else { result = MPPUtility.getWorkTimeUnits(format); } return result; }
java
private TimeUnit getFormat(int format) { TimeUnit result; if (format == 0xFFFF) { result = TimeUnit.HOURS; } else { result = MPPUtility.getWorkTimeUnits(format); } return result; }
[ "private", "TimeUnit", "getFormat", "(", "int", "format", ")", "{", "TimeUnit", "result", ";", "if", "(", "format", "==", "0xFFFF", ")", "{", "result", "=", "TimeUnit", ".", "HOURS", ";", "}", "else", "{", "result", "=", "MPPUtility", ".", "getWorkTimeUn...
Converts an integer into a time format. @param format integer format value @return TimeUnit instance
[ "Converts", "an", "integer", "into", "a", "time", "format", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CostRateTableFactory.java#L96-L108
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/ConstraintTypeUtility.java
ConstraintTypeUtility.getInstance
public static ConstraintType getInstance(Locale locale, String type) { int index = 0; String[] constraintTypes = LocaleData.getStringArray(locale, LocaleData.CONSTRAINT_TYPES); for (int loop = 0; loop < constraintTypes.length; loop++) { if (constraintTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } return (ConstraintType.getInstance(index)); }
java
public static ConstraintType getInstance(Locale locale, String type) { int index = 0; String[] constraintTypes = LocaleData.getStringArray(locale, LocaleData.CONSTRAINT_TYPES); for (int loop = 0; loop < constraintTypes.length; loop++) { if (constraintTypes[loop].equalsIgnoreCase(type) == true) { index = loop; break; } } return (ConstraintType.getInstance(index)); }
[ "public", "static", "ConstraintType", "getInstance", "(", "Locale", "locale", ",", "String", "type", ")", "{", "int", "index", "=", "0", ";", "String", "[", "]", "constraintTypes", "=", "LocaleData", ".", "getStringArray", "(", "locale", ",", "LocaleData", "...
This method takes the textual version of a constraint name and returns an appropriate class instance. Note that unrecognised values are treated as "As Soon As Possible" constraints. @param locale target locale @param type text version of the constraint type @return ConstraintType instance
[ "This", "method", "takes", "the", "textual", "version", "of", "a", "constraint", "name", "and", "returns", "an", "appropriate", "class", "instance", ".", "Note", "that", "unrecognised", "values", "are", "treated", "as", "As", "Soon", "As", "Possible", "constra...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ConstraintTypeUtility.java#L53-L68
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.query
private static void query(String filename) throws Exception { ProjectFile mpx = new UniversalProjectReader().read(filename); listProjectProperties(mpx); listResources(mpx); listTasks(mpx); listAssignments(mpx); listAssignmentsByTask(mpx); listAssignmentsByResource(mpx); listHierarchy(mpx); listTaskNotes(mpx); listResourceNotes(mpx); listRelationships(mpx); listSlack(mpx); listCalendars(mpx); }
java
private static void query(String filename) throws Exception { ProjectFile mpx = new UniversalProjectReader().read(filename); listProjectProperties(mpx); listResources(mpx); listTasks(mpx); listAssignments(mpx); listAssignmentsByTask(mpx); listAssignmentsByResource(mpx); listHierarchy(mpx); listTaskNotes(mpx); listResourceNotes(mpx); listRelationships(mpx); listSlack(mpx); listCalendars(mpx); }
[ "private", "static", "void", "query", "(", "String", "filename", ")", "throws", "Exception", "{", "ProjectFile", "mpx", "=", "new", "UniversalProjectReader", "(", ")", ".", "read", "(", "filename", ")", ";", "listProjectProperties", "(", "mpx", ")", ";", "li...
This method performs a set of queries to retrieve information from the an MPP or an MPX file. @param filename name of the MPX file @throws Exception on file read error
[ "This", "method", "performs", "a", "set", "of", "queries", "to", "retrieve", "information", "from", "the", "an", "MPP", "or", "an", "MPX", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L84-L112
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listProjectProperties
private static void listProjectProperties(ProjectFile file) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm z"); ProjectProperties properties = file.getProjectProperties(); Date startDate = properties.getStartDate(); Date finishDate = properties.getFinishDate(); String formattedStartDate = startDate == null ? "(none)" : df.format(startDate); String formattedFinishDate = finishDate == null ? "(none)" : df.format(finishDate); System.out.println("MPP file type: " + properties.getMppFileType()); System.out.println("Project Properties: StartDate=" + formattedStartDate + " FinishDate=" + formattedFinishDate); System.out.println(); }
java
private static void listProjectProperties(ProjectFile file) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm z"); ProjectProperties properties = file.getProjectProperties(); Date startDate = properties.getStartDate(); Date finishDate = properties.getFinishDate(); String formattedStartDate = startDate == null ? "(none)" : df.format(startDate); String formattedFinishDate = finishDate == null ? "(none)" : df.format(finishDate); System.out.println("MPP file type: " + properties.getMppFileType()); System.out.println("Project Properties: StartDate=" + formattedStartDate + " FinishDate=" + formattedFinishDate); System.out.println(); }
[ "private", "static", "void", "listProjectProperties", "(", "ProjectFile", "file", ")", "{", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat", "(", "\"dd/MM/yyyy HH:mm z\"", ")", ";", "ProjectProperties", "properties", "=", "file", ".", "getProjectProperties", ...
Reads basic summary details from the project properties. @param file MPX file
[ "Reads", "basic", "summary", "details", "from", "the", "project", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L119-L131
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listResources
private static void listResources(ProjectFile file) { for (Resource resource : file.getResources()) { System.out.println("Resource: " + resource.getName() + " (Unique ID=" + resource.getUniqueID() + ") Start=" + resource.getStart() + " Finish=" + resource.getFinish()); } System.out.println(); }
java
private static void listResources(ProjectFile file) { for (Resource resource : file.getResources()) { System.out.println("Resource: " + resource.getName() + " (Unique ID=" + resource.getUniqueID() + ") Start=" + resource.getStart() + " Finish=" + resource.getFinish()); } System.out.println(); }
[ "private", "static", "void", "listResources", "(", "ProjectFile", "file", ")", "{", "for", "(", "Resource", "resource", ":", "file", ".", "getResources", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Resource: \"", "+", "resource", ".",...
This method lists all resources defined in the file. @param file MPX file
[ "This", "method", "lists", "all", "resources", "defined", "in", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L138-L145
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listTasks
private static void listTasks(ProjectFile file) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm z"); for (Task task : file.getTasks()) { Date date = task.getStart(); String text = task.getStartText(); String startDate = text != null ? text : (date != null ? df.format(date) : "(no start date supplied)"); date = task.getFinish(); text = task.getFinishText(); String finishDate = text != null ? text : (date != null ? df.format(date) : "(no finish date supplied)"); Duration dur = task.getDuration(); text = task.getDurationText(); String duration = text != null ? text : (dur != null ? dur.toString() : "(no duration supplied)"); dur = task.getActualDuration(); String actualDuration = dur != null ? dur.toString() : "(no actual duration supplied)"; String baselineDuration = task.getBaselineDurationText(); if (baselineDuration == null) { dur = task.getBaselineDuration(); if (dur != null) { baselineDuration = dur.toString(); } else { baselineDuration = "(no duration supplied)"; } } System.out.println("Task: " + task.getName() + " ID=" + task.getID() + " Unique ID=" + task.getUniqueID() + " (Start Date=" + startDate + " Finish Date=" + finishDate + " Duration=" + duration + " Actual Duration" + actualDuration + " Baseline Duration=" + baselineDuration + " Outline Level=" + task.getOutlineLevel() + " Outline Number=" + task.getOutlineNumber() + " Recurring=" + task.getRecurring() + ")"); } System.out.println(); }
java
private static void listTasks(ProjectFile file) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm z"); for (Task task : file.getTasks()) { Date date = task.getStart(); String text = task.getStartText(); String startDate = text != null ? text : (date != null ? df.format(date) : "(no start date supplied)"); date = task.getFinish(); text = task.getFinishText(); String finishDate = text != null ? text : (date != null ? df.format(date) : "(no finish date supplied)"); Duration dur = task.getDuration(); text = task.getDurationText(); String duration = text != null ? text : (dur != null ? dur.toString() : "(no duration supplied)"); dur = task.getActualDuration(); String actualDuration = dur != null ? dur.toString() : "(no actual duration supplied)"; String baselineDuration = task.getBaselineDurationText(); if (baselineDuration == null) { dur = task.getBaselineDuration(); if (dur != null) { baselineDuration = dur.toString(); } else { baselineDuration = "(no duration supplied)"; } } System.out.println("Task: " + task.getName() + " ID=" + task.getID() + " Unique ID=" + task.getUniqueID() + " (Start Date=" + startDate + " Finish Date=" + finishDate + " Duration=" + duration + " Actual Duration" + actualDuration + " Baseline Duration=" + baselineDuration + " Outline Level=" + task.getOutlineLevel() + " Outline Number=" + task.getOutlineNumber() + " Recurring=" + task.getRecurring() + ")"); } System.out.println(); }
[ "private", "static", "void", "listTasks", "(", "ProjectFile", "file", ")", "{", "SimpleDateFormat", "df", "=", "new", "SimpleDateFormat", "(", "\"dd/MM/yyyy HH:mm z\"", ")", ";", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(", ")", ")", "{", ...
This method lists all tasks defined in the file. @param file MPX file
[ "This", "method", "lists", "all", "tasks", "defined", "in", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L152-L190
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listHierarchy
private static void listHierarchy(ProjectFile file) { for (Task task : file.getChildTasks()) { System.out.println("Task: " + task.getName() + "\t" + task.getStart() + "\t" + task.getFinish()); listHierarchy(task, " "); } System.out.println(); }
java
private static void listHierarchy(ProjectFile file) { for (Task task : file.getChildTasks()) { System.out.println("Task: " + task.getName() + "\t" + task.getStart() + "\t" + task.getFinish()); listHierarchy(task, " "); } System.out.println(); }
[ "private", "static", "void", "listHierarchy", "(", "ProjectFile", "file", ")", "{", "for", "(", "Task", "task", ":", "file", ".", "getChildTasks", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Task: \"", "+", "task", ".", "getName", ...
This method lists all tasks defined in the file in a hierarchical format, reflecting the parent-child relationships between them. @param file MPX file
[ "This", "method", "lists", "all", "tasks", "defined", "in", "the", "file", "in", "a", "hierarchical", "format", "reflecting", "the", "parent", "-", "child", "relationships", "between", "them", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L198-L207
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listHierarchy
private static void listHierarchy(Task task, String indent) { for (Task child : task.getChildTasks()) { System.out.println(indent + "Task: " + child.getName() + "\t" + child.getStart() + "\t" + child.getFinish()); listHierarchy(child, indent + " "); } }
java
private static void listHierarchy(Task task, String indent) { for (Task child : task.getChildTasks()) { System.out.println(indent + "Task: " + child.getName() + "\t" + child.getStart() + "\t" + child.getFinish()); listHierarchy(child, indent + " "); } }
[ "private", "static", "void", "listHierarchy", "(", "Task", "task", ",", "String", "indent", ")", "{", "for", "(", "Task", "child", ":", "task", ".", "getChildTasks", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "indent", "+", "\"Task:...
Helper method called recursively to list child tasks. @param task task whose children are to be displayed @param indent whitespace used to indent hierarchy levels
[ "Helper", "method", "called", "recursively", "to", "list", "child", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L215-L222
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listAssignments
private static void listAssignments(ProjectFile file) { Task task; Resource resource; String taskName; String resourceName; for (ResourceAssignment assignment : file.getResourceAssignments()) { task = assignment.getTask(); if (task == null) { taskName = "(null task)"; } else { taskName = task.getName(); } resource = assignment.getResource(); if (resource == null) { resourceName = "(null resource)"; } else { resourceName = resource.getName(); } System.out.println("Assignment: Task=" + taskName + " Resource=" + resourceName); if (task != null) { listTimephasedWork(assignment); } } System.out.println(); }
java
private static void listAssignments(ProjectFile file) { Task task; Resource resource; String taskName; String resourceName; for (ResourceAssignment assignment : file.getResourceAssignments()) { task = assignment.getTask(); if (task == null) { taskName = "(null task)"; } else { taskName = task.getName(); } resource = assignment.getResource(); if (resource == null) { resourceName = "(null resource)"; } else { resourceName = resource.getName(); } System.out.println("Assignment: Task=" + taskName + " Resource=" + resourceName); if (task != null) { listTimephasedWork(assignment); } } System.out.println(); }
[ "private", "static", "void", "listAssignments", "(", "ProjectFile", "file", ")", "{", "Task", "task", ";", "Resource", "resource", ";", "String", "taskName", ";", "String", "resourceName", ";", "for", "(", "ResourceAssignment", "assignment", ":", "file", ".", ...
This method lists all resource assignments defined in the file. @param file MPX file
[ "This", "method", "lists", "all", "resource", "assignments", "defined", "in", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L229-L266
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listTimephasedWork
private static void listTimephasedWork(ResourceAssignment assignment) { Task task = assignment.getTask(); int days = (int) ((task.getFinish().getTime() - task.getStart().getTime()) / (1000 * 60 * 60 * 24)) + 1; if (days > 1) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy"); TimescaleUtility timescale = new TimescaleUtility(); ArrayList<DateRange> dates = timescale.createTimescale(task.getStart(), TimescaleUnits.DAYS, days); TimephasedUtility timephased = new TimephasedUtility(); ArrayList<Duration> durations = timephased.segmentWork(assignment.getCalendar(), assignment.getTimephasedWork(), TimescaleUnits.DAYS, dates); for (DateRange range : dates) { System.out.print(df.format(range.getStart()) + "\t"); } System.out.println(); for (Duration duration : durations) { System.out.print(duration.toString() + " ".substring(0, 7) + "\t"); } System.out.println(); } }
java
private static void listTimephasedWork(ResourceAssignment assignment) { Task task = assignment.getTask(); int days = (int) ((task.getFinish().getTime() - task.getStart().getTime()) / (1000 * 60 * 60 * 24)) + 1; if (days > 1) { SimpleDateFormat df = new SimpleDateFormat("dd/MM/yy"); TimescaleUtility timescale = new TimescaleUtility(); ArrayList<DateRange> dates = timescale.createTimescale(task.getStart(), TimescaleUnits.DAYS, days); TimephasedUtility timephased = new TimephasedUtility(); ArrayList<Duration> durations = timephased.segmentWork(assignment.getCalendar(), assignment.getTimephasedWork(), TimescaleUnits.DAYS, dates); for (DateRange range : dates) { System.out.print(df.format(range.getStart()) + "\t"); } System.out.println(); for (Duration duration : durations) { System.out.print(duration.toString() + " ".substring(0, 7) + "\t"); } System.out.println(); } }
[ "private", "static", "void", "listTimephasedWork", "(", "ResourceAssignment", "assignment", ")", "{", "Task", "task", "=", "assignment", ".", "getTask", "(", ")", ";", "int", "days", "=", "(", "int", ")", "(", "(", "task", ".", "getFinish", "(", ")", "."...
Dump timephased work for an assignment. @param assignment resource assignment
[ "Dump", "timephased", "work", "for", "an", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L273-L297
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listAssignmentsByTask
private static void listAssignmentsByTask(ProjectFile file) { for (Task task : file.getTasks()) { System.out.println("Assignments for task " + task.getName() + ":"); for (ResourceAssignment assignment : task.getResourceAssignments()) { Resource resource = assignment.getResource(); String resourceName; if (resource == null) { resourceName = "(null resource)"; } else { resourceName = resource.getName(); } System.out.println(" " + resourceName); } } System.out.println(); }
java
private static void listAssignmentsByTask(ProjectFile file) { for (Task task : file.getTasks()) { System.out.println("Assignments for task " + task.getName() + ":"); for (ResourceAssignment assignment : task.getResourceAssignments()) { Resource resource = assignment.getResource(); String resourceName; if (resource == null) { resourceName = "(null resource)"; } else { resourceName = resource.getName(); } System.out.println(" " + resourceName); } } System.out.println(); }
[ "private", "static", "void", "listAssignmentsByTask", "(", "ProjectFile", "file", ")", "{", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Assignments for task \"", "+", "task", "...
This method displays the resource assignments for each task. This time rather than just iterating through the list of all assignments in the file, we extract the assignments on a task-by-task basis. @param file MPX file
[ "This", "method", "displays", "the", "resource", "assignments", "for", "each", "task", ".", "This", "time", "rather", "than", "just", "iterating", "through", "the", "list", "of", "all", "assignments", "in", "the", "file", "we", "extract", "the", "assignments",...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L306-L331
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listAssignmentsByResource
private static void listAssignmentsByResource(ProjectFile file) { for (Resource resource : file.getResources()) { System.out.println("Assignments for resource " + resource.getName() + ":"); for (ResourceAssignment assignment : resource.getTaskAssignments()) { Task task = assignment.getTask(); System.out.println(" " + task.getName()); } } System.out.println(); }
java
private static void listAssignmentsByResource(ProjectFile file) { for (Resource resource : file.getResources()) { System.out.println("Assignments for resource " + resource.getName() + ":"); for (ResourceAssignment assignment : resource.getTaskAssignments()) { Task task = assignment.getTask(); System.out.println(" " + task.getName()); } } System.out.println(); }
[ "private", "static", "void", "listAssignmentsByResource", "(", "ProjectFile", "file", ")", "{", "for", "(", "Resource", "resource", ":", "file", ".", "getResources", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\"Assignments for resource \"", ...
This method displays the resource assignments for each resource. This time rather than just iterating through the list of all assignments in the file, we extract the assignments on a resource-by-resource basis. @param file MPX file
[ "This", "method", "displays", "the", "resource", "assignments", "for", "each", "resource", ".", "This", "time", "rather", "than", "just", "iterating", "through", "the", "list", "of", "all", "assignments", "in", "the", "file", "we", "extract", "the", "assignmen...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L340-L354
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listTaskNotes
private static void listTaskNotes(ProjectFile file) { for (Task task : file.getTasks()) { String notes = task.getNotes(); if (notes.length() != 0) { System.out.println("Notes for " + task.getName() + ": " + notes); } } System.out.println(); }
java
private static void listTaskNotes(ProjectFile file) { for (Task task : file.getTasks()) { String notes = task.getNotes(); if (notes.length() != 0) { System.out.println("Notes for " + task.getName() + ": " + notes); } } System.out.println(); }
[ "private", "static", "void", "listTaskNotes", "(", "ProjectFile", "file", ")", "{", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(", ")", ")", "{", "String", "notes", "=", "task", ".", "getNotes", "(", ")", ";", "if", "(", "notes", ".",...
This method lists any notes attached to tasks. @param file MPX file
[ "This", "method", "lists", "any", "notes", "attached", "to", "tasks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L361-L374
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listResourceNotes
private static void listResourceNotes(ProjectFile file) { for (Resource resource : file.getResources()) { String notes = resource.getNotes(); if (notes.length() != 0) { System.out.println("Notes for " + resource.getName() + ": " + notes); } } System.out.println(); }
java
private static void listResourceNotes(ProjectFile file) { for (Resource resource : file.getResources()) { String notes = resource.getNotes(); if (notes.length() != 0) { System.out.println("Notes for " + resource.getName() + ": " + notes); } } System.out.println(); }
[ "private", "static", "void", "listResourceNotes", "(", "ProjectFile", "file", ")", "{", "for", "(", "Resource", "resource", ":", "file", ".", "getResources", "(", ")", ")", "{", "String", "notes", "=", "resource", ".", "getNotes", "(", ")", ";", "if", "(...
This method lists any notes attached to resources. @param file MPX file
[ "This", "method", "lists", "any", "notes", "attached", "to", "resources", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L381-L394
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listRelationships
private static void listRelationships(ProjectFile file) { for (Task task : file.getTasks()) { System.out.print(task.getID()); System.out.print('\t'); System.out.print(task.getName()); System.out.print('\t'); dumpRelationList(task.getPredecessors()); System.out.print('\t'); dumpRelationList(task.getSuccessors()); System.out.println(); } }
java
private static void listRelationships(ProjectFile file) { for (Task task : file.getTasks()) { System.out.print(task.getID()); System.out.print('\t'); System.out.print(task.getName()); System.out.print('\t'); dumpRelationList(task.getPredecessors()); System.out.print('\t'); dumpRelationList(task.getSuccessors()); System.out.println(); } }
[ "private", "static", "void", "listRelationships", "(", "ProjectFile", "file", ")", "{", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(", ")", ")", "{", "System", ".", "out", ".", "print", "(", "task", ".", "getID", "(", ")", ")", ";", ...
This method lists task predecessor and successor relationships. @param file project file
[ "This", "method", "lists", "task", "predecessor", "and", "successor", "relationships", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L401-L415
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.dumpRelationList
private static void dumpRelationList(List<Relation> relations) { if (relations != null && relations.isEmpty() == false) { if (relations.size() > 1) { System.out.print('"'); } boolean first = true; for (Relation relation : relations) { if (!first) { System.out.print(','); } first = false; System.out.print(relation.getTargetTask().getID()); Duration lag = relation.getLag(); if (relation.getType() != RelationType.FINISH_START || lag.getDuration() != 0) { System.out.print(relation.getType()); } if (lag.getDuration() != 0) { if (lag.getDuration() > 0) { System.out.print("+"); } System.out.print(lag); } } if (relations.size() > 1) { System.out.print('"'); } } }
java
private static void dumpRelationList(List<Relation> relations) { if (relations != null && relations.isEmpty() == false) { if (relations.size() > 1) { System.out.print('"'); } boolean first = true; for (Relation relation : relations) { if (!first) { System.out.print(','); } first = false; System.out.print(relation.getTargetTask().getID()); Duration lag = relation.getLag(); if (relation.getType() != RelationType.FINISH_START || lag.getDuration() != 0) { System.out.print(relation.getType()); } if (lag.getDuration() != 0) { if (lag.getDuration() > 0) { System.out.print("+"); } System.out.print(lag); } } if (relations.size() > 1) { System.out.print('"'); } } }
[ "private", "static", "void", "dumpRelationList", "(", "List", "<", "Relation", ">", "relations", ")", "{", "if", "(", "relations", "!=", "null", "&&", "relations", ".", "isEmpty", "(", ")", "==", "false", ")", "{", "if", "(", "relations", ".", "size", ...
Internal utility to dump relationship lists in a structured format that can easily be compared with the tabular data in MS Project. @param relations relation list
[ "Internal", "utility", "to", "dump", "relationship", "lists", "in", "a", "structured", "format", "that", "can", "easily", "be", "compared", "with", "the", "tabular", "data", "in", "MS", "Project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L423-L460
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listSlack
private static void listSlack(ProjectFile file) { for (Task task : file.getTasks()) { System.out.println(task.getName() + " Total Slack=" + task.getTotalSlack() + " Start Slack=" + task.getStartSlack() + " Finish Slack=" + task.getFinishSlack()); } }
java
private static void listSlack(ProjectFile file) { for (Task task : file.getTasks()) { System.out.println(task.getName() + " Total Slack=" + task.getTotalSlack() + " Start Slack=" + task.getStartSlack() + " Finish Slack=" + task.getFinishSlack()); } }
[ "private", "static", "void", "listSlack", "(", "ProjectFile", "file", ")", "{", "for", "(", "Task", "task", ":", "file", ".", "getTasks", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "task", ".", "getName", "(", ")", "+", "\" Total ...
List the slack values for each task. @param file ProjectFile instance
[ "List", "the", "slack", "values", "for", "each", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L467-L473
train
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjQuery.java
MpxjQuery.listCalendars
private static void listCalendars(ProjectFile file) { for (ProjectCalendar cal : file.getCalendars()) { System.out.println(cal.toString()); } }
java
private static void listCalendars(ProjectFile file) { for (ProjectCalendar cal : file.getCalendars()) { System.out.println(cal.toString()); } }
[ "private", "static", "void", "listCalendars", "(", "ProjectFile", "file", ")", "{", "for", "(", "ProjectCalendar", "cal", ":", "file", ".", "getCalendars", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "cal", ".", "toString", "(", ")", ...
List details of all calendars in the file. @param file ProjectFile instance
[ "List", "details", "of", "all", "calendars", "in", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L480-L486
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarContainer.java
ProjectCalendarContainer.addDefaultBaseCalendar
public ProjectCalendar addDefaultBaseCalendar() { ProjectCalendar calendar = add(); calendar.setName(ProjectCalendar.DEFAULT_BASE_CALENDAR_NAME); calendar.setWorkingDay(Day.SUNDAY, false); calendar.setWorkingDay(Day.MONDAY, true); calendar.setWorkingDay(Day.TUESDAY, true); calendar.setWorkingDay(Day.WEDNESDAY, true); calendar.setWorkingDay(Day.THURSDAY, true); calendar.setWorkingDay(Day.FRIDAY, true); calendar.setWorkingDay(Day.SATURDAY, false); calendar.addDefaultCalendarHours(); return (calendar); }
java
public ProjectCalendar addDefaultBaseCalendar() { ProjectCalendar calendar = add(); calendar.setName(ProjectCalendar.DEFAULT_BASE_CALENDAR_NAME); calendar.setWorkingDay(Day.SUNDAY, false); calendar.setWorkingDay(Day.MONDAY, true); calendar.setWorkingDay(Day.TUESDAY, true); calendar.setWorkingDay(Day.WEDNESDAY, true); calendar.setWorkingDay(Day.THURSDAY, true); calendar.setWorkingDay(Day.FRIDAY, true); calendar.setWorkingDay(Day.SATURDAY, false); calendar.addDefaultCalendarHours(); return (calendar); }
[ "public", "ProjectCalendar", "addDefaultBaseCalendar", "(", ")", "{", "ProjectCalendar", "calendar", "=", "add", "(", ")", ";", "calendar", ".", "setName", "(", "ProjectCalendar", ".", "DEFAULT_BASE_CALENDAR_NAME", ")", ";", "calendar", ".", "setWorkingDay", "(", ...
This is a convenience method used to add a calendar called "Standard" to the project, and populate it with a default working week and default working hours. @return a new default calendar
[ "This", "is", "a", "convenience", "method", "used", "to", "add", "a", "calendar", "called", "Standard", "to", "the", "project", "and", "populate", "it", "with", "a", "default", "working", "week", "and", "default", "working", "hours", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarContainer.java#L73-L90
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarContainer.java
ProjectCalendarContainer.addDefaultDerivedCalendar
public ProjectCalendar addDefaultDerivedCalendar() { ProjectCalendar calendar = add(); calendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); return (calendar); }
java
public ProjectCalendar addDefaultDerivedCalendar() { ProjectCalendar calendar = add(); calendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); calendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); return (calendar); }
[ "public", "ProjectCalendar", "addDefaultDerivedCalendar", "(", ")", "{", "ProjectCalendar", "calendar", "=", "add", "(", ")", ";", "calendar", ".", "setWorkingDay", "(", "Day", ".", "SUNDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "calendar", ".", "setWorki...
This is a convenience method to add a default derived calendar to the project. @return new ProjectCalendar instance
[ "This", "is", "a", "convenience", "method", "to", "add", "a", "default", "derived", "calendar", "to", "the", "project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarContainer.java#L98-L111
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarContainer.java
ProjectCalendarContainer.getByName
public ProjectCalendar getByName(String calendarName) { ProjectCalendar calendar = null; if (calendarName != null && calendarName.length() != 0) { Iterator<ProjectCalendar> iter = iterator(); while (iter.hasNext() == true) { calendar = iter.next(); String name = calendar.getName(); if ((name != null) && (name.equalsIgnoreCase(calendarName) == true)) { break; } calendar = null; } } return (calendar); }
java
public ProjectCalendar getByName(String calendarName) { ProjectCalendar calendar = null; if (calendarName != null && calendarName.length() != 0) { Iterator<ProjectCalendar> iter = iterator(); while (iter.hasNext() == true) { calendar = iter.next(); String name = calendar.getName(); if ((name != null) && (name.equalsIgnoreCase(calendarName) == true)) { break; } calendar = null; } } return (calendar); }
[ "public", "ProjectCalendar", "getByName", "(", "String", "calendarName", ")", "{", "ProjectCalendar", "calendar", "=", "null", ";", "if", "(", "calendarName", "!=", "null", "&&", "calendarName", ".", "length", "(", ")", "!=", "0", ")", "{", "Iterator", "<", ...
Retrieves the named calendar. This method will return null if the named calendar is not located. @param calendarName name of the required calendar @return ProjectCalendar instance
[ "Retrieves", "the", "named", "calendar", ".", "This", "method", "will", "return", "null", "if", "the", "named", "calendar", "is", "not", "located", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarContainer.java#L120-L142
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPDDatabaseReader.java
MPDDatabaseReader.read
public ProjectFile read() throws MPXJException { MPD9DatabaseReader reader = new MPD9DatabaseReader(); reader.setProjectID(m_projectID); reader.setPreserveNoteFormatting(m_preserveNoteFormatting); reader.setDataSource(m_dataSource); reader.setConnection(m_connection); ProjectFile project = reader.read(); return (project); }
java
public ProjectFile read() throws MPXJException { MPD9DatabaseReader reader = new MPD9DatabaseReader(); reader.setProjectID(m_projectID); reader.setPreserveNoteFormatting(m_preserveNoteFormatting); reader.setDataSource(m_dataSource); reader.setConnection(m_connection); ProjectFile project = reader.read(); return (project); }
[ "public", "ProjectFile", "read", "(", ")", "throws", "MPXJException", "{", "MPD9DatabaseReader", "reader", "=", "new", "MPD9DatabaseReader", "(", ")", ";", "reader", ".", "setProjectID", "(", "m_projectID", ")", ";", "reader", ".", "setPreserveNoteFormatting", "("...
Read project data from a database. @return ProjectFile instance @throws MPXJException
[ "Read", "project", "data", "from", "a", "database", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDDatabaseReader.java#L79-L88
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPDDatabaseReader.java
MPDDatabaseReader.read
@Override public ProjectFile read(String accessDatabaseFileName) throws MPXJException { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + accessDatabaseFileName; m_connection = DriverManager.getConnection(url); m_projectID = Integer.valueOf(1); return (read()); } catch (ClassNotFoundException ex) { throw new MPXJException("Failed to load JDBC driver", ex); } catch (SQLException ex) { throw new MPXJException("Failed to create connection", ex); } finally { if (m_connection != null) { try { m_connection.close(); } catch (SQLException ex) { // silently ignore exceptions when closing connection } } } }
java
@Override public ProjectFile read(String accessDatabaseFileName) throws MPXJException { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String url = "jdbc:odbc:DRIVER=Microsoft Access Driver (*.mdb);DBQ=" + accessDatabaseFileName; m_connection = DriverManager.getConnection(url); m_projectID = Integer.valueOf(1); return (read()); } catch (ClassNotFoundException ex) { throw new MPXJException("Failed to load JDBC driver", ex); } catch (SQLException ex) { throw new MPXJException("Failed to create connection", ex); } finally { if (m_connection != null) { try { m_connection.close(); } catch (SQLException ex) { // silently ignore exceptions when closing connection } } } }
[ "@", "Override", "public", "ProjectFile", "read", "(", "String", "accessDatabaseFileName", ")", "throws", "MPXJException", "{", "try", "{", "Class", ".", "forName", "(", "\"sun.jdbc.odbc.JdbcOdbcDriver\"", ")", ";", "String", "url", "=", "\"jdbc:odbc:DRIVER=Microsoft ...
This is a convenience method which reads the first project from the named MPD file using the JDBC-ODBC bridge driver. @param accessDatabaseFileName access database file name @return ProjectFile instance @throws MPXJException
[ "This", "is", "a", "convenience", "method", "which", "reads", "the", "first", "project", "from", "the", "named", "MPD", "file", "using", "the", "JDBC", "-", "ODBC", "bridge", "driver", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDDatabaseReader.java#L142-L178
train
joniles/mpxj
src/main/java/net/sf/mpxj/writer/ProjectWriterUtility.java
ProjectWriterUtility.getProjectWriter
public static ProjectWriter getProjectWriter(String name) throws InstantiationException, IllegalAccessException { int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot write files of type: " + name); } ProjectWriter file = fileClass.newInstance(); return (file); }
java
public static ProjectWriter getProjectWriter(String name) throws InstantiationException, IllegalAccessException { int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectWriter> fileClass = WRITER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot write files of type: " + name); } ProjectWriter file = fileClass.newInstance(); return (file); }
[ "public", "static", "ProjectWriter", "getProjectWriter", "(", "String", "name", ")", "throws", "InstantiationException", ",", "IllegalAccessException", "{", "int", "index", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-"...
Retrieves a ProjectWriter instance which can write a file of the type specified by the supplied file name. @param name file name @return ProjectWriter instance
[ "Retrieves", "a", "ProjectWriter", "instance", "which", "can", "write", "a", "file", "of", "the", "type", "specified", "by", "the", "supplied", "file", "name", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/writer/ProjectWriterUtility.java#L57-L76
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.processCustomFieldValues
private void processCustomFieldValues() { byte[] data = m_projectProps.getByteArray(Props.TASK_FIELD_ATTRIBUTES); if (data != null) { int index = 0; int offset = 0; // First the length int length = MPPUtility.getInt(data, offset); offset += 4; // Then the number of custom value lists int numberOfValueLists = MPPUtility.getInt(data, offset); offset += 4; // Then the value lists themselves FieldType field; int valueListOffset = 0; while (index < numberOfValueLists && offset < length) { // Each item consists of the Field ID (4 bytes) and the offset to the value list (4 bytes) // Get the Field field = FieldTypeHelper.getInstance(MPPUtility.getInt(data, offset)); offset += 4; // Get the value list offset valueListOffset = MPPUtility.getInt(data, offset); offset += 4; // Read the value list itself if (valueListOffset < data.length) { int tempOffset = valueListOffset; tempOffset += 8; // Get the data offset int dataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; tempOffset += 4; // Get the end of the data offset int endDataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; tempOffset += 4; // Get the end of the description int endDescriptionOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; // Get the values themselves int valuesLength = endDataOffset - dataOffset; byte[] values = new byte[valuesLength]; MPPUtility.getByteArray(data, dataOffset, valuesLength, values, 0); // Get the descriptions int descriptionsLength = endDescriptionOffset - endDataOffset; byte[] descriptions = new byte[descriptionsLength]; MPPUtility.getByteArray(data, endDataOffset, descriptionsLength, descriptions, 0); populateContainer(field, values, descriptions); } index++; } } }
java
private void processCustomFieldValues() { byte[] data = m_projectProps.getByteArray(Props.TASK_FIELD_ATTRIBUTES); if (data != null) { int index = 0; int offset = 0; // First the length int length = MPPUtility.getInt(data, offset); offset += 4; // Then the number of custom value lists int numberOfValueLists = MPPUtility.getInt(data, offset); offset += 4; // Then the value lists themselves FieldType field; int valueListOffset = 0; while (index < numberOfValueLists && offset < length) { // Each item consists of the Field ID (4 bytes) and the offset to the value list (4 bytes) // Get the Field field = FieldTypeHelper.getInstance(MPPUtility.getInt(data, offset)); offset += 4; // Get the value list offset valueListOffset = MPPUtility.getInt(data, offset); offset += 4; // Read the value list itself if (valueListOffset < data.length) { int tempOffset = valueListOffset; tempOffset += 8; // Get the data offset int dataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; tempOffset += 4; // Get the end of the data offset int endDataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; tempOffset += 4; // Get the end of the description int endDescriptionOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset; // Get the values themselves int valuesLength = endDataOffset - dataOffset; byte[] values = new byte[valuesLength]; MPPUtility.getByteArray(data, dataOffset, valuesLength, values, 0); // Get the descriptions int descriptionsLength = endDescriptionOffset - endDataOffset; byte[] descriptions = new byte[descriptionsLength]; MPPUtility.getByteArray(data, endDataOffset, descriptionsLength, descriptions, 0); populateContainer(field, values, descriptions); } index++; } } }
[ "private", "void", "processCustomFieldValues", "(", ")", "{", "byte", "[", "]", "data", "=", "m_projectProps", ".", "getByteArray", "(", "Props", ".", "TASK_FIELD_ATTRIBUTES", ")", ";", "if", "(", "data", "!=", "null", ")", "{", "int", "index", "=", "0", ...
Reads non outline code custom field values and populates container.
[ "Reads", "non", "outline", "code", "custom", "field", "values", "and", "populates", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L83-L140
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.processOutlineCodeValues
private void processOutlineCodeValues() throws IOException { DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode"); FixedMeta fm = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedMeta"))), 10); FixedData fd = new FixedData(fm, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedData")))); Map<Integer, FieldType> map = new HashMap<Integer, FieldType>(); int items = fm.getItemCount(); for (int loop = 0; loop < items; loop++) { byte[] data = fd.getByteArrayValue(loop); if (data.length < 18) { continue; } int index = MPPUtility.getShort(data, 0); int fieldID = MPPUtility.getInt(data, 12); FieldType fieldType = FieldTypeHelper.getInstance(fieldID); if (fieldType.getFieldTypeClass() != FieldTypeClass.UNKNOWN) { map.put(Integer.valueOf(index), fieldType); } } VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta")))); Var2Data outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data")))); Map<FieldType, List<Pair<String, String>>> valueMap = new HashMap<FieldType, List<Pair<String, String>>>(); for (Integer id : outlineCodeVarMeta.getUniqueIdentifierArray()) { FieldType fieldType = map.get(id); String value = outlineCodeVarData.getUnicodeString(id, VALUE); String description = outlineCodeVarData.getUnicodeString(id, DESCRIPTION); List<Pair<String, String>> list = valueMap.get(fieldType); if (list == null) { list = new ArrayList<Pair<String, String>>(); valueMap.put(fieldType, list); } list.add(new Pair<String, String>(value, description)); } for (Entry<FieldType, List<Pair<String, String>>> entry : valueMap.entrySet()) { populateContainer(entry.getKey(), entry.getValue()); } }
java
private void processOutlineCodeValues() throws IOException { DirectoryEntry outlineCodeDir = (DirectoryEntry) m_projectDir.getEntry("TBkndOutlCode"); FixedMeta fm = new FixedMeta(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedMeta"))), 10); FixedData fd = new FixedData(fm, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("FixedData")))); Map<Integer, FieldType> map = new HashMap<Integer, FieldType>(); int items = fm.getItemCount(); for (int loop = 0; loop < items; loop++) { byte[] data = fd.getByteArrayValue(loop); if (data.length < 18) { continue; } int index = MPPUtility.getShort(data, 0); int fieldID = MPPUtility.getInt(data, 12); FieldType fieldType = FieldTypeHelper.getInstance(fieldID); if (fieldType.getFieldTypeClass() != FieldTypeClass.UNKNOWN) { map.put(Integer.valueOf(index), fieldType); } } VarMeta outlineCodeVarMeta = new VarMeta9(new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("VarMeta")))); Var2Data outlineCodeVarData = new Var2Data(outlineCodeVarMeta, new DocumentInputStream(((DocumentEntry) outlineCodeDir.getEntry("Var2Data")))); Map<FieldType, List<Pair<String, String>>> valueMap = new HashMap<FieldType, List<Pair<String, String>>>(); for (Integer id : outlineCodeVarMeta.getUniqueIdentifierArray()) { FieldType fieldType = map.get(id); String value = outlineCodeVarData.getUnicodeString(id, VALUE); String description = outlineCodeVarData.getUnicodeString(id, DESCRIPTION); List<Pair<String, String>> list = valueMap.get(fieldType); if (list == null) { list = new ArrayList<Pair<String, String>>(); valueMap.put(fieldType, list); } list.add(new Pair<String, String>(value, description)); } for (Entry<FieldType, List<Pair<String, String>>> entry : valueMap.entrySet()) { populateContainer(entry.getKey(), entry.getValue()); } }
[ "private", "void", "processOutlineCodeValues", "(", ")", "throws", "IOException", "{", "DirectoryEntry", "outlineCodeDir", "=", "(", "DirectoryEntry", ")", "m_projectDir", ".", "getEntry", "(", "\"TBkndOutlCode\"", ")", ";", "FixedMeta", "fm", "=", "new", "FixedMeta...
Reads outline code custom field values and populates container.
[ "Reads", "outline", "code", "custom", "field", "values", "and", "populates", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L145-L195
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.populateContainer
private void populateContainer(FieldType field, byte[] values, byte[] descriptions) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); List<Object> descriptionList = convertType(DataType.STRING, descriptions); List<Object> valueList = convertType(field.getDataType(), values); for (int index = 0; index < descriptionList.size(); index++) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setDescription((String) descriptionList.get(index)); if (index < valueList.size()) { item.setValue(valueList.get(index)); } table.add(item); } }
java
private void populateContainer(FieldType field, byte[] values, byte[] descriptions) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); List<Object> descriptionList = convertType(DataType.STRING, descriptions); List<Object> valueList = convertType(field.getDataType(), values); for (int index = 0; index < descriptionList.size(); index++) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setDescription((String) descriptionList.get(index)); if (index < valueList.size()) { item.setValue(valueList.get(index)); } table.add(item); } }
[ "private", "void", "populateContainer", "(", "FieldType", "field", ",", "byte", "[", "]", "values", ",", "byte", "[", "]", "descriptions", ")", "{", "CustomField", "config", "=", "m_container", ".", "getCustomField", "(", "field", ")", ";", "CustomFieldLookupT...
Populate the container, converting raw data into Java types. @param field custom field to which these values belong @param values raw value data @param descriptions raw description data
[ "Populate", "the", "container", "converting", "raw", "data", "into", "Java", "types", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L204-L221
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.populateContainer
private void populateContainer(FieldType field, List<Pair<String, String>> items) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); for (Pair<String, String> pair : items) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setValue(pair.getFirst()); item.setDescription(pair.getSecond()); table.add(item); } }
java
private void populateContainer(FieldType field, List<Pair<String, String>> items) { CustomField config = m_container.getCustomField(field); CustomFieldLookupTable table = config.getLookupTable(); for (Pair<String, String> pair : items) { CustomFieldValueItem item = new CustomFieldValueItem(Integer.valueOf(0)); item.setValue(pair.getFirst()); item.setDescription(pair.getSecond()); table.add(item); } }
[ "private", "void", "populateContainer", "(", "FieldType", "field", ",", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "items", ")", "{", "CustomField", "config", "=", "m_container", ".", "getCustomField", "(", "field", ")", ";", "CustomFieldLo...
Populate the container from outline code data. @param field field type @param items pairs of values and descriptions
[ "Populate", "the", "container", "from", "outline", "code", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L229-L241
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java
CustomFieldValueReader9.convertType
private List<Object> convertType(DataType type, byte[] data) { List<Object> result = new ArrayList<Object>(); int index = 0; while (index < data.length) { switch (type) { case STRING: { String value = MPPUtility.getUnicodeString(data, index); result.add(value); index += ((value.length() + 1) * 2); break; } case CURRENCY: { Double value = Double.valueOf(MPPUtility.getDouble(data, index) / 100); result.add(value); index += 8; break; } case NUMERIC: { Double value = Double.valueOf(MPPUtility.getDouble(data, index)); result.add(value); index += 8; break; } case DATE: { Date value = MPPUtility.getTimestamp(data, index); result.add(value); index += 4; break; } case DURATION: { TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, index + 4), m_properties.getDefaultDurationUnits()); Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(data, index), units); result.add(value); index += 6; break; } case BOOLEAN: { Boolean value = Boolean.valueOf(MPPUtility.getShort(data, index) == 1); result.add(value); index += 2; break; } default: { index = data.length; break; } } } return result; }
java
private List<Object> convertType(DataType type, byte[] data) { List<Object> result = new ArrayList<Object>(); int index = 0; while (index < data.length) { switch (type) { case STRING: { String value = MPPUtility.getUnicodeString(data, index); result.add(value); index += ((value.length() + 1) * 2); break; } case CURRENCY: { Double value = Double.valueOf(MPPUtility.getDouble(data, index) / 100); result.add(value); index += 8; break; } case NUMERIC: { Double value = Double.valueOf(MPPUtility.getDouble(data, index)); result.add(value); index += 8; break; } case DATE: { Date value = MPPUtility.getTimestamp(data, index); result.add(value); index += 4; break; } case DURATION: { TimeUnit units = MPPUtility.getDurationTimeUnits(MPPUtility.getShort(data, index + 4), m_properties.getDefaultDurationUnits()); Duration value = MPPUtility.getAdjustedDuration(m_properties, MPPUtility.getInt(data, index), units); result.add(value); index += 6; break; } case BOOLEAN: { Boolean value = Boolean.valueOf(MPPUtility.getShort(data, index) == 1); result.add(value); index += 2; break; } default: { index = data.length; break; } } } return result; }
[ "private", "List", "<", "Object", ">", "convertType", "(", "DataType", "type", ",", "byte", "[", "]", "data", ")", "{", "List", "<", "Object", ">", "result", "=", "new", "ArrayList", "<", "Object", ">", "(", ")", ";", "int", "index", "=", "0", ";",...
Convert raw data into Java types. @param type data type @param data raw data @return list of Java object
[ "Convert", "raw", "data", "into", "Java", "types", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/CustomFieldValueReader9.java#L250-L318
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/MapRow.java
MapRow.getBoolean
public boolean getBoolean(FastTrackField type) { boolean result = false; Object value = getObject(type); if (value != null) { result = BooleanHelper.getBoolean((Boolean) value); } return result; }
java
public boolean getBoolean(FastTrackField type) { boolean result = false; Object value = getObject(type); if (value != null) { result = BooleanHelper.getBoolean((Boolean) value); } return result; }
[ "public", "boolean", "getBoolean", "(", "FastTrackField", "type", ")", "{", "boolean", "result", "=", "false", ";", "Object", "value", "=", "getObject", "(", "type", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "result", "=", "BooleanHelper", "....
Retrieve a boolean field. @param type field type @return field data
[ "Retrieve", "a", "boolean", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L103-L112
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/MapRow.java
MapRow.getTimestamp
public Date getTimestamp(FastTrackField dateName, FastTrackField timeName) { Date result = null; Date date = getDate(dateName); if (date != null) { Calendar dateCal = DateHelper.popCalendar(date); Date time = getDate(timeName); if (time != null) { Calendar timeCal = DateHelper.popCalendar(time); dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY)); dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE)); dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND)); dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND)); DateHelper.pushCalendar(timeCal); } result = dateCal.getTime(); DateHelper.pushCalendar(dateCal); } return result; }
java
public Date getTimestamp(FastTrackField dateName, FastTrackField timeName) { Date result = null; Date date = getDate(dateName); if (date != null) { Calendar dateCal = DateHelper.popCalendar(date); Date time = getDate(timeName); if (time != null) { Calendar timeCal = DateHelper.popCalendar(time); dateCal.set(Calendar.HOUR_OF_DAY, timeCal.get(Calendar.HOUR_OF_DAY)); dateCal.set(Calendar.MINUTE, timeCal.get(Calendar.MINUTE)); dateCal.set(Calendar.SECOND, timeCal.get(Calendar.SECOND)); dateCal.set(Calendar.MILLISECOND, timeCal.get(Calendar.MILLISECOND)); DateHelper.pushCalendar(timeCal); } result = dateCal.getTime(); DateHelper.pushCalendar(dateCal); } return result; }
[ "public", "Date", "getTimestamp", "(", "FastTrackField", "dateName", ",", "FastTrackField", "timeName", ")", "{", "Date", "result", "=", "null", ";", "Date", "date", "=", "getDate", "(", "dateName", ")", ";", "if", "(", "date", "!=", "null", ")", "{", "C...
Retrieve a timestamp field. @param dateName field containing the date component @param timeName field containing the time component @return Date instance
[ "Retrieve", "a", "timestamp", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L132-L155
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/MapRow.java
MapRow.getDuration
public Duration getDuration(FastTrackField type) { Double value = (Double) getObject(type); return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getDurationTimeUnit()); }
java
public Duration getDuration(FastTrackField type) { Double value = (Double) getObject(type); return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getDurationTimeUnit()); }
[ "public", "Duration", "getDuration", "(", "FastTrackField", "type", ")", "{", "Double", "value", "=", "(", "Double", ")", "getObject", "(", "type", ")", ";", "return", "value", "==", "null", "?", "null", ":", "Duration", ".", "getInstance", "(", "value", ...
Retrieve a duration field. @param type field type @return Duration instance
[ "Retrieve", "a", "duration", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L174-L178
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/MapRow.java
MapRow.getWork
public Duration getWork(FastTrackField type) { Double value = (Double) getObject(type); return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getWorkTimeUnit()); }
java
public Duration getWork(FastTrackField type) { Double value = (Double) getObject(type); return value == null ? null : Duration.getInstance(value.doubleValue(), m_table.getWorkTimeUnit()); }
[ "public", "Duration", "getWork", "(", "FastTrackField", "type", ")", "{", "Double", "value", "=", "(", "Double", ")", "getObject", "(", "type", ")", ";", "return", "value", "==", "null", "?", "null", ":", "Duration", ".", "getInstance", "(", "value", "."...
Retrieve a work field. @param type field type @return Duration instance
[ "Retrieve", "a", "work", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L186-L190
train
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/MapRow.java
MapRow.getUUID
public UUID getUUID(FastTrackField type) { String value = getString(type); UUID result = null; if (value != null && !value.isEmpty() && value.length() >= 36) { if (value.startsWith("{")) { value = value.substring(1, value.length() - 1); } if (value.length() > 16) { value = value.substring(0, 36); } result = UUID.fromString(value); } return result; }
java
public UUID getUUID(FastTrackField type) { String value = getString(type); UUID result = null; if (value != null && !value.isEmpty() && value.length() >= 36) { if (value.startsWith("{")) { value = value.substring(1, value.length() - 1); } if (value.length() > 16) { value = value.substring(0, 36); } result = UUID.fromString(value); } return result; }
[ "public", "UUID", "getUUID", "(", "FastTrackField", "type", ")", "{", "String", "value", "=", "getString", "(", "type", ")", ";", "UUID", "result", "=", "null", ";", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", "&&"...
Retrieve a UUID field. @param type field type @return UUID instance
[ "Retrieve", "a", "UUID", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/MapRow.java#L210-L227
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPDUtility.java
MPDUtility.getSymbolPosition
public static CurrencySymbolPosition getSymbolPosition(int value) { CurrencySymbolPosition result; switch (value) { case 1: { result = CurrencySymbolPosition.AFTER; break; } case 2: { result = CurrencySymbolPosition.BEFORE_WITH_SPACE; break; } case 3: { result = CurrencySymbolPosition.AFTER_WITH_SPACE; break; } case 0: default: { result = CurrencySymbolPosition.BEFORE; break; } } return (result); }
java
public static CurrencySymbolPosition getSymbolPosition(int value) { CurrencySymbolPosition result; switch (value) { case 1: { result = CurrencySymbolPosition.AFTER; break; } case 2: { result = CurrencySymbolPosition.BEFORE_WITH_SPACE; break; } case 3: { result = CurrencySymbolPosition.AFTER_WITH_SPACE; break; } case 0: default: { result = CurrencySymbolPosition.BEFORE; break; } } return (result); }
[ "public", "static", "CurrencySymbolPosition", "getSymbolPosition", "(", "int", "value", ")", "{", "CurrencySymbolPosition", "result", ";", "switch", "(", "value", ")", "{", "case", "1", ":", "{", "result", "=", "CurrencySymbolPosition", ".", "AFTER", ";", "break...
This method maps the currency symbol position from the representation used in the MPP file to the representation used by MPX. @param value MPP symbol position @return MPX symbol position
[ "This", "method", "maps", "the", "currency", "symbol", "position", "from", "the", "representation", "used", "in", "the", "MPP", "file", "to", "the", "representation", "used", "by", "MPX", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDUtility.java#L52-L85
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPDUtility.java
MPDUtility.getDuration
public static final Duration getDuration(double value, TimeUnit type) { double duration; // Value is given in 1/10 of minute switch (type) { case MINUTES: case ELAPSED_MINUTES: { duration = value / 10; break; } case HOURS: case ELAPSED_HOURS: { duration = value / 600; // 60 * 10 break; } case DAYS: { duration = value / 4800; // 8 * 60 * 10 break; } case ELAPSED_DAYS: { duration = value / 14400; // 24 * 60 * 10 break; } case WEEKS: { duration = value / 24000; // 5 * 8 * 60 * 10 break; } case ELAPSED_WEEKS: { duration = value / 100800; // 7 * 24 * 60 * 10 break; } case MONTHS: { duration = value / 96000; // 4 * 5 * 8 * 60 * 10 break; } case ELAPSED_MONTHS: { duration = value / 432000; // 30 * 24 * 60 * 10 break; } default: { duration = value; break; } } return (Duration.getInstance(duration, type)); }
java
public static final Duration getDuration(double value, TimeUnit type) { double duration; // Value is given in 1/10 of minute switch (type) { case MINUTES: case ELAPSED_MINUTES: { duration = value / 10; break; } case HOURS: case ELAPSED_HOURS: { duration = value / 600; // 60 * 10 break; } case DAYS: { duration = value / 4800; // 8 * 60 * 10 break; } case ELAPSED_DAYS: { duration = value / 14400; // 24 * 60 * 10 break; } case WEEKS: { duration = value / 24000; // 5 * 8 * 60 * 10 break; } case ELAPSED_WEEKS: { duration = value / 100800; // 7 * 24 * 60 * 10 break; } case MONTHS: { duration = value / 96000; // 4 * 5 * 8 * 60 * 10 break; } case ELAPSED_MONTHS: { duration = value / 432000; // 30 * 24 * 60 * 10 break; } default: { duration = value; break; } } return (Duration.getInstance(duration, type)); }
[ "public", "static", "final", "Duration", "getDuration", "(", "double", "value", ",", "TimeUnit", "type", ")", "{", "double", "duration", ";", "// Value is given in 1/10 of minute", "switch", "(", "type", ")", "{", "case", "MINUTES", ":", "case", "ELAPSED_MINUTES",...
Reads a duration value. This method relies on the fact that the units of the duration have been specified elsewhere. @param value Duration value @param type type of units of the duration @return Duration instance
[ "Reads", "a", "duration", "value", ".", "This", "method", "relies", "on", "the", "fact", "that", "the", "units", "of", "the", "duration", "have", "been", "specified", "elsewhere", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDUtility.java#L271-L334
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPDUtility.java
MPDUtility.dumpRow
public static void dumpRow(Map<String, Object> row) { for (Entry<String, Object> entry : row.entrySet()) { Object value = entry.getValue(); System.out.println(entry.getKey() + " = " + value + " ( " + (value == null ? "" : value.getClass().getName()) + ")"); } }
java
public static void dumpRow(Map<String, Object> row) { for (Entry<String, Object> entry : row.entrySet()) { Object value = entry.getValue(); System.out.println(entry.getKey() + " = " + value + " ( " + (value == null ? "" : value.getClass().getName()) + ")"); } }
[ "public", "static", "void", "dumpRow", "(", "Map", "<", "String", ",", "Object", ">", "row", ")", "{", "for", "(", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "row", ".", "entrySet", "(", ")", ")", "{", "Object", "value", "=", "entry"...
Dump the contents of a row from an MPD file. @param row row data
[ "Dump", "the", "contents", "of", "a", "row", "from", "an", "MPD", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPDUtility.java#L341-L348
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.generateMapFile
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
java
public void generateMapFile(File jarFile, String mapFileName, boolean mapClassMethods) throws XMLStreamException, IOException, ClassNotFoundException, IntrospectionException { m_responseList = new LinkedList<String>(); writeMapFile(mapFileName, jarFile, mapClassMethods); }
[ "public", "void", "generateMapFile", "(", "File", "jarFile", ",", "String", "mapFileName", ",", "boolean", "mapClassMethods", ")", "throws", "XMLStreamException", ",", "IOException", ",", "ClassNotFoundException", ",", "IntrospectionException", "{", "m_responseList", "=...
Generate a map file from a jar file. @param jarFile jar file @param mapFileName map file name @param mapClassMethods true if we want to produce .Net style class method names @throws XMLStreamException @throws IOException @throws ClassNotFoundException @throws IntrospectionException
[ "Generate", "a", "map", "file", "from", "a", "jar", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L94-L98
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.writeMapFile
private void writeMapFile(String mapFileName, File jarFile, boolean mapClassMethods) throws IOException, XMLStreamException, ClassNotFoundException, IntrospectionException { FileWriter fw = new FileWriter(mapFileName); XMLOutputFactory xof = XMLOutputFactory.newInstance(); XMLStreamWriter writer = xof.createXMLStreamWriter(fw); //XMLStreamWriter writer = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(fw)); writer.writeStartDocument(); writer.writeStartElement("root"); writer.writeStartElement("assembly"); addClasses(writer, jarFile, mapClassMethods); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); writer.close(); fw.flush(); fw.close(); }
java
private void writeMapFile(String mapFileName, File jarFile, boolean mapClassMethods) throws IOException, XMLStreamException, ClassNotFoundException, IntrospectionException { FileWriter fw = new FileWriter(mapFileName); XMLOutputFactory xof = XMLOutputFactory.newInstance(); XMLStreamWriter writer = xof.createXMLStreamWriter(fw); //XMLStreamWriter writer = new IndentingXMLStreamWriter(xof.createXMLStreamWriter(fw)); writer.writeStartDocument(); writer.writeStartElement("root"); writer.writeStartElement("assembly"); addClasses(writer, jarFile, mapClassMethods); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndDocument(); writer.flush(); writer.close(); fw.flush(); fw.close(); }
[ "private", "void", "writeMapFile", "(", "String", "mapFileName", ",", "File", "jarFile", ",", "boolean", "mapClassMethods", ")", "throws", "IOException", ",", "XMLStreamException", ",", "ClassNotFoundException", ",", "IntrospectionException", "{", "FileWriter", "fw", ...
Generate an IKVM map file. @param mapFileName map file name @param jarFile jar file containing code to be mapped @param mapClassMethods true if we want to produce .Net style class method names @throws IOException @throws XMLStreamException @throws ClassNotFoundException @throws IntrospectionException
[ "Generate", "an", "IKVM", "map", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L111-L132
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addClasses
private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException { ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }, currentThreadClassLoader); JarFile jar = new JarFile(jarFile); Enumeration<JarEntry> enumeration = jar.entries(); while (enumeration.hasMoreElements()) { JarEntry jarEntry = enumeration.nextElement(); if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class")) { addClass(loader, jarEntry, writer, mapClassMethods); } } jar.close(); }
java
private void addClasses(XMLStreamWriter writer, File jarFile, boolean mapClassMethods) throws IOException, ClassNotFoundException, XMLStreamException, IntrospectionException { ClassLoader currentThreadClassLoader = Thread.currentThread().getContextClassLoader(); URLClassLoader loader = new URLClassLoader(new URL[] { jarFile.toURI().toURL() }, currentThreadClassLoader); JarFile jar = new JarFile(jarFile); Enumeration<JarEntry> enumeration = jar.entries(); while (enumeration.hasMoreElements()) { JarEntry jarEntry = enumeration.nextElement(); if (!jarEntry.isDirectory() && jarEntry.getName().endsWith(".class")) { addClass(loader, jarEntry, writer, mapClassMethods); } } jar.close(); }
[ "private", "void", "addClasses", "(", "XMLStreamWriter", "writer", ",", "File", "jarFile", ",", "boolean", "mapClassMethods", ")", "throws", "IOException", ",", "ClassNotFoundException", ",", "XMLStreamException", ",", "IntrospectionException", "{", "ClassLoader", "curr...
Add classes to the map file. @param writer XML stream writer @param jarFile jar file @param mapClassMethods true if we want to produce .Net style class method names @throws IOException @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException
[ "Add", "classes", "to", "the", "map", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L145-L165
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addClass
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException { String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", "."); writer.writeStartElement("class"); writer.writeAttribute("name", className); Set<Method> methodSet = new HashSet<Method>(); Class<?> aClass = loader.loadClass(className); processProperties(writer, methodSet, aClass); if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers())) { processClassMethods(writer, aClass, methodSet); } writer.writeEndElement(); }
java
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException { String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", "."); writer.writeStartElement("class"); writer.writeAttribute("name", className); Set<Method> methodSet = new HashSet<Method>(); Class<?> aClass = loader.loadClass(className); processProperties(writer, methodSet, aClass); if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers())) { processClassMethods(writer, aClass, methodSet); } writer.writeEndElement(); }
[ "private", "void", "addClass", "(", "URLClassLoader", "loader", ",", "JarEntry", "jarEntry", ",", "XMLStreamWriter", "writer", ",", "boolean", "mapClassMethods", ")", "throws", "ClassNotFoundException", ",", "XMLStreamException", ",", "IntrospectionException", "{", "Str...
Add an individual class to the map file. @param loader jar file class loader @param jarEntry jar file entry @param writer XML stream writer @param mapClassMethods true if we want to produce .Net style class method names @throws ClassNotFoundException @throws XMLStreamException @throws IntrospectionException
[ "Add", "an", "individual", "class", "to", "the", "map", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L178-L194
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.processProperties
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException { BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; if (propertyDescriptor.getPropertyType() != null) { String name = propertyDescriptor.getName(); Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); String readMethodName = readMethod == null ? null : readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName); if (readMethod != null) { methodSet.add(readMethod); } if (writeMethod != null) { methodSet.add(writeMethod); } } else { processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor); } } }
java
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException { BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass()); PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); for (int i = 0; i < propertyDescriptors.length; i++) { PropertyDescriptor propertyDescriptor = propertyDescriptors[i]; if (propertyDescriptor.getPropertyType() != null) { String name = propertyDescriptor.getName(); Method readMethod = propertyDescriptor.getReadMethod(); Method writeMethod = propertyDescriptor.getWriteMethod(); String readMethodName = readMethod == null ? null : readMethod.getName(); String writeMethodName = writeMethod == null ? null : writeMethod.getName(); addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName); if (readMethod != null) { methodSet.add(readMethod); } if (writeMethod != null) { methodSet.add(writeMethod); } } else { processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor); } } }
[ "private", "void", "processProperties", "(", "XMLStreamWriter", "writer", ",", "Set", "<", "Method", ">", "methodSet", ",", "Class", "<", "?", ">", "aClass", ")", "throws", "IntrospectionException", ",", "XMLStreamException", "{", "BeanInfo", "beanInfo", "=", "I...
Process class properties. @param writer output stream @param methodSet set of methods processed @param aClass class being processed @throws IntrospectionException @throws XMLStreamException
[ "Process", "class", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L205-L238
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.addProperty
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException { if (name.length() != 0) { writer.writeStartElement("property"); // convert property name to .NET style (i.e. first letter uppercase) String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); writer.writeAttribute("name", propertyName); String type = getTypeString(propertyType); writer.writeAttribute("sig", "()" + type); if (readMethod != null) { writer.writeStartElement("getter"); writer.writeAttribute("name", readMethod); writer.writeAttribute("sig", "()" + type); writer.writeEndElement(); } if (writeMethod != null) { writer.writeStartElement("setter"); writer.writeAttribute("name", writeMethod); writer.writeAttribute("sig", "(" + type + ")V"); writer.writeEndElement(); } writer.writeEndElement(); } }
java
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException { if (name.length() != 0) { writer.writeStartElement("property"); // convert property name to .NET style (i.e. first letter uppercase) String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1); writer.writeAttribute("name", propertyName); String type = getTypeString(propertyType); writer.writeAttribute("sig", "()" + type); if (readMethod != null) { writer.writeStartElement("getter"); writer.writeAttribute("name", readMethod); writer.writeAttribute("sig", "()" + type); writer.writeEndElement(); } if (writeMethod != null) { writer.writeStartElement("setter"); writer.writeAttribute("name", writeMethod); writer.writeAttribute("sig", "(" + type + ")V"); writer.writeEndElement(); } writer.writeEndElement(); } }
[ "private", "void", "addProperty", "(", "XMLStreamWriter", "writer", ",", "String", "name", ",", "Class", "<", "?", ">", "propertyType", ",", "String", "readMethod", ",", "String", "writeMethod", ")", "throws", "XMLStreamException", "{", "if", "(", "name", ".",...
Add a simple property to the map file. @param writer xml stream writer @param name property name @param propertyType property type @param readMethod read method name @param writeMethod write method name @throws XMLStreamException
[ "Add", "a", "simple", "property", "to", "the", "map", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L250-L280
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.getTypeString
private String getTypeString(Class<?> c) { String result = TYPE_MAP.get(c); if (result == null) { result = c.getName(); if (!result.endsWith(";") && !result.startsWith("[")) { result = "L" + result + ";"; } } return result; }
java
private String getTypeString(Class<?> c) { String result = TYPE_MAP.get(c); if (result == null) { result = c.getName(); if (!result.endsWith(";") && !result.startsWith("[")) { result = "L" + result + ";"; } } return result; }
[ "private", "String", "getTypeString", "(", "Class", "<", "?", ">", "c", ")", "{", "String", "result", "=", "TYPE_MAP", ".", "get", "(", "c", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "c", ".", "getName", "(", ")", ";",...
Converts a class into a signature token. @param c class @return signature token text
[ "Converts", "a", "class", "into", "a", "signature", "token", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L288-L300
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.processClassMethods
private void processClassMethods(XMLStreamWriter writer, Class<?> aClass, Set<Method> methodSet) throws XMLStreamException { Method[] methods = aClass.getDeclaredMethods(); for (Method method : methods) { if (!methodSet.contains(method) && Modifier.isPublic(method.getModifiers()) && !Modifier.isInterface(method.getModifiers())) { if (Modifier.isStatic(method.getModifiers())) { // TODO Handle static methods here } else { String name = method.getName(); String methodSignature = createMethodSignature(method); String fullJavaName = aClass.getCanonicalName() + "." + name + methodSignature; if (!ignoreMethod(fullJavaName)) { // // Hide the original method // writer.writeStartElement("method"); writer.writeAttribute("name", name); writer.writeAttribute("sig", methodSignature); writer.writeStartElement("attribute"); writer.writeAttribute("type", "System.ComponentModel.EditorBrowsableAttribute"); writer.writeAttribute("sig", "(Lcli.System.ComponentModel.EditorBrowsableState;)V"); writer.writeStartElement("parameter"); writer.writeCharacters("Never"); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); // // Create a wrapper method // name = name.toUpperCase().charAt(0) + name.substring(1); writer.writeStartElement("method"); writer.writeAttribute("name", name); writer.writeAttribute("sig", methodSignature); writer.writeAttribute("modifiers", "public"); writer.writeStartElement("body"); for (int index = 0; index <= method.getParameterTypes().length; index++) { if (index < 4) { writer.writeEmptyElement("ldarg_" + index); } else { writer.writeStartElement("ldarg_s"); writer.writeAttribute("argNum", Integer.toString(index)); writer.writeEndElement(); } } writer.writeStartElement("callvirt"); writer.writeAttribute("class", aClass.getName()); writer.writeAttribute("name", method.getName()); writer.writeAttribute("sig", methodSignature); writer.writeEndElement(); if (!method.getReturnType().getName().equals("void")) { writer.writeEmptyElement("ldnull"); writer.writeEmptyElement("pop"); } writer.writeEmptyElement("ret"); writer.writeEndElement(); writer.writeEndElement(); /* * The private method approach doesn't work... so * 3. Add EditorBrowsableAttribute (Never) to original methods * 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues * 5. Implement static method support? <attribute type="System.ComponentModel.EditorBrowsableAttribute" sig="(Lcli.System.ComponentModel.EditorBrowsableState;)V"> 914 <parameter>Never</parameter> 915 </attribute> */ m_responseList.add(fullJavaName); } } } } }
java
private void processClassMethods(XMLStreamWriter writer, Class<?> aClass, Set<Method> methodSet) throws XMLStreamException { Method[] methods = aClass.getDeclaredMethods(); for (Method method : methods) { if (!methodSet.contains(method) && Modifier.isPublic(method.getModifiers()) && !Modifier.isInterface(method.getModifiers())) { if (Modifier.isStatic(method.getModifiers())) { // TODO Handle static methods here } else { String name = method.getName(); String methodSignature = createMethodSignature(method); String fullJavaName = aClass.getCanonicalName() + "." + name + methodSignature; if (!ignoreMethod(fullJavaName)) { // // Hide the original method // writer.writeStartElement("method"); writer.writeAttribute("name", name); writer.writeAttribute("sig", methodSignature); writer.writeStartElement("attribute"); writer.writeAttribute("type", "System.ComponentModel.EditorBrowsableAttribute"); writer.writeAttribute("sig", "(Lcli.System.ComponentModel.EditorBrowsableState;)V"); writer.writeStartElement("parameter"); writer.writeCharacters("Never"); writer.writeEndElement(); writer.writeEndElement(); writer.writeEndElement(); // // Create a wrapper method // name = name.toUpperCase().charAt(0) + name.substring(1); writer.writeStartElement("method"); writer.writeAttribute("name", name); writer.writeAttribute("sig", methodSignature); writer.writeAttribute("modifiers", "public"); writer.writeStartElement("body"); for (int index = 0; index <= method.getParameterTypes().length; index++) { if (index < 4) { writer.writeEmptyElement("ldarg_" + index); } else { writer.writeStartElement("ldarg_s"); writer.writeAttribute("argNum", Integer.toString(index)); writer.writeEndElement(); } } writer.writeStartElement("callvirt"); writer.writeAttribute("class", aClass.getName()); writer.writeAttribute("name", method.getName()); writer.writeAttribute("sig", methodSignature); writer.writeEndElement(); if (!method.getReturnType().getName().equals("void")) { writer.writeEmptyElement("ldnull"); writer.writeEmptyElement("pop"); } writer.writeEmptyElement("ret"); writer.writeEndElement(); writer.writeEndElement(); /* * The private method approach doesn't work... so * 3. Add EditorBrowsableAttribute (Never) to original methods * 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues * 5. Implement static method support? <attribute type="System.ComponentModel.EditorBrowsableAttribute" sig="(Lcli.System.ComponentModel.EditorBrowsableState;)V"> 914 <parameter>Never</parameter> 915 </attribute> */ m_responseList.add(fullJavaName); } } } } }
[ "private", "void", "processClassMethods", "(", "XMLStreamWriter", "writer", ",", "Class", "<", "?", ">", "aClass", ",", "Set", "<", "Method", ">", "methodSet", ")", "throws", "XMLStreamException", "{", "Method", "[", "]", "methods", "=", "aClass", ".", "getD...
Hides the original Java-style method name using an attribute which should be respected by Visual Studio, the creates a new wrapper method using a .Net style method name. Note that this does not work for VB as it is case insensitive. Even though Visual Studio won't show you the Java-style method name, the VB compiler sees both and thinks they are the same... which causes it to fail. @param writer output stream @param aClass class being processed @param methodSet set of methods which have been processed. @throws XMLStreamException
[ "Hides", "the", "original", "Java", "-", "style", "method", "name", "using", "an", "attribute", "which", "should", "be", "respected", "by", "Visual", "Studio", "the", "creates", "a", "new", "wrapper", "method", "using", "a", ".", "Net", "style", "method", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L367-L458
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.ignoreMethod
private boolean ignoreMethod(String name) { boolean result = false; for (String ignoredName : IGNORED_METHODS) { if (name.matches(ignoredName)) { result = true; break; } } return result; }
java
private boolean ignoreMethod(String name) { boolean result = false; for (String ignoredName : IGNORED_METHODS) { if (name.matches(ignoredName)) { result = true; break; } } return result; }
[ "private", "boolean", "ignoreMethod", "(", "String", "name", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "String", "ignoredName", ":", "IGNORED_METHODS", ")", "{", "if", "(", "name", ".", "matches", "(", "ignoredName", ")", ")", "{", "r...
Used to determine if the current method should be ignored. @param name method name @return true if the method should be ignored
[ "Used", "to", "determine", "if", "the", "current", "method", "should", "be", "ignored", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L466-L480
train
joniles/mpxj
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
MapFileGenerator.createMethodSignature
private String createMethodSignature(Method method) { StringBuilder sb = new StringBuilder(); sb.append("("); for (Class<?> type : method.getParameterTypes()) { sb.append(getTypeString(type)); } sb.append(")"); Class<?> type = method.getReturnType(); if (type.getName().equals("void")) { sb.append("V"); } else { sb.append(getTypeString(type)); } return sb.toString(); }
java
private String createMethodSignature(Method method) { StringBuilder sb = new StringBuilder(); sb.append("("); for (Class<?> type : method.getParameterTypes()) { sb.append(getTypeString(type)); } sb.append(")"); Class<?> type = method.getReturnType(); if (type.getName().equals("void")) { sb.append("V"); } else { sb.append(getTypeString(type)); } return sb.toString(); }
[ "private", "String", "createMethodSignature", "(", "Method", "method", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "sb", ".", "append", "(", "\"(\"", ")", ";", "for", "(", "Class", "<", "?", ">", "type", ":", "method", ...
Creates a method signature. @param method Method instance @return method signature
[ "Creates", "a", "method", "signature", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L488-L507
train
joniles/mpxj
src/main/java/net/sf/mpxj/ProjectCalendarException.java
ProjectCalendarException.contains
public boolean contains(Date date) { boolean result = false; if (date != null) { result = (DateHelper.compare(getFromDate(), getToDate(), date) == 0); } return (result); }
java
public boolean contains(Date date) { boolean result = false; if (date != null) { result = (DateHelper.compare(getFromDate(), getToDate(), date) == 0); } return (result); }
[ "public", "boolean", "contains", "(", "Date", "date", ")", "{", "boolean", "result", "=", "false", ";", "if", "(", "date", "!=", "null", ")", "{", "result", "=", "(", "DateHelper", ".", "compare", "(", "getFromDate", "(", ")", ",", "getToDate", "(", ...
This method determines whether the given date falls in the range of dates covered by this exception. Note that this method assumes that both the start and end date of this exception have been set. @param date Date to be tested @return Boolean value
[ "This", "method", "determines", "whether", "the", "given", "date", "falls", "in", "the", "range", "of", "dates", "covered", "by", "this", "exception", ".", "Note", "that", "this", "method", "assumes", "that", "both", "the", "start", "and", "end", "date", "...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarException.java#L129-L139
train
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/JTableExtra.java
JTableExtra.setModel
@Override public void setModel(TableModel model) { super.setModel(model); int columns = model.getColumnCount(); TableColumnModel tableColumnModel = getColumnModel(); for (int index = 0; index < columns; index++) { tableColumnModel.getColumn(index).setPreferredWidth(m_columnWidth); } }
java
@Override public void setModel(TableModel model) { super.setModel(model); int columns = model.getColumnCount(); TableColumnModel tableColumnModel = getColumnModel(); for (int index = 0; index < columns; index++) { tableColumnModel.getColumn(index).setPreferredWidth(m_columnWidth); } }
[ "@", "Override", "public", "void", "setModel", "(", "TableModel", "model", ")", "{", "super", ".", "setModel", "(", "model", ")", ";", "int", "columns", "=", "model", ".", "getColumnCount", "(", ")", ";", "TableColumnModel", "tableColumnModel", "=", "getColu...
Updates the model. Ensures that we reset the columns widths. @param model table model
[ "Updates", "the", "model", ".", "Ensures", "that", "we", "reset", "the", "columns", "widths", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/JTableExtra.java#L139-L148
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.process
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { try { populateMemberData(reader, file, root); processProjectProperties(); if (!reader.getReadPropertiesOnly()) { processSubProjectData(); processGraphicalIndicators(); processCustomValueLists(); processCalendarData(); processResourceData(); processTaskData(); processConstraintData(); processAssignmentData(); postProcessTasks(); if (reader.getReadPresentationData()) { processViewPropertyData(); processTableData(); processViewData(); processFilterData(); processGroupData(); processSavedViewState(); } } } finally { clearMemberData(); } }
java
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException { try { populateMemberData(reader, file, root); processProjectProperties(); if (!reader.getReadPropertiesOnly()) { processSubProjectData(); processGraphicalIndicators(); processCustomValueLists(); processCalendarData(); processResourceData(); processTaskData(); processConstraintData(); processAssignmentData(); postProcessTasks(); if (reader.getReadPresentationData()) { processViewPropertyData(); processTableData(); processViewData(); processFilterData(); processGroupData(); processSavedViewState(); } } } finally { clearMemberData(); } }
[ "@", "Override", "public", "void", "process", "(", "MPPReader", "reader", ",", "ProjectFile", "file", ",", "DirectoryEntry", "root", ")", "throws", "MPXJException", ",", "IOException", "{", "try", "{", "populateMemberData", "(", "reader", ",", "file", ",", "ro...
This method is used to process an MPP14 file. This is the file format used by Project 14. @param reader parent file reader @param file parent MPP file @param root Root of the POI file system.
[ "This", "method", "is", "used", "to", "process", "an", "MPP14", "file", ".", "This", "is", "the", "file", "format", "used", "by", "Project", "14", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L80-L115
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processGraphicalIndicators
private void processGraphicalIndicators() { GraphicalIndicatorReader graphicalIndicatorReader = new GraphicalIndicatorReader(); graphicalIndicatorReader.process(m_file.getCustomFields(), m_file.getProjectProperties(), m_projectProps); }
java
private void processGraphicalIndicators() { GraphicalIndicatorReader graphicalIndicatorReader = new GraphicalIndicatorReader(); graphicalIndicatorReader.process(m_file.getCustomFields(), m_file.getProjectProperties(), m_projectProps); }
[ "private", "void", "processGraphicalIndicators", "(", ")", "{", "GraphicalIndicatorReader", "graphicalIndicatorReader", "=", "new", "GraphicalIndicatorReader", "(", ")", ";", "graphicalIndicatorReader", ".", "process", "(", "m_file", ".", "getCustomFields", "(", ")", ",...
Process the graphical indicator data.
[ "Process", "the", "graphical", "indicator", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L230-L234
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.readSubProjects
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { while (uniqueIDOffset < filePathOffset) { readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++); uniqueIDOffset += 4; } }
java
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex) { while (uniqueIDOffset < filePathOffset) { readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++); uniqueIDOffset += 4; } }
[ "private", "void", "readSubProjects", "(", "byte", "[", "]", "data", ",", "int", "uniqueIDOffset", ",", "int", "filePathOffset", ",", "int", "fileNameOffset", ",", "int", "subprojectIndex", ")", "{", "while", "(", "uniqueIDOffset", "<", "filePathOffset", ")", ...
Read a list of sub projects. @param data byte array @param uniqueIDOffset offset of unique ID @param filePathOffset offset of file path @param fileNameOffset offset of file name @param subprojectIndex index of the subproject, used to calculate unique id offset
[ "Read", "a", "list", "of", "sub", "projects", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L559-L566
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processBaseFonts
private void processBaseFonts(byte[] data) { int offset = 0; int blockCount = MPPUtility.getShort(data, 0); offset += 2; int size; String name; for (int loop = 0; loop < blockCount; loop++) { /*unknownAttribute = MPPUtility.getShort(data, offset);*/ offset += 2; size = MPPUtility.getShort(data, offset); offset += 2; name = MPPUtility.getUnicodeString(data, offset); offset += 64; if (name.length() != 0) { FontBase fontBase = new FontBase(Integer.valueOf(loop), name, size); m_fontBases.put(fontBase.getIndex(), fontBase); } } }
java
private void processBaseFonts(byte[] data) { int offset = 0; int blockCount = MPPUtility.getShort(data, 0); offset += 2; int size; String name; for (int loop = 0; loop < blockCount; loop++) { /*unknownAttribute = MPPUtility.getShort(data, offset);*/ offset += 2; size = MPPUtility.getShort(data, offset); offset += 2; name = MPPUtility.getUnicodeString(data, offset); offset += 64; if (name.length() != 0) { FontBase fontBase = new FontBase(Integer.valueOf(loop), name, size); m_fontBases.put(fontBase.getIndex(), fontBase); } } }
[ "private", "void", "processBaseFonts", "(", "byte", "[", "]", "data", ")", "{", "int", "offset", "=", "0", ";", "int", "blockCount", "=", "MPPUtility", ".", "getShort", "(", "data", ",", "0", ")", ";", "offset", "+=", "2", ";", "int", "size", ";", ...
Create an index of base font numbers and their associated base font instances. @param data property data
[ "Create", "an", "index", "of", "base", "font", "numbers", "and", "their", "associated", "base", "font", "instances", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L773-L800
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.createTaskMap
private TreeMap<Integer, Integer> createTaskMap(FieldMap fieldMap, FixedMeta taskFixedMeta, FixedData taskFixedData, Var2Data taskVarData) { TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>(); int uniqueIdOffset = fieldMap.getFixedDataOffset(TaskField.UNIQUE_ID); Integer taskNameKey = fieldMap.getVarDataKey(TaskField.NAME); int itemCount = taskFixedMeta.getAdjustedItemCount(); int uniqueID; Integer key; // // First three items are not tasks, so let's skip them // for (int loop = 3; loop < itemCount; loop++) { byte[] data = taskFixedData.getByteArrayValue(loop); if (data != null) { byte[] metaData = taskFixedMeta.getByteArrayValue(loop); // // Check for the deleted task flag // int flags = MPPUtility.getInt(metaData, 0); if ((flags & 0x02) != 0) { // Project stores the deleted tasks unique id's into the fixed data as well // and at least in one case the deleted task was listed twice in the list // the second time with data with it causing a phantom task to be shown. // See CalendarErrorPhantomTasks.mpp // // So let's add the unique id for the deleted task into the map so we don't // accidentally include the task later. // uniqueID = MPPUtility.getShort(data, TASK_UNIQUE_ID_FIXED_OFFSET); // Only a short stored for deleted tasks? key = Integer.valueOf(uniqueID); if (taskMap.containsKey(key) == false) { taskMap.put(key, null); // use null so we can easily ignore this later } } else { // // Do we have a null task? // if (data.length == NULL_TASK_BLOCK_SIZE) { uniqueID = MPPUtility.getInt(data, TASK_UNIQUE_ID_FIXED_OFFSET); key = Integer.valueOf(uniqueID); if (taskMap.containsKey(key) == false) { taskMap.put(key, Integer.valueOf(loop)); } } else { // // We apply a heuristic here - if we have more than 75% of the data, we assume // the task is valid. // int maxSize = fieldMap.getMaxFixedDataSize(0); if (maxSize == 0 || ((data.length * 100) / maxSize) > 75) { uniqueID = MPPUtility.getInt(data, uniqueIdOffset); key = Integer.valueOf(uniqueID); // Accept this task if it does not have a deleted unique ID or it has a deleted unique ID but the name is not null if (!taskMap.containsKey(key) || taskVarData.getUnicodeString(key, taskNameKey) != null) { taskMap.put(key, Integer.valueOf(loop)); } } } } } } return (taskMap); }
java
private TreeMap<Integer, Integer> createTaskMap(FieldMap fieldMap, FixedMeta taskFixedMeta, FixedData taskFixedData, Var2Data taskVarData) { TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>(); int uniqueIdOffset = fieldMap.getFixedDataOffset(TaskField.UNIQUE_ID); Integer taskNameKey = fieldMap.getVarDataKey(TaskField.NAME); int itemCount = taskFixedMeta.getAdjustedItemCount(); int uniqueID; Integer key; // // First three items are not tasks, so let's skip them // for (int loop = 3; loop < itemCount; loop++) { byte[] data = taskFixedData.getByteArrayValue(loop); if (data != null) { byte[] metaData = taskFixedMeta.getByteArrayValue(loop); // // Check for the deleted task flag // int flags = MPPUtility.getInt(metaData, 0); if ((flags & 0x02) != 0) { // Project stores the deleted tasks unique id's into the fixed data as well // and at least in one case the deleted task was listed twice in the list // the second time with data with it causing a phantom task to be shown. // See CalendarErrorPhantomTasks.mpp // // So let's add the unique id for the deleted task into the map so we don't // accidentally include the task later. // uniqueID = MPPUtility.getShort(data, TASK_UNIQUE_ID_FIXED_OFFSET); // Only a short stored for deleted tasks? key = Integer.valueOf(uniqueID); if (taskMap.containsKey(key) == false) { taskMap.put(key, null); // use null so we can easily ignore this later } } else { // // Do we have a null task? // if (data.length == NULL_TASK_BLOCK_SIZE) { uniqueID = MPPUtility.getInt(data, TASK_UNIQUE_ID_FIXED_OFFSET); key = Integer.valueOf(uniqueID); if (taskMap.containsKey(key) == false) { taskMap.put(key, Integer.valueOf(loop)); } } else { // // We apply a heuristic here - if we have more than 75% of the data, we assume // the task is valid. // int maxSize = fieldMap.getMaxFixedDataSize(0); if (maxSize == 0 || ((data.length * 100) / maxSize) > 75) { uniqueID = MPPUtility.getInt(data, uniqueIdOffset); key = Integer.valueOf(uniqueID); // Accept this task if it does not have a deleted unique ID or it has a deleted unique ID but the name is not null if (!taskMap.containsKey(key) || taskVarData.getUnicodeString(key, taskNameKey) != null) { taskMap.put(key, Integer.valueOf(loop)); } } } } } } return (taskMap); }
[ "private", "TreeMap", "<", "Integer", ",", "Integer", ">", "createTaskMap", "(", "FieldMap", "fieldMap", ",", "FixedMeta", "taskFixedMeta", ",", "FixedData", "taskFixedData", ",", "Var2Data", "taskVarData", ")", "{", "TreeMap", "<", "Integer", ",", "Integer", ">...
This method maps the task unique identifiers to their index number within the FixedData block. @param fieldMap field map @param taskFixedMeta Fixed meta data for this task @param taskFixedData Fixed data for this task @param taskVarData Variable task data @return Mapping between task identifiers and block position
[ "This", "method", "maps", "the", "task", "unique", "identifiers", "to", "their", "index", "number", "within", "the", "FixedData", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L812-L890
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.postProcessTasks
private void postProcessTasks() throws MPXJException { // // Renumber ID values using a large increment to allow // space for later inserts. // TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>(); // I've found a pathological case of an MPP file with around 102k blank tasks... int nextIDIncrement = 102000; int nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? nextIDIncrement : 0); for (Map.Entry<Long, Integer> entry : m_taskOrder.entrySet()) { taskMap.put(Integer.valueOf(nextID), entry.getValue()); nextID += nextIDIncrement; } // // Insert any null tasks into the correct location // int insertionCount = 0; Map<Integer, Integer> offsetMap = new HashMap<Integer, Integer>(); for (Map.Entry<Integer, Integer> entry : m_nullTaskOrder.entrySet()) { int idValue = entry.getKey().intValue(); int baseTargetIdValue = (idValue - insertionCount) * nextIDIncrement; int targetIDValue = baseTargetIdValue; Integer previousOffsetKey = Integer.valueOf(baseTargetIdValue); Integer previousOffset = offsetMap.get(previousOffsetKey); int offset = previousOffset == null ? 0 : previousOffset.intValue() + 1; ++insertionCount; while (taskMap.containsKey(Integer.valueOf(targetIDValue))) { ++offset; if (offset == nextIDIncrement) { throw new MPXJException("Unable to fix task order"); } targetIDValue = baseTargetIdValue - (nextIDIncrement - offset); } offsetMap.put(previousOffsetKey, Integer.valueOf(offset)); taskMap.put(Integer.valueOf(targetIDValue), entry.getValue()); } // // Finally, we can renumber the tasks // nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? 1 : 0); for (Map.Entry<Integer, Integer> entry : taskMap.entrySet()) { Task task = m_file.getTaskByUniqueID(entry.getValue()); if (task != null) { task.setID(Integer.valueOf(nextID)); } nextID++; } }
java
private void postProcessTasks() throws MPXJException { // // Renumber ID values using a large increment to allow // space for later inserts. // TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>(); // I've found a pathological case of an MPP file with around 102k blank tasks... int nextIDIncrement = 102000; int nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? nextIDIncrement : 0); for (Map.Entry<Long, Integer> entry : m_taskOrder.entrySet()) { taskMap.put(Integer.valueOf(nextID), entry.getValue()); nextID += nextIDIncrement; } // // Insert any null tasks into the correct location // int insertionCount = 0; Map<Integer, Integer> offsetMap = new HashMap<Integer, Integer>(); for (Map.Entry<Integer, Integer> entry : m_nullTaskOrder.entrySet()) { int idValue = entry.getKey().intValue(); int baseTargetIdValue = (idValue - insertionCount) * nextIDIncrement; int targetIDValue = baseTargetIdValue; Integer previousOffsetKey = Integer.valueOf(baseTargetIdValue); Integer previousOffset = offsetMap.get(previousOffsetKey); int offset = previousOffset == null ? 0 : previousOffset.intValue() + 1; ++insertionCount; while (taskMap.containsKey(Integer.valueOf(targetIDValue))) { ++offset; if (offset == nextIDIncrement) { throw new MPXJException("Unable to fix task order"); } targetIDValue = baseTargetIdValue - (nextIDIncrement - offset); } offsetMap.put(previousOffsetKey, Integer.valueOf(offset)); taskMap.put(Integer.valueOf(targetIDValue), entry.getValue()); } // // Finally, we can renumber the tasks // nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? 1 : 0); for (Map.Entry<Integer, Integer> entry : taskMap.entrySet()) { Task task = m_file.getTaskByUniqueID(entry.getValue()); if (task != null) { task.setID(Integer.valueOf(nextID)); } nextID++; } }
[ "private", "void", "postProcessTasks", "(", ")", "throws", "MPXJException", "{", "//", "// Renumber ID values using a large increment to allow", "// space for later inserts.", "//", "TreeMap", "<", "Integer", ",", "Integer", ">", "taskMap", "=", "new", "TreeMap", "<", "...
MPP14 files seem to exhibit some occasional weirdness with duplicate ID values which leads to the task structure being reported incorrectly. The following method attempts to correct this. The method uses ordering data embedded in the file to reconstruct the correct ID order of the tasks.
[ "MPP14", "files", "seem", "to", "exhibit", "some", "occasional", "weirdness", "with", "duplicate", "ID", "values", "which", "leads", "to", "the", "task", "structure", "being", "reported", "incorrectly", ".", "The", "following", "method", "attempts", "to", "corre...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1317-L1376
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.processHyperlinkData
private void processHyperlinkData(Resource resource, byte[] data) { if (data != null) { int offset = 12; String hyperlink; String address; String subaddress; offset += 12; hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; subaddress = MPPUtility.getUnicodeString(data, offset); resource.setHyperlink(hyperlink); resource.setHyperlinkAddress(address); resource.setHyperlinkSubAddress(subaddress); } }
java
private void processHyperlinkData(Resource resource, byte[] data) { if (data != null) { int offset = 12; String hyperlink; String address; String subaddress; offset += 12; hyperlink = MPPUtility.getUnicodeString(data, offset); offset += ((hyperlink.length() + 1) * 2); offset += 12; address = MPPUtility.getUnicodeString(data, offset); offset += ((address.length() + 1) * 2); offset += 12; subaddress = MPPUtility.getUnicodeString(data, offset); resource.setHyperlink(hyperlink); resource.setHyperlinkAddress(address); resource.setHyperlinkSubAddress(subaddress); } }
[ "private", "void", "processHyperlinkData", "(", "Resource", "resource", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "int", "offset", "=", "12", ";", "String", "hyperlink", ";", "String", "address", ";", "String", ...
This method is used to extract the resource hyperlink attributes from a block of data and call the appropriate modifier methods to configure the specified task object. @param resource resource instance @param data hyperlink data block
[ "This", "method", "is", "used", "to", "extract", "the", "resource", "hyperlink", "attributes", "from", "a", "block", "of", "data", "and", "call", "the", "appropriate", "modifier", "methods", "to", "configure", "the", "specified", "task", "object", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1547-L1571
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
MPP14Reader.readBitFields
private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data) { for (MppBitFlag flag : flags) { flag.setValue(container, data); } }
java
private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data) { for (MppBitFlag flag : flags) { flag.setValue(container, data); } }
[ "private", "void", "readBitFields", "(", "MppBitFlag", "[", "]", "flags", ",", "FieldContainer", "container", ",", "byte", "[", "]", "data", ")", "{", "for", "(", "MppBitFlag", "flag", ":", "flags", ")", "{", "flag", ".", "setValue", "(", "container", ",...
Iterate through a set of bit field flags and set the value for each one in the supplied container. @param flags bit field flags @param container field container @param data source data
[ "Iterate", "through", "a", "set", "of", "bit", "field", "flags", "and", "set", "the", "value", "for", "each", "one", "in", "the", "supplied", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L2039-L2045
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/Table.java
Table.read
public void read(InputStream is) throws IOException { byte[] headerBlock = new byte[20]; is.read(headerBlock); int headerLength = PEPUtility.getShort(headerBlock, 8); int recordCount = PEPUtility.getInt(headerBlock, 10); int recordLength = PEPUtility.getInt(headerBlock, 16); StreamHelper.skip(is, headerLength - headerBlock.length); byte[] record = new byte[recordLength]; for (int recordIndex = 1; recordIndex <= recordCount; recordIndex++) { is.read(record); readRow(recordIndex, record); } }
java
public void read(InputStream is) throws IOException { byte[] headerBlock = new byte[20]; is.read(headerBlock); int headerLength = PEPUtility.getShort(headerBlock, 8); int recordCount = PEPUtility.getInt(headerBlock, 10); int recordLength = PEPUtility.getInt(headerBlock, 16); StreamHelper.skip(is, headerLength - headerBlock.length); byte[] record = new byte[recordLength]; for (int recordIndex = 1; recordIndex <= recordCount; recordIndex++) { is.read(record); readRow(recordIndex, record); } }
[ "public", "void", "read", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "headerBlock", "=", "new", "byte", "[", "20", "]", ";", "is", ".", "read", "(", "headerBlock", ")", ";", "int", "headerLength", "=", "PEPUtility", ...
Reads the table data from an input stream and breaks it down into rows. @param is input stream
[ "Reads", "the", "table", "data", "from", "an", "input", "stream", "and", "breaks", "it", "down", "into", "rows", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/Table.java#L59-L75
train
joniles/mpxj
src/main/java/net/sf/mpxj/turboproject/Table.java
Table.addRow
protected void addRow(int uniqueID, Map<String, Object> map) { m_rows.put(Integer.valueOf(uniqueID), new MapRow(map)); }
java
protected void addRow(int uniqueID, Map<String, Object> map) { m_rows.put(Integer.valueOf(uniqueID), new MapRow(map)); }
[ "protected", "void", "addRow", "(", "int", "uniqueID", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "m_rows", ".", "put", "(", "Integer", ".", "valueOf", "(", "uniqueID", ")", ",", "new", "MapRow", "(", "map", ")", ")", ";", "}" ...
Adds a row to the internal storage, indexed by primary key. @param uniqueID unique ID of the row @param map row data as a simpe map
[ "Adds", "a", "row", "to", "the", "internal", "storage", "indexed", "by", "primary", "key", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/Table.java#L106-L109
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
TimephasedDataFactory.getCompleteWork
public List<TimephasedWork> getCompleteWork(ProjectCalendar calendar, ResourceAssignment resourceAssignment, byte[] data) { LinkedList<TimephasedWork> list = new LinkedList<TimephasedWork>(); if (calendar != null && data != null && data.length > 2 && MPPUtility.getShort(data, 0) > 0) { Date startDate = resourceAssignment.getStart(); double finishTime = MPPUtility.getInt(data, 24); int blockCount = MPPUtility.getShort(data, 0); double previousCumulativeWork = 0; TimephasedWork previousAssignment = null; int index = 32; int currentBlock = 0; while (currentBlock < blockCount && index + 20 <= data.length) { double time = MPPUtility.getInt(data, index + 0); // If the start of this block is before the start of the assignment, or after the end of the assignment // the values don't make sense, so we'll just set the start of this block to be the start of the assignment. // This deals with an issue where odd timephased data like this was causing an MPP file to be read // extremely slowly. if (time < 0 || time > finishTime) { time = 0; } else { time /= 80; } Duration startWork = Duration.getInstance(time, TimeUnit.MINUTES); double currentCumulativeWork = (long) MPPUtility.getDouble(data, index + 4); double assignmentDuration = currentCumulativeWork - previousCumulativeWork; previousCumulativeWork = currentCumulativeWork; assignmentDuration /= 1000; Duration totalWork = Duration.getInstance(assignmentDuration, TimeUnit.MINUTES); time = (long) MPPUtility.getDouble(data, index + 12); time /= 125; time *= 6; Duration workPerDay = Duration.getInstance(time, TimeUnit.MINUTES); Date start; if (startWork.getDuration() == 0) { start = startDate; } else { start = calendar.getDate(startDate, startWork, true); } TimephasedWork assignment = new TimephasedWork(); assignment.setStart(start); assignment.setAmountPerDay(workPerDay); assignment.setTotalAmount(totalWork); if (previousAssignment != null) { Date finish = calendar.getDate(startDate, startWork, false); previousAssignment.setFinish(finish); if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime()) { list.removeLast(); } } list.add(assignment); previousAssignment = assignment; index += 20; ++currentBlock; } if (previousAssignment != null) { Duration finishWork = Duration.getInstance(finishTime / 80, TimeUnit.MINUTES); Date finish = calendar.getDate(startDate, finishWork, false); previousAssignment.setFinish(finish); if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime()) { list.removeLast(); } } } return list; }
java
public List<TimephasedWork> getCompleteWork(ProjectCalendar calendar, ResourceAssignment resourceAssignment, byte[] data) { LinkedList<TimephasedWork> list = new LinkedList<TimephasedWork>(); if (calendar != null && data != null && data.length > 2 && MPPUtility.getShort(data, 0) > 0) { Date startDate = resourceAssignment.getStart(); double finishTime = MPPUtility.getInt(data, 24); int blockCount = MPPUtility.getShort(data, 0); double previousCumulativeWork = 0; TimephasedWork previousAssignment = null; int index = 32; int currentBlock = 0; while (currentBlock < blockCount && index + 20 <= data.length) { double time = MPPUtility.getInt(data, index + 0); // If the start of this block is before the start of the assignment, or after the end of the assignment // the values don't make sense, so we'll just set the start of this block to be the start of the assignment. // This deals with an issue where odd timephased data like this was causing an MPP file to be read // extremely slowly. if (time < 0 || time > finishTime) { time = 0; } else { time /= 80; } Duration startWork = Duration.getInstance(time, TimeUnit.MINUTES); double currentCumulativeWork = (long) MPPUtility.getDouble(data, index + 4); double assignmentDuration = currentCumulativeWork - previousCumulativeWork; previousCumulativeWork = currentCumulativeWork; assignmentDuration /= 1000; Duration totalWork = Duration.getInstance(assignmentDuration, TimeUnit.MINUTES); time = (long) MPPUtility.getDouble(data, index + 12); time /= 125; time *= 6; Duration workPerDay = Duration.getInstance(time, TimeUnit.MINUTES); Date start; if (startWork.getDuration() == 0) { start = startDate; } else { start = calendar.getDate(startDate, startWork, true); } TimephasedWork assignment = new TimephasedWork(); assignment.setStart(start); assignment.setAmountPerDay(workPerDay); assignment.setTotalAmount(totalWork); if (previousAssignment != null) { Date finish = calendar.getDate(startDate, startWork, false); previousAssignment.setFinish(finish); if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime()) { list.removeLast(); } } list.add(assignment); previousAssignment = assignment; index += 20; ++currentBlock; } if (previousAssignment != null) { Duration finishWork = Duration.getInstance(finishTime / 80, TimeUnit.MINUTES); Date finish = calendar.getDate(startDate, finishWork, false); previousAssignment.setFinish(finish); if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime()) { list.removeLast(); } } } return list; }
[ "public", "List", "<", "TimephasedWork", ">", "getCompleteWork", "(", "ProjectCalendar", "calendar", ",", "ResourceAssignment", "resourceAssignment", ",", "byte", "[", "]", "data", ")", "{", "LinkedList", "<", "TimephasedWork", ">", "list", "=", "new", "LinkedList...
Given a block of data representing completed work, this method will retrieve a set of TimephasedWork instances which represent the day by day work carried out for a specific resource assignment. @param calendar calendar on which date calculations are based @param resourceAssignment resource assignment @param data completed work data block @return list of TimephasedWork instances
[ "Given", "a", "block", "of", "data", "representing", "completed", "work", "this", "method", "will", "retrieve", "a", "set", "of", "TimephasedWork", "instances", "which", "represent", "the", "day", "by", "day", "work", "carried", "out", "for", "a", "specific", ...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L61-L149
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
TimephasedDataFactory.getWorkModified
public boolean getWorkModified(List<TimephasedWork> list) { boolean result = false; for (TimephasedWork assignment : list) { result = assignment.getModified(); if (result) { break; } } return result; }
java
public boolean getWorkModified(List<TimephasedWork> list) { boolean result = false; for (TimephasedWork assignment : list) { result = assignment.getModified(); if (result) { break; } } return result; }
[ "public", "boolean", "getWorkModified", "(", "List", "<", "TimephasedWork", ">", "list", ")", "{", "boolean", "result", "=", "false", ";", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "result", "=", "assignment", ".", "getModified", "("...
Test the list of TimephasedWork instances to see if any of them have been modified. @param list list of TimephasedWork instances @return boolean flag
[ "Test", "the", "list", "of", "TimephasedWork", "instances", "to", "see", "if", "any", "of", "them", "have", "been", "modified", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L304-L316
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
TimephasedDataFactory.getBaselineWork
public TimephasedWorkContainer getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw) { TimephasedWorkContainer result = null; if (data != null && data.length > 0) { LinkedList<TimephasedWork> list = null; //System.out.println(ByteArrayHelper.hexdump(data, false)); int index = 8; // 8 byte header int blockSize = 40; double previousCumulativeWorkPerformedInMinutes = 0; Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36); index += blockSize; TimephasedWork work = null; while (index + blockSize <= data.length) { double cumulativeWorkInMinutes = (double) ((long) MPPUtility.getDouble(data, index + 20)) / 1000; if (!Duration.durationValueEquals(cumulativeWorkInMinutes, previousCumulativeWorkPerformedInMinutes)) { //double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000; double normalActualWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 8)) / 10; double normalRemainingWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 28)) / 10; double workThisPeriodInMinutes = cumulativeWorkInMinutes - previousCumulativeWorkPerformedInMinutes; double overtimeWorkThisPeriodInMinutes = workThisPeriodInMinutes - (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes); double overtimeFactor = overtimeWorkThisPeriodInMinutes / (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes); double normalWorkPerDayInMinutes = 480; double overtimeWorkPerDayInMinutes = normalWorkPerDayInMinutes * overtimeFactor; work = new TimephasedWork(); work.setFinish(MPPUtility.getTimestampFromTenths(data, index + 16)); work.setStart(blockStartDate); work.setTotalAmount(Duration.getInstance(workThisPeriodInMinutes, TimeUnit.MINUTES)); work.setAmountPerDay(Duration.getInstance(normalWorkPerDayInMinutes + overtimeWorkPerDayInMinutes, TimeUnit.MINUTES)); previousCumulativeWorkPerformedInMinutes = cumulativeWorkInMinutes; if (list == null) { list = new LinkedList<TimephasedWork>(); } list.add(work); //System.out.println(work); } blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36); index += blockSize; } if (list != null) { if (work != null) { work.setFinish(assignment.getFinish()); } result = new DefaultTimephasedWorkContainer(calendar, normaliser, list, raw); } } return result; }
java
public TimephasedWorkContainer getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw) { TimephasedWorkContainer result = null; if (data != null && data.length > 0) { LinkedList<TimephasedWork> list = null; //System.out.println(ByteArrayHelper.hexdump(data, false)); int index = 8; // 8 byte header int blockSize = 40; double previousCumulativeWorkPerformedInMinutes = 0; Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36); index += blockSize; TimephasedWork work = null; while (index + blockSize <= data.length) { double cumulativeWorkInMinutes = (double) ((long) MPPUtility.getDouble(data, index + 20)) / 1000; if (!Duration.durationValueEquals(cumulativeWorkInMinutes, previousCumulativeWorkPerformedInMinutes)) { //double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000; double normalActualWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 8)) / 10; double normalRemainingWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 28)) / 10; double workThisPeriodInMinutes = cumulativeWorkInMinutes - previousCumulativeWorkPerformedInMinutes; double overtimeWorkThisPeriodInMinutes = workThisPeriodInMinutes - (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes); double overtimeFactor = overtimeWorkThisPeriodInMinutes / (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes); double normalWorkPerDayInMinutes = 480; double overtimeWorkPerDayInMinutes = normalWorkPerDayInMinutes * overtimeFactor; work = new TimephasedWork(); work.setFinish(MPPUtility.getTimestampFromTenths(data, index + 16)); work.setStart(blockStartDate); work.setTotalAmount(Duration.getInstance(workThisPeriodInMinutes, TimeUnit.MINUTES)); work.setAmountPerDay(Duration.getInstance(normalWorkPerDayInMinutes + overtimeWorkPerDayInMinutes, TimeUnit.MINUTES)); previousCumulativeWorkPerformedInMinutes = cumulativeWorkInMinutes; if (list == null) { list = new LinkedList<TimephasedWork>(); } list.add(work); //System.out.println(work); } blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36); index += blockSize; } if (list != null) { if (work != null) { work.setFinish(assignment.getFinish()); } result = new DefaultTimephasedWorkContainer(calendar, normaliser, list, raw); } } return result; }
[ "public", "TimephasedWorkContainer", "getBaselineWork", "(", "ResourceAssignment", "assignment", ",", "ProjectCalendar", "calendar", ",", "TimephasedWorkNormaliser", "normaliser", ",", "byte", "[", "]", "data", ",", "boolean", "raw", ")", "{", "TimephasedWorkContainer", ...
Extracts baseline work from the MPP file for a specific baseline. Returns null if no baseline work is present, otherwise returns a list of timephased work items. @param assignment parent assignment @param calendar baseline calendar @param normaliser normaliser associated with this data @param data timephased baseline work data block @param raw flag indicating if this data is to be treated as raw @return timephased work
[ "Extracts", "baseline", "work", "from", "the", "MPP", "file", "for", "a", "specific", "baseline", ".", "Returns", "null", "if", "no", "baseline", "work", "is", "present", "otherwise", "returns", "a", "list", "of", "timephased", "work", "items", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L330-L392
train
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
TimephasedDataFactory.getBaselineCost
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw) { TimephasedCostContainer result = null; if (data != null && data.length > 0) { LinkedList<TimephasedCost> list = null; //System.out.println(ByteArrayHelper.hexdump(data, false)); int index = 16; // 16 byte header int blockSize = 20; double previousTotalCost = 0; Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16); index += blockSize; while (index + blockSize <= data.length) { Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16); double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100; if (!costEquals(previousTotalCost, currentTotalCost)) { TimephasedCost cost = new TimephasedCost(); cost.setStart(blockStartDate); cost.setFinish(blockEndDate); cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost)); if (list == null) { list = new LinkedList<TimephasedCost>(); } list.add(cost); //System.out.println(cost); previousTotalCost = currentTotalCost; } blockStartDate = blockEndDate; index += blockSize; } if (list != null) { result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw); } } return result; }
java
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw) { TimephasedCostContainer result = null; if (data != null && data.length > 0) { LinkedList<TimephasedCost> list = null; //System.out.println(ByteArrayHelper.hexdump(data, false)); int index = 16; // 16 byte header int blockSize = 20; double previousTotalCost = 0; Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16); index += blockSize; while (index + blockSize <= data.length) { Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16); double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100; if (!costEquals(previousTotalCost, currentTotalCost)) { TimephasedCost cost = new TimephasedCost(); cost.setStart(blockStartDate); cost.setFinish(blockEndDate); cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost)); if (list == null) { list = new LinkedList<TimephasedCost>(); } list.add(cost); //System.out.println(cost); previousTotalCost = currentTotalCost; } blockStartDate = blockEndDate; index += blockSize; } if (list != null) { result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw); } } return result; }
[ "public", "TimephasedCostContainer", "getBaselineCost", "(", "ProjectCalendar", "calendar", ",", "TimephasedCostNormaliser", "normaliser", ",", "byte", "[", "]", "data", ",", "boolean", "raw", ")", "{", "TimephasedCostContainer", "result", "=", "null", ";", "if", "(...
Extracts baseline cost from the MPP file for a specific baseline. Returns null if no baseline cost is present, otherwise returns a list of timephased work items. @param calendar baseline calendar @param normaliser normaliser associated with this data @param data timephased baseline work data block @param raw flag indicating if this data is to be treated as raw @return timephased work
[ "Extracts", "baseline", "cost", "from", "the", "MPP", "file", "for", "a", "specific", "baseline", ".", "Returns", "null", "if", "no", "baseline", "cost", "is", "present", "otherwise", "returns", "a", "list", "of", "timephased", "work", "items", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L405-L453
train
joniles/mpxj
src/main/java/net/sf/mpxj/common/SplitTaskFactory.java
SplitTaskFactory.processSplitData
public void processSplitData(Task task, List<TimephasedWork> timephasedComplete, List<TimephasedWork> timephasedPlanned) { Date splitsComplete = null; TimephasedWork lastComplete = null; TimephasedWork firstPlanned = null; if (!timephasedComplete.isEmpty()) { lastComplete = timephasedComplete.get(timephasedComplete.size() - 1); splitsComplete = lastComplete.getFinish(); } if (!timephasedPlanned.isEmpty()) { firstPlanned = timephasedPlanned.get(0); } LinkedList<DateRange> splits = new LinkedList<DateRange>(); TimephasedWork lastAssignment = null; DateRange lastRange = null; for (TimephasedWork assignment : timephasedComplete) { if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0) { splits.removeLast(); lastRange = new DateRange(lastRange.getStart(), assignment.getFinish()); } else { lastRange = new DateRange(assignment.getStart(), assignment.getFinish()); } splits.add(lastRange); lastAssignment = assignment; } // // We may not have a split, we may just have a partially // complete split. // Date splitStart = null; if (lastComplete != null && firstPlanned != null && lastComplete.getTotalAmount().getDuration() != 0 && firstPlanned.getTotalAmount().getDuration() != 0) { lastRange = splits.removeLast(); splitStart = lastRange.getStart(); } lastAssignment = null; lastRange = null; for (TimephasedWork assignment : timephasedPlanned) { if (splitStart == null) { if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0) { splits.removeLast(); lastRange = new DateRange(lastRange.getStart(), assignment.getFinish()); } else { lastRange = new DateRange(assignment.getStart(), assignment.getFinish()); } } else { lastRange = new DateRange(splitStart, assignment.getFinish()); } splits.add(lastRange); splitStart = null; lastAssignment = assignment; } // // We must have a minimum of 3 entries for this to be a valid split task // if (splits.size() > 2) { task.getSplits().addAll(splits); task.setSplitCompleteDuration(splitsComplete); } else { task.setSplits(null); task.setSplitCompleteDuration(null); } }
java
public void processSplitData(Task task, List<TimephasedWork> timephasedComplete, List<TimephasedWork> timephasedPlanned) { Date splitsComplete = null; TimephasedWork lastComplete = null; TimephasedWork firstPlanned = null; if (!timephasedComplete.isEmpty()) { lastComplete = timephasedComplete.get(timephasedComplete.size() - 1); splitsComplete = lastComplete.getFinish(); } if (!timephasedPlanned.isEmpty()) { firstPlanned = timephasedPlanned.get(0); } LinkedList<DateRange> splits = new LinkedList<DateRange>(); TimephasedWork lastAssignment = null; DateRange lastRange = null; for (TimephasedWork assignment : timephasedComplete) { if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0) { splits.removeLast(); lastRange = new DateRange(lastRange.getStart(), assignment.getFinish()); } else { lastRange = new DateRange(assignment.getStart(), assignment.getFinish()); } splits.add(lastRange); lastAssignment = assignment; } // // We may not have a split, we may just have a partially // complete split. // Date splitStart = null; if (lastComplete != null && firstPlanned != null && lastComplete.getTotalAmount().getDuration() != 0 && firstPlanned.getTotalAmount().getDuration() != 0) { lastRange = splits.removeLast(); splitStart = lastRange.getStart(); } lastAssignment = null; lastRange = null; for (TimephasedWork assignment : timephasedPlanned) { if (splitStart == null) { if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0) { splits.removeLast(); lastRange = new DateRange(lastRange.getStart(), assignment.getFinish()); } else { lastRange = new DateRange(assignment.getStart(), assignment.getFinish()); } } else { lastRange = new DateRange(splitStart, assignment.getFinish()); } splits.add(lastRange); splitStart = null; lastAssignment = assignment; } // // We must have a minimum of 3 entries for this to be a valid split task // if (splits.size() > 2) { task.getSplits().addAll(splits); task.setSplitCompleteDuration(splitsComplete); } else { task.setSplits(null); task.setSplitCompleteDuration(null); } }
[ "public", "void", "processSplitData", "(", "Task", "task", ",", "List", "<", "TimephasedWork", ">", "timephasedComplete", ",", "List", "<", "TimephasedWork", ">", "timephasedPlanned", ")", "{", "Date", "splitsComplete", "=", "null", ";", "TimephasedWork", "lastCom...
Process the timephased resource assignment data to work out the split structure of the task. @param task parent task @param timephasedComplete completed resource assignment work @param timephasedPlanned planned resource assignment work
[ "Process", "the", "timephased", "resource", "assignment", "data", "to", "work", "out", "the", "split", "structure", "of", "the", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/SplitTaskFactory.java#L48-L131
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.updateScheduleSource
private void updateScheduleSource(ProjectProperties properties) { // Rudimentary identification of schedule source if (properties.getCompany() != null && properties.getCompany().equals("Synchro Software Ltd")) { properties.setFileApplication("Synchro"); } else { if (properties.getAuthor() != null && properties.getAuthor().equals("SG Project")) { properties.setFileApplication("Simple Genius"); } else { properties.setFileApplication("Microsoft"); } } properties.setFileType("MSPDI"); }
java
private void updateScheduleSource(ProjectProperties properties) { // Rudimentary identification of schedule source if (properties.getCompany() != null && properties.getCompany().equals("Synchro Software Ltd")) { properties.setFileApplication("Synchro"); } else { if (properties.getAuthor() != null && properties.getAuthor().equals("SG Project")) { properties.setFileApplication("Simple Genius"); } else { properties.setFileApplication("Microsoft"); } } properties.setFileType("MSPDI"); }
[ "private", "void", "updateScheduleSource", "(", "ProjectProperties", "properties", ")", "{", "// Rudimentary identification of schedule source", "if", "(", "properties", ".", "getCompany", "(", ")", "!=", "null", "&&", "properties", ".", "getCompany", "(", ")", ".", ...
Populate the properties indicating the source of this schedule. @param properties project properties
[ "Populate", "the", "properties", "indicating", "the", "source", "of", "this", "schedule", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L357-L376
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readCalendars
private void readCalendars(Project project, HashMap<BigInteger, ProjectCalendar> map) { Project.Calendars calendars = project.getCalendars(); if (calendars != null) { LinkedList<Pair<ProjectCalendar, BigInteger>> baseCalendars = new LinkedList<Pair<ProjectCalendar, BigInteger>>(); for (Project.Calendars.Calendar cal : calendars.getCalendar()) { readCalendar(cal, map, baseCalendars); } updateBaseCalendarNames(baseCalendars, map); } try { ProjectProperties properties = m_projectFile.getProjectProperties(); BigInteger calendarID = new BigInteger(properties.getDefaultCalendarName()); ProjectCalendar calendar = map.get(calendarID); m_projectFile.setDefaultCalendar(calendar); } catch (Exception ex) { // Ignore exceptions } }
java
private void readCalendars(Project project, HashMap<BigInteger, ProjectCalendar> map) { Project.Calendars calendars = project.getCalendars(); if (calendars != null) { LinkedList<Pair<ProjectCalendar, BigInteger>> baseCalendars = new LinkedList<Pair<ProjectCalendar, BigInteger>>(); for (Project.Calendars.Calendar cal : calendars.getCalendar()) { readCalendar(cal, map, baseCalendars); } updateBaseCalendarNames(baseCalendars, map); } try { ProjectProperties properties = m_projectFile.getProjectProperties(); BigInteger calendarID = new BigInteger(properties.getDefaultCalendarName()); ProjectCalendar calendar = map.get(calendarID); m_projectFile.setDefaultCalendar(calendar); } catch (Exception ex) { // Ignore exceptions } }
[ "private", "void", "readCalendars", "(", "Project", "project", ",", "HashMap", "<", "BigInteger", ",", "ProjectCalendar", ">", "map", ")", "{", "Project", ".", "Calendars", "calendars", "=", "project", ".", "getCalendars", "(", ")", ";", "if", "(", "calendar...
This method extracts calendar data from an MSPDI file. @param project Root node of the MSPDI file @param map Map of calendar UIDs to names
[ "This", "method", "extracts", "calendar", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L384-L409
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.updateBaseCalendarNames
private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map) { for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); BigInteger baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = map.get(baseCalendarID); if (baseCal != null) { cal.setParent(baseCal); } } }
java
private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map) { for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); BigInteger baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = map.get(baseCalendarID); if (baseCal != null) { cal.setParent(baseCal); } } }
[ "private", "static", "void", "updateBaseCalendarNames", "(", "List", "<", "Pair", "<", "ProjectCalendar", ",", "BigInteger", ">", ">", "baseCalendars", ",", "HashMap", "<", "BigInteger", ",", "ProjectCalendar", ">", "map", ")", "{", "for", "(", "Pair", "<", ...
The way calendars are stored in an MSPDI file means that there can be forward references between the base calendar unique ID for a derived calendar, and the base calendar itself. To get around this, we initially populate the base calendar name attribute with the base calendar unique ID, and now in this method we can convert those ID values into the correct names. @param baseCalendars list of calendars and base calendar IDs @param map map of calendar ID values and calendar objects
[ "The", "way", "calendars", "are", "stored", "in", "an", "MSPDI", "file", "means", "that", "there", "can", "be", "forward", "references", "between", "the", "base", "calendar", "unique", "ID", "for", "a", "derived", "calendar", "and", "the", "base", "calendar"...
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L422-L435
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readCalendar
private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars) { ProjectCalendar bc = m_projectFile.addCalendar(); bc.setUniqueID(NumberHelper.getInteger(calendar.getUID())); bc.setName(calendar.getName()); BigInteger baseCalendarID = calendar.getBaseCalendarUID(); if (baseCalendarID != null) { baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID)); } readExceptions(calendar, bc); boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty(); Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays(); if (days != null) { for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay()) { readDay(bc, weekDay, readExceptionsFromDays); } } else { bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT); bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); } readWorkWeeks(calendar, bc); map.put(calendar.getUID(), bc); m_eventManager.fireCalendarReadEvent(bc); }
java
private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars) { ProjectCalendar bc = m_projectFile.addCalendar(); bc.setUniqueID(NumberHelper.getInteger(calendar.getUID())); bc.setName(calendar.getName()); BigInteger baseCalendarID = calendar.getBaseCalendarUID(); if (baseCalendarID != null) { baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID)); } readExceptions(calendar, bc); boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty(); Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays(); if (days != null) { for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay()) { readDay(bc, weekDay, readExceptionsFromDays); } } else { bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT); bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); } readWorkWeeks(calendar, bc); map.put(calendar.getUID(), bc); m_eventManager.fireCalendarReadEvent(bc); }
[ "private", "void", "readCalendar", "(", "Project", ".", "Calendars", ".", "Calendar", "calendar", ",", "HashMap", "<", "BigInteger", ",", "ProjectCalendar", ">", "map", ",", "List", "<", "Pair", "<", "ProjectCalendar", ",", "BigInteger", ">", ">", "baseCalenda...
This method extracts data for a single calendar from an MSPDI file. @param calendar Calendar data @param map Map of calendar UIDs to names @param baseCalendars list of base calendars
[ "This", "method", "extracts", "data", "for", "a", "single", "calendar", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L444-L482
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readDay
private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays) { BigInteger dayType = day.getDayType(); if (dayType != null) { if (dayType.intValue() == 0) { if (readExceptionsFromDays) { readExceptionDay(calendar, day); } } else { readNormalDay(calendar, day); } } }
java
private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays) { BigInteger dayType = day.getDayType(); if (dayType != null) { if (dayType.intValue() == 0) { if (readExceptionsFromDays) { readExceptionDay(calendar, day); } } else { readNormalDay(calendar, day); } } }
[ "private", "void", "readDay", "(", "ProjectCalendar", "calendar", ",", "Project", ".", "Calendars", ".", "Calendar", ".", "WeekDays", ".", "WeekDay", "day", ",", "boolean", "readExceptionsFromDays", ")", "{", "BigInteger", "dayType", "=", "day", ".", "getDayType...
This method extracts data for a single day from an MSPDI file. @param calendar Calendar data @param day Day data @param readExceptionsFromDays read exceptions form day definitions
[ "This", "method", "extracts", "data", "for", "a", "single", "day", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L491-L508
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readNormalDay
private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay) { int dayNumber = weekDay.getDayType().intValue(); Day day = Day.getInstance(dayNumber); calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking())); ProjectCalendarHours hours = calendar.addCalendarHours(day); Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes(); if (times != null) { for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime()) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } hours.addRange(new DateRange(startTime, endTime)); } } } }
java
private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay) { int dayNumber = weekDay.getDayType().intValue(); Day day = Day.getInstance(dayNumber); calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking())); ProjectCalendarHours hours = calendar.addCalendarHours(day); Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes(); if (times != null) { for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime()) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } hours.addRange(new DateRange(startTime, endTime)); } } } }
[ "private", "void", "readNormalDay", "(", "ProjectCalendar", "calendar", ",", "Project", ".", "Calendars", ".", "Calendar", ".", "WeekDays", ".", "WeekDay", "weekDay", ")", "{", "int", "dayNumber", "=", "weekDay", ".", "getDayType", "(", ")", ".", "intValue", ...
This method extracts data for a normal working day from an MSPDI file. @param calendar Calendar data @param weekDay Day data
[ "This", "method", "extracts", "data", "for", "a", "normal", "working", "day", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L516-L542
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readExceptionDay
private void readExceptionDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day) { Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod timePeriod = day.getTimePeriod(); Date fromDate = timePeriod.getFromDate(); Date toDate = timePeriod.getToDate(); Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = day.getWorkingTimes(); ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (times != null) { List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> time = times.getWorkingTime(); for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : time) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } exception.addRange(new DateRange(startTime, endTime)); } } } }
java
private void readExceptionDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day) { Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod timePeriod = day.getTimePeriod(); Date fromDate = timePeriod.getFromDate(); Date toDate = timePeriod.getToDate(); Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = day.getWorkingTimes(); ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate); if (times != null) { List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> time = times.getWorkingTime(); for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : time) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } exception.addRange(new DateRange(startTime, endTime)); } } } }
[ "private", "void", "readExceptionDay", "(", "ProjectCalendar", "calendar", ",", "Project", ".", "Calendars", ".", "Calendar", ".", "WeekDays", ".", "WeekDay", "day", ")", "{", "Project", ".", "Calendars", ".", "Calendar", ".", "WeekDays", ".", "WeekDay", ".", ...
This method extracts data for an exception day from an MSPDI file. @param calendar Calendar data @param day Day data
[ "This", "method", "extracts", "data", "for", "an", "exception", "day", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L550-L577
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readExceptions
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc) { Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions(); if (exceptions != null) { for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException()) { readException(bc, exception); } } }
java
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc) { Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions(); if (exceptions != null) { for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException()) { readException(bc, exception); } } }
[ "private", "void", "readExceptions", "(", "Project", ".", "Calendars", ".", "Calendar", "calendar", ",", "ProjectCalendar", "bc", ")", "{", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", "exceptions", "=", "calendar", ".", "getExceptions", "(",...
Reads any exceptions present in the file. This is only used in MSPDI file versions saved by Project 2007 and later. @param calendar XML calendar @param bc MPXJ calendar
[ "Reads", "any", "exceptions", "present", "in", "the", "file", ".", "This", "is", "only", "used", "in", "MSPDI", "file", "versions", "saved", "by", "Project", "2007", "and", "later", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L586-L596
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readException
private void readException(ProjectCalendar bc, Project.Calendars.Calendar.Exceptions.Exception exception) { Date fromDate = exception.getTimePeriod().getFromDate(); Date toDate = exception.getTimePeriod().getToDate(); // Vico Schedule Planner seems to write start and end dates to FromTime and ToTime // rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project // so we will ignore it too! if (fromDate != null && toDate != null) { ProjectCalendarException bce = bc.addCalendarException(fromDate, toDate); bce.setName(exception.getName()); readRecurringData(bce, exception); Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = exception.getWorkingTimes(); if (times != null) { List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> time = times.getWorkingTime(); for (Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime period : time) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } bce.addRange(new DateRange(startTime, endTime)); } } } } }
java
private void readException(ProjectCalendar bc, Project.Calendars.Calendar.Exceptions.Exception exception) { Date fromDate = exception.getTimePeriod().getFromDate(); Date toDate = exception.getTimePeriod().getToDate(); // Vico Schedule Planner seems to write start and end dates to FromTime and ToTime // rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project // so we will ignore it too! if (fromDate != null && toDate != null) { ProjectCalendarException bce = bc.addCalendarException(fromDate, toDate); bce.setName(exception.getName()); readRecurringData(bce, exception); Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = exception.getWorkingTimes(); if (times != null) { List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> time = times.getWorkingTime(); for (Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime period : time) { Date startTime = period.getFromTime(); Date endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } bce.addRange(new DateRange(startTime, endTime)); } } } } }
[ "private", "void", "readException", "(", "ProjectCalendar", "bc", ",", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", ".", "Exception", "exception", ")", "{", "Date", "fromDate", "=", "exception", ".", "getTimePeriod", "(", ")", ".", "getFrom...
Read a single calendar exception. @param bc parent calendar @param exception exception data
[ "Read", "a", "single", "calendar", "exception", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L604-L638
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readRecurringData
private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception) { RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType())); if (rt != null) { RecurringData rd = new RecurringData(); rd.setStartDate(bce.getFromDate()); rd.setFinishDate(bce.getToDate()); rd.setRecurrenceType(rt); rd.setRelative(getRelative(NumberHelper.getInt(exception.getType()))); rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences())); switch (rd.getRecurrenceType()) { case DAILY: { rd.setFrequency(getFrequency(exception)); break; } case WEEKLY: { rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS); rd.setFrequency(getFrequency(exception)); break; } case MONTHLY: { if (rd.getRelative()) { rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2)); rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1)); } else { rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay())); } rd.setFrequency(getFrequency(exception)); break; } case YEARLY: { if (rd.getRelative()) { rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2)); rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1)); } else { rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay())); } rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1)); break; } } if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1) { bce.setRecurring(rd); } } }
java
private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception) { RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType())); if (rt != null) { RecurringData rd = new RecurringData(); rd.setStartDate(bce.getFromDate()); rd.setFinishDate(bce.getToDate()); rd.setRecurrenceType(rt); rd.setRelative(getRelative(NumberHelper.getInt(exception.getType()))); rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences())); switch (rd.getRecurrenceType()) { case DAILY: { rd.setFrequency(getFrequency(exception)); break; } case WEEKLY: { rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS); rd.setFrequency(getFrequency(exception)); break; } case MONTHLY: { if (rd.getRelative()) { rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2)); rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1)); } else { rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay())); } rd.setFrequency(getFrequency(exception)); break; } case YEARLY: { if (rd.getRelative()) { rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2)); rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1)); } else { rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay())); } rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1)); break; } } if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1) { bce.setRecurring(rd); } } }
[ "private", "void", "readRecurringData", "(", "ProjectCalendarException", "bce", ",", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", ".", "Exception", "exception", ")", "{", "RecurrenceType", "rt", "=", "getRecurrenceType", "(", "NumberHelper", ".",...
Read recurring data for a calendar exception. @param bce MPXJ calendar exception @param exception XML calendar exception
[ "Read", "recurring", "data", "for", "a", "calendar", "exception", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L646-L709
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.getFrequency
private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception) { Integer period = NumberHelper.getInteger(exception.getPeriod()); if (period == null) { period = Integer.valueOf(1); } return period; }
java
private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception) { Integer period = NumberHelper.getInteger(exception.getPeriod()); if (period == null) { period = Integer.valueOf(1); } return period; }
[ "private", "Integer", "getFrequency", "(", "Project", ".", "Calendars", ".", "Calendar", ".", "Exceptions", ".", "Exception", "exception", ")", "{", "Integer", "period", "=", "NumberHelper", ".", "getInteger", "(", "exception", ".", "getPeriod", "(", ")", ")",...
Retrieve the frequency of an exception. @param exception XML calendar exception @return frequency
[ "Retrieve", "the", "frequency", "of", "an", "exception", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L759-L767
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readWorkWeeks
private void readWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar) { WorkWeeks ww = xmlCalendar.getWorkWeeks(); if (ww != null) { for (WorkWeek xmlWeek : ww.getWorkWeek()) { ProjectCalendarWeek week = mpxjCalendar.addWorkWeek(); week.setName(xmlWeek.getName()); Date startTime = xmlWeek.getTimePeriod().getFromDate(); Date endTime = xmlWeek.getTimePeriod().getToDate(); week.setDateRange(new DateRange(startTime, endTime)); WeekDays xmlWeekDays = xmlWeek.getWeekDays(); if (xmlWeekDays != null) { for (WeekDay xmlWeekDay : xmlWeekDays.getWeekDay()) { int dayNumber = xmlWeekDay.getDayType().intValue(); Day day = Day.getInstance(dayNumber); week.setWorkingDay(day, BooleanHelper.getBoolean(xmlWeekDay.isDayWorking())); ProjectCalendarHours hours = week.addCalendarHours(day); Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = xmlWeekDay.getWorkingTimes(); if (times != null) { for (Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime()) { startTime = period.getFromTime(); endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } hours.addRange(new DateRange(startTime, endTime)); } } } } } } } }
java
private void readWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar) { WorkWeeks ww = xmlCalendar.getWorkWeeks(); if (ww != null) { for (WorkWeek xmlWeek : ww.getWorkWeek()) { ProjectCalendarWeek week = mpxjCalendar.addWorkWeek(); week.setName(xmlWeek.getName()); Date startTime = xmlWeek.getTimePeriod().getFromDate(); Date endTime = xmlWeek.getTimePeriod().getToDate(); week.setDateRange(new DateRange(startTime, endTime)); WeekDays xmlWeekDays = xmlWeek.getWeekDays(); if (xmlWeekDays != null) { for (WeekDay xmlWeekDay : xmlWeekDays.getWeekDay()) { int dayNumber = xmlWeekDay.getDayType().intValue(); Day day = Day.getInstance(dayNumber); week.setWorkingDay(day, BooleanHelper.getBoolean(xmlWeekDay.isDayWorking())); ProjectCalendarHours hours = week.addCalendarHours(day); Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = xmlWeekDay.getWorkingTimes(); if (times != null) { for (Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime()) { startTime = period.getFromTime(); endTime = period.getToTime(); if (startTime != null && endTime != null) { if (startTime.getTime() >= endTime.getTime()) { endTime = DateHelper.addDays(endTime, 1); } hours.addRange(new DateRange(startTime, endTime)); } } } } } } } }
[ "private", "void", "readWorkWeeks", "(", "Project", ".", "Calendars", ".", "Calendar", "xmlCalendar", ",", "ProjectCalendar", "mpxjCalendar", ")", "{", "WorkWeeks", "ww", "=", "xmlCalendar", ".", "getWorkWeeks", "(", ")", ";", "if", "(", "ww", "!=", "null", ...
Read the work weeks associated with this calendar. @param xmlCalendar XML calendar object @param mpxjCalendar MPXJ calendar object
[ "Read", "the", "work", "weeks", "associated", "with", "this", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L775-L821
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readProjectExtendedAttributes
private void readProjectExtendedAttributes(Project project) { Project.ExtendedAttributes attributes = project.getExtendedAttributes(); if (attributes != null) { for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute()) { readFieldAlias(ea); } } }
java
private void readProjectExtendedAttributes(Project project) { Project.ExtendedAttributes attributes = project.getExtendedAttributes(); if (attributes != null) { for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute()) { readFieldAlias(ea); } } }
[ "private", "void", "readProjectExtendedAttributes", "(", "Project", "project", ")", "{", "Project", ".", "ExtendedAttributes", "attributes", "=", "project", ".", "getExtendedAttributes", "(", ")", ";", "if", "(", "attributes", "!=", "null", ")", "{", "for", "(",...
This method extracts project extended attribute data from an MSPDI file. @param project Root node of the MSPDI file
[ "This", "method", "extracts", "project", "extended", "attribute", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L828-L838
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readFieldAlias
private void readFieldAlias(Project.ExtendedAttributes.ExtendedAttribute attribute) { String alias = attribute.getAlias(); if (alias != null && alias.length() != 0) { FieldType field = FieldTypeHelper.getInstance(Integer.parseInt(attribute.getFieldID())); m_projectFile.getCustomFields().getCustomField(field).setAlias(attribute.getAlias()); } }
java
private void readFieldAlias(Project.ExtendedAttributes.ExtendedAttribute attribute) { String alias = attribute.getAlias(); if (alias != null && alias.length() != 0) { FieldType field = FieldTypeHelper.getInstance(Integer.parseInt(attribute.getFieldID())); m_projectFile.getCustomFields().getCustomField(field).setAlias(attribute.getAlias()); } }
[ "private", "void", "readFieldAlias", "(", "Project", ".", "ExtendedAttributes", ".", "ExtendedAttribute", "attribute", ")", "{", "String", "alias", "=", "attribute", ".", "getAlias", "(", ")", ";", "if", "(", "alias", "!=", "null", "&&", "alias", ".", "lengt...
Read a single field alias from an extended attribute. @param attribute extended attribute
[ "Read", "a", "single", "field", "alias", "from", "an", "extended", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L845-L853
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readResources
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap) { Project.Resources resources = project.getResources(); if (resources != null) { for (Project.Resources.Resource resource : resources.getResource()) { readResource(resource, calendarMap); } } }
java
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap) { Project.Resources resources = project.getResources(); if (resources != null) { for (Project.Resources.Resource resource : resources.getResource()) { readResource(resource, calendarMap); } } }
[ "private", "void", "readResources", "(", "Project", "project", ",", "HashMap", "<", "BigInteger", ",", "ProjectCalendar", ">", "calendarMap", ")", "{", "Project", ".", "Resources", "resources", "=", "project", ".", "getResources", "(", ")", ";", "if", "(", "...
This method extracts resource data from an MSPDI file. @param project Root node of the MSPDI file @param calendarMap Map of calendar UIDs to names
[ "This", "method", "extracts", "resource", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L861-L871
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readResourceBaselines
private void readResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource) { for (Project.Resources.Resource.Baseline baseline : xmlResource.getBaseline()) { int number = NumberHelper.getInt(baseline.getNumber()); Double cost = DatatypeConverter.parseCurrency(baseline.getCost()); Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork()); if (number == 0) { mpxjResource.setBaselineCost(cost); mpxjResource.setBaselineWork(work); } else { mpxjResource.setBaselineCost(number, cost); mpxjResource.setBaselineWork(number, work); } } }
java
private void readResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource) { for (Project.Resources.Resource.Baseline baseline : xmlResource.getBaseline()) { int number = NumberHelper.getInt(baseline.getNumber()); Double cost = DatatypeConverter.parseCurrency(baseline.getCost()); Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork()); if (number == 0) { mpxjResource.setBaselineCost(cost); mpxjResource.setBaselineWork(work); } else { mpxjResource.setBaselineCost(number, cost); mpxjResource.setBaselineWork(number, work); } } }
[ "private", "void", "readResourceBaselines", "(", "Project", ".", "Resources", ".", "Resource", "xmlResource", ",", "Resource", "mpxjResource", ")", "{", "for", "(", "Project", ".", "Resources", ".", "Resource", ".", "Baseline", "baseline", ":", "xmlResource", "....
Reads baseline values for the current resource. @param xmlResource MSPDI resource instance @param mpxjResource MPXJ resource instance
[ "Reads", "baseline", "values", "for", "the", "current", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L978-L998
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readResourceExtendedAttributes
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx) { for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
java
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx) { for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
[ "private", "void", "readResourceExtendedAttributes", "(", "Project", ".", "Resources", ".", "Resource", "xml", ",", "Resource", "mpx", ")", "{", "for", "(", "Project", ".", "Resources", ".", "Resource", ".", "ExtendedAttribute", "attrib", ":", "xml", ".", "get...
This method processes any extended attributes associated with a resource. @param xml MSPDI resource instance @param mpx MPX resource instance
[ "This", "method", "processes", "any", "extended", "attributes", "associated", "with", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1006-L1015
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readCostRateTables
private void readCostRateTables(Resource resource, Rates rates) { if (rates == null) { CostRateTable table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(0, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(1, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(2, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(3, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(4, table); } else { Set<CostRateTable> tables = new HashSet<CostRateTable>(); for (net.sf.mpxj.mspdi.schema.Project.Resources.Resource.Rates.Rate rate : rates.getRate()) { Rate standardRate = DatatypeConverter.parseRate(rate.getStandardRate()); TimeUnit standardRateFormat = DatatypeConverter.parseTimeUnit(rate.getStandardRateFormat()); Rate overtimeRate = DatatypeConverter.parseRate(rate.getOvertimeRate()); TimeUnit overtimeRateFormat = DatatypeConverter.parseTimeUnit(rate.getOvertimeRateFormat()); Double costPerUse = DatatypeConverter.parseCurrency(rate.getCostPerUse()); Date endDate = rate.getRatesTo(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); int tableIndex = rate.getRateTable().intValue(); CostRateTable table = resource.getCostRateTable(tableIndex); if (table == null) { table = new CostRateTable(); resource.setCostRateTable(tableIndex, table); } table.add(entry); tables.add(table); } for (CostRateTable table : tables) { Collections.sort(table); } } }
java
private void readCostRateTables(Resource resource, Rates rates) { if (rates == null) { CostRateTable table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(0, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(1, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(2, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(3, table); table = new CostRateTable(); table.add(CostRateTableEntry.DEFAULT_ENTRY); resource.setCostRateTable(4, table); } else { Set<CostRateTable> tables = new HashSet<CostRateTable>(); for (net.sf.mpxj.mspdi.schema.Project.Resources.Resource.Rates.Rate rate : rates.getRate()) { Rate standardRate = DatatypeConverter.parseRate(rate.getStandardRate()); TimeUnit standardRateFormat = DatatypeConverter.parseTimeUnit(rate.getStandardRateFormat()); Rate overtimeRate = DatatypeConverter.parseRate(rate.getOvertimeRate()); TimeUnit overtimeRateFormat = DatatypeConverter.parseTimeUnit(rate.getOvertimeRateFormat()); Double costPerUse = DatatypeConverter.parseCurrency(rate.getCostPerUse()); Date endDate = rate.getRatesTo(); CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate); int tableIndex = rate.getRateTable().intValue(); CostRateTable table = resource.getCostRateTable(tableIndex); if (table == null) { table = new CostRateTable(); resource.setCostRateTable(tableIndex, table); } table.add(entry); tables.add(table); } for (CostRateTable table : tables) { Collections.sort(table); } } }
[ "private", "void", "readCostRateTables", "(", "Resource", "resource", ",", "Rates", "rates", ")", "{", "if", "(", "rates", "==", "null", ")", "{", "CostRateTable", "table", "=", "new", "CostRateTable", "(", ")", ";", "table", ".", "add", "(", "CostRateTabl...
Reads the cost rate tables from the file. @param resource parent resource @param rates XML cot rate tables
[ "Reads", "the", "cost", "rate", "tables", "from", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1023-L1078
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readAvailabilityTable
private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods) { if (periods != null) { AvailabilityTable table = resource.getAvailability(); List<AvailabilityPeriod> list = periods.getAvailabilityPeriod(); for (AvailabilityPeriod period : list) { Date start = period.getAvailableFrom(); Date end = period.getAvailableTo(); Number units = DatatypeConverter.parseUnits(period.getAvailableUnits()); Availability availability = new Availability(start, end, units); table.add(availability); } Collections.sort(table); } }
java
private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods) { if (periods != null) { AvailabilityTable table = resource.getAvailability(); List<AvailabilityPeriod> list = periods.getAvailabilityPeriod(); for (AvailabilityPeriod period : list) { Date start = period.getAvailableFrom(); Date end = period.getAvailableTo(); Number units = DatatypeConverter.parseUnits(period.getAvailableUnits()); Availability availability = new Availability(start, end, units); table.add(availability); } Collections.sort(table); } }
[ "private", "void", "readAvailabilityTable", "(", "Resource", "resource", ",", "AvailabilityPeriods", "periods", ")", "{", "if", "(", "periods", "!=", "null", ")", "{", "AvailabilityTable", "table", "=", "resource", ".", "getAvailability", "(", ")", ";", "List", ...
Reads the availability table from the file. @param resource MPXJ resource instance @param periods MSPDI availability periods
[ "Reads", "the", "availability", "table", "from", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1086-L1102
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readTasks
private void readTasks(Project project) { Project.Tasks tasks = project.getTasks(); if (tasks != null) { int tasksWithoutIDCount = 0; for (Project.Tasks.Task task : tasks.getTask()) { Task mpxjTask = readTask(task); if (mpxjTask.getID() == null) { ++tasksWithoutIDCount; } } for (Project.Tasks.Task task : tasks.getTask()) { readPredecessors(task); } // // MS Project will happily read tasks from an MSPDI file without IDs, // it will just generate ID values based on the task order in the file. // If we find that there are no ID values present, we'll do the same. // if (tasksWithoutIDCount == tasks.getTask().size()) { m_projectFile.getTasks().renumberIDs(); } } m_projectFile.updateStructure(); }
java
private void readTasks(Project project) { Project.Tasks tasks = project.getTasks(); if (tasks != null) { int tasksWithoutIDCount = 0; for (Project.Tasks.Task task : tasks.getTask()) { Task mpxjTask = readTask(task); if (mpxjTask.getID() == null) { ++tasksWithoutIDCount; } } for (Project.Tasks.Task task : tasks.getTask()) { readPredecessors(task); } // // MS Project will happily read tasks from an MSPDI file without IDs, // it will just generate ID values based on the task order in the file. // If we find that there are no ID values present, we'll do the same. // if (tasksWithoutIDCount == tasks.getTask().size()) { m_projectFile.getTasks().renumberIDs(); } } m_projectFile.updateStructure(); }
[ "private", "void", "readTasks", "(", "Project", "project", ")", "{", "Project", ".", "Tasks", "tasks", "=", "project", ".", "getTasks", "(", ")", ";", "if", "(", "tasks", "!=", "null", ")", "{", "int", "tasksWithoutIDCount", "=", "0", ";", "for", "(", ...
This method extracts task data from an MSPDI file. @param project Root node of the MSPDI file
[ "This", "method", "extracts", "task", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1109-L1142
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.updateProjectProperties
private void updateProjectProperties(Task task) { ProjectProperties props = m_projectFile.getProjectProperties(); props.setComments(task.getNotes()); }
java
private void updateProjectProperties(Task task) { ProjectProperties props = m_projectFile.getProjectProperties(); props.setComments(task.getNotes()); }
[ "private", "void", "updateProjectProperties", "(", "Task", "task", ")", "{", "ProjectProperties", "props", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "props", ".", "setComments", "(", "task", ".", "getNotes", "(", ")", ")", ";", "}" ]
Update the project properties from the project summary task. @param task project summary task
[ "Update", "the", "project", "properties", "from", "the", "project", "summary", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1363-L1367
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readTaskBaselines
private void readTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask, TimeUnit durationFormat) { for (Project.Tasks.Task.Baseline baseline : xmlTask.getBaseline()) { int number = NumberHelper.getInt(baseline.getNumber()); Double cost = DatatypeConverter.parseCurrency(baseline.getCost()); Duration duration = DatatypeConverter.parseDuration(m_projectFile, durationFormat, baseline.getDuration()); Date finish = baseline.getFinish(); Date start = baseline.getStart(); Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork()); if (number == 0) { mpxjTask.setBaselineCost(cost); mpxjTask.setBaselineDuration(duration); mpxjTask.setBaselineFinish(finish); mpxjTask.setBaselineStart(start); mpxjTask.setBaselineWork(work); } else { mpxjTask.setBaselineCost(number, cost); mpxjTask.setBaselineDuration(number, duration); mpxjTask.setBaselineFinish(number, finish); mpxjTask.setBaselineStart(number, start); mpxjTask.setBaselineWork(number, work); } } }
java
private void readTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask, TimeUnit durationFormat) { for (Project.Tasks.Task.Baseline baseline : xmlTask.getBaseline()) { int number = NumberHelper.getInt(baseline.getNumber()); Double cost = DatatypeConverter.parseCurrency(baseline.getCost()); Duration duration = DatatypeConverter.parseDuration(m_projectFile, durationFormat, baseline.getDuration()); Date finish = baseline.getFinish(); Date start = baseline.getStart(); Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork()); if (number == 0) { mpxjTask.setBaselineCost(cost); mpxjTask.setBaselineDuration(duration); mpxjTask.setBaselineFinish(finish); mpxjTask.setBaselineStart(start); mpxjTask.setBaselineWork(work); } else { mpxjTask.setBaselineCost(number, cost); mpxjTask.setBaselineDuration(number, duration); mpxjTask.setBaselineFinish(number, finish); mpxjTask.setBaselineStart(number, start); mpxjTask.setBaselineWork(number, work); } } }
[ "private", "void", "readTaskBaselines", "(", "Project", ".", "Tasks", ".", "Task", "xmlTask", ",", "Task", "mpxjTask", ",", "TimeUnit", "durationFormat", ")", "{", "for", "(", "Project", ".", "Tasks", ".", "Task", ".", "Baseline", "baseline", ":", "xmlTask",...
Reads baseline values for the current task. @param xmlTask MSPDI task instance @param mpxjTask MPXJ task instance @param durationFormat duration format to use
[ "Reads", "baseline", "values", "for", "the", "current", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1407-L1436
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readTaskExtendedAttributes
private void readTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx) { for (Project.Tasks.Task.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; TaskField mpxFieldID = MPPTaskField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
java
private void readTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx) { for (Project.Tasks.Task.ExtendedAttribute attrib : xml.getExtendedAttribute()) { int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF; TaskField mpxFieldID = MPPTaskField.getInstance(xmlFieldID); TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null); DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat); } }
[ "private", "void", "readTaskExtendedAttributes", "(", "Project", ".", "Tasks", ".", "Task", "xml", ",", "Task", "mpx", ")", "{", "for", "(", "Project", ".", "Tasks", ".", "Task", ".", "ExtendedAttribute", "attrib", ":", "xml", ".", "getExtendedAttribute", "(...
This method processes any extended attributes associated with a task. @param xml MSPDI task instance @param mpx MPX task instance
[ "This", "method", "processes", "any", "extended", "attributes", "associated", "with", "a", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1444-L1453
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.getTaskCalendar
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task) { ProjectCalendar calendar = null; BigInteger calendarID = task.getCalendarUID(); if (calendarID != null) { calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue())); } return (calendar); }
java
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task) { ProjectCalendar calendar = null; BigInteger calendarID = task.getCalendarUID(); if (calendarID != null) { calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue())); } return (calendar); }
[ "private", "ProjectCalendar", "getTaskCalendar", "(", "Project", ".", "Tasks", ".", "Task", "task", ")", "{", "ProjectCalendar", "calendar", "=", "null", ";", "BigInteger", "calendarID", "=", "task", ".", "getCalendarUID", "(", ")", ";", "if", "(", "calendarID...
This method is used to retrieve the calendar associated with a task. If no calendar is associated with a task, this method returns null. @param task MSPDI task @return calendar instance
[ "This", "method", "is", "used", "to", "retrieve", "the", "calendar", "associated", "with", "a", "task", ".", "If", "no", "calendar", "is", "associated", "with", "a", "task", "this", "method", "returns", "null", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1463-L1474
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readPredecessors
private void readPredecessors(Project.Tasks.Task task) { Integer uid = task.getUID(); if (uid != null) { Task currTask = m_projectFile.getTaskByUniqueID(uid); if (currTask != null) { for (Project.Tasks.Task.PredecessorLink link : task.getPredecessorLink()) { readPredecessor(currTask, link); } } } }
java
private void readPredecessors(Project.Tasks.Task task) { Integer uid = task.getUID(); if (uid != null) { Task currTask = m_projectFile.getTaskByUniqueID(uid); if (currTask != null) { for (Project.Tasks.Task.PredecessorLink link : task.getPredecessorLink()) { readPredecessor(currTask, link); } } } }
[ "private", "void", "readPredecessors", "(", "Project", ".", "Tasks", ".", "Task", "task", ")", "{", "Integer", "uid", "=", "task", ".", "getUID", "(", ")", ";", "if", "(", "uid", "!=", "null", ")", "{", "Task", "currTask", "=", "m_projectFile", ".", ...
This method extracts predecessor data from an MSPDI file. @param task Task data
[ "This", "method", "extracts", "predecessor", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1481-L1495
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readPredecessor
private void readPredecessor(Task currTask, Project.Tasks.Task.PredecessorLink link) { BigInteger uid = link.getPredecessorUID(); if (uid != null) { Task prevTask = m_projectFile.getTaskByUniqueID(Integer.valueOf(uid.intValue())); if (prevTask != null) { RelationType type; if (link.getType() != null) { type = RelationType.getInstance(link.getType().intValue()); } else { type = RelationType.FINISH_START; } TimeUnit lagUnits = DatatypeConverter.parseDurationTimeUnits(link.getLagFormat()); Duration lagDuration; int lag = NumberHelper.getInt(link.getLinkLag()); if (lag == 0) { lagDuration = Duration.getInstance(0, lagUnits); } else { if (lagUnits == TimeUnit.PERCENT || lagUnits == TimeUnit.ELAPSED_PERCENT) { lagDuration = Duration.getInstance(lag, lagUnits); } else { lagDuration = Duration.convertUnits(lag / 10.0, TimeUnit.MINUTES, lagUnits, m_projectFile.getProjectProperties()); } } Relation relation = currTask.addPredecessor(prevTask, type, lagDuration); m_eventManager.fireRelationReadEvent(relation); } } }
java
private void readPredecessor(Task currTask, Project.Tasks.Task.PredecessorLink link) { BigInteger uid = link.getPredecessorUID(); if (uid != null) { Task prevTask = m_projectFile.getTaskByUniqueID(Integer.valueOf(uid.intValue())); if (prevTask != null) { RelationType type; if (link.getType() != null) { type = RelationType.getInstance(link.getType().intValue()); } else { type = RelationType.FINISH_START; } TimeUnit lagUnits = DatatypeConverter.parseDurationTimeUnits(link.getLagFormat()); Duration lagDuration; int lag = NumberHelper.getInt(link.getLinkLag()); if (lag == 0) { lagDuration = Duration.getInstance(0, lagUnits); } else { if (lagUnits == TimeUnit.PERCENT || lagUnits == TimeUnit.ELAPSED_PERCENT) { lagDuration = Duration.getInstance(lag, lagUnits); } else { lagDuration = Duration.convertUnits(lag / 10.0, TimeUnit.MINUTES, lagUnits, m_projectFile.getProjectProperties()); } } Relation relation = currTask.addPredecessor(prevTask, type, lagDuration); m_eventManager.fireRelationReadEvent(relation); } } }
[ "private", "void", "readPredecessor", "(", "Task", "currTask", ",", "Project", ".", "Tasks", ".", "Task", ".", "PredecessorLink", "link", ")", "{", "BigInteger", "uid", "=", "link", ".", "getPredecessorUID", "(", ")", ";", "if", "(", "uid", "!=", "null", ...
This method extracts data for a single predecessor from an MSPDI file. @param currTask Current task object @param link Predecessor data
[ "This", "method", "extracts", "data", "for", "a", "single", "predecessor", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1503-L1545
train
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
MSPDIReader.readAssignments
private void readAssignments(Project project) { Project.Assignments assignments = project.getAssignments(); if (assignments != null) { SplitTaskFactory splitFactory = new SplitTaskFactory(); TimephasedWorkNormaliser normaliser = new MSPDITimephasedWorkNormaliser(); for (Project.Assignments.Assignment assignment : assignments.getAssignment()) { readAssignment(assignment, splitFactory, normaliser); } } }
java
private void readAssignments(Project project) { Project.Assignments assignments = project.getAssignments(); if (assignments != null) { SplitTaskFactory splitFactory = new SplitTaskFactory(); TimephasedWorkNormaliser normaliser = new MSPDITimephasedWorkNormaliser(); for (Project.Assignments.Assignment assignment : assignments.getAssignment()) { readAssignment(assignment, splitFactory, normaliser); } } }
[ "private", "void", "readAssignments", "(", "Project", "project", ")", "{", "Project", ".", "Assignments", "assignments", "=", "project", ".", "getAssignments", "(", ")", ";", "if", "(", "assignments", "!=", "null", ")", "{", "SplitTaskFactory", "splitFactory", ...
This method extracts assignment data from an MSPDI file. @param project Root node of the MSPDI file
[ "This", "method", "extracts", "assignment", "data", "from", "an", "MSPDI", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1552-L1564
train