id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
157,200
joniles/mpxj
src/main/java/net/sf/mpxj/utility/TimephasedUtility.java
TimephasedUtility.segmentBaselineWork
public ArrayList<Duration> segmentBaselineWork(ProjectFile file, List<TimephasedWork> work, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { return segmentWork(file.getBaselineCalendar(), work, rangeUnits, dateList); }
java
public ArrayList<Duration> segmentBaselineWork(ProjectFile file, List<TimephasedWork> work, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { return segmentWork(file.getBaselineCalendar(), work, rangeUnits, dateList); }
[ "public", "ArrayList", "<", "Duration", ">", "segmentBaselineWork", "(", "ProjectFile", "file", ",", "List", "<", "TimephasedWork", ">", "work", ",", "TimescaleUnits", "rangeUnits", ",", "ArrayList", "<", "DateRange", ">", "dateList", ")", "{", "return", "segmentWork", "(", "file", ".", "getBaselineCalendar", "(", ")", ",", "work", ",", "rangeUnits", ",", "dateList", ")", ";", "}" ]
This is the main entry point used to convert the internal representation of timephased baseline work into an external form which can be displayed to the user. @param file parent project file @param work timephased resource assignment data @param rangeUnits timescale units @param dateList timescale date ranges @return list of durations, one per timescale date range
[ "This", "is", "the", "main", "entry", "point", "used", "to", "convert", "the", "internal", "representation", "of", "timephased", "baseline", "work", "into", "an", "external", "form", "which", "can", "be", "displayed", "to", "the", "user", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L108-L111
157,201
joniles/mpxj
src/main/java/net/sf/mpxj/utility/TimephasedUtility.java
TimephasedUtility.segmentCost
public ArrayList<Double> segmentCost(ProjectCalendar projectCalendar, List<TimephasedCost> cost, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { ArrayList<Double> result = new ArrayList<Double>(dateList.size()); int lastStartIndex = 0; // // Iterate through the list of dates range we are interested in. // Each date range in this list corresponds to a column // shown on the "timescale" view by MS Project // for (DateRange range : dateList) { // // If the current date range does not intersect with any of the // assignment date ranges in the list, then we show a zero // duration for this date range. // int startIndex = lastStartIndex == -1 ? -1 : getStartIndex(range, cost, lastStartIndex); if (startIndex == -1) { result.add(NumberHelper.DOUBLE_ZERO); } else { // // We have found an assignment which intersects with the current // date range, call the method below to determine how // much time from this resource assignment can be allocated // to the current date range. // result.add(getRangeCost(projectCalendar, rangeUnits, range, cost, startIndex)); lastStartIndex = startIndex; } } return result; }
java
public ArrayList<Double> segmentCost(ProjectCalendar projectCalendar, List<TimephasedCost> cost, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { ArrayList<Double> result = new ArrayList<Double>(dateList.size()); int lastStartIndex = 0; // // Iterate through the list of dates range we are interested in. // Each date range in this list corresponds to a column // shown on the "timescale" view by MS Project // for (DateRange range : dateList) { // // If the current date range does not intersect with any of the // assignment date ranges in the list, then we show a zero // duration for this date range. // int startIndex = lastStartIndex == -1 ? -1 : getStartIndex(range, cost, lastStartIndex); if (startIndex == -1) { result.add(NumberHelper.DOUBLE_ZERO); } else { // // We have found an assignment which intersects with the current // date range, call the method below to determine how // much time from this resource assignment can be allocated // to the current date range. // result.add(getRangeCost(projectCalendar, rangeUnits, range, cost, startIndex)); lastStartIndex = startIndex; } } return result; }
[ "public", "ArrayList", "<", "Double", ">", "segmentCost", "(", "ProjectCalendar", "projectCalendar", ",", "List", "<", "TimephasedCost", ">", "cost", ",", "TimescaleUnits", "rangeUnits", ",", "ArrayList", "<", "DateRange", ">", "dateList", ")", "{", "ArrayList", "<", "Double", ">", "result", "=", "new", "ArrayList", "<", "Double", ">", "(", "dateList", ".", "size", "(", ")", ")", ";", "int", "lastStartIndex", "=", "0", ";", "//", "// Iterate through the list of dates range we are interested in.", "// Each date range in this list corresponds to a column", "// shown on the \"timescale\" view by MS Project", "//", "for", "(", "DateRange", "range", ":", "dateList", ")", "{", "//", "// If the current date range does not intersect with any of the", "// assignment date ranges in the list, then we show a zero", "// duration for this date range.", "//", "int", "startIndex", "=", "lastStartIndex", "==", "-", "1", "?", "-", "1", ":", "getStartIndex", "(", "range", ",", "cost", ",", "lastStartIndex", ")", ";", "if", "(", "startIndex", "==", "-", "1", ")", "{", "result", ".", "add", "(", "NumberHelper", ".", "DOUBLE_ZERO", ")", ";", "}", "else", "{", "//", "// We have found an assignment which intersects with the current", "// date range, call the method below to determine how", "// much time from this resource assignment can be allocated", "// to the current date range.", "//", "result", ".", "add", "(", "getRangeCost", "(", "projectCalendar", ",", "rangeUnits", ",", "range", ",", "cost", ",", "startIndex", ")", ")", ";", "lastStartIndex", "=", "startIndex", ";", "}", "}", "return", "result", ";", "}" ]
This is the main entry point used to convert the internal representation of timephased cost into an external form which can be displayed to the user. @param projectCalendar calendar used by the resource assignment @param cost timephased resource assignment data @param rangeUnits timescale units @param dateList timescale date ranges @return list of durations, one per timescale date range
[ "This", "is", "the", "main", "entry", "point", "used", "to", "convert", "the", "internal", "representation", "of", "timephased", "cost", "into", "an", "external", "form", "which", "can", "be", "displayed", "to", "the", "user", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L124-L160
157,202
joniles/mpxj
src/main/java/net/sf/mpxj/utility/TimephasedUtility.java
TimephasedUtility.segmentBaselineCost
public ArrayList<Double> segmentBaselineCost(ProjectFile file, List<TimephasedCost> cost, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { return segmentCost(file.getBaselineCalendar(), cost, rangeUnits, dateList); }
java
public ArrayList<Double> segmentBaselineCost(ProjectFile file, List<TimephasedCost> cost, TimescaleUnits rangeUnits, ArrayList<DateRange> dateList) { return segmentCost(file.getBaselineCalendar(), cost, rangeUnits, dateList); }
[ "public", "ArrayList", "<", "Double", ">", "segmentBaselineCost", "(", "ProjectFile", "file", ",", "List", "<", "TimephasedCost", ">", "cost", ",", "TimescaleUnits", "rangeUnits", ",", "ArrayList", "<", "DateRange", ">", "dateList", ")", "{", "return", "segmentCost", "(", "file", ".", "getBaselineCalendar", "(", ")", ",", "cost", ",", "rangeUnits", ",", "dateList", ")", ";", "}" ]
This is the main entry point used to convert the internal representation of timephased baseline cost into an external form which can be displayed to the user. @param file parent project file @param cost timephased resource assignment data @param rangeUnits timescale units @param dateList timescale date ranges @return list of durations, one per timescale date range
[ "This", "is", "the", "main", "entry", "point", "used", "to", "convert", "the", "internal", "representation", "of", "timephased", "baseline", "cost", "into", "an", "external", "form", "which", "can", "be", "displayed", "to", "the", "user", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L173-L176
157,203
joniles/mpxj
src/main/java/net/sf/mpxj/utility/TimephasedUtility.java
TimephasedUtility.getStartIndex
private <T extends TimephasedItem<?>> int getStartIndex(DateRange range, List<T> assignments, int startIndex) { int result = -1; if (assignments != null) { long rangeStart = range.getStart().getTime(); long rangeEnd = range.getEnd().getTime(); for (int loop = startIndex; loop < assignments.size(); loop++) { T assignment = assignments.get(loop); int compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeStart); // // The start of the target range falls after the assignment end - // move on to test the next assignment. // if (compareResult > 0) { continue; } // // The start of the target range falls within the assignment - // return the index of this assignment to the caller. // if (compareResult == 0) { result = loop; break; } // // At this point, we know that the start of the target range is before // the assignment start. We need to determine if the end of the // target range overlaps the assignment. // compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeEnd); if (compareResult >= 0) { result = loop; break; } } } return result; }
java
private <T extends TimephasedItem<?>> int getStartIndex(DateRange range, List<T> assignments, int startIndex) { int result = -1; if (assignments != null) { long rangeStart = range.getStart().getTime(); long rangeEnd = range.getEnd().getTime(); for (int loop = startIndex; loop < assignments.size(); loop++) { T assignment = assignments.get(loop); int compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeStart); // // The start of the target range falls after the assignment end - // move on to test the next assignment. // if (compareResult > 0) { continue; } // // The start of the target range falls within the assignment - // return the index of this assignment to the caller. // if (compareResult == 0) { result = loop; break; } // // At this point, we know that the start of the target range is before // the assignment start. We need to determine if the end of the // target range overlaps the assignment. // compareResult = DateHelper.compare(assignment.getStart(), assignment.getFinish(), rangeEnd); if (compareResult >= 0) { result = loop; break; } } } return result; }
[ "private", "<", "T", "extends", "TimephasedItem", "<", "?", ">", ">", "int", "getStartIndex", "(", "DateRange", "range", ",", "List", "<", "T", ">", "assignments", ",", "int", "startIndex", ")", "{", "int", "result", "=", "-", "1", ";", "if", "(", "assignments", "!=", "null", ")", "{", "long", "rangeStart", "=", "range", ".", "getStart", "(", ")", ".", "getTime", "(", ")", ";", "long", "rangeEnd", "=", "range", ".", "getEnd", "(", ")", ".", "getTime", "(", ")", ";", "for", "(", "int", "loop", "=", "startIndex", ";", "loop", "<", "assignments", ".", "size", "(", ")", ";", "loop", "++", ")", "{", "T", "assignment", "=", "assignments", ".", "get", "(", "loop", ")", ";", "int", "compareResult", "=", "DateHelper", ".", "compare", "(", "assignment", ".", "getStart", "(", ")", ",", "assignment", ".", "getFinish", "(", ")", ",", "rangeStart", ")", ";", "//", "// The start of the target range falls after the assignment end -", "// move on to test the next assignment.", "//", "if", "(", "compareResult", ">", "0", ")", "{", "continue", ";", "}", "//", "// The start of the target range falls within the assignment -", "// return the index of this assignment to the caller.", "//", "if", "(", "compareResult", "==", "0", ")", "{", "result", "=", "loop", ";", "break", ";", "}", "//", "// At this point, we know that the start of the target range is before", "// the assignment start. We need to determine if the end of the", "// target range overlaps the assignment.", "//", "compareResult", "=", "DateHelper", ".", "compare", "(", "assignment", ".", "getStart", "(", ")", ",", "assignment", ".", "getFinish", "(", ")", ",", "rangeEnd", ")", ";", "if", "(", "compareResult", ">=", "0", ")", "{", "result", "=", "loop", ";", "break", ";", "}", "}", "}", "return", "result", ";", "}" ]
Used to locate the first timephased resource assignment block which intersects with the target date range. @param <T> payload type @param range target date range @param assignments timephased resource assignments @param startIndex index at which to start the search @return index of timephased resource assignment which intersects with the target date range
[ "Used", "to", "locate", "the", "first", "timephased", "resource", "assignment", "block", "which", "intersects", "with", "the", "target", "date", "range", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/TimephasedUtility.java#L188-L234
157,204
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AbstractCalendarFactory.java
AbstractCalendarFactory.processCalendarHours
private void processCalendarHours(byte[] data, ProjectCalendar defaultCalendar, ProjectCalendar cal, boolean isBaseCalendar) { // Dump out the calendar related data and fields. //MPPUtility.dataDump(data, true, false, false, false, true, false, true); int offset; ProjectCalendarHours hours; int periodIndex; int index; int defaultFlag; int periodCount; Date start; long duration; Day day; List<DateRange> dateRanges = new ArrayList<DateRange>(5); for (index = 0; index < 7; index++) { offset = getCalendarHoursOffset() + (60 * index); defaultFlag = data == null ? 1 : MPPUtility.getShort(data, offset); day = Day.getInstance(index + 1); if (defaultFlag == 1) { if (isBaseCalendar) { if (defaultCalendar == null) { cal.setWorkingDay(day, DEFAULT_WORKING_WEEK[index]); if (cal.isWorkingDay(day)) { hours = cal.addCalendarHours(Day.getInstance(index + 1)); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } else { boolean workingDay = defaultCalendar.isWorkingDay(day); cal.setWorkingDay(day, workingDay); if (workingDay) { hours = cal.addCalendarHours(Day.getInstance(index + 1)); for (DateRange range : defaultCalendar.getHours(day)) { hours.addRange(range); } } } } else { cal.setWorkingDay(day, DayType.DEFAULT); } } else { dateRanges.clear(); periodIndex = 0; periodCount = MPPUtility.getShort(data, offset + 2); while (periodIndex < periodCount) { int startOffset = offset + 8 + (periodIndex * 2); start = MPPUtility.getTime(data, startOffset); int durationOffset = offset + 20 + (periodIndex * 4); duration = MPPUtility.getDuration(data, durationOffset); Date end = new Date(start.getTime() + duration); dateRanges.add(new DateRange(start, end)); ++periodIndex; } if (dateRanges.isEmpty()) { cal.setWorkingDay(day, false); } else { cal.setWorkingDay(day, true); hours = cal.addCalendarHours(Day.getInstance(index + 1)); for (DateRange range : dateRanges) { hours.addRange(range); } } } } }
java
private void processCalendarHours(byte[] data, ProjectCalendar defaultCalendar, ProjectCalendar cal, boolean isBaseCalendar) { // Dump out the calendar related data and fields. //MPPUtility.dataDump(data, true, false, false, false, true, false, true); int offset; ProjectCalendarHours hours; int periodIndex; int index; int defaultFlag; int periodCount; Date start; long duration; Day day; List<DateRange> dateRanges = new ArrayList<DateRange>(5); for (index = 0; index < 7; index++) { offset = getCalendarHoursOffset() + (60 * index); defaultFlag = data == null ? 1 : MPPUtility.getShort(data, offset); day = Day.getInstance(index + 1); if (defaultFlag == 1) { if (isBaseCalendar) { if (defaultCalendar == null) { cal.setWorkingDay(day, DEFAULT_WORKING_WEEK[index]); if (cal.isWorkingDay(day)) { hours = cal.addCalendarHours(Day.getInstance(index + 1)); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } else { boolean workingDay = defaultCalendar.isWorkingDay(day); cal.setWorkingDay(day, workingDay); if (workingDay) { hours = cal.addCalendarHours(Day.getInstance(index + 1)); for (DateRange range : defaultCalendar.getHours(day)) { hours.addRange(range); } } } } else { cal.setWorkingDay(day, DayType.DEFAULT); } } else { dateRanges.clear(); periodIndex = 0; periodCount = MPPUtility.getShort(data, offset + 2); while (periodIndex < periodCount) { int startOffset = offset + 8 + (periodIndex * 2); start = MPPUtility.getTime(data, startOffset); int durationOffset = offset + 20 + (periodIndex * 4); duration = MPPUtility.getDuration(data, durationOffset); Date end = new Date(start.getTime() + duration); dateRanges.add(new DateRange(start, end)); ++periodIndex; } if (dateRanges.isEmpty()) { cal.setWorkingDay(day, false); } else { cal.setWorkingDay(day, true); hours = cal.addCalendarHours(Day.getInstance(index + 1)); for (DateRange range : dateRanges) { hours.addRange(range); } } } } }
[ "private", "void", "processCalendarHours", "(", "byte", "[", "]", "data", ",", "ProjectCalendar", "defaultCalendar", ",", "ProjectCalendar", "cal", ",", "boolean", "isBaseCalendar", ")", "{", "// Dump out the calendar related data and fields.", "//MPPUtility.dataDump(data, true, false, false, false, true, false, true);", "int", "offset", ";", "ProjectCalendarHours", "hours", ";", "int", "periodIndex", ";", "int", "index", ";", "int", "defaultFlag", ";", "int", "periodCount", ";", "Date", "start", ";", "long", "duration", ";", "Day", "day", ";", "List", "<", "DateRange", ">", "dateRanges", "=", "new", "ArrayList", "<", "DateRange", ">", "(", "5", ")", ";", "for", "(", "index", "=", "0", ";", "index", "<", "7", ";", "index", "++", ")", "{", "offset", "=", "getCalendarHoursOffset", "(", ")", "+", "(", "60", "*", "index", ")", ";", "defaultFlag", "=", "data", "==", "null", "?", "1", ":", "MPPUtility", ".", "getShort", "(", "data", ",", "offset", ")", ";", "day", "=", "Day", ".", "getInstance", "(", "index", "+", "1", ")", ";", "if", "(", "defaultFlag", "==", "1", ")", "{", "if", "(", "isBaseCalendar", ")", "{", "if", "(", "defaultCalendar", "==", "null", ")", "{", "cal", ".", "setWorkingDay", "(", "day", ",", "DEFAULT_WORKING_WEEK", "[", "index", "]", ")", ";", "if", "(", "cal", ".", "isWorkingDay", "(", "day", ")", ")", "{", "hours", "=", "cal", ".", "addCalendarHours", "(", "Day", ".", "getInstance", "(", "index", "+", "1", ")", ")", ";", "hours", ".", "addRange", "(", "ProjectCalendarWeek", ".", "DEFAULT_WORKING_MORNING", ")", ";", "hours", ".", "addRange", "(", "ProjectCalendarWeek", ".", "DEFAULT_WORKING_AFTERNOON", ")", ";", "}", "}", "else", "{", "boolean", "workingDay", "=", "defaultCalendar", ".", "isWorkingDay", "(", "day", ")", ";", "cal", ".", "setWorkingDay", "(", "day", ",", "workingDay", ")", ";", "if", "(", "workingDay", ")", "{", "hours", "=", "cal", ".", "addCalendarHours", "(", "Day", ".", "getInstance", "(", "index", "+", "1", ")", ")", ";", "for", "(", "DateRange", "range", ":", "defaultCalendar", ".", "getHours", "(", "day", ")", ")", "{", "hours", ".", "addRange", "(", "range", ")", ";", "}", "}", "}", "}", "else", "{", "cal", ".", "setWorkingDay", "(", "day", ",", "DayType", ".", "DEFAULT", ")", ";", "}", "}", "else", "{", "dateRanges", ".", "clear", "(", ")", ";", "periodIndex", "=", "0", ";", "periodCount", "=", "MPPUtility", ".", "getShort", "(", "data", ",", "offset", "+", "2", ")", ";", "while", "(", "periodIndex", "<", "periodCount", ")", "{", "int", "startOffset", "=", "offset", "+", "8", "+", "(", "periodIndex", "*", "2", ")", ";", "start", "=", "MPPUtility", ".", "getTime", "(", "data", ",", "startOffset", ")", ";", "int", "durationOffset", "=", "offset", "+", "20", "+", "(", "periodIndex", "*", "4", ")", ";", "duration", "=", "MPPUtility", ".", "getDuration", "(", "data", ",", "durationOffset", ")", ";", "Date", "end", "=", "new", "Date", "(", "start", ".", "getTime", "(", ")", "+", "duration", ")", ";", "dateRanges", ".", "add", "(", "new", "DateRange", "(", "start", ",", "end", ")", ")", ";", "++", "periodIndex", ";", "}", "if", "(", "dateRanges", ".", "isEmpty", "(", ")", ")", "{", "cal", ".", "setWorkingDay", "(", "day", ",", "false", ")", ";", "}", "else", "{", "cal", ".", "setWorkingDay", "(", "day", ",", "true", ")", ";", "hours", "=", "cal", ".", "addCalendarHours", "(", "Day", ".", "getInstance", "(", "index", "+", "1", ")", ")", ";", "for", "(", "DateRange", "range", ":", "dateRanges", ")", "{", "hours", ".", "addRange", "(", "range", ")", ";", "}", "}", "}", "}", "}" ]
For a given set of calendar data, this method sets the working day status for each day, and if present, sets the hours for that day. NOTE: MPP14 defines the concept of working weeks. MPXJ does not currently support this, and thus we only read the working hours for the default working week. @param data calendar data block @param defaultCalendar calendar to use for default values @param cal calendar instance @param isBaseCalendar true if this is a base calendar
[ "For", "a", "given", "set", "of", "calendar", "data", "this", "method", "sets", "the", "working", "day", "status", "for", "each", "day", "and", "if", "present", "sets", "the", "hours", "for", "that", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarFactory.java#L194-L282
157,205
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/AbstractCalendarFactory.java
AbstractCalendarFactory.updateBaseCalendarNames
private void updateBaseCalendarNames(List<Pair<ProjectCalendar, Integer>> baseCalendars, HashMap<Integer, ProjectCalendar> map) { for (Pair<ProjectCalendar, Integer> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); Integer baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = map.get(baseCalendarID); if (baseCal != null && baseCal.getName() != null) { cal.setParent(baseCal); } else { // Remove invalid calendar to avoid serious problems later. m_file.removeCalendar(cal); } } }
java
private void updateBaseCalendarNames(List<Pair<ProjectCalendar, Integer>> baseCalendars, HashMap<Integer, ProjectCalendar> map) { for (Pair<ProjectCalendar, Integer> pair : baseCalendars) { ProjectCalendar cal = pair.getFirst(); Integer baseCalendarID = pair.getSecond(); ProjectCalendar baseCal = map.get(baseCalendarID); if (baseCal != null && baseCal.getName() != null) { cal.setParent(baseCal); } else { // Remove invalid calendar to avoid serious problems later. m_file.removeCalendar(cal); } } }
[ "private", "void", "updateBaseCalendarNames", "(", "List", "<", "Pair", "<", "ProjectCalendar", ",", "Integer", ">", ">", "baseCalendars", ",", "HashMap", "<", "Integer", ",", "ProjectCalendar", ">", "map", ")", "{", "for", "(", "Pair", "<", "ProjectCalendar", ",", "Integer", ">", "pair", ":", "baseCalendars", ")", "{", "ProjectCalendar", "cal", "=", "pair", ".", "getFirst", "(", ")", ";", "Integer", "baseCalendarID", "=", "pair", ".", "getSecond", "(", ")", ";", "ProjectCalendar", "baseCal", "=", "map", ".", "get", "(", "baseCalendarID", ")", ";", "if", "(", "baseCal", "!=", "null", "&&", "baseCal", ".", "getName", "(", ")", "!=", "null", ")", "{", "cal", ".", "setParent", "(", "baseCal", ")", ";", "}", "else", "{", "// Remove invalid calendar to avoid serious problems later.", "m_file", ".", "removeCalendar", "(", "cal", ")", ";", "}", "}", "}" ]
The way calendars are stored in an MPP14 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", "MPP14", "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", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/AbstractCalendarFactory.java#L295-L312
157,206
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireTaskReadEvent
public void fireTaskReadEvent(Task task) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.taskRead(task); } } }
java
public void fireTaskReadEvent(Task task) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.taskRead(task); } } }
[ "public", "void", "fireTaskReadEvent", "(", "Task", "task", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "taskRead", "(", "task", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a task has been read from a project file. @param task task instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "task", "has", "been", "read", "from", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L42-L51
157,207
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireTaskWrittenEvent
public void fireTaskWrittenEvent(Task task) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.taskWritten(task); } } }
java
public void fireTaskWrittenEvent(Task task) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.taskWritten(task); } } }
[ "public", "void", "fireTaskWrittenEvent", "(", "Task", "task", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "taskWritten", "(", "task", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a task has been written to a project file. @param task task instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "task", "has", "been", "written", "to", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L59-L68
157,208
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireResourceReadEvent
public void fireResourceReadEvent(Resource resource) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.resourceRead(resource); } } }
java
public void fireResourceReadEvent(Resource resource) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.resourceRead(resource); } } }
[ "public", "void", "fireResourceReadEvent", "(", "Resource", "resource", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "resourceRead", "(", "resource", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a resource has been read from a project file. @param resource resource instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "resource", "has", "been", "read", "from", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L76-L85
157,209
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireResourceWrittenEvent
public void fireResourceWrittenEvent(Resource resource) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.resourceWritten(resource); } } }
java
public void fireResourceWrittenEvent(Resource resource) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.resourceWritten(resource); } } }
[ "public", "void", "fireResourceWrittenEvent", "(", "Resource", "resource", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "resourceWritten", "(", "resource", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a resource has been written to a project file. @param resource resource instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "resource", "has", "been", "written", "to", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L93-L102
157,210
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireCalendarReadEvent
public void fireCalendarReadEvent(ProjectCalendar calendar) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.calendarRead(calendar); } } }
java
public void fireCalendarReadEvent(ProjectCalendar calendar) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.calendarRead(calendar); } } }
[ "public", "void", "fireCalendarReadEvent", "(", "ProjectCalendar", "calendar", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "calendarRead", "(", "calendar", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a calendar has been read from a project file. @param calendar calendar instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "calendar", "has", "been", "read", "from", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L110-L119
157,211
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireAssignmentReadEvent
public void fireAssignmentReadEvent(ResourceAssignment resourceAssignment) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.assignmentRead(resourceAssignment); } } }
java
public void fireAssignmentReadEvent(ResourceAssignment resourceAssignment) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.assignmentRead(resourceAssignment); } } }
[ "public", "void", "fireAssignmentReadEvent", "(", "ResourceAssignment", "resourceAssignment", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "assignmentRead", "(", "resourceAssignment", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a resource assignment has been read from a project file. @param resourceAssignment resourceAssignment instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "resource", "assignment", "has", "been", "read", "from", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L127-L136
157,212
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireAssignmentWrittenEvent
public void fireAssignmentWrittenEvent(ResourceAssignment resourceAssignment) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.assignmentWritten(resourceAssignment); } } }
java
public void fireAssignmentWrittenEvent(ResourceAssignment resourceAssignment) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.assignmentWritten(resourceAssignment); } } }
[ "public", "void", "fireAssignmentWrittenEvent", "(", "ResourceAssignment", "resourceAssignment", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "assignmentWritten", "(", "resourceAssignment", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a resource assignment has been written to a project file. @param resourceAssignment resourceAssignment instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "resource", "assignment", "has", "been", "written", "to", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L144-L153
157,213
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireRelationReadEvent
public void fireRelationReadEvent(Relation relation) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.relationRead(relation); } } }
java
public void fireRelationReadEvent(Relation relation) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.relationRead(relation); } } }
[ "public", "void", "fireRelationReadEvent", "(", "Relation", "relation", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "relationRead", "(", "relation", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a relation has been read from a project file. @param relation relation instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "relation", "has", "been", "read", "from", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L161-L170
157,214
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireRelationWrittenEvent
public void fireRelationWrittenEvent(Relation relation) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.relationWritten(relation); } } }
java
public void fireRelationWrittenEvent(Relation relation) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.relationWritten(relation); } } }
[ "public", "void", "fireRelationWrittenEvent", "(", "Relation", "relation", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "relationWritten", "(", "relation", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a relation has been written to a project file. @param relation relation instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "relation", "has", "been", "written", "to", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L178-L187
157,215
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.fireCalendarWrittenEvent
public void fireCalendarWrittenEvent(ProjectCalendar calendar) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.calendarWritten(calendar); } } }
java
public void fireCalendarWrittenEvent(ProjectCalendar calendar) { if (m_projectListeners != null) { for (ProjectListener listener : m_projectListeners) { listener.calendarWritten(calendar); } } }
[ "public", "void", "fireCalendarWrittenEvent", "(", "ProjectCalendar", "calendar", ")", "{", "if", "(", "m_projectListeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "m_projectListeners", ")", "{", "listener", ".", "calendarWritten", "(", "calendar", ")", ";", "}", "}", "}" ]
This method is called to alert project listeners to the fact that a calendar has been written to a project file. @param calendar calendar instance
[ "This", "method", "is", "called", "to", "alert", "project", "listeners", "to", "the", "fact", "that", "a", "calendar", "has", "been", "written", "to", "a", "project", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L195-L204
157,216
joniles/mpxj
src/main/java/net/sf/mpxj/EventManager.java
EventManager.addProjectListeners
public void addProjectListeners(List<ProjectListener> listeners) { if (listeners != null) { for (ProjectListener listener : listeners) { addProjectListener(listener); } } }
java
public void addProjectListeners(List<ProjectListener> listeners) { if (listeners != null) { for (ProjectListener listener : listeners) { addProjectListener(listener); } } }
[ "public", "void", "addProjectListeners", "(", "List", "<", "ProjectListener", ">", "listeners", ")", "{", "if", "(", "listeners", "!=", "null", ")", "{", "for", "(", "ProjectListener", "listener", ":", "listeners", ")", "{", "addProjectListener", "(", "listener", ")", ";", "}", "}", "}" ]
Adds a collection of listeners to the current project. @param listeners collection of listeners
[ "Adds", "a", "collection", "of", "listeners", "to", "the", "current", "project", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/EventManager.java#L225-L234
157,217
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/UserFieldCounters.java
UserFieldCounters.nextField
public <E extends Enum<E> & FieldType> E nextField(Class<E> clazz, UserFieldDataType type) { for (String name : m_names[type.ordinal()]) { int i = NumberHelper.getInt(m_counters.get(name)) + 1; try { E e = Enum.valueOf(clazz, name + i); m_counters.put(name, Integer.valueOf(i)); return e; } catch (IllegalArgumentException ex) { // try the next name } } // no more fields available throw new IllegalArgumentException("No fields for type " + type + " available"); }
java
public <E extends Enum<E> & FieldType> E nextField(Class<E> clazz, UserFieldDataType type) { for (String name : m_names[type.ordinal()]) { int i = NumberHelper.getInt(m_counters.get(name)) + 1; try { E e = Enum.valueOf(clazz, name + i); m_counters.put(name, Integer.valueOf(i)); return e; } catch (IllegalArgumentException ex) { // try the next name } } // no more fields available throw new IllegalArgumentException("No fields for type " + type + " available"); }
[ "public", "<", "E", "extends", "Enum", "<", "E", ">", "&", "FieldType", ">", "E", "nextField", "(", "Class", "<", "E", ">", "clazz", ",", "UserFieldDataType", "type", ")", "{", "for", "(", "String", "name", ":", "m_names", "[", "type", ".", "ordinal", "(", ")", "]", ")", "{", "int", "i", "=", "NumberHelper", ".", "getInt", "(", "m_counters", ".", "get", "(", "name", ")", ")", "+", "1", ";", "try", "{", "E", "e", "=", "Enum", ".", "valueOf", "(", "clazz", ",", "name", "+", "i", ")", ";", "m_counters", ".", "put", "(", "name", ",", "Integer", ".", "valueOf", "(", "i", ")", ")", ";", "return", "e", ";", "}", "catch", "(", "IllegalArgumentException", "ex", ")", "{", "// try the next name", "}", "}", "// no more fields available", "throw", "new", "IllegalArgumentException", "(", "\"No fields for type \"", "+", "type", "+", "\" available\"", ")", ";", "}" ]
Generate the next available field for a user defined field. @param <E> field type class @param clazz class of the desired field enum @param type user defined field type. @return field of specified type
[ "Generate", "the", "next", "available", "field", "for", "a", "user", "defined", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/UserFieldCounters.java#L70-L89
157,218
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java
FastTrackReader.read
private ProjectFile read() throws Exception { m_project = new ProjectFile(); m_eventManager = m_project.getEventManager(); ProjectConfig config = m_project.getProjectConfig(); config.setAutoCalendarUniqueID(false); config.setAutoTaskID(false); config.setAutoTaskUniqueID(false); config.setAutoResourceUniqueID(false); config.setAutoWBS(false); config.setAutoOutlineNumber(false); m_project.getProjectProperties().setFileApplication("FastTrack"); m_project.getProjectProperties().setFileType("FTS"); m_eventManager.addProjectListeners(m_projectListeners); // processProject(); // processCalendars(); processResources(); processTasks(); processDependencies(); processAssignments(); return m_project; }
java
private ProjectFile read() throws Exception { m_project = new ProjectFile(); m_eventManager = m_project.getEventManager(); ProjectConfig config = m_project.getProjectConfig(); config.setAutoCalendarUniqueID(false); config.setAutoTaskID(false); config.setAutoTaskUniqueID(false); config.setAutoResourceUniqueID(false); config.setAutoWBS(false); config.setAutoOutlineNumber(false); m_project.getProjectProperties().setFileApplication("FastTrack"); m_project.getProjectProperties().setFileType("FTS"); m_eventManager.addProjectListeners(m_projectListeners); // processProject(); // processCalendars(); processResources(); processTasks(); processDependencies(); processAssignments(); return m_project; }
[ "private", "ProjectFile", "read", "(", ")", "throws", "Exception", "{", "m_project", "=", "new", "ProjectFile", "(", ")", ";", "m_eventManager", "=", "m_project", ".", "getEventManager", "(", ")", ";", "ProjectConfig", "config", "=", "m_project", ".", "getProjectConfig", "(", ")", ";", "config", ".", "setAutoCalendarUniqueID", "(", "false", ")", ";", "config", ".", "setAutoTaskID", "(", "false", ")", ";", "config", ".", "setAutoTaskUniqueID", "(", "false", ")", ";", "config", ".", "setAutoResourceUniqueID", "(", "false", ")", ";", "config", ".", "setAutoWBS", "(", "false", ")", ";", "config", ".", "setAutoOutlineNumber", "(", "false", ")", ";", "m_project", ".", "getProjectProperties", "(", ")", ".", "setFileApplication", "(", "\"FastTrack\"", ")", ";", "m_project", ".", "getProjectProperties", "(", ")", ".", "setFileType", "(", "\"FTS\"", ")", ";", "m_eventManager", ".", "addProjectListeners", "(", "m_projectListeners", ")", ";", "// processProject();", "// processCalendars();", "processResources", "(", ")", ";", "processTasks", "(", ")", ";", "processDependencies", "(", ")", ";", "processAssignments", "(", ")", ";", "return", "m_project", ";", "}" ]
Read FTS file data from the configured source and return a populated ProjectFile instance. @return ProjectFile instance
[ "Read", "FTS", "file", "data", "from", "the", "configured", "source", "and", "return", "a", "populated", "ProjectFile", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java#L139-L165
157,219
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java
FastTrackReader.processDependencies
private void processDependencies() { Set<Task> tasksWithBars = new HashSet<Task>(); FastTrackTable table = m_data.getTable(FastTrackTableType.ACTBARS); for (MapRow row : table) { Task task = m_project.getTaskByUniqueID(row.getInteger(ActBarField._ACTIVITY)); if (task == null || tasksWithBars.contains(task)) { continue; } tasksWithBars.add(task); String predecessors = row.getString(ActBarField.PREDECESSORS); if (predecessors == null || predecessors.isEmpty()) { continue; } for (String predecessor : predecessors.split(", ")) { Matcher matcher = RELATION_REGEX.matcher(predecessor); matcher.matches(); Integer id = Integer.valueOf(matcher.group(1)); RelationType type = RELATION_TYPE_MAP.get(matcher.group(3)); if (type == null) { type = RelationType.FINISH_START; } String sign = matcher.group(4); double lag = NumberHelper.getDouble(matcher.group(5)); if ("-".equals(sign)) { lag = -lag; } Task targetTask = m_project.getTaskByID(id); if (targetTask != null) { Duration lagDuration = Duration.getInstance(lag, m_data.getDurationTimeUnit()); Relation relation = task.addPredecessor(targetTask, type, lagDuration); m_eventManager.fireRelationReadEvent(relation); } } } }
java
private void processDependencies() { Set<Task> tasksWithBars = new HashSet<Task>(); FastTrackTable table = m_data.getTable(FastTrackTableType.ACTBARS); for (MapRow row : table) { Task task = m_project.getTaskByUniqueID(row.getInteger(ActBarField._ACTIVITY)); if (task == null || tasksWithBars.contains(task)) { continue; } tasksWithBars.add(task); String predecessors = row.getString(ActBarField.PREDECESSORS); if (predecessors == null || predecessors.isEmpty()) { continue; } for (String predecessor : predecessors.split(", ")) { Matcher matcher = RELATION_REGEX.matcher(predecessor); matcher.matches(); Integer id = Integer.valueOf(matcher.group(1)); RelationType type = RELATION_TYPE_MAP.get(matcher.group(3)); if (type == null) { type = RelationType.FINISH_START; } String sign = matcher.group(4); double lag = NumberHelper.getDouble(matcher.group(5)); if ("-".equals(sign)) { lag = -lag; } Task targetTask = m_project.getTaskByID(id); if (targetTask != null) { Duration lagDuration = Duration.getInstance(lag, m_data.getDurationTimeUnit()); Relation relation = task.addPredecessor(targetTask, type, lagDuration); m_eventManager.fireRelationReadEvent(relation); } } } }
[ "private", "void", "processDependencies", "(", ")", "{", "Set", "<", "Task", ">", "tasksWithBars", "=", "new", "HashSet", "<", "Task", ">", "(", ")", ";", "FastTrackTable", "table", "=", "m_data", ".", "getTable", "(", "FastTrackTableType", ".", "ACTBARS", ")", ";", "for", "(", "MapRow", "row", ":", "table", ")", "{", "Task", "task", "=", "m_project", ".", "getTaskByUniqueID", "(", "row", ".", "getInteger", "(", "ActBarField", ".", "_ACTIVITY", ")", ")", ";", "if", "(", "task", "==", "null", "||", "tasksWithBars", ".", "contains", "(", "task", ")", ")", "{", "continue", ";", "}", "tasksWithBars", ".", "add", "(", "task", ")", ";", "String", "predecessors", "=", "row", ".", "getString", "(", "ActBarField", ".", "PREDECESSORS", ")", ";", "if", "(", "predecessors", "==", "null", "||", "predecessors", ".", "isEmpty", "(", ")", ")", "{", "continue", ";", "}", "for", "(", "String", "predecessor", ":", "predecessors", ".", "split", "(", "\", \"", ")", ")", "{", "Matcher", "matcher", "=", "RELATION_REGEX", ".", "matcher", "(", "predecessor", ")", ";", "matcher", ".", "matches", "(", ")", ";", "Integer", "id", "=", "Integer", ".", "valueOf", "(", "matcher", ".", "group", "(", "1", ")", ")", ";", "RelationType", "type", "=", "RELATION_TYPE_MAP", ".", "get", "(", "matcher", ".", "group", "(", "3", ")", ")", ";", "if", "(", "type", "==", "null", ")", "{", "type", "=", "RelationType", ".", "FINISH_START", ";", "}", "String", "sign", "=", "matcher", ".", "group", "(", "4", ")", ";", "double", "lag", "=", "NumberHelper", ".", "getDouble", "(", "matcher", ".", "group", "(", "5", ")", ")", ";", "if", "(", "\"-\"", ".", "equals", "(", "sign", ")", ")", "{", "lag", "=", "-", "lag", ";", "}", "Task", "targetTask", "=", "m_project", ".", "getTaskByID", "(", "id", ")", ";", "if", "(", "targetTask", "!=", "null", ")", "{", "Duration", "lagDuration", "=", "Duration", ".", "getInstance", "(", "lag", ",", "m_data", ".", "getDurationTimeUnit", "(", ")", ")", ";", "Relation", "relation", "=", "task", ".", "addPredecessor", "(", "targetTask", ",", "type", ",", "lagDuration", ")", ";", "m_eventManager", ".", "fireRelationReadEvent", "(", "relation", ")", ";", "}", "}", "}", "}" ]
Process task dependencies.
[ "Process", "task", "dependencies", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java#L532-L579
157,220
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java
FastTrackReader.getOutlineLevel
private Integer getOutlineLevel(Task task) { String value = task.getWBS(); Integer result = Integer.valueOf(1); if (value != null && value.length() > 0) { String[] path = WBS_SPLIT_REGEX.split(value); result = Integer.valueOf(path.length); } return result; }
java
private Integer getOutlineLevel(Task task) { String value = task.getWBS(); Integer result = Integer.valueOf(1); if (value != null && value.length() > 0) { String[] path = WBS_SPLIT_REGEX.split(value); result = Integer.valueOf(path.length); } return result; }
[ "private", "Integer", "getOutlineLevel", "(", "Task", "task", ")", "{", "String", "value", "=", "task", ".", "getWBS", "(", ")", ";", "Integer", "result", "=", "Integer", ".", "valueOf", "(", "1", ")", ";", "if", "(", "value", "!=", "null", "&&", "value", ".", "length", "(", ")", ">", "0", ")", "{", "String", "[", "]", "path", "=", "WBS_SPLIT_REGEX", ".", "split", "(", "value", ")", ";", "result", "=", "Integer", ".", "valueOf", "(", "path", ".", "length", ")", ";", "}", "return", "result", ";", "}" ]
Extract the outline level from a task's WBS attribute. @param task Task instance @return outline level
[ "Extract", "the", "outline", "level", "from", "a", "task", "s", "WBS", "attribute", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackReader.java#L640-L650
157,221
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.setWeeklyDay
public void setWeeklyDay(Day day, boolean value) { if (value) { m_days.add(day); } else { m_days.remove(day); } }
java
public void setWeeklyDay(Day day, boolean value) { if (value) { m_days.add(day); } else { m_days.remove(day); } }
[ "public", "void", "setWeeklyDay", "(", "Day", "day", ",", "boolean", "value", ")", "{", "if", "(", "value", ")", "{", "m_days", ".", "add", "(", "day", ")", ";", "}", "else", "{", "m_days", ".", "remove", "(", "day", ")", ";", "}", "}" ]
Set the state of an individual day in a weekly recurrence. @param day Day instance @param value true if this day is included in the recurrence
[ "Set", "the", "state", "of", "an", "individual", "day", "in", "a", "weekly", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L180-L190
157,222
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.setWeeklyDaysFromBitmap
public void setWeeklyDaysFromBitmap(Integer days, int[] masks) { if (days != null) { int value = days.intValue(); for (Day day : Day.values()) { setWeeklyDay(day, ((value & masks[day.getValue()]) != 0)); } } }
java
public void setWeeklyDaysFromBitmap(Integer days, int[] masks) { if (days != null) { int value = days.intValue(); for (Day day : Day.values()) { setWeeklyDay(day, ((value & masks[day.getValue()]) != 0)); } } }
[ "public", "void", "setWeeklyDaysFromBitmap", "(", "Integer", "days", ",", "int", "[", "]", "masks", ")", "{", "if", "(", "days", "!=", "null", ")", "{", "int", "value", "=", "days", ".", "intValue", "(", ")", ";", "for", "(", "Day", "day", ":", "Day", ".", "values", "(", ")", ")", "{", "setWeeklyDay", "(", "day", ",", "(", "(", "value", "&", "masks", "[", "day", ".", "getValue", "(", ")", "]", ")", "!=", "0", ")", ")", ";", "}", "}", "}" ]
Converts from a bitmap to individual day flags for a weekly recurrence, using the array of masks. @param days bitmap @param masks array of mask values
[ "Converts", "from", "a", "bitmap", "to", "individual", "day", "flags", "for", "a", "weekly", "recurrence", "using", "the", "array", "of", "masks", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L199-L209
157,223
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getDayOfWeek
public Day getDayOfWeek() { Day result = null; if (!m_days.isEmpty()) { result = m_days.iterator().next(); } return result; }
java
public Day getDayOfWeek() { Day result = null; if (!m_days.isEmpty()) { result = m_days.iterator().next(); } return result; }
[ "public", "Day", "getDayOfWeek", "(", ")", "{", "Day", "result", "=", "null", ";", "if", "(", "!", "m_days", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "m_days", ".", "iterator", "(", ")", ".", "next", "(", ")", ";", "}", "return", "result", ";", "}" ]
Retrieves the monthly or yearly relative day of the week. @return day of the week
[ "Retrieves", "the", "monthly", "or", "yearly", "relative", "day", "of", "the", "week", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L256-L264
157,224
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getDates
public Date[] getDates() { int frequency = NumberHelper.getInt(m_frequency); if (frequency < 1) { frequency = 1; } Calendar calendar = DateHelper.popCalendar(m_startDate); List<Date> dates = new ArrayList<Date>(); switch (m_recurrenceType) { case DAILY: { getDailyDates(calendar, frequency, dates); break; } case WEEKLY: { getWeeklyDates(calendar, frequency, dates); break; } case MONTHLY: { getMonthlyDates(calendar, frequency, dates); break; } case YEARLY: { getYearlyDates(calendar, dates); break; } } DateHelper.pushCalendar(calendar); return dates.toArray(new Date[dates.size()]); }
java
public Date[] getDates() { int frequency = NumberHelper.getInt(m_frequency); if (frequency < 1) { frequency = 1; } Calendar calendar = DateHelper.popCalendar(m_startDate); List<Date> dates = new ArrayList<Date>(); switch (m_recurrenceType) { case DAILY: { getDailyDates(calendar, frequency, dates); break; } case WEEKLY: { getWeeklyDates(calendar, frequency, dates); break; } case MONTHLY: { getMonthlyDates(calendar, frequency, dates); break; } case YEARLY: { getYearlyDates(calendar, dates); break; } } DateHelper.pushCalendar(calendar); return dates.toArray(new Date[dates.size()]); }
[ "public", "Date", "[", "]", "getDates", "(", ")", "{", "int", "frequency", "=", "NumberHelper", ".", "getInt", "(", "m_frequency", ")", ";", "if", "(", "frequency", "<", "1", ")", "{", "frequency", "=", "1", ";", "}", "Calendar", "calendar", "=", "DateHelper", ".", "popCalendar", "(", "m_startDate", ")", ";", "List", "<", "Date", ">", "dates", "=", "new", "ArrayList", "<", "Date", ">", "(", ")", ";", "switch", "(", "m_recurrenceType", ")", "{", "case", "DAILY", ":", "{", "getDailyDates", "(", "calendar", ",", "frequency", ",", "dates", ")", ";", "break", ";", "}", "case", "WEEKLY", ":", "{", "getWeeklyDates", "(", "calendar", ",", "frequency", ",", "dates", ")", ";", "break", ";", "}", "case", "MONTHLY", ":", "{", "getMonthlyDates", "(", "calendar", ",", "frequency", ",", "dates", ")", ";", "break", ";", "}", "case", "YEARLY", ":", "{", "getYearlyDates", "(", "calendar", ",", "dates", ")", ";", "break", ";", "}", "}", "DateHelper", ".", "pushCalendar", "(", "calendar", ")", ";", "return", "dates", ".", "toArray", "(", "new", "Date", "[", "dates", ".", "size", "(", ")", "]", ")", ";", "}" ]
Retrieve the set of start dates represented by this recurrence data. @return array of start dates
[ "Retrieve", "the", "set", "of", "start", "dates", "represented", "by", "this", "recurrence", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L322-L363
157,225
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.moreDates
private boolean moreDates(Calendar calendar, List<Date> dates) { boolean result; if (m_finishDate == null) { int occurrences = NumberHelper.getInt(m_occurrences); if (occurrences < 1) { occurrences = 1; } result = dates.size() < occurrences; } else { result = calendar.getTimeInMillis() <= m_finishDate.getTime(); } return result; }
java
private boolean moreDates(Calendar calendar, List<Date> dates) { boolean result; if (m_finishDate == null) { int occurrences = NumberHelper.getInt(m_occurrences); if (occurrences < 1) { occurrences = 1; } result = dates.size() < occurrences; } else { result = calendar.getTimeInMillis() <= m_finishDate.getTime(); } return result; }
[ "private", "boolean", "moreDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "boolean", "result", ";", "if", "(", "m_finishDate", "==", "null", ")", "{", "int", "occurrences", "=", "NumberHelper", ".", "getInt", "(", "m_occurrences", ")", ";", "if", "(", "occurrences", "<", "1", ")", "{", "occurrences", "=", "1", ";", "}", "result", "=", "dates", ".", "size", "(", ")", "<", "occurrences", ";", "}", "else", "{", "result", "=", "calendar", ".", "getTimeInMillis", "(", ")", "<=", "m_finishDate", ".", "getTime", "(", ")", ";", "}", "return", "result", ";", "}" ]
Determines if we need to calculate more dates. If we do not have a finish date, this method falls back on using the occurrences attribute. If we have a finish date, we'll use that instead. We're assuming that the recurring data has one or other of those values. @param calendar current date @param dates dates generated so far @return true if we should calculate another date
[ "Determines", "if", "we", "need", "to", "calculate", "more", "dates", ".", "If", "we", "do", "not", "have", "a", "finish", "date", "this", "method", "falls", "back", "on", "using", "the", "occurrences", "attribute", ".", "If", "we", "have", "a", "finish", "date", "we", "ll", "use", "that", "instead", ".", "We", "re", "assuming", "that", "the", "recurring", "data", "has", "one", "or", "other", "of", "those", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L375-L392
157,226
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getDailyDates
private void getDailyDates(Calendar calendar, int frequency, List<Date> dates) { while (moreDates(calendar, dates)) { dates.add(calendar.getTime()); calendar.add(Calendar.DAY_OF_YEAR, frequency); } }
java
private void getDailyDates(Calendar calendar, int frequency, List<Date> dates) { while (moreDates(calendar, dates)) { dates.add(calendar.getTime()); calendar.add(Calendar.DAY_OF_YEAR, frequency); } }
[ "private", "void", "getDailyDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "frequency", ")", ";", "}", "}" ]
Calculate start dates for a daily recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "daily", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L401-L408
157,227
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getWeeklyDates
private void getWeeklyDates(Calendar calendar, int frequency, List<Date> dates) { int currentDay = calendar.get(Calendar.DAY_OF_WEEK); while (moreDates(calendar, dates)) { int offset = 0; for (int dayIndex = 0; dayIndex < 7; dayIndex++) { if (getWeeklyDay(Day.getInstance(currentDay))) { if (offset != 0) { calendar.add(Calendar.DAY_OF_YEAR, offset); offset = 0; } if (!moreDates(calendar, dates)) { break; } dates.add(calendar.getTime()); } ++offset; ++currentDay; if (currentDay > 7) { currentDay = 1; } } if (frequency > 1) { offset += (7 * (frequency - 1)); } calendar.add(Calendar.DAY_OF_YEAR, offset); } }
java
private void getWeeklyDates(Calendar calendar, int frequency, List<Date> dates) { int currentDay = calendar.get(Calendar.DAY_OF_WEEK); while (moreDates(calendar, dates)) { int offset = 0; for (int dayIndex = 0; dayIndex < 7; dayIndex++) { if (getWeeklyDay(Day.getInstance(currentDay))) { if (offset != 0) { calendar.add(Calendar.DAY_OF_YEAR, offset); offset = 0; } if (!moreDates(calendar, dates)) { break; } dates.add(calendar.getTime()); } ++offset; ++currentDay; if (currentDay > 7) { currentDay = 1; } } if (frequency > 1) { offset += (7 * (frequency - 1)); } calendar.add(Calendar.DAY_OF_YEAR, offset); } }
[ "private", "void", "getWeeklyDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "int", "currentDay", "=", "calendar", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "int", "offset", "=", "0", ";", "for", "(", "int", "dayIndex", "=", "0", ";", "dayIndex", "<", "7", ";", "dayIndex", "++", ")", "{", "if", "(", "getWeeklyDay", "(", "Day", ".", "getInstance", "(", "currentDay", ")", ")", ")", "{", "if", "(", "offset", "!=", "0", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "offset", ")", ";", "offset", "=", "0", ";", "}", "if", "(", "!", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "break", ";", "}", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "}", "++", "offset", ";", "++", "currentDay", ";", "if", "(", "currentDay", ">", "7", ")", "{", "currentDay", "=", "1", ";", "}", "}", "if", "(", "frequency", ">", "1", ")", "{", "offset", "+=", "(", "7", "*", "(", "frequency", "-", "1", ")", ")", ";", "}", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "offset", ")", ";", "}", "}" ]
Calculate start dates for a weekly recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "weekly", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L417-L455
157,228
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getMonthlyDates
private void getMonthlyDates(Calendar calendar, int frequency, List<Date> dates) { if (m_relative) { getMonthlyRelativeDates(calendar, frequency, dates); } else { getMonthlyAbsoluteDates(calendar, frequency, dates); } }
java
private void getMonthlyDates(Calendar calendar, int frequency, List<Date> dates) { if (m_relative) { getMonthlyRelativeDates(calendar, frequency, dates); } else { getMonthlyAbsoluteDates(calendar, frequency, dates); } }
[ "private", "void", "getMonthlyDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "if", "(", "m_relative", ")", "{", "getMonthlyRelativeDates", "(", "calendar", ",", "frequency", ",", "dates", ")", ";", "}", "else", "{", "getMonthlyAbsoluteDates", "(", "calendar", ",", "frequency", ",", "dates", ")", ";", "}", "}" ]
Calculate start dates for a monthly recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "monthly", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L464-L474
157,229
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getMonthlyRelativeDates
private void getMonthlyRelativeDates(Calendar calendar, int frequency, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
java
private void getMonthlyRelativeDates(Calendar calendar, int frequency, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
[ "private", "void", "getMonthlyRelativeDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "long", "startDate", "=", "calendar", ".", "getTimeInMillis", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "int", "dayNumber", "=", "NumberHelper", ".", "getInt", "(", "m_dayNumber", ")", ";", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "if", "(", "dayNumber", ">", "4", ")", "{", "setCalendarToLastRelativeDay", "(", "calendar", ")", ";", "}", "else", "{", "setCalendarToOrdinalRelativeDay", "(", "calendar", ",", "dayNumber", ")", ";", "}", "if", "(", "calendar", ".", "getTimeInMillis", "(", ")", ">", "startDate", ")", "{", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "if", "(", "!", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "break", ";", "}", "}", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "MONTH", ",", "frequency", ")", ";", "}", "}" ]
Calculate start dates for a monthly relative recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "monthly", "relative", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L483-L511
157,230
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getMonthlyAbsoluteDates
private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates) { int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); if (requiredDayNumber < currentDayNumber) { calendar.add(Calendar.MONTH, 1); } while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
java
private void getMonthlyAbsoluteDates(Calendar calendar, int frequency, List<Date> dates) { int currentDayNumber = calendar.get(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); if (requiredDayNumber < currentDayNumber) { calendar.add(Calendar.MONTH, 1); } while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MONTH, frequency); } }
[ "private", "void", "getMonthlyAbsoluteDates", "(", "Calendar", "calendar", ",", "int", "frequency", ",", "List", "<", "Date", ">", "dates", ")", "{", "int", "currentDayNumber", "=", "calendar", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "int", "requiredDayNumber", "=", "NumberHelper", ".", "getInt", "(", "m_dayNumber", ")", ";", "if", "(", "requiredDayNumber", "<", "currentDayNumber", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "MONTH", ",", "1", ")", ";", "}", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "int", "useDayNumber", "=", "requiredDayNumber", ";", "int", "maxDayNumber", "=", "calendar", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "if", "(", "useDayNumber", ">", "maxDayNumber", ")", "{", "useDayNumber", "=", "maxDayNumber", ";", "}", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "useDayNumber", ")", ";", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "MONTH", ",", "frequency", ")", ";", "}", "}" ]
Calculate start dates for a monthly absolute recurrence. @param calendar current date @param frequency frequency @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "monthly", "absolute", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L520-L543
157,231
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getYearlyDates
private void getYearlyDates(Calendar calendar, List<Date> dates) { if (m_relative) { getYearlyRelativeDates(calendar, dates); } else { getYearlyAbsoluteDates(calendar, dates); } }
java
private void getYearlyDates(Calendar calendar, List<Date> dates) { if (m_relative) { getYearlyRelativeDates(calendar, dates); } else { getYearlyAbsoluteDates(calendar, dates); } }
[ "private", "void", "getYearlyDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "if", "(", "m_relative", ")", "{", "getYearlyRelativeDates", "(", "calendar", ",", "dates", ")", ";", "}", "else", "{", "getYearlyAbsoluteDates", "(", "calendar", ",", "dates", ")", ";", "}", "}" ]
Calculate start dates for a yearly recurrence. @param calendar current date @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "yearly", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L551-L561
157,232
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getYearlyRelativeDates
private void getYearlyRelativeDates(Calendar calendar, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
java
private void getYearlyRelativeDates(Calendar calendar, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int dayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { if (dayNumber > 4) { setCalendarToLastRelativeDay(calendar); } else { setCalendarToOrdinalRelativeDay(calendar, dayNumber); } if (calendar.getTimeInMillis() > startDate) { dates.add(calendar.getTime()); if (!moreDates(calendar, dates)) { break; } } calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
[ "private", "void", "getYearlyRelativeDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "long", "startDate", "=", "calendar", ".", "getTimeInMillis", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "MONTH", ",", "NumberHelper", ".", "getInt", "(", "m_monthNumber", ")", "-", "1", ")", ";", "int", "dayNumber", "=", "NumberHelper", ".", "getInt", "(", "m_dayNumber", ")", ";", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "if", "(", "dayNumber", ">", "4", ")", "{", "setCalendarToLastRelativeDay", "(", "calendar", ")", ";", "}", "else", "{", "setCalendarToOrdinalRelativeDay", "(", "calendar", ",", "dayNumber", ")", ";", "}", "if", "(", "calendar", ".", "getTimeInMillis", "(", ")", ">", "startDate", ")", "{", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "if", "(", "!", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "break", ";", "}", "}", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "}", "}" ]
Calculate start dates for a yearly relative recurrence. @param calendar current date @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "yearly", "relative", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L569-L598
157,233
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getYearlyAbsoluteDates
private void getYearlyAbsoluteDates(Calendar calendar, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); if (calendar.getTimeInMillis() < startDate) { calendar.add(Calendar.YEAR, 1); } dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
java
private void getYearlyAbsoluteDates(Calendar calendar, List<Date> dates) { long startDate = calendar.getTimeInMillis(); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.set(Calendar.MONTH, NumberHelper.getInt(m_monthNumber) - 1); int requiredDayNumber = NumberHelper.getInt(m_dayNumber); while (moreDates(calendar, dates)) { int useDayNumber = requiredDayNumber; int maxDayNumber = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); if (useDayNumber > maxDayNumber) { useDayNumber = maxDayNumber; } calendar.set(Calendar.DAY_OF_MONTH, useDayNumber); if (calendar.getTimeInMillis() < startDate) { calendar.add(Calendar.YEAR, 1); } dates.add(calendar.getTime()); calendar.set(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.YEAR, 1); } }
[ "private", "void", "getYearlyAbsoluteDates", "(", "Calendar", "calendar", ",", "List", "<", "Date", ">", "dates", ")", "{", "long", "startDate", "=", "calendar", ".", "getTimeInMillis", "(", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "MONTH", ",", "NumberHelper", ".", "getInt", "(", "m_monthNumber", ")", "-", "1", ")", ";", "int", "requiredDayNumber", "=", "NumberHelper", ".", "getInt", "(", "m_dayNumber", ")", ";", "while", "(", "moreDates", "(", "calendar", ",", "dates", ")", ")", "{", "int", "useDayNumber", "=", "requiredDayNumber", ";", "int", "maxDayNumber", "=", "calendar", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ";", "if", "(", "useDayNumber", ">", "maxDayNumber", ")", "{", "useDayNumber", "=", "maxDayNumber", ";", "}", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "useDayNumber", ")", ";", "if", "(", "calendar", ".", "getTimeInMillis", "(", ")", "<", "startDate", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "}", "dates", ".", "add", "(", "calendar", ".", "getTime", "(", ")", ")", ";", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "1", ")", ";", "calendar", ".", "add", "(", "Calendar", ".", "YEAR", ",", "1", ")", ";", "}", "}" ]
Calculate start dates for a yearly absolute recurrence. @param calendar current date @param dates array of start dates
[ "Calculate", "start", "dates", "for", "a", "yearly", "absolute", "recurrence", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L606-L632
157,234
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.setCalendarToOrdinalRelativeDay
private void setCalendarToOrdinalRelativeDay(Calendar calendar, int dayNumber) { int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int requiredDayOfWeek = getDayOfWeek().getValue(); int dayOfWeekOffset = 0; if (requiredDayOfWeek > currentDayOfWeek) { dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek; } else { if (requiredDayOfWeek < currentDayOfWeek) { dayOfWeekOffset = 7 - (currentDayOfWeek - requiredDayOfWeek); } } if (dayOfWeekOffset != 0) { calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset); } if (dayNumber > 1) { calendar.add(Calendar.DAY_OF_YEAR, (7 * (dayNumber - 1))); } }
java
private void setCalendarToOrdinalRelativeDay(Calendar calendar, int dayNumber) { int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int requiredDayOfWeek = getDayOfWeek().getValue(); int dayOfWeekOffset = 0; if (requiredDayOfWeek > currentDayOfWeek) { dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek; } else { if (requiredDayOfWeek < currentDayOfWeek) { dayOfWeekOffset = 7 - (currentDayOfWeek - requiredDayOfWeek); } } if (dayOfWeekOffset != 0) { calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset); } if (dayNumber > 1) { calendar.add(Calendar.DAY_OF_YEAR, (7 * (dayNumber - 1))); } }
[ "private", "void", "setCalendarToOrdinalRelativeDay", "(", "Calendar", "calendar", ",", "int", "dayNumber", ")", "{", "int", "currentDayOfWeek", "=", "calendar", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "int", "requiredDayOfWeek", "=", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", ";", "int", "dayOfWeekOffset", "=", "0", ";", "if", "(", "requiredDayOfWeek", ">", "currentDayOfWeek", ")", "{", "dayOfWeekOffset", "=", "requiredDayOfWeek", "-", "currentDayOfWeek", ";", "}", "else", "{", "if", "(", "requiredDayOfWeek", "<", "currentDayOfWeek", ")", "{", "dayOfWeekOffset", "=", "7", "-", "(", "currentDayOfWeek", "-", "requiredDayOfWeek", ")", ";", "}", "}", "if", "(", "dayOfWeekOffset", "!=", "0", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "dayOfWeekOffset", ")", ";", "}", "if", "(", "dayNumber", ">", "1", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "(", "7", "*", "(", "dayNumber", "-", "1", ")", ")", ")", ";", "}", "}" ]
Moves a calendar to the nth named day of the month. @param calendar current date @param dayNumber nth day
[ "Moves", "a", "calendar", "to", "the", "nth", "named", "day", "of", "the", "month", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L640-L666
157,235
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.setCalendarToLastRelativeDay
private void setCalendarToLastRelativeDay(Calendar calendar) { calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int requiredDayOfWeek = getDayOfWeek().getValue(); int dayOfWeekOffset = 0; if (currentDayOfWeek > requiredDayOfWeek) { dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek; } else { if (currentDayOfWeek < requiredDayOfWeek) { dayOfWeekOffset = -7 + (requiredDayOfWeek - currentDayOfWeek); } } if (dayOfWeekOffset != 0) { calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset); } }
java
private void setCalendarToLastRelativeDay(Calendar calendar) { calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); int currentDayOfWeek = calendar.get(Calendar.DAY_OF_WEEK); int requiredDayOfWeek = getDayOfWeek().getValue(); int dayOfWeekOffset = 0; if (currentDayOfWeek > requiredDayOfWeek) { dayOfWeekOffset = requiredDayOfWeek - currentDayOfWeek; } else { if (currentDayOfWeek < requiredDayOfWeek) { dayOfWeekOffset = -7 + (requiredDayOfWeek - currentDayOfWeek); } } if (dayOfWeekOffset != 0) { calendar.add(Calendar.DAY_OF_YEAR, dayOfWeekOffset); } }
[ "private", "void", "setCalendarToLastRelativeDay", "(", "Calendar", "calendar", ")", "{", "calendar", ".", "set", "(", "Calendar", ".", "DAY_OF_MONTH", ",", "calendar", ".", "getActualMaximum", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ";", "int", "currentDayOfWeek", "=", "calendar", ".", "get", "(", "Calendar", ".", "DAY_OF_WEEK", ")", ";", "int", "requiredDayOfWeek", "=", "getDayOfWeek", "(", ")", ".", "getValue", "(", ")", ";", "int", "dayOfWeekOffset", "=", "0", ";", "if", "(", "currentDayOfWeek", ">", "requiredDayOfWeek", ")", "{", "dayOfWeekOffset", "=", "requiredDayOfWeek", "-", "currentDayOfWeek", ";", "}", "else", "{", "if", "(", "currentDayOfWeek", "<", "requiredDayOfWeek", ")", "{", "dayOfWeekOffset", "=", "-", "7", "+", "(", "requiredDayOfWeek", "-", "currentDayOfWeek", ")", ";", "}", "}", "if", "(", "dayOfWeekOffset", "!=", "0", ")", "{", "calendar", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "dayOfWeekOffset", ")", ";", "}", "}" ]
Moves a calendar to the last named day of the month. @param calendar current date
[ "Moves", "a", "calendar", "to", "the", "last", "named", "day", "of", "the", "month", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L673-L696
157,236
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.setYearlyAbsoluteFromDate
public void setYearlyAbsoluteFromDate(Date date) { if (date != null) { Calendar cal = DateHelper.popCalendar(date); m_dayNumber = Integer.valueOf(cal.get(Calendar.DAY_OF_MONTH)); m_monthNumber = Integer.valueOf(cal.get(Calendar.MONTH) + 1); DateHelper.pushCalendar(cal); } }
java
public void setYearlyAbsoluteFromDate(Date date) { if (date != null) { Calendar cal = DateHelper.popCalendar(date); m_dayNumber = Integer.valueOf(cal.get(Calendar.DAY_OF_MONTH)); m_monthNumber = Integer.valueOf(cal.get(Calendar.MONTH) + 1); DateHelper.pushCalendar(cal); } }
[ "public", "void", "setYearlyAbsoluteFromDate", "(", "Date", "date", ")", "{", "if", "(", "date", "!=", "null", ")", "{", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", "date", ")", ";", "m_dayNumber", "=", "Integer", ".", "valueOf", "(", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_MONTH", ")", ")", ";", "m_monthNumber", "=", "Integer", ".", "valueOf", "(", "cal", ".", "get", "(", "Calendar", ".", "MONTH", ")", "+", "1", ")", ";", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "}", "}" ]
Sets the yearly absolute date. @param date yearly absolute date
[ "Sets", "the", "yearly", "absolute", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L703-L712
157,237
joniles/mpxj
src/main/java/net/sf/mpxj/RecurringData.java
RecurringData.getOrdinal
private String getOrdinal(Integer value) { String result; int index = value.intValue(); if (index >= ORDINAL.length) { result = "every " + index + "th"; } else { result = ORDINAL[index]; } return result; }
java
private String getOrdinal(Integer value) { String result; int index = value.intValue(); if (index >= ORDINAL.length) { result = "every " + index + "th"; } else { result = ORDINAL[index]; } return result; }
[ "private", "String", "getOrdinal", "(", "Integer", "value", ")", "{", "String", "result", ";", "int", "index", "=", "value", ".", "intValue", "(", ")", ";", "if", "(", "index", ">=", "ORDINAL", ".", "length", ")", "{", "result", "=", "\"every \"", "+", "index", "+", "\"th\"", ";", "}", "else", "{", "result", "=", "ORDINAL", "[", "index", "]", ";", "}", "return", "result", ";", "}" ]
Retrieve the ordinal text for a given integer. @param value integer value @return ordinal text
[ "Retrieve", "the", "ordinal", "text", "for", "a", "given", "integer", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/RecurringData.java#L720-L733
157,238
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/PriorityUtility.java
PriorityUtility.getInstance
public static Priority getInstance(Locale locale, String priority) { int index = DEFAULT_PRIORITY_INDEX; if (priority != null) { String[] priorityTypes = LocaleData.getStringArray(locale, LocaleData.PRIORITY_TYPES); for (int loop = 0; loop < priorityTypes.length; loop++) { if (priorityTypes[loop].equalsIgnoreCase(priority) == true) { index = loop; break; } } } return (Priority.getInstance((index + 1) * 100)); }
java
public static Priority getInstance(Locale locale, String priority) { int index = DEFAULT_PRIORITY_INDEX; if (priority != null) { String[] priorityTypes = LocaleData.getStringArray(locale, LocaleData.PRIORITY_TYPES); for (int loop = 0; loop < priorityTypes.length; loop++) { if (priorityTypes[loop].equalsIgnoreCase(priority) == true) { index = loop; break; } } } return (Priority.getInstance((index + 1) * 100)); }
[ "public", "static", "Priority", "getInstance", "(", "Locale", "locale", ",", "String", "priority", ")", "{", "int", "index", "=", "DEFAULT_PRIORITY_INDEX", ";", "if", "(", "priority", "!=", "null", ")", "{", "String", "[", "]", "priorityTypes", "=", "LocaleData", ".", "getStringArray", "(", "locale", ",", "LocaleData", ".", "PRIORITY_TYPES", ")", ";", "for", "(", "int", "loop", "=", "0", ";", "loop", "<", "priorityTypes", ".", "length", ";", "loop", "++", ")", "{", "if", "(", "priorityTypes", "[", "loop", "]", ".", "equalsIgnoreCase", "(", "priority", ")", "==", "true", ")", "{", "index", "=", "loop", ";", "break", ";", "}", "}", "}", "return", "(", "Priority", ".", "getInstance", "(", "(", "index", "+", "1", ")", "*", "100", ")", ")", ";", "}" ]
This method takes the textual version of a priority and returns an appropriate instance of this class. Note that unrecognised values are treated as medium priority. @param locale target locale @param priority text version of the priority @return Priority class instance
[ "This", "method", "takes", "the", "textual", "version", "of", "a", "priority", "and", "returns", "an", "appropriate", "instance", "of", "this", "class", ".", "Note", "that", "unrecognised", "values", "are", "treated", "as", "medium", "priority", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/PriorityUtility.java#L53-L71
157,239
joniles/mpxj
src/main/java/net/sf/mpxj/Duration.java
Duration.add
public static Duration add(Duration a, Duration b, ProjectProperties defaults) { if (a == null && b == null) { return null; } if (a == null) { return b; } if (b == null) { return a; } TimeUnit unit = a.getUnits(); if (b.getUnits() != unit) { b = b.convertUnits(unit, defaults); } return Duration.getInstance(a.getDuration() + b.getDuration(), unit); }
java
public static Duration add(Duration a, Duration b, ProjectProperties defaults) { if (a == null && b == null) { return null; } if (a == null) { return b; } if (b == null) { return a; } TimeUnit unit = a.getUnits(); if (b.getUnits() != unit) { b = b.convertUnits(unit, defaults); } return Duration.getInstance(a.getDuration() + b.getDuration(), unit); }
[ "public", "static", "Duration", "add", "(", "Duration", "a", ",", "Duration", "b", ",", "ProjectProperties", "defaults", ")", "{", "if", "(", "a", "==", "null", "&&", "b", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "a", "==", "null", ")", "{", "return", "b", ";", "}", "if", "(", "b", "==", "null", ")", "{", "return", "a", ";", "}", "TimeUnit", "unit", "=", "a", ".", "getUnits", "(", ")", ";", "if", "(", "b", ".", "getUnits", "(", ")", "!=", "unit", ")", "{", "b", "=", "b", ".", "convertUnits", "(", "unit", ",", "defaults", ")", ";", "}", "return", "Duration", ".", "getInstance", "(", "a", ".", "getDuration", "(", ")", "+", "b", ".", "getDuration", "(", ")", ",", "unit", ")", ";", "}" ]
If a and b are not null, returns a new duration of a + b. If a is null and b is not null, returns b. If a is not null and b is null, returns a. If a and b are null, returns null. If needed, b is converted to a's time unit using the project properties. @param a first duration @param b second duration @param defaults project properties containing default values @return a + b
[ "If", "a", "and", "b", "are", "not", "null", "returns", "a", "new", "duration", "of", "a", "+", "b", ".", "If", "a", "is", "null", "and", "b", "is", "not", "null", "returns", "b", ".", "If", "a", "is", "not", "null", "and", "b", "is", "null", "returns", "a", ".", "If", "a", "and", "b", "are", "null", "returns", "null", ".", "If", "needed", "b", "is", "converted", "to", "a", "s", "time", "unit", "using", "the", "project", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/Duration.java#L405-L426
157,240
joniles/mpxj
src/main/java/net/sf/mpxj/reader/ProjectReaderUtility.java
ProjectReaderUtility.getProjectReader
public static ProjectReader getProjectReader(String name) throws MPXJException { int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectReader> fileClass = READER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot read files of type: " + extension); } try { ProjectReader file = fileClass.newInstance(); return (file); } catch (Exception ex) { throw new MPXJException("Failed to load project reader", ex); } }
java
public static ProjectReader getProjectReader(String name) throws MPXJException { int index = name.lastIndexOf('.'); if (index == -1) { throw new IllegalArgumentException("Filename has no extension: " + name); } String extension = name.substring(index + 1).toUpperCase(); Class<? extends ProjectReader> fileClass = READER_MAP.get(extension); if (fileClass == null) { throw new IllegalArgumentException("Cannot read files of type: " + extension); } try { ProjectReader file = fileClass.newInstance(); return (file); } catch (Exception ex) { throw new MPXJException("Failed to load project reader", ex); } }
[ "public", "static", "ProjectReader", "getProjectReader", "(", "String", "name", ")", "throws", "MPXJException", "{", "int", "index", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "==", "-", "1", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Filename has no extension: \"", "+", "name", ")", ";", "}", "String", "extension", "=", "name", ".", "substring", "(", "index", "+", "1", ")", ".", "toUpperCase", "(", ")", ";", "Class", "<", "?", "extends", "ProjectReader", ">", "fileClass", "=", "READER_MAP", ".", "get", "(", "extension", ")", ";", "if", "(", "fileClass", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Cannot read files of type: \"", "+", "extension", ")", ";", "}", "try", "{", "ProjectReader", "file", "=", "fileClass", ".", "newInstance", "(", ")", ";", "return", "(", "file", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "throw", "new", "MPXJException", "(", "\"Failed to load project reader\"", ",", "ex", ")", ";", "}", "}" ]
Retrieves a ProjectReader instance which can read a file of the type specified by the supplied file name. @param name file name @return ProjectReader instance
[ "Retrieves", "a", "ProjectReader", "instance", "which", "can", "read", "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/reader/ProjectReaderUtility.java#L66-L92
157,241
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.processCalendars
private void processCalendars() throws SQLException { for (ResultSetRow row : getRows("SELECT * FROM MSP_CALENDARS WHERE PROJ_ID=?", m_projectID)) { processCalendar(row); } updateBaseCalendarNames(); processCalendarData(m_project.getCalendars()); }
java
private void processCalendars() throws SQLException { for (ResultSetRow row : getRows("SELECT * FROM MSP_CALENDARS WHERE PROJ_ID=?", m_projectID)) { processCalendar(row); } updateBaseCalendarNames(); processCalendarData(m_project.getCalendars()); }
[ "private", "void", "processCalendars", "(", ")", "throws", "SQLException", "{", "for", "(", "ResultSetRow", "row", ":", "getRows", "(", "\"SELECT * FROM MSP_CALENDARS WHERE PROJ_ID=?\"", ",", "m_projectID", ")", ")", "{", "processCalendar", "(", "row", ")", ";", "}", "updateBaseCalendarNames", "(", ")", ";", "processCalendarData", "(", "m_project", ".", "getCalendars", "(", ")", ")", ";", "}" ]
Select calendar data from the database. @throws SQLException
[ "Select", "calendar", "data", "from", "the", "database", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L187-L197
157,242
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.processCalendarData
private void processCalendarData(List<ProjectCalendar> calendars) throws SQLException { for (ProjectCalendar calendar : calendars) { processCalendarData(calendar, getRows("SELECT * FROM MSP_CALENDAR_DATA WHERE PROJ_ID=? AND CAL_UID=?", m_projectID, calendar.getUniqueID())); } }
java
private void processCalendarData(List<ProjectCalendar> calendars) throws SQLException { for (ProjectCalendar calendar : calendars) { processCalendarData(calendar, getRows("SELECT * FROM MSP_CALENDAR_DATA WHERE PROJ_ID=? AND CAL_UID=?", m_projectID, calendar.getUniqueID())); } }
[ "private", "void", "processCalendarData", "(", "List", "<", "ProjectCalendar", ">", "calendars", ")", "throws", "SQLException", "{", "for", "(", "ProjectCalendar", "calendar", ":", "calendars", ")", "{", "processCalendarData", "(", "calendar", ",", "getRows", "(", "\"SELECT * FROM MSP_CALENDAR_DATA WHERE PROJ_ID=? AND CAL_UID=?\"", ",", "m_projectID", ",", "calendar", ".", "getUniqueID", "(", ")", ")", ")", ";", "}", "}" ]
Process calendar hours and exception data from the database. @param calendars all calendars for the project
[ "Process", "calendar", "hours", "and", "exception", "data", "from", "the", "database", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L204-L210
157,243
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.processCalendarData
private void processCalendarData(ProjectCalendar calendar, List<ResultSetRow> calendarData) { for (ResultSetRow row : calendarData) { processCalendarData(calendar, row); } }
java
private void processCalendarData(ProjectCalendar calendar, List<ResultSetRow> calendarData) { for (ResultSetRow row : calendarData) { processCalendarData(calendar, row); } }
[ "private", "void", "processCalendarData", "(", "ProjectCalendar", "calendar", ",", "List", "<", "ResultSetRow", ">", "calendarData", ")", "{", "for", "(", "ResultSetRow", "row", ":", "calendarData", ")", "{", "processCalendarData", "(", "calendar", ",", "row", ")", ";", "}", "}" ]
Process the hours and exceptions for an individual calendar. @param calendar project calendar @param calendarData hours and exception rows for this calendar
[ "Process", "the", "hours", "and", "exceptions", "for", "an", "individual", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L218-L224
157,244
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.processSubProjects
private void processSubProjects() { int subprojectIndex = 1; for (Task task : m_project.getTasks()) { String subProjectFileName = task.getSubprojectName(); if (subProjectFileName != null) { String fileName = subProjectFileName; int offset = 0x01000000 + (subprojectIndex * 0x00400000); int index = subProjectFileName.lastIndexOf('\\'); if (index != -1) { fileName = subProjectFileName.substring(index + 1); } SubProject sp = new SubProject(); sp.setFileName(fileName); sp.setFullPath(subProjectFileName); sp.setUniqueIDOffset(Integer.valueOf(offset)); sp.setTaskUniqueID(task.getUniqueID()); task.setSubProject(sp); ++subprojectIndex; } } }
java
private void processSubProjects() { int subprojectIndex = 1; for (Task task : m_project.getTasks()) { String subProjectFileName = task.getSubprojectName(); if (subProjectFileName != null) { String fileName = subProjectFileName; int offset = 0x01000000 + (subprojectIndex * 0x00400000); int index = subProjectFileName.lastIndexOf('\\'); if (index != -1) { fileName = subProjectFileName.substring(index + 1); } SubProject sp = new SubProject(); sp.setFileName(fileName); sp.setFullPath(subProjectFileName); sp.setUniqueIDOffset(Integer.valueOf(offset)); sp.setTaskUniqueID(task.getUniqueID()); task.setSubProject(sp); ++subprojectIndex; } } }
[ "private", "void", "processSubProjects", "(", ")", "{", "int", "subprojectIndex", "=", "1", ";", "for", "(", "Task", "task", ":", "m_project", ".", "getTasks", "(", ")", ")", "{", "String", "subProjectFileName", "=", "task", ".", "getSubprojectName", "(", ")", ";", "if", "(", "subProjectFileName", "!=", "null", ")", "{", "String", "fileName", "=", "subProjectFileName", ";", "int", "offset", "=", "0x01000000", "+", "(", "subprojectIndex", "*", "0x00400000", ")", ";", "int", "index", "=", "subProjectFileName", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index", "!=", "-", "1", ")", "{", "fileName", "=", "subProjectFileName", ".", "substring", "(", "index", "+", "1", ")", ";", "}", "SubProject", "sp", "=", "new", "SubProject", "(", ")", ";", "sp", ".", "setFileName", "(", "fileName", ")", ";", "sp", ".", "setFullPath", "(", "subProjectFileName", ")", ";", "sp", ".", "setUniqueIDOffset", "(", "Integer", ".", "valueOf", "(", "offset", ")", ")", ";", "sp", ".", "setTaskUniqueID", "(", "task", ".", "getUniqueID", "(", ")", ")", ";", "task", ".", "setSubProject", "(", "sp", ")", ";", "++", "subprojectIndex", ";", "}", "}", "}" ]
The only indication that a task is a SubProject is the contents of the subproject file name field. We test these here then add a skeleton subproject structure to match the way we do things with MPP files.
[ "The", "only", "indication", "that", "a", "task", "is", "a", "SubProject", "is", "the", "contents", "of", "the", "subproject", "file", "name", "field", ".", "We", "test", "these", "here", "then", "add", "a", "skeleton", "subproject", "structure", "to", "match", "the", "way", "we", "do", "things", "with", "MPP", "files", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L346-L372
157,245
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.processOutlineCodeFields
private void processOutlineCodeFields(Row parentRow) throws SQLException { Integer entityID = parentRow.getInteger("CODE_REF_UID"); Integer outlineCodeEntityID = parentRow.getInteger("CODE_UID"); for (ResultSetRow row : getRows("SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?", outlineCodeEntityID)) { processOutlineCodeField(entityID, row); } }
java
private void processOutlineCodeFields(Row parentRow) throws SQLException { Integer entityID = parentRow.getInteger("CODE_REF_UID"); Integer outlineCodeEntityID = parentRow.getInteger("CODE_UID"); for (ResultSetRow row : getRows("SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?", outlineCodeEntityID)) { processOutlineCodeField(entityID, row); } }
[ "private", "void", "processOutlineCodeFields", "(", "Row", "parentRow", ")", "throws", "SQLException", "{", "Integer", "entityID", "=", "parentRow", ".", "getInteger", "(", "\"CODE_REF_UID\"", ")", ";", "Integer", "outlineCodeEntityID", "=", "parentRow", ".", "getInteger", "(", "\"CODE_UID\"", ")", ";", "for", "(", "ResultSetRow", "row", ":", "getRows", "(", "\"SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?\"", ",", "outlineCodeEntityID", ")", ")", "{", "processOutlineCodeField", "(", "entityID", ",", "row", ")", ";", "}", "}" ]
Process a single outline code. @param parentRow outline code to task mapping table @throws SQLException
[ "Process", "a", "single", "outline", "code", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L458-L467
157,246
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.allocateConnection
private void allocateConnection() throws SQLException { if (m_connection == null) { m_connection = m_dataSource.getConnection(); m_allocatedConnection = true; queryDatabaseMetaData(); } }
java
private void allocateConnection() throws SQLException { if (m_connection == null) { m_connection = m_dataSource.getConnection(); m_allocatedConnection = true; queryDatabaseMetaData(); } }
[ "private", "void", "allocateConnection", "(", ")", "throws", "SQLException", "{", "if", "(", "m_connection", "==", "null", ")", "{", "m_connection", "=", "m_dataSource", ".", "getConnection", "(", ")", ";", "m_allocatedConnection", "=", "true", ";", "queryDatabaseMetaData", "(", ")", ";", "}", "}" ]
Allocates a database connection. @throws SQLException
[ "Allocates", "a", "database", "connection", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L578-L586
157,247
joniles/mpxj
src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java
MPD9DatabaseReader.queryDatabaseMetaData
private void queryDatabaseMetaData() { ResultSet rs = null; try { Set<String> tables = new HashSet<String>(); DatabaseMetaData dmd = m_connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tables.add(rs.getString("TABLE_NAME")); } m_hasResourceBaselines = tables.contains("MSP_RESOURCE_BASELINES"); m_hasTaskBaselines = tables.contains("MSP_TASK_BASELINES"); m_hasAssignmentBaselines = tables.contains("MSP_ASSIGNMENT_BASELINES"); } catch (Exception ex) { // Ignore errors when reading meta data } finally { if (rs != null) { try { rs.close(); } catch (SQLException ex) { // Ignore errors when closing result set } rs = null; } } }
java
private void queryDatabaseMetaData() { ResultSet rs = null; try { Set<String> tables = new HashSet<String>(); DatabaseMetaData dmd = m_connection.getMetaData(); rs = dmd.getTables(null, null, null, null); while (rs.next()) { tables.add(rs.getString("TABLE_NAME")); } m_hasResourceBaselines = tables.contains("MSP_RESOURCE_BASELINES"); m_hasTaskBaselines = tables.contains("MSP_TASK_BASELINES"); m_hasAssignmentBaselines = tables.contains("MSP_ASSIGNMENT_BASELINES"); } catch (Exception ex) { // Ignore errors when reading meta data } finally { if (rs != null) { try { rs.close(); } catch (SQLException ex) { // Ignore errors when closing result set } rs = null; } } }
[ "private", "void", "queryDatabaseMetaData", "(", ")", "{", "ResultSet", "rs", "=", "null", ";", "try", "{", "Set", "<", "String", ">", "tables", "=", "new", "HashSet", "<", "String", ">", "(", ")", ";", "DatabaseMetaData", "dmd", "=", "m_connection", ".", "getMetaData", "(", ")", ";", "rs", "=", "dmd", ".", "getTables", "(", "null", ",", "null", ",", "null", ",", "null", ")", ";", "while", "(", "rs", ".", "next", "(", ")", ")", "{", "tables", ".", "add", "(", "rs", ".", "getString", "(", "\"TABLE_NAME\"", ")", ")", ";", "}", "m_hasResourceBaselines", "=", "tables", ".", "contains", "(", "\"MSP_RESOURCE_BASELINES\"", ")", ";", "m_hasTaskBaselines", "=", "tables", ".", "contains", "(", "\"MSP_TASK_BASELINES\"", ")", ";", "m_hasAssignmentBaselines", "=", "tables", ".", "contains", "(", "\"MSP_ASSIGNMENT_BASELINES\"", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "// Ignore errors when reading meta data", "}", "finally", "{", "if", "(", "rs", "!=", "null", ")", "{", "try", "{", "rs", ".", "close", "(", ")", ";", "}", "catch", "(", "SQLException", "ex", ")", "{", "// Ignore errors when closing result set", "}", "rs", "=", "null", ";", "}", "}", "}" ]
Queries database meta data to check for the existence of specific tables.
[ "Queries", "database", "meta", "data", "to", "check", "for", "the", "existence", "of", "specific", "tables", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpd/MPD9DatabaseReader.java#L669-L709
157,248
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java
DatatypeConverter.parseUUID
public static final UUID parseUUID(String value) { UUID result = null; if (value != null && !value.isEmpty()) { if (value.charAt(0) == '{') { // PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID> result = UUID.fromString(value.substring(1, value.length() - 1)); } else { // XER representation: CrkTPqCalki5irI4SJSsRA byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "=="); long msb = 0; long lsb = 0; for (int i = 0; i < 8; i++) { msb = (msb << 8) | (data[i] & 0xff); } for (int i = 8; i < 16; i++) { lsb = (lsb << 8) | (data[i] & 0xff); } result = new UUID(msb, lsb); } } return result; }
java
public static final UUID parseUUID(String value) { UUID result = null; if (value != null && !value.isEmpty()) { if (value.charAt(0) == '{') { // PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID> result = UUID.fromString(value.substring(1, value.length() - 1)); } else { // XER representation: CrkTPqCalki5irI4SJSsRA byte[] data = javax.xml.bind.DatatypeConverter.parseBase64Binary(value + "=="); long msb = 0; long lsb = 0; for (int i = 0; i < 8; i++) { msb = (msb << 8) | (data[i] & 0xff); } for (int i = 8; i < 16; i++) { lsb = (lsb << 8) | (data[i] & 0xff); } result = new UUID(msb, lsb); } } return result; }
[ "public", "static", "final", "UUID", "parseUUID", "(", "String", "value", ")", "{", "UUID", "result", "=", "null", ";", "if", "(", "value", "!=", "null", "&&", "!", "value", ".", "isEmpty", "(", ")", ")", "{", "if", "(", "value", ".", "charAt", "(", "0", ")", "==", "'", "'", ")", "{", "// PMXML representation: <GUID>{0AB9133E-A09A-9648-B98A-B2384894AC44}</GUID>", "result", "=", "UUID", ".", "fromString", "(", "value", ".", "substring", "(", "1", ",", "value", ".", "length", "(", ")", "-", "1", ")", ")", ";", "}", "else", "{", "// XER representation: CrkTPqCalki5irI4SJSsRA", "byte", "[", "]", "data", "=", "javax", ".", "xml", ".", "bind", ".", "DatatypeConverter", ".", "parseBase64Binary", "(", "value", "+", "\"==\"", ")", ";", "long", "msb", "=", "0", ";", "long", "lsb", "=", "0", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "8", ";", "i", "++", ")", "{", "msb", "=", "(", "msb", "<<", "8", ")", "|", "(", "data", "[", "i", "]", "&", "0xff", ")", ";", "}", "for", "(", "int", "i", "=", "8", ";", "i", "<", "16", ";", "i", "++", ")", "{", "lsb", "=", "(", "lsb", "<<", "8", ")", "|", "(", "data", "[", "i", "]", "&", "0xff", ")", ";", "}", "result", "=", "new", "UUID", "(", "msb", ",", "lsb", ")", ";", "}", "}", "return", "result", ";", "}" ]
Convert the Primavera string representation of a UUID into a Java UUID instance. @param value Primavera UUID @return Java UUID instance
[ "Convert", "the", "Primavera", "string", "representation", "of", "a", "UUID", "into", "a", "Java", "UUID", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java#L44-L75
157,249
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java
DatatypeConverter.printUUID
public static String printUUID(UUID guid) { return guid == null ? null : "{" + guid.toString().toUpperCase() + "}"; }
java
public static String printUUID(UUID guid) { return guid == null ? null : "{" + guid.toString().toUpperCase() + "}"; }
[ "public", "static", "String", "printUUID", "(", "UUID", "guid", ")", "{", "return", "guid", "==", "null", "?", "null", ":", "\"{\"", "+", "guid", ".", "toString", "(", ")", ".", "toUpperCase", "(", ")", "+", "\"}\"", ";", "}" ]
Retrieve a UUID in the form required by Primavera PMXML. @param guid UUID instance @return formatted UUID
[ "Retrieve", "a", "UUID", "in", "the", "form", "required", "by", "Primavera", "PMXML", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java#L83-L86
157,250
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java
DatatypeConverter.printTime
public static final String printTime(Date value) { return (value == null ? null : TIME_FORMAT.get().format(value)); }
java
public static final String printTime(Date value) { return (value == null ? null : TIME_FORMAT.get().format(value)); }
[ "public", "static", "final", "String", "printTime", "(", "Date", "value", ")", "{", "return", "(", "value", "==", "null", "?", "null", ":", "TIME_FORMAT", ".", "get", "(", ")", ".", "format", "(", "value", ")", ")", ";", "}" ]
Print a time value. @param value time value @return time value
[ "Print", "a", "time", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/DatatypeConverter.java#L131-L134
157,251
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
157,252
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", "(", ")", ")", ">", "MS_PROJECT_MAX_UNIQUE_ID", ")", "{", "renumberUniqueIDs", "(", ")", ";", "break", ";", "}", "}", "}", "}" ]
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", "renumber", "them", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectEntityContainer.java#L74-L87
157,253
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", ">", "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", ")", ")", ";", "}", "}" ]
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
157,254
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", "(", ")", ";", "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", ")", ")", ";", "}", "}", "}" ]
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
157,255
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", "=", "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", ")", ";", "}" ]
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
157,256
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 forward until we find a working hour", "while", "(", "hour", "<", "24", ")", "{", "if", "(", "(", "value", "&", "0x1", ")", "!=", "0", ")", "{", "++", "hoursPerDay", ";", "}", "value", "=", "value", ">>", "1", ";", "++", "hour", ";", "}", "}", "return", "hoursPerDay", ";", "}" ]
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
157,257
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\"", ")", ")", ";", "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", "}", "}", "}", "}" ]
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
157,258
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", ".", "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", ")", ";", "}", "}" ]
Read activities.
[ "Read", "activities", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/suretrak/SureTrakDatabaseReader.java#L588-L636
157,259
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", "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", ")", ";", "}" ]
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
157,260
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", ".", "getWorkTimeUnits", "(", "format", ")", ";", "}", "return", "result", ";", "}" ]
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
157,261
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", ".", "CONSTRAINT_TYPES", ")", ";", "for", "(", "int", "loop", "=", "0", ";", "loop", "<", "constraintTypes", ".", "length", ";", "loop", "++", ")", "{", "if", "(", "constraintTypes", "[", "loop", "]", ".", "equalsIgnoreCase", "(", "type", ")", "==", "true", ")", "{", "index", "=", "loop", ";", "break", ";", "}", "}", "return", "(", "ConstraintType", ".", "getInstance", "(", "index", ")", ")", ";", "}" ]
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", "constraints", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/ConstraintTypeUtility.java#L53-L68
157,262
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", ")", ";", "listResources", "(", "mpx", ")", ";", "listTasks", "(", "mpx", ")", ";", "listAssignments", "(", "mpx", ")", ";", "listAssignmentsByTask", "(", "mpx", ")", ";", "listAssignmentsByResource", "(", "mpx", ")", ";", "listHierarchy", "(", "mpx", ")", ";", "listTaskNotes", "(", "mpx", ")", ";", "listResourceNotes", "(", "mpx", ")", ";", "listRelationships", "(", "mpx", ")", ";", "listSlack", "(", "mpx", ")", ";", "listCalendars", "(", "mpx", ")", ";", "}" ]
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
157,263
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", "(", ")", ";", "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", "(", ")", ";", "}" ]
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
157,264
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", ".", "getName", "(", ")", "+", "\" (Unique ID=\"", "+", "resource", ".", "getUniqueID", "(", ")", "+", "\") Start=\"", "+", "resource", ".", "getStart", "(", ")", "+", "\" Finish=\"", "+", "resource", ".", "getFinish", "(", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}" ]
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
157,265
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", "(", ")", ")", "{", "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", "(", ")", ";", "}" ]
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
157,266
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", "(", ")", "+", "\"\\t\"", "+", "task", ".", "getStart", "(", ")", "+", "\"\\t\"", "+", "task", ".", "getFinish", "(", ")", ")", ";", "listHierarchy", "(", "task", ",", "\" \"", ")", ";", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}" ]
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
157,267
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: \"", "+", "child", ".", "getName", "(", ")", "+", "\"\\t\"", "+", "child", ".", "getStart", "(", ")", "+", "\"\\t\"", "+", "child", ".", "getFinish", "(", ")", ")", ";", "listHierarchy", "(", "child", ",", "indent", "+", "\" \"", ")", ";", "}", "}" ]
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
157,268
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", ".", "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", "(", ")", ";", "}" ]
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
157,269
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", "(", ")", ".", "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", "(", ")", ";", "}", "}" ]
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
157,270
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", ".", "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", "(", ")", ";", "}" ]
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", "on", "a", "task", "-", "by", "-", "task", "basis", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L306-L331
157,271
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 \"", "+", "resource", ".", "getName", "(", ")", "+", "\":\"", ")", ";", "for", "(", "ResourceAssignment", "assignment", ":", "resource", ".", "getTaskAssignments", "(", ")", ")", "{", "Task", "task", "=", "assignment", ".", "getTask", "(", ")", ";", "System", ".", "out", ".", "println", "(", "\" \"", "+", "task", ".", "getName", "(", ")", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}" ]
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", "assignments", "on", "a", "resource", "-", "by", "-", "resource", "basis", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjQuery.java#L340-L354
157,272
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", ".", "length", "(", ")", "!=", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"Notes for \"", "+", "task", ".", "getName", "(", ")", "+", "\": \"", "+", "notes", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}" ]
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
157,273
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", "(", "notes", ".", "length", "(", ")", "!=", "0", ")", "{", "System", ".", "out", ".", "println", "(", "\"Notes for \"", "+", "resource", ".", "getName", "(", ")", "+", "\": \"", "+", "notes", ")", ";", "}", "}", "System", ".", "out", ".", "println", "(", ")", ";", "}" ]
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
157,274
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", "(", ")", ")", ";", "System", ".", "out", ".", "print", "(", "'", "'", ")", ";", "System", ".", "out", ".", "print", "(", "task", ".", "getName", "(", ")", ")", ";", "System", ".", "out", ".", "print", "(", "'", "'", ")", ";", "dumpRelationList", "(", "task", ".", "getPredecessors", "(", ")", ")", ";", "System", ".", "out", ".", "print", "(", "'", "'", ")", ";", "dumpRelationList", "(", "task", ".", "getSuccessors", "(", ")", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "}", "}" ]
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
157,275
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", "(", ")", ">", "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", "(", "'", "'", ")", ";", "}", "}", "}" ]
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
157,276
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 Slack=\"", "+", "task", ".", "getTotalSlack", "(", ")", "+", "\" Start Slack=\"", "+", "task", ".", "getStartSlack", "(", ")", "+", "\" Finish Slack=\"", "+", "task", ".", "getFinishSlack", "(", ")", ")", ";", "}", "}" ]
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
157,277
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
157,278
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", "(", "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", ")", ";", "}" ]
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
157,279
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", ".", "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", ")", ";", "}" ]
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
157,280
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", "<", "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", ")", ";", "}" ]
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
157,281
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", "(", "m_preserveNoteFormatting", ")", ";", "reader", ".", "setDataSource", "(", "m_dataSource", ")", ";", "reader", ".", "setConnection", "(", "m_connection", ")", ";", "ProjectFile", "project", "=", "reader", ".", "read", "(", ")", ";", "return", "(", "project", ")", ";", "}" ]
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
157,282
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 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", "}", "}", "}", "}" ]
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
157,283
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", "==", "-", "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", ")", ";", "}" ]
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
157,284
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", ";", "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", "++", ";", "}", "}", "}" ]
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
157,285
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", "(", "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", "(", ")", ")", ";", "}", "}" ]
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
157,286
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", ")", ";", "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", ")", ";", "}", "}" ]
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
157,287
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", ")", ";", "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", ")", ";", "}", "}" ]
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
157,288
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", ";", "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", ";", "}" ]
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
157,289
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", ".", "getBoolean", "(", "(", "Boolean", ")", "value", ")", ";", "}", "return", "result", ";", "}" ]
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
157,290
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", ")", "{", "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", ";", "}" ]
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
157,291
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", ".", "doubleValue", "(", ")", ",", "m_table", ".", "getDurationTimeUnit", "(", ")", ")", ";", "}" ]
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
157,292
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", ".", "doubleValue", "(", ")", ",", "m_table", ".", "getWorkTimeUnit", "(", ")", ")", ";", "}" ]
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
157,293
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", "(", ")", "&&", "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", ";", "}" ]
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
157,294
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", ";", "}", "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", ")", ";", "}" ]
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
157,295
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", ":", "{", "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", ")", ")", ";", "}" ]
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
157,296
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", ".", "getValue", "(", ")", ";", "System", ".", "out", ".", "println", "(", "entry", ".", "getKey", "(", ")", "+", "\" = \"", "+", "value", "+", "\" ( \"", "+", "(", "value", "==", "null", "?", "\"\"", ":", "value", ".", "getClass", "(", ")", ".", "getName", "(", ")", ")", "+", "\")\"", ")", ";", "}", "}" ]
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
157,297
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", "=", "new", "LinkedList", "<", "String", ">", "(", ")", ";", "writeMapFile", "(", "mapFileName", ",", "jarFile", ",", "mapClassMethods", ")", ";", "}" ]
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
157,298
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", "=", "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", "(", ")", ";", "}" ]
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
157,299
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", "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", "(", ")", ";", "}" ]
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