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
156,900
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getTimestampFromLong
public static Date getTimestampFromLong(long timestamp) { TimeZone tz = TimeZone.getDefault(); Date result = new Date(timestamp - tz.getRawOffset()); if (tz.inDaylightTime(result) == true) { int savings; if (HAS_DST_SAVINGS == true) { savings = tz.getDSTSavings(); } else { savings = DEFAULT_DST_SAVINGS; } result = new Date(result.getTime() - savings); } return (result); }
java
public static Date getTimestampFromLong(long timestamp) { TimeZone tz = TimeZone.getDefault(); Date result = new Date(timestamp - tz.getRawOffset()); if (tz.inDaylightTime(result) == true) { int savings; if (HAS_DST_SAVINGS == true) { savings = tz.getDSTSavings(); } else { savings = DEFAULT_DST_SAVINGS; } result = new Date(result.getTime() - savings); } return (result); }
[ "public", "static", "Date", "getTimestampFromLong", "(", "long", "timestamp", ")", "{", "TimeZone", "tz", "=", "TimeZone", ".", "getDefault", "(", ")", ";", "Date", "result", "=", "new", "Date", "(", "timestamp", "-", "tz", ".", "getRawOffset", "(", ")", ")", ";", "if", "(", "tz", ".", "inDaylightTime", "(", "result", ")", "==", "true", ")", "{", "int", "savings", ";", "if", "(", "HAS_DST_SAVINGS", "==", "true", ")", "{", "savings", "=", "tz", ".", "getDSTSavings", "(", ")", ";", "}", "else", "{", "savings", "=", "DEFAULT_DST_SAVINGS", ";", "}", "result", "=", "new", "Date", "(", "result", ".", "getTime", "(", ")", "-", "savings", ")", ";", "}", "return", "(", "result", ")", ";", "}" ]
Creates a timestamp from the equivalent long value. This conversion takes account of the time zone and any daylight savings time. @param timestamp timestamp expressed as a long integer @return new Date instance
[ "Creates", "a", "timestamp", "from", "the", "equivalent", "long", "value", ".", "This", "conversion", "takes", "account", "of", "the", "time", "zone", "and", "any", "daylight", "savings", "time", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L288-L309
156,901
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.getTime
public static Date getTime(int hour, int minutes) { Calendar cal = popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, 0); Date result = cal.getTime(); pushCalendar(cal); return result; }
java
public static Date getTime(int hour, int minutes) { Calendar cal = popCalendar(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.SECOND, 0); Date result = cal.getTime(); pushCalendar(cal); return result; }
[ "public", "static", "Date", "getTime", "(", "int", "hour", ",", "int", "minutes", ")", "{", "Calendar", "cal", "=", "popCalendar", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hour", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minutes", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "Date", "result", "=", "cal", ".", "getTime", "(", ")", ";", "pushCalendar", "(", "cal", ")", ";", "return", "result", ";", "}" ]
Create a Date instance representing a specific time. @param hour hour 0-23 @param minutes minutes 0-59 @return new Date instance
[ "Create", "a", "Date", "instance", "representing", "a", "specific", "time", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L318-L327
156,902
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.setTime
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
java
public static void setTime(Calendar cal, Date time) { if (time != null) { Calendar startCalendar = popCalendar(time); cal.set(Calendar.HOUR_OF_DAY, startCalendar.get(Calendar.HOUR_OF_DAY)); cal.set(Calendar.MINUTE, startCalendar.get(Calendar.MINUTE)); cal.set(Calendar.SECOND, startCalendar.get(Calendar.SECOND)); pushCalendar(startCalendar); } }
[ "public", "static", "void", "setTime", "(", "Calendar", "cal", ",", "Date", "time", ")", "{", "if", "(", "time", "!=", "null", ")", "{", "Calendar", "startCalendar", "=", "popCalendar", "(", "time", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "startCalendar", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "startCalendar", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "startCalendar", ".", "get", "(", "Calendar", ".", "SECOND", ")", ")", ";", "pushCalendar", "(", "startCalendar", ")", ";", "}", "}" ]
Given a date represented by a Calendar instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param cal Calendar instance representing the date @param time Date instance representing the time of day
[ "Given", "a", "date", "represented", "by", "a", "Calendar", "instance", "set", "the", "time", "component", "of", "the", "date", "based", "on", "the", "hours", "and", "minutes", "of", "the", "time", "supplied", "by", "the", "Date", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L337-L347
156,903
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.setTime
public static Date setTime(Date date, Date canonicalTime) { Date result; if (canonicalTime == null) { result = date; } else { // // The original naive implementation of this method generated // the "start of day" date (midnight) for the required day // then added the milliseconds from the canonical time // to move the time forward to the required point. Unfortunately // if the date we'e trying to do this for is the entry or // exit from DST, the result is wrong, hence I've switched to // the approach below. // Calendar cal = popCalendar(canonicalTime); int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1; int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); int millisecond = cal.get(Calendar.MILLISECOND); cal.setTime(date); if (dayOffset != 0) { // The canonical time can be +1 day. // It's to do with the way we've historically // managed time ranges and midnight. cal.add(Calendar.DAY_OF_YEAR, dayOffset); } cal.set(Calendar.MILLISECOND, millisecond); cal.set(Calendar.SECOND, second); cal.set(Calendar.MINUTE, minute); cal.set(Calendar.HOUR_OF_DAY, hourOfDay); result = cal.getTime(); pushCalendar(cal); } return result; }
java
public static Date setTime(Date date, Date canonicalTime) { Date result; if (canonicalTime == null) { result = date; } else { // // The original naive implementation of this method generated // the "start of day" date (midnight) for the required day // then added the milliseconds from the canonical time // to move the time forward to the required point. Unfortunately // if the date we'e trying to do this for is the entry or // exit from DST, the result is wrong, hence I've switched to // the approach below. // Calendar cal = popCalendar(canonicalTime); int dayOffset = cal.get(Calendar.DAY_OF_YEAR) - 1; int hourOfDay = cal.get(Calendar.HOUR_OF_DAY); int minute = cal.get(Calendar.MINUTE); int second = cal.get(Calendar.SECOND); int millisecond = cal.get(Calendar.MILLISECOND); cal.setTime(date); if (dayOffset != 0) { // The canonical time can be +1 day. // It's to do with the way we've historically // managed time ranges and midnight. cal.add(Calendar.DAY_OF_YEAR, dayOffset); } cal.set(Calendar.MILLISECOND, millisecond); cal.set(Calendar.SECOND, second); cal.set(Calendar.MINUTE, minute); cal.set(Calendar.HOUR_OF_DAY, hourOfDay); result = cal.getTime(); pushCalendar(cal); } return result; }
[ "public", "static", "Date", "setTime", "(", "Date", "date", ",", "Date", "canonicalTime", ")", "{", "Date", "result", ";", "if", "(", "canonicalTime", "==", "null", ")", "{", "result", "=", "date", ";", "}", "else", "{", "//", "// The original naive implementation of this method generated", "// the \"start of day\" date (midnight) for the required day", "// then added the milliseconds from the canonical time", "// to move the time forward to the required point. Unfortunately", "// if the date we'e trying to do this for is the entry or", "// exit from DST, the result is wrong, hence I've switched to", "// the approach below.", "//", "Calendar", "cal", "=", "popCalendar", "(", "canonicalTime", ")", ";", "int", "dayOffset", "=", "cal", ".", "get", "(", "Calendar", ".", "DAY_OF_YEAR", ")", "-", "1", ";", "int", "hourOfDay", "=", "cal", ".", "get", "(", "Calendar", ".", "HOUR_OF_DAY", ")", ";", "int", "minute", "=", "cal", ".", "get", "(", "Calendar", ".", "MINUTE", ")", ";", "int", "second", "=", "cal", ".", "get", "(", "Calendar", ".", "SECOND", ")", ";", "int", "millisecond", "=", "cal", ".", "get", "(", "Calendar", ".", "MILLISECOND", ")", ";", "cal", ".", "setTime", "(", "date", ")", ";", "if", "(", "dayOffset", "!=", "0", ")", "{", "// The canonical time can be +1 day.", "// It's to do with the way we've historically", "// managed time ranges and midnight.", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "dayOffset", ")", ";", "}", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "millisecond", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "second", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minute", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hourOfDay", ")", ";", "result", "=", "cal", ".", "getTime", "(", ")", ";", "pushCalendar", "(", "cal", ")", ";", "}", "return", "result", ";", "}" ]
Given a date represented by a Date instance, set the time component of the date based on the hours and minutes of the time supplied by the Date instance. @param date Date instance representing the date @param canonicalTime Date instance representing the time of day @return new Date instance with the required time set
[ "Given", "a", "date", "represented", "by", "a", "Date", "instance", "set", "the", "time", "component", "of", "the", "date", "based", "on", "the", "hours", "and", "minutes", "of", "the", "time", "supplied", "by", "the", "Date", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L358-L402
156,904
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.addDays
public static Date addDays(Date date, int days) { Calendar cal = popCalendar(date); cal.add(Calendar.DAY_OF_YEAR, days); Date result = cal.getTime(); pushCalendar(cal); return result; }
java
public static Date addDays(Date date, int days) { Calendar cal = popCalendar(date); cal.add(Calendar.DAY_OF_YEAR, days); Date result = cal.getTime(); pushCalendar(cal); return result; }
[ "public", "static", "Date", "addDays", "(", "Date", "date", ",", "int", "days", ")", "{", "Calendar", "cal", "=", "popCalendar", "(", "date", ")", ";", "cal", ".", "add", "(", "Calendar", ".", "DAY_OF_YEAR", ",", "days", ")", ";", "Date", "result", "=", "cal", ".", "getTime", "(", ")", ";", "pushCalendar", "(", "cal", ")", ";", "return", "result", ";", "}" ]
Add a number of days to the supplied date. @param date start date @param days number of days to add @return new date
[ "Add", "a", "number", "of", "days", "to", "the", "supplied", "date", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L441-L448
156,905
joniles/mpxj
src/main/java/net/sf/mpxj/common/DateHelper.java
DateHelper.popCalendar
public static Calendar popCalendar() { Calendar result; Deque<Calendar> calendars = CALENDARS.get(); if (calendars.isEmpty()) { result = Calendar.getInstance(); } else { result = calendars.pop(); } return result; }
java
public static Calendar popCalendar() { Calendar result; Deque<Calendar> calendars = CALENDARS.get(); if (calendars.isEmpty()) { result = Calendar.getInstance(); } else { result = calendars.pop(); } return result; }
[ "public", "static", "Calendar", "popCalendar", "(", ")", "{", "Calendar", "result", ";", "Deque", "<", "Calendar", ">", "calendars", "=", "CALENDARS", ".", "get", "(", ")", ";", "if", "(", "calendars", ".", "isEmpty", "(", ")", ")", "{", "result", "=", "Calendar", ".", "getInstance", "(", ")", ";", "}", "else", "{", "result", "=", "calendars", ".", "pop", "(", ")", ";", "}", "return", "result", ";", "}" ]
Acquire a calendar instance. @return Calendar instance
[ "Acquire", "a", "calendar", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/DateHelper.java#L455-L468
156,906
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/BlockReader.java
BlockReader.read
public List<MapRow> read() throws IOException { List<MapRow> result = new ArrayList<MapRow>(); int fileCount = m_stream.readInt(); if (fileCount != 0) { for (int index = 0; index < fileCount; index++) { // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); readBlock(map); result.add(new MapRow(map)); } } return result; }
java
public List<MapRow> read() throws IOException { List<MapRow> result = new ArrayList<MapRow>(); int fileCount = m_stream.readInt(); if (fileCount != 0) { for (int index = 0; index < fileCount; index++) { // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); readBlock(map); result.add(new MapRow(map)); } } return result; }
[ "public", "List", "<", "MapRow", ">", "read", "(", ")", "throws", "IOException", "{", "List", "<", "MapRow", ">", "result", "=", "new", "ArrayList", "<", "MapRow", ">", "(", ")", ";", "int", "fileCount", "=", "m_stream", ".", "readInt", "(", ")", ";", "if", "(", "fileCount", "!=", "0", ")", "{", "for", "(", "int", "index", "=", "0", ";", "index", "<", "fileCount", ";", "index", "++", ")", "{", "// We use a LinkedHashMap to preserve insertion order in iteration", "// Useful when debugging the file format.", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "readBlock", "(", "map", ")", ";", "result", ".", "add", "(", "new", "MapRow", "(", "map", ")", ")", ";", "}", "}", "return", "result", ";", "}" ]
Read a list of fixed sized blocks from the input stream. @return List of MapRow instances representing the fixed size blocks
[ "Read", "a", "list", "of", "fixed", "sized", "blocks", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/BlockReader.java#L52-L68
156,907
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readByte
protected int readByte(InputStream is) throws IOException { byte[] data = new byte[1]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getByte(data, 0)); }
java
protected int readByte(InputStream is) throws IOException { byte[] data = new byte[1]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getByte(data, 0)); }
[ "protected", "int", "readByte", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "1", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "return", "(", "MPPUtility", ".", "getByte", "(", "data", ",", "0", ")", ")", ";", "}" ]
This method reads a single byte from the input stream. @param is the input stream @return byte value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "single", "byte", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L51-L60
156,908
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readShort
protected int readShort(InputStream is) throws IOException { byte[] data = new byte[2]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getShort(data, 0)); }
java
protected int readShort(InputStream is) throws IOException { byte[] data = new byte[2]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getShort(data, 0)); }
[ "protected", "int", "readShort", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "2", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "return", "(", "MPPUtility", ".", "getShort", "(", "data", ",", "0", ")", ")", ";", "}" ]
This method reads a two byte integer from the input stream. @param is the input stream @return integer value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "two", "byte", "integer", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L69-L78
156,909
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readInt
protected int readInt(InputStream is) throws IOException { byte[] data = new byte[4]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getInt(data, 0)); }
java
protected int readInt(InputStream is) throws IOException { byte[] data = new byte[4]; if (is.read(data) != data.length) { throw new EOFException(); } return (MPPUtility.getInt(data, 0)); }
[ "protected", "int", "readInt", "(", "InputStream", "is", ")", "throws", "IOException", "{", "byte", "[", "]", "data", "=", "new", "byte", "[", "4", "]", ";", "if", "(", "is", ".", "read", "(", "data", ")", "!=", "data", ".", "length", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "return", "(", "MPPUtility", ".", "getInt", "(", "data", ",", "0", ")", ")", ";", "}" ]
This method reads a four byte integer from the input stream. @param is the input stream @return byte value @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "four", "byte", "integer", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L87-L96
156,910
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MPPComponent.java
MPPComponent.readByteArray
protected byte[] readByteArray(InputStream is, int size) throws IOException { byte[] buffer = new byte[size]; if (is.read(buffer) != buffer.length) { throw new EOFException(); } return (buffer); }
java
protected byte[] readByteArray(InputStream is, int size) throws IOException { byte[] buffer = new byte[size]; if (is.read(buffer) != buffer.length) { throw new EOFException(); } return (buffer); }
[ "protected", "byte", "[", "]", "readByteArray", "(", "InputStream", "is", ",", "int", "size", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "size", "]", ";", "if", "(", "is", ".", "read", "(", "buffer", ")", "!=", "buffer", ".", "length", ")", "{", "throw", "new", "EOFException", "(", ")", ";", "}", "return", "(", "buffer", ")", ";", "}" ]
This method reads a byte array from the input stream. @param is the input stream @param size number of bytes to read @return byte array @throws IOException on file read error or EOF
[ "This", "method", "reads", "a", "byte", "array", "from", "the", "input", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPComponent.java#L106-L114
156,911
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/Blast.java
Blast.blast
public int blast(InputStream input, OutputStream output) throws IOException { m_input = input; m_output = output; int lit; /* true if literals are coded */ int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ int dist; /* distance for copy */ int copy; /* copy counter */ //unsigned char *from, *to; /* copy pointers */ /* read header */ lit = bits(8); if (lit > 1) { return -1; } dict = bits(8); if (dict < 4 || dict > 6) { return -2; } /* decode literals and length/distance pairs */ do { if (bits(1) != 0) { /* get length */ symbol = decode(LENCODE); len = BASE[symbol] + bits(EXTRA[symbol]); if (len == 519) { break; /* end code */ } /* get distance */ symbol = len == 2 ? 2 : dict; dist = decode(DISTCODE) << symbol; dist += bits(symbol); dist++; if (m_first != 0 && dist > m_next) { return -3; /* distance too far back */ } /* copy length bytes from distance bytes back */ do { //to = m_out + m_next; int to = m_next; int from = to - dist; copy = MAXWIN; if (m_next < dist) { from += copy; copy = dist; } copy -= m_next; if (copy > len) { copy = len; } len -= copy; m_next += copy; do { //*to++ = *from++; m_out[to++] = m_out[from++]; } while (--copy != 0); if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } while (len != 0); } else { /* get literal and write it */ symbol = lit != 0 ? decode(LITCODE) : bits(8); m_out[m_next++] = (byte) symbol; if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } } while (true); if (m_next != 0) { m_output.write(m_out, 0, m_next); } return 0; }
java
public int blast(InputStream input, OutputStream output) throws IOException { m_input = input; m_output = output; int lit; /* true if literals are coded */ int dict; /* log2(dictionary size) - 6 */ int symbol; /* decoded symbol, extra bits for distance */ int len; /* length for copy */ int dist; /* distance for copy */ int copy; /* copy counter */ //unsigned char *from, *to; /* copy pointers */ /* read header */ lit = bits(8); if (lit > 1) { return -1; } dict = bits(8); if (dict < 4 || dict > 6) { return -2; } /* decode literals and length/distance pairs */ do { if (bits(1) != 0) { /* get length */ symbol = decode(LENCODE); len = BASE[symbol] + bits(EXTRA[symbol]); if (len == 519) { break; /* end code */ } /* get distance */ symbol = len == 2 ? 2 : dict; dist = decode(DISTCODE) << symbol; dist += bits(symbol); dist++; if (m_first != 0 && dist > m_next) { return -3; /* distance too far back */ } /* copy length bytes from distance bytes back */ do { //to = m_out + m_next; int to = m_next; int from = to - dist; copy = MAXWIN; if (m_next < dist) { from += copy; copy = dist; } copy -= m_next; if (copy > len) { copy = len; } len -= copy; m_next += copy; do { //*to++ = *from++; m_out[to++] = m_out[from++]; } while (--copy != 0); if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } while (len != 0); } else { /* get literal and write it */ symbol = lit != 0 ? decode(LITCODE) : bits(8); m_out[m_next++] = (byte) symbol; if (m_next == MAXWIN) { //if (s->outfun(s->outhow, s->out, s->next)) return 1; m_output.write(m_out, 0, m_next); m_next = 0; m_first = 0; } } } while (true); if (m_next != 0) { m_output.write(m_out, 0, m_next); } return 0; }
[ "public", "int", "blast", "(", "InputStream", "input", ",", "OutputStream", "output", ")", "throws", "IOException", "{", "m_input", "=", "input", ";", "m_output", "=", "output", ";", "int", "lit", ";", "/* true if literals are coded */", "int", "dict", ";", "/* log2(dictionary size) - 6 */", "int", "symbol", ";", "/* decoded symbol, extra bits for distance */", "int", "len", ";", "/* length for copy */", "int", "dist", ";", "/* distance for copy */", "int", "copy", ";", "/* copy counter */", "//unsigned char *from, *to; /* copy pointers */", "/* read header */", "lit", "=", "bits", "(", "8", ")", ";", "if", "(", "lit", ">", "1", ")", "{", "return", "-", "1", ";", "}", "dict", "=", "bits", "(", "8", ")", ";", "if", "(", "dict", "<", "4", "||", "dict", ">", "6", ")", "{", "return", "-", "2", ";", "}", "/* decode literals and length/distance pairs */", "do", "{", "if", "(", "bits", "(", "1", ")", "!=", "0", ")", "{", "/* get length */", "symbol", "=", "decode", "(", "LENCODE", ")", ";", "len", "=", "BASE", "[", "symbol", "]", "+", "bits", "(", "EXTRA", "[", "symbol", "]", ")", ";", "if", "(", "len", "==", "519", ")", "{", "break", ";", "/* end code */", "}", "/* get distance */", "symbol", "=", "len", "==", "2", "?", "2", ":", "dict", ";", "dist", "=", "decode", "(", "DISTCODE", ")", "<<", "symbol", ";", "dist", "+=", "bits", "(", "symbol", ")", ";", "dist", "++", ";", "if", "(", "m_first", "!=", "0", "&&", "dist", ">", "m_next", ")", "{", "return", "-", "3", ";", "/* distance too far back */", "}", "/* copy length bytes from distance bytes back */", "do", "{", "//to = m_out + m_next;", "int", "to", "=", "m_next", ";", "int", "from", "=", "to", "-", "dist", ";", "copy", "=", "MAXWIN", ";", "if", "(", "m_next", "<", "dist", ")", "{", "from", "+=", "copy", ";", "copy", "=", "dist", ";", "}", "copy", "-=", "m_next", ";", "if", "(", "copy", ">", "len", ")", "{", "copy", "=", "len", ";", "}", "len", "-=", "copy", ";", "m_next", "+=", "copy", ";", "do", "{", "//*to++ = *from++;", "m_out", "[", "to", "++", "]", "=", "m_out", "[", "from", "++", "]", ";", "}", "while", "(", "--", "copy", "!=", "0", ")", ";", "if", "(", "m_next", "==", "MAXWIN", ")", "{", "//if (s->outfun(s->outhow, s->out, s->next)) return 1;", "m_output", ".", "write", "(", "m_out", ",", "0", ",", "m_next", ")", ";", "m_next", "=", "0", ";", "m_first", "=", "0", ";", "}", "}", "while", "(", "len", "!=", "0", ")", ";", "}", "else", "{", "/* get literal and write it */", "symbol", "=", "lit", "!=", "0", "?", "decode", "(", "LITCODE", ")", ":", "bits", "(", "8", ")", ";", "m_out", "[", "m_next", "++", "]", "=", "(", "byte", ")", "symbol", ";", "if", "(", "m_next", "==", "MAXWIN", ")", "{", "//if (s->outfun(s->outhow, s->out, s->next)) return 1;", "m_output", ".", "write", "(", "m_out", ",", "0", ",", "m_next", ")", ";", "m_next", "=", "0", ";", "m_first", "=", "0", ";", "}", "}", "}", "while", "(", "true", ")", ";", "if", "(", "m_next", "!=", "0", ")", "{", "m_output", ".", "write", "(", "m_out", ",", "0", ",", "m_next", ")", ";", "}", "return", "0", ";", "}" ]
Decode PKWare Compression Library stream. Format notes: - First byte is 0 if literals are uncoded or 1 if they are coded. Second byte is 4, 5, or 6 for the number of extra bits in the distance code. This is the base-2 logarithm of the dictionary size minus six. - Compressed data is a combination of literals and length/distance pairs terminated by an end code. Literals are either Huffman coded or uncoded bytes. A length/distance pair is a coded length followed by a coded distance to represent a string that occurs earlier in the uncompressed data that occurs again at the current location. - A bit preceding a literal or length/distance pair indicates which comes next, 0 for literals, 1 for length/distance. - If literals are uncoded, then the next eight bits are the literal, in the normal bit order in the stream, i.e. no bit-reversal is needed. Similarly, no bit reversal is needed for either the length extra bits or the distance extra bits. - Literal bytes are simply written to the output. A length/distance pair is an instruction to copy previously uncompressed bytes to the output. The copy is from distance bytes back in the output stream, copying for length bytes. - Distances pointing before the beginning of the output data are not permitted. - Overlapped copies, where the length is greater than the distance, are allowed and common. For example, a distance of one and a length of 518 simply copies the last byte 518 times. A distance of four and a length of twelve copies the last four bytes three times. A simple forward copy ignoring whether the length is greater than the distance or not implements this correctly. @param input InputStream instance @param output OutputStream instance @return status code
[ "Decode", "PKWare", "Compression", "Library", "stream", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Blast.java#L156-L261
156,912
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/Blast.java
Blast.decode
private int decode(Huffman h) throws IOException { int len; /* current number of bits in code */ int code; /* len bits being decoded */ int first; /* first code of length len */ int count; /* number of codes of length len */ int index; /* index of first code of length len in symbol table */ int bitbuf; /* bits from stream */ int left; /* bits left in next or left to process */ //short *next; /* next number of codes */ bitbuf = m_bitbuf; left = m_bitcnt; code = first = index = 0; len = 1; int nextIndex = 1; // next = h->count + 1; while (true) { while (left-- != 0) { code |= (bitbuf & 1) ^ 1; /* invert code */ bitbuf >>= 1; //count = *next++; count = h.m_count[nextIndex++]; if (code < first + count) { /* if length len, return symbol */ m_bitbuf = bitbuf; m_bitcnt = (m_bitcnt - len) & 7; return h.m_symbol[index + (code - first)]; } index += count; /* else update for next length */ first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) { break; } if (m_left == 0) { m_in = m_input.read(); m_left = m_in == -1 ? 0 : 1; if (m_left == 0) { throw new IOException("out of input"); /* out of input */ } } bitbuf = m_in; m_left--; if (left > 8) { left = 8; } } return -9; /* ran out of codes */ }
java
private int decode(Huffman h) throws IOException { int len; /* current number of bits in code */ int code; /* len bits being decoded */ int first; /* first code of length len */ int count; /* number of codes of length len */ int index; /* index of first code of length len in symbol table */ int bitbuf; /* bits from stream */ int left; /* bits left in next or left to process */ //short *next; /* next number of codes */ bitbuf = m_bitbuf; left = m_bitcnt; code = first = index = 0; len = 1; int nextIndex = 1; // next = h->count + 1; while (true) { while (left-- != 0) { code |= (bitbuf & 1) ^ 1; /* invert code */ bitbuf >>= 1; //count = *next++; count = h.m_count[nextIndex++]; if (code < first + count) { /* if length len, return symbol */ m_bitbuf = bitbuf; m_bitcnt = (m_bitcnt - len) & 7; return h.m_symbol[index + (code - first)]; } index += count; /* else update for next length */ first += count; first <<= 1; code <<= 1; len++; } left = (MAXBITS + 1) - len; if (left == 0) { break; } if (m_left == 0) { m_in = m_input.read(); m_left = m_in == -1 ? 0 : 1; if (m_left == 0) { throw new IOException("out of input"); /* out of input */ } } bitbuf = m_in; m_left--; if (left > 8) { left = 8; } } return -9; /* ran out of codes */ }
[ "private", "int", "decode", "(", "Huffman", "h", ")", "throws", "IOException", "{", "int", "len", ";", "/* current number of bits in code */", "int", "code", ";", "/* len bits being decoded */", "int", "first", ";", "/* first code of length len */", "int", "count", ";", "/* number of codes of length len */", "int", "index", ";", "/* index of first code of length len in symbol table */", "int", "bitbuf", ";", "/* bits from stream */", "int", "left", ";", "/* bits left in next or left to process */", "//short *next; /* next number of codes */", "bitbuf", "=", "m_bitbuf", ";", "left", "=", "m_bitcnt", ";", "code", "=", "first", "=", "index", "=", "0", ";", "len", "=", "1", ";", "int", "nextIndex", "=", "1", ";", "// next = h->count + 1;", "while", "(", "true", ")", "{", "while", "(", "left", "--", "!=", "0", ")", "{", "code", "|=", "(", "bitbuf", "&", "1", ")", "^", "1", ";", "/* invert code */", "bitbuf", ">>=", "1", ";", "//count = *next++;", "count", "=", "h", ".", "m_count", "[", "nextIndex", "++", "]", ";", "if", "(", "code", "<", "first", "+", "count", ")", "{", "/* if length len, return symbol */", "m_bitbuf", "=", "bitbuf", ";", "m_bitcnt", "=", "(", "m_bitcnt", "-", "len", ")", "&", "7", ";", "return", "h", ".", "m_symbol", "[", "index", "+", "(", "code", "-", "first", ")", "]", ";", "}", "index", "+=", "count", ";", "/* else update for next length */", "first", "+=", "count", ";", "first", "<<=", "1", ";", "code", "<<=", "1", ";", "len", "++", ";", "}", "left", "=", "(", "MAXBITS", "+", "1", ")", "-", "len", ";", "if", "(", "left", "==", "0", ")", "{", "break", ";", "}", "if", "(", "m_left", "==", "0", ")", "{", "m_in", "=", "m_input", ".", "read", "(", ")", ";", "m_left", "=", "m_in", "==", "-", "1", "?", "0", ":", "1", ";", "if", "(", "m_left", "==", "0", ")", "{", "throw", "new", "IOException", "(", "\"out of input\"", ")", ";", "/* out of input */", "}", "}", "bitbuf", "=", "m_in", ";", "m_left", "--", ";", "if", "(", "left", ">", "8", ")", "{", "left", "=", "8", ";", "}", "}", "return", "-", "9", ";", "/* ran out of codes */", "}" ]
Decode a code from the stream s using huffman table h. Return the symbol or a negative value if there is an error. If all of the lengths are zero, i.e. an empty code, or if the code is incomplete and an invalid code is received, then -9 is returned after reading MAXBITS bits. Format notes: - The codes as stored in the compressed data are bit-reversed relative to a simple integer ordering of codes of the same lengths. Hence below the bits are pulled from the compressed data one at a time and used to build the code value reversed from what is in the stream in order to permit simple integer comparisons for decoding. - The first code for the shortest length is all ones. Subsequent codes of the same length are simply integer decrements of the previous code. When moving up a length, a one bit is appended to the code. For a complete code, the last code of the longest length will be all zeros. To support this ordering, the bits pulled during decoding are inverted to apply the more "natural" ordering starting with all zeros and incrementing. @param h Huffman table @return status code
[ "Decode", "a", "code", "from", "the", "stream", "s", "using", "huffman", "table", "h", ".", "Return", "the", "symbol", "or", "a", "negative", "value", "if", "there", "is", "an", "error", ".", "If", "all", "of", "the", "lengths", "are", "zero", "i", ".", "e", ".", "an", "empty", "code", "or", "if", "the", "code", "is", "incomplete", "and", "an", "invalid", "code", "is", "received", "then", "-", "9", "is", "returned", "after", "reading", "MAXBITS", "bits", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/Blast.java#L331-L389
156,913
joniles/mpxj
src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java
MSPDITimephasedWorkNormaliser.validateSameDay
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
java
private void validateSameDay(ProjectCalendar calendar, LinkedList<TimephasedWork> list) { for (TimephasedWork assignment : list) { Date assignmentStart = assignment.getStart(); Date calendarStartTime = calendar.getStartTime(assignmentStart); Date assignmentStartTime = DateHelper.getCanonicalTime(assignmentStart); Date assignmentFinish = assignment.getFinish(); Date calendarFinishTime = calendar.getFinishTime(assignmentFinish); Date assignmentFinishTime = DateHelper.getCanonicalTime(assignmentFinish); double totalWork = assignment.getTotalAmount().getDuration(); if (assignmentStartTime != null && calendarStartTime != null) { if ((totalWork == 0 && assignmentStartTime.getTime() != calendarStartTime.getTime()) || (assignmentStartTime.getTime() < calendarStartTime.getTime())) { assignmentStart = DateHelper.setTime(assignmentStart, calendarStartTime); assignment.setStart(assignmentStart); } } if (assignmentFinishTime != null && calendarFinishTime != null) { if ((totalWork == 0 && assignmentFinishTime.getTime() != calendarFinishTime.getTime()) || (assignmentFinishTime.getTime() > calendarFinishTime.getTime())) { assignmentFinish = DateHelper.setTime(assignmentFinish, calendarFinishTime); assignment.setFinish(assignmentFinish); } } } }
[ "private", "void", "validateSameDay", "(", "ProjectCalendar", "calendar", ",", "LinkedList", "<", "TimephasedWork", ">", "list", ")", "{", "for", "(", "TimephasedWork", "assignment", ":", "list", ")", "{", "Date", "assignmentStart", "=", "assignment", ".", "getStart", "(", ")", ";", "Date", "calendarStartTime", "=", "calendar", ".", "getStartTime", "(", "assignmentStart", ")", ";", "Date", "assignmentStartTime", "=", "DateHelper", ".", "getCanonicalTime", "(", "assignmentStart", ")", ";", "Date", "assignmentFinish", "=", "assignment", ".", "getFinish", "(", ")", ";", "Date", "calendarFinishTime", "=", "calendar", ".", "getFinishTime", "(", "assignmentFinish", ")", ";", "Date", "assignmentFinishTime", "=", "DateHelper", ".", "getCanonicalTime", "(", "assignmentFinish", ")", ";", "double", "totalWork", "=", "assignment", ".", "getTotalAmount", "(", ")", ".", "getDuration", "(", ")", ";", "if", "(", "assignmentStartTime", "!=", "null", "&&", "calendarStartTime", "!=", "null", ")", "{", "if", "(", "(", "totalWork", "==", "0", "&&", "assignmentStartTime", ".", "getTime", "(", ")", "!=", "calendarStartTime", ".", "getTime", "(", ")", ")", "||", "(", "assignmentStartTime", ".", "getTime", "(", ")", "<", "calendarStartTime", ".", "getTime", "(", ")", ")", ")", "{", "assignmentStart", "=", "DateHelper", ".", "setTime", "(", "assignmentStart", ",", "calendarStartTime", ")", ";", "assignment", ".", "setStart", "(", "assignmentStart", ")", ";", "}", "}", "if", "(", "assignmentFinishTime", "!=", "null", "&&", "calendarFinishTime", "!=", "null", ")", "{", "if", "(", "(", "totalWork", "==", "0", "&&", "assignmentFinishTime", ".", "getTime", "(", ")", "!=", "calendarFinishTime", ".", "getTime", "(", ")", ")", "||", "(", "assignmentFinishTime", ".", "getTime", "(", ")", ">", "calendarFinishTime", ".", "getTime", "(", ")", ")", ")", "{", "assignmentFinish", "=", "DateHelper", ".", "setTime", "(", "assignmentFinish", ",", "calendarFinishTime", ")", ";", "assignment", ".", "setFinish", "(", "assignmentFinish", ")", ";", "}", "}", "}", "}" ]
Ensures that the start and end dates for ranges fit within the working times for a given day. @param calendar current calendar @param list assignment data
[ "Ensures", "that", "the", "start", "and", "end", "dates", "for", "ranges", "fit", "within", "the", "working", "times", "for", "a", "given", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDITimephasedWorkNormaliser.java#L279-L309
156,914
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/TableFactory.java
TableFactory.createTable
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
java
public Table createTable(ProjectFile file, byte[] data, VarMeta varMeta, Var2Data varData) { Table table = new Table(); table.setID(MPPUtility.getInt(data, 0)); table.setResourceFlag(MPPUtility.getShort(data, 108) == 1); table.setName(MPPUtility.removeAmpersands(MPPUtility.getUnicodeString(data, 4))); byte[] columnData = null; Integer tableID = Integer.valueOf(table.getID()); if (m_tableColumnDataBaseline != null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataBaseline)); } if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataEnterprise)); if (columnData == null) { columnData = varData.getByteArray(varMeta.getOffset(tableID, m_tableColumnDataStandard)); } } processColumnData(file, table, columnData); //System.out.println(table); return (table); }
[ "public", "Table", "createTable", "(", "ProjectFile", "file", ",", "byte", "[", "]", "data", ",", "VarMeta", "varMeta", ",", "Var2Data", "varData", ")", "{", "Table", "table", "=", "new", "Table", "(", ")", ";", "table", ".", "setID", "(", "MPPUtility", ".", "getInt", "(", "data", ",", "0", ")", ")", ";", "table", ".", "setResourceFlag", "(", "MPPUtility", ".", "getShort", "(", "data", ",", "108", ")", "==", "1", ")", ";", "table", ".", "setName", "(", "MPPUtility", ".", "removeAmpersands", "(", "MPPUtility", ".", "getUnicodeString", "(", "data", ",", "4", ")", ")", ")", ";", "byte", "[", "]", "columnData", "=", "null", ";", "Integer", "tableID", "=", "Integer", ".", "valueOf", "(", "table", ".", "getID", "(", ")", ")", ";", "if", "(", "m_tableColumnDataBaseline", "!=", "null", ")", "{", "columnData", "=", "varData", ".", "getByteArray", "(", "varMeta", ".", "getOffset", "(", "tableID", ",", "m_tableColumnDataBaseline", ")", ")", ";", "}", "if", "(", "columnData", "==", "null", ")", "{", "columnData", "=", "varData", ".", "getByteArray", "(", "varMeta", ".", "getOffset", "(", "tableID", ",", "m_tableColumnDataEnterprise", ")", ")", ";", "if", "(", "columnData", "==", "null", ")", "{", "columnData", "=", "varData", ".", "getByteArray", "(", "varMeta", ".", "getOffset", "(", "tableID", ",", "m_tableColumnDataStandard", ")", ")", ";", "}", "}", "processColumnData", "(", "file", ",", "table", ",", "columnData", ")", ";", "//System.out.println(table);", "return", "(", "table", ")", ";", "}" ]
Creates a new Table instance from data extracted from an MPP file. @param file parent project file @param data fixed data @param varMeta var meta @param varData var data @return Table instance
[ "Creates", "a", "new", "Table", "instance", "from", "data", "extracted", "from", "an", "MPP", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TableFactory.java#L61-L90
156,915
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/MapRow.java
MapRow.parseBoolean
private final boolean parseBoolean(String value) { return value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("y") || value.equalsIgnoreCase("yes")); }
java
private final boolean parseBoolean(String value) { return value != null && (value.equalsIgnoreCase("true") || value.equalsIgnoreCase("y") || value.equalsIgnoreCase("yes")); }
[ "private", "final", "boolean", "parseBoolean", "(", "String", "value", ")", "{", "return", "value", "!=", "null", "&&", "(", "value", ".", "equalsIgnoreCase", "(", "\"true\"", ")", "||", "value", ".", "equalsIgnoreCase", "(", "\"y\"", ")", "||", "value", ".", "equalsIgnoreCase", "(", "\"yes\"", ")", ")", ";", "}" ]
Parse a string representation of a Boolean value. XER files sometimes have "N" and "Y" to indicate boolean @param value string representation @return Boolean value
[ "Parse", "a", "string", "representation", "of", "a", "Boolean", "value", ".", "XER", "files", "sometimes", "have", "N", "and", "Y", "to", "indicate", "boolean" ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/MapRow.java#L183-L186
156,916
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processActivityCodes
public void processActivityCodes(List<Row> types, List<Row> typeValues, List<Row> assignments) { ActivityCodeContainer container = m_project.getActivityCodes(); Map<Integer, ActivityCode> map = new HashMap<Integer, ActivityCode>(); for (Row row : types) { ActivityCode code = new ActivityCode(row.getInteger("actv_code_type_id"), row.getString("actv_code_type")); container.add(code); map.put(code.getUniqueID(), code); } for (Row row : typeValues) { ActivityCode code = map.get(row.getInteger("actv_code_type_id")); if (code != null) { ActivityCodeValue value = code.addValue(row.getInteger("actv_code_id"), row.getString("short_name"), row.getString("actv_code_name")); m_activityCodeMap.put(value.getUniqueID(), value); } } for (Row row : assignments) { Integer taskID = row.getInteger("task_id"); List<Integer> list = m_activityCodeAssignments.get(taskID); if (list == null) { list = new ArrayList<Integer>(); m_activityCodeAssignments.put(taskID, list); } list.add(row.getInteger("actv_code_id")); } }
java
public void processActivityCodes(List<Row> types, List<Row> typeValues, List<Row> assignments) { ActivityCodeContainer container = m_project.getActivityCodes(); Map<Integer, ActivityCode> map = new HashMap<Integer, ActivityCode>(); for (Row row : types) { ActivityCode code = new ActivityCode(row.getInteger("actv_code_type_id"), row.getString("actv_code_type")); container.add(code); map.put(code.getUniqueID(), code); } for (Row row : typeValues) { ActivityCode code = map.get(row.getInteger("actv_code_type_id")); if (code != null) { ActivityCodeValue value = code.addValue(row.getInteger("actv_code_id"), row.getString("short_name"), row.getString("actv_code_name")); m_activityCodeMap.put(value.getUniqueID(), value); } } for (Row row : assignments) { Integer taskID = row.getInteger("task_id"); List<Integer> list = m_activityCodeAssignments.get(taskID); if (list == null) { list = new ArrayList<Integer>(); m_activityCodeAssignments.put(taskID, list); } list.add(row.getInteger("actv_code_id")); } }
[ "public", "void", "processActivityCodes", "(", "List", "<", "Row", ">", "types", ",", "List", "<", "Row", ">", "typeValues", ",", "List", "<", "Row", ">", "assignments", ")", "{", "ActivityCodeContainer", "container", "=", "m_project", ".", "getActivityCodes", "(", ")", ";", "Map", "<", "Integer", ",", "ActivityCode", ">", "map", "=", "new", "HashMap", "<", "Integer", ",", "ActivityCode", ">", "(", ")", ";", "for", "(", "Row", "row", ":", "types", ")", "{", "ActivityCode", "code", "=", "new", "ActivityCode", "(", "row", ".", "getInteger", "(", "\"actv_code_type_id\"", ")", ",", "row", ".", "getString", "(", "\"actv_code_type\"", ")", ")", ";", "container", ".", "add", "(", "code", ")", ";", "map", ".", "put", "(", "code", ".", "getUniqueID", "(", ")", ",", "code", ")", ";", "}", "for", "(", "Row", "row", ":", "typeValues", ")", "{", "ActivityCode", "code", "=", "map", ".", "get", "(", "row", ".", "getInteger", "(", "\"actv_code_type_id\"", ")", ")", ";", "if", "(", "code", "!=", "null", ")", "{", "ActivityCodeValue", "value", "=", "code", ".", "addValue", "(", "row", ".", "getInteger", "(", "\"actv_code_id\"", ")", ",", "row", ".", "getString", "(", "\"short_name\"", ")", ",", "row", ".", "getString", "(", "\"actv_code_name\"", ")", ")", ";", "m_activityCodeMap", ".", "put", "(", "value", ".", "getUniqueID", "(", ")", ",", "value", ")", ";", "}", "}", "for", "(", "Row", "row", ":", "assignments", ")", "{", "Integer", "taskID", "=", "row", ".", "getInteger", "(", "\"task_id\"", ")", ";", "List", "<", "Integer", ">", "list", "=", "m_activityCodeAssignments", ".", "get", "(", "taskID", ")", ";", "if", "(", "list", "==", "null", ")", "{", "list", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "m_activityCodeAssignments", ".", "put", "(", "taskID", ",", "list", ")", ";", "}", "list", ".", "add", "(", "row", ".", "getInteger", "(", "\"actv_code_id\"", ")", ")", ";", "}", "}" ]
Read activity code types and values. @param types activity code type data @param typeValues activity code value data @param assignments activity code task assignments
[ "Read", "activity", "code", "types", "and", "values", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L184-L217
156,917
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendar
public void processCalendar(Row row) { ProjectCalendar calendar = m_project.addCalendar(); Integer id = row.getInteger("clndr_id"); m_calMap.put(id, calendar); calendar.setName(row.getString("clndr_name")); try { calendar.setMinutesPerDay(Integer.valueOf((int) NumberHelper.getDouble(row.getDouble("day_hr_cnt")) * 60)); calendar.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("week_hr_cnt")) * 60))); calendar.setMinutesPerMonth(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("month_hr_cnt")) * 60))); calendar.setMinutesPerYear(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("year_hr_cnt")) * 60))); } catch (ClassCastException ex) { // We have seen examples of malformed calendar data where fields have been missing // from the record. We'll typically get a class cast exception here as we're trying // to process something which isn't a double. // We'll just return at this point as it's not clear that we can salvage anything // sensible from this record. return; } // Process data String calendarData = row.getString("clndr_data"); if (calendarData != null && !calendarData.isEmpty()) { Record root = Record.getRecord(calendarData); if (root != null) { processCalendarDays(calendar, root); processCalendarExceptions(calendar, root); } } else { // if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00 DateRange defaultHourRange = new DateRange(DateHelper.getTime(8, 0), DateHelper.getTime(16, 0)); for (Day day : Day.values()) { if (day != Day.SATURDAY && day != Day.SUNDAY) { calendar.setWorkingDay(day, true); ProjectCalendarHours hours = calendar.addCalendarHours(day); hours.addRange(defaultHourRange); } else { calendar.setWorkingDay(day, false); } } } m_eventManager.fireCalendarReadEvent(calendar); }
java
public void processCalendar(Row row) { ProjectCalendar calendar = m_project.addCalendar(); Integer id = row.getInteger("clndr_id"); m_calMap.put(id, calendar); calendar.setName(row.getString("clndr_name")); try { calendar.setMinutesPerDay(Integer.valueOf((int) NumberHelper.getDouble(row.getDouble("day_hr_cnt")) * 60)); calendar.setMinutesPerWeek(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("week_hr_cnt")) * 60))); calendar.setMinutesPerMonth(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("month_hr_cnt")) * 60))); calendar.setMinutesPerYear(Integer.valueOf((int) (NumberHelper.getDouble(row.getDouble("year_hr_cnt")) * 60))); } catch (ClassCastException ex) { // We have seen examples of malformed calendar data where fields have been missing // from the record. We'll typically get a class cast exception here as we're trying // to process something which isn't a double. // We'll just return at this point as it's not clear that we can salvage anything // sensible from this record. return; } // Process data String calendarData = row.getString("clndr_data"); if (calendarData != null && !calendarData.isEmpty()) { Record root = Record.getRecord(calendarData); if (root != null) { processCalendarDays(calendar, root); processCalendarExceptions(calendar, root); } } else { // if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00 DateRange defaultHourRange = new DateRange(DateHelper.getTime(8, 0), DateHelper.getTime(16, 0)); for (Day day : Day.values()) { if (day != Day.SATURDAY && day != Day.SUNDAY) { calendar.setWorkingDay(day, true); ProjectCalendarHours hours = calendar.addCalendarHours(day); hours.addRange(defaultHourRange); } else { calendar.setWorkingDay(day, false); } } } m_eventManager.fireCalendarReadEvent(calendar); }
[ "public", "void", "processCalendar", "(", "Row", "row", ")", "{", "ProjectCalendar", "calendar", "=", "m_project", ".", "addCalendar", "(", ")", ";", "Integer", "id", "=", "row", ".", "getInteger", "(", "\"clndr_id\"", ")", ";", "m_calMap", ".", "put", "(", "id", ",", "calendar", ")", ";", "calendar", ".", "setName", "(", "row", ".", "getString", "(", "\"clndr_name\"", ")", ")", ";", "try", "{", "calendar", ".", "setMinutesPerDay", "(", "Integer", ".", "valueOf", "(", "(", "int", ")", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"day_hr_cnt\"", ")", ")", "*", "60", ")", ")", ";", "calendar", ".", "setMinutesPerWeek", "(", "Integer", ".", "valueOf", "(", "(", "int", ")", "(", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"week_hr_cnt\"", ")", ")", "*", "60", ")", ")", ")", ";", "calendar", ".", "setMinutesPerMonth", "(", "Integer", ".", "valueOf", "(", "(", "int", ")", "(", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"month_hr_cnt\"", ")", ")", "*", "60", ")", ")", ")", ";", "calendar", ".", "setMinutesPerYear", "(", "Integer", ".", "valueOf", "(", "(", "int", ")", "(", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"year_hr_cnt\"", ")", ")", "*", "60", ")", ")", ")", ";", "}", "catch", "(", "ClassCastException", "ex", ")", "{", "// We have seen examples of malformed calendar data where fields have been missing", "// from the record. We'll typically get a class cast exception here as we're trying", "// to process something which isn't a double.", "// We'll just return at this point as it's not clear that we can salvage anything", "// sensible from this record.", "return", ";", "}", "// Process data", "String", "calendarData", "=", "row", ".", "getString", "(", "\"clndr_data\"", ")", ";", "if", "(", "calendarData", "!=", "null", "&&", "!", "calendarData", ".", "isEmpty", "(", ")", ")", "{", "Record", "root", "=", "Record", ".", "getRecord", "(", "calendarData", ")", ";", "if", "(", "root", "!=", "null", ")", "{", "processCalendarDays", "(", "calendar", ",", "root", ")", ";", "processCalendarExceptions", "(", "calendar", ",", "root", ")", ";", "}", "}", "else", "{", "// if there is not DaysOfWeek data, Primavera seems to default to Mon-Fri, 8:00-16:00", "DateRange", "defaultHourRange", "=", "new", "DateRange", "(", "DateHelper", ".", "getTime", "(", "8", ",", "0", ")", ",", "DateHelper", ".", "getTime", "(", "16", ",", "0", ")", ")", ";", "for", "(", "Day", "day", ":", "Day", ".", "values", "(", ")", ")", "{", "if", "(", "day", "!=", "Day", ".", "SATURDAY", "&&", "day", "!=", "Day", ".", "SUNDAY", ")", "{", "calendar", ".", "setWorkingDay", "(", "day", ",", "true", ")", ";", "ProjectCalendarHours", "hours", "=", "calendar", ".", "addCalendarHours", "(", "day", ")", ";", "hours", ".", "addRange", "(", "defaultHourRange", ")", ";", "}", "else", "{", "calendar", ".", "setWorkingDay", "(", "day", ",", "false", ")", ";", "}", "}", "}", "m_eventManager", ".", "fireCalendarReadEvent", "(", "calendar", ")", ";", "}" ]
Process data for an individual calendar. @param row calendar data
[ "Process", "data", "for", "an", "individual", "calendar", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L298-L354
156,918
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendarDays
private void processCalendarDays(ProjectCalendar calendar, Record root) { // Retrieve working hours ... Record daysOfWeek = root.getChild("DaysOfWeek"); if (daysOfWeek != null) { for (Record dayRecord : daysOfWeek.getChildren()) { processCalendarHours(calendar, dayRecord); } } }
java
private void processCalendarDays(ProjectCalendar calendar, Record root) { // Retrieve working hours ... Record daysOfWeek = root.getChild("DaysOfWeek"); if (daysOfWeek != null) { for (Record dayRecord : daysOfWeek.getChildren()) { processCalendarHours(calendar, dayRecord); } } }
[ "private", "void", "processCalendarDays", "(", "ProjectCalendar", "calendar", ",", "Record", "root", ")", "{", "// Retrieve working hours ...", "Record", "daysOfWeek", "=", "root", ".", "getChild", "(", "\"DaysOfWeek\"", ")", ";", "if", "(", "daysOfWeek", "!=", "null", ")", "{", "for", "(", "Record", "dayRecord", ":", "daysOfWeek", ".", "getChildren", "(", ")", ")", "{", "processCalendarHours", "(", "calendar", ",", "dayRecord", ")", ";", "}", "}", "}" ]
Process calendar days of the week. @param calendar project calendar @param root calendar data
[ "Process", "calendar", "days", "of", "the", "week", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L362-L373
156,919
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processCalendarHours
private void processCalendarHours(ProjectCalendar calendar, Record dayRecord) { // ... for each day of the week Day day = Day.getInstance(Integer.parseInt(dayRecord.getField())); // Get hours List<Record> recHours = dayRecord.getChildren(); if (recHours.size() == 0) { // No data -> not working calendar.setWorkingDay(day, false); } else { calendar.setWorkingDay(day, true); // Read hours ProjectCalendarHours hours = calendar.addCalendarHours(day); for (Record recWorkingHours : recHours) { addHours(hours, recWorkingHours); } } }
java
private void processCalendarHours(ProjectCalendar calendar, Record dayRecord) { // ... for each day of the week Day day = Day.getInstance(Integer.parseInt(dayRecord.getField())); // Get hours List<Record> recHours = dayRecord.getChildren(); if (recHours.size() == 0) { // No data -> not working calendar.setWorkingDay(day, false); } else { calendar.setWorkingDay(day, true); // Read hours ProjectCalendarHours hours = calendar.addCalendarHours(day); for (Record recWorkingHours : recHours) { addHours(hours, recWorkingHours); } } }
[ "private", "void", "processCalendarHours", "(", "ProjectCalendar", "calendar", ",", "Record", "dayRecord", ")", "{", "// ... for each day of the week", "Day", "day", "=", "Day", ".", "getInstance", "(", "Integer", ".", "parseInt", "(", "dayRecord", ".", "getField", "(", ")", ")", ")", ";", "// Get hours", "List", "<", "Record", ">", "recHours", "=", "dayRecord", ".", "getChildren", "(", ")", ";", "if", "(", "recHours", ".", "size", "(", ")", "==", "0", ")", "{", "// No data -> not working", "calendar", ".", "setWorkingDay", "(", "day", ",", "false", ")", ";", "}", "else", "{", "calendar", ".", "setWorkingDay", "(", "day", ",", "true", ")", ";", "// Read hours", "ProjectCalendarHours", "hours", "=", "calendar", ".", "addCalendarHours", "(", "day", ")", ";", "for", "(", "Record", "recWorkingHours", ":", "recHours", ")", "{", "addHours", "(", "hours", ",", "recWorkingHours", ")", ";", "}", "}", "}" ]
Process hours in a working day. @param calendar project calendar @param dayRecord working day data
[ "Process", "hours", "in", "a", "working", "day", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L381-L402
156,920
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addHours
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
java
private void addHours(ProjectCalendarDateRanges ranges, Record hoursRecord) { if (hoursRecord.getValue() != null) { String[] wh = hoursRecord.getValue().split("\\|"); try { String startText; String endText; if (wh[0].equals("s")) { startText = wh[1]; endText = wh[3]; } else { startText = wh[3]; endText = wh[1]; } // for end time treat midnight as midnight next day if (endText.equals("00:00")) { endText = "24:00"; } Date start = m_calendarTimeFormat.parse(startText); Date end = m_calendarTimeFormat.parse(endText); ranges.addRange(new DateRange(start, end)); } catch (ParseException e) { // silently ignore date parse exceptions } } }
[ "private", "void", "addHours", "(", "ProjectCalendarDateRanges", "ranges", ",", "Record", "hoursRecord", ")", "{", "if", "(", "hoursRecord", ".", "getValue", "(", ")", "!=", "null", ")", "{", "String", "[", "]", "wh", "=", "hoursRecord", ".", "getValue", "(", ")", ".", "split", "(", "\"\\\\|\"", ")", ";", "try", "{", "String", "startText", ";", "String", "endText", ";", "if", "(", "wh", "[", "0", "]", ".", "equals", "(", "\"s\"", ")", ")", "{", "startText", "=", "wh", "[", "1", "]", ";", "endText", "=", "wh", "[", "3", "]", ";", "}", "else", "{", "startText", "=", "wh", "[", "3", "]", ";", "endText", "=", "wh", "[", "1", "]", ";", "}", "// for end time treat midnight as midnight next day", "if", "(", "endText", ".", "equals", "(", "\"00:00\"", ")", ")", "{", "endText", "=", "\"24:00\"", ";", "}", "Date", "start", "=", "m_calendarTimeFormat", ".", "parse", "(", "startText", ")", ";", "Date", "end", "=", "m_calendarTimeFormat", ".", "parse", "(", "endText", ")", ";", "ranges", ".", "addRange", "(", "new", "DateRange", "(", "start", ",", "end", ")", ")", ";", "}", "catch", "(", "ParseException", "e", ")", "{", "// silently ignore date parse exceptions", "}", "}", "}" ]
Parses a record containing hours and add them to a container. @param ranges hours container @param hoursRecord hours record
[ "Parses", "a", "record", "containing", "hours", "and", "add", "them", "to", "a", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L410-L446
156,921
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getResourceCalendar
private ProjectCalendar getResourceCalendar(Integer calendarID) { ProjectCalendar result = null; if (calendarID != null) { ProjectCalendar calendar = m_calMap.get(calendarID); if (calendar != null) { // // If the resource is linked to a base calendar, derive // a default calendar from the base calendar. // if (!calendar.isDerived()) { ProjectCalendar resourceCalendar = m_project.addCalendar(); resourceCalendar.setParent(calendar); resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); result = resourceCalendar; } else { // // Primavera seems to allow a calendar to be shared between resources // whereas in the MS Project model there is a one-to-one // relationship. If we find a shared calendar, take a copy of it // if (calendar.getResource() == null) { result = calendar; } else { ProjectCalendar copy = m_project.addCalendar(); copy.copy(calendar); result = copy; } } } } return result; }
java
private ProjectCalendar getResourceCalendar(Integer calendarID) { ProjectCalendar result = null; if (calendarID != null) { ProjectCalendar calendar = m_calMap.get(calendarID); if (calendar != null) { // // If the resource is linked to a base calendar, derive // a default calendar from the base calendar. // if (!calendar.isDerived()) { ProjectCalendar resourceCalendar = m_project.addCalendar(); resourceCalendar.setParent(calendar); resourceCalendar.setWorkingDay(Day.MONDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.TUESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.THURSDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.FRIDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SATURDAY, DayType.DEFAULT); resourceCalendar.setWorkingDay(Day.SUNDAY, DayType.DEFAULT); result = resourceCalendar; } else { // // Primavera seems to allow a calendar to be shared between resources // whereas in the MS Project model there is a one-to-one // relationship. If we find a shared calendar, take a copy of it // if (calendar.getResource() == null) { result = calendar; } else { ProjectCalendar copy = m_project.addCalendar(); copy.copy(calendar); result = copy; } } } } return result; }
[ "private", "ProjectCalendar", "getResourceCalendar", "(", "Integer", "calendarID", ")", "{", "ProjectCalendar", "result", "=", "null", ";", "if", "(", "calendarID", "!=", "null", ")", "{", "ProjectCalendar", "calendar", "=", "m_calMap", ".", "get", "(", "calendarID", ")", ";", "if", "(", "calendar", "!=", "null", ")", "{", "//", "// If the resource is linked to a base calendar, derive", "// a default calendar from the base calendar.", "//", "if", "(", "!", "calendar", ".", "isDerived", "(", ")", ")", "{", "ProjectCalendar", "resourceCalendar", "=", "m_project", ".", "addCalendar", "(", ")", ";", "resourceCalendar", ".", "setParent", "(", "calendar", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "MONDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "TUESDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "WEDNESDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "THURSDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "FRIDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "SATURDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "resourceCalendar", ".", "setWorkingDay", "(", "Day", ".", "SUNDAY", ",", "DayType", ".", "DEFAULT", ")", ";", "result", "=", "resourceCalendar", ";", "}", "else", "{", "//", "// Primavera seems to allow a calendar to be shared between resources", "// whereas in the MS Project model there is a one-to-one", "// relationship. If we find a shared calendar, take a copy of it", "//", "if", "(", "calendar", ".", "getResource", "(", ")", "==", "null", ")", "{", "result", "=", "calendar", ";", "}", "else", "{", "ProjectCalendar", "copy", "=", "m_project", ".", "addCalendar", "(", ")", ";", "copy", ".", "copy", "(", "calendar", ")", ";", "result", "=", "copy", ";", "}", "}", "}", "}", "return", "result", ";", "}" ]
Retrieve the correct calendar for a resource. @param calendarID calendar ID @return calendar for resource
[ "Retrieve", "the", "correct", "calendar", "for", "a", "resource", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L506-L553
156,922
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getActivityIDField
private FieldType getActivityIDField(Map<FieldType, String> map) { FieldType result = null; for (Map.Entry<FieldType, String> entry : map.entrySet()) { if (entry.getValue().equals("task_code")) { result = entry.getKey(); break; } } return result; }
java
private FieldType getActivityIDField(Map<FieldType, String> map) { FieldType result = null; for (Map.Entry<FieldType, String> entry : map.entrySet()) { if (entry.getValue().equals("task_code")) { result = entry.getKey(); break; } } return result; }
[ "private", "FieldType", "getActivityIDField", "(", "Map", "<", "FieldType", ",", "String", ">", "map", ")", "{", "FieldType", "result", "=", "null", ";", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "String", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "if", "(", "entry", ".", "getValue", "(", ")", ".", "equals", "(", "\"task_code\"", ")", ")", "{", "result", "=", "entry", ".", "getKey", "(", ")", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Determine which field the Activity ID has been mapped to. @param map field map @return field
[ "Determine", "which", "field", "the", "Activity", "ID", "has", "been", "mapped", "to", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L793-L805
156,923
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addUserDefinedField
private void addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { try { switch (fieldType) { case TASK: TaskField taskField; do { taskField = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (m_taskFields.containsKey(taskField) || m_wbsFields.containsKey(taskField)); m_project.getCustomFields().getCustomField(taskField).setAlias(name); break; case RESOURCE: ResourceField resourceField; do { resourceField = m_resourceUdfCounters.nextField(ResourceField.class, dataType); } while (m_resourceFields.containsKey(resourceField)); m_project.getCustomFields().getCustomField(resourceField).setAlias(name); break; case ASSIGNMENT: AssignmentField assignmentField; do { assignmentField = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); } while (m_assignmentFields.containsKey(assignmentField)); m_project.getCustomFields().getCustomField(assignmentField).setAlias(name); break; default: break; } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } }
java
private void addUserDefinedField(FieldTypeClass fieldType, UserFieldDataType dataType, String name) { try { switch (fieldType) { case TASK: TaskField taskField; do { taskField = m_taskUdfCounters.nextField(TaskField.class, dataType); } while (m_taskFields.containsKey(taskField) || m_wbsFields.containsKey(taskField)); m_project.getCustomFields().getCustomField(taskField).setAlias(name); break; case RESOURCE: ResourceField resourceField; do { resourceField = m_resourceUdfCounters.nextField(ResourceField.class, dataType); } while (m_resourceFields.containsKey(resourceField)); m_project.getCustomFields().getCustomField(resourceField).setAlias(name); break; case ASSIGNMENT: AssignmentField assignmentField; do { assignmentField = m_assignmentUdfCounters.nextField(AssignmentField.class, dataType); } while (m_assignmentFields.containsKey(assignmentField)); m_project.getCustomFields().getCustomField(assignmentField).setAlias(name); break; default: break; } } catch (Exception ex) { // // SF#227: If we get an exception thrown here... it's likely that // we've run out of user defined fields, for example // there are only 30 TEXT fields. We'll ignore this: the user // defined field won't be mapped to an alias, so we'll // ignore it when we read in the values. // } }
[ "private", "void", "addUserDefinedField", "(", "FieldTypeClass", "fieldType", ",", "UserFieldDataType", "dataType", ",", "String", "name", ")", "{", "try", "{", "switch", "(", "fieldType", ")", "{", "case", "TASK", ":", "TaskField", "taskField", ";", "do", "{", "taskField", "=", "m_taskUdfCounters", ".", "nextField", "(", "TaskField", ".", "class", ",", "dataType", ")", ";", "}", "while", "(", "m_taskFields", ".", "containsKey", "(", "taskField", ")", "||", "m_wbsFields", ".", "containsKey", "(", "taskField", ")", ")", ";", "m_project", ".", "getCustomFields", "(", ")", ".", "getCustomField", "(", "taskField", ")", ".", "setAlias", "(", "name", ")", ";", "break", ";", "case", "RESOURCE", ":", "ResourceField", "resourceField", ";", "do", "{", "resourceField", "=", "m_resourceUdfCounters", ".", "nextField", "(", "ResourceField", ".", "class", ",", "dataType", ")", ";", "}", "while", "(", "m_resourceFields", ".", "containsKey", "(", "resourceField", ")", ")", ";", "m_project", ".", "getCustomFields", "(", ")", ".", "getCustomField", "(", "resourceField", ")", ".", "setAlias", "(", "name", ")", ";", "break", ";", "case", "ASSIGNMENT", ":", "AssignmentField", "assignmentField", ";", "do", "{", "assignmentField", "=", "m_assignmentUdfCounters", ".", "nextField", "(", "AssignmentField", ".", "class", ",", "dataType", ")", ";", "}", "while", "(", "m_assignmentFields", ".", "containsKey", "(", "assignmentField", ")", ")", ";", "m_project", ".", "getCustomFields", "(", ")", ".", "getCustomField", "(", "assignmentField", ")", ".", "setAlias", "(", "name", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "//", "// SF#227: If we get an exception thrown here... it's likely that", "// we've run out of user defined fields, for example", "// there are only 30 TEXT fields. We'll ignore this: the user", "// defined field won't be mapped to an alias, so we'll", "// ignore it when we read in the values.", "//", "}", "}" ]
Configure a new user defined field. @param fieldType field type @param dataType field data type @param name field name
[ "Configure", "a", "new", "user", "defined", "field", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L814-L871
156,924
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.addUDFValue
private void addUDFValue(FieldTypeClass fieldType, FieldContainer container, Row row) { Integer fieldId = row.getInteger("udf_type_id"); String fieldName = m_udfFields.get(fieldId); Object value = null; FieldType field = m_project.getCustomFields().getFieldByAlias(fieldType, fieldName); if (field != null) { DataType fieldDataType = field.getDataType(); switch (fieldDataType) { case DATE: { value = row.getDate("udf_date"); break; } case CURRENCY: case NUMERIC: { value = row.getDouble("udf_number"); break; } case GUID: case INTEGER: { value = row.getInteger("udf_code_id"); break; } case BOOLEAN: { String text = row.getString("udf_text"); if (text != null) { // before a normal boolean parse, we try to lookup the text as a P6 static type indicator UDF value = STATICTYPE_UDF_MAP.get(text); if (value == null) { value = Boolean.valueOf(row.getBoolean("udf_text")); } } else { value = Boolean.valueOf(row.getBoolean("udf_number")); } break; } default: { value = row.getString("udf_text"); break; } } container.set(field, value); } }
java
private void addUDFValue(FieldTypeClass fieldType, FieldContainer container, Row row) { Integer fieldId = row.getInteger("udf_type_id"); String fieldName = m_udfFields.get(fieldId); Object value = null; FieldType field = m_project.getCustomFields().getFieldByAlias(fieldType, fieldName); if (field != null) { DataType fieldDataType = field.getDataType(); switch (fieldDataType) { case DATE: { value = row.getDate("udf_date"); break; } case CURRENCY: case NUMERIC: { value = row.getDouble("udf_number"); break; } case GUID: case INTEGER: { value = row.getInteger("udf_code_id"); break; } case BOOLEAN: { String text = row.getString("udf_text"); if (text != null) { // before a normal boolean parse, we try to lookup the text as a P6 static type indicator UDF value = STATICTYPE_UDF_MAP.get(text); if (value == null) { value = Boolean.valueOf(row.getBoolean("udf_text")); } } else { value = Boolean.valueOf(row.getBoolean("udf_number")); } break; } default: { value = row.getString("udf_text"); break; } } container.set(field, value); } }
[ "private", "void", "addUDFValue", "(", "FieldTypeClass", "fieldType", ",", "FieldContainer", "container", ",", "Row", "row", ")", "{", "Integer", "fieldId", "=", "row", ".", "getInteger", "(", "\"udf_type_id\"", ")", ";", "String", "fieldName", "=", "m_udfFields", ".", "get", "(", "fieldId", ")", ";", "Object", "value", "=", "null", ";", "FieldType", "field", "=", "m_project", ".", "getCustomFields", "(", ")", ".", "getFieldByAlias", "(", "fieldType", ",", "fieldName", ")", ";", "if", "(", "field", "!=", "null", ")", "{", "DataType", "fieldDataType", "=", "field", ".", "getDataType", "(", ")", ";", "switch", "(", "fieldDataType", ")", "{", "case", "DATE", ":", "{", "value", "=", "row", ".", "getDate", "(", "\"udf_date\"", ")", ";", "break", ";", "}", "case", "CURRENCY", ":", "case", "NUMERIC", ":", "{", "value", "=", "row", ".", "getDouble", "(", "\"udf_number\"", ")", ";", "break", ";", "}", "case", "GUID", ":", "case", "INTEGER", ":", "{", "value", "=", "row", ".", "getInteger", "(", "\"udf_code_id\"", ")", ";", "break", ";", "}", "case", "BOOLEAN", ":", "{", "String", "text", "=", "row", ".", "getString", "(", "\"udf_text\"", ")", ";", "if", "(", "text", "!=", "null", ")", "{", "// before a normal boolean parse, we try to lookup the text as a P6 static type indicator UDF", "value", "=", "STATICTYPE_UDF_MAP", ".", "get", "(", "text", ")", ";", "if", "(", "value", "==", "null", ")", "{", "value", "=", "Boolean", ".", "valueOf", "(", "row", ".", "getBoolean", "(", "\"udf_text\"", ")", ")", ";", "}", "}", "else", "{", "value", "=", "Boolean", ".", "valueOf", "(", "row", ".", "getBoolean", "(", "\"udf_number\"", ")", ")", ";", "}", "break", ";", "}", "default", ":", "{", "value", "=", "row", ".", "getString", "(", "\"udf_text\"", ")", ";", "break", ";", "}", "}", "container", ".", "set", "(", "field", ",", "value", ")", ";", "}", "}" ]
Adds a user defined field value to a task. @param fieldType field type @param container FieldContainer instance @param row UDF data
[ "Adds", "a", "user", "defined", "field", "value", "to", "a", "task", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L880-L941
156,925
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.populateUserDefinedFieldValues
private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID) { Map<Integer, List<Row>> tableData = m_udfValues.get(tableName); if (tableData != null) { List<Row> udf = tableData.get(uniqueID); if (udf != null) { for (Row r : udf) { addUDFValue(type, container, r); } } } }
java
private void populateUserDefinedFieldValues(String tableName, FieldTypeClass type, FieldContainer container, Integer uniqueID) { Map<Integer, List<Row>> tableData = m_udfValues.get(tableName); if (tableData != null) { List<Row> udf = tableData.get(uniqueID); if (udf != null) { for (Row r : udf) { addUDFValue(type, container, r); } } } }
[ "private", "void", "populateUserDefinedFieldValues", "(", "String", "tableName", ",", "FieldTypeClass", "type", ",", "FieldContainer", "container", ",", "Integer", "uniqueID", ")", "{", "Map", "<", "Integer", ",", "List", "<", "Row", ">", ">", "tableData", "=", "m_udfValues", ".", "get", "(", "tableName", ")", ";", "if", "(", "tableData", "!=", "null", ")", "{", "List", "<", "Row", ">", "udf", "=", "tableData", ".", "get", "(", "uniqueID", ")", ";", "if", "(", "udf", "!=", "null", ")", "{", "for", "(", "Row", "r", ":", "udf", ")", "{", "addUDFValue", "(", "type", ",", "container", ",", "r", ")", ";", "}", "}", "}", "}" ]
Populate the UDF values for this entity. @param tableName parent table name @param type entity type @param container entity @param uniqueID entity Unique ID
[ "Populate", "the", "UDF", "values", "for", "this", "entity", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L951-L965
156,926
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processDefaultCurrency
public void processDefaultCurrency(Row row) { ProjectProperties properties = m_project.getProjectProperties(); properties.setCurrencySymbol(row.getString("curr_symbol")); properties.setSymbolPosition(CURRENCY_SYMBOL_POSITION_MAP.get(row.getString("pos_curr_fmt_type"))); properties.setCurrencyDigits(row.getInteger("decimal_digit_cnt")); properties.setThousandsSeparator(row.getString("digit_group_symbol").charAt(0)); properties.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); }
java
public void processDefaultCurrency(Row row) { ProjectProperties properties = m_project.getProjectProperties(); properties.setCurrencySymbol(row.getString("curr_symbol")); properties.setSymbolPosition(CURRENCY_SYMBOL_POSITION_MAP.get(row.getString("pos_curr_fmt_type"))); properties.setCurrencyDigits(row.getInteger("decimal_digit_cnt")); properties.setThousandsSeparator(row.getString("digit_group_symbol").charAt(0)); properties.setDecimalSeparator(row.getString("decimal_symbol").charAt(0)); }
[ "public", "void", "processDefaultCurrency", "(", "Row", "row", ")", "{", "ProjectProperties", "properties", "=", "m_project", ".", "getProjectProperties", "(", ")", ";", "properties", ".", "setCurrencySymbol", "(", "row", ".", "getString", "(", "\"curr_symbol\"", ")", ")", ";", "properties", ".", "setSymbolPosition", "(", "CURRENCY_SYMBOL_POSITION_MAP", ".", "get", "(", "row", ".", "getString", "(", "\"pos_curr_fmt_type\"", ")", ")", ")", ";", "properties", ".", "setCurrencyDigits", "(", "row", ".", "getInteger", "(", "\"decimal_digit_cnt\"", ")", ")", ";", "properties", ".", "setThousandsSeparator", "(", "row", ".", "getString", "(", "\"digit_group_symbol\"", ")", ".", "charAt", "(", "0", ")", ")", ";", "properties", ".", "setDecimalSeparator", "(", "row", ".", "getString", "(", "\"decimal_symbol\"", ")", ".", "charAt", "(", "0", ")", ")", ";", "}" ]
Code common to both XER and database readers to extract currency format data. @param row row containing currency data
[ "Code", "common", "to", "both", "XER", "and", "database", "readers", "to", "extract", "currency", "format", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1358-L1366
156,927
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.processFields
private void processFields(Map<FieldType, String> map, Row row, FieldContainer container) { for (Map.Entry<FieldType, String> entry : map.entrySet()) { FieldType field = entry.getKey(); String name = entry.getValue(); Object value; switch (field.getDataType()) { case INTEGER: { value = row.getInteger(name); break; } case BOOLEAN: { value = Boolean.valueOf(row.getBoolean(name)); break; } case DATE: { value = row.getDate(name); break; } case CURRENCY: case NUMERIC: case PERCENTAGE: { value = row.getDouble(name); break; } case DELAY: case WORK: case DURATION: { value = row.getDuration(name); break; } case RESOURCE_TYPE: { value = RESOURCE_TYPE_MAP.get(row.getString(name)); break; } case TASK_TYPE: { value = TASK_TYPE_MAP.get(row.getString(name)); break; } case CONSTRAINT: { value = CONSTRAINT_TYPE_MAP.get(row.getString(name)); break; } case PRIORITY: { value = PRIORITY_MAP.get(row.getString(name)); break; } case GUID: { value = row.getUUID(name); break; } default: { value = row.getString(name); break; } } container.set(field, value); } }
java
private void processFields(Map<FieldType, String> map, Row row, FieldContainer container) { for (Map.Entry<FieldType, String> entry : map.entrySet()) { FieldType field = entry.getKey(); String name = entry.getValue(); Object value; switch (field.getDataType()) { case INTEGER: { value = row.getInteger(name); break; } case BOOLEAN: { value = Boolean.valueOf(row.getBoolean(name)); break; } case DATE: { value = row.getDate(name); break; } case CURRENCY: case NUMERIC: case PERCENTAGE: { value = row.getDouble(name); break; } case DELAY: case WORK: case DURATION: { value = row.getDuration(name); break; } case RESOURCE_TYPE: { value = RESOURCE_TYPE_MAP.get(row.getString(name)); break; } case TASK_TYPE: { value = TASK_TYPE_MAP.get(row.getString(name)); break; } case CONSTRAINT: { value = CONSTRAINT_TYPE_MAP.get(row.getString(name)); break; } case PRIORITY: { value = PRIORITY_MAP.get(row.getString(name)); break; } case GUID: { value = row.getUUID(name); break; } default: { value = row.getString(name); break; } } container.set(field, value); } }
[ "private", "void", "processFields", "(", "Map", "<", "FieldType", ",", "String", ">", "map", ",", "Row", "row", ",", "FieldContainer", "container", ")", "{", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "String", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "FieldType", "field", "=", "entry", ".", "getKey", "(", ")", ";", "String", "name", "=", "entry", ".", "getValue", "(", ")", ";", "Object", "value", ";", "switch", "(", "field", ".", "getDataType", "(", ")", ")", "{", "case", "INTEGER", ":", "{", "value", "=", "row", ".", "getInteger", "(", "name", ")", ";", "break", ";", "}", "case", "BOOLEAN", ":", "{", "value", "=", "Boolean", ".", "valueOf", "(", "row", ".", "getBoolean", "(", "name", ")", ")", ";", "break", ";", "}", "case", "DATE", ":", "{", "value", "=", "row", ".", "getDate", "(", "name", ")", ";", "break", ";", "}", "case", "CURRENCY", ":", "case", "NUMERIC", ":", "case", "PERCENTAGE", ":", "{", "value", "=", "row", ".", "getDouble", "(", "name", ")", ";", "break", ";", "}", "case", "DELAY", ":", "case", "WORK", ":", "case", "DURATION", ":", "{", "value", "=", "row", ".", "getDuration", "(", "name", ")", ";", "break", ";", "}", "case", "RESOURCE_TYPE", ":", "{", "value", "=", "RESOURCE_TYPE_MAP", ".", "get", "(", "row", ".", "getString", "(", "name", ")", ")", ";", "break", ";", "}", "case", "TASK_TYPE", ":", "{", "value", "=", "TASK_TYPE_MAP", ".", "get", "(", "row", ".", "getString", "(", "name", ")", ")", ";", "break", ";", "}", "case", "CONSTRAINT", ":", "{", "value", "=", "CONSTRAINT_TYPE_MAP", ".", "get", "(", "row", ".", "getString", "(", "name", ")", ")", ";", "break", ";", "}", "case", "PRIORITY", ":", "{", "value", "=", "PRIORITY_MAP", ".", "get", "(", "row", ".", "getString", "(", "name", ")", ")", ";", "break", ";", "}", "case", "GUID", ":", "{", "value", "=", "row", ".", "getUUID", "(", "name", ")", ";", "break", ";", "}", "default", ":", "{", "value", "=", "row", ".", "getString", "(", "name", ")", ";", "break", ";", "}", "}", "container", ".", "set", "(", "field", ",", "value", ")", ";", "}", "}" ]
Generic method to extract Primavera fields and assign to MPXJ fields. @param map map of MPXJ field types and Primavera field names @param row Primavera data container @param container MPXJ data contain
[ "Generic", "method", "to", "extract", "Primavera", "fields", "and", "assign", "to", "MPXJ", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1375-L1458
156,928
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.applyAliases
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
java
private void applyAliases(Map<FieldType, String> aliases) { CustomFieldContainer fields = m_project.getCustomFields(); for (Map.Entry<FieldType, String> entry : aliases.entrySet()) { fields.getCustomField(entry.getKey()).setAlias(entry.getValue()); } }
[ "private", "void", "applyAliases", "(", "Map", "<", "FieldType", ",", "String", ">", "aliases", ")", "{", "CustomFieldContainer", "fields", "=", "m_project", ".", "getCustomFields", "(", ")", ";", "for", "(", "Map", ".", "Entry", "<", "FieldType", ",", "String", ">", "entry", ":", "aliases", ".", "entrySet", "(", ")", ")", "{", "fields", ".", "getCustomField", "(", "entry", ".", "getKey", "(", ")", ")", ".", "setAlias", "(", "entry", ".", "getValue", "(", ")", ")", ";", "}", "}" ]
Apply aliases to task and resource fields. @param aliases map of aliases
[ "Apply", "aliases", "to", "task", "and", "resource", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1481-L1488
156,929
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculatePercentComplete
private Number calculatePercentComplete(Row row) { Number result; switch (PercentCompleteType.getInstance(row.getString("complete_pct_type"))) { case UNITS: { result = calculateUnitsPercentComplete(row); break; } case DURATION: { result = calculateDurationPercentComplete(row); break; } default: { result = calculatePhysicalPercentComplete(row); break; } } return result; }
java
private Number calculatePercentComplete(Row row) { Number result; switch (PercentCompleteType.getInstance(row.getString("complete_pct_type"))) { case UNITS: { result = calculateUnitsPercentComplete(row); break; } case DURATION: { result = calculateDurationPercentComplete(row); break; } default: { result = calculatePhysicalPercentComplete(row); break; } } return result; }
[ "private", "Number", "calculatePercentComplete", "(", "Row", "row", ")", "{", "Number", "result", ";", "switch", "(", "PercentCompleteType", ".", "getInstance", "(", "row", ".", "getString", "(", "\"complete_pct_type\"", ")", ")", ")", "{", "case", "UNITS", ":", "{", "result", "=", "calculateUnitsPercentComplete", "(", "row", ")", ";", "break", ";", "}", "case", "DURATION", ":", "{", "result", "=", "calculateDurationPercentComplete", "(", "row", ")", ";", "break", ";", "}", "default", ":", "{", "result", "=", "calculatePhysicalPercentComplete", "(", "row", ")", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Determine which type of percent complete is used on on this task, and calculate the required value. @param row task data @return percent complete value
[ "Determine", "which", "type", "of", "percent", "complete", "is", "used", "on", "on", "this", "task", "and", "calculate", "the", "required", "value", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1497-L1522
156,930
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculateUnitsPercentComplete
private Number calculateUnitsPercentComplete(Row row) { double result = 0; double actualWorkQuantity = NumberHelper.getDouble(row.getDouble("act_work_qty")); double actualEquipmentQuantity = NumberHelper.getDouble(row.getDouble("act_equip_qty")); double numerator = actualWorkQuantity + actualEquipmentQuantity; if (numerator != 0) { double remainingWorkQuantity = NumberHelper.getDouble(row.getDouble("remain_work_qty")); double remainingEquipmentQuantity = NumberHelper.getDouble(row.getDouble("remain_equip_qty")); double denominator = remainingWorkQuantity + actualWorkQuantity + remainingEquipmentQuantity + actualEquipmentQuantity; result = denominator == 0 ? 0 : ((numerator * 100) / denominator); } return NumberHelper.getDouble(result); }
java
private Number calculateUnitsPercentComplete(Row row) { double result = 0; double actualWorkQuantity = NumberHelper.getDouble(row.getDouble("act_work_qty")); double actualEquipmentQuantity = NumberHelper.getDouble(row.getDouble("act_equip_qty")); double numerator = actualWorkQuantity + actualEquipmentQuantity; if (numerator != 0) { double remainingWorkQuantity = NumberHelper.getDouble(row.getDouble("remain_work_qty")); double remainingEquipmentQuantity = NumberHelper.getDouble(row.getDouble("remain_equip_qty")); double denominator = remainingWorkQuantity + actualWorkQuantity + remainingEquipmentQuantity + actualEquipmentQuantity; result = denominator == 0 ? 0 : ((numerator * 100) / denominator); } return NumberHelper.getDouble(result); }
[ "private", "Number", "calculateUnitsPercentComplete", "(", "Row", "row", ")", "{", "double", "result", "=", "0", ";", "double", "actualWorkQuantity", "=", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"act_work_qty\"", ")", ")", ";", "double", "actualEquipmentQuantity", "=", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"act_equip_qty\"", ")", ")", ";", "double", "numerator", "=", "actualWorkQuantity", "+", "actualEquipmentQuantity", ";", "if", "(", "numerator", "!=", "0", ")", "{", "double", "remainingWorkQuantity", "=", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"remain_work_qty\"", ")", ")", ";", "double", "remainingEquipmentQuantity", "=", "NumberHelper", ".", "getDouble", "(", "row", ".", "getDouble", "(", "\"remain_equip_qty\"", ")", ")", ";", "double", "denominator", "=", "remainingWorkQuantity", "+", "actualWorkQuantity", "+", "remainingEquipmentQuantity", "+", "actualEquipmentQuantity", ";", "result", "=", "denominator", "==", "0", "?", "0", ":", "(", "(", "numerator", "*", "100", ")", "/", "denominator", ")", ";", "}", "return", "NumberHelper", ".", "getDouble", "(", "result", ")", ";", "}" ]
Calculate the units percent complete. @param row task data @return percent complete
[ "Calculate", "the", "units", "percent", "complete", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1541-L1558
156,931
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.calculateDurationPercentComplete
private Number calculateDurationPercentComplete(Row row) { double result = 0; double targetDuration = row.getDuration("target_drtn_hr_cnt").getDuration(); double remainingDuration = row.getDuration("remain_drtn_hr_cnt").getDuration(); if (targetDuration == 0) { if (remainingDuration == 0) { if ("TK_Complete".equals(row.getString("status_code"))) { result = 100; } } } else { if (remainingDuration < targetDuration) { result = ((targetDuration - remainingDuration) * 100) / targetDuration; } } return NumberHelper.getDouble(result); }
java
private Number calculateDurationPercentComplete(Row row) { double result = 0; double targetDuration = row.getDuration("target_drtn_hr_cnt").getDuration(); double remainingDuration = row.getDuration("remain_drtn_hr_cnt").getDuration(); if (targetDuration == 0) { if (remainingDuration == 0) { if ("TK_Complete".equals(row.getString("status_code"))) { result = 100; } } } else { if (remainingDuration < targetDuration) { result = ((targetDuration - remainingDuration) * 100) / targetDuration; } } return NumberHelper.getDouble(result); }
[ "private", "Number", "calculateDurationPercentComplete", "(", "Row", "row", ")", "{", "double", "result", "=", "0", ";", "double", "targetDuration", "=", "row", ".", "getDuration", "(", "\"target_drtn_hr_cnt\"", ")", ".", "getDuration", "(", ")", ";", "double", "remainingDuration", "=", "row", ".", "getDuration", "(", "\"remain_drtn_hr_cnt\"", ")", ".", "getDuration", "(", ")", ";", "if", "(", "targetDuration", "==", "0", ")", "{", "if", "(", "remainingDuration", "==", "0", ")", "{", "if", "(", "\"TK_Complete\"", ".", "equals", "(", "row", ".", "getString", "(", "\"status_code\"", ")", ")", ")", "{", "result", "=", "100", ";", "}", "}", "}", "else", "{", "if", "(", "remainingDuration", "<", "targetDuration", ")", "{", "result", "=", "(", "(", "targetDuration", "-", "remainingDuration", ")", "*", "100", ")", "/", "targetDuration", ";", "}", "}", "return", "NumberHelper", ".", "getDouble", "(", "result", ")", ";", "}" ]
Calculate the duration percent complete. @param row task data @return percent complete
[ "Calculate", "the", "duration", "percent", "complete", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1566-L1591
156,932
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultResourceFieldMap
public static Map<FieldType, String> getDefaultResourceFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(ResourceField.UNIQUE_ID, "rsrc_id"); map.put(ResourceField.GUID, "guid"); map.put(ResourceField.NAME, "rsrc_name"); map.put(ResourceField.CODE, "employee_code"); map.put(ResourceField.EMAIL_ADDRESS, "email_addr"); map.put(ResourceField.NOTES, "rsrc_notes"); map.put(ResourceField.CREATED, "create_date"); map.put(ResourceField.TYPE, "rsrc_type"); map.put(ResourceField.INITIALS, "rsrc_short_name"); map.put(ResourceField.PARENT_ID, "parent_rsrc_id"); return map; }
java
public static Map<FieldType, String> getDefaultResourceFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(ResourceField.UNIQUE_ID, "rsrc_id"); map.put(ResourceField.GUID, "guid"); map.put(ResourceField.NAME, "rsrc_name"); map.put(ResourceField.CODE, "employee_code"); map.put(ResourceField.EMAIL_ADDRESS, "email_addr"); map.put(ResourceField.NOTES, "rsrc_notes"); map.put(ResourceField.CREATED, "create_date"); map.put(ResourceField.TYPE, "rsrc_type"); map.put(ResourceField.INITIALS, "rsrc_short_name"); map.put(ResourceField.PARENT_ID, "parent_rsrc_id"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultResourceFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "UNIQUE_ID", ",", "\"rsrc_id\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "GUID", ",", "\"guid\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "NAME", ",", "\"rsrc_name\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "CODE", ",", "\"employee_code\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "EMAIL_ADDRESS", ",", "\"email_addr\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "NOTES", ",", "\"rsrc_notes\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "CREATED", ",", "\"create_date\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "TYPE", ",", "\"rsrc_type\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "INITIALS", ",", "\"rsrc_short_name\"", ")", ";", "map", ".", "put", "(", "ResourceField", ".", "PARENT_ID", ",", "\"parent_rsrc_id\"", ")", ";", "return", "map", ";", "}" ]
Retrieve the default mapping between MPXJ resource fields and Primavera resource field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "resource", "fields", "and", "Primavera", "resource", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1598-L1614
156,933
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultWbsFieldMap
public static Map<FieldType, String> getDefaultWbsFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "wbs_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "wbs_name"); map.put(TaskField.BASELINE_COST, "orig_cost"); map.put(TaskField.REMAINING_COST, "indep_remain_total_cost"); map.put(TaskField.REMAINING_WORK, "indep_remain_work_qty"); map.put(TaskField.DEADLINE, "anticip_end_date"); map.put(TaskField.DATE1, "suspend_date"); map.put(TaskField.DATE2, "resume_date"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.WBS, "wbs_short_name"); return map; }
java
public static Map<FieldType, String> getDefaultWbsFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "wbs_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "wbs_name"); map.put(TaskField.BASELINE_COST, "orig_cost"); map.put(TaskField.REMAINING_COST, "indep_remain_total_cost"); map.put(TaskField.REMAINING_WORK, "indep_remain_work_qty"); map.put(TaskField.DEADLINE, "anticip_end_date"); map.put(TaskField.DATE1, "suspend_date"); map.put(TaskField.DATE2, "resume_date"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.WBS, "wbs_short_name"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultWbsFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "TaskField", ".", "UNIQUE_ID", ",", "\"wbs_id\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "GUID", ",", "\"guid\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "NAME", ",", "\"wbs_name\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "BASELINE_COST", ",", "\"orig_cost\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_COST", ",", "\"indep_remain_total_cost\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_WORK", ",", "\"indep_remain_work_qty\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DEADLINE", ",", "\"anticip_end_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DATE1", ",", "\"suspend_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DATE2", ",", "\"resume_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT1", ",", "\"task_code\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "WBS", ",", "\"wbs_short_name\"", ")", ";", "return", "map", ";", "}" ]
Retrieve the default mapping between MPXJ task fields and Primavera wbs field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "task", "fields", "and", "Primavera", "wbs", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1621-L1638
156,934
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultTaskFieldMap
public static Map<FieldType, String> getDefaultTaskFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "task_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "task_name"); map.put(TaskField.ACTUAL_DURATION, "act_drtn_hr_cnt"); map.put(TaskField.REMAINING_DURATION, "remain_drtn_hr_cnt"); map.put(TaskField.ACTUAL_WORK, "act_work_qty"); map.put(TaskField.REMAINING_WORK, "remain_work_qty"); map.put(TaskField.BASELINE_WORK, "target_work_qty"); map.put(TaskField.BASELINE_DURATION, "target_drtn_hr_cnt"); map.put(TaskField.DURATION, "target_drtn_hr_cnt"); map.put(TaskField.CONSTRAINT_DATE, "cstr_date"); map.put(TaskField.ACTUAL_START, "act_start_date"); map.put(TaskField.ACTUAL_FINISH, "act_end_date"); map.put(TaskField.LATE_START, "late_start_date"); map.put(TaskField.LATE_FINISH, "late_end_date"); map.put(TaskField.EARLY_START, "early_start_date"); map.put(TaskField.EARLY_FINISH, "early_end_date"); map.put(TaskField.REMAINING_EARLY_START, "restart_date"); map.put(TaskField.REMAINING_EARLY_FINISH, "reend_date"); map.put(TaskField.BASELINE_START, "target_start_date"); map.put(TaskField.BASELINE_FINISH, "target_end_date"); map.put(TaskField.CONSTRAINT_TYPE, "cstr_type"); map.put(TaskField.PRIORITY, "priority_type"); map.put(TaskField.CREATED, "create_date"); map.put(TaskField.TYPE, "duration_type"); map.put(TaskField.FREE_SLACK, "free_float_hr_cnt"); map.put(TaskField.TOTAL_SLACK, "total_float_hr_cnt"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.TEXT2, "task_type"); map.put(TaskField.TEXT3, "status_code"); map.put(TaskField.NUMBER1, "rsrc_id"); return map; }
java
public static Map<FieldType, String> getDefaultTaskFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(TaskField.UNIQUE_ID, "task_id"); map.put(TaskField.GUID, "guid"); map.put(TaskField.NAME, "task_name"); map.put(TaskField.ACTUAL_DURATION, "act_drtn_hr_cnt"); map.put(TaskField.REMAINING_DURATION, "remain_drtn_hr_cnt"); map.put(TaskField.ACTUAL_WORK, "act_work_qty"); map.put(TaskField.REMAINING_WORK, "remain_work_qty"); map.put(TaskField.BASELINE_WORK, "target_work_qty"); map.put(TaskField.BASELINE_DURATION, "target_drtn_hr_cnt"); map.put(TaskField.DURATION, "target_drtn_hr_cnt"); map.put(TaskField.CONSTRAINT_DATE, "cstr_date"); map.put(TaskField.ACTUAL_START, "act_start_date"); map.put(TaskField.ACTUAL_FINISH, "act_end_date"); map.put(TaskField.LATE_START, "late_start_date"); map.put(TaskField.LATE_FINISH, "late_end_date"); map.put(TaskField.EARLY_START, "early_start_date"); map.put(TaskField.EARLY_FINISH, "early_end_date"); map.put(TaskField.REMAINING_EARLY_START, "restart_date"); map.put(TaskField.REMAINING_EARLY_FINISH, "reend_date"); map.put(TaskField.BASELINE_START, "target_start_date"); map.put(TaskField.BASELINE_FINISH, "target_end_date"); map.put(TaskField.CONSTRAINT_TYPE, "cstr_type"); map.put(TaskField.PRIORITY, "priority_type"); map.put(TaskField.CREATED, "create_date"); map.put(TaskField.TYPE, "duration_type"); map.put(TaskField.FREE_SLACK, "free_float_hr_cnt"); map.put(TaskField.TOTAL_SLACK, "total_float_hr_cnt"); map.put(TaskField.TEXT1, "task_code"); map.put(TaskField.TEXT2, "task_type"); map.put(TaskField.TEXT3, "status_code"); map.put(TaskField.NUMBER1, "rsrc_id"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultTaskFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "TaskField", ".", "UNIQUE_ID", ",", "\"task_id\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "GUID", ",", "\"guid\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "NAME", ",", "\"task_name\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "ACTUAL_DURATION", ",", "\"act_drtn_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_DURATION", ",", "\"remain_drtn_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "ACTUAL_WORK", ",", "\"act_work_qty\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_WORK", ",", "\"remain_work_qty\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "BASELINE_WORK", ",", "\"target_work_qty\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "BASELINE_DURATION", ",", "\"target_drtn_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DURATION", ",", "\"target_drtn_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "CONSTRAINT_DATE", ",", "\"cstr_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "ACTUAL_START", ",", "\"act_start_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "ACTUAL_FINISH", ",", "\"act_end_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "LATE_START", ",", "\"late_start_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "LATE_FINISH", ",", "\"late_end_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "EARLY_START", ",", "\"early_start_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "EARLY_FINISH", ",", "\"early_end_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_EARLY_START", ",", "\"restart_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "REMAINING_EARLY_FINISH", ",", "\"reend_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "BASELINE_START", ",", "\"target_start_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "BASELINE_FINISH", ",", "\"target_end_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "CONSTRAINT_TYPE", ",", "\"cstr_type\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "PRIORITY", ",", "\"priority_type\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "CREATED", ",", "\"create_date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TYPE", ",", "\"duration_type\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "FREE_SLACK", ",", "\"free_float_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TOTAL_SLACK", ",", "\"total_float_hr_cnt\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT1", ",", "\"task_code\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT2", ",", "\"task_type\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT3", ",", "\"status_code\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "NUMBER1", ",", "\"rsrc_id\"", ")", ";", "return", "map", ";", "}" ]
Retrieve the default mapping between MPXJ task fields and Primavera task field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "task", "fields", "and", "Primavera", "task", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1645-L1682
156,935
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultAssignmentFieldMap
public static Map<FieldType, String> getDefaultAssignmentFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(AssignmentField.UNIQUE_ID, "taskrsrc_id"); map.put(AssignmentField.GUID, "guid"); map.put(AssignmentField.REMAINING_WORK, "remain_qty"); map.put(AssignmentField.BASELINE_WORK, "target_qty"); map.put(AssignmentField.ACTUAL_OVERTIME_WORK, "act_ot_qty"); map.put(AssignmentField.BASELINE_COST, "target_cost"); map.put(AssignmentField.ACTUAL_OVERTIME_COST, "act_ot_cost"); map.put(AssignmentField.REMAINING_COST, "remain_cost"); map.put(AssignmentField.ACTUAL_START, "act_start_date"); map.put(AssignmentField.ACTUAL_FINISH, "act_end_date"); map.put(AssignmentField.BASELINE_START, "target_start_date"); map.put(AssignmentField.BASELINE_FINISH, "target_end_date"); map.put(AssignmentField.ASSIGNMENT_DELAY, "target_lag_drtn_hr_cnt"); return map; }
java
public static Map<FieldType, String> getDefaultAssignmentFieldMap() { Map<FieldType, String> map = new LinkedHashMap<FieldType, String>(); map.put(AssignmentField.UNIQUE_ID, "taskrsrc_id"); map.put(AssignmentField.GUID, "guid"); map.put(AssignmentField.REMAINING_WORK, "remain_qty"); map.put(AssignmentField.BASELINE_WORK, "target_qty"); map.put(AssignmentField.ACTUAL_OVERTIME_WORK, "act_ot_qty"); map.put(AssignmentField.BASELINE_COST, "target_cost"); map.put(AssignmentField.ACTUAL_OVERTIME_COST, "act_ot_cost"); map.put(AssignmentField.REMAINING_COST, "remain_cost"); map.put(AssignmentField.ACTUAL_START, "act_start_date"); map.put(AssignmentField.ACTUAL_FINISH, "act_end_date"); map.put(AssignmentField.BASELINE_START, "target_start_date"); map.put(AssignmentField.BASELINE_FINISH, "target_end_date"); map.put(AssignmentField.ASSIGNMENT_DELAY, "target_lag_drtn_hr_cnt"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultAssignmentFieldMap", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "LinkedHashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "UNIQUE_ID", ",", "\"taskrsrc_id\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "GUID", ",", "\"guid\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "REMAINING_WORK", ",", "\"remain_qty\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "BASELINE_WORK", ",", "\"target_qty\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "ACTUAL_OVERTIME_WORK", ",", "\"act_ot_qty\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "BASELINE_COST", ",", "\"target_cost\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "ACTUAL_OVERTIME_COST", ",", "\"act_ot_cost\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "REMAINING_COST", ",", "\"remain_cost\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "ACTUAL_START", ",", "\"act_start_date\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "ACTUAL_FINISH", ",", "\"act_end_date\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "BASELINE_START", ",", "\"target_start_date\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "BASELINE_FINISH", ",", "\"target_end_date\"", ")", ";", "map", ".", "put", "(", "AssignmentField", ".", "ASSIGNMENT_DELAY", ",", "\"target_lag_drtn_hr_cnt\"", ")", ";", "return", "map", ";", "}" ]
Retrieve the default mapping between MPXJ assignment fields and Primavera assignment field names. @return mapping
[ "Retrieve", "the", "default", "mapping", "between", "MPXJ", "assignment", "fields", "and", "Primavera", "assignment", "field", "names", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1689-L1708
156,936
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java
PrimaveraReader.getDefaultAliases
public static Map<FieldType, String> getDefaultAliases() { Map<FieldType, String> map = new HashMap<FieldType, String>(); map.put(TaskField.DATE1, "Suspend Date"); map.put(TaskField.DATE2, "Resume Date"); map.put(TaskField.TEXT1, "Code"); map.put(TaskField.TEXT2, "Activity Type"); map.put(TaskField.TEXT3, "Status"); map.put(TaskField.NUMBER1, "Primary Resource Unique ID"); return map; }
java
public static Map<FieldType, String> getDefaultAliases() { Map<FieldType, String> map = new HashMap<FieldType, String>(); map.put(TaskField.DATE1, "Suspend Date"); map.put(TaskField.DATE2, "Resume Date"); map.put(TaskField.TEXT1, "Code"); map.put(TaskField.TEXT2, "Activity Type"); map.put(TaskField.TEXT3, "Status"); map.put(TaskField.NUMBER1, "Primary Resource Unique ID"); return map; }
[ "public", "static", "Map", "<", "FieldType", ",", "String", ">", "getDefaultAliases", "(", ")", "{", "Map", "<", "FieldType", ",", "String", ">", "map", "=", "new", "HashMap", "<", "FieldType", ",", "String", ">", "(", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DATE1", ",", "\"Suspend Date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "DATE2", ",", "\"Resume Date\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT1", ",", "\"Code\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT2", ",", "\"Activity Type\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "TEXT3", ",", "\"Status\"", ")", ";", "map", ".", "put", "(", "TaskField", ".", "NUMBER1", ",", "\"Primary Resource Unique ID\"", ")", ";", "return", "map", ";", "}" ]
Retrieve the default aliases to be applied to MPXJ task and resource fields. @return map of aliases
[ "Retrieve", "the", "default", "aliases", "to", "be", "applied", "to", "MPXJ", "task", "and", "resource", "fields", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraReader.java#L1715-L1727
156,937
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.filter
private static void filter(String filename, String filtername) throws Exception { ProjectFile project = new UniversalProjectReader().read(filename); Filter filter = project.getFilters().getFilterByName(filtername); if (filter == null) { displayAvailableFilters(project); } else { System.out.println(filter); System.out.println(); if (filter.isTaskFilter()) { processTaskFilter(project, filter); } else { processResourceFilter(project, filter); } } }
java
private static void filter(String filename, String filtername) throws Exception { ProjectFile project = new UniversalProjectReader().read(filename); Filter filter = project.getFilters().getFilterByName(filtername); if (filter == null) { displayAvailableFilters(project); } else { System.out.println(filter); System.out.println(); if (filter.isTaskFilter()) { processTaskFilter(project, filter); } else { processResourceFilter(project, filter); } } }
[ "private", "static", "void", "filter", "(", "String", "filename", ",", "String", "filtername", ")", "throws", "Exception", "{", "ProjectFile", "project", "=", "new", "UniversalProjectReader", "(", ")", ".", "read", "(", "filename", ")", ";", "Filter", "filter", "=", "project", ".", "getFilters", "(", ")", ".", "getFilterByName", "(", "filtername", ")", ";", "if", "(", "filter", "==", "null", ")", "{", "displayAvailableFilters", "(", "project", ")", ";", "}", "else", "{", "System", ".", "out", ".", "println", "(", "filter", ")", ";", "System", ".", "out", ".", "println", "(", ")", ";", "if", "(", "filter", ".", "isTaskFilter", "(", ")", ")", "{", "processTaskFilter", "(", "project", ",", "filter", ")", ";", "}", "else", "{", "processResourceFilter", "(", "project", ",", "filter", ")", ";", "}", "}", "}" ]
This method opens the named project, applies the named filter and displays the filtered list of tasks or resources. If an invalid filter name is supplied, a list of valid filter names is shown. @param filename input file name @param filtername input filter name
[ "This", "method", "opens", "the", "named", "project", "applies", "the", "named", "filter", "and", "displays", "the", "filtered", "list", "of", "tasks", "or", "resources", ".", "If", "an", "invalid", "filter", "name", "is", "supplied", "a", "list", "of", "valid", "filter", "names", "is", "shown", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L74-L97
156,938
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.displayAvailableFilters
private static void displayAvailableFilters(ProjectFile project) { System.out.println("Unknown filter name supplied."); System.out.println("Available task filters:"); for (Filter filter : project.getFilters().getTaskFilters()) { System.out.println(" " + filter.getName()); } System.out.println("Available resource filters:"); for (Filter filter : project.getFilters().getResourceFilters()) { System.out.println(" " + filter.getName()); } }
java
private static void displayAvailableFilters(ProjectFile project) { System.out.println("Unknown filter name supplied."); System.out.println("Available task filters:"); for (Filter filter : project.getFilters().getTaskFilters()) { System.out.println(" " + filter.getName()); } System.out.println("Available resource filters:"); for (Filter filter : project.getFilters().getResourceFilters()) { System.out.println(" " + filter.getName()); } }
[ "private", "static", "void", "displayAvailableFilters", "(", "ProjectFile", "project", ")", "{", "System", ".", "out", ".", "println", "(", "\"Unknown filter name supplied.\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Available task filters:\"", ")", ";", "for", "(", "Filter", "filter", ":", "project", ".", "getFilters", "(", ")", ".", "getTaskFilters", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\" \"", "+", "filter", ".", "getName", "(", ")", ")", ";", "}", "System", ".", "out", ".", "println", "(", "\"Available resource filters:\"", ")", ";", "for", "(", "Filter", "filter", ":", "project", ".", "getFilters", "(", ")", ".", "getResourceFilters", "(", ")", ")", "{", "System", ".", "out", ".", "println", "(", "\" \"", "+", "filter", ".", "getName", "(", ")", ")", ";", "}", "}" ]
This utility displays a list of available task filters, and a list of available resource filters. @param project project file
[ "This", "utility", "displays", "a", "list", "of", "available", "task", "filters", "and", "a", "list", "of", "available", "resource", "filters", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L105-L120
156,939
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processTaskFilter
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
java
private static void processTaskFilter(ProjectFile project, Filter filter) { for (Task task : project.getTasks()) { if (filter.evaluate(task, null)) { System.out.println(task.getID() + "," + task.getUniqueID() + "," + task.getName()); } } }
[ "private", "static", "void", "processTaskFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Task", "task", ":", "project", ".", "getTasks", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", "task", ",", "null", ")", ")", "{", "System", ".", "out", ".", "println", "(", "task", ".", "getID", "(", ")", "+", "\",\"", "+", "task", ".", "getUniqueID", "(", ")", "+", "\",\"", "+", "task", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Apply a filter to the list of all tasks, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "tasks", "and", "show", "the", "results", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L128-L137
156,940
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjFilter.java
MpxjFilter.processResourceFilter
private static void processResourceFilter(ProjectFile project, Filter filter) { for (Resource resource : project.getResources()) { if (filter.evaluate(resource, null)) { System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName()); } } }
java
private static void processResourceFilter(ProjectFile project, Filter filter) { for (Resource resource : project.getResources()) { if (filter.evaluate(resource, null)) { System.out.println(resource.getID() + "," + resource.getUniqueID() + "," + resource.getName()); } } }
[ "private", "static", "void", "processResourceFilter", "(", "ProjectFile", "project", ",", "Filter", "filter", ")", "{", "for", "(", "Resource", "resource", ":", "project", ".", "getResources", "(", ")", ")", "{", "if", "(", "filter", ".", "evaluate", "(", "resource", ",", "null", ")", ")", "{", "System", ".", "out", ".", "println", "(", "resource", ".", "getID", "(", ")", "+", "\",\"", "+", "resource", ".", "getUniqueID", "(", ")", "+", "\",\"", "+", "resource", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
Apply a filter to the list of all resources, and show the results. @param project project file @param filter filter
[ "Apply", "a", "filter", "to", "the", "list", "of", "all", "resources", "and", "show", "the", "results", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjFilter.java#L145-L154
156,941
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjConvert.java
MpxjConvert.process
public void process(String inputFile, String outputFile) throws Exception { System.out.println("Reading input file started."); long start = System.currentTimeMillis(); ProjectFile projectFile = readFile(inputFile); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading input file completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
java
public void process(String inputFile, String outputFile) throws Exception { System.out.println("Reading input file started."); long start = System.currentTimeMillis(); ProjectFile projectFile = readFile(inputFile); long elapsed = System.currentTimeMillis() - start; System.out.println("Reading input file completed in " + elapsed + "ms."); System.out.println("Writing output file started."); start = System.currentTimeMillis(); ProjectWriter writer = ProjectWriterUtility.getProjectWriter(outputFile); writer.write(projectFile, outputFile); elapsed = System.currentTimeMillis() - start; System.out.println("Writing output completed in " + elapsed + "ms."); }
[ "public", "void", "process", "(", "String", "inputFile", ",", "String", "outputFile", ")", "throws", "Exception", "{", "System", ".", "out", ".", "println", "(", "\"Reading input file started.\"", ")", ";", "long", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "ProjectFile", "projectFile", "=", "readFile", "(", "inputFile", ")", ";", "long", "elapsed", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "System", ".", "out", ".", "println", "(", "\"Reading input file completed in \"", "+", "elapsed", "+", "\"ms.\"", ")", ";", "System", ".", "out", ".", "println", "(", "\"Writing output file started.\"", ")", ";", "start", "=", "System", ".", "currentTimeMillis", "(", ")", ";", "ProjectWriter", "writer", "=", "ProjectWriterUtility", ".", "getProjectWriter", "(", "outputFile", ")", ";", "writer", ".", "write", "(", "projectFile", ",", "outputFile", ")", ";", "elapsed", "=", "System", ".", "currentTimeMillis", "(", ")", "-", "start", ";", "System", ".", "out", ".", "println", "(", "\"Writing output completed in \"", "+", "elapsed", "+", "\"ms.\"", ")", ";", "}" ]
Convert one project file format to another. @param inputFile input file @param outputFile output file @throws Exception
[ "Convert", "one", "project", "file", "format", "to", "another", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjConvert.java#L80-L94
156,942
joniles/mpxj
src/main/java/net/sf/mpxj/sample/MpxjConvert.java
MpxjConvert.readFile
private ProjectFile readFile(String inputFile) throws MPXJException { ProjectReader reader = new UniversalProjectReader(); ProjectFile projectFile = reader.read(inputFile); if (projectFile == null) { throw new IllegalArgumentException("Unsupported file type"); } return projectFile; }
java
private ProjectFile readFile(String inputFile) throws MPXJException { ProjectReader reader = new UniversalProjectReader(); ProjectFile projectFile = reader.read(inputFile); if (projectFile == null) { throw new IllegalArgumentException("Unsupported file type"); } return projectFile; }
[ "private", "ProjectFile", "readFile", "(", "String", "inputFile", ")", "throws", "MPXJException", "{", "ProjectReader", "reader", "=", "new", "UniversalProjectReader", "(", ")", ";", "ProjectFile", "projectFile", "=", "reader", ".", "read", "(", "inputFile", ")", ";", "if", "(", "projectFile", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unsupported file type\"", ")", ";", "}", "return", "projectFile", ";", "}" ]
Use the universal project reader to open the file. Throw an exception if we can't determine the file type. @param inputFile file name @return ProjectFile instance
[ "Use", "the", "universal", "project", "reader", "to", "open", "the", "file", ".", "Throw", "an", "exception", "if", "we", "can", "t", "determine", "the", "file", "type", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/sample/MpxjConvert.java#L103-L112
156,943
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readProjectProperties
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
java
private void readProjectProperties(Settings phoenixSettings, Storepoint storepoint) { ProjectProperties mpxjProperties = m_projectFile.getProjectProperties(); mpxjProperties.setName(phoenixSettings.getTitle()); mpxjProperties.setDefaultDurationUnits(phoenixSettings.getBaseunit()); mpxjProperties.setStatusDate(storepoint.getDataDate()); }
[ "private", "void", "readProjectProperties", "(", "Settings", "phoenixSettings", ",", "Storepoint", "storepoint", ")", "{", "ProjectProperties", "mpxjProperties", "=", "m_projectFile", ".", "getProjectProperties", "(", ")", ";", "mpxjProperties", ".", "setName", "(", "phoenixSettings", ".", "getTitle", "(", ")", ")", ";", "mpxjProperties", ".", "setDefaultDurationUnits", "(", "phoenixSettings", ".", "getBaseunit", "(", ")", ")", ";", "mpxjProperties", ".", "setStatusDate", "(", "storepoint", ".", "getDataDate", "(", ")", ")", ";", "}" ]
This method extracts project properties from a Phoenix file. @param phoenixSettings Phoenix settings @param storepoint Current storepoint
[ "This", "method", "extracts", "project", "properties", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L193-L199
156,944
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readCalendars
private void readCalendars(Storepoint phoenixProject) { Calendars calendars = phoenixProject.getCalendars(); if (calendars != null) { for (Calendar calendar : calendars.getCalendar()) { readCalendar(calendar); } ProjectCalendar defaultCalendar = m_projectFile.getCalendarByName(phoenixProject.getDefaultCalendar()); if (defaultCalendar != null) { m_projectFile.getProjectProperties().setDefaultCalendarName(defaultCalendar.getName()); } } }
java
private void readCalendars(Storepoint phoenixProject) { Calendars calendars = phoenixProject.getCalendars(); if (calendars != null) { for (Calendar calendar : calendars.getCalendar()) { readCalendar(calendar); } ProjectCalendar defaultCalendar = m_projectFile.getCalendarByName(phoenixProject.getDefaultCalendar()); if (defaultCalendar != null) { m_projectFile.getProjectProperties().setDefaultCalendarName(defaultCalendar.getName()); } } }
[ "private", "void", "readCalendars", "(", "Storepoint", "phoenixProject", ")", "{", "Calendars", "calendars", "=", "phoenixProject", ".", "getCalendars", "(", ")", ";", "if", "(", "calendars", "!=", "null", ")", "{", "for", "(", "Calendar", "calendar", ":", "calendars", ".", "getCalendar", "(", ")", ")", "{", "readCalendar", "(", "calendar", ")", ";", "}", "ProjectCalendar", "defaultCalendar", "=", "m_projectFile", ".", "getCalendarByName", "(", "phoenixProject", ".", "getDefaultCalendar", "(", ")", ")", ";", "if", "(", "defaultCalendar", "!=", "null", ")", "{", "m_projectFile", ".", "getProjectProperties", "(", ")", ".", "setDefaultCalendarName", "(", "defaultCalendar", ".", "getName", "(", ")", ")", ";", "}", "}", "}" ]
This method extracts calendar data from a Phoenix file. @param phoenixProject Root node of the Phoenix file
[ "This", "method", "extracts", "calendar", "data", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L206-L222
156,945
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readCalendar
private void readCalendar(Calendar calendar) { // Create the calendar ProjectCalendar mpxjCalendar = m_projectFile.addCalendar(); mpxjCalendar.setName(calendar.getName()); // Default all days to working for (Day day : Day.values()) { mpxjCalendar.setWorkingDay(day, true); } // Mark non-working days List<NonWork> nonWorkingDays = calendar.getNonWork(); for (NonWork nonWorkingDay : nonWorkingDays) { // TODO: handle recurring exceptions if (nonWorkingDay.getType().equals("internal_weekly")) { mpxjCalendar.setWorkingDay(nonWorkingDay.getWeekday(), false); } } // Add default working hours for working days for (Day day : Day.values()) { if (mpxjCalendar.isWorkingDay(day)) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
java
private void readCalendar(Calendar calendar) { // Create the calendar ProjectCalendar mpxjCalendar = m_projectFile.addCalendar(); mpxjCalendar.setName(calendar.getName()); // Default all days to working for (Day day : Day.values()) { mpxjCalendar.setWorkingDay(day, true); } // Mark non-working days List<NonWork> nonWorkingDays = calendar.getNonWork(); for (NonWork nonWorkingDay : nonWorkingDays) { // TODO: handle recurring exceptions if (nonWorkingDay.getType().equals("internal_weekly")) { mpxjCalendar.setWorkingDay(nonWorkingDay.getWeekday(), false); } } // Add default working hours for working days for (Day day : Day.values()) { if (mpxjCalendar.isWorkingDay(day)) { ProjectCalendarHours hours = mpxjCalendar.addCalendarHours(day); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_MORNING); hours.addRange(ProjectCalendarWeek.DEFAULT_WORKING_AFTERNOON); } } }
[ "private", "void", "readCalendar", "(", "Calendar", "calendar", ")", "{", "// Create the calendar", "ProjectCalendar", "mpxjCalendar", "=", "m_projectFile", ".", "addCalendar", "(", ")", ";", "mpxjCalendar", ".", "setName", "(", "calendar", ".", "getName", "(", ")", ")", ";", "// Default all days to working", "for", "(", "Day", "day", ":", "Day", ".", "values", "(", ")", ")", "{", "mpxjCalendar", ".", "setWorkingDay", "(", "day", ",", "true", ")", ";", "}", "// Mark non-working days", "List", "<", "NonWork", ">", "nonWorkingDays", "=", "calendar", ".", "getNonWork", "(", ")", ";", "for", "(", "NonWork", "nonWorkingDay", ":", "nonWorkingDays", ")", "{", "// TODO: handle recurring exceptions", "if", "(", "nonWorkingDay", ".", "getType", "(", ")", ".", "equals", "(", "\"internal_weekly\"", ")", ")", "{", "mpxjCalendar", ".", "setWorkingDay", "(", "nonWorkingDay", ".", "getWeekday", "(", ")", ",", "false", ")", ";", "}", "}", "// Add default working hours for working days", "for", "(", "Day", "day", ":", "Day", ".", "values", "(", ")", ")", "{", "if", "(", "mpxjCalendar", ".", "isWorkingDay", "(", "day", ")", ")", "{", "ProjectCalendarHours", "hours", "=", "mpxjCalendar", ".", "addCalendarHours", "(", "day", ")", ";", "hours", ".", "addRange", "(", "ProjectCalendarWeek", ".", "DEFAULT_WORKING_MORNING", ")", ";", "hours", ".", "addRange", "(", "ProjectCalendarWeek", ".", "DEFAULT_WORKING_AFTERNOON", ")", ";", "}", "}", "}" ]
This method extracts data for a single calendar from a Phoenix file. @param calendar calendar data
[ "This", "method", "extracts", "data", "for", "a", "single", "calendar", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L229-L262
156,946
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readResources
private void readResources(Storepoint phoenixProject) { Resources resources = phoenixProject.getResources(); if (resources != null) { for (net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res : resources.getResource()) { Resource resource = readResource(res); readAssignments(resource, res); } } }
java
private void readResources(Storepoint phoenixProject) { Resources resources = phoenixProject.getResources(); if (resources != null) { for (net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res : resources.getResource()) { Resource resource = readResource(res); readAssignments(resource, res); } } }
[ "private", "void", "readResources", "(", "Storepoint", "phoenixProject", ")", "{", "Resources", "resources", "=", "phoenixProject", ".", "getResources", "(", ")", ";", "if", "(", "resources", "!=", "null", ")", "{", "for", "(", "net", ".", "sf", ".", "mpxj", ".", "phoenix", ".", "schema", ".", "Project", ".", "Storepoints", ".", "Storepoint", ".", "Resources", ".", "Resource", "res", ":", "resources", ".", "getResource", "(", ")", ")", "{", "Resource", "resource", "=", "readResource", "(", "res", ")", ";", "readAssignments", "(", "resource", ",", "res", ")", ";", "}", "}", "}" ]
This method extracts resource data from a Phoenix file. @param phoenixProject parent node for resources
[ "This", "method", "extracts", "resource", "data", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L269-L280
156,947
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readResource
private Resource readResource(net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource phoenixResource) { Resource mpxjResource = m_projectFile.addResource(); TimeUnit rateUnits = phoenixResource.getMonetarybase(); if (rateUnits == null) { rateUnits = TimeUnit.HOURS; } // phoenixResource.getMaximum() mpxjResource.setCostPerUse(phoenixResource.getMonetarycostperuse()); mpxjResource.setStandardRate(new Rate(phoenixResource.getMonetaryrate(), rateUnits)); mpxjResource.setStandardRateUnits(rateUnits); mpxjResource.setName(phoenixResource.getName()); mpxjResource.setType(phoenixResource.getType()); mpxjResource.setMaterialLabel(phoenixResource.getUnitslabel()); //phoenixResource.getUnitsperbase() mpxjResource.setGUID(phoenixResource.getUuid()); m_eventManager.fireResourceReadEvent(mpxjResource); return mpxjResource; }
java
private Resource readResource(net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource phoenixResource) { Resource mpxjResource = m_projectFile.addResource(); TimeUnit rateUnits = phoenixResource.getMonetarybase(); if (rateUnits == null) { rateUnits = TimeUnit.HOURS; } // phoenixResource.getMaximum() mpxjResource.setCostPerUse(phoenixResource.getMonetarycostperuse()); mpxjResource.setStandardRate(new Rate(phoenixResource.getMonetaryrate(), rateUnits)); mpxjResource.setStandardRateUnits(rateUnits); mpxjResource.setName(phoenixResource.getName()); mpxjResource.setType(phoenixResource.getType()); mpxjResource.setMaterialLabel(phoenixResource.getUnitslabel()); //phoenixResource.getUnitsperbase() mpxjResource.setGUID(phoenixResource.getUuid()); m_eventManager.fireResourceReadEvent(mpxjResource); return mpxjResource; }
[ "private", "Resource", "readResource", "(", "net", ".", "sf", ".", "mpxj", ".", "phoenix", ".", "schema", ".", "Project", ".", "Storepoints", ".", "Storepoint", ".", "Resources", ".", "Resource", "phoenixResource", ")", "{", "Resource", "mpxjResource", "=", "m_projectFile", ".", "addResource", "(", ")", ";", "TimeUnit", "rateUnits", "=", "phoenixResource", ".", "getMonetarybase", "(", ")", ";", "if", "(", "rateUnits", "==", "null", ")", "{", "rateUnits", "=", "TimeUnit", ".", "HOURS", ";", "}", "// phoenixResource.getMaximum()", "mpxjResource", ".", "setCostPerUse", "(", "phoenixResource", ".", "getMonetarycostperuse", "(", ")", ")", ";", "mpxjResource", ".", "setStandardRate", "(", "new", "Rate", "(", "phoenixResource", ".", "getMonetaryrate", "(", ")", ",", "rateUnits", ")", ")", ";", "mpxjResource", ".", "setStandardRateUnits", "(", "rateUnits", ")", ";", "mpxjResource", ".", "setName", "(", "phoenixResource", ".", "getName", "(", ")", ")", ";", "mpxjResource", ".", "setType", "(", "phoenixResource", ".", "getType", "(", ")", ")", ";", "mpxjResource", ".", "setMaterialLabel", "(", "phoenixResource", ".", "getUnitslabel", "(", ")", ")", ";", "//phoenixResource.getUnitsperbase()", "mpxjResource", ".", "setGUID", "(", "phoenixResource", ".", "getUuid", "(", ")", ")", ";", "m_eventManager", ".", "fireResourceReadEvent", "(", "mpxjResource", ")", ";", "return", "mpxjResource", ";", "}" ]
This method extracts data for a single resource from a Phoenix file. @param phoenixResource resource data @return Resource instance
[ "This", "method", "extracts", "data", "for", "a", "single", "resource", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L288-L311
156,948
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readTasks
private void readTasks(Project phoenixProject, Storepoint storepoint) { processLayouts(phoenixProject); processActivityCodes(storepoint); processActivities(storepoint); updateDates(); }
java
private void readTasks(Project phoenixProject, Storepoint storepoint) { processLayouts(phoenixProject); processActivityCodes(storepoint); processActivities(storepoint); updateDates(); }
[ "private", "void", "readTasks", "(", "Project", "phoenixProject", ",", "Storepoint", "storepoint", ")", "{", "processLayouts", "(", "phoenixProject", ")", ";", "processActivityCodes", "(", "storepoint", ")", ";", "processActivities", "(", "storepoint", ")", ";", "updateDates", "(", ")", ";", "}" ]
Read phases and activities from the Phoenix file to create the task hierarchy. @param phoenixProject all project data @param storepoint storepoint containing current project data
[ "Read", "phases", "and", "activities", "from", "the", "Phoenix", "file", "to", "create", "the", "task", "hierarchy", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L319-L325
156,949
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processActivityCodes
private void processActivityCodes(Storepoint storepoint) { for (Code code : storepoint.getActivityCodes().getCode()) { int sequence = 0; for (Value value : code.getValue()) { UUID uuid = getUUID(value.getUuid(), value.getName()); m_activityCodeValues.put(uuid, value.getName()); m_activityCodeSequence.put(uuid, Integer.valueOf(++sequence)); } } }
java
private void processActivityCodes(Storepoint storepoint) { for (Code code : storepoint.getActivityCodes().getCode()) { int sequence = 0; for (Value value : code.getValue()) { UUID uuid = getUUID(value.getUuid(), value.getName()); m_activityCodeValues.put(uuid, value.getName()); m_activityCodeSequence.put(uuid, Integer.valueOf(++sequence)); } } }
[ "private", "void", "processActivityCodes", "(", "Storepoint", "storepoint", ")", "{", "for", "(", "Code", "code", ":", "storepoint", ".", "getActivityCodes", "(", ")", ".", "getCode", "(", ")", ")", "{", "int", "sequence", "=", "0", ";", "for", "(", "Value", "value", ":", "code", ".", "getValue", "(", ")", ")", "{", "UUID", "uuid", "=", "getUUID", "(", "value", ".", "getUuid", "(", ")", ",", "value", ".", "getName", "(", ")", ")", ";", "m_activityCodeValues", ".", "put", "(", "uuid", ",", "value", ".", "getName", "(", ")", ")", ";", "m_activityCodeSequence", ".", "put", "(", "uuid", ",", "Integer", ".", "valueOf", "(", "++", "sequence", ")", ")", ";", "}", "}", "}" ]
Map from an activity code value UUID to the actual value itself, and its sequence number. @param storepoint storepoint containing current project data
[ "Map", "from", "an", "activity", "code", "value", "UUID", "to", "the", "actual", "value", "itself", "and", "its", "sequence", "number", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L333-L345
156,950
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processLayouts
private void processLayouts(Project phoenixProject) { // // Find the active layout // Layout activeLayout = getActiveLayout(phoenixProject); // // Create a list of the visible codes in the correct order // for (CodeOption option : activeLayout.getCodeOptions().getCodeOption()) { if (option.isShown().booleanValue()) { m_codeSequence.add(getUUID(option.getCodeUuid(), option.getCode())); } } }
java
private void processLayouts(Project phoenixProject) { // // Find the active layout // Layout activeLayout = getActiveLayout(phoenixProject); // // Create a list of the visible codes in the correct order // for (CodeOption option : activeLayout.getCodeOptions().getCodeOption()) { if (option.isShown().booleanValue()) { m_codeSequence.add(getUUID(option.getCodeUuid(), option.getCode())); } } }
[ "private", "void", "processLayouts", "(", "Project", "phoenixProject", ")", "{", "//", "// Find the active layout", "//", "Layout", "activeLayout", "=", "getActiveLayout", "(", "phoenixProject", ")", ";", "//", "// Create a list of the visible codes in the correct order", "//", "for", "(", "CodeOption", "option", ":", "activeLayout", ".", "getCodeOptions", "(", ")", ".", "getCodeOption", "(", ")", ")", "{", "if", "(", "option", ".", "isShown", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "m_codeSequence", ".", "add", "(", "getUUID", "(", "option", ".", "getCodeUuid", "(", ")", ",", "option", ".", "getCode", "(", ")", ")", ")", ";", "}", "}", "}" ]
Find the current layout and extract the activity code order and visibility. @param phoenixProject phoenix project data
[ "Find", "the", "current", "layout", "and", "extract", "the", "activity", "code", "order", "and", "visibility", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L352-L369
156,951
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.getActiveLayout
private Layout getActiveLayout(Project phoenixProject) { // // Start with the first layout we find // Layout activeLayout = phoenixProject.getLayouts().getLayout().get(0); // // If this isn't active, find one which is... and if none are, // we'll just use the first. // if (!activeLayout.isActive().booleanValue()) { for (Layout layout : phoenixProject.getLayouts().getLayout()) { if (layout.isActive().booleanValue()) { activeLayout = layout; break; } } } return activeLayout; }
java
private Layout getActiveLayout(Project phoenixProject) { // // Start with the first layout we find // Layout activeLayout = phoenixProject.getLayouts().getLayout().get(0); // // If this isn't active, find one which is... and if none are, // we'll just use the first. // if (!activeLayout.isActive().booleanValue()) { for (Layout layout : phoenixProject.getLayouts().getLayout()) { if (layout.isActive().booleanValue()) { activeLayout = layout; break; } } } return activeLayout; }
[ "private", "Layout", "getActiveLayout", "(", "Project", "phoenixProject", ")", "{", "//", "// Start with the first layout we find", "//", "Layout", "activeLayout", "=", "phoenixProject", ".", "getLayouts", "(", ")", ".", "getLayout", "(", ")", ".", "get", "(", "0", ")", ";", "//", "// If this isn't active, find one which is... and if none are,", "// we'll just use the first.", "//", "if", "(", "!", "activeLayout", ".", "isActive", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "for", "(", "Layout", "layout", ":", "phoenixProject", ".", "getLayouts", "(", ")", ".", "getLayout", "(", ")", ")", "{", "if", "(", "layout", ".", "isActive", "(", ")", ".", "booleanValue", "(", ")", ")", "{", "activeLayout", "=", "layout", ";", "break", ";", "}", "}", "}", "return", "activeLayout", ";", "}" ]
Find the current active layout. @param phoenixProject phoenix project data @return current active layout
[ "Find", "the", "current", "active", "layout", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L377-L401
156,952
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processActivities
private void processActivities(Storepoint phoenixProject) { final AlphanumComparator comparator = new AlphanumComparator(); List<Activity> activities = phoenixProject.getActivities().getActivity(); Collections.sort(activities, new Comparator<Activity>() { @Override public int compare(Activity o1, Activity o2) { Map<UUID, UUID> codes1 = getActivityCodes(o1); Map<UUID, UUID> codes2 = getActivityCodes(o2); for (UUID code : m_codeSequence) { UUID codeValue1 = codes1.get(code); UUID codeValue2 = codes2.get(code); if (codeValue1 == null || codeValue2 == null) { if (codeValue1 == null && codeValue2 == null) { continue; } if (codeValue1 == null) { return -1; } if (codeValue2 == null) { return 1; } } if (!codeValue1.equals(codeValue2)) { Integer sequence1 = m_activityCodeSequence.get(codeValue1); Integer sequence2 = m_activityCodeSequence.get(codeValue2); return NumberHelper.compare(sequence1, sequence2); } } return comparator.compare(o1.getId(), o2.getId()); } }); for (Activity activity : activities) { processActivity(activity); } }
java
private void processActivities(Storepoint phoenixProject) { final AlphanumComparator comparator = new AlphanumComparator(); List<Activity> activities = phoenixProject.getActivities().getActivity(); Collections.sort(activities, new Comparator<Activity>() { @Override public int compare(Activity o1, Activity o2) { Map<UUID, UUID> codes1 = getActivityCodes(o1); Map<UUID, UUID> codes2 = getActivityCodes(o2); for (UUID code : m_codeSequence) { UUID codeValue1 = codes1.get(code); UUID codeValue2 = codes2.get(code); if (codeValue1 == null || codeValue2 == null) { if (codeValue1 == null && codeValue2 == null) { continue; } if (codeValue1 == null) { return -1; } if (codeValue2 == null) { return 1; } } if (!codeValue1.equals(codeValue2)) { Integer sequence1 = m_activityCodeSequence.get(codeValue1); Integer sequence2 = m_activityCodeSequence.get(codeValue2); return NumberHelper.compare(sequence1, sequence2); } } return comparator.compare(o1.getId(), o2.getId()); } }); for (Activity activity : activities) { processActivity(activity); } }
[ "private", "void", "processActivities", "(", "Storepoint", "phoenixProject", ")", "{", "final", "AlphanumComparator", "comparator", "=", "new", "AlphanumComparator", "(", ")", ";", "List", "<", "Activity", ">", "activities", "=", "phoenixProject", ".", "getActivities", "(", ")", ".", "getActivity", "(", ")", ";", "Collections", ".", "sort", "(", "activities", ",", "new", "Comparator", "<", "Activity", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Activity", "o1", ",", "Activity", "o2", ")", "{", "Map", "<", "UUID", ",", "UUID", ">", "codes1", "=", "getActivityCodes", "(", "o1", ")", ";", "Map", "<", "UUID", ",", "UUID", ">", "codes2", "=", "getActivityCodes", "(", "o2", ")", ";", "for", "(", "UUID", "code", ":", "m_codeSequence", ")", "{", "UUID", "codeValue1", "=", "codes1", ".", "get", "(", "code", ")", ";", "UUID", "codeValue2", "=", "codes2", ".", "get", "(", "code", ")", ";", "if", "(", "codeValue1", "==", "null", "||", "codeValue2", "==", "null", ")", "{", "if", "(", "codeValue1", "==", "null", "&&", "codeValue2", "==", "null", ")", "{", "continue", ";", "}", "if", "(", "codeValue1", "==", "null", ")", "{", "return", "-", "1", ";", "}", "if", "(", "codeValue2", "==", "null", ")", "{", "return", "1", ";", "}", "}", "if", "(", "!", "codeValue1", ".", "equals", "(", "codeValue2", ")", ")", "{", "Integer", "sequence1", "=", "m_activityCodeSequence", ".", "get", "(", "codeValue1", ")", ";", "Integer", "sequence2", "=", "m_activityCodeSequence", ".", "get", "(", "codeValue2", ")", ";", "return", "NumberHelper", ".", "compare", "(", "sequence1", ",", "sequence2", ")", ";", "}", "}", "return", "comparator", ".", "compare", "(", "o1", ".", "getId", "(", ")", ",", "o2", ".", "getId", "(", ")", ")", ";", "}", "}", ")", ";", "for", "(", "Activity", "activity", ":", "activities", ")", "{", "processActivity", "(", "activity", ")", ";", "}", "}" ]
Process the set of activities from the Phoenix file. @param phoenixProject project data
[ "Process", "the", "set", "of", "activities", "from", "the", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L408-L458
156,953
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.processActivity
private void processActivity(Activity activity) { Task task = getParentTask(activity).addTask(); task.setText(1, activity.getId()); task.setActualDuration(activity.getActualDuration()); task.setActualFinish(activity.getActualFinish()); task.setActualStart(activity.getActualStart()); //activity.getBaseunit() //activity.getBilled() //activity.getCalendar() //activity.getCostAccount() task.setCreateDate(activity.getCreationTime()); task.setFinish(activity.getCurrentFinish()); task.setStart(activity.getCurrentStart()); task.setName(activity.getDescription()); task.setDuration(activity.getDurationAtCompletion()); task.setEarlyFinish(activity.getEarlyFinish()); task.setEarlyStart(activity.getEarlyStart()); task.setFreeSlack(activity.getFreeFloat()); task.setLateFinish(activity.getLateFinish()); task.setLateStart(activity.getLateStart()); task.setNotes(activity.getNotes()); task.setBaselineDuration(activity.getOriginalDuration()); //activity.getPathFloat() task.setPhysicalPercentComplete(activity.getPhysicalPercentComplete()); task.setRemainingDuration(activity.getRemainingDuration()); task.setCost(activity.getTotalCost()); task.setTotalSlack(activity.getTotalFloat()); task.setMilestone(activityIsMilestone(activity)); //activity.getUserDefined() task.setGUID(activity.getUuid()); if (task.getMilestone()) { if (activityIsStartMilestone(activity)) { task.setFinish(task.getStart()); } else { task.setStart(task.getFinish()); } } if (task.getActualStart() == null) { task.setPercentageComplete(Integer.valueOf(0)); } else { if (task.getActualFinish() != null) { task.setPercentageComplete(Integer.valueOf(100)); } else { Duration remaining = activity.getRemainingDuration(); Duration total = activity.getDurationAtCompletion(); if (remaining != null && total != null && total.getDuration() != 0) { double percentComplete = ((total.getDuration() - remaining.getDuration()) * 100.0) / total.getDuration(); task.setPercentageComplete(Double.valueOf(percentComplete)); } } } m_activityMap.put(activity.getId(), task); }
java
private void processActivity(Activity activity) { Task task = getParentTask(activity).addTask(); task.setText(1, activity.getId()); task.setActualDuration(activity.getActualDuration()); task.setActualFinish(activity.getActualFinish()); task.setActualStart(activity.getActualStart()); //activity.getBaseunit() //activity.getBilled() //activity.getCalendar() //activity.getCostAccount() task.setCreateDate(activity.getCreationTime()); task.setFinish(activity.getCurrentFinish()); task.setStart(activity.getCurrentStart()); task.setName(activity.getDescription()); task.setDuration(activity.getDurationAtCompletion()); task.setEarlyFinish(activity.getEarlyFinish()); task.setEarlyStart(activity.getEarlyStart()); task.setFreeSlack(activity.getFreeFloat()); task.setLateFinish(activity.getLateFinish()); task.setLateStart(activity.getLateStart()); task.setNotes(activity.getNotes()); task.setBaselineDuration(activity.getOriginalDuration()); //activity.getPathFloat() task.setPhysicalPercentComplete(activity.getPhysicalPercentComplete()); task.setRemainingDuration(activity.getRemainingDuration()); task.setCost(activity.getTotalCost()); task.setTotalSlack(activity.getTotalFloat()); task.setMilestone(activityIsMilestone(activity)); //activity.getUserDefined() task.setGUID(activity.getUuid()); if (task.getMilestone()) { if (activityIsStartMilestone(activity)) { task.setFinish(task.getStart()); } else { task.setStart(task.getFinish()); } } if (task.getActualStart() == null) { task.setPercentageComplete(Integer.valueOf(0)); } else { if (task.getActualFinish() != null) { task.setPercentageComplete(Integer.valueOf(100)); } else { Duration remaining = activity.getRemainingDuration(); Duration total = activity.getDurationAtCompletion(); if (remaining != null && total != null && total.getDuration() != 0) { double percentComplete = ((total.getDuration() - remaining.getDuration()) * 100.0) / total.getDuration(); task.setPercentageComplete(Double.valueOf(percentComplete)); } } } m_activityMap.put(activity.getId(), task); }
[ "private", "void", "processActivity", "(", "Activity", "activity", ")", "{", "Task", "task", "=", "getParentTask", "(", "activity", ")", ".", "addTask", "(", ")", ";", "task", ".", "setText", "(", "1", ",", "activity", ".", "getId", "(", ")", ")", ";", "task", ".", "setActualDuration", "(", "activity", ".", "getActualDuration", "(", ")", ")", ";", "task", ".", "setActualFinish", "(", "activity", ".", "getActualFinish", "(", ")", ")", ";", "task", ".", "setActualStart", "(", "activity", ".", "getActualStart", "(", ")", ")", ";", "//activity.getBaseunit()", "//activity.getBilled()", "//activity.getCalendar()", "//activity.getCostAccount()", "task", ".", "setCreateDate", "(", "activity", ".", "getCreationTime", "(", ")", ")", ";", "task", ".", "setFinish", "(", "activity", ".", "getCurrentFinish", "(", ")", ")", ";", "task", ".", "setStart", "(", "activity", ".", "getCurrentStart", "(", ")", ")", ";", "task", ".", "setName", "(", "activity", ".", "getDescription", "(", ")", ")", ";", "task", ".", "setDuration", "(", "activity", ".", "getDurationAtCompletion", "(", ")", ")", ";", "task", ".", "setEarlyFinish", "(", "activity", ".", "getEarlyFinish", "(", ")", ")", ";", "task", ".", "setEarlyStart", "(", "activity", ".", "getEarlyStart", "(", ")", ")", ";", "task", ".", "setFreeSlack", "(", "activity", ".", "getFreeFloat", "(", ")", ")", ";", "task", ".", "setLateFinish", "(", "activity", ".", "getLateFinish", "(", ")", ")", ";", "task", ".", "setLateStart", "(", "activity", ".", "getLateStart", "(", ")", ")", ";", "task", ".", "setNotes", "(", "activity", ".", "getNotes", "(", ")", ")", ";", "task", ".", "setBaselineDuration", "(", "activity", ".", "getOriginalDuration", "(", ")", ")", ";", "//activity.getPathFloat()", "task", ".", "setPhysicalPercentComplete", "(", "activity", ".", "getPhysicalPercentComplete", "(", ")", ")", ";", "task", ".", "setRemainingDuration", "(", "activity", ".", "getRemainingDuration", "(", ")", ")", ";", "task", ".", "setCost", "(", "activity", ".", "getTotalCost", "(", ")", ")", ";", "task", ".", "setTotalSlack", "(", "activity", ".", "getTotalFloat", "(", ")", ")", ";", "task", ".", "setMilestone", "(", "activityIsMilestone", "(", "activity", ")", ")", ";", "//activity.getUserDefined()", "task", ".", "setGUID", "(", "activity", ".", "getUuid", "(", ")", ")", ";", "if", "(", "task", ".", "getMilestone", "(", ")", ")", "{", "if", "(", "activityIsStartMilestone", "(", "activity", ")", ")", "{", "task", ".", "setFinish", "(", "task", ".", "getStart", "(", ")", ")", ";", "}", "else", "{", "task", ".", "setStart", "(", "task", ".", "getFinish", "(", ")", ")", ";", "}", "}", "if", "(", "task", ".", "getActualStart", "(", ")", "==", "null", ")", "{", "task", ".", "setPercentageComplete", "(", "Integer", ".", "valueOf", "(", "0", ")", ")", ";", "}", "else", "{", "if", "(", "task", ".", "getActualFinish", "(", ")", "!=", "null", ")", "{", "task", ".", "setPercentageComplete", "(", "Integer", ".", "valueOf", "(", "100", ")", ")", ";", "}", "else", "{", "Duration", "remaining", "=", "activity", ".", "getRemainingDuration", "(", ")", ";", "Duration", "total", "=", "activity", ".", "getDurationAtCompletion", "(", ")", ";", "if", "(", "remaining", "!=", "null", "&&", "total", "!=", "null", "&&", "total", ".", "getDuration", "(", ")", "!=", "0", ")", "{", "double", "percentComplete", "=", "(", "(", "total", ".", "getDuration", "(", ")", "-", "remaining", ".", "getDuration", "(", ")", ")", "*", "100.0", ")", "/", "total", ".", "getDuration", "(", ")", ";", "task", ".", "setPercentageComplete", "(", "Double", ".", "valueOf", "(", "percentComplete", ")", ")", ";", "}", "}", "}", "m_activityMap", ".", "put", "(", "activity", ".", "getId", "(", ")", ",", "task", ")", ";", "}" ]
Create a Task instance from a Phoenix activity. @param activity Phoenix activity data
[ "Create", "a", "Task", "instance", "from", "a", "Phoenix", "activity", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L465-L533
156,954
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.activityIsMilestone
private boolean activityIsMilestone(Activity activity) { String type = activity.getType(); return type != null && type.indexOf("Milestone") != -1; }
java
private boolean activityIsMilestone(Activity activity) { String type = activity.getType(); return type != null && type.indexOf("Milestone") != -1; }
[ "private", "boolean", "activityIsMilestone", "(", "Activity", "activity", ")", "{", "String", "type", "=", "activity", ".", "getType", "(", ")", ";", "return", "type", "!=", "null", "&&", "type", ".", "indexOf", "(", "\"Milestone\"", ")", "!=", "-", "1", ";", "}" ]
Returns true if the activity is a milestone. @param activity Phoenix activity @return true if the activity is a milestone
[ "Returns", "true", "if", "the", "activity", "is", "a", "milestone", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L541-L545
156,955
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.activityIsStartMilestone
private boolean activityIsStartMilestone(Activity activity) { String type = activity.getType(); return type != null && type.indexOf("StartMilestone") != -1; }
java
private boolean activityIsStartMilestone(Activity activity) { String type = activity.getType(); return type != null && type.indexOf("StartMilestone") != -1; }
[ "private", "boolean", "activityIsStartMilestone", "(", "Activity", "activity", ")", "{", "String", "type", "=", "activity", ".", "getType", "(", ")", ";", "return", "type", "!=", "null", "&&", "type", ".", "indexOf", "(", "\"StartMilestone\"", ")", "!=", "-", "1", ";", "}" ]
Returns true if the activity is a start milestone. @param activity Phoenix activity @return true if the activity is a milestone
[ "Returns", "true", "if", "the", "activity", "is", "a", "start", "milestone", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L553-L557
156,956
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.getParentTask
private ChildTaskContainer getParentTask(Activity activity) { // // Make a map of activity codes and their values for this activity // Map<UUID, UUID> map = getActivityCodes(activity); // // Work through the activity codes in sequence // ChildTaskContainer parent = m_projectFile; StringBuilder uniqueIdentifier = new StringBuilder(); for (UUID activityCode : m_codeSequence) { UUID activityCodeValue = map.get(activityCode); String activityCodeText = m_activityCodeValues.get(activityCodeValue); if (activityCodeText != null) { if (uniqueIdentifier.length() != 0) { uniqueIdentifier.append('>'); } uniqueIdentifier.append(activityCodeValue.toString()); UUID uuid = UUID.nameUUIDFromBytes(uniqueIdentifier.toString().getBytes()); Task newParent = findChildTaskByUUID(parent, uuid); if (newParent == null) { newParent = parent.addTask(); newParent.setGUID(uuid); newParent.setName(activityCodeText); } parent = newParent; } } return parent; }
java
private ChildTaskContainer getParentTask(Activity activity) { // // Make a map of activity codes and their values for this activity // Map<UUID, UUID> map = getActivityCodes(activity); // // Work through the activity codes in sequence // ChildTaskContainer parent = m_projectFile; StringBuilder uniqueIdentifier = new StringBuilder(); for (UUID activityCode : m_codeSequence) { UUID activityCodeValue = map.get(activityCode); String activityCodeText = m_activityCodeValues.get(activityCodeValue); if (activityCodeText != null) { if (uniqueIdentifier.length() != 0) { uniqueIdentifier.append('>'); } uniqueIdentifier.append(activityCodeValue.toString()); UUID uuid = UUID.nameUUIDFromBytes(uniqueIdentifier.toString().getBytes()); Task newParent = findChildTaskByUUID(parent, uuid); if (newParent == null) { newParent = parent.addTask(); newParent.setGUID(uuid); newParent.setName(activityCodeText); } parent = newParent; } } return parent; }
[ "private", "ChildTaskContainer", "getParentTask", "(", "Activity", "activity", ")", "{", "//", "// Make a map of activity codes and their values for this activity", "//", "Map", "<", "UUID", ",", "UUID", ">", "map", "=", "getActivityCodes", "(", "activity", ")", ";", "//", "// Work through the activity codes in sequence", "//", "ChildTaskContainer", "parent", "=", "m_projectFile", ";", "StringBuilder", "uniqueIdentifier", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "UUID", "activityCode", ":", "m_codeSequence", ")", "{", "UUID", "activityCodeValue", "=", "map", ".", "get", "(", "activityCode", ")", ";", "String", "activityCodeText", "=", "m_activityCodeValues", ".", "get", "(", "activityCodeValue", ")", ";", "if", "(", "activityCodeText", "!=", "null", ")", "{", "if", "(", "uniqueIdentifier", ".", "length", "(", ")", "!=", "0", ")", "{", "uniqueIdentifier", ".", "append", "(", "'", "'", ")", ";", "}", "uniqueIdentifier", ".", "append", "(", "activityCodeValue", ".", "toString", "(", ")", ")", ";", "UUID", "uuid", "=", "UUID", ".", "nameUUIDFromBytes", "(", "uniqueIdentifier", ".", "toString", "(", ")", ".", "getBytes", "(", ")", ")", ";", "Task", "newParent", "=", "findChildTaskByUUID", "(", "parent", ",", "uuid", ")", ";", "if", "(", "newParent", "==", "null", ")", "{", "newParent", "=", "parent", ".", "addTask", "(", ")", ";", "newParent", ".", "setGUID", "(", "uuid", ")", ";", "newParent", ".", "setName", "(", "activityCodeText", ")", ";", "}", "parent", "=", "newParent", ";", "}", "}", "return", "parent", ";", "}" ]
Retrieves the parent task for a Phoenix activity. @param activity Phoenix activity @return parent task
[ "Retrieves", "the", "parent", "task", "for", "a", "Phoenix", "activity", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L565-L600
156,957
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.findChildTaskByUUID
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid) { Task result = null; for (Task task : parent.getChildTasks()) { if (uuid.equals(task.getGUID())) { result = task; break; } } return result; }
java
private Task findChildTaskByUUID(ChildTaskContainer parent, UUID uuid) { Task result = null; for (Task task : parent.getChildTasks()) { if (uuid.equals(task.getGUID())) { result = task; break; } } return result; }
[ "private", "Task", "findChildTaskByUUID", "(", "ChildTaskContainer", "parent", ",", "UUID", "uuid", ")", "{", "Task", "result", "=", "null", ";", "for", "(", "Task", "task", ":", "parent", ".", "getChildTasks", "(", ")", ")", "{", "if", "(", "uuid", ".", "equals", "(", "task", ".", "getGUID", "(", ")", ")", ")", "{", "result", "=", "task", ";", "break", ";", "}", "}", "return", "result", ";", "}" ]
Locates a task within a child task container which matches the supplied UUID. @param parent child task container @param uuid required UUID @return Task instance or null if the task is not found
[ "Locates", "a", "task", "within", "a", "child", "task", "container", "which", "matches", "the", "supplied", "UUID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L609-L623
156,958
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readAssignments
private void readAssignments(Resource mpxjResource, net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res) { for (Assignment assignment : res.getAssignment()) { readAssignment(mpxjResource, assignment); } }
java
private void readAssignments(Resource mpxjResource, net.sf.mpxj.phoenix.schema.Project.Storepoints.Storepoint.Resources.Resource res) { for (Assignment assignment : res.getAssignment()) { readAssignment(mpxjResource, assignment); } }
[ "private", "void", "readAssignments", "(", "Resource", "mpxjResource", ",", "net", ".", "sf", ".", "mpxj", ".", "phoenix", ".", "schema", ".", "Project", ".", "Storepoints", ".", "Storepoint", ".", "Resources", ".", "Resource", "res", ")", "{", "for", "(", "Assignment", "assignment", ":", "res", ".", "getAssignment", "(", ")", ")", "{", "readAssignment", "(", "mpxjResource", ",", "assignment", ")", ";", "}", "}" ]
Reads Phoenix resource assignments. @param mpxjResource MPXJ resource @param res Phoenix resource
[ "Reads", "Phoenix", "resource", "assignments", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L631-L637
156,959
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readAssignment
private void readAssignment(Resource resource, Assignment assignment) { Task task = m_activityMap.get(assignment.getActivity()); if (task != null) { task.addResourceAssignment(resource); } }
java
private void readAssignment(Resource resource, Assignment assignment) { Task task = m_activityMap.get(assignment.getActivity()); if (task != null) { task.addResourceAssignment(resource); } }
[ "private", "void", "readAssignment", "(", "Resource", "resource", ",", "Assignment", "assignment", ")", "{", "Task", "task", "=", "m_activityMap", ".", "get", "(", "assignment", ".", "getActivity", "(", ")", ")", ";", "if", "(", "task", "!=", "null", ")", "{", "task", ".", "addResourceAssignment", "(", "resource", ")", ";", "}", "}" ]
Read a single resource assignment. @param resource MPXJ resource @param assignment Phoenix assignment
[ "Read", "a", "single", "resource", "assignment", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L645-L652
156,960
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readRelationships
private void readRelationships(Storepoint phoenixProject) { for (Relationship relation : phoenixProject.getRelationships().getRelationship()) { readRelation(relation); } }
java
private void readRelationships(Storepoint phoenixProject) { for (Relationship relation : phoenixProject.getRelationships().getRelationship()) { readRelation(relation); } }
[ "private", "void", "readRelationships", "(", "Storepoint", "phoenixProject", ")", "{", "for", "(", "Relationship", "relation", ":", "phoenixProject", ".", "getRelationships", "(", ")", ".", "getRelationship", "(", ")", ")", "{", "readRelation", "(", "relation", ")", ";", "}", "}" ]
Read task relationships from a Phoenix file. @param phoenixProject Phoenix project data
[ "Read", "task", "relationships", "from", "a", "Phoenix", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L659-L665
156,961
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.readRelation
private void readRelation(Relationship relation) { Task predecessor = m_activityMap.get(relation.getPredecessor()); Task successor = m_activityMap.get(relation.getSuccessor()); if (predecessor != null && successor != null) { Duration lag = relation.getLag(); RelationType type = relation.getType(); successor.addPredecessor(predecessor, type, lag); } }
java
private void readRelation(Relationship relation) { Task predecessor = m_activityMap.get(relation.getPredecessor()); Task successor = m_activityMap.get(relation.getSuccessor()); if (predecessor != null && successor != null) { Duration lag = relation.getLag(); RelationType type = relation.getType(); successor.addPredecessor(predecessor, type, lag); } }
[ "private", "void", "readRelation", "(", "Relationship", "relation", ")", "{", "Task", "predecessor", "=", "m_activityMap", ".", "get", "(", "relation", ".", "getPredecessor", "(", ")", ")", ";", "Task", "successor", "=", "m_activityMap", ".", "get", "(", "relation", ".", "getSuccessor", "(", ")", ")", ";", "if", "(", "predecessor", "!=", "null", "&&", "successor", "!=", "null", ")", "{", "Duration", "lag", "=", "relation", ".", "getLag", "(", ")", ";", "RelationType", "type", "=", "relation", ".", "getType", "(", ")", ";", "successor", ".", "addPredecessor", "(", "predecessor", ",", "type", ",", "lag", ")", ";", "}", "}" ]
Read an individual Phoenix task relationship. @param relation Phoenix task relationship
[ "Read", "an", "individual", "Phoenix", "task", "relationship", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L672-L682
156,962
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.getActivityCodes
Map<UUID, UUID> getActivityCodes(Activity activity) { Map<UUID, UUID> map = m_activityCodeCache.get(activity); if (map == null) { map = new HashMap<UUID, UUID>(); m_activityCodeCache.put(activity, map); for (CodeAssignment ca : activity.getCodeAssignment()) { UUID code = getUUID(ca.getCodeUuid(), ca.getCode()); UUID value = getUUID(ca.getValueUuid(), ca.getValue()); map.put(code, value); } } return map; }
java
Map<UUID, UUID> getActivityCodes(Activity activity) { Map<UUID, UUID> map = m_activityCodeCache.get(activity); if (map == null) { map = new HashMap<UUID, UUID>(); m_activityCodeCache.put(activity, map); for (CodeAssignment ca : activity.getCodeAssignment()) { UUID code = getUUID(ca.getCodeUuid(), ca.getCode()); UUID value = getUUID(ca.getValueUuid(), ca.getValue()); map.put(code, value); } } return map; }
[ "Map", "<", "UUID", ",", "UUID", ">", "getActivityCodes", "(", "Activity", "activity", ")", "{", "Map", "<", "UUID", ",", "UUID", ">", "map", "=", "m_activityCodeCache", ".", "get", "(", "activity", ")", ";", "if", "(", "map", "==", "null", ")", "{", "map", "=", "new", "HashMap", "<", "UUID", ",", "UUID", ">", "(", ")", ";", "m_activityCodeCache", ".", "put", "(", "activity", ",", "map", ")", ";", "for", "(", "CodeAssignment", "ca", ":", "activity", ".", "getCodeAssignment", "(", ")", ")", "{", "UUID", "code", "=", "getUUID", "(", "ca", ".", "getCodeUuid", "(", ")", ",", "ca", ".", "getCode", "(", ")", ")", ";", "UUID", "value", "=", "getUUID", "(", "ca", ".", "getValueUuid", "(", ")", ",", "ca", ".", "getValue", "(", ")", ")", ";", "map", ".", "put", "(", "code", ",", "value", ")", ";", "}", "}", "return", "map", ";", "}" ]
For a given activity, retrieve a map of the activity code values which have been assigned to it. @param activity target activity @return map of activity code value UUIDs
[ "For", "a", "given", "activity", "retrieve", "a", "map", "of", "the", "activity", "code", "values", "which", "have", "been", "assigned", "to", "it", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L690-L705
156,963
joniles/mpxj
src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java
PhoenixReader.getCurrentStorepoint
private Storepoint getCurrentStorepoint(Project phoenixProject) { List<Storepoint> storepoints = phoenixProject.getStorepoints().getStorepoint(); Collections.sort(storepoints, new Comparator<Storepoint>() { @Override public int compare(Storepoint o1, Storepoint o2) { return DateHelper.compare(o2.getCreationTime(), o1.getCreationTime()); } }); return storepoints.get(0); }
java
private Storepoint getCurrentStorepoint(Project phoenixProject) { List<Storepoint> storepoints = phoenixProject.getStorepoints().getStorepoint(); Collections.sort(storepoints, new Comparator<Storepoint>() { @Override public int compare(Storepoint o1, Storepoint o2) { return DateHelper.compare(o2.getCreationTime(), o1.getCreationTime()); } }); return storepoints.get(0); }
[ "private", "Storepoint", "getCurrentStorepoint", "(", "Project", "phoenixProject", ")", "{", "List", "<", "Storepoint", ">", "storepoints", "=", "phoenixProject", ".", "getStorepoints", "(", ")", ".", "getStorepoint", "(", ")", ";", "Collections", ".", "sort", "(", "storepoints", ",", "new", "Comparator", "<", "Storepoint", ">", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Storepoint", "o1", ",", "Storepoint", "o2", ")", "{", "return", "DateHelper", ".", "compare", "(", "o2", ".", "getCreationTime", "(", ")", ",", "o1", ".", "getCreationTime", "(", ")", ")", ";", "}", "}", ")", ";", "return", "storepoints", ".", "get", "(", "0", ")", ";", "}" ]
Retrieve the most recent storepoint. @param phoenixProject project data @return Storepoint instance
[ "Retrieve", "the", "most", "recent", "storepoint", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/phoenix/PhoenixReader.java#L713-L724
156,964
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/TableReader.java
TableReader.read
public TableReader read() throws IOException { int tableHeader = m_stream.readInt(); if (tableHeader != 0x39AF547A) { throw new IllegalArgumentException("Unexpected file format"); } int recordCount = m_stream.readInt(); for (int loop = 0; loop < recordCount; loop++) { int rowMagicNumber = m_stream.readInt(); if (rowMagicNumber != rowMagicNumber()) { throw new IllegalArgumentException("Unexpected file format"); } // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); if (hasUUID()) { readUUID(m_stream, map); } readRow(m_stream, map); SynchroLogger.log("READER", getClass(), map); m_rows.add(new MapRow(map)); } int tableTrailer = m_stream.readInt(); if (tableTrailer != 0x6F99E416) { throw new IllegalArgumentException("Unexpected file format"); } postTrailer(m_stream); return this; }
java
public TableReader read() throws IOException { int tableHeader = m_stream.readInt(); if (tableHeader != 0x39AF547A) { throw new IllegalArgumentException("Unexpected file format"); } int recordCount = m_stream.readInt(); for (int loop = 0; loop < recordCount; loop++) { int rowMagicNumber = m_stream.readInt(); if (rowMagicNumber != rowMagicNumber()) { throw new IllegalArgumentException("Unexpected file format"); } // We use a LinkedHashMap to preserve insertion order in iteration // Useful when debugging the file format. Map<String, Object> map = new LinkedHashMap<String, Object>(); if (hasUUID()) { readUUID(m_stream, map); } readRow(m_stream, map); SynchroLogger.log("READER", getClass(), map); m_rows.add(new MapRow(map)); } int tableTrailer = m_stream.readInt(); if (tableTrailer != 0x6F99E416) { throw new IllegalArgumentException("Unexpected file format"); } postTrailer(m_stream); return this; }
[ "public", "TableReader", "read", "(", ")", "throws", "IOException", "{", "int", "tableHeader", "=", "m_stream", ".", "readInt", "(", ")", ";", "if", "(", "tableHeader", "!=", "0x39AF547A", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected file format\"", ")", ";", "}", "int", "recordCount", "=", "m_stream", ".", "readInt", "(", ")", ";", "for", "(", "int", "loop", "=", "0", ";", "loop", "<", "recordCount", ";", "loop", "++", ")", "{", "int", "rowMagicNumber", "=", "m_stream", ".", "readInt", "(", ")", ";", "if", "(", "rowMagicNumber", "!=", "rowMagicNumber", "(", ")", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected file format\"", ")", ";", "}", "// We use a LinkedHashMap to preserve insertion order in iteration", "// Useful when debugging the file format.", "Map", "<", "String", ",", "Object", ">", "map", "=", "new", "LinkedHashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "if", "(", "hasUUID", "(", ")", ")", "{", "readUUID", "(", "m_stream", ",", "map", ")", ";", "}", "readRow", "(", "m_stream", ",", "map", ")", ";", "SynchroLogger", ".", "log", "(", "\"READER\"", ",", "getClass", "(", ")", ",", "map", ")", ";", "m_rows", ".", "add", "(", "new", "MapRow", "(", "map", ")", ")", ";", "}", "int", "tableTrailer", "=", "m_stream", ".", "readInt", "(", ")", ";", "if", "(", "tableTrailer", "!=", "0x6F99E416", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"Unexpected file format\"", ")", ";", "}", "postTrailer", "(", "m_stream", ")", ";", "return", "this", ";", "}" ]
Read data from the table. Return a reference to the current instance to allow method chaining. @return reader instance
[ "Read", "data", "from", "the", "table", ".", "Return", "a", "reference", "to", "the", "current", "instance", "to", "allow", "method", "chaining", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/TableReader.java#L63-L105
156,965
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/TableReader.java
TableReader.readUUID
protected void readUUID(StreamReader stream, Map<String, Object> map) throws IOException { int unknown0Size = stream.getMajorVersion() > 5 ? 8 : 16; map.put("UNKNOWN0", stream.readBytes(unknown0Size)); map.put("UUID", stream.readUUID()); }
java
protected void readUUID(StreamReader stream, Map<String, Object> map) throws IOException { int unknown0Size = stream.getMajorVersion() > 5 ? 8 : 16; map.put("UNKNOWN0", stream.readBytes(unknown0Size)); map.put("UUID", stream.readUUID()); }
[ "protected", "void", "readUUID", "(", "StreamReader", "stream", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "throws", "IOException", "{", "int", "unknown0Size", "=", "stream", ".", "getMajorVersion", "(", ")", ">", "5", "?", "8", ":", "16", ";", "map", ".", "put", "(", "\"UNKNOWN0\"", ",", "stream", ".", "readBytes", "(", "unknown0Size", ")", ")", ";", "map", ".", "put", "(", "\"UUID\"", ",", "stream", ".", "readUUID", "(", ")", ")", ";", "}" ]
Read the optional row header and UUID. @param stream input stream @param map row map
[ "Read", "the", "optional", "row", "header", "and", "UUID", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/TableReader.java#L124-L129
156,966
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/common/AbstractShortColumn.java
AbstractShortColumn.readShort
protected int readShort(int offset, byte[] data) { int result = 0; int i = offset + m_offset; for (int shiftBy = 0; shiftBy < 16; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
java
protected int readShort(int offset, byte[] data) { int result = 0; int i = offset + m_offset; for (int shiftBy = 0; shiftBy < 16; shiftBy += 8) { result |= ((data[i] & 0xff)) << shiftBy; ++i; } return result; }
[ "protected", "int", "readShort", "(", "int", "offset", ",", "byte", "[", "]", "data", ")", "{", "int", "result", "=", "0", ";", "int", "i", "=", "offset", "+", "m_offset", ";", "for", "(", "int", "shiftBy", "=", "0", ";", "shiftBy", "<", "16", ";", "shiftBy", "+=", "8", ")", "{", "result", "|=", "(", "(", "data", "[", "i", "]", "&", "0xff", ")", ")", "<<", "shiftBy", ";", "++", "i", ";", "}", "return", "result", ";", "}" ]
Read a two byte integer from the data. @param offset current offset into data block @param data data block @return int value
[ "Read", "a", "two", "byte", "integer", "from", "the", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/common/AbstractShortColumn.java#L49-L59
156,967
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.loadObject
public void loadObject(Object object, Set<String> excludedMethods) { m_model.setTableModel(createTableModel(object, excludedMethods)); }
java
public void loadObject(Object object, Set<String> excludedMethods) { m_model.setTableModel(createTableModel(object, excludedMethods)); }
[ "public", "void", "loadObject", "(", "Object", "object", ",", "Set", "<", "String", ">", "excludedMethods", ")", "{", "m_model", ".", "setTableModel", "(", "createTableModel", "(", "object", ",", "excludedMethods", ")", ")", ";", "}" ]
Populate the model with the object's properties. @param object object whose properties we're displaying @param excludedMethods method names to exclude
[ "Populate", "the", "model", "with", "the", "object", "s", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L62-L65
156,968
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.createTableModel
private TableModel createTableModel(Object object, Set<String> excludedMethods) { List<Method> methods = new ArrayList<Method>(); for (Method method : object.getClass().getMethods()) { if ((method.getParameterTypes().length == 0) || (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == int.class)) { String name = method.getName(); if (!excludedMethods.contains(name) && (name.startsWith("get") || name.startsWith("is"))) { methods.add(method); } } } Map<String, String> map = new TreeMap<String, String>(); for (Method method : methods) { if (method.getParameterTypes().length == 0) { getSingleValue(method, object, map); } else { getMultipleValues(method, object, map); } } String[] headings = new String[] { "Property", "Value" }; String[][] data = new String[map.size()][2]; int rowIndex = 0; for (Entry<String, String> entry : map.entrySet()) { data[rowIndex][0] = entry.getKey(); data[rowIndex][1] = entry.getValue(); ++rowIndex; } TableModel tableModel = new DefaultTableModel(data, headings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; return tableModel; }
java
private TableModel createTableModel(Object object, Set<String> excludedMethods) { List<Method> methods = new ArrayList<Method>(); for (Method method : object.getClass().getMethods()) { if ((method.getParameterTypes().length == 0) || (method.getParameterTypes().length == 1 && method.getParameterTypes()[0] == int.class)) { String name = method.getName(); if (!excludedMethods.contains(name) && (name.startsWith("get") || name.startsWith("is"))) { methods.add(method); } } } Map<String, String> map = new TreeMap<String, String>(); for (Method method : methods) { if (method.getParameterTypes().length == 0) { getSingleValue(method, object, map); } else { getMultipleValues(method, object, map); } } String[] headings = new String[] { "Property", "Value" }; String[][] data = new String[map.size()][2]; int rowIndex = 0; for (Entry<String, String> entry : map.entrySet()) { data[rowIndex][0] = entry.getKey(); data[rowIndex][1] = entry.getValue(); ++rowIndex; } TableModel tableModel = new DefaultTableModel(data, headings) { @Override public boolean isCellEditable(int r, int c) { return false; } }; return tableModel; }
[ "private", "TableModel", "createTableModel", "(", "Object", "object", ",", "Set", "<", "String", ">", "excludedMethods", ")", "{", "List", "<", "Method", ">", "methods", "=", "new", "ArrayList", "<", "Method", ">", "(", ")", ";", "for", "(", "Method", "method", ":", "object", ".", "getClass", "(", ")", ".", "getMethods", "(", ")", ")", "{", "if", "(", "(", "method", ".", "getParameterTypes", "(", ")", ".", "length", "==", "0", ")", "||", "(", "method", ".", "getParameterTypes", "(", ")", ".", "length", "==", "1", "&&", "method", ".", "getParameterTypes", "(", ")", "[", "0", "]", "==", "int", ".", "class", ")", ")", "{", "String", "name", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "!", "excludedMethods", ".", "contains", "(", "name", ")", "&&", "(", "name", ".", "startsWith", "(", "\"get\"", ")", "||", "name", ".", "startsWith", "(", "\"is\"", ")", ")", ")", "{", "methods", ".", "add", "(", "method", ")", ";", "}", "}", "}", "Map", "<", "String", ",", "String", ">", "map", "=", "new", "TreeMap", "<", "String", ",", "String", ">", "(", ")", ";", "for", "(", "Method", "method", ":", "methods", ")", "{", "if", "(", "method", ".", "getParameterTypes", "(", ")", ".", "length", "==", "0", ")", "{", "getSingleValue", "(", "method", ",", "object", ",", "map", ")", ";", "}", "else", "{", "getMultipleValues", "(", "method", ",", "object", ",", "map", ")", ";", "}", "}", "String", "[", "]", "headings", "=", "new", "String", "[", "]", "{", "\"Property\"", ",", "\"Value\"", "}", ";", "String", "[", "]", "[", "]", "data", "=", "new", "String", "[", "map", ".", "size", "(", ")", "]", "[", "2", "]", ";", "int", "rowIndex", "=", "0", ";", "for", "(", "Entry", "<", "String", ",", "String", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "data", "[", "rowIndex", "]", "[", "0", "]", "=", "entry", ".", "getKey", "(", ")", ";", "data", "[", "rowIndex", "]", "[", "1", "]", "=", "entry", ".", "getValue", "(", ")", ";", "++", "rowIndex", ";", "}", "TableModel", "tableModel", "=", "new", "DefaultTableModel", "(", "data", ",", "headings", ")", "{", "@", "Override", "public", "boolean", "isCellEditable", "(", "int", "r", ",", "int", "c", ")", "{", "return", "false", ";", "}", "}", ";", "return", "tableModel", ";", "}" ]
Create a table model from an object's properties. @param object target object @param excludedMethods method names to exclude @return table model
[ "Create", "a", "table", "model", "from", "an", "object", "s", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L74-L126
156,969
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.filterValue
private Object filterValue(Object value) { if (value instanceof Boolean && !((Boolean) value).booleanValue()) { value = null; } if (value instanceof String && ((String) value).isEmpty()) { value = null; } if (value instanceof Double && ((Double) value).doubleValue() == 0.0) { value = null; } if (value instanceof Integer && ((Integer) value).intValue() == 0) { value = null; } if (value instanceof Duration && ((Duration) value).getDuration() == 0.0) { value = null; } return value; }
java
private Object filterValue(Object value) { if (value instanceof Boolean && !((Boolean) value).booleanValue()) { value = null; } if (value instanceof String && ((String) value).isEmpty()) { value = null; } if (value instanceof Double && ((Double) value).doubleValue() == 0.0) { value = null; } if (value instanceof Integer && ((Integer) value).intValue() == 0) { value = null; } if (value instanceof Duration && ((Duration) value).getDuration() == 0.0) { value = null; } return value; }
[ "private", "Object", "filterValue", "(", "Object", "value", ")", "{", "if", "(", "value", "instanceof", "Boolean", "&&", "!", "(", "(", "Boolean", ")", "value", ")", ".", "booleanValue", "(", ")", ")", "{", "value", "=", "null", ";", "}", "if", "(", "value", "instanceof", "String", "&&", "(", "(", "String", ")", "value", ")", ".", "isEmpty", "(", ")", ")", "{", "value", "=", "null", ";", "}", "if", "(", "value", "instanceof", "Double", "&&", "(", "(", "Double", ")", "value", ")", ".", "doubleValue", "(", ")", "==", "0.0", ")", "{", "value", "=", "null", ";", "}", "if", "(", "value", "instanceof", "Integer", "&&", "(", "(", "Integer", ")", "value", ")", ".", "intValue", "(", ")", "==", "0", ")", "{", "value", "=", "null", ";", "}", "if", "(", "value", "instanceof", "Duration", "&&", "(", "(", "Duration", ")", "value", ")", ".", "getDuration", "(", ")", "==", "0.0", ")", "{", "value", "=", "null", ";", "}", "return", "value", ";", "}" ]
Replace default values will null, allowing them to be ignored. @param value value to test @return filtered value
[ "Replace", "default", "values", "will", "null", "allowing", "them", "to", "be", "ignored", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L134-L158
156,970
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.getSingleValue
private void getSingleValue(Method method, Object object, Map<String, String> map) { Object value; try { value = filterValue(method.invoke(object)); } catch (Exception ex) { value = ex.toString(); } if (value != null) { map.put(getPropertyName(method), String.valueOf(value)); } }
java
private void getSingleValue(Method method, Object object, Map<String, String> map) { Object value; try { value = filterValue(method.invoke(object)); } catch (Exception ex) { value = ex.toString(); } if (value != null) { map.put(getPropertyName(method), String.valueOf(value)); } }
[ "private", "void", "getSingleValue", "(", "Method", "method", ",", "Object", "object", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "Object", "value", ";", "try", "{", "value", "=", "filterValue", "(", "method", ".", "invoke", "(", "object", ")", ")", ";", "}", "catch", "(", "Exception", "ex", ")", "{", "value", "=", "ex", ".", "toString", "(", ")", ";", "}", "if", "(", "value", "!=", "null", ")", "{", "map", ".", "put", "(", "getPropertyName", "(", "method", ")", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}", "}" ]
Retrieve a single value property. @param method method definition @param object target object @param map parameter values
[ "Retrieve", "a", "single", "value", "property", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L167-L183
156,971
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.getMultipleValues
private void getMultipleValues(Method method, Object object, Map<String, String> map) { try { int index = 1; while (true) { Object value = filterValue(method.invoke(object, Integer.valueOf(index))); if (value != null) { map.put(getPropertyName(method, index), String.valueOf(value)); } ++index; } } catch (Exception ex) { // Reached the end of the valid indexes } }
java
private void getMultipleValues(Method method, Object object, Map<String, String> map) { try { int index = 1; while (true) { Object value = filterValue(method.invoke(object, Integer.valueOf(index))); if (value != null) { map.put(getPropertyName(method, index), String.valueOf(value)); } ++index; } } catch (Exception ex) { // Reached the end of the valid indexes } }
[ "private", "void", "getMultipleValues", "(", "Method", "method", ",", "Object", "object", ",", "Map", "<", "String", ",", "String", ">", "map", ")", "{", "try", "{", "int", "index", "=", "1", ";", "while", "(", "true", ")", "{", "Object", "value", "=", "filterValue", "(", "method", ".", "invoke", "(", "object", ",", "Integer", ".", "valueOf", "(", "index", ")", ")", ")", ";", "if", "(", "value", "!=", "null", ")", "{", "map", ".", "put", "(", "getPropertyName", "(", "method", ",", "index", ")", ",", "String", ".", "valueOf", "(", "value", ")", ")", ";", "}", "++", "index", ";", "}", "}", "catch", "(", "Exception", "ex", ")", "{", "// Reached the end of the valid indexes", "}", "}" ]
Retrieve multiple properties. @param method method definition @param object target object @param map parameter values
[ "Retrieve", "multiple", "properties", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L192-L211
156,972
joniles/mpxj
src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java
ObjectPropertiesController.getPropertyName
private String getPropertyName(Method method) { String result = method.getName(); if (result.startsWith("get")) { result = result.substring(3); } return result; }
java
private String getPropertyName(Method method) { String result = method.getName(); if (result.startsWith("get")) { result = result.substring(3); } return result; }
[ "private", "String", "getPropertyName", "(", "Method", "method", ")", "{", "String", "result", "=", "method", ".", "getName", "(", ")", ";", "if", "(", "result", ".", "startsWith", "(", "\"get\"", ")", ")", "{", "result", "=", "result", ".", "substring", "(", "3", ")", ";", "}", "return", "result", ";", "}" ]
Convert a method name into a property name. @param method target method @return property name
[ "Convert", "a", "method", "name", "into", "a", "property", "name", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/ObjectPropertiesController.java#L219-L227
156,973
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXJDateFormat.java
MPXJDateFormat.setLocale
public void setLocale(Locale locale) { List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>(); for (SimpleDateFormat format : m_formats) { formats.add(new SimpleDateFormat(format.toPattern(), locale)); } m_formats = formats.toArray(new SimpleDateFormat[formats.size()]); }
java
public void setLocale(Locale locale) { List<SimpleDateFormat> formats = new ArrayList<SimpleDateFormat>(); for (SimpleDateFormat format : m_formats) { formats.add(new SimpleDateFormat(format.toPattern(), locale)); } m_formats = formats.toArray(new SimpleDateFormat[formats.size()]); }
[ "public", "void", "setLocale", "(", "Locale", "locale", ")", "{", "List", "<", "SimpleDateFormat", ">", "formats", "=", "new", "ArrayList", "<", "SimpleDateFormat", ">", "(", ")", ";", "for", "(", "SimpleDateFormat", "format", ":", "m_formats", ")", "{", "formats", ".", "add", "(", "new", "SimpleDateFormat", "(", "format", ".", "toPattern", "(", ")", ",", "locale", ")", ")", ";", "}", "m_formats", "=", "formats", ".", "toArray", "(", "new", "SimpleDateFormat", "[", "formats", ".", "size", "(", ")", "]", ")", ";", "}" ]
This method is called when the locale of the parent file is updated. It resets the locale specific date attributes to the default values for the new locale. @param locale new locale
[ "This", "method", "is", "called", "when", "the", "locale", "of", "the", "parent", "file", "is", "updated", ".", "It", "resets", "the", "locale", "specific", "date", "attributes", "to", "the", "default", "values", "for", "the", "new", "locale", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXJDateFormat.java#L63-L72
156,974
joniles/mpxj
src/main/java/net/sf/mpxj/primavera/p3/DatabaseReader.java
DatabaseReader.process
public Map<String, Table> process(File directory, String prefix) throws IOException { String filePrefix = prefix.toUpperCase(); Map<String, Table> tables = new HashMap<String, Table>(); File[] files = directory.listFiles(); if (files != null) { for (File file : files) { String name = file.getName().toUpperCase(); if (!name.startsWith(filePrefix)) { continue; } int typeIndex = name.lastIndexOf('.') - 3; String type = name.substring(typeIndex, typeIndex + 3); TableDefinition definition = TABLE_DEFINITIONS.get(type); if (definition != null) { Table table = new Table(); TableReader reader = new TableReader(definition); reader.read(file, table); tables.put(type, table); //dumpCSV(type, definition, table); } } } return tables; }
java
public Map<String, Table> process(File directory, String prefix) throws IOException { String filePrefix = prefix.toUpperCase(); Map<String, Table> tables = new HashMap<String, Table>(); File[] files = directory.listFiles(); if (files != null) { for (File file : files) { String name = file.getName().toUpperCase(); if (!name.startsWith(filePrefix)) { continue; } int typeIndex = name.lastIndexOf('.') - 3; String type = name.substring(typeIndex, typeIndex + 3); TableDefinition definition = TABLE_DEFINITIONS.get(type); if (definition != null) { Table table = new Table(); TableReader reader = new TableReader(definition); reader.read(file, table); tables.put(type, table); //dumpCSV(type, definition, table); } } } return tables; }
[ "public", "Map", "<", "String", ",", "Table", ">", "process", "(", "File", "directory", ",", "String", "prefix", ")", "throws", "IOException", "{", "String", "filePrefix", "=", "prefix", ".", "toUpperCase", "(", ")", ";", "Map", "<", "String", ",", "Table", ">", "tables", "=", "new", "HashMap", "<", "String", ",", "Table", ">", "(", ")", ";", "File", "[", "]", "files", "=", "directory", ".", "listFiles", "(", ")", ";", "if", "(", "files", "!=", "null", ")", "{", "for", "(", "File", "file", ":", "files", ")", "{", "String", "name", "=", "file", ".", "getName", "(", ")", ".", "toUpperCase", "(", ")", ";", "if", "(", "!", "name", ".", "startsWith", "(", "filePrefix", ")", ")", "{", "continue", ";", "}", "int", "typeIndex", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", "-", "3", ";", "String", "type", "=", "name", ".", "substring", "(", "typeIndex", ",", "typeIndex", "+", "3", ")", ";", "TableDefinition", "definition", "=", "TABLE_DEFINITIONS", ".", "get", "(", "type", ")", ";", "if", "(", "definition", "!=", "null", ")", "{", "Table", "table", "=", "new", "Table", "(", ")", ";", "TableReader", "reader", "=", "new", "TableReader", "(", "definition", ")", ";", "reader", ".", "read", "(", "file", ",", "table", ")", ";", "tables", ".", "put", "(", "type", ",", "table", ")", ";", "//dumpCSV(type, definition, table);", "}", "}", "}", "return", "tables", ";", "}" ]
Main entry point. Reads a directory containing a P3 Btrieve database files and returns a map of table names and table content. @param directory directory containing the database @param prefix file name prefix used to identify files from the same database @return Map of table names to table data
[ "Main", "entry", "point", ".", "Reads", "a", "directory", "containing", "a", "P3", "Btrieve", "database", "files", "and", "returns", "a", "map", "of", "table", "names", "and", "table", "content", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/p3/DatabaseReader.java#L55-L84
156,975
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroLogger.java
SynchroLogger.openLogFile
public static void openLogFile() throws IOException { if (LOG_FILE != null) { System.out.println("SynchroLogger Configured"); LOG = new PrintWriter(new FileWriter(LOG_FILE)); } }
java
public static void openLogFile() throws IOException { if (LOG_FILE != null) { System.out.println("SynchroLogger Configured"); LOG = new PrintWriter(new FileWriter(LOG_FILE)); } }
[ "public", "static", "void", "openLogFile", "(", ")", "throws", "IOException", "{", "if", "(", "LOG_FILE", "!=", "null", ")", "{", "System", ".", "out", ".", "println", "(", "\"SynchroLogger Configured\"", ")", ";", "LOG", "=", "new", "PrintWriter", "(", "new", "FileWriter", "(", "LOG_FILE", ")", ")", ";", "}", "}" ]
Open the log file for writing.
[ "Open", "the", "log", "file", "for", "writing", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroLogger.java#L60-L67
156,976
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroLogger.java
SynchroLogger.log
public static void log(String label, byte[] data) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(ByteArrayHelper.hexdump(data, true)); LOG.flush(); } }
java
public static void log(String label, byte[] data) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(ByteArrayHelper.hexdump(data, true)); LOG.flush(); } }
[ "public", "static", "void", "log", "(", "String", "label", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "LOG", "!=", "null", ")", "{", "LOG", ".", "write", "(", "label", ")", ";", "LOG", ".", "write", "(", "\": \"", ")", ";", "LOG", ".", "println", "(", "ByteArrayHelper", ".", "hexdump", "(", "data", ",", "true", ")", ")", ";", "LOG", ".", "flush", "(", ")", ";", "}", "}" ]
Log a byte array. @param label label text @param data byte array
[ "Log", "a", "byte", "array", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroLogger.java#L87-L96
156,977
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroLogger.java
SynchroLogger.log
public static void log(String label, String data) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(data); LOG.flush(); } }
java
public static void log(String label, String data) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(data); LOG.flush(); } }
[ "public", "static", "void", "log", "(", "String", "label", ",", "String", "data", ")", "{", "if", "(", "LOG", "!=", "null", ")", "{", "LOG", ".", "write", "(", "label", ")", ";", "LOG", ".", "write", "(", "\": \"", ")", ";", "LOG", ".", "println", "(", "data", ")", ";", "LOG", ".", "flush", "(", ")", ";", "}", "}" ]
Log a string. @param label label text @param data string data
[ "Log", "a", "string", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroLogger.java#L104-L113
156,978
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroLogger.java
SynchroLogger.log
public static void log(byte[] data) { if (LOG != null) { LOG.println(ByteArrayHelper.hexdump(data, true, 16, "")); LOG.flush(); } }
java
public static void log(byte[] data) { if (LOG != null) { LOG.println(ByteArrayHelper.hexdump(data, true, 16, "")); LOG.flush(); } }
[ "public", "static", "void", "log", "(", "byte", "[", "]", "data", ")", "{", "if", "(", "LOG", "!=", "null", ")", "{", "LOG", ".", "println", "(", "ByteArrayHelper", ".", "hexdump", "(", "data", ",", "true", ",", "16", ",", "\"\"", ")", ")", ";", "LOG", ".", "flush", "(", ")", ";", "}", "}" ]
Log a byte array as a hex dump. @param data byte array
[ "Log", "a", "byte", "array", "as", "a", "hex", "dump", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroLogger.java#L137-L144
156,979
joniles/mpxj
src/main/java/net/sf/mpxj/synchro/SynchroLogger.java
SynchroLogger.log
public static void log(String label, Class<?> klass, Map<String, Object> map) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(klass.getSimpleName()); for (Map.Entry<String, Object> entry : map.entrySet()) { LOG.println(entry.getKey() + ": " + entry.getValue()); } LOG.println(); LOG.flush(); } }
java
public static void log(String label, Class<?> klass, Map<String, Object> map) { if (LOG != null) { LOG.write(label); LOG.write(": "); LOG.println(klass.getSimpleName()); for (Map.Entry<String, Object> entry : map.entrySet()) { LOG.println(entry.getKey() + ": " + entry.getValue()); } LOG.println(); LOG.flush(); } }
[ "public", "static", "void", "log", "(", "String", "label", ",", "Class", "<", "?", ">", "klass", ",", "Map", "<", "String", ",", "Object", ">", "map", ")", "{", "if", "(", "LOG", "!=", "null", ")", "{", "LOG", ".", "write", "(", "label", ")", ";", "LOG", ".", "write", "(", "\": \"", ")", ";", "LOG", ".", "println", "(", "klass", ".", "getSimpleName", "(", ")", ")", ";", "for", "(", "Map", ".", "Entry", "<", "String", ",", "Object", ">", "entry", ":", "map", ".", "entrySet", "(", ")", ")", "{", "LOG", ".", "println", "(", "entry", ".", "getKey", "(", ")", "+", "\": \"", "+", "entry", ".", "getValue", "(", ")", ")", ";", "}", "LOG", ".", "println", "(", ")", ";", "LOG", ".", "flush", "(", ")", ";", "}", "}" ]
Log table contents. @param label label text @param klass reader class name @param map table data
[ "Log", "table", "contents", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/synchro/SynchroLogger.java#L153-L168
156,980
joniles/mpxj
src/main/java/net/sf/mpxj/mpp/MppBitFlag.java
MppBitFlag.setValue
public void setValue(FieldContainer container, byte[] data) { if (data != null) { container.set(m_type, ((MPPUtility.getInt(data, m_offset) & m_mask) == 0) ? m_zeroValue : m_nonZeroValue); } }
java
public void setValue(FieldContainer container, byte[] data) { if (data != null) { container.set(m_type, ((MPPUtility.getInt(data, m_offset) & m_mask) == 0) ? m_zeroValue : m_nonZeroValue); } }
[ "public", "void", "setValue", "(", "FieldContainer", "container", ",", "byte", "[", "]", "data", ")", "{", "if", "(", "data", "!=", "null", ")", "{", "container", ".", "set", "(", "m_type", ",", "(", "(", "MPPUtility", ".", "getInt", "(", "data", ",", "m_offset", ")", "&", "m_mask", ")", "==", "0", ")", "?", "m_zeroValue", ":", "m_nonZeroValue", ")", ";", "}", "}" ]
Extracts the value of this bit flag from the supplied byte array and sets the value in the supplied container. @param container container @param data byte array
[ "Extracts", "the", "value", "of", "this", "bit", "flag", "from", "the", "supplied", "byte", "array", "and", "sets", "the", "value", "in", "the", "supplied", "container", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MppBitFlag.java#L37-L43
156,981
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/AbstractColumn.java
AbstractColumn.setFieldType
private void setFieldType(FastTrackTableType tableType) { switch (tableType) { case ACTBARS: { m_type = ActBarField.getInstance(m_header.getColumnType()); break; } case ACTIVITIES: { m_type = ActivityField.getInstance(m_header.getColumnType()); break; } case RESOURCES: { m_type = ResourceField.getInstance(m_header.getColumnType()); break; } } }
java
private void setFieldType(FastTrackTableType tableType) { switch (tableType) { case ACTBARS: { m_type = ActBarField.getInstance(m_header.getColumnType()); break; } case ACTIVITIES: { m_type = ActivityField.getInstance(m_header.getColumnType()); break; } case RESOURCES: { m_type = ResourceField.getInstance(m_header.getColumnType()); break; } } }
[ "private", "void", "setFieldType", "(", "FastTrackTableType", "tableType", ")", "{", "switch", "(", "tableType", ")", "{", "case", "ACTBARS", ":", "{", "m_type", "=", "ActBarField", ".", "getInstance", "(", "m_header", ".", "getColumnType", "(", ")", ")", ";", "break", ";", "}", "case", "ACTIVITIES", ":", "{", "m_type", "=", "ActivityField", ".", "getInstance", "(", "m_header", ".", "getColumnType", "(", ")", ")", ";", "break", ";", "}", "case", "RESOURCES", ":", "{", "m_type", "=", "ResourceField", ".", "getInstance", "(", "m_header", ".", "getColumnType", "(", ")", ")", ";", "break", ";", "}", "}", "}" ]
Set the enum representing the type of this column. @param tableType type of table to which this column belongs
[ "Set", "the", "enum", "representing", "the", "type", "of", "this", "column", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/AbstractColumn.java#L107-L127
156,982
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.process
public void process(File file) throws Exception { openLogFile(); int blockIndex = 0; int length = (int) file.length(); m_buffer = new byte[length]; FileInputStream is = new FileInputStream(file); try { int bytesRead = is.read(m_buffer); if (bytesRead != length) { throw new RuntimeException("Read count different"); } } finally { is.close(); } List<Integer> blocks = new ArrayList<Integer>(); for (int index = 64; index < m_buffer.length - 11; index++) { if (matchPattern(PARENT_BLOCK_PATTERNS, index)) { blocks.add(Integer.valueOf(index)); } } int startIndex = 0; for (int endIndex : blocks) { int blockLength = endIndex - startIndex; readBlock(blockIndex, startIndex, blockLength); startIndex = endIndex; ++blockIndex; } int blockLength = m_buffer.length - startIndex; readBlock(blockIndex, startIndex, blockLength); closeLogFile(); }
java
public void process(File file) throws Exception { openLogFile(); int blockIndex = 0; int length = (int) file.length(); m_buffer = new byte[length]; FileInputStream is = new FileInputStream(file); try { int bytesRead = is.read(m_buffer); if (bytesRead != length) { throw new RuntimeException("Read count different"); } } finally { is.close(); } List<Integer> blocks = new ArrayList<Integer>(); for (int index = 64; index < m_buffer.length - 11; index++) { if (matchPattern(PARENT_BLOCK_PATTERNS, index)) { blocks.add(Integer.valueOf(index)); } } int startIndex = 0; for (int endIndex : blocks) { int blockLength = endIndex - startIndex; readBlock(blockIndex, startIndex, blockLength); startIndex = endIndex; ++blockIndex; } int blockLength = m_buffer.length - startIndex; readBlock(blockIndex, startIndex, blockLength); closeLogFile(); }
[ "public", "void", "process", "(", "File", "file", ")", "throws", "Exception", "{", "openLogFile", "(", ")", ";", "int", "blockIndex", "=", "0", ";", "int", "length", "=", "(", "int", ")", "file", ".", "length", "(", ")", ";", "m_buffer", "=", "new", "byte", "[", "length", "]", ";", "FileInputStream", "is", "=", "new", "FileInputStream", "(", "file", ")", ";", "try", "{", "int", "bytesRead", "=", "is", ".", "read", "(", "m_buffer", ")", ";", "if", "(", "bytesRead", "!=", "length", ")", "{", "throw", "new", "RuntimeException", "(", "\"Read count different\"", ")", ";", "}", "}", "finally", "{", "is", ".", "close", "(", ")", ";", "}", "List", "<", "Integer", ">", "blocks", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "index", "=", "64", ";", "index", "<", "m_buffer", ".", "length", "-", "11", ";", "index", "++", ")", "{", "if", "(", "matchPattern", "(", "PARENT_BLOCK_PATTERNS", ",", "index", ")", ")", "{", "blocks", ".", "add", "(", "Integer", ".", "valueOf", "(", "index", ")", ")", ";", "}", "}", "int", "startIndex", "=", "0", ";", "for", "(", "int", "endIndex", ":", "blocks", ")", "{", "int", "blockLength", "=", "endIndex", "-", "startIndex", ";", "readBlock", "(", "blockIndex", ",", "startIndex", ",", "blockLength", ")", ";", "startIndex", "=", "endIndex", ";", "++", "blockIndex", ";", "}", "int", "blockLength", "=", "m_buffer", ".", "length", "-", "startIndex", ";", "readBlock", "(", "blockIndex", ",", "startIndex", ",", "blockLength", ")", ";", "closeLogFile", "(", ")", ";", "}" ]
Read a FastTrack file. @param file FastTrack file
[ "Read", "a", "FastTrack", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L52-L95
156,983
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.getTable
public FastTrackTable getTable(FastTrackTableType type) { FastTrackTable result = m_tables.get(type); if (result == null) { result = EMPTY_TABLE; } return result; }
java
public FastTrackTable getTable(FastTrackTableType type) { FastTrackTable result = m_tables.get(type); if (result == null) { result = EMPTY_TABLE; } return result; }
[ "public", "FastTrackTable", "getTable", "(", "FastTrackTableType", "type", ")", "{", "FastTrackTable", "result", "=", "m_tables", ".", "get", "(", "type", ")", ";", "if", "(", "result", "==", "null", ")", "{", "result", "=", "EMPTY_TABLE", ";", "}", "return", "result", ";", "}" ]
Retrieve a table of data. @param type table type @return FastTrackTable instance
[ "Retrieve", "a", "table", "of", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L103-L111
156,984
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readBlock
private void readBlock(int blockIndex, int startIndex, int blockLength) throws Exception { logBlock(blockIndex, startIndex, blockLength); if (blockLength < 128) { readTableBlock(startIndex, blockLength); } else { readColumnBlock(startIndex, blockLength); } }
java
private void readBlock(int blockIndex, int startIndex, int blockLength) throws Exception { logBlock(blockIndex, startIndex, blockLength); if (blockLength < 128) { readTableBlock(startIndex, blockLength); } else { readColumnBlock(startIndex, blockLength); } }
[ "private", "void", "readBlock", "(", "int", "blockIndex", ",", "int", "startIndex", ",", "int", "blockLength", ")", "throws", "Exception", "{", "logBlock", "(", "blockIndex", ",", "startIndex", ",", "blockLength", ")", ";", "if", "(", "blockLength", "<", "128", ")", "{", "readTableBlock", "(", "startIndex", ",", "blockLength", ")", ";", "}", "else", "{", "readColumnBlock", "(", "startIndex", ",", "blockLength", ")", ";", "}", "}" ]
Read a block of data from the FastTrack file and determine if it contains a table definition, or columns. @param blockIndex index of the current block @param startIndex start index of the block in the file @param blockLength block length
[ "Read", "a", "block", "of", "data", "from", "the", "FastTrack", "file", "and", "determine", "if", "it", "contains", "a", "table", "definition", "or", "columns", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L141-L153
156,985
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readTableBlock
private void readTableBlock(int startIndex, int blockLength) { for (int index = startIndex; index < (startIndex + blockLength - 11); index++) { if (matchPattern(TABLE_BLOCK_PATTERNS, index)) { int offset = index + 7; int nameLength = FastTrackUtility.getInt(m_buffer, offset); offset += 4; String name = new String(m_buffer, offset, nameLength, CharsetHelper.UTF16LE).toUpperCase(); FastTrackTableType type = REQUIRED_TABLES.get(name); if (type != null) { m_currentTable = new FastTrackTable(type, this); m_tables.put(type, m_currentTable); } else { m_currentTable = null; } m_currentFields.clear(); break; } } }
java
private void readTableBlock(int startIndex, int blockLength) { for (int index = startIndex; index < (startIndex + blockLength - 11); index++) { if (matchPattern(TABLE_BLOCK_PATTERNS, index)) { int offset = index + 7; int nameLength = FastTrackUtility.getInt(m_buffer, offset); offset += 4; String name = new String(m_buffer, offset, nameLength, CharsetHelper.UTF16LE).toUpperCase(); FastTrackTableType type = REQUIRED_TABLES.get(name); if (type != null) { m_currentTable = new FastTrackTable(type, this); m_tables.put(type, m_currentTable); } else { m_currentTable = null; } m_currentFields.clear(); break; } } }
[ "private", "void", "readTableBlock", "(", "int", "startIndex", ",", "int", "blockLength", ")", "{", "for", "(", "int", "index", "=", "startIndex", ";", "index", "<", "(", "startIndex", "+", "blockLength", "-", "11", ")", ";", "index", "++", ")", "{", "if", "(", "matchPattern", "(", "TABLE_BLOCK_PATTERNS", ",", "index", ")", ")", "{", "int", "offset", "=", "index", "+", "7", ";", "int", "nameLength", "=", "FastTrackUtility", ".", "getInt", "(", "m_buffer", ",", "offset", ")", ";", "offset", "+=", "4", ";", "String", "name", "=", "new", "String", "(", "m_buffer", ",", "offset", ",", "nameLength", ",", "CharsetHelper", ".", "UTF16LE", ")", ".", "toUpperCase", "(", ")", ";", "FastTrackTableType", "type", "=", "REQUIRED_TABLES", ".", "get", "(", "name", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "m_currentTable", "=", "new", "FastTrackTable", "(", "type", ",", "this", ")", ";", "m_tables", ".", "put", "(", "type", ",", "m_currentTable", ")", ";", "}", "else", "{", "m_currentTable", "=", "null", ";", "}", "m_currentFields", ".", "clear", "(", ")", ";", "break", ";", "}", "}", "}" ]
Read the name of a table and prepare to populate it with column data. @param startIndex start of the block @param blockLength length of the block
[ "Read", "the", "name", "of", "a", "table", "and", "prepare", "to", "populate", "it", "with", "column", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L161-L185
156,986
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readColumnBlock
private void readColumnBlock(int startIndex, int blockLength) throws Exception { int endIndex = startIndex + blockLength; List<Integer> blocks = new ArrayList<Integer>(); for (int index = startIndex; index < endIndex - 11; index++) { if (matchChildBlock(index)) { int childBlockStart = index - 2; blocks.add(Integer.valueOf(childBlockStart)); } } blocks.add(Integer.valueOf(endIndex)); int childBlockStart = -1; for (int childBlockEnd : blocks) { if (childBlockStart != -1) { int childblockLength = childBlockEnd - childBlockStart; try { readColumn(childBlockStart, childblockLength); } catch (UnexpectedStructureException ex) { logUnexpectedStructure(); } } childBlockStart = childBlockEnd; } }
java
private void readColumnBlock(int startIndex, int blockLength) throws Exception { int endIndex = startIndex + blockLength; List<Integer> blocks = new ArrayList<Integer>(); for (int index = startIndex; index < endIndex - 11; index++) { if (matchChildBlock(index)) { int childBlockStart = index - 2; blocks.add(Integer.valueOf(childBlockStart)); } } blocks.add(Integer.valueOf(endIndex)); int childBlockStart = -1; for (int childBlockEnd : blocks) { if (childBlockStart != -1) { int childblockLength = childBlockEnd - childBlockStart; try { readColumn(childBlockStart, childblockLength); } catch (UnexpectedStructureException ex) { logUnexpectedStructure(); } } childBlockStart = childBlockEnd; } }
[ "private", "void", "readColumnBlock", "(", "int", "startIndex", ",", "int", "blockLength", ")", "throws", "Exception", "{", "int", "endIndex", "=", "startIndex", "+", "blockLength", ";", "List", "<", "Integer", ">", "blocks", "=", "new", "ArrayList", "<", "Integer", ">", "(", ")", ";", "for", "(", "int", "index", "=", "startIndex", ";", "index", "<", "endIndex", "-", "11", ";", "index", "++", ")", "{", "if", "(", "matchChildBlock", "(", "index", ")", ")", "{", "int", "childBlockStart", "=", "index", "-", "2", ";", "blocks", ".", "add", "(", "Integer", ".", "valueOf", "(", "childBlockStart", ")", ")", ";", "}", "}", "blocks", ".", "add", "(", "Integer", ".", "valueOf", "(", "endIndex", ")", ")", ";", "int", "childBlockStart", "=", "-", "1", ";", "for", "(", "int", "childBlockEnd", ":", "blocks", ")", "{", "if", "(", "childBlockStart", "!=", "-", "1", ")", "{", "int", "childblockLength", "=", "childBlockEnd", "-", "childBlockStart", ";", "try", "{", "readColumn", "(", "childBlockStart", ",", "childblockLength", ")", ";", "}", "catch", "(", "UnexpectedStructureException", "ex", ")", "{", "logUnexpectedStructure", "(", ")", ";", "}", "}", "childBlockStart", "=", "childBlockEnd", ";", "}", "}" ]
Read multiple columns from a block. @param startIndex start of the block @param blockLength length of the block
[ "Read", "multiple", "columns", "from", "a", "block", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L193-L224
156,987
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.readColumn
private void readColumn(int startIndex, int length) throws Exception { if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
java
private void readColumn(int startIndex, int length) throws Exception { if (m_currentTable != null) { int value = FastTrackUtility.getByte(m_buffer, startIndex); Class<?> klass = COLUMN_MAP[value]; if (klass == null) { klass = UnknownColumn.class; } FastTrackColumn column = (FastTrackColumn) klass.newInstance(); m_currentColumn = column; logColumnData(startIndex, length); column.read(m_currentTable.getType(), m_buffer, startIndex, length); FastTrackField type = column.getType(); // // Don't try to add this data if: // 1. We don't know what type it is // 2. We have seen the type already // if (type != null && !m_currentFields.contains(type)) { m_currentFields.add(type); m_currentTable.addColumn(column); updateDurationTimeUnit(column); updateWorkTimeUnit(column); logColumn(column); } } }
[ "private", "void", "readColumn", "(", "int", "startIndex", ",", "int", "length", ")", "throws", "Exception", "{", "if", "(", "m_currentTable", "!=", "null", ")", "{", "int", "value", "=", "FastTrackUtility", ".", "getByte", "(", "m_buffer", ",", "startIndex", ")", ";", "Class", "<", "?", ">", "klass", "=", "COLUMN_MAP", "[", "value", "]", ";", "if", "(", "klass", "==", "null", ")", "{", "klass", "=", "UnknownColumn", ".", "class", ";", "}", "FastTrackColumn", "column", "=", "(", "FastTrackColumn", ")", "klass", ".", "newInstance", "(", ")", ";", "m_currentColumn", "=", "column", ";", "logColumnData", "(", "startIndex", ",", "length", ")", ";", "column", ".", "read", "(", "m_currentTable", ".", "getType", "(", ")", ",", "m_buffer", ",", "startIndex", ",", "length", ")", ";", "FastTrackField", "type", "=", "column", ".", "getType", "(", ")", ";", "//", "// Don't try to add this data if:", "// 1. We don't know what type it is", "// 2. We have seen the type already", "//", "if", "(", "type", "!=", "null", "&&", "!", "m_currentFields", ".", "contains", "(", "type", ")", ")", "{", "m_currentFields", ".", "add", "(", "type", ")", ";", "m_currentTable", ".", "addColumn", "(", "column", ")", ";", "updateDurationTimeUnit", "(", "column", ")", ";", "updateWorkTimeUnit", "(", "column", ")", ";", "logColumn", "(", "column", ")", ";", "}", "}", "}" ]
Read data for a single column. @param startIndex block start @param length block length
[ "Read", "data", "for", "a", "single", "column", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L232-L266
156,988
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.matchPattern
private final boolean matchPattern(byte[][] patterns, int bufferIndex) { boolean match = false; for (byte[] pattern : patterns) { int index = 0; match = true; for (byte b : pattern) { if (b != m_buffer[bufferIndex + index]) { match = false; break; } ++index; } if (match) { break; } } return match; }
java
private final boolean matchPattern(byte[][] patterns, int bufferIndex) { boolean match = false; for (byte[] pattern : patterns) { int index = 0; match = true; for (byte b : pattern) { if (b != m_buffer[bufferIndex + index]) { match = false; break; } ++index; } if (match) { break; } } return match; }
[ "private", "final", "boolean", "matchPattern", "(", "byte", "[", "]", "[", "]", "patterns", ",", "int", "bufferIndex", ")", "{", "boolean", "match", "=", "false", ";", "for", "(", "byte", "[", "]", "pattern", ":", "patterns", ")", "{", "int", "index", "=", "0", ";", "match", "=", "true", ";", "for", "(", "byte", "b", ":", "pattern", ")", "{", "if", "(", "b", "!=", "m_buffer", "[", "bufferIndex", "+", "index", "]", ")", "{", "match", "=", "false", ";", "break", ";", "}", "++", "index", ";", "}", "if", "(", "match", ")", "{", "break", ";", "}", "}", "return", "match", ";", "}" ]
Locate a feature in the file by match a byte pattern. @param patterns patterns to match @param bufferIndex start index @return true if the bytes at the position match a pattern
[ "Locate", "a", "feature", "in", "the", "file", "by", "match", "a", "byte", "pattern", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L275-L297
156,989
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.matchChildBlock
private final boolean matchChildBlock(int bufferIndex) { // // Match the pattern we see at the start of the child block // int index = 0; for (byte b : CHILD_BLOCK_PATTERN) { if (b != m_buffer[bufferIndex + index]) { return false; } ++index; } // // The first step will produce false positives. To handle this, we should find // the name of the block next, and check to ensure that the length // of the name makes sense. // int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index); // System.out.println("Name length: " + nameLength); // // if (nameLength > 0 && nameLength < 100) // { // String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE); // System.out.println("Name: " + name); // } return nameLength > 0 && nameLength < 100; }
java
private final boolean matchChildBlock(int bufferIndex) { // // Match the pattern we see at the start of the child block // int index = 0; for (byte b : CHILD_BLOCK_PATTERN) { if (b != m_buffer[bufferIndex + index]) { return false; } ++index; } // // The first step will produce false positives. To handle this, we should find // the name of the block next, and check to ensure that the length // of the name makes sense. // int nameLength = FastTrackUtility.getInt(m_buffer, bufferIndex + index); // System.out.println("Name length: " + nameLength); // // if (nameLength > 0 && nameLength < 100) // { // String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE); // System.out.println("Name: " + name); // } return nameLength > 0 && nameLength < 100; }
[ "private", "final", "boolean", "matchChildBlock", "(", "int", "bufferIndex", ")", "{", "//", "// Match the pattern we see at the start of the child block", "//", "int", "index", "=", "0", ";", "for", "(", "byte", "b", ":", "CHILD_BLOCK_PATTERN", ")", "{", "if", "(", "b", "!=", "m_buffer", "[", "bufferIndex", "+", "index", "]", ")", "{", "return", "false", ";", "}", "++", "index", ";", "}", "//", "// The first step will produce false positives. To handle this, we should find", "// the name of the block next, and check to ensure that the length", "// of the name makes sense.", "//", "int", "nameLength", "=", "FastTrackUtility", ".", "getInt", "(", "m_buffer", ",", "bufferIndex", "+", "index", ")", ";", "// System.out.println(\"Name length: \" + nameLength);", "// ", "// if (nameLength > 0 && nameLength < 100)", "// {", "// String name = new String(m_buffer, bufferIndex+index+4, nameLength, CharsetHelper.UTF16LE);", "// System.out.println(\"Name: \" + name);", "// }", "return", "nameLength", ">", "0", "&&", "nameLength", "<", "100", ";", "}" ]
Locate a child block by byte pattern and validate by checking the length of the string we are expecting to follow the pattern. @param bufferIndex start index @return true if a child block starts at this point
[ "Locate", "a", "child", "block", "by", "byte", "pattern", "and", "validate", "by", "checking", "the", "length", "of", "the", "string", "we", "are", "expecting", "to", "follow", "the", "pattern", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L307-L338
156,990
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.updateDurationTimeUnit
private void updateDurationTimeUnit(FastTrackColumn column) { if (m_durationTimeUnit == null && isDurationColumn(column)) { int value = ((DurationColumn) column).getTimeUnitValue(); if (value != 1) { m_durationTimeUnit = FastTrackUtility.getTimeUnit(value); } } }
java
private void updateDurationTimeUnit(FastTrackColumn column) { if (m_durationTimeUnit == null && isDurationColumn(column)) { int value = ((DurationColumn) column).getTimeUnitValue(); if (value != 1) { m_durationTimeUnit = FastTrackUtility.getTimeUnit(value); } } }
[ "private", "void", "updateDurationTimeUnit", "(", "FastTrackColumn", "column", ")", "{", "if", "(", "m_durationTimeUnit", "==", "null", "&&", "isDurationColumn", "(", "column", ")", ")", "{", "int", "value", "=", "(", "(", "DurationColumn", ")", "column", ")", ".", "getTimeUnitValue", "(", ")", ";", "if", "(", "value", "!=", "1", ")", "{", "m_durationTimeUnit", "=", "FastTrackUtility", ".", "getTimeUnit", "(", "value", ")", ";", "}", "}", "}" ]
Update the default time unit for durations based on data read from the file. @param column column data
[ "Update", "the", "default", "time", "unit", "for", "durations", "based", "on", "data", "read", "from", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L345-L355
156,991
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.updateWorkTimeUnit
private void updateWorkTimeUnit(FastTrackColumn column) { if (m_workTimeUnit == null && isWorkColumn(column)) { int value = ((DurationColumn) column).getTimeUnitValue(); if (value != 1) { m_workTimeUnit = FastTrackUtility.getTimeUnit(value); } } }
java
private void updateWorkTimeUnit(FastTrackColumn column) { if (m_workTimeUnit == null && isWorkColumn(column)) { int value = ((DurationColumn) column).getTimeUnitValue(); if (value != 1) { m_workTimeUnit = FastTrackUtility.getTimeUnit(value); } } }
[ "private", "void", "updateWorkTimeUnit", "(", "FastTrackColumn", "column", ")", "{", "if", "(", "m_workTimeUnit", "==", "null", "&&", "isWorkColumn", "(", "column", ")", ")", "{", "int", "value", "=", "(", "(", "DurationColumn", ")", "column", ")", ".", "getTimeUnitValue", "(", ")", ";", "if", "(", "value", "!=", "1", ")", "{", "m_workTimeUnit", "=", "FastTrackUtility", ".", "getTimeUnit", "(", "value", ")", ";", "}", "}", "}" ]
Update the default time unit for work based on data read from the file. @param column column data
[ "Update", "the", "default", "time", "unit", "for", "work", "based", "on", "data", "read", "from", "the", "file", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L362-L372
156,992
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.logBlock
private void logBlock(int blockIndex, int startIndex, int blockLength) { if (m_log != null) { m_log.println("Block Index: " + blockIndex); m_log.println("Length: " + blockLength + " (" + Integer.toHexString(blockLength) + ")"); m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, blockLength, true, 16, "")); m_log.flush(); } }
java
private void logBlock(int blockIndex, int startIndex, int blockLength) { if (m_log != null) { m_log.println("Block Index: " + blockIndex); m_log.println("Length: " + blockLength + " (" + Integer.toHexString(blockLength) + ")"); m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, blockLength, true, 16, "")); m_log.flush(); } }
[ "private", "void", "logBlock", "(", "int", "blockIndex", ",", "int", "startIndex", ",", "int", "blockLength", ")", "{", "if", "(", "m_log", "!=", "null", ")", "{", "m_log", ".", "println", "(", "\"Block Index: \"", "+", "blockIndex", ")", ";", "m_log", ".", "println", "(", "\"Length: \"", "+", "blockLength", "+", "\" (\"", "+", "Integer", ".", "toHexString", "(", "blockLength", ")", "+", "\")\"", ")", ";", "m_log", ".", "println", "(", ")", ";", "m_log", ".", "println", "(", "FastTrackUtility", ".", "hexdump", "(", "m_buffer", ",", "startIndex", ",", "blockLength", ",", "true", ",", "16", ",", "\"\"", ")", ")", ";", "m_log", ".", "flush", "(", ")", ";", "}", "}" ]
Log block data. @param blockIndex current block index @param startIndex start index @param blockLength length
[ "Log", "block", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L436-L446
156,993
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.logColumnData
private void logColumnData(int startIndex, int length) { if (m_log != null) { m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, length, true, 16, "")); m_log.println(); m_log.flush(); } }
java
private void logColumnData(int startIndex, int length) { if (m_log != null) { m_log.println(); m_log.println(FastTrackUtility.hexdump(m_buffer, startIndex, length, true, 16, "")); m_log.println(); m_log.flush(); } }
[ "private", "void", "logColumnData", "(", "int", "startIndex", ",", "int", "length", ")", "{", "if", "(", "m_log", "!=", "null", ")", "{", "m_log", ".", "println", "(", ")", ";", "m_log", ".", "println", "(", "FastTrackUtility", ".", "hexdump", "(", "m_buffer", ",", "startIndex", ",", "length", ",", "true", ",", "16", ",", "\"\"", ")", ")", ";", "m_log", ".", "println", "(", ")", ";", "m_log", ".", "flush", "(", ")", ";", "}", "}" ]
Log the data for a single column. @param startIndex offset into buffer @param length length
[ "Log", "the", "data", "for", "a", "single", "column", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L454-L463
156,994
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.logUnexpectedStructure
private void logUnexpectedStructure() { if (m_log != null) { m_log.println("ABORTED COLUMN - unexpected structure: " + m_currentColumn.getClass().getSimpleName() + " " + m_currentColumn.getName()); } }
java
private void logUnexpectedStructure() { if (m_log != null) { m_log.println("ABORTED COLUMN - unexpected structure: " + m_currentColumn.getClass().getSimpleName() + " " + m_currentColumn.getName()); } }
[ "private", "void", "logUnexpectedStructure", "(", ")", "{", "if", "(", "m_log", "!=", "null", ")", "{", "m_log", ".", "println", "(", "\"ABORTED COLUMN - unexpected structure: \"", "+", "m_currentColumn", ".", "getClass", "(", ")", ".", "getSimpleName", "(", ")", "+", "\" \"", "+", "m_currentColumn", ".", "getName", "(", ")", ")", ";", "}", "}" ]
Log unexpected column structure.
[ "Log", "unexpected", "column", "structure", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L468-L474
156,995
joniles/mpxj
src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java
FastTrackData.logColumn
private void logColumn(FastTrackColumn column) { if (m_log != null) { m_log.println("TABLE: " + m_currentTable.getType()); m_log.println(column.toString()); m_log.flush(); } }
java
private void logColumn(FastTrackColumn column) { if (m_log != null) { m_log.println("TABLE: " + m_currentTable.getType()); m_log.println(column.toString()); m_log.flush(); } }
[ "private", "void", "logColumn", "(", "FastTrackColumn", "column", ")", "{", "if", "(", "m_log", "!=", "null", ")", "{", "m_log", ".", "println", "(", "\"TABLE: \"", "+", "m_currentTable", ".", "getType", "(", ")", ")", ";", "m_log", ".", "println", "(", "column", ".", "toString", "(", ")", ")", ";", "m_log", ".", "flush", "(", ")", ";", "}", "}" ]
Log column data. @param column column data
[ "Log", "column", "data", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/fasttrack/FastTrackData.java#L481-L489
156,996
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateCurrencySettings
private void populateCurrencySettings(Record record, ProjectProperties properties) { properties.setCurrencySymbol(record.getString(0)); properties.setSymbolPosition(record.getCurrencySymbolPosition(1)); properties.setCurrencyDigits(record.getInteger(2)); Character c = record.getCharacter(3); if (c != null) { properties.setThousandsSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setDecimalSeparator(c.charValue()); } }
java
private void populateCurrencySettings(Record record, ProjectProperties properties) { properties.setCurrencySymbol(record.getString(0)); properties.setSymbolPosition(record.getCurrencySymbolPosition(1)); properties.setCurrencyDigits(record.getInteger(2)); Character c = record.getCharacter(3); if (c != null) { properties.setThousandsSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setDecimalSeparator(c.charValue()); } }
[ "private", "void", "populateCurrencySettings", "(", "Record", "record", ",", "ProjectProperties", "properties", ")", "{", "properties", ".", "setCurrencySymbol", "(", "record", ".", "getString", "(", "0", ")", ")", ";", "properties", ".", "setSymbolPosition", "(", "record", ".", "getCurrencySymbolPosition", "(", "1", ")", ")", ";", "properties", ".", "setCurrencyDigits", "(", "record", ".", "getInteger", "(", "2", ")", ")", ";", "Character", "c", "=", "record", ".", "getCharacter", "(", "3", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "properties", ".", "setThousandsSeparator", "(", "c", ".", "charValue", "(", ")", ")", ";", "}", "c", "=", "record", ".", "getCharacter", "(", "4", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "properties", ".", "setDecimalSeparator", "(", "c", ".", "charValue", "(", ")", ")", ";", "}", "}" ]
Populates currency settings. @param record MPX record @param properties project properties
[ "Populates", "currency", "settings", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L483-L500
156,997
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateDefaultSettings
private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException { properties.setDefaultDurationUnits(record.getTimeUnit(0)); properties.setDefaultDurationIsFixed(record.getNumericBoolean(1)); properties.setDefaultWorkUnits(record.getTimeUnit(2)); properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60)); properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60)); properties.setDefaultStandardRate(record.getRate(5)); properties.setDefaultOvertimeRate(record.getRate(6)); properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7)); properties.setSplitInProgressTasks(record.getNumericBoolean(8)); }
java
private void populateDefaultSettings(Record record, ProjectProperties properties) throws MPXJException { properties.setDefaultDurationUnits(record.getTimeUnit(0)); properties.setDefaultDurationIsFixed(record.getNumericBoolean(1)); properties.setDefaultWorkUnits(record.getTimeUnit(2)); properties.setMinutesPerDay(Double.valueOf(NumberHelper.getDouble(record.getFloat(3)) * 60)); properties.setMinutesPerWeek(Double.valueOf(NumberHelper.getDouble(record.getFloat(4)) * 60)); properties.setDefaultStandardRate(record.getRate(5)); properties.setDefaultOvertimeRate(record.getRate(6)); properties.setUpdatingTaskStatusUpdatesResourceStatus(record.getNumericBoolean(7)); properties.setSplitInProgressTasks(record.getNumericBoolean(8)); }
[ "private", "void", "populateDefaultSettings", "(", "Record", "record", ",", "ProjectProperties", "properties", ")", "throws", "MPXJException", "{", "properties", ".", "setDefaultDurationUnits", "(", "record", ".", "getTimeUnit", "(", "0", ")", ")", ";", "properties", ".", "setDefaultDurationIsFixed", "(", "record", ".", "getNumericBoolean", "(", "1", ")", ")", ";", "properties", ".", "setDefaultWorkUnits", "(", "record", ".", "getTimeUnit", "(", "2", ")", ")", ";", "properties", ".", "setMinutesPerDay", "(", "Double", ".", "valueOf", "(", "NumberHelper", ".", "getDouble", "(", "record", ".", "getFloat", "(", "3", ")", ")", "*", "60", ")", ")", ";", "properties", ".", "setMinutesPerWeek", "(", "Double", ".", "valueOf", "(", "NumberHelper", ".", "getDouble", "(", "record", ".", "getFloat", "(", "4", ")", ")", "*", "60", ")", ")", ";", "properties", ".", "setDefaultStandardRate", "(", "record", ".", "getRate", "(", "5", ")", ")", ";", "properties", ".", "setDefaultOvertimeRate", "(", "record", ".", "getRate", "(", "6", ")", ")", ";", "properties", ".", "setUpdatingTaskStatusUpdatesResourceStatus", "(", "record", ".", "getNumericBoolean", "(", "7", ")", ")", ";", "properties", ".", "setSplitInProgressTasks", "(", "record", ".", "getNumericBoolean", "(", "8", ")", ")", ";", "}" ]
Populates default settings. @param record MPX record @param properties project properties @throws MPXJException
[ "Populates", "default", "settings", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L509-L520
156,998
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.populateDateTimeSettings
private void populateDateTimeSettings(Record record, ProjectProperties properties) { properties.setDateOrder(record.getDateOrder(0)); properties.setTimeFormat(record.getTimeFormat(1)); Date time = getTimeFromInteger(record.getInteger(2)); if (time != null) { properties.setDefaultStartTime(time); } Character c = record.getCharacter(3); if (c != null) { properties.setDateSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setTimeSeparator(c.charValue()); } properties.setAMText(record.getString(5)); properties.setPMText(record.getString(6)); properties.setDateFormat(record.getDateFormat(7)); properties.setBarTextDateFormat(record.getDateFormat(8)); }
java
private void populateDateTimeSettings(Record record, ProjectProperties properties) { properties.setDateOrder(record.getDateOrder(0)); properties.setTimeFormat(record.getTimeFormat(1)); Date time = getTimeFromInteger(record.getInteger(2)); if (time != null) { properties.setDefaultStartTime(time); } Character c = record.getCharacter(3); if (c != null) { properties.setDateSeparator(c.charValue()); } c = record.getCharacter(4); if (c != null) { properties.setTimeSeparator(c.charValue()); } properties.setAMText(record.getString(5)); properties.setPMText(record.getString(6)); properties.setDateFormat(record.getDateFormat(7)); properties.setBarTextDateFormat(record.getDateFormat(8)); }
[ "private", "void", "populateDateTimeSettings", "(", "Record", "record", ",", "ProjectProperties", "properties", ")", "{", "properties", ".", "setDateOrder", "(", "record", ".", "getDateOrder", "(", "0", ")", ")", ";", "properties", ".", "setTimeFormat", "(", "record", ".", "getTimeFormat", "(", "1", ")", ")", ";", "Date", "time", "=", "getTimeFromInteger", "(", "record", ".", "getInteger", "(", "2", ")", ")", ";", "if", "(", "time", "!=", "null", ")", "{", "properties", ".", "setDefaultStartTime", "(", "time", ")", ";", "}", "Character", "c", "=", "record", ".", "getCharacter", "(", "3", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "properties", ".", "setDateSeparator", "(", "c", ".", "charValue", "(", ")", ")", ";", "}", "c", "=", "record", ".", "getCharacter", "(", "4", ")", ";", "if", "(", "c", "!=", "null", ")", "{", "properties", ".", "setTimeSeparator", "(", "c", ".", "charValue", "(", ")", ")", ";", "}", "properties", ".", "setAMText", "(", "record", ".", "getString", "(", "5", ")", ")", ";", "properties", ".", "setPMText", "(", "record", ".", "getString", "(", "6", ")", ")", ";", "properties", ".", "setDateFormat", "(", "record", ".", "getDateFormat", "(", "7", ")", ")", ";", "properties", ".", "setBarTextDateFormat", "(", "record", ".", "getDateFormat", "(", "8", ")", ")", ";", "}" ]
Populates date time settings. @param record MPX record @param properties project properties
[ "Populates", "date", "time", "settings", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L528-L555
156,999
joniles/mpxj
src/main/java/net/sf/mpxj/mpx/MPXReader.java
MPXReader.getTimeFromInteger
private Date getTimeFromInteger(Integer time) { Date result = null; if (time != null) { int minutes = time.intValue(); int hours = minutes / 60; minutes -= (hours * 60); Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.HOUR_OF_DAY, hours); result = cal.getTime(); DateHelper.pushCalendar(cal); } return (result); }
java
private Date getTimeFromInteger(Integer time) { Date result = null; if (time != null) { int minutes = time.intValue(); int hours = minutes / 60; minutes -= (hours * 60); Calendar cal = DateHelper.popCalendar(); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, minutes); cal.set(Calendar.HOUR_OF_DAY, hours); result = cal.getTime(); DateHelper.pushCalendar(cal); } return (result); }
[ "private", "Date", "getTimeFromInteger", "(", "Integer", "time", ")", "{", "Date", "result", "=", "null", ";", "if", "(", "time", "!=", "null", ")", "{", "int", "minutes", "=", "time", ".", "intValue", "(", ")", ";", "int", "hours", "=", "minutes", "/", "60", ";", "minutes", "-=", "(", "hours", "*", "60", ")", ";", "Calendar", "cal", "=", "DateHelper", ".", "popCalendar", "(", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MILLISECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "SECOND", ",", "0", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "MINUTE", ",", "minutes", ")", ";", "cal", ".", "set", "(", "Calendar", ".", "HOUR_OF_DAY", ",", "hours", ")", ";", "result", "=", "cal", ".", "getTime", "(", ")", ";", "DateHelper", ".", "pushCalendar", "(", "cal", ")", ";", "}", "return", "(", "result", ")", ";", "}" ]
Converts a time represented as an integer to a Date instance. @param time integer time @return Date instance
[ "Converts", "a", "time", "represented", "as", "an", "integer", "to", "a", "Date", "instance", "." ]
143ea0e195da59cd108f13b3b06328e9542337e8
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXReader.java#L563-L583