idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
20,300 | private void processWorkWeeks ( byte [ ] data , int offset , ProjectCalendar cal ) { offset += 4 ; while ( data . length >= offset + ( ( 7 * 60 ) + 2 + 2 + 8 + 4 ) ) { ProjectCalendarWeek week = cal . addWorkWeek ( ) ; for ( Day day : Day . values ( ) ) { processWorkWeekDay ( data , offset , week , day ) ; offset += 60... | Read the work weeks . |
20,301 | private void processWorkWeekDay ( byte [ ] data , int offset , ProjectCalendarWeek week , Day day ) { int dayType = MPPUtility . getShort ( data , offset + 0 ) ; if ( dayType == 1 ) { week . setWorkingDay ( day , DayType . DEFAULT ) ; } else { ProjectCalendarHours hours = week . addCalendarHours ( day ) ; int rangeCoun... | Process an individual work week day . |
20,302 | private RecurrenceType getRecurrenceType ( int value ) { RecurrenceType result ; if ( value < 0 || value >= RECURRENCE_TYPES . length ) { result = null ; } else { result = RECURRENCE_TYPES [ value ] ; } return result ; } | Retrieve the recurrence type . |
20,303 | private boolean getRelative ( int value ) { boolean result ; if ( value < 0 || value >= RELATIVE_MAP . length ) { result = false ; } else { result = RELATIVE_MAP [ value ] ; } return result ; } | Determine if the exception is relative based on the recurrence type integer value . |
20,304 | public List < GanttDesignerRemark . Task > getTask ( ) { if ( task == null ) { task = new ArrayList < GanttDesignerRemark . Task > ( ) ; } return this . task ; } | Gets the value of the task property . |
20,305 | public void setLeftTableModel ( TableModel model ) { TableModel old = m_leftTable . getModel ( ) ; m_leftTable . setModel ( model ) ; firePropertyChange ( "leftTableModel" , old , model ) ; } | Set the model used by the left table . |
20,306 | public void setRightTableModel ( TableModel model ) { TableModel old = m_rightTable . getModel ( ) ; m_rightTable . setModel ( model ) ; firePropertyChange ( "rightTableModel" , old , model ) ; } | Set the model used by the right table . |
20,307 | public void process ( InputStream is ) throws Exception { readHeader ( is ) ; readVersion ( is ) ; readTableData ( readTableHeaders ( is ) , is ) ; } | Extract raw table data from the input stream . |
20,308 | public StreamReader getTableData ( String name ) throws IOException { InputStream stream = new ByteArrayInputStream ( m_tableData . get ( name ) ) ; if ( m_majorVersion > 5 ) { byte [ ] header = new byte [ 24 ] ; stream . read ( header ) ; SynchroLogger . log ( "TABLE HEADER" , header ) ; } return new StreamReader ( m_... | Return an input stream to read the data from the named table . |
20,309 | private List < SynchroTable > readTableHeaders ( InputStream is ) throws IOException { List < SynchroTable > tables = new ArrayList < SynchroTable > ( ) ; byte [ ] header = new byte [ 48 ] ; while ( true ) { is . read ( header ) ; m_offset += 48 ; SynchroTable table = readTableHeader ( header ) ; if ( table == null ) {... | Read the table headers . This allows us to break the file into chunks representing the individual tables . |
20,310 | 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 . |
20,311 | 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 . |
20,312 | 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 . |
20,313 | 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 . |
20,314 | 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 . |
20,315 | 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 . |
20,316 | 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 . |
20,317 | 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 . |
20,318 | 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 . |
20,319 | 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 . |
20,320 | 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 . |
20,321 | 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 . |
20,322 | 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 . |
20,323 | public FieldType getField ( ) { FieldType result = null ; if ( m_index < m_fields . length ) { result = m_fields [ m_index ++ ] ; } return result ; } | Retrieve the next available field . |
20,324 | 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 . |
20,325 | 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 . |
20,326 | 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 . |
20,327 | 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 . |
20,328 | 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 . |
20,329 | 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 . |
20,330 | 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 . |
20,331 | 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 . |
20,332 | 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 . |
20,333 | 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 . |
20,334 | 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 . |
20,335 | 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 . |
20,336 | 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 . |
20,337 | 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 . |
20,338 | 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 . |
20,339 | 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 . |
20,340 | 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 . |
20,341 | private Table getTable ( String name ) { Table table = m_tables . get ( name ) ; if ( table == null ) { table = EMPTY_TABLE ; } return table ; } | Retrieve a table by name . |
20,342 | 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 . |
20,343 | 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 . |
20,344 | 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 . |
20,345 | 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 . |
20,346 | 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 . |
20,347 | 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 . |
20,348 | 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 . |
20,349 | public static final String printTimestamp ( Date value ) { return ( value == null ? null : TIMESTAMP_FORMAT . get ( ) . format ( value ) ) ; } | Print a timestamp value . |
20,350 | public static final Duration parseDuration ( String value ) { return value == null ? null : Duration . getInstance ( Double . parseDouble ( value ) , TimeUnit . DAYS ) ; } | Parse a duration value . |
20,351 | public static final String printDuration ( Duration value ) { return value == null ? null : Double . toString ( value . getDuration ( ) ) ; } | Print a duration value . |
20,352 | public static final String printDate ( Date value ) { return ( value == null ? null : DATE_FORMAT . get ( ) . format ( value ) ) ; } | Print a date . |
20,353 | public static final Double parsePercent ( String value ) { return value == null ? null : Double . valueOf ( Double . parseDouble ( value ) * 100.0 ) ; } | Parse a percent complete value . |
20,354 | public static final String printPercent ( Double value ) { return value == null ? null : Double . toString ( value . doubleValue ( ) / 100.0 ) ; } | Print a percent complete value . |
20,355 | public List < PPVItemsType . PPVItem > getPPVItem ( ) { if ( ppvItem == null ) { ppvItem = new ArrayList < PPVItemsType . PPVItem > ( ) ; } return this . ppvItem ; } | Gets the value of the ppvItem property . |
20,356 | 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 . |
20,357 | 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 . |
20,358 | 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 . |
20,359 | 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 . |
20,360 | 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 . |
20,361 | 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 . |
20,362 | 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 . |
20,363 | 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 . |
20,364 | 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 . |
20,365 | 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 . |
20,366 | 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 . |
20,367 | 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 . |
20,368 | 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 . |
20,369 | 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 . |
20,370 | 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 . |
20,371 | 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 . |
20,372 | 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 . |
20,373 | 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 . |
20,374 | 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 . |
20,375 | 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 . |
20,376 | 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 . |
20,377 | 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 . |
20,378 | 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 . |
20,379 | 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 . |
20,380 | public void setWorkingDay ( Day day , boolean working ) { setWorkingDay ( day , ( working ? DayType . WORKING : DayType . NON_WORKING ) ) ; } | convenience method for setting working or non - working days . |
20,381 | 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 . |
20,382 | 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 . |
20,383 | 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 . |
20,384 | 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 . |
20,385 | 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 . |
20,386 | 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 . |
20,387 | 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 . |
20,388 | 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 . |
20,389 | 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 . |
20,390 | 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 . |
20,391 | 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 . |
20,392 | 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 . |
20,393 | 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 . |
20,394 | 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 . |
20,395 | 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 . |
20,396 | 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 . |
20,397 | 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 . |
20,398 | 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 . |
20,399 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.