idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
143,400 | public static final CurrencySymbolPosition parseCurrencySymbolPosition ( String value ) { CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION . get ( value ) ; result = result == null ? CurrencySymbolPosition . BEFORE_WITH_SPACE : result ; return result ; } | Parse a currency symbol position from a string representation . | 69 | 11 |
143,401 | public static final Date parseDate ( String value ) { Date result = null ; try { if ( value != null && ! value . isEmpty ( ) ) { result = DATE_FORMAT . get ( ) . parse ( value ) ; } } catch ( ParseException ex ) { // Ignore } return result ; } | Parse a date value . | 67 | 6 |
143,402 | public static final Date parseDateTime ( String value ) { Date result = null ; try { if ( value != null && ! value . isEmpty ( ) ) { result = DATE_TIME_FORMAT . get ( ) . parse ( value ) ; } } catch ( ParseException ex ) { // Ignore } return result ; } | Parse a date time value . | 70 | 7 |
143,403 | public static final int getInt ( byte [ ] data , int offset ) { int result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 32 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; } | Read a four byte integer . | 71 | 6 |
143,404 | public static final int getShort ( byte [ ] data , int offset ) { int result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 16 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; } | Read a two byte integer . | 71 | 6 |
143,405 | public static final String getString ( byte [ ] data , int offset ) { return getString ( data , offset , data . length - offset ) ; } | Retrieve a string value . | 32 | 6 |
143,406 | public static final Date getFinishDate ( byte [ ] data , int offset ) { Date result ; long days = getShort ( data , offset ) ; if ( days == 0x8000 ) { result = null ; } else { result = DateHelper . getDateFromLong ( EPOCH + ( ( days - 1 ) * DateHelper . MS_PER_DAY ) ) ; } return ( result ) ; } | Retrieve a finish date . | 86 | 6 |
143,407 | public void setDefaultCalendarName ( String calendarName ) { if ( calendarName == null || calendarName . length ( ) == 0 ) { calendarName = DEFAULT_CALENDAR_NAME ; } set ( ProjectField . DEFAULT_CALENDAR_NAME , calendarName ) ; } | Sets the Calendar used . Standard if no value is set . | 64 | 13 |
143,408 | public Date getStartDate ( ) { Date result = ( Date ) getCachedValue ( ProjectField . START_DATE ) ; if ( result == null ) { result = getParentFile ( ) . getStartDate ( ) ; } return ( result ) ; } | Retrieves the project start date . If an explicit start date has not been set this method calculates the start date by looking for the earliest task start date . | 56 | 32 |
143,409 | public Date getFinishDate ( ) { Date result = ( Date ) getCachedValue ( ProjectField . FINISH_DATE ) ; if ( result == null ) { result = getParentFile ( ) . getFinishDate ( ) ; } return ( result ) ; } | Retrieves the project finish date . If an explicit finish date has not been set this method calculates the finish date by looking for the latest task finish date . | 57 | 32 |
143,410 | public void setCurrencySymbol ( String symbol ) { if ( symbol == null ) { symbol = DEFAULT_CURRENCY_SYMBOL ; } set ( ProjectField . CURRENCY_SYMBOL , symbol ) ; } | Sets currency symbol . | 50 | 5 |
143,411 | public void setSymbolPosition ( CurrencySymbolPosition posn ) { if ( posn == null ) { posn = DEFAULT_CURRENCY_SYMBOL_POSITION ; } set ( ProjectField . CURRENCY_SYMBOL_POSITION , posn ) ; } | Sets the position of the currency symbol . | 62 | 9 |
143,412 | public void setCurrencyDigits ( Integer currDigs ) { if ( currDigs == null ) { currDigs = DEFAULT_CURRENCY_DIGITS ; } set ( ProjectField . CURRENCY_DIGITS , currDigs ) ; } | Sets no of currency digits . | 62 | 7 |
143,413 | public Number getMinutesPerMonth ( ) { return Integer . valueOf ( NumberHelper . getInt ( getMinutesPerDay ( ) ) * NumberHelper . getInt ( getDaysPerMonth ( ) ) ) ; } | Retrieve the default number of minutes per month . | 47 | 10 |
143,414 | public Number getMinutesPerYear ( ) { return Integer . valueOf ( NumberHelper . getInt ( getMinutesPerDay ( ) ) * NumberHelper . getInt ( getDaysPerMonth ( ) ) * 12 ) ; } | Retrieve the default number of minutes per year . | 49 | 10 |
143,415 | @ SuppressWarnings ( "unchecked" ) public Map < String , Object > getCustomProperties ( ) { return ( Map < String , Object > ) getCachedValue ( ProjectField . CUSTOM_PROPERTIES ) ; } | Retrieve a map of custom document properties . | 54 | 9 |
143,416 | private char getCachedCharValue ( FieldType field , char defaultValue ) { Character c = ( Character ) getCachedValue ( field ) ; return c == null ? defaultValue : c . charValue ( ) ; } | Handles retrieval of primitive char type . | 47 | 8 |
143,417 | private void set ( FieldType field , boolean value ) { set ( field , ( value ? Boolean . TRUE : Boolean . FALSE ) ) ; } | This method inserts a name value pair into internal storage . | 30 | 11 |
143,418 | private List < Row > getRows ( String sql ) throws SQLException { allocateConnection ( ) ; try { List < Row > result = new LinkedList < Row > ( ) ; m_ps = m_connection . prepareStatement ( sql ) ; m_rs = m_ps . executeQuery ( ) ; populateMetaData ( ) ; while ( m_rs . next ( ) ) { result . add ( new MpdResultSetRow ( m_rs , m_meta ) ) ; } return ( result ) ; } finally { releaseConnection ( ) ; } } | Retrieve a number of rows matching the supplied query . | 122 | 11 |
143,419 | private void releaseConnection ( ) { if ( m_rs != null ) { try { m_rs . close ( ) ; } catch ( SQLException ex ) { // silently ignore errors on close } m_rs = null ; } if ( m_ps != null ) { try { m_ps . close ( ) ; } catch ( SQLException ex ) { // silently ignore errors on close } m_ps = null ; } } | Releases a database connection and cleans up any resources associated with that connection . | 94 | 15 |
143,420 | private void populateMetaData ( ) throws SQLException { m_meta . clear ( ) ; ResultSetMetaData meta = m_rs . getMetaData ( ) ; int columnCount = meta . getColumnCount ( ) + 1 ; for ( int loop = 1 ; loop < columnCount ; loop ++ ) { String name = meta . getColumnName ( loop ) ; Integer type = Integer . valueOf ( meta . getColumnType ( loop ) ) ; m_meta . put ( name , type ) ; } } | Retrieves basic meta data from the result set . | 110 | 11 |
143,421 | public void setSchema ( String schema ) { if ( schema . charAt ( schema . length ( ) - 1 ) != ' ' ) { schema = schema + ' ' ; } m_schema = schema ; } | Set the name of the schema containing the schedule tables . | 46 | 11 |
143,422 | public ActivityCodeValue addValue ( Integer uniqueID , String name , String description ) { ActivityCodeValue value = new ActivityCodeValue ( this , uniqueID , name , description ) ; m_values . add ( value ) ; return value ; } | Add a value to this activity code . | 51 | 8 |
143,423 | public static final long getLong ( byte [ ] data , int offset ) { long result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 64 ; shiftBy += 8 ) { result |= ( ( long ) ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; } | Read a long int from a byte array . | 74 | 9 |
143,424 | public static final int getInt ( InputStream is ) throws IOException { byte [ ] data = new byte [ 4 ] ; is . read ( data ) ; return getInt ( data , 0 ) ; } | Read an int from an input stream . | 43 | 8 |
143,425 | public static final int getShort ( InputStream is ) throws IOException { byte [ ] data = new byte [ 2 ] ; is . read ( data ) ; return getShort ( data , 0 ) ; } | Read a short int from an input stream . | 43 | 9 |
143,426 | public static final long getLong ( InputStream is ) throws IOException { byte [ ] data = new byte [ 8 ] ; is . read ( data ) ; return getLong ( data , 0 ) ; } | Read a long int from an input stream . | 43 | 9 |
143,427 | public static final String getString ( InputStream is ) throws IOException { int type = is . read ( ) ; if ( type != 1 ) { throw new IllegalArgumentException ( "Unexpected string format" ) ; } Charset charset = CharsetHelper . UTF8 ; int length = is . read ( ) ; if ( length == 0xFF ) { length = getShort ( is ) ; if ( length == 0xFFFE ) { charset = CharsetHelper . UTF16LE ; length = ( is . read ( ) * 2 ) ; } } String result ; if ( length == 0 ) { result = null ; } else { byte [ ] stringData = new byte [ length ] ; is . read ( stringData ) ; result = new String ( stringData , charset ) ; } return result ; } | Read a Synchro string from an input stream . | 177 | 11 |
143,428 | public static final UUID getUUID ( InputStream is ) throws IOException { byte [ ] data = new byte [ 16 ] ; is . read ( data ) ; long long1 = 0 ; long1 |= ( ( long ) ( data [ 3 ] & 0xFF ) ) << 56 ; long1 |= ( ( long ) ( data [ 2 ] & 0xFF ) ) << 48 ; long1 |= ( ( long ) ( data [ 1 ] & 0xFF ) ) << 40 ; long1 |= ( ( long ) ( data [ 0 ] & 0xFF ) ) << 32 ; long1 |= ( ( long ) ( data [ 5 ] & 0xFF ) ) << 24 ; long1 |= ( ( long ) ( data [ 4 ] & 0xFF ) ) << 16 ; long1 |= ( ( long ) ( data [ 7 ] & 0xFF ) ) << 8 ; long1 |= ( ( long ) ( data [ 6 ] & 0xFF ) ) << 0 ; long long2 = 0 ; long2 |= ( ( long ) ( data [ 8 ] & 0xFF ) ) << 56 ; long2 |= ( ( long ) ( data [ 9 ] & 0xFF ) ) << 48 ; long2 |= ( ( long ) ( data [ 10 ] & 0xFF ) ) << 40 ; long2 |= ( ( long ) ( data [ 11 ] & 0xFF ) ) << 32 ; long2 |= ( ( long ) ( data [ 12 ] & 0xFF ) ) << 24 ; long2 |= ( ( long ) ( data [ 13 ] & 0xFF ) ) << 16 ; long2 |= ( ( long ) ( data [ 14 ] & 0xFF ) ) << 8 ; long2 |= ( ( long ) ( data [ 15 ] & 0xFF ) ) << 0 ; return new UUID ( long1 , long2 ) ; } | Retrieve a UUID from an input stream . | 412 | 10 |
143,429 | public static final Date getDate ( InputStream is ) throws IOException { long timeInSeconds = getInt ( is ) ; if ( timeInSeconds == 0x93406FFF ) { return null ; } timeInSeconds -= 3600 ; timeInSeconds *= 1000 ; return DateHelper . getDateFromLong ( timeInSeconds ) ; } | Read a Synchro date from an input stream . | 78 | 11 |
143,430 | public static final Date getTime ( InputStream is ) throws IOException { int timeValue = getInt ( is ) ; timeValue -= 86400 ; timeValue /= 60 ; return DateHelper . getTimeFromMinutesPastMidnight ( Integer . valueOf ( timeValue ) ) ; } | Read a Synchro time from an input stream . | 62 | 11 |
143,431 | public static final Duration getDuration ( InputStream is ) throws IOException { double durationInSeconds = getInt ( is ) ; durationInSeconds /= ( 60 * 60 ) ; return Duration . getInstance ( durationInSeconds , TimeUnit . HOURS ) ; } | Retrieve a Synchro Duration from an input stream . | 58 | 12 |
143,432 | public static final Double getDouble ( InputStream is ) throws IOException { double result = Double . longBitsToDouble ( getLong ( is ) ) ; if ( Double . isNaN ( result ) ) { result = 0 ; } return Double . valueOf ( result ) ; } | Retrieve a Double from an input stream . | 60 | 9 |
143,433 | public void process ( ) { if ( m_data != null ) { int index = 0 ; int offset = 0 ; // First the length (repeated twice) int length = MPPUtility . getInt ( m_data , offset ) ; offset += 8 ; // Then the number of custom columns int numberOfAliases = MPPUtility . getInt ( m_data , offset ) ; offset += 4 ; // Then the aliases themselves while ( index < numberOfAliases && offset < length ) { // Each item consists of the Field ID (2 bytes), 40 0B marker (2 bytes), and the // offset to the string (4 bytes) // Get the Field ID int fieldID = MPPUtility . getInt ( m_data , offset ) ; offset += 4 ; // Get the alias offset (offset + 4 for some reason). int aliasOffset = MPPUtility . getInt ( m_data , offset ) + 4 ; offset += 4 ; // Read the alias itself if ( aliasOffset < m_data . length ) { String alias = MPPUtility . getUnicodeString ( m_data , aliasOffset ) ; m_fields . getCustomField ( FieldTypeHelper . getInstance ( fieldID ) ) . setAlias ( alias ) ; } index ++ ; } } } | Process field aliases . | 276 | 4 |
143,434 | public List < ProjectListType . Project > getProject ( ) { if ( project == null ) { project = new ArrayList < ProjectListType . Project > ( ) ; } return this . project ; } | Gets the value of the project property . | 43 | 9 |
143,435 | public static final String printExtendedAttributeCurrency ( Number value ) { return ( value == null ? null : NUMBER_FORMAT . get ( ) . format ( value . doubleValue ( ) * 100 ) ) ; } | Print an extended attribute currency value . | 47 | 7 |
143,436 | public static final Number parseExtendedAttributeCurrency ( String value ) { Number result ; if ( value == null ) { result = null ; } else { result = NumberHelper . getDouble ( Double . parseDouble ( correctNumberFormat ( value ) ) / 100 ) ; } return result ; } | Parse an extended attribute currency value . | 61 | 8 |
143,437 | public static final Boolean parseExtendedAttributeBoolean ( String value ) { return ( ( value . equals ( "1" ) ? Boolean . TRUE : Boolean . FALSE ) ) ; } | Parse an extended attribute boolean value . | 38 | 8 |
143,438 | public static final String printExtendedAttributeDate ( Date value ) { return ( value == null ? null : DATE_FORMAT . get ( ) . format ( value ) ) ; } | Print an extended attribute date value . | 39 | 7 |
143,439 | public static final Date parseExtendedAttributeDate ( String value ) { Date result = null ; if ( value != null ) { try { result = DATE_FORMAT . get ( ) . parse ( value ) ; } catch ( ParseException ex ) { // ignore exceptions } } return ( result ) ; } | Parse an extended attribute date value . | 65 | 8 |
143,440 | public static final String printExtendedAttribute ( MSPDIWriter writer , Object value , DataType type ) { String result ; if ( type == DataType . DATE ) { result = printExtendedAttributeDate ( ( Date ) value ) ; } else { if ( value instanceof Boolean ) { result = printExtendedAttributeBoolean ( ( Boolean ) value ) ; } else { if ( value instanceof Duration ) { result = printDuration ( writer , ( Duration ) value ) ; } else { if ( type == DataType . CURRENCY ) { result = printExtendedAttributeCurrency ( ( Number ) value ) ; } else { if ( value instanceof Number ) { result = printExtendedAttributeNumber ( ( Number ) value ) ; } else { result = value . toString ( ) ; } } } } } return ( result ) ; } | Print an extended attribute value . | 179 | 6 |
143,441 | public static final void parseExtendedAttribute ( ProjectFile file , FieldContainer mpx , String value , FieldType mpxFieldID , TimeUnit durationFormat ) { if ( mpxFieldID != null ) { switch ( mpxFieldID . getDataType ( ) ) { case STRING : { mpx . set ( mpxFieldID , value ) ; break ; } case DATE : { mpx . set ( mpxFieldID , parseExtendedAttributeDate ( value ) ) ; break ; } case CURRENCY : { mpx . set ( mpxFieldID , parseExtendedAttributeCurrency ( value ) ) ; break ; } case BOOLEAN : { mpx . set ( mpxFieldID , parseExtendedAttributeBoolean ( value ) ) ; break ; } case NUMERIC : { mpx . set ( mpxFieldID , parseExtendedAttributeNumber ( value ) ) ; break ; } case DURATION : { mpx . set ( mpxFieldID , parseDuration ( file , durationFormat , value ) ) ; break ; } default : { break ; } } } } | Parse an extended attribute value . | 237 | 7 |
143,442 | public static final String printCurrencySymbolPosition ( CurrencySymbolPosition value ) { String result ; switch ( value ) { default : case BEFORE : { result = "0" ; break ; } case AFTER : { result = "1" ; break ; } case BEFORE_WITH_SPACE : { result = "2" ; break ; } case AFTER_WITH_SPACE : { result = "3" ; break ; } } return ( result ) ; } | Prints a currency symbol position value . | 99 | 8 |
143,443 | public static final CurrencySymbolPosition parseCurrencySymbolPosition ( String value ) { CurrencySymbolPosition result = CurrencySymbolPosition . BEFORE ; switch ( NumberHelper . getInt ( value ) ) { case 0 : { result = CurrencySymbolPosition . BEFORE ; break ; } case 1 : { result = CurrencySymbolPosition . AFTER ; break ; } case 2 : { result = CurrencySymbolPosition . BEFORE_WITH_SPACE ; break ; } case 3 : { result = CurrencySymbolPosition . AFTER_WITH_SPACE ; break ; } } return ( result ) ; } | Parse a currency symbol position value . | 126 | 8 |
143,444 | public static final String printAccrueType ( AccrueType value ) { return ( Integer . toString ( value == null ? AccrueType . PRORATED . getValue ( ) : value . getValue ( ) ) ) ; } | Print an accrue type . | 49 | 6 |
143,445 | public static final String printResourceType ( ResourceType value ) { return ( Integer . toString ( value == null ? ResourceType . WORK . getValue ( ) : value . getValue ( ) ) ) ; } | Print a resource type . | 44 | 5 |
143,446 | public static final String printWorkGroup ( WorkGroup value ) { return ( Integer . toString ( value == null ? WorkGroup . DEFAULT . getValue ( ) : value . getValue ( ) ) ) ; } | Print a work group . | 45 | 5 |
143,447 | public static final String printWorkContour ( WorkContour value ) { return ( Integer . toString ( value == null ? WorkContour . FLAT . getValue ( ) : value . getValue ( ) ) ) ; } | Print a work contour . | 48 | 6 |
143,448 | public static final String printBookingType ( BookingType value ) { return ( Integer . toString ( value == null ? BookingType . COMMITTED . getValue ( ) : value . getValue ( ) ) ) ; } | Print a booking type . | 49 | 5 |
143,449 | public static final String printTaskType ( TaskType value ) { return ( Integer . toString ( value == null ? TaskType . FIXED_UNITS . getValue ( ) : value . getValue ( ) ) ) ; } | Print a task type . | 48 | 5 |
143,450 | public static final BigInteger printEarnedValueMethod ( EarnedValueMethod value ) { return ( value == null ? BigInteger . valueOf ( EarnedValueMethod . PERCENT_COMPLETE . getValue ( ) ) : BigInteger . valueOf ( value . getValue ( ) ) ) ; } | Print an earned value method . | 63 | 6 |
143,451 | public static final BigDecimal printUnits ( Number value ) { return ( value == null ? BIGDECIMAL_ONE : new BigDecimal ( value . doubleValue ( ) / 100 ) ) ; } | Print units . | 44 | 3 |
143,452 | public static final Number parseUnits ( Number value ) { return ( value == null ? null : NumberHelper . getDouble ( value . doubleValue ( ) * 100 ) ) ; } | Parse units . | 38 | 4 |
143,453 | public static final BigInteger printTimeUnit ( TimeUnit value ) { return ( BigInteger . valueOf ( value == null ? TimeUnit . DAYS . getValue ( ) + 1 : value . getValue ( ) + 1 ) ) ; } | Print time unit . | 51 | 4 |
143,454 | public static final TimeUnit parseWorkUnits ( BigInteger value ) { TimeUnit result = TimeUnit . HOURS ; if ( value != null ) { switch ( value . intValue ( ) ) { case 1 : { result = TimeUnit . MINUTES ; break ; } case 3 : { result = TimeUnit . DAYS ; break ; } case 4 : { result = TimeUnit . WEEKS ; break ; } case 5 : { result = TimeUnit . MONTHS ; break ; } case 7 : { result = TimeUnit . YEARS ; break ; } default : case 2 : { result = TimeUnit . HOURS ; break ; } } } return ( result ) ; } | Parse work units . | 145 | 5 |
143,455 | public static final BigInteger printWorkUnits ( TimeUnit value ) { int result ; if ( value == null ) { value = TimeUnit . HOURS ; } switch ( value ) { case MINUTES : { result = 1 ; break ; } case DAYS : { result = 3 ; break ; } case WEEKS : { result = 4 ; break ; } case MONTHS : { result = 5 ; break ; } case YEARS : { result = 7 ; break ; } default : case HOURS : { result = 2 ; break ; } } return ( BigInteger . valueOf ( result ) ) ; } | Print work units . | 130 | 4 |
143,456 | public static final Double parseCurrency ( Number value ) { return ( value == null ? null : NumberHelper . getDouble ( value . doubleValue ( ) / 100 ) ) ; } | Parse currency . | 38 | 4 |
143,457 | public static final BigDecimal printCurrency ( Number value ) { return ( value == null || value . doubleValue ( ) == 0 ? null : new BigDecimal ( value . doubleValue ( ) * 100 ) ) ; } | Print currency . | 48 | 3 |
143,458 | public static final TimeUnit parseDurationTimeUnits ( BigInteger value , TimeUnit defaultValue ) { TimeUnit result = defaultValue ; if ( value != null ) { switch ( value . intValue ( ) ) { case 3 : case 35 : { result = TimeUnit . MINUTES ; break ; } case 4 : case 36 : { result = TimeUnit . ELAPSED_MINUTES ; break ; } case 5 : case 37 : { result = TimeUnit . HOURS ; break ; } case 6 : case 38 : { result = TimeUnit . ELAPSED_HOURS ; break ; } case 7 : case 39 : case 53 : { result = TimeUnit . DAYS ; break ; } case 8 : case 40 : { result = TimeUnit . ELAPSED_DAYS ; break ; } case 9 : case 41 : { result = TimeUnit . WEEKS ; break ; } case 10 : case 42 : { result = TimeUnit . ELAPSED_WEEKS ; break ; } case 11 : case 43 : { result = TimeUnit . MONTHS ; break ; } case 12 : case 44 : { result = TimeUnit . ELAPSED_MONTHS ; break ; } case 19 : case 51 : { result = TimeUnit . PERCENT ; break ; } case 20 : case 52 : { result = TimeUnit . ELAPSED_PERCENT ; break ; } default : { result = PARENT_FILE . get ( ) . getProjectProperties ( ) . getDefaultDurationUnits ( ) ; break ; } } } return ( result ) ; } | Parse duration time units . | 334 | 6 |
143,459 | public static final Priority parsePriority ( BigInteger priority ) { return ( priority == null ? null : Priority . getInstance ( priority . intValue ( ) ) ) ; } | Parse priority . | 36 | 4 |
143,460 | public static final BigInteger printPriority ( Priority priority ) { int result = Priority . MEDIUM ; if ( priority != null ) { result = priority . getValue ( ) ; } return ( BigInteger . valueOf ( result ) ) ; } | Print priority . | 51 | 3 |
143,461 | public static final Duration parseDurationInThousanthsOfMinutes ( ProjectProperties properties , Number value , TimeUnit targetTimeUnit ) { return parseDurationInFractionsOfMinutes ( properties , value , targetTimeUnit , 1000 ) ; } | Parse duration represented in thousandths of minutes . | 52 | 10 |
143,462 | public static final BigDecimal printDurationInDecimalThousandthsOfMinutes ( Duration duration ) { BigDecimal result = null ; if ( duration != null && duration . getDuration ( ) != 0 ) { result = BigDecimal . valueOf ( printDurationFractionsOfMinutes ( duration , 1000 ) ) ; } return result ; } | Print duration in thousandths of minutes . | 73 | 8 |
143,463 | public static final BigInteger printDurationInIntegerTenthsOfMinutes ( Duration duration ) { BigInteger result = null ; if ( duration != null && duration . getDuration ( ) != 0 ) { result = BigInteger . valueOf ( ( long ) printDurationFractionsOfMinutes ( duration , 10 ) ) ; } return result ; } | Print duration in tenths of minutes . | 72 | 8 |
143,464 | public static final UUID parseUUID ( String value ) { return value == null || value . isEmpty ( ) ? null : UUID . fromString ( value ) ; } | Convert the MSPDI representation of a UUID into a Java UUID instance . | 37 | 18 |
143,465 | private static final Duration parseDurationInFractionsOfMinutes ( ProjectProperties properties , Number value , TimeUnit targetTimeUnit , int factor ) { Duration result = null ; if ( value != null ) { result = Duration . getInstance ( value . intValue ( ) / factor , TimeUnit . MINUTES ) ; if ( targetTimeUnit != result . getUnits ( ) ) { result = result . convertUnits ( targetTimeUnit , properties ) ; } } return ( result ) ; } | Parse duration represented as an arbitrary fraction of minutes . | 105 | 11 |
143,466 | private static final double printDurationFractionsOfMinutes ( Duration duration , int factor ) { double result = 0 ; if ( duration != null ) { result = duration . getDuration ( ) ; switch ( duration . getUnits ( ) ) { case HOURS : case ELAPSED_HOURS : { result *= 60 ; break ; } case DAYS : { result *= ( 60 * 8 ) ; break ; } case ELAPSED_DAYS : { result *= ( 60 * 24 ) ; break ; } case WEEKS : { result *= ( 60 * 8 * 5 ) ; break ; } case ELAPSED_WEEKS : { result *= ( 60 * 24 * 7 ) ; break ; } case MONTHS : { result *= ( 60 * 8 * 5 * 4 ) ; break ; } case ELAPSED_MONTHS : { result *= ( 60 * 24 * 30 ) ; break ; } case YEARS : { result *= ( 60 * 8 * 5 * 52 ) ; break ; } case ELAPSED_YEARS : { result *= ( 60 * 24 * 365 ) ; break ; } default : { break ; } } } result *= factor ; return ( result ) ; } | Print a duration represented by an arbitrary fraction of minutes . | 264 | 11 |
143,467 | public static final BigDecimal printRate ( Rate rate ) { BigDecimal result = null ; if ( rate != null && rate . getAmount ( ) != 0 ) { result = new BigDecimal ( rate . getAmount ( ) ) ; } return result ; } | Print rate . | 56 | 3 |
143,468 | public static final Rate parseRate ( BigDecimal value ) { Rate result = null ; if ( value != null ) { result = new Rate ( value , TimeUnit . HOURS ) ; } return ( result ) ; } | Parse rate . | 46 | 4 |
143,469 | public static final BigInteger printDay ( Day day ) { return ( day == null ? null : BigInteger . valueOf ( day . getValue ( ) - 1 ) ) ; } | Print a day . | 38 | 4 |
143,470 | public static final BigInteger printConstraintType ( ConstraintType value ) { return ( value == null ? null : BigInteger . valueOf ( value . getValue ( ) ) ) ; } | Print a constraint type . | 42 | 5 |
143,471 | public static final String printTaskUID ( Integer value ) { ProjectFile file = PARENT_FILE . get ( ) ; if ( file != null ) { file . getEventManager ( ) . fireTaskWrittenEvent ( file . getTaskByUniqueID ( value ) ) ; } return ( value . toString ( ) ) ; } | Print a task UID . | 69 | 5 |
143,472 | public static final String printResourceUID ( Integer value ) { ProjectFile file = PARENT_FILE . get ( ) ; if ( file != null ) { file . getEventManager ( ) . fireResourceWrittenEvent ( file . getResourceByUniqueID ( value ) ) ; } return ( value . toString ( ) ) ; } | Print a resource UID . | 69 | 5 |
143,473 | public static final Boolean parseBoolean ( String value ) { return ( value == null || value . charAt ( 0 ) != ' ' ? Boolean . FALSE : Boolean . TRUE ) ; } | Parse a boolean . | 39 | 5 |
143,474 | public static final String printDateTime ( Date value ) { return ( value == null ? null : DATE_FORMAT . get ( ) . format ( value ) ) ; } | Print a date time value . | 37 | 6 |
143,475 | private static final String correctNumberFormat ( String value ) { String result ; int index = value . indexOf ( ' ' ) ; if ( index == - 1 ) { result = value ; } else { char [ ] chars = value . toCharArray ( ) ; chars [ index ] = ' ' ; result = new String ( chars ) ; } return result ; } | Detect numbers using comma as a decimal separator and replace with period . | 76 | 14 |
143,476 | public static final ProjectFile setProjectNameAndRead ( File directory ) throws MPXJException { List < String > projects = listProjectNames ( directory ) ; if ( ! projects . isEmpty ( ) ) { P3DatabaseReader reader = new P3DatabaseReader ( ) ; reader . setProjectName ( projects . get ( 0 ) ) ; return reader . read ( directory ) ; } return null ; } | Convenience method which locates the first P3 database in a directory and opens it . | 85 | 19 |
143,477 | public static final List < String > listProjectNames ( File directory ) { List < String > result = new ArrayList < String > ( ) ; File [ ] files = directory . listFiles ( new FilenameFilter ( ) { @ Override public boolean accept ( File dir , String name ) { return name . toUpperCase ( ) . endsWith ( "STR.P3" ) ; } } ) ; if ( files != null ) { for ( File file : files ) { String fileName = file . getName ( ) ; String prefix = fileName . substring ( 0 , fileName . length ( ) - 6 ) ; result . add ( prefix ) ; } } Collections . sort ( result ) ; return result ; } | Retrieve a list of the available P3 project names from a directory . | 153 | 15 |
143,478 | private void readProjectHeader ( ) { Table table = m_tables . get ( "DIR" ) ; MapRow row = table . find ( "" ) ; if ( row != null ) { setFields ( PROJECT_FIELDS , row , m_projectFile . getProjectProperties ( ) ) ; m_wbsFormat = new P3WbsFormat ( row ) ; } } | Read general project properties . | 85 | 5 |
143,479 | private void readWBS ( ) { Map < Integer , List < MapRow > > levelMap = new HashMap < Integer , List < MapRow > > ( ) ; for ( MapRow row : m_tables . get ( "STR" ) ) { Integer level = row . getInteger ( "LEVEL_NUMBER" ) ; List < MapRow > items = levelMap . get ( level ) ; if ( items == null ) { items = new ArrayList < MapRow > ( ) ; levelMap . put ( level , items ) ; } items . add ( row ) ; } int level = 1 ; while ( true ) { List < MapRow > items = levelMap . get ( Integer . valueOf ( level ++ ) ) ; if ( items == null ) { break ; } for ( MapRow row : items ) { m_wbsFormat . parseRawValue ( row . getString ( "CODE_VALUE" ) ) ; String parentWbsValue = m_wbsFormat . getFormattedParentValue ( ) ; String wbsValue = m_wbsFormat . getFormattedValue ( ) ; row . setObject ( "WBS" , wbsValue ) ; row . setObject ( "PARENT_WBS" , parentWbsValue ) ; } final AlphanumComparator comparator = new AlphanumComparator ( ) ; Collections . sort ( items , new Comparator < MapRow > ( ) { @ Override public int compare ( MapRow o1 , MapRow o2 ) { return comparator . compare ( o1 . getString ( "WBS" ) , o2 . getString ( "WBS" ) ) ; } } ) ; for ( MapRow row : items ) { String wbs = row . getString ( "WBS" ) ; if ( wbs != null && ! wbs . isEmpty ( ) ) { ChildTaskContainer parent = m_wbsMap . get ( row . getString ( "PARENT_WBS" ) ) ; if ( parent == null ) { parent = m_projectFile ; } Task task = parent . addTask ( ) ; String name = row . getString ( "CODE_TITLE" ) ; if ( name == null || name . isEmpty ( ) ) { name = wbs ; } task . setName ( name ) ; task . setWBS ( wbs ) ; task . setSummary ( true ) ; m_wbsMap . put ( wbs , task ) ; } } } } | Read tasks representing the WBS . | 535 | 7 |
143,480 | private void readRelationships ( ) { for ( MapRow row : m_tables . get ( "REL" ) ) { Task predecessor = m_activityMap . get ( row . getString ( "PREDECESSOR_ACTIVITY_ID" ) ) ; Task successor = m_activityMap . get ( row . getString ( "SUCCESSOR_ACTIVITY_ID" ) ) ; if ( predecessor != null && successor != null ) { Duration lag = row . getDuration ( "LAG_VALUE" ) ; RelationType type = row . getRelationType ( "LAG_TYPE" ) ; successor . addPredecessor ( predecessor , type , lag ) ; } } } | Read task relationships . | 152 | 4 |
143,481 | private void setFields ( Map < String , FieldType > map , MapRow row , FieldContainer container ) { if ( row != null ) { for ( Map . Entry < String , FieldType > entry : map . entrySet ( ) ) { container . set ( entry . getValue ( ) , row . getObject ( entry . getKey ( ) ) ) ; } } } | Set the value of one or more fields based on the contents of a database row . | 80 | 17 |
143,482 | private static void defineField ( Map < String , FieldType > container , String name , FieldType type ) { defineField ( container , name , type , null ) ; } | Configure the mapping between a database column and a field . | 36 | 12 |
143,483 | private static void dumpTree ( PrintWriter pw , DirectoryEntry dir , String prefix , boolean showData , boolean hex , String indent ) throws Exception { long byteCount ; for ( Iterator < Entry > iter = dir . getEntries ( ) ; iter . hasNext ( ) ; ) { Entry entry = iter . next ( ) ; if ( entry instanceof DirectoryEntry ) { String childIndent = indent ; if ( childIndent != null ) { childIndent += " " ; } String childPrefix = prefix + "[" + entry . getName ( ) + "]." ; pw . println ( "start dir: " + prefix + entry . getName ( ) ) ; dumpTree ( pw , ( DirectoryEntry ) entry , childPrefix , showData , hex , childIndent ) ; pw . println ( "end dir: " + prefix + entry . getName ( ) ) ; } else if ( entry instanceof DocumentEntry ) { if ( showData ) { pw . println ( "start doc: " + prefix + entry . getName ( ) ) ; if ( hex == true ) { byteCount = hexdump ( new DocumentInputStream ( ( DocumentEntry ) entry ) , pw ) ; } else { byteCount = asciidump ( new DocumentInputStream ( ( DocumentEntry ) entry ) , pw ) ; } pw . println ( "end doc: " + prefix + entry . getName ( ) + " (" + byteCount + " bytes read)" ) ; } else { if ( indent != null ) { pw . print ( indent ) ; } pw . println ( "doc: " + prefix + entry . getName ( ) ) ; } } else { pw . println ( "found unknown: " + prefix + entry . getName ( ) ) ; } } } | This method recursively descends the directory structure dumping details of any files it finds to the output file . | 385 | 22 |
143,484 | private static long hexdump ( InputStream is , PrintWriter pw ) throws Exception { byte [ ] buffer = new byte [ BUFFER_SIZE ] ; long byteCount = 0 ; char c ; int loop ; int count ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { count = is . read ( buffer ) ; if ( count == - 1 ) { break ; } byteCount += count ; sb . setLength ( 0 ) ; for ( loop = 0 ; loop < count ; loop ++ ) { sb . append ( " " ) ; sb . append ( HEX_DIGITS [ ( buffer [ loop ] & 0xF0 ) >> 4 ] ) ; sb . append ( HEX_DIGITS [ buffer [ loop ] & 0x0F ] ) ; } while ( loop < BUFFER_SIZE ) { sb . append ( " " ) ; ++ loop ; } sb . append ( " " ) ; for ( loop = 0 ; loop < count ; loop ++ ) { c = ( char ) buffer [ loop ] ; if ( c > 200 || c < 27 ) { c = ' ' ; } sb . append ( c ) ; } pw . println ( sb . toString ( ) ) ; } return ( byteCount ) ; } | This method dumps the entire contents of a file to an output print writer as hex and ASCII data . | 277 | 20 |
143,485 | private static long asciidump ( InputStream is , PrintWriter pw ) throws Exception { byte [ ] buffer = new byte [ BUFFER_SIZE ] ; long byteCount = 0 ; char c ; int loop ; int count ; StringBuilder sb = new StringBuilder ( ) ; while ( true ) { count = is . read ( buffer ) ; if ( count == - 1 ) { break ; } byteCount += count ; sb . setLength ( 0 ) ; for ( loop = 0 ; loop < count ; loop ++ ) { c = ( char ) buffer [ loop ] ; if ( c > 200 || c < 27 ) { c = ' ' ; } sb . append ( c ) ; } pw . print ( sb . toString ( ) ) ; } return ( byteCount ) ; } | This method dumps the entire contents of a file to an output print writer as ascii data . | 171 | 20 |
143,486 | protected void mergeSameCost ( LinkedList < TimephasedCost > list ) { LinkedList < TimephasedCost > result = new LinkedList < TimephasedCost > ( ) ; TimephasedCost previousAssignment = null ; for ( TimephasedCost assignment : list ) { if ( previousAssignment == null ) { assignment . setAmountPerDay ( assignment . getTotalAmount ( ) ) ; result . add ( assignment ) ; } else { Number previousAssignmentCost = previousAssignment . getAmountPerDay ( ) ; Number assignmentCost = assignment . getTotalAmount ( ) ; if ( NumberHelper . equals ( previousAssignmentCost . doubleValue ( ) , assignmentCost . doubleValue ( ) , 0.01 ) ) { Date assignmentStart = previousAssignment . getStart ( ) ; Date assignmentFinish = assignment . getFinish ( ) ; double total = previousAssignment . getTotalAmount ( ) . doubleValue ( ) ; total += assignmentCost . doubleValue ( ) ; TimephasedCost merged = new TimephasedCost ( ) ; merged . setStart ( assignmentStart ) ; merged . setFinish ( assignmentFinish ) ; merged . setAmountPerDay ( assignmentCost ) ; merged . setTotalAmount ( Double . valueOf ( total ) ) ; result . removeLast ( ) ; assignment = merged ; } else { assignment . setAmountPerDay ( assignment . getTotalAmount ( ) ) ; } result . add ( assignment ) ; } previousAssignment = assignment ; } list . clear ( ) ; list . addAll ( result ) ; } | This method merges together assignment data for the same cost . | 329 | 12 |
143,487 | @ Override public void write ( ProjectFile projectFile , OutputStream out ) throws IOException { m_projectFile = projectFile ; m_eventManager = projectFile . getEventManager ( ) ; m_writer = new PrintStream ( out ) ; // the print stream class is the easiest way to create a text file m_buffer = new StringBuilder ( ) ; try { write ( ) ; // method call a method, this is how MPXJ is structured, so I followed the lead? } // catch (Exception e) // { // used during console debugging // System.out.println("Caught Exception in SDEFWriter.java"); // System.out.println(" " + e.toString()); // } finally { // keeps things cool after we're done m_writer = null ; m_projectFile = null ; m_buffer = null ; } } | Write a project file in SDEF format to an output stream . | 182 | 13 |
143,488 | private void writeProjectProperties ( ProjectProperties record ) throws IOException { // the ProjectProperties class from MPXJ has the details of how many days per week etc.... // so I've assigned these variables in here, but actually use them in other methods // see the write task method, that's where they're used, but that method only has a Task object m_minutesPerDay = record . getMinutesPerDay ( ) . doubleValue ( ) ; m_minutesPerWeek = record . getMinutesPerWeek ( ) . doubleValue ( ) ; m_daysPerMonth = record . getDaysPerMonth ( ) . doubleValue ( ) ; // reset buffer to be empty, then concatenate data as required by USACE m_buffer . setLength ( 0 ) ; m_buffer . append ( "PROJ " ) ; m_buffer . append ( m_formatter . format ( record . getStartDate ( ) ) . toUpperCase ( ) + " " ) ; // DataDate m_buffer . append ( SDEFmethods . lset ( record . getManager ( ) , 4 ) + " " ) ; // ProjIdent m_buffer . append ( SDEFmethods . lset ( record . getProjectTitle ( ) , 48 ) + " " ) ; // ProjName m_buffer . append ( SDEFmethods . lset ( record . getSubject ( ) , 36 ) + " " ) ; // ContrName m_buffer . append ( "P " ) ; // ArrowP m_buffer . append ( SDEFmethods . lset ( record . getKeywords ( ) , 7 ) ) ; // ContractNum m_buffer . append ( m_formatter . format ( record . getStartDate ( ) ) . toUpperCase ( ) + " " ) ; // ProjStart m_buffer . append ( m_formatter . format ( record . getFinishDate ( ) ) . toUpperCase ( ) ) ; // ProjEnd m_writer . println ( m_buffer ) ; } | Write project properties . | 438 | 4 |
143,489 | private void writeCalendars ( List < ProjectCalendar > records ) { // // Write project calendars // for ( ProjectCalendar record : records ) { m_buffer . setLength ( 0 ) ; m_buffer . append ( "CLDR " ) ; m_buffer . append ( SDEFmethods . lset ( record . getUniqueID ( ) . toString ( ) , 2 ) ) ; // 2 character used, USACE allows 1 String workDays = SDEFmethods . workDays ( record ) ; // custom line, like NYYYYYN for a week m_buffer . append ( SDEFmethods . lset ( workDays , 8 ) ) ; m_buffer . append ( SDEFmethods . lset ( record . getName ( ) , 30 ) ) ; m_writer . println ( m_buffer ) ; } } | This will create a line in the SDEF file for each calendar if there are more than 9 calendars you ll have a big error as USACE numbers them 0 - 9 . | 179 | 35 |
143,490 | private void writeExceptions ( List < ProjectCalendar > records ) throws IOException { for ( ProjectCalendar record : records ) { if ( ! record . getCalendarExceptions ( ) . isEmpty ( ) ) { // Need to move HOLI up here and get 15 exceptions per line as per USACE spec. // for now, we'll write one line for each calendar exception, hope there aren't too many // // changing this would be a serious upgrade, too much coding to do today.... for ( ProjectCalendarException ex : record . getCalendarExceptions ( ) ) { writeCalendarException ( record , ex ) ; } } m_eventManager . fireCalendarWrittenEvent ( record ) ; // left here from MPX template, maybe not needed??? } } | Write calendar exceptions . | 163 | 4 |
143,491 | private void writeTaskPredecessors ( Task record ) { m_buffer . setLength ( 0 ) ; // // Write the task predecessor // if ( ! record . getSummary ( ) && ! record . getPredecessors ( ) . isEmpty ( ) ) { // I don't use summary tasks for SDEF m_buffer . append ( "PRED " ) ; List < Relation > predecessors = record . getPredecessors ( ) ; for ( Relation pred : predecessors ) { m_buffer . append ( SDEFmethods . rset ( pred . getSourceTask ( ) . getUniqueID ( ) . toString ( ) , 10 ) + " " ) ; m_buffer . append ( SDEFmethods . rset ( pred . getTargetTask ( ) . getUniqueID ( ) . toString ( ) , 10 ) + " " ) ; String type = "C" ; // default finish-to-start if ( ! pred . getType ( ) . toString ( ) . equals ( "FS" ) ) { type = pred . getType ( ) . toString ( ) . substring ( 0 , 1 ) ; } m_buffer . append ( type + " " ) ; Duration dd = pred . getLag ( ) ; double duration = dd . getDuration ( ) ; if ( dd . getUnits ( ) != TimeUnit . DAYS ) { dd = Duration . convertUnits ( duration , dd . getUnits ( ) , TimeUnit . DAYS , m_minutesPerDay , m_minutesPerWeek , m_daysPerMonth ) ; } Double days = Double . valueOf ( dd . getDuration ( ) + 0.5 ) ; // Add 0.5 so half day rounds up upon truncation Integer est = Integer . valueOf ( days . intValue ( ) ) ; m_buffer . append ( SDEFmethods . rset ( est . toString ( ) , 4 ) + " " ) ; // task duration in days required by USACE } m_writer . println ( m_buffer . toString ( ) ) ; } } | Write each predecessor for a task . | 443 | 7 |
143,492 | private Duration getAssignmentWork ( ProjectCalendar calendar , TimephasedWork assignment ) { Date assignmentStart = assignment . getStart ( ) ; Date splitStart = assignmentStart ; Date splitFinishTime = calendar . getFinishTime ( splitStart ) ; Date splitFinish = DateHelper . setTime ( splitStart , splitFinishTime ) ; Duration calendarSplitWork = calendar . getWork ( splitStart , splitFinish , TimeUnit . MINUTES ) ; Duration assignmentWorkPerDay = assignment . getAmountPerDay ( ) ; Duration splitWork ; double splitMinutes = assignmentWorkPerDay . getDuration ( ) ; splitMinutes *= calendarSplitWork . getDuration ( ) ; splitMinutes /= ( 8 * 60 ) ; // this appears to be a fixed value splitWork = Duration . getInstance ( splitMinutes , TimeUnit . MINUTES ) ; return splitWork ; } | Retrieves the pro - rata work carried out on a given day . | 186 | 16 |
143,493 | private Map < Integer , List < Row > > createWorkPatternAssignmentMap ( List < Row > rows ) throws ParseException { Map < Integer , List < Row > > map = new HashMap < Integer , List < Row > > ( ) ; for ( Row row : rows ) { Integer calendarID = row . getInteger ( "ID" ) ; String workPatterns = row . getString ( "WORK_PATTERNS" ) ; map . put ( calendarID , createWorkPatternAssignmentRowList ( workPatterns ) ) ; } return map ; } | Create the work pattern assignment map . | 121 | 7 |
143,494 | private List < Row > createWorkPatternAssignmentRowList ( String workPatterns ) throws ParseException { List < Row > list = new ArrayList < Row > ( ) ; String [ ] patterns = workPatterns . split ( ",|:" ) ; int index = 1 ; while ( index < patterns . length ) { Integer workPattern = Integer . valueOf ( patterns [ index + 1 ] ) ; Date startDate = DatatypeConverter . parseBasicTimestamp ( patterns [ index + 3 ] ) ; Date endDate = DatatypeConverter . parseBasicTimestamp ( patterns [ index + 4 ] ) ; Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( "WORK_PATTERN" , workPattern ) ; map . put ( "START_DATE" , startDate ) ; map . put ( "END_DATE" , endDate ) ; list . add ( new MapRow ( map ) ) ; index += 5 ; } return list ; } | Extract a list of work pattern assignments . | 220 | 9 |
143,495 | private Map < Integer , List < Row > > createExceptionAssignmentMap ( List < Row > rows ) { Map < Integer , List < Row > > map = new HashMap < Integer , List < Row > > ( ) ; for ( Row row : rows ) { Integer calendarID = row . getInteger ( "ID" ) ; String exceptions = row . getString ( "EXCEPTIONS" ) ; map . put ( calendarID , createExceptionAssignmentRowList ( exceptions ) ) ; } return map ; } | Create the exception assignment map . | 108 | 6 |
143,496 | private List < Row > createExceptionAssignmentRowList ( String exceptionData ) { List < Row > list = new ArrayList < Row > ( ) ; String [ ] exceptions = exceptionData . split ( ",|:" ) ; int index = 1 ; while ( index < exceptions . length ) { Date startDate = DatatypeConverter . parseEpochTimestamp ( exceptions [ index + 0 ] ) ; Date endDate = DatatypeConverter . parseEpochTimestamp ( exceptions [ index + 1 ] ) ; //Integer exceptionTypeID = Integer.valueOf(exceptions[index + 2]); Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( "STARU_DATE" , startDate ) ; map . put ( "ENE_DATE" , endDate ) ; list . add ( new MapRow ( map ) ) ; index += 3 ; } return list ; } | Extract a list of exception assignments . | 200 | 8 |
143,497 | private Map < Integer , List < Row > > createTimeEntryMap ( List < Row > rows ) throws ParseException { Map < Integer , List < Row > > map = new HashMap < Integer , List < Row > > ( ) ; for ( Row row : rows ) { Integer workPatternID = row . getInteger ( "ID" ) ; String shifts = row . getString ( "SHIFTS" ) ; map . put ( workPatternID , createTimeEntryRowList ( shifts ) ) ; } return map ; } | Create the time entry map . | 112 | 6 |
143,498 | private List < Row > createTimeEntryRowList ( String shiftData ) throws ParseException { List < Row > list = new ArrayList < Row > ( ) ; String [ ] shifts = shiftData . split ( ",|:" ) ; int index = 1 ; while ( index < shifts . length ) { index += 2 ; int entryCount = Integer . parseInt ( shifts [ index ] ) ; index ++ ; for ( int entryIndex = 0 ; entryIndex < entryCount ; entryIndex ++ ) { Integer exceptionTypeID = Integer . valueOf ( shifts [ index + 0 ] ) ; Date startTime = DatatypeConverter . parseBasicTime ( shifts [ index + 1 ] ) ; Date endTime = DatatypeConverter . parseBasicTime ( shifts [ index + 2 ] ) ; Map < String , Object > map = new HashMap < String , Object > ( ) ; map . put ( "START_TIME" , startTime ) ; map . put ( "END_TIME" , endTime ) ; map . put ( "EXCEPTIOP" , exceptionTypeID ) ; list . add ( new MapRow ( map ) ) ; index += 3 ; } } return list ; } | Extract a list of time entries . | 255 | 8 |
143,499 | private ColumnDefinition [ ] columnDefinitions ( ColumnDefinition [ ] columns , String [ ] order ) { Map < String , ColumnDefinition > map = makeColumnMap ( columns ) ; ColumnDefinition [ ] result = new ColumnDefinition [ order . length ] ; for ( int index = 0 ; index < order . length ; index ++ ) { result [ index ] = map . get ( order [ index ] ) ; } return result ; } | Generate an ordered set of column definitions from an ordered set of column names . | 89 | 16 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.