idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
144,000
private SynchroTable readTableHeader ( byte [ ] header ) { SynchroTable result = null ; String tableName = DatatypeConverter . getSimpleString ( header , 0 ) ; if ( ! tableName . isEmpty ( ) ) { int offset = DatatypeConverter . getInt ( header , 40 ) ; result = new SynchroTable ( tableName , offset ) ; } return result ...
Read the header data for a single file .
144,001
private void readTableData ( List < SynchroTable > tables , InputStream is ) throws IOException { for ( SynchroTable table : tables ) { if ( REQUIRED_TABLES . contains ( table . getName ( ) ) ) { readTable ( is , table ) ; } } }
Read the data for all of the tables we re interested in .
144,002
private void readTable ( InputStream is , SynchroTable table ) throws IOException { int skip = table . getOffset ( ) - m_offset ; if ( skip != 0 ) { StreamHelper . skip ( is , skip ) ; m_offset += skip ; } String tableName = DatatypeConverter . getString ( is ) ; int tableNameLength = 2 + tableName . length ( ) ; m_off...
Read data for a single table and store it .
144,003
private void readHeader ( InputStream is ) throws IOException { byte [ ] header = new byte [ 20 ] ; is . read ( header ) ; m_offset += 20 ; SynchroLogger . log ( "HEADER" , header ) ; }
Read the file header data .
144,004
private void readVersion ( InputStream is ) throws IOException { BytesReadInputStream bytesReadStream = new BytesReadInputStream ( is ) ; String version = DatatypeConverter . getString ( bytesReadStream ) ; m_offset += bytesReadStream . getBytesRead ( ) ; SynchroLogger . log ( "VERSION" , version ) ; String [ ] version...
Read the version number .
144,005
public List < ProjectFile > readAll ( ) throws MPXJException { Map < Integer , String > projects = listProjects ( ) ; List < ProjectFile > result = new ArrayList < ProjectFile > ( projects . keySet ( ) . size ( ) ) ; for ( Integer id : projects . keySet ( ) ) { setProjectID ( id . intValue ( ) ) ; result . add ( read (...
Convenience method which allows all projects in the database to be read in a single operation .
144,006
private void processAnalytics ( ) throws SQLException { allocateConnection ( ) ; try { DatabaseMetaData meta = m_connection . getMetaData ( ) ; String productName = meta . getDatabaseProductName ( ) ; if ( productName == null || productName . isEmpty ( ) ) { productName = "DATABASE" ; } else { productName = productName...
Populate data for analytics .
144,007
private void processSchedulingProjectProperties ( ) throws SQLException { List < Row > rows = getRows ( "select * from " + m_schema + "projprop where proj_id=? and prop_name='scheduling'" , m_projectID ) ; if ( ! rows . isEmpty ( ) ) { Row row = rows . get ( 0 ) ; Record record = Record . getRecord ( row . getString ( ...
Process the scheduling project property from PROJPROP . This table only seems to exist in P6 databases not XER files .
144,008
private void processDefaultCurrency ( Integer currencyID ) throws SQLException { List < Row > rows = getRows ( "select * from " + m_schema + "currtype where curr_id=?" , currencyID ) ; if ( ! rows . isEmpty ( ) ) { Row row = rows . get ( 0 ) ; m_reader . processDefaultCurrency ( row ) ; } }
Select the default currency properties from the database .
144,009
public void setSchema ( String schema ) { if ( schema == null ) { schema = "" ; } else { if ( ! schema . isEmpty ( ) && ! schema . endsWith ( "." ) ) { schema = schema + '.' ; } } m_schema = schema ; }
Set the name of the schema containing the Primavera tables .
144,010
public void applyPattern ( String primaryPattern , String [ ] alternativePatterns , char decimalSeparator , char groupingSeparator ) { m_symbols . setDecimalSeparator ( decimalSeparator ) ; m_symbols . setGroupingSeparator ( groupingSeparator ) ; setDecimalFormatSymbols ( m_symbols ) ; applyPattern ( primaryPattern ) ;...
This method is used to configure the primary and alternative format patterns .
144,011
private String getResourceField ( int key ) { String result = null ; if ( key > 0 && key < m_resourceNames . length ) { result = m_resourceNames [ key ] ; } return ( result ) ; }
Given a resource field number this method returns the resource field name .
144,012
private int getResourceCode ( String field ) throws MPXJException { Integer result = m_resourceNumbers . get ( field ) ; if ( result == null ) { throw new MPXJException ( MPXJException . INVALID_RESOURCE_FIELD_NAME + " " + field ) ; } return ( result . intValue ( ) ) ; }
Given a resource field name this method returns the resource field number .
144,013
public FieldType getField ( ) { FieldType result = null ; if ( m_index < m_fields . length ) { result = m_fields [ m_index ++ ] ; } return result ; }
Retrieve the next available field .
144,014
public List < MapRow > readTable ( TableReader reader ) throws IOException { reader . read ( ) ; return reader . getRows ( ) ; }
Read a nested table . Instantiates the supplied reader class to extract the data .
144,015
public List < MapRow > readUnknownTable ( int rowSize , int rowMagicNumber ) throws IOException { TableReader reader = new UnknownTableReader ( this , rowSize , rowMagicNumber ) ; reader . read ( ) ; return reader . getRows ( ) ; }
Read a nested table whose contents we don t understand .
144,016
public List < MapRow > readTable ( Class < ? extends TableReader > readerClass ) throws IOException { TableReader reader ; try { reader = readerClass . getConstructor ( StreamReader . class ) . newInstance ( this ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } return readTable ( reader ) ; }
Reads a nested table . Uses the supplied reader class instance .
144,017
public List < MapRow > readTableConditional ( Class < ? extends TableReader > readerClass ) throws IOException { List < MapRow > result ; if ( DatatypeConverter . getBoolean ( m_stream ) ) { result = readTable ( readerClass ) ; } else { result = Collections . emptyList ( ) ; } return result ; }
Conditionally read a nested table based in the value of a boolean flag which precedes the table data .
144,018
public ByteArray readBytes ( int size ) throws IOException { byte [ ] data = new byte [ size ] ; m_stream . read ( data ) ; return new ByteArray ( data ) ; }
Read an array of bytes of a specified size .
144,019
public List < MapRow > readBlocks ( Class < ? extends BlockReader > readerClass ) throws IOException { BlockReader reader ; try { reader = readerClass . getConstructor ( StreamReader . class ) . newInstance ( this ) ; } catch ( Exception ex ) { throw new RuntimeException ( ex ) ; } return reader . read ( ) ; }
Read a list of fixed size blocks using an instance of the supplied reader class .
144,020
private void readFile ( InputStream is ) throws IOException { StreamHelper . skip ( is , 64 ) ; int index = 64 ; ArrayList < Integer > offsetList = new ArrayList < Integer > ( ) ; List < String > nameList = new ArrayList < String > ( ) ; while ( true ) { byte [ ] table = new byte [ 32 ] ; is . read ( table ) ; index +=...
Reads a PEP file from the input stream .
144,021
private void readCalendars ( ) { for ( MapRow row : getTable ( "NCALTAB" ) ) { ProjectCalendar calendar = m_projectFile . addCalendar ( ) ; calendar . setUniqueID ( row . getInteger ( "UNIQUE_ID" ) ) ; calendar . setName ( row . getString ( "NAME" ) ) ; calendar . setWorkingDay ( Day . SUNDAY , row . getBoolean ( "SUND...
Read calendar data from a PEP file .
144,022
private void addCalendarExceptions ( Table table , ProjectCalendar calendar , Integer exceptionID ) { Integer currentExceptionID = exceptionID ; while ( true ) { MapRow row = table . find ( currentExceptionID ) ; if ( row == null ) { break ; } Date date = row . getDate ( "DATE" ) ; ProjectCalendarException exception = ...
Read exceptions for a calendar .
144,023
private void readResources ( ) { for ( MapRow row : getTable ( "RTAB" ) ) { Resource resource = m_projectFile . addResource ( ) ; setFields ( RESOURCE_FIELDS , row , resource ) ; m_eventManager . fireResourceReadEvent ( resource ) ; } }
Read resource data from a PEP file .
144,024
private void readTasks ( ) { Integer rootID = Integer . valueOf ( 1 ) ; readWBS ( m_projectFile , rootID ) ; readTasks ( rootID ) ; m_projectFile . getTasks ( ) . synchronizeTaskIDToHierarchy ( ) ; }
Read task data from a PEP file .
144,025
private void readWBS ( ChildTaskContainer parent , Integer id ) { Integer currentID = id ; Table table = getTable ( "WBSTAB" ) ; while ( currentID . intValue ( ) != 0 ) { MapRow row = table . find ( currentID ) ; Integer taskID = row . getInteger ( "TASK_ID" ) ; Task task = readTask ( parent , taskID ) ; Integer childI...
Recursively read the WBS structure from a PEP file .
144,026
private void readTasks ( Integer id ) { Integer currentID = id ; Table table = getTable ( "WBSTAB" ) ; while ( currentID . intValue ( ) != 0 ) { MapRow row = table . find ( currentID ) ; Task task = m_projectFile . getTaskByUniqueID ( row . getInteger ( "TASK_ID" ) ) ; readLeafTasks ( task , row . getInteger ( "FIRST_C...
Read leaf tasks attached to the WBS .
144,027
private void readLeafTasks ( Task parent , Integer id ) { Integer currentID = id ; Table table = getTable ( "A1TAB" ) ; while ( currentID . intValue ( ) != 0 ) { if ( m_projectFile . getTaskByUniqueID ( currentID ) == null ) { readTask ( parent , currentID ) ; } currentID = table . find ( currentID ) . getInteger ( "NE...
Read the leaf tasks for an individual WBS node .
144,028
private Task readTask ( ChildTaskContainer parent , Integer id ) { Table a0 = getTable ( "A0TAB" ) ; Table a1 = getTable ( "A1TAB" ) ; Table a2 = getTable ( "A2TAB" ) ; Table a3 = getTable ( "A3TAB" ) ; Table a4 = getTable ( "A4TAB" ) ; Task task = parent . addTask ( ) ; MapRow a1Row = a1 . find ( id ) ; MapRow a2Row =...
Read data for an individual task from the tables in a PEP file .
144,029
private void readRelationships ( ) { for ( MapRow row : getTable ( "CONTAB" ) ) { Task task1 = m_projectFile . getTaskByUniqueID ( row . getInteger ( "TASK_ID_1" ) ) ; Task task2 = m_projectFile . getTaskByUniqueID ( row . getInteger ( "TASK_ID_2" ) ) ; if ( task1 != null && task2 != null ) { RelationType type = row . ...
Read relationship data from a PEP file .
144,030
private void readResourceAssignments ( ) { for ( MapRow row : getTable ( "USGTAB" ) ) { Task task = m_projectFile . getTaskByUniqueID ( row . getInteger ( "TASK_ID" ) ) ; Resource resource = m_projectFile . getResourceByUniqueID ( row . getInteger ( "RESOURCE_ID" ) ) ; if ( task != null && resource != null ) { Resource...
Read resource assignment data from a PEP file .
144,031
private Table getTable ( String name ) { Table table = m_tables . get ( name ) ; if ( table == null ) { table = EMPTY_TABLE ; } return table ; }
Retrieve a table by name .
144,032
private void applyAliases ( ) { CustomFieldContainer fields = m_projectFile . getCustomFields ( ) ; for ( Map . Entry < FieldType , String > entry : ALIASES . entrySet ( ) ) { fields . getCustomField ( entry . getKey ( ) ) . setAlias ( entry . getValue ( ) ) ; } }
Configure column aliases .
144,033
private static void defineField ( Map < String , FieldType > container , String name , FieldType type , String alias ) { container . put ( name , type ) ; if ( alias != null ) { ALIASES . put ( type , alias ) ; } }
Configure the mapping between a database column and a field including definition of an alias .
144,034
public String getString ( Integer type ) { String result = null ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = m_data . getString ( getOffset ( item ) ) ; } return ( result ) ; }
Retrieves a string value from the extended data .
144,035
public int getInt ( Integer type ) { int result = 0 ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = MPPUtility . getInt ( item , 0 ) ; } return ( result ) ; }
Retrieves an integer value from the extended data .
144,036
public long getLong ( Integer type ) { long result = 0 ; byte [ ] item = m_map . get ( type ) ; if ( item != null ) { result = MPPUtility . getLong6 ( item , 0 ) ; } return ( result ) ; }
Retrieves a long value from the extended data .
144,037
private void processHyperlinkData ( ResourceAssignment assignment , byte [ ] data ) { if ( data != null ) { int offset = 12 ; offset += 12 ; String hyperlink = MPPUtility . getUnicodeString ( data , offset ) ; offset += ( ( hyperlink . length ( ) + 1 ) * 2 ) ; offset += 12 ; String address = MPPUtility . getUnicodeStri...
Extract assignment hyperlink data .
144,038
private void createTimephasedData ( ProjectFile file , ResourceAssignment assignment , List < TimephasedWork > timephasedPlanned , List < TimephasedWork > timephasedComplete ) { if ( timephasedPlanned . isEmpty ( ) && timephasedComplete . isEmpty ( ) ) { Duration totalMinutes = assignment . getWork ( ) . convertUnits (...
Method used to create missing timephased data .
144,039
public static final String printTimestamp ( Date value ) { return ( value == null ? null : TIMESTAMP_FORMAT . get ( ) . format ( value ) ) ; }
Print a timestamp value .
144,040
public static final Duration parseDuration ( String value ) { return value == null ? null : Duration . getInstance ( Double . parseDouble ( value ) , TimeUnit . DAYS ) ; }
Parse a duration value .
144,041
public static final String printDuration ( Duration value ) { return value == null ? null : Double . toString ( value . getDuration ( ) ) ; }
Print a duration value .
144,042
public static final String printDate ( Date value ) { return ( value == null ? null : DATE_FORMAT . get ( ) . format ( value ) ) ; }
Print a date .
144,043
public static final Double parsePercent ( String value ) { return value == null ? null : Double . valueOf ( Double . parseDouble ( value ) * 100.0 ) ; }
Parse a percent complete value .
144,044
public static final String printPercent ( Double value ) { return value == null ? null : Double . toString ( value . doubleValue ( ) / 100.0 ) ; }
Print a percent complete value .
144,045
public List < PPVItemsType . PPVItem > getPPVItem ( ) { if ( ppvItem == null ) { ppvItem = new ArrayList < PPVItemsType . PPVItem > ( ) ; } return this . ppvItem ; }
Gets the value of the ppvItem property .
144,046
public CustomField getCustomField ( FieldType field ) { CustomField result = m_configMap . get ( field ) ; if ( result == null ) { result = new CustomField ( field , this ) ; m_configMap . put ( field , result ) ; } return result ; }
Retrieve configuration details for a given custom field .
144,047
void registerAlias ( FieldType type , String alias ) { m_aliasMap . put ( new Pair < FieldTypeClass , String > ( type . getFieldTypeClass ( ) , alias ) , type ) ; }
When an alias for a field is added index it here to allow lookup by alias and type .
144,048
public FieldType getFieldByAlias ( FieldTypeClass typeClass , String alias ) { return m_aliasMap . get ( new Pair < FieldTypeClass , String > ( typeClass , alias ) ) ; }
Retrieve a field from a particular entity using its alias .
144,049
private void createFieldMap ( byte [ ] data ) { int index = 0 ; int lastDataBlockOffset = 0 ; int dataBlockIndex = 0 ; while ( index < data . length ) { long mask = MPPUtility . getInt ( data , index + 0 ) ; int dataBlockOffset = MPPUtility . getShort ( data , index + 4 ) ; FieldType type = getFieldType ( MPPUtility . ...
Generic method used to create a field map from a block of data .
144,050
public void createTaskFieldMap ( Props props ) { byte [ ] fieldMapData = null ; for ( Integer key : TASK_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData == null ) { populateDefaultData ( getDefaultTaskData ( ) ) ; } else { createFieldMap ( fieldMapData ...
Creates a field map for tasks .
144,051
public void createRelationFieldMap ( Props props ) { byte [ ] fieldMapData = null ; for ( Integer key : RELATION_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData == null ) { populateDefaultData ( getDefaultRelationData ( ) ) ; } else { createFieldMap ( f...
Creates a field map for relations .
144,052
public void createEnterpriseCustomFieldMap ( Props props , Class < ? > c ) { byte [ ] fieldMapData = null ; for ( Integer key : ENTERPRISE_CUSTOM_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData != null ) { int index = 4 ; while ( index < fieldMapData . ...
Create a field map for enterprise custom fields .
144,053
public void createResourceFieldMap ( Props props ) { byte [ ] fieldMapData = null ; for ( Integer key : RESOURCE_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData == null ) { populateDefaultData ( getDefaultResourceData ( ) ) ; } else { createFieldMap ( f...
Creates a field map for resources .
144,054
public void createAssignmentFieldMap ( Props props ) { byte [ ] fieldMapData = null ; for ( Integer key : ASSIGNMENT_KEYS ) { fieldMapData = props . getByteArray ( key ) ; if ( fieldMapData != null ) { break ; } } if ( fieldMapData == null ) { populateDefaultData ( getDefaultAssignmentData ( ) ) ; } else { createFieldM...
Creates a field map for assignments .
144,055
private void populateDefaultData ( FieldItem [ ] defaultData ) { for ( FieldItem item : defaultData ) { m_map . put ( item . getType ( ) , item ) ; } }
This method takes an array of data and uses this to populate the field map .
144,056
public void populateContainer ( Class < ? extends FieldType > type , FieldContainer container , Integer id , byte [ ] [ ] fixedData , Var2Data varData ) { for ( FieldItem item : m_map . values ( ) ) { if ( item . getType ( ) . getClass ( ) . equals ( type ) ) { Object value = item . read ( id , fixedData , varData ) ; ...
Given a container and a set of raw data blocks this method extracts the field data and writes it into the container .
144,057
public int getFixedDataOffset ( FieldType type ) { int result ; FieldItem item = m_map . get ( type ) ; if ( item != null ) { result = item . getFixedDataOffset ( ) ; } else { result = - 1 ; } return result ; }
Retrieve the fixed data offset for a specific field .
144,058
public Integer getVarDataKey ( FieldType type ) { Integer result = null ; FieldItem item = m_map . get ( type ) ; if ( item != null ) { result = item . getVarDataKey ( ) ; } return result ; }
Retrieve the var data key for a specific field .
144,059
public FieldType getFieldTypeFromVarDataKey ( Integer key ) { FieldType result = null ; for ( Entry < FieldType , FieldMap . FieldItem > entry : m_map . entrySet ( ) ) { if ( entry . getValue ( ) . getFieldLocation ( ) == FieldLocation . VAR_DATA && entry . getValue ( ) . getVarDataKey ( ) . equals ( key ) ) { result =...
Used to map from a var data key to a field type . Note this is designed for diagnostic use only and uses an inefficient search .
144,060
public FieldLocation getFieldLocation ( FieldType type ) { FieldLocation result = null ; FieldItem item = m_map . get ( type ) ; if ( item != null ) { result = item . getFieldLocation ( ) ; } return result ; }
Retrieve the field location for a specific field .
144,061
protected Object getFieldData ( Integer id , FieldType type , byte [ ] [ ] fixedData , Var2Data varData ) { Object result = null ; FieldItem item = m_map . get ( type ) ; if ( item != null ) { result = item . read ( id , fixedData , varData ) ; } return result ; }
Retrieve a single field value .
144,062
public void dumpKnownFieldMaps ( Props props ) { for ( int key = 50331668 ; key < 50331674 ; key ++ ) { byte [ ] fieldMapData = props . getByteArray ( Integer . valueOf ( key ) ) ; if ( fieldMapData != null ) { System . out . println ( "KEY: " + key ) ; createFieldMap ( fieldMapData ) ; System . out . println ( toStrin...
Diagnostic method used to dump known field map data .
144,063
private int getFixedDataFieldSize ( FieldType type ) { int result = 0 ; DataType dataType = type . getDataType ( ) ; if ( dataType != null ) { switch ( dataType ) { case DATE : case INTEGER : case DURATION : { result = 4 ; break ; } case TIME_UNITS : case CONSTRAINT : case PRIORITY : case PERCENTAGE : case TASK_TYPE : ...
Determine the size of a field in a fixed data block .
144,064
void setParent ( ProjectCalendarWeek parent ) { m_parent = parent ; for ( int loop = 0 ; loop < m_days . length ; loop ++ ) { if ( m_days [ loop ] == null ) { m_days [ loop ] = DayType . DEFAULT ; } } }
Set the parent from which this week is derived .
144,065
public ProjectCalendarHours getHours ( Day day ) { ProjectCalendarHours result = getCalendarHours ( day ) ; if ( result == null ) { if ( m_parent == null ) { addDefaultCalendarHours ( day ) ; result = getCalendarHours ( day ) ; } else { result = m_parent . getHours ( day ) ; } } return result ; }
This method retrieves the calendar hours for the specified day . Note that if this is a derived calendar then this method will refer to the base calendar where no hours are specified in the derived calendar .
144,066
public void addDefaultCalendarHours ( Day day ) { ProjectCalendarHours hours = addCalendarHours ( day ) ; if ( day != Day . SATURDAY && day != Day . SUNDAY ) { hours . addRange ( DEFAULT_WORKING_MORNING ) ; hours . addRange ( DEFAULT_WORKING_AFTERNOON ) ; } }
This is a convenience method used to add a default set of calendar hours to a calendar .
144,067
public ProjectCalendarHours addCalendarHours ( Day day ) { ProjectCalendarHours bch = new ProjectCalendarHours ( this ) ; bch . setDay ( day ) ; m_hours [ day . getValue ( ) - 1 ] = bch ; return ( bch ) ; }
Used to add working hours to the calendar . Note that the MPX file definition allows a maximum of 7 calendar hours records to be added to a single calendar .
144,068
public void attachHoursToDay ( ProjectCalendarHours hours ) { if ( hours . getParentCalendar ( ) != this ) { throw new IllegalArgumentException ( ) ; } m_hours [ hours . getDay ( ) . getValue ( ) - 1 ] = hours ; }
Attaches a pre - existing set of hours to the correct day within the calendar .
144,069
public void removeHoursFromDay ( ProjectCalendarHours hours ) { if ( hours . getParentCalendar ( ) != this ) { throw new IllegalArgumentException ( ) ; } m_hours [ hours . getDay ( ) . getValue ( ) - 1 ] = null ; }
Removes a set of calendar hours from the day to which they are currently attached .
144,070
public void setWorkingDay ( Day day , boolean working ) { setWorkingDay ( day , ( working ? DayType . WORKING : DayType . NON_WORKING ) ) ; }
convenience method for setting working or non - working days .
144,071
public void setWorkingDay ( Day day , DayType working ) { DayType value ; if ( working == null ) { if ( isDerived ( ) ) { value = DayType . DEFAULT ; } else { value = DayType . WORKING ; } } else { value = working ; } m_days [ day . getValue ( ) - 1 ] = value ; }
This is a convenience method provided to allow a day to be set as working or non - working by using the day number to identify the required day .
144,072
private void readCalendar ( Gantt gantt ) { Gantt . Calendar ganttCalendar = gantt . getCalendar ( ) ; m_projectFile . getProjectProperties ( ) . setWeekStartDay ( ganttCalendar . getWeekStart ( ) ) ; ProjectCalendar calendar = m_projectFile . addCalendar ( ) ; calendar . setName ( "Standard" ) ; m_projectFile . setDef...
Read the calendar data from a Gantt Designer file .
144,073
private void processTasks ( Gantt gantt ) { ProjectCalendar calendar = m_projectFile . getDefaultCalendar ( ) ; for ( Gantt . Tasks . Task ganttTask : gantt . getTasks ( ) . getTask ( ) ) { String wbs = ganttTask . getID ( ) ; ChildTaskContainer parentTask = getParentTask ( wbs ) ; Task task = parentTask . addTask ( ) ...
Read task data from a Gantt Designer file .
144,074
private void processPredecessors ( Gantt gantt ) { for ( Gantt . Tasks . Task ganttTask : gantt . getTasks ( ) . getTask ( ) ) { String predecessors = ganttTask . getP ( ) ; if ( predecessors != null && ! predecessors . isEmpty ( ) ) { String wbs = ganttTask . getID ( ) ; Task task = m_taskMap . get ( wbs ) ; for ( Str...
Read predecessors from a Gantt Designer file .
144,075
private void processRemarks ( Gantt gantt ) { processRemarks ( gantt . getRemarks ( ) ) ; processRemarks ( gantt . getRemarks1 ( ) ) ; processRemarks ( gantt . getRemarks2 ( ) ) ; processRemarks ( gantt . getRemarks3 ( ) ) ; processRemarks ( gantt . getRemarks4 ( ) ) ; }
Read remarks from a Gantt Designer file .
144,076
private void processRemarks ( GanttDesignerRemark remark ) { for ( GanttDesignerRemark . Task remarkTask : remark . getTask ( ) ) { Integer id = remarkTask . getRow ( ) ; Task task = m_projectFile . getTaskByID ( id ) ; String notes = task . getNotes ( ) ; if ( notes . isEmpty ( ) ) { notes = remarkTask . getContent ( ...
Read an individual remark type from a Gantt Designer file .
144,077
private String getParentWBS ( String wbs ) { String result ; int index = wbs . lastIndexOf ( '.' ) ; if ( index == - 1 ) { result = null ; } else { result = wbs . substring ( 0 , index ) ; } return result ; }
Extract the parent WBS from a WBS .
144,078
private ChildTaskContainer getParentTask ( String wbs ) { ChildTaskContainer result ; String parentWbs = getParentWBS ( wbs ) ; if ( parentWbs == null ) { result = m_projectFile ; } else { result = m_taskMap . get ( parentWbs ) ; } return result ; }
Retrieve the parent task based on its WBS .
144,079
private List < Entry > getChildNodes ( DirectoryEntry parent ) { List < Entry > result = new ArrayList < Entry > ( ) ; Iterator < Entry > entries = parent . getEntries ( ) ; while ( entries . hasNext ( ) ) { result . add ( entries . next ( ) ) ; } return result ; }
Retrieves child nodes from a directory entry .
144,080
private void fireTreeStructureChanged ( ) { Object [ ] listeners = m_listenerList . getListenerList ( ) ; TreeModelEvent e = null ; for ( int i = listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( listeners [ i ] == TreeModelListener . class ) { if ( e == null ) { e = new TreeModelEvent ( getRoot ( ) , new Object [ ] { ...
Notify listeners that the tree structure has changed .
144,081
public int getMinutesPerDay ( ) { return m_minutesPerDay == null ? NumberHelper . getInt ( getParentFile ( ) . getProjectProperties ( ) . getMinutesPerDay ( ) ) : m_minutesPerDay . intValue ( ) ; }
Retrieve the number of minutes per day for this calendar .
144,082
public int getMinutesPerWeek ( ) { return m_minutesPerWeek == null ? NumberHelper . getInt ( getParentFile ( ) . getProjectProperties ( ) . getMinutesPerWeek ( ) ) : m_minutesPerWeek . intValue ( ) ; }
Retrieve the number of minutes per week for this calendar .
144,083
public int getMinutesPerMonth ( ) { return m_minutesPerMonth == null ? NumberHelper . getInt ( getParentFile ( ) . getProjectProperties ( ) . getMinutesPerMonth ( ) ) : m_minutesPerMonth . intValue ( ) ; }
Retrieve the number of minutes per month for this calendar .
144,084
public int getMinutesPerYear ( ) { return m_minutesPerYear == null ? NumberHelper . getInt ( getParentFile ( ) . getProjectProperties ( ) . getMinutesPerYear ( ) ) : m_minutesPerYear . intValue ( ) ; }
Retrieve the number of minutes per year for this calendar .
144,085
public ProjectCalendarWeek addWorkWeek ( ) { ProjectCalendarWeek week = new ProjectCalendarWeek ( ) ; week . setParent ( this ) ; m_workWeeks . add ( week ) ; m_weeksSorted = false ; clearWorkingDateCache ( ) ; return week ; }
Add an empty work week .
144,086
public ProjectCalendarException addCalendarException ( Date fromDate , Date toDate ) { ProjectCalendarException bce = new ProjectCalendarException ( fromDate , toDate ) ; m_exceptions . add ( bce ) ; m_expandedExceptions . clear ( ) ; m_exceptionsSorted = false ; clearWorkingDateCache ( ) ; return bce ; }
Used to add exceptions to the calendar . The MPX standard defines a limit of 250 exceptions per calendar .
144,087
public void setParent ( ProjectCalendar calendar ) { if ( calendar != this ) { if ( getParent ( ) != null ) { getParent ( ) . removeDerivedCalendar ( this ) ; } super . setParent ( calendar ) ; if ( calendar != null ) { calendar . addDerivedCalendar ( this ) ; } clearWorkingDateCache ( ) ; } }
Sets the ProjectCalendar instance from which this calendar is derived .
144,088
public boolean isWorkingDay ( Day day ) { DayType value = getWorkingDay ( day ) ; boolean result ; if ( value == DayType . DEFAULT ) { ProjectCalendar cal = getParent ( ) ; if ( cal != null ) { result = cal . isWorkingDay ( day ) ; } else { result = ( day != Day . SATURDAY && day != Day . SUNDAY ) ; } } else { result =...
Method indicating whether a day is a working or non - working day .
144,089
public Duration getDuration ( Date startDate , Date endDate ) { Calendar cal = DateHelper . popCalendar ( startDate ) ; int days = getDaysInRange ( startDate , endDate ) ; int duration = 0 ; Day day = Day . getInstance ( cal . get ( Calendar . DAY_OF_WEEK ) ) ; while ( days > 0 ) { if ( isWorkingDate ( cal . getTime ( ...
This method is provided to allow an absolute period of time represented by start and end dates into a duration in working days based on this calendar instance . This method takes account of any exceptions defined for this calendar .
144,090
public Date getStartTime ( Date date ) { Date result = m_startTimeCache . get ( date ) ; if ( result == null ) { ProjectCalendarDateRanges ranges = getRanges ( date , null , null ) ; if ( ranges == null ) { result = getParentFile ( ) . getProjectProperties ( ) . getDefaultStartTime ( ) ; } else { result = ranges . getR...
Retrieves the time at which work starts on the given date or returns null if this is a non - working day .
144,091
public Date getFinishTime ( Date date ) { Date result = null ; if ( date != null ) { ProjectCalendarDateRanges ranges = getRanges ( date , null , null ) ; if ( ranges == null ) { result = getParentFile ( ) . getProjectProperties ( ) . getDefaultEndTime ( ) ; result = DateHelper . getCanonicalTime ( result ) ; } else { ...
Retrieves the time at which work finishes on the given date or returns null if this is a non - working day .
144,092
private void updateToNextWorkStart ( Calendar cal ) { Date originalDate = cal . getTime ( ) ; ProjectCalendarDateRanges ranges = getRanges ( originalDate , cal , null ) ; if ( ranges != null ) { Date calTime = DateHelper . getCanonicalTime ( cal . getTime ( ) ) ; Date startTime = null ; for ( DateRange range : ranges )...
This method finds the start of the next working period .
144,093
public Date getNextWorkStart ( Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; updateToNextWorkStart ( cal ) ; return cal . getTime ( ) ; }
Utility method to retrieve the next working date start time given a date and time as a starting point .
144,094
public Date getPreviousWorkFinish ( Date date ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; updateToPreviousWorkFinish ( cal ) ; return cal . getTime ( ) ; }
Utility method to retrieve the previous working date finish time given a date and time as a starting point .
144,095
public boolean isWorkingDate ( Date date ) { Calendar cal = DateHelper . popCalendar ( date ) ; Day day = Day . getInstance ( cal . get ( Calendar . DAY_OF_WEEK ) ) ; DateHelper . pushCalendar ( cal ) ; return isWorkingDate ( date , day ) ; }
This method allows the caller to determine if a given date is a working day . This method takes account of calendar exceptions .
144,096
private boolean isWorkingDate ( Date date , Day day ) { ProjectCalendarDateRanges ranges = getRanges ( date , null , day ) ; return ranges . getRangeCount ( ) != 0 ; }
This private method allows the caller to determine if a given date is a working day . This method takes account of calendar exceptions . It assumes that the caller has already calculated the day of the week on which the given day falls .
144,097
private int getDaysInRange ( Date startDate , Date endDate ) { int result ; Calendar cal = DateHelper . popCalendar ( endDate ) ; int endDateYear = cal . get ( Calendar . YEAR ) ; int endDateDayOfYear = cal . get ( Calendar . DAY_OF_YEAR ) ; cal . setTime ( startDate ) ; if ( endDateYear == cal . get ( Calendar . YEAR ...
This method calculates the absolute number of days between two dates . Note that where two date objects are provided that fall on the same day this method will return one not zero . Note also that this method assumes that the dates are passed in the correct order i . e . startDate < endDate .
144,098
public void setUniqueID ( Integer uniqueID ) { ProjectFile parent = getParentFile ( ) ; if ( m_uniqueID != null ) { parent . getCalendars ( ) . unmapUniqueID ( m_uniqueID ) ; } parent . getCalendars ( ) . mapUniqueID ( uniqueID , this ) ; m_uniqueID = uniqueID ; }
Modifier method to set the unique ID of this calendar .
144,099
public void setResource ( Resource resource ) { m_resource = resource ; String name = m_resource . getName ( ) ; if ( name == null || name . length ( ) == 0 ) { name = "Unnamed Resource" ; } setName ( name ) ; }
Sets the resource to which this calendar is linked . Note that this method updates the calendar s name to be the same as the resource name . If the resource does not yet have a name then the calendar is given a default name .