idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
20,700 | public List < TimephasedCost > getTimephasedCost ( ) { if ( m_timephasedCost == null ) { Resource r = getResource ( ) ; ResourceType type = r != null ? r . getType ( ) : ResourceType . WORK ; if ( type != ResourceType . COST ) { if ( m_timephasedWork != null && m_timephasedWork . hasData ( ) ) { if ( hasMultipleCostRat... | Retrieves the timephased breakdown of cost . |
20,701 | public List < TimephasedCost > getTimephasedActualCost ( ) { if ( m_timephasedActualCost == null ) { Resource r = getResource ( ) ; ResourceType type = r != null ? r . getType ( ) : ResourceType . WORK ; if ( type != ResourceType . COST ) { if ( m_timephasedActualWork != null && m_timephasedActualWork . hasData ( ) ) {... | Retrieves the timephased breakdown of actual cost . |
20,702 | private List < TimephasedCost > getTimephasedCostMultipleRates ( List < TimephasedWork > standardWorkList , List < TimephasedWork > overtimeWorkList ) { List < TimephasedWork > standardWorkResult = new LinkedList < TimephasedWork > ( ) ; List < TimephasedWork > overtimeWorkResult = new LinkedList < TimephasedWork > ( )... | Generates timephased costs from timephased work where multiple cost rates apply to the assignment . |
20,703 | private List < TimephasedCost > getTimephasedCostFixedAmount ( ) { List < TimephasedCost > result = new LinkedList < TimephasedCost > ( ) ; ProjectCalendar cal = getCalendar ( ) ; double remainingCost = getRemainingCost ( ) . doubleValue ( ) ; if ( remainingCost > 0 ) { AccrueType accrueAt = getResource ( ) . getAccrue... | Generates timephased costs from the assignment s cost value . Used for Cost type Resources . |
20,704 | private List < TimephasedCost > getTimephasedActualCostFixedAmount ( ) { List < TimephasedCost > result = new LinkedList < TimephasedCost > ( ) ; double actualCost = getActualCost ( ) . doubleValue ( ) ; if ( actualCost > 0 ) { AccrueType accrueAt = getResource ( ) . getAccrueAt ( ) ; if ( accrueAt == AccrueType . STAR... | Generates timephased actual costs from the assignment s cost value . Used for Cost type Resources . |
20,705 | private List < TimephasedWork > splitWork ( CostRateTable table , ProjectCalendar calendar , TimephasedWork work , int rateIndex ) { List < TimephasedWork > result = new LinkedList < TimephasedWork > ( ) ; work . setTotalAmount ( Duration . getInstance ( 0 , work . getAmountPerDay ( ) . getUnits ( ) ) ) ; while ( true ... | Splits timephased work segments in line with cost rates . Note that this is an approximation - where a rate changes during a working day the second rate is used for the whole day . |
20,706 | private boolean hasMultipleCostRates ( ) { boolean result = false ; CostRateTable table = getCostRateTable ( ) ; if ( table != null ) { if ( table . size ( ) > 1 ) { CostRateTableEntry startEntry = table . getEntryByDate ( getStart ( ) ) ; CostRateTableEntry finishEntry = table . getEntryByDate ( getFinish ( ) ) ; resu... | Used to determine if multiple cost rates apply to this assignment . |
20,707 | private CostRateTableEntry getCostRateTableEntry ( Date date ) { CostRateTableEntry result ; CostRateTable table = getCostRateTable ( ) ; if ( table == null ) { Resource resource = getResource ( ) ; result = new CostRateTableEntry ( resource . getStandardRate ( ) , TimeUnit . HOURS , resource . getOvertimeRate ( ) , Ti... | Retrieves the cost rate table entry active on a given date . |
20,708 | private int getCostRateTableEntryIndex ( Date date ) { int result = - 1 ; CostRateTable table = getCostRateTable ( ) ; if ( table != null ) { if ( table . size ( ) == 1 ) { result = 0 ; } else { result = table . getIndexByDate ( date ) ; } } return result ; } | Retrieves the index of a cost rate table entry active on a given date . |
20,709 | public List < TimephasedWork > getTimephasedBaselineWork ( int index ) { return m_timephasedBaselineWork [ index ] == null ? null : m_timephasedBaselineWork [ index ] . getData ( ) ; } | Retrieve timephased baseline work . Note that index 0 represents Baseline index 1 represents Baseline1 and so on . |
20,710 | public List < TimephasedCost > getTimephasedBaselineCost ( int index ) { return m_timephasedBaselineCost [ index ] == null ? null : m_timephasedBaselineCost [ index ] . getData ( ) ; } | Retrieve timephased baseline cost . Note that index 0 represents Baseline index 1 represents Baseline1 and so on . |
20,711 | public ProjectCalendar getCalendar ( ) { ProjectCalendar calendar = null ; Resource resource = getResource ( ) ; if ( resource != null ) { calendar = resource . getResourceCalendar ( ) ; } Task task = getTask ( ) ; if ( calendar == null || task . getIgnoreResourceCalendar ( ) ) { calendar = task . getEffectiveCalendar ... | Retrieves the calendar used for this resource assignment . |
20,712 | public void setEnterpriseCost ( int index , Number value ) { set ( selectField ( AssignmentFieldLists . ENTERPRISE_COST , index ) , value ) ; } | Set an enterprise cost value . |
20,713 | public void setEnterpriseDate ( int index , Date value ) { set ( selectField ( AssignmentFieldLists . ENTERPRISE_DATE , index ) , value ) ; } | Set an enterprise date value . |
20,714 | public void setEnterpriseDuration ( int index , Duration value ) { set ( selectField ( AssignmentFieldLists . ENTERPRISE_DURATION , index ) , value ) ; } | Set an enterprise duration value . |
20,715 | public void setEnterpriseNumber ( int index , Number value ) { set ( selectField ( AssignmentFieldLists . ENTERPRISE_NUMBER , index ) , value ) ; } | Set an enterprise number value . |
20,716 | public void setEnterpriseText ( int index , String value ) { set ( selectField ( AssignmentFieldLists . ENTERPRISE_TEXT , index ) , value ) ; } | Set an enterprise text value . |
20,717 | public Number getOvertimeCost ( ) { Number cost = ( Number ) getCachedValue ( AssignmentField . OVERTIME_COST ) ; if ( cost == null ) { Number actual = getActualOvertimeCost ( ) ; Number remaining = getRemainingOvertimeCost ( ) ; if ( actual != null && remaining != null ) { cost = NumberHelper . getDouble ( actual . do... | Returns the overtime cost of this resource assignment . |
20,718 | public Number getPercentageWorkComplete ( ) { Number pct = ( Number ) getCachedValue ( AssignmentField . PERCENT_WORK_COMPLETE ) ; if ( pct == null ) { Duration actualWork = getActualWork ( ) ; Duration work = getWork ( ) ; if ( actualWork != null && work != null && work . getDuration ( ) != 0 ) { pct = Double . valueO... | The % Work Complete field contains the current status of a task expressed as the percentage of the task s work that has been completed . You can enter percent work complete or you can have Microsoft Project calculate it for you based on actual work on the task . |
20,719 | public Duration getStartVariance ( ) { Duration variance = ( Duration ) getCachedValue ( AssignmentField . START_VARIANCE ) ; if ( variance == null ) { TimeUnit format = getParentFile ( ) . getProjectProperties ( ) . getDefaultDurationUnits ( ) ; variance = DateHelper . getVariance ( getTask ( ) , getBaselineStart ( ) ... | Calculate the start variance . |
20,720 | public Duration getFinishVariance ( ) { Duration variance = ( Duration ) getCachedValue ( AssignmentField . FINISH_VARIANCE ) ; if ( variance == null ) { TimeUnit format = getParentFile ( ) . getProjectProperties ( ) . getDefaultDurationUnits ( ) ; variance = DateHelper . getVariance ( getTask ( ) , getBaselineFinish (... | Calculate the finish variance . |
20,721 | public int getCostRateTableIndex ( ) { Integer value = ( Integer ) getCachedValue ( AssignmentField . COST_RATE_TABLE ) ; return value == null ? 0 : value . intValue ( ) ; } | Returns the cost rate table index for this assignment . |
20,722 | private AssignmentField selectField ( AssignmentField [ ] fields , int index ) { if ( index < 1 || index > fields . length ) { throw new IllegalArgumentException ( index + " is not a valid field index" ) ; } return ( fields [ index - 1 ] ) ; } | Maps a field index to an AssignmentField instance . |
20,723 | public void sort ( ChildTaskContainer container ) { List < Task > tasks = container . getChildTasks ( ) ; if ( ! tasks . isEmpty ( ) ) { for ( Task task : tasks ) { sort ( task ) ; Collections . sort ( tasks , new Comparator < Task > ( ) { public int compare ( Task t1 , Task t2 ) { boolean t1IsWbs = m_wbsTasks . contai... | Recursively sort the supplied child tasks . |
20,724 | public void read ( File file , Table table ) throws IOException { InputStream is = null ; try { is = new FileInputStream ( file ) ; read ( is , table ) ; } finally { StreamHelper . closeQuietly ( is ) ; } } | Read the table from the file and populate the supplied Table instance . |
20,725 | private void readPage ( byte [ ] buffer , Table table ) { int magicNumber = getShort ( buffer , 0 ) ; if ( magicNumber == 0x4400 ) { int recordSize = m_definition . getRecordSize ( ) ; RowValidator rowValidator = m_definition . getRowValidator ( ) ; String primaryKeyColumnName = m_definition . getPrimaryKeyColumnName (... | Reads data from a single page of the database file . |
20,726 | private void populateMap ( byte [ ] data , Integer previousItemOffset , Integer previousItemKey , Integer itemOffset ) { if ( previousItemOffset != null ) { int itemSize = itemOffset . intValue ( ) - previousItemOffset . intValue ( ) ; byte [ ] itemData = new byte [ itemSize ] ; System . arraycopy ( data , previousItem... | Method used to extract data from the block of properties and insert the key value pair into a map . |
20,727 | public void viewDocument ( DocumentEntry entry ) { InputStream is = null ; try { is = new DocumentInputStream ( entry ) ; byte [ ] data = new byte [ is . available ( ) ] ; is . read ( data ) ; m_model . setData ( data ) ; updateTables ( ) ; } catch ( IOException ex ) { throw new RuntimeException ( ex ) ; } finally { St... | Command to select a document from the POIFS for viewing . |
20,728 | protected void updateTables ( ) { byte [ ] data = m_model . getData ( ) ; int columns = m_model . getColumns ( ) ; int rows = ( data . length / columns ) + 1 ; int offset = m_model . getOffset ( ) ; String [ ] [ ] hexData = new String [ rows ] [ columns ] ; String [ ] [ ] asciiData = new String [ rows ] [ columns ] ; i... | Update the content of the tables . |
20,729 | public static final FieldType getInstance ( int fieldID ) { FieldType result ; int prefix = fieldID & 0xFFFF0000 ; int index = fieldID & 0x0000FFFF ; switch ( prefix ) { case MPPTaskField . TASK_FIELD_BASE : { result = MPPTaskField . getInstance ( index ) ; if ( result == null ) { result = getPlaceholder ( TaskField . ... | Retrieve a FieldType instance based on an ID value from an MPP9 or MPP12 file . |
20,730 | private static FieldType getPlaceholder ( final Class < ? > type , final int fieldID ) { return new FieldType ( ) { public FieldTypeClass getFieldTypeClass ( ) { return FieldTypeClass . UNKNOWN ; } public String name ( ) { return "UNKNOWN" ; } public int getValue ( ) { return fieldID ; } public String getName ( ) { ret... | Generate a placeholder for an unknown type . |
20,731 | public static final boolean valueIsNotDefault ( FieldType type , Object value ) { boolean result = true ; if ( value == null ) { result = false ; } else { DataType dataType = type . getDataType ( ) ; switch ( dataType ) { case BOOLEAN : { result = ( ( Boolean ) value ) . booleanValue ( ) ; break ; } case CURRENCY : cas... | Determines if this value is the default value for the given field type . |
20,732 | public List < ProjectFile > readAll ( InputStream is , boolean linkCrossProjectRelations ) throws MPXJException { try { m_tables = new HashMap < String , List < Row > > ( ) ; m_numberFormat = new DecimalFormat ( ) ; processFile ( is ) ; List < Row > rows = getRows ( "project" , null , null ) ; List < ProjectFile > resu... | This is a convenience method which allows all projects in an XER file to be read in a single pass . |
20,733 | private void processFile ( InputStream is ) throws MPXJException { int line = 1 ; try { BufferedInputStream bis = new BufferedInputStream ( is ) ; byte [ ] data = new byte [ 6 ] ; data [ 0 ] = ( byte ) bis . read ( ) ; bis . mark ( 1024 ) ; bis . read ( data , 1 , 5 ) ; if ( ! new String ( data ) . equals ( "ERMHDR" ) ... | Reads the XER file table and row structure ready for processing . |
20,734 | private Charset getCharset ( ) { Charset result = m_charset ; if ( result == null ) { result = m_encoding == null ? CharsetHelper . CP1252 : Charset . forName ( m_encoding ) ; } return result ; } | Retrieve the Charset used to read the file . |
20,735 | private void processProjectID ( ) { if ( m_projectID == null ) { List < Row > rows = getRows ( "project" , null , null ) ; if ( ! rows . isEmpty ( ) ) { Row row = rows . get ( 0 ) ; m_projectID = row . getInteger ( "proj_id" ) ; } } } | If the user has not specified a project ID this method retrieves the ID of the first project in the file . |
20,736 | private void processCurrency ( Row row ) { String currencyName = row . getString ( "curr_short_name" ) ; DecimalFormatSymbols symbols = new DecimalFormatSymbols ( ) ; symbols . setDecimalSeparator ( row . getString ( "decimal_symbol" ) . charAt ( 0 ) ) ; symbols . setGroupingSeparator ( row . getString ( "digit_group_s... | Process a currency definition . |
20,737 | public Map < Integer , String > listProjects ( InputStream is ) throws MPXJException { try { m_tables = new HashMap < String , List < Row > > ( ) ; processFile ( is ) ; Map < Integer , String > result = new HashMap < Integer , String > ( ) ; List < Row > rows = getRows ( "project" , null , null ) ; for ( Row row : rows... | Populates a Map instance representing the IDs and names of projects available in the current file . |
20,738 | private void processScheduleOptions ( ) { List < Row > rows = getRows ( "schedoptions" , "proj_id" , m_projectID ) ; if ( rows . isEmpty ( ) == false ) { Row row = rows . get ( 0 ) ; Map < String , Object > customProperties = new HashMap < String , Object > ( ) ; customProperties . put ( "LagCalendar" , row . getString... | Process schedule options from SCHEDOPTIONS . This table only seems to exist in XER files not P6 databases . |
20,739 | private void readRecord ( Tokenizer tk , List < String > record ) throws IOException { record . clear ( ) ; while ( tk . nextToken ( ) == Tokenizer . TT_WORD ) { record . add ( tk . getToken ( ) ) ; } } | Reads each token from a single record and adds it to a list . |
20,740 | private boolean processRecord ( List < String > record ) throws MPXJException { boolean done = false ; XerRecordType type = RECORD_TYPE_MAP . get ( record . get ( 0 ) ) ; if ( type == null ) { throw new MPXJException ( MPXJException . INVALID_FORMAT ) ; } switch ( type ) { case HEADER : { processHeader ( record ) ; bre... | Handles a complete record at a time stores it in a form ready for further processing . |
20,741 | private List < Row > getRows ( String tableName , String columnName , Integer id ) { List < Row > result ; List < Row > table = m_tables . get ( tableName ) ; if ( table == null ) { result = Collections . < Row > emptyList ( ) ; } else { if ( columnName == null ) { result = table ; } else { result = new LinkedList < Ro... | Filters a list of rows from the named table . If a column name and a value are supplied then use this to filter the rows . If no column name is supplied then return all rows . |
20,742 | protected Object getTypedValue ( int type , byte [ ] value ) { Object result ; switch ( type ) { case 4 : { result = MPPUtility . getTimestamp ( value , 0 ) ; break ; } case 6 : { TimeUnit units = MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( value , 4 ) , m_properties . getDefaultDurationUnits ( ) ) ; re... | Convert raw value as read from the MPP file into a Java type . |
20,743 | public void addRow ( String primaryKeyColumnName , Map < String , Object > map ) { Integer rowNumber = Integer . valueOf ( m_rowNumber ++ ) ; map . put ( "ROW_NUMBER" , rowNumber ) ; Object primaryKey = null ; if ( primaryKeyColumnName != null ) { primaryKey = map . get ( primaryKeyColumnName ) ; } if ( primaryKey == n... | Add a row to the table . We have a limited understanding of the way Btrieve handles outdated rows so we use what we think is a version number to try to ensure that we only have the latest rows . |
20,744 | public static List < List < RTFEmbeddedObject > > getEmbeddedObjects ( String text ) { List < List < RTFEmbeddedObject > > objects = null ; List < RTFEmbeddedObject > objectData ; int offset = text . indexOf ( OBJDATA ) ; if ( offset != - 1 ) { objects = new LinkedList < List < RTFEmbeddedObject > > ( ) ; while ( offse... | This method generates a list of lists . Each list represents the data for an embedded object and contains set set of RTFEmbeddedObject instances that make up the embedded object . This method will return null if there are no embedded objects in the RTF document . |
20,745 | private int getInt ( List < byte [ ] > blocks ) { int result ; if ( blocks . isEmpty ( ) == false ) { byte [ ] data = blocks . remove ( 0 ) ; result = MPPUtility . getInt ( data , 0 ) ; } else { result = 0 ; } return ( result ) ; } | Internal method used to retrieve a integer from an embedded data block . |
20,746 | private byte [ ] getData ( List < byte [ ] > blocks , int length ) { byte [ ] result ; if ( blocks . isEmpty ( ) == false ) { if ( length < 4 ) { length = 4 ; } result = new byte [ length ] ; int offset = 0 ; byte [ ] data ; while ( offset < length ) { data = blocks . remove ( 0 ) ; System . arraycopy ( data , 0 , resu... | Internal method used to retrieve a byte array from one or more embedded data blocks . Consecutive data blocks may need to be concatenated by this method in order to retrieve the complete set of data . |
20,747 | private static int readObjectData ( int offset , String text , List < RTFEmbeddedObject > objects ) { LinkedList < byte [ ] > blocks = new LinkedList < byte [ ] > ( ) ; offset += ( OBJDATA . length ( ) ) ; offset = skipEndOfLine ( text , offset ) ; int length ; int lastOffset = offset ; while ( offset != - 1 ) { length... | This method extracts byte arrays from the embedded object data and converts them into RTFEmbeddedObject instances which it then adds to the supplied list . |
20,748 | private static int skipEndOfLine ( String text , int offset ) { char c ; boolean finished = false ; while ( finished == false ) { c = text . charAt ( offset ) ; switch ( c ) { case ' ' : case '\r' : case '\n' : { ++ offset ; break ; } case '}' : { offset = - 1 ; finished = true ; break ; } default : { finished = true ;... | This method skips the end - of - line markers in the RTF document . It also indicates if the end of the embedded object has been reached . |
20,749 | private static int getBlockLength ( String text , int offset ) { int startIndex = offset ; boolean finished = false ; char c ; while ( finished == false ) { c = text . charAt ( offset ) ; switch ( c ) { case '\r' : case '\n' : case '}' : { finished = true ; break ; } default : { ++ offset ; break ; } } } int length = o... | Calculates the length of the next block of RTF data . |
20,750 | private static int readDataBlock ( String text , int offset , int length , List < byte [ ] > blocks ) { int bytes = length / 2 ; byte [ ] data = new byte [ bytes ] ; for ( int index = 0 ; index < bytes ; index ++ ) { data [ index ] = ( byte ) Integer . parseInt ( text . substring ( offset , offset + 2 ) , 16 ) ; offset... | Reads a data block and adds it to the list of blocks . |
20,751 | private SubProject readSubProject ( byte [ ] data , int uniqueIDOffset , int filePathOffset , int fileNameOffset , int subprojectIndex ) { try { SubProject sp = new SubProject ( ) ; int type = SUBPROJECT_TASKUNIQUEID0 ; if ( uniqueIDOffset != - 1 ) { int value = MPPUtility . getInt ( data , uniqueIDOffset ) ; type = MP... | Method used to read the sub project details from a byte array . |
20,752 | private void readRecord ( byte [ ] buffer , Table table ) { int deletedFlag = getShort ( buffer , 0 ) ; if ( deletedFlag != 0 ) { Map < String , Object > row = new HashMap < String , Object > ( ) ; for ( ColumnDefinition column : m_definition . getColumns ( ) ) { Object value = column . read ( 0 , buffer ) ; row . put ... | Reads a single record from the table . |
20,753 | public static final void decodeBuffer ( byte [ ] data , byte encryptionCode ) { for ( int i = 0 ; i < data . length ; i ++ ) { data [ i ] = ( byte ) ( data [ i ] ^ encryptionCode ) ; } } | This method decodes a byte array with the given encryption code using XOR encryption . |
20,754 | public static final String decodePassword ( byte [ ] data , byte encryptionCode ) { String result ; if ( data . length < MINIMUM_PASSWORD_DATA_LENGTH ) { result = null ; } else { MPPUtility . decodeBuffer ( data , encryptionCode ) ; StringBuilder buffer = new StringBuilder ( ) ; char c ; for ( int i = 0 ; i < PASSWORD_... | Decode the password from the given data . Will decode the data block as well . |
20,755 | public static final void getByteArray ( byte [ ] data , int offset , int size , byte [ ] buffer , int bufferOffset ) { System . arraycopy ( data , offset , buffer , bufferOffset , size ) ; } | This method extracts a portion of a byte array and writes it into another byte array . |
20,756 | public static final long getLong6 ( byte [ ] data , int offset ) { long result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 48 ; shiftBy += 8 ) { result |= ( ( long ) ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; } | This method reads a six byte long from the input array . |
20,757 | public static final Date getTime ( byte [ ] data , int offset ) { int time = getShort ( data , offset ) / 10 ; Calendar cal = DateHelper . popCalendar ( EPOCH_DATE ) ; cal . set ( Calendar . HOUR_OF_DAY , ( time / 60 ) ) ; cal . set ( Calendar . MINUTE , ( time % 60 ) ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set... | Reads a time value . The time is represented as tenths of a minute since midnight . |
20,758 | public static final Date getTimestamp ( byte [ ] data , int offset ) { Date result ; long days = getShort ( data , offset + 2 ) ; if ( days < 100 ) { days = 0 ; } if ( days == 0 || days == 65535 ) { result = null ; } else { long time = getShort ( data , offset ) ; if ( time == 65535 ) { time = 0 ; } result = DateHelper... | Reads a combined date and time value . |
20,759 | public static final Date getTimestampFromTenths ( byte [ ] data , int offset ) { long ms = ( ( long ) getInt ( data , offset ) ) * 6000 ; return ( DateHelper . getTimestampFromLong ( EPOCH + ms ) ) ; } | Reads a combined date and time value expressed in tenths of a minute . |
20,760 | public static final String getUnicodeString ( byte [ ] data , int offset ) { int length = getUnicodeStringLengthInBytes ( data , offset ) ; return length == 0 ? "" : new String ( data , offset , length , CharsetHelper . UTF16LE ) ; } | Reads a string of two byte characters from the input array . This method assumes that the string finishes either at the end of the array or when char zero is encountered . The value starts at the position specified by the offset parameter . |
20,761 | private static final int getUnicodeStringLengthInBytes ( byte [ ] data , int offset ) { int result ; if ( data == null || offset >= data . length ) { result = 0 ; } else { result = data . length - offset ; for ( int loop = offset ; loop < ( data . length - 1 ) ; loop += 2 ) { if ( data [ loop ] == 0 && data [ loop + 1 ... | Determine the length of a nul terminated UTF16LE string in bytes . |
20,762 | public static final String getString ( byte [ ] data , int offset ) { StringBuilder buffer = new StringBuilder ( ) ; char c ; for ( int loop = 0 ; offset + loop < data . length ; loop ++ ) { c = ( char ) data [ offset + loop ] ; if ( c == 0 ) { break ; } buffer . append ( c ) ; } return ( buffer . toString ( ) ) ; } | Reads a string of single byte characters from the input array . This method assumes that the string finishes either at the end of the array or when char zero is encountered . Reading begins at the supplied offset into the array . |
20,763 | public static final Color getColor ( byte [ ] data , int offset ) { Color result = null ; if ( getByte ( data , offset + 3 ) == 0 ) { int r = getByte ( data , offset ) ; int g = getByte ( data , offset + 1 ) ; int b = getByte ( data , offset + 2 ) ; result = new Color ( r , g , b ) ; } return result ; } | Reads a color value represented by three bytes for R G and B components plus a flag byte indicating if this is an automatic color . Returns null if the color type is Automatic . |
20,764 | public static final String removeAmpersands ( String name ) { if ( name != null ) { if ( name . indexOf ( '&' ) != - 1 ) { StringBuilder sb = new StringBuilder ( ) ; int index = 0 ; char c ; while ( index < name . length ( ) ) { c = name . charAt ( index ) ; if ( c != '&' ) { sb . append ( c ) ; } ++ index ; } name = s... | Utility method to remove ampersands embedded in names . |
20,765 | public static final Double getPercentage ( byte [ ] data , int offset ) { int value = MPPUtility . getShort ( data , offset ) ; Double result = null ; if ( value >= 0 && value <= 100 ) { result = NumberHelper . getDouble ( value ) ; } return result ; } | Utility method to read a percentage value . |
20,766 | public static final byte [ ] cloneSubArray ( byte [ ] data , int offset , int size ) { byte [ ] newData = new byte [ size ] ; System . arraycopy ( data , offset , newData , 0 , size ) ; return ( newData ) ; } | This method allows a subsection of a byte array to be copied . |
20,767 | public static void dumpBlockData ( int headerSize , int blockSize , byte [ ] data ) { if ( data != null ) { System . out . println ( ByteArrayHelper . hexdump ( data , 0 , headerSize , false ) ) ; int index = headerSize ; while ( index < data . length ) { System . out . println ( ByteArrayHelper . hexdump ( data , inde... | Dumps the contents of a structured block made up from a header and fixed sized records . |
20,768 | public Duration getDuration ( Date startDate , Date endDate ) throws MPXJException { return ( getDuration ( "Standard" , startDate , endDate ) ) ; } | This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar . The calendar used is the Standard calendar . If this calendar does not exist and exception will be thrown . |
20,769 | public Duration getDuration ( String calendarName , Date startDate , Date endDate ) throws MPXJException { ProjectCalendar calendar = getCalendarByName ( calendarName ) ; if ( calendar == null ) { throw new MPXJException ( MPXJException . CALENDAR_ERROR + ": " + calendarName ) ; } return ( calendar . getDuration ( star... | This method is used to calculate the duration of work between two fixed dates according to the work schedule defined in the named calendar . The name of the calendar to be used is passed as an argument . |
20,770 | public Date getStartDate ( ) { Date startDate = null ; for ( Task task : m_tasks ) { if ( NumberHelper . getInt ( task . getUniqueID ( ) ) == 0 ) { continue ; } Date taskStartDate ; if ( task . getMilestone ( ) == true ) { taskStartDate = task . getActualFinish ( ) ; if ( taskStartDate == null ) { taskStartDate = task ... | Find the earliest task start date . We treat this as the start date for the project . |
20,771 | public Date getFinishDate ( ) { Date finishDate = null ; for ( Task task : m_tasks ) { if ( NumberHelper . getInt ( task . getUniqueID ( ) ) == 0 ) { continue ; } Date taskFinishDate ; taskFinishDate = task . getActualFinish ( ) ; if ( taskFinishDate == null ) { taskFinishDate = task . getFinish ( ) ; } if ( taskFinish... | Find the latest task finish date . We treat this as the finish date for the project . |
20,772 | public ProjectCalendar getDefaultCalendar ( ) { String calendarName = m_properties . getDefaultCalendarName ( ) ; ProjectCalendar calendar = getCalendarByName ( calendarName ) ; if ( calendar == null ) { if ( m_calendars . isEmpty ( ) ) { calendar = addDefaultBaseCalendar ( ) ; } else { calendar = m_calendars . get ( 0... | Retrieves the default calendar for this project based on the calendar name given in the project properties . If a calendar of this name cannot be found then the first calendar listed for the project will be returned . If the project contains no calendars then a default calendar is added . |
20,773 | public ProjectCalendar getBaselineCalendar ( ) { ProjectCalendar result = getCalendarByName ( "Used for Microsoft Project 98 Baseline Calendar" ) ; if ( result == null ) { result = getDefaultCalendar ( ) ; } return result ; } | Retrieve the calendar used internally for timephased baseline calculation . |
20,774 | public void process ( CustomFieldContainer indicators , ProjectProperties properties , Props props ) { m_container = indicators ; m_properties = properties ; m_data = props . getByteArray ( Props . TASK_FIELD_ATTRIBUTES ) ; if ( m_data != null ) { int columnsCount = MPPUtility . getInt ( m_data , 4 ) ; m_headerOffset =... | The main entry point for processing graphical indicator definitions . |
20,775 | private void processColumns ( ) { int fieldID = MPPUtility . getInt ( m_data , m_headerOffset ) ; m_headerOffset += 4 ; m_dataOffset = MPPUtility . getInt ( m_data , m_headerOffset ) ; m_headerOffset += 4 ; FieldType type = FieldTypeHelper . getInstance ( fieldID ) ; if ( type . getDataType ( ) != null ) { processKnown... | Processes graphical indicator definitions for each column . |
20,776 | private void processKnownType ( FieldType type ) { GraphicalIndicator indicator = m_container . getCustomField ( type ) . getGraphicalIndicator ( ) ; indicator . setFieldType ( type ) ; int flags = m_data [ m_dataOffset ] ; indicator . setProjectSummaryInheritsFromSummaryRows ( ( flags & 0x08 ) != 0 ) ; indicator . set... | Process a graphical indicator definition for a known type . |
20,777 | private GraphicalIndicatorCriteria processCriteria ( FieldType type ) { GraphicalIndicatorCriteria criteria = new GraphicalIndicatorCriteria ( m_properties ) ; criteria . setLeftValue ( type ) ; int indicatorType = MPPUtility . getInt ( m_data , m_dataOffset ) ; m_dataOffset += 4 ; criteria . setIndicator ( indicatorTy... | Process the graphical indicator criteria for a single column . |
20,778 | private void processOperandValue ( int index , FieldType type , GraphicalIndicatorCriteria criteria ) { boolean valueFlag = ( MPPUtility . getInt ( m_data , m_dataOffset ) == 1 ) ; m_dataOffset += 4 ; if ( valueFlag == false ) { int fieldID = MPPUtility . getInt ( m_data , m_dataOffset ) ; criteria . setRightValue ( in... | Process an operand value used in the definition of the graphical indicator criteria . |
20,779 | private GridLines getGridLines ( byte [ ] data , int offset ) { Color normalLineColor = ColorType . getInstance ( data [ offset ] ) . getColor ( ) ; LineStyle normalLineStyle = LineStyle . getInstance ( data [ offset + 3 ] ) ; int intervalNumber = data [ offset + 4 ] ; LineStyle intervalLineStyle = LineStyle . getInsta... | Creates a new GridLines instance . |
20,780 | public byte [ ] getByteArray ( Integer offset ) { byte [ ] result = null ; if ( offset != null ) { result = m_map . get ( offset ) ; } return ( result ) ; } | This method retrieves a byte array containing the data at the given offset in the block . If no data is found at the given offset this method returns null . |
20,781 | public byte [ ] getByteArray ( Integer id , Integer type ) { return ( getByteArray ( m_meta . getOffset ( id , type ) ) ) ; } | This method retrieves a byte array of the specified type belonging to the item with the specified unique ID . |
20,782 | public String getUnicodeString ( Integer id , Integer type ) { return ( getUnicodeString ( m_meta . getOffset ( id , type ) ) ) ; } | This method retrieves a String of the specified type belonging to the item with the specified unique ID . |
20,783 | public String getString ( Integer offset ) { String result = null ; if ( offset != null ) { byte [ ] value = m_map . get ( offset ) ; if ( value != null ) { result = MPPUtility . getString ( value , 0 ) ; } } return ( result ) ; } | This method retrieves the data at the given offset and returns it as a String assuming the underlying data is composed of single byte characters . |
20,784 | public String getString ( Integer id , Integer type ) { return ( getString ( m_meta . getOffset ( id , type ) ) ) ; } | This method retrieves a string of the specified type belonging to the item with the specified unique ID . |
20,785 | public int getShort ( Integer id , Integer type ) { int result = 0 ; Integer offset = m_meta . getOffset ( id , type ) ; if ( offset != null ) { byte [ ] value = m_map . get ( offset ) ; if ( value != null && value . length >= 2 ) { result = MPPUtility . getShort ( value , 0 ) ; } } return ( result ) ; } | This method retrieves an integer of the specified type belonging to the item with the specified unique ID . |
20,786 | public double getDouble ( Integer id , Integer type ) { double result = Double . longBitsToDouble ( getLong ( id , type ) ) ; if ( Double . isNaN ( result ) ) { result = 0 ; } return result ; } | This method retrieves a double of the specified type belonging to the item with the specified unique ID . |
20,787 | public DateRange getRange ( int index ) { DateRange result ; if ( index >= 0 && index < m_ranges . size ( ) ) { result = m_ranges . get ( index ) ; } else { result = DateRange . EMPTY_RANGE ; } return ( result ) ; } | Retrieve the date range at the specified index . The index is zero based and this method will return null if the requested date range does not exist . |
20,788 | public GenericCriteria process ( ProjectProperties properties , byte [ ] data , int dataOffset , int entryOffset , List < GenericCriteriaPrompt > prompts , List < FieldType > fields , boolean [ ] criteriaType ) { m_properties = properties ; m_prompts = prompts ; m_fields = fields ; m_criteriaType = criteriaType ; m_dat... | Main entry point to read criteria data . |
20,789 | private void processBlock ( List < GenericCriteria > list , byte [ ] block ) { if ( block != null ) { if ( MPPUtility . getShort ( block , 0 ) > 0x3E6 ) { addCriteria ( list , block ) ; } else { switch ( block [ 0 ] ) { case ( byte ) 0x0B : { processBlock ( list , getChildBlock ( block ) ) ; break ; } case ( byte ) 0x0... | Process a single criteria block . |
20,790 | private void addCriteria ( List < GenericCriteria > list , byte [ ] block ) { byte [ ] leftBlock = getChildBlock ( block ) ; byte [ ] rightBlock1 = getListNextBlock ( leftBlock ) ; byte [ ] rightBlock2 = getListNextBlock ( rightBlock1 ) ; TestOperator operator = TestOperator . getInstance ( MPPUtility . getShort ( bloc... | Adds a basic LHS OPERATOR RHS block . |
20,791 | private void addBlock ( List < GenericCriteria > list , byte [ ] block , TestOperator operator ) { GenericCriteria result = new GenericCriteria ( m_properties ) ; result . setOperator ( operator ) ; list . add ( result ) ; processBlock ( result . getCriteriaList ( ) , getChildBlock ( block ) ) ; processBlock ( list , g... | Adds a logical operator block . |
20,792 | private Object getValue ( FieldType field , byte [ ] block ) { Object result = null ; switch ( block [ 0 ] ) { case 0x07 : { result = getFieldType ( block ) ; break ; } case 0x01 : { result = getConstantValue ( field , block ) ; break ; } case 0x00 : { result = getPromptValue ( field , block ) ; break ; } } return resu... | Retrieves the value component of a criteria expression . |
20,793 | private Object getConstantValue ( FieldType type , byte [ ] block ) { Object value ; DataType dataType = type . getDataType ( ) ; if ( dataType == null ) { value = null ; } else { switch ( dataType ) { case DURATION : { value = MPPUtility . getAdjustedDuration ( m_properties , MPPUtility . getInt ( block , getValueOffs... | Retrieves a constant value . |
20,794 | private GenericCriteriaPrompt getPromptValue ( FieldType field , byte [ ] block ) { int textOffset = getPromptOffset ( block ) ; String value = MPPUtility . getUnicodeString ( m_criteriaData , m_criteriaTextStart + textOffset ) ; GenericCriteriaPrompt prompt = new GenericCriteriaPrompt ( field . getDataType ( ) , value... | Retrieves a prompt value . |
20,795 | private RelationType getRelationType ( int type ) { RelationType result ; if ( type > 0 && type < RELATION_TYPES . length ) { result = RELATION_TYPES [ type ] ; } else { result = RelationType . FINISH_START ; } return result ; } | Convert an integer to a RelationType instance . |
20,796 | public byte [ ] getByteArrayValue ( int index ) { byte [ ] result = null ; if ( m_array [ index ] != null ) { result = ( byte [ ] ) m_array [ index ] ; } return ( result ) ; } | This method retrieves a byte array containing the data at the given index in the block . If no data is found at the given index this method returns null . |
20,797 | public byte getByte ( Integer type ) { byte result = 0 ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = item [ 0 ] ; } return ( result ) ; } | Retrieves a byte value from the property data . |
20,798 | public Date getTime ( Integer type ) { Date result = null ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = MPPUtility . getTime ( item , 0 ) ; } return ( result ) ; } | Retrieves a timestamp from the property data . |
20,799 | public String getUnicodeString ( Integer type ) { String result = null ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = MPPUtility . getUnicodeString ( item , 0 ) ; } return ( result ) ; } | Retrieves a string value from the property data . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.