idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
20,400
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 .
20,401
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 .
20,402
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 .
20,403
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 .
20,404
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 .
20,405
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 .
20,406
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 .
20,407
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 .
20,408
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 .
20,409
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 .
20,410
public ProjectCalendarException getException ( Date date ) { ProjectCalendarException exception = null ; populateExpandedExceptions ( ) ; if ( ! m_expandedExceptions . isEmpty ( ) ) { sortExceptions ( ) ; int low = 0 ; int high = m_expandedExceptions . size ( ) - 1 ; long targetDate = date . getTime ( ) ; while ( low <...
Retrieve a calendar exception which applies to this date .
20,411
public ProjectCalendarWeek getWorkWeek ( Date date ) { ProjectCalendarWeek week = null ; if ( ! m_workWeeks . isEmpty ( ) ) { sortWorkWeeks ( ) ; int low = 0 ; int high = m_workWeeks . size ( ) - 1 ; long targetDate = date . getTime ( ) ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; ProjectCalendarWeek midV...
Retrieve a work week which applies to this date .
20,412
public Duration getWork ( Date date , TimeUnit format ) { ProjectCalendarDateRanges ranges = getRanges ( date , null , null ) ; long time = getTotalTime ( ranges ) ; return convertFormat ( time , format ) ; }
Retrieves the amount of work on a given day and returns it in the specified format .
20,413
public Duration getWork ( Date startDate , Date endDate , TimeUnit format ) { DateRange range = new DateRange ( startDate , endDate ) ; Long cachedResult = m_workingDateCache . get ( range ) ; long totalTime = 0 ; if ( cachedResult == null ) { boolean invert = false ; if ( startDate . getTime ( ) > endDate . getTime ( ...
This method retrieves a Duration instance representing the amount of work between two dates based on this calendar .
20,414
private Duration convertFormat ( long totalTime , TimeUnit format ) { double duration = totalTime ; switch ( format ) { case MINUTES : case ELAPSED_MINUTES : { duration /= ( 60 * 1000 ) ; break ; } case HOURS : case ELAPSED_HOURS : { duration /= ( 60 * 60 * 1000 ) ; break ; } case DAYS : { double minutesPerDay = getMin...
Utility method used to convert an integer time representation into a Duration instance .
20,415
private long getTotalTime ( ProjectCalendarDateRanges exception , Date date , boolean after ) { long currentTime = DateHelper . getCanonicalTime ( date ) . getTime ( ) ; long total = 0 ; for ( DateRange range : exception ) { total += getTime ( range . getStart ( ) , range . getEnd ( ) , currentTime , after ) ; } return...
Retrieves the amount of time represented by a calendar exception before or after an intersection point .
20,416
private long getTotalTime ( ProjectCalendarDateRanges exception ) { long total = 0 ; for ( DateRange range : exception ) { total += getTime ( range . getStart ( ) , range . getEnd ( ) ) ; } return ( total ) ; }
Retrieves the amount of working time represented by a calendar exception .
20,417
private long getTotalTime ( ProjectCalendarDateRanges hours , Date startDate , Date endDate ) { long total = 0 ; if ( startDate . getTime ( ) != endDate . getTime ( ) ) { Date start = DateHelper . getCanonicalTime ( startDate ) ; Date end = DateHelper . getCanonicalTime ( endDate ) ; for ( DateRange range : hours ) { D...
This method calculates the total amount of working time in a single day which intersects with the supplied time range .
20,418
private long getTime ( Date start , Date end , long target , boolean after ) { long total = 0 ; if ( start != null && end != null ) { Date startTime = DateHelper . getCanonicalTime ( start ) ; Date endTime = DateHelper . getCanonicalTime ( end ) ; Date startDay = DateHelper . getDayStartDate ( start ) ; Date finishDay ...
Calculates how much of a time range is before or after a target intersection point .
20,419
private long getTime ( Date start , Date end ) { long total = 0 ; if ( start != null && end != null ) { Date startTime = DateHelper . getCanonicalTime ( start ) ; Date endTime = DateHelper . getCanonicalTime ( end ) ; Date startDay = DateHelper . getDayStartDate ( start ) ; Date finishDay = DateHelper . getDayStartDate...
Retrieves the amount of time between two date time values . Note that these values are converted into canonical values to remove the date component .
20,420
private long getTime ( Date start1 , Date end1 , Date start2 , Date end2 ) { long total = 0 ; if ( start1 != null && end1 != null && start2 != null && end2 != null ) { long start ; long end ; if ( start1 . getTime ( ) < start2 . getTime ( ) ) { start = start2 . getTime ( ) ; } else { start = start1 . getTime ( ) ; } if...
This method returns the length of overlapping time between two time ranges .
20,421
public void copy ( ProjectCalendar cal ) { setName ( cal . getName ( ) ) ; setParent ( cal . getParent ( ) ) ; System . arraycopy ( cal . getDays ( ) , 0 , getDays ( ) , 0 , getDays ( ) . length ) ; for ( ProjectCalendarException ex : cal . m_exceptions ) { addCalendarException ( ex . getFromDate ( ) , ex . getToDate (...
Copy the settings from another calendar to this calendar .
20,422
private void clearWorkingDateCache ( ) { m_workingDateCache . clear ( ) ; m_startTimeCache . clear ( ) ; m_getDateLastResult = null ; for ( ProjectCalendar calendar : m_derivedCalendars ) { calendar . clearWorkingDateCache ( ) ; } }
Utility method to clear cached calendar data .
20,423
private ProjectCalendarDateRanges getRanges ( Date date , Calendar cal , Day day ) { ProjectCalendarDateRanges ranges = getException ( date ) ; if ( ranges == null ) { ProjectCalendarWeek week = getWorkWeek ( date ) ; if ( week == null ) { week = this ; } if ( day == null ) { if ( cal == null ) { cal = Calendar . getIn...
Retrieves the working hours on the given date .
20,424
private void populateExpandedExceptions ( ) { if ( ! m_exceptions . isEmpty ( ) && m_expandedExceptions . isEmpty ( ) ) { for ( ProjectCalendarException exception : m_exceptions ) { RecurringData recurring = exception . getRecurring ( ) ; if ( recurring == null ) { m_expandedExceptions . add ( exception ) ; } else { fo...
Populate the expanded exceptions list based on the main exceptions list . Where we find recurring exception definitions we generate individual exceptions for each recurrence to ensure that we account for them correctly .
20,425
private Map < String , Table > getIndex ( Table table ) { Map < String , Table > result ; if ( ! table . getResourceFlag ( ) ) { result = m_taskTablesByName ; } else { result = m_resourceTablesByName ; } return result ; }
Retrieve the correct index for the supplied Table instance .
20,426
public void saveFile ( File file , String type ) { if ( file != null ) { m_treeController . saveFile ( file , type ) ; } }
Saves the project file displayed in this panel .
20,427
public void addFilter ( Filter filter ) { if ( filter . isTaskFilter ( ) ) { m_taskFilters . add ( filter ) ; } if ( filter . isResourceFilter ( ) ) { m_resourceFilters . add ( filter ) ; } m_filtersByName . put ( filter . getName ( ) , filter ) ; m_filtersByID . put ( filter . getID ( ) , filter ) ; }
Adds a filter definition to this project file .
20,428
public void removeFilter ( String filterName ) { Filter filter = getFilterByName ( filterName ) ; if ( filter != null ) { if ( filter . isTaskFilter ( ) ) { m_taskFilters . remove ( filter ) ; } if ( filter . isResourceFilter ( ) ) { m_resourceFilters . remove ( filter ) ; } m_filtersByName . remove ( filterName ) ; m_...
Removes a filter from this project file .
20,429
private void writeProjectProperties ( ) { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; m_plannerProject . setCompany ( properties . getCompany ( ) ) ; m_plannerProject . setManager ( properties . getManager ( ) ) ; m_plannerProject . setName ( getString ( properties . getName ( ) ) ) ; m_pl...
This method writes project properties to a Planner file .
20,430
private void writeCalendars ( ) throws JAXBException { Calendars calendars = m_factory . createCalendars ( ) ; m_plannerProject . setCalendars ( calendars ) ; writeDayTypes ( calendars ) ; List < net . sf . mpxj . planner . schema . Calendar > calendar = calendars . getCalendar ( ) ; for ( ProjectCalendar mpxjCalendar ...
This method writes calendar data to a Planner file .
20,431
private void writeDayTypes ( Calendars calendars ) { DayTypes dayTypes = m_factory . createDayTypes ( ) ; calendars . setDayTypes ( dayTypes ) ; List < DayType > typeList = dayTypes . getDayType ( ) ; DayType dayType = m_factory . createDayType ( ) ; typeList . add ( dayType ) ; dayType . setId ( "0" ) ; dayType . setN...
Write the standard set of day types .
20,432
private void writeCalendar ( ProjectCalendar mpxjCalendar , net . sf . mpxj . planner . schema . Calendar plannerCalendar ) throws JAXBException { plannerCalendar . setId ( getIntegerString ( mpxjCalendar . getUniqueID ( ) ) ) ; plannerCalendar . setName ( getString ( mpxjCalendar . getName ( ) ) ) ; DefaultWeek dw = m...
This method writes data for a single calendar to a Planner file .
20,433
private void processWorkingHours ( ProjectCalendar mpxjCalendar , Sequence uniqueID , Day day , List < OverriddenDayType > typeList ) { if ( isWorkingDay ( mpxjCalendar , day ) ) { ProjectCalendarHours mpxjHours = mpxjCalendar . getCalendarHours ( day ) ; if ( mpxjHours != null ) { OverriddenDayType odt = m_factory . c...
Process the standard working hours for a given day .
20,434
private void writeResources ( ) { Resources resources = m_factory . createResources ( ) ; m_plannerProject . setResources ( resources ) ; List < net . sf . mpxj . planner . schema . Resource > resourceList = resources . getResource ( ) ; for ( Resource mpxjResource : m_projectFile . getResources ( ) ) { net . sf . mpxj...
This method writes resource data to a Planner file .
20,435
private void writeResource ( Resource mpxjResource , net . sf . mpxj . planner . schema . Resource plannerResource ) { ProjectCalendar resourceCalendar = mpxjResource . getResourceCalendar ( ) ; if ( resourceCalendar != null ) { plannerResource . setCalendar ( getIntegerString ( resourceCalendar . getUniqueID ( ) ) ) ;...
This method writes data for a single resource to a Planner file .
20,436
private void writeTasks ( ) throws JAXBException { Tasks tasks = m_factory . createTasks ( ) ; m_plannerProject . setTasks ( tasks ) ; List < net . sf . mpxj . planner . schema . Task > taskList = tasks . getTask ( ) ; for ( Task task : m_projectFile . getChildTasks ( ) ) { writeTask ( task , taskList ) ; } }
This method writes task data to a Planner file .
20,437
private void writeTask ( Task mpxjTask , List < net . sf . mpxj . planner . schema . Task > taskList ) throws JAXBException { net . sf . mpxj . planner . schema . Task plannerTask = m_factory . createTask ( ) ; taskList . add ( plannerTask ) ; plannerTask . setEnd ( getDateTimeString ( mpxjTask . getFinish ( ) ) ) ; pl...
This method writes data for a single task to a Planner file .
20,438
private void writePredecessors ( Task mpxjTask , net . sf . mpxj . planner . schema . Task plannerTask ) { Predecessors plannerPredecessors = m_factory . createPredecessors ( ) ; plannerTask . setPredecessors ( plannerPredecessors ) ; List < Predecessor > predecessorList = plannerPredecessors . getPredecessor ( ) ; int...
This method writes predecessor data to a Planner file . We have to deal with a slight anomaly in this method that is introduced by the MPX file format . It would be possible for someone to create an MPX file with both the predecessor list and the unique ID predecessor list populated ... which means that we must process...
20,439
private void writeAssignments ( ) { Allocations allocations = m_factory . createAllocations ( ) ; m_plannerProject . setAllocations ( allocations ) ; List < Allocation > allocationList = allocations . getAllocation ( ) ; for ( ResourceAssignment mpxjAssignment : m_projectFile . getResourceAssignments ( ) ) { Allocation...
This method writes assignment data to a Planner file .
20,440
private String getIntegerString ( Number value ) { return ( value == null ? null : Integer . toString ( value . intValue ( ) ) ) ; }
Convert an Integer value into a String .
20,441
private boolean isWorkingDay ( ProjectCalendar mpxjCalendar , Day day ) { boolean result = false ; net . sf . mpxj . DayType type = mpxjCalendar . getWorkingDay ( day ) ; if ( type == null ) { type = net . sf . mpxj . DayType . DEFAULT ; } switch ( type ) { case WORKING : { result = true ; break ; } case NON_WORKING : ...
Used to determine if a particular day of the week is normally a working day .
20,442
private String getWorkingDayString ( ProjectCalendar mpxjCalendar , Day day ) { String result = null ; net . sf . mpxj . DayType type = mpxjCalendar . getWorkingDay ( day ) ; if ( type == null ) { type = net . sf . mpxj . DayType . DEFAULT ; } switch ( type ) { case WORKING : { result = "0" ; break ; } case NON_WORKING...
Returns a flag represented as a String indicating if the supplied day is a working day .
20,443
private String getTimeString ( Date value ) { Calendar cal = DateHelper . popCalendar ( value ) ; int hours = cal . get ( Calendar . HOUR_OF_DAY ) ; int minutes = cal . get ( Calendar . MINUTE ) ; DateHelper . pushCalendar ( cal ) ; StringBuilder sb = new StringBuilder ( 4 ) ; sb . append ( m_twoDigitFormat . format ( ...
Convert a Java date into a Planner time .
20,444
private String getDateString ( Date value ) { Calendar cal = DateHelper . popCalendar ( value ) ; int year = cal . get ( Calendar . YEAR ) ; int month = cal . get ( Calendar . MONTH ) + 1 ; int day = cal . get ( Calendar . DAY_OF_MONTH ) ; DateHelper . pushCalendar ( cal ) ; StringBuilder sb = new StringBuilder ( 8 ) ;...
Convert a Java date into a Planner date .
20,445
private String getDateTimeString ( Date value ) { String result = null ; if ( value != null ) { Calendar cal = DateHelper . popCalendar ( value ) ; StringBuilder sb = new StringBuilder ( 16 ) ; sb . append ( m_fourDigitFormat . format ( cal . get ( Calendar . YEAR ) ) ) ; sb . append ( m_twoDigitFormat . format ( cal ....
Convert a Java date into a Planner date - time string .
20,446
private String getDurationString ( Duration value ) { String result = null ; if ( value != null ) { double seconds = 0 ; switch ( value . getUnits ( ) ) { case MINUTES : case ELAPSED_MINUTES : { seconds = value . getDuration ( ) * 60 ; break ; } case HOURS : case ELAPSED_HOURS : { seconds = value . getDuration ( ) * ( ...
Converts an MPXJ Duration instance into the string representation of a Planner duration .
20,447
private void readProjectProperties ( Project project ) throws MPXJException { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; properties . setCompany ( project . getCompany ( ) ) ; properties . setManager ( project . getManager ( ) ) ; properties . setName ( project . getName ( ) ) ; propertie...
This method extracts project properties from a Planner file .
20,448
private void readCalendars ( Project project ) throws MPXJException { Calendars calendars = project . getCalendars ( ) ; if ( calendars != null ) { for ( net . sf . mpxj . planner . schema . Calendar cal : calendars . getCalendar ( ) ) { readCalendar ( cal , null ) ; } Integer defaultCalendarID = getInteger ( project ....
This method extracts calendar data from a Planner file .
20,449
private void readCalendar ( net . sf . mpxj . planner . schema . Calendar plannerCalendar , ProjectCalendar parentMpxjCalendar ) throws MPXJException { ProjectCalendar mpxjCalendar = m_projectFile . addCalendar ( ) ; mpxjCalendar . setUniqueID ( getInteger ( plannerCalendar . getId ( ) ) ) ; mpxjCalendar . setName ( pl...
This method extracts data for a single calendar from a Planner file .
20,450
private void readResources ( Project plannerProject ) throws MPXJException { Resources resources = plannerProject . getResources ( ) ; if ( resources != null ) { for ( net . sf . mpxj . planner . schema . Resource res : resources . getResource ( ) ) { readResource ( res ) ; } } }
This method extracts resource data from a Planner file .
20,451
private void readResource ( net . sf . mpxj . planner . schema . Resource plannerResource ) throws MPXJException { Resource mpxjResource = m_projectFile . addResource ( ) ; mpxjResource . setEmailAddress ( plannerResource . getEmail ( ) ) ; mpxjResource . setUniqueID ( getInteger ( plannerResource . getId ( ) ) ) ; mpx...
This method extracts data for a single resource from a Planner file .
20,452
private void readTasks ( Project plannerProject ) throws MPXJException { Tasks tasks = plannerProject . getTasks ( ) ; if ( tasks != null ) { for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask ( ) ) { readTask ( null , task ) ; } for ( net . sf . mpxj . planner . schema . Task task : tasks . getTask...
This method extracts task data from a Planner file .
20,453
private void readPredecessors ( net . sf . mpxj . planner . schema . Task plannerTask ) { Task mpxjTask = m_projectFile . getTaskByUniqueID ( getInteger ( plannerTask . getId ( ) ) ) ; Predecessors predecessors = plannerTask . getPredecessors ( ) ; if ( predecessors != null ) { List < Predecessor > predecessorList = pr...
This method extracts predecessor data from a Planner file .
20,454
private void readAssignments ( Project plannerProject ) { Allocations allocations = plannerProject . getAllocations ( ) ; List < Allocation > allocationList = allocations . getAllocation ( ) ; Set < Task > tasksWithAssignments = new HashSet < Task > ( ) ; for ( Allocation allocation : allocationList ) { Integer taskID ...
This method extracts assignment data from a Planner file .
20,455
private Date getDateTime ( String value ) throws MPXJException { try { Number year = m_fourDigitFormat . parse ( value . substring ( 0 , 4 ) ) ; Number month = m_twoDigitFormat . parse ( value . substring ( 4 , 6 ) ) ; Number day = m_twoDigitFormat . parse ( value . substring ( 6 , 8 ) ) ; Number hours = m_twoDigitForm...
Convert a Planner date - time value into a Java date .
20,456
private Date getTime ( String value ) throws MPXJException { try { Number hours = m_twoDigitFormat . parse ( value . substring ( 0 , 2 ) ) ; Number minutes = m_twoDigitFormat . parse ( value . substring ( 2 , 4 ) ) ; Calendar cal = DateHelper . popCalendar ( ) ; cal . set ( Calendar . HOUR_OF_DAY , hours . intValue ( )...
Convert a Planner time into a Java date .
20,457
private Duration getDuration ( String value ) { Duration result = null ; if ( value != null && value . length ( ) != 0 ) { double seconds = getLong ( value ) ; double hours = seconds / ( 60 * 60 ) ; double days = hours / 8 ; if ( days < 1 ) { result = Duration . getInstance ( hours , TimeUnit . HOURS ) ; } else { doubl...
Converts the string representation of a Planner duration into an MPXJ Duration instance .
20,458
public ArrayList < Duration > segmentWork ( ProjectCalendar projectCalendar , List < TimephasedWork > work , TimescaleUnits rangeUnits , List < DateRange > dateList ) { ArrayList < Duration > result = new ArrayList < Duration > ( dateList . size ( ) ) ; int lastStartIndex = 0 ; for ( DateRange range : dateList ) { int ...
This is the main entry point used to convert the internal representation of timephased work into an external form which can be displayed to the user .
20,459
public ArrayList < Duration > segmentBaselineWork ( ProjectFile file , List < TimephasedWork > work , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { return segmentWork ( file . getBaselineCalendar ( ) , work , rangeUnits , dateList ) ; }
This is the main entry point used to convert the internal representation of timephased baseline work into an external form which can be displayed to the user .
20,460
public ArrayList < Double > segmentCost ( ProjectCalendar projectCalendar , List < TimephasedCost > cost , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { ArrayList < Double > result = new ArrayList < Double > ( dateList . size ( ) ) ; int lastStartIndex = 0 ; for ( DateRange range : dateList ) { int s...
This is the main entry point used to convert the internal representation of timephased cost into an external form which can be displayed to the user .
20,461
public ArrayList < Double > segmentBaselineCost ( ProjectFile file , List < TimephasedCost > cost , TimescaleUnits rangeUnits , ArrayList < DateRange > dateList ) { return segmentCost ( file . getBaselineCalendar ( ) , cost , rangeUnits , dateList ) ; }
This is the main entry point used to convert the internal representation of timephased baseline cost into an external form which can be displayed to the user .
20,462
private < T extends TimephasedItem < ? > > int getStartIndex ( DateRange range , List < T > assignments , int startIndex ) { int result = - 1 ; if ( assignments != null ) { long rangeStart = range . getStart ( ) . getTime ( ) ; long rangeEnd = range . getEnd ( ) . getTime ( ) ; for ( int loop = startIndex ; loop < assi...
Used to locate the first timephased resource assignment block which intersects with the target date range .
20,463
private void processCalendarHours ( byte [ ] data , ProjectCalendar defaultCalendar , ProjectCalendar cal , boolean isBaseCalendar ) { int offset ; ProjectCalendarHours hours ; int periodIndex ; int index ; int defaultFlag ; int periodCount ; Date start ; long duration ; Day day ; List < DateRange > dateRanges = new Ar...
For a given set of calendar data this method sets the working day status for each day and if present sets the hours for that day .
20,464
private void updateBaseCalendarNames ( List < Pair < ProjectCalendar , Integer > > baseCalendars , HashMap < Integer , ProjectCalendar > map ) { for ( Pair < ProjectCalendar , Integer > pair : baseCalendars ) { ProjectCalendar cal = pair . getFirst ( ) ; Integer baseCalendarID = pair . getSecond ( ) ; ProjectCalendar b...
The way calendars are stored in an MPP14 file means that there can be forward references between the base calendar unique ID for a derived calendar and the base calendar itself . To get around this we initially populate the base calendar name attribute with the base calendar unique ID and now in this method we can conv...
20,465
public void fireTaskReadEvent ( Task task ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . taskRead ( task ) ; } } }
This method is called to alert project listeners to the fact that a task has been read from a project file .
20,466
public void fireTaskWrittenEvent ( Task task ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . taskWritten ( task ) ; } } }
This method is called to alert project listeners to the fact that a task has been written to a project file .
20,467
public void fireResourceReadEvent ( Resource resource ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . resourceRead ( resource ) ; } } }
This method is called to alert project listeners to the fact that a resource has been read from a project file .
20,468
public void fireResourceWrittenEvent ( Resource resource ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . resourceWritten ( resource ) ; } } }
This method is called to alert project listeners to the fact that a resource has been written to a project file .
20,469
public void fireCalendarReadEvent ( ProjectCalendar calendar ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . calendarRead ( calendar ) ; } } }
This method is called to alert project listeners to the fact that a calendar has been read from a project file .
20,470
public void fireAssignmentReadEvent ( ResourceAssignment resourceAssignment ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . assignmentRead ( resourceAssignment ) ; } } }
This method is called to alert project listeners to the fact that a resource assignment has been read from a project file .
20,471
public void fireAssignmentWrittenEvent ( ResourceAssignment resourceAssignment ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . assignmentWritten ( resourceAssignment ) ; } } }
This method is called to alert project listeners to the fact that a resource assignment has been written to a project file .
20,472
public void fireRelationReadEvent ( Relation relation ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . relationRead ( relation ) ; } } }
This method is called to alert project listeners to the fact that a relation has been read from a project file .
20,473
public void fireRelationWrittenEvent ( Relation relation ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . relationWritten ( relation ) ; } } }
This method is called to alert project listeners to the fact that a relation has been written to a project file .
20,474
public void fireCalendarWrittenEvent ( ProjectCalendar calendar ) { if ( m_projectListeners != null ) { for ( ProjectListener listener : m_projectListeners ) { listener . calendarWritten ( calendar ) ; } } }
This method is called to alert project listeners to the fact that a calendar has been written to a project file .
20,475
public void addProjectListeners ( List < ProjectListener > listeners ) { if ( listeners != null ) { for ( ProjectListener listener : listeners ) { addProjectListener ( listener ) ; } } }
Adds a collection of listeners to the current project .
20,476
public < E extends Enum < E > & FieldType > E nextField ( Class < E > clazz , UserFieldDataType type ) { for ( String name : m_names [ type . ordinal ( ) ] ) { int i = NumberHelper . getInt ( m_counters . get ( name ) ) + 1 ; try { E e = Enum . valueOf ( clazz , name + i ) ; m_counters . put ( name , Integer . valueOf ...
Generate the next available field for a user defined field .
20,477
private ProjectFile read ( ) throws Exception { m_project = new ProjectFile ( ) ; m_eventManager = m_project . getEventManager ( ) ; ProjectConfig config = m_project . getProjectConfig ( ) ; config . setAutoCalendarUniqueID ( false ) ; config . setAutoTaskID ( false ) ; config . setAutoTaskUniqueID ( false ) ; config ....
Read FTS file data from the configured source and return a populated ProjectFile instance .
20,478
private void processDependencies ( ) { Set < Task > tasksWithBars = new HashSet < Task > ( ) ; FastTrackTable table = m_data . getTable ( FastTrackTableType . ACTBARS ) ; for ( MapRow row : table ) { Task task = m_project . getTaskByUniqueID ( row . getInteger ( ActBarField . _ACTIVITY ) ) ; if ( task == null || tasksW...
Process task dependencies .
20,479
private Integer getOutlineLevel ( Task task ) { String value = task . getWBS ( ) ; Integer result = Integer . valueOf ( 1 ) ; if ( value != null && value . length ( ) > 0 ) { String [ ] path = WBS_SPLIT_REGEX . split ( value ) ; result = Integer . valueOf ( path . length ) ; } return result ; }
Extract the outline level from a task s WBS attribute .
20,480
public void setWeeklyDay ( Day day , boolean value ) { if ( value ) { m_days . add ( day ) ; } else { m_days . remove ( day ) ; } }
Set the state of an individual day in a weekly recurrence .
20,481
public void setWeeklyDaysFromBitmap ( Integer days , int [ ] masks ) { if ( days != null ) { int value = days . intValue ( ) ; for ( Day day : Day . values ( ) ) { setWeeklyDay ( day , ( ( value & masks [ day . getValue ( ) ] ) != 0 ) ) ; } } }
Converts from a bitmap to individual day flags for a weekly recurrence using the array of masks .
20,482
public Day getDayOfWeek ( ) { Day result = null ; if ( ! m_days . isEmpty ( ) ) { result = m_days . iterator ( ) . next ( ) ; } return result ; }
Retrieves the monthly or yearly relative day of the week .
20,483
public Date [ ] getDates ( ) { int frequency = NumberHelper . getInt ( m_frequency ) ; if ( frequency < 1 ) { frequency = 1 ; } Calendar calendar = DateHelper . popCalendar ( m_startDate ) ; List < Date > dates = new ArrayList < Date > ( ) ; switch ( m_recurrenceType ) { case DAILY : { getDailyDates ( calendar , freque...
Retrieve the set of start dates represented by this recurrence data .
20,484
private boolean moreDates ( Calendar calendar , List < Date > dates ) { boolean result ; if ( m_finishDate == null ) { int occurrences = NumberHelper . getInt ( m_occurrences ) ; if ( occurrences < 1 ) { occurrences = 1 ; } result = dates . size ( ) < occurrences ; } else { result = calendar . getTimeInMillis ( ) <= m_...
Determines if we need to calculate more dates . If we do not have a finish date this method falls back on using the occurrences attribute . If we have a finish date we ll use that instead . We re assuming that the recurring data has one or other of those values .
20,485
private void getDailyDates ( Calendar calendar , int frequency , List < Date > dates ) { while ( moreDates ( calendar , dates ) ) { dates . add ( calendar . getTime ( ) ) ; calendar . add ( Calendar . DAY_OF_YEAR , frequency ) ; } }
Calculate start dates for a daily recurrence .
20,486
private void getWeeklyDates ( Calendar calendar , int frequency , List < Date > dates ) { int currentDay = calendar . get ( Calendar . DAY_OF_WEEK ) ; while ( moreDates ( calendar , dates ) ) { int offset = 0 ; for ( int dayIndex = 0 ; dayIndex < 7 ; dayIndex ++ ) { if ( getWeeklyDay ( Day . getInstance ( currentDay ) ...
Calculate start dates for a weekly recurrence .
20,487
private void getMonthlyDates ( Calendar calendar , int frequency , List < Date > dates ) { if ( m_relative ) { getMonthlyRelativeDates ( calendar , frequency , dates ) ; } else { getMonthlyAbsoluteDates ( calendar , frequency , dates ) ; } }
Calculate start dates for a monthly recurrence .
20,488
private void getMonthlyRelativeDates ( Calendar calendar , int frequency , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; int dayNumber = NumberHelper . getInt ( m_dayNumber ) ; while ( moreDates ( calendar , dates ) ) { if ( dayNumber > 4 ) { ...
Calculate start dates for a monthly relative recurrence .
20,489
private void getMonthlyAbsoluteDates ( Calendar calendar , int frequency , List < Date > dates ) { int currentDayNumber = calendar . get ( Calendar . DAY_OF_MONTH ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; int requiredDayNumber = NumberHelper . getInt ( m_dayNumber ) ; if ( requiredDayNumber < currentDayNumbe...
Calculate start dates for a monthly absolute recurrence .
20,490
private void getYearlyDates ( Calendar calendar , List < Date > dates ) { if ( m_relative ) { getYearlyRelativeDates ( calendar , dates ) ; } else { getYearlyAbsoluteDates ( calendar , dates ) ; } }
Calculate start dates for a yearly recurrence .
20,491
private void getYearlyRelativeDates ( Calendar calendar , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; calendar . set ( Calendar . MONTH , NumberHelper . getInt ( m_monthNumber ) - 1 ) ; int dayNumber = NumberHelper . getInt ( m_dayNumber ) ;...
Calculate start dates for a yearly relative recurrence .
20,492
private void getYearlyAbsoluteDates ( Calendar calendar , List < Date > dates ) { long startDate = calendar . getTimeInMillis ( ) ; calendar . set ( Calendar . DAY_OF_MONTH , 1 ) ; calendar . set ( Calendar . MONTH , NumberHelper . getInt ( m_monthNumber ) - 1 ) ; int requiredDayNumber = NumberHelper . getInt ( m_dayNu...
Calculate start dates for a yearly absolute recurrence .
20,493
private void setCalendarToOrdinalRelativeDay ( Calendar calendar , int dayNumber ) { int currentDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int requiredDayOfWeek = getDayOfWeek ( ) . getValue ( ) ; int dayOfWeekOffset = 0 ; if ( requiredDayOfWeek > currentDayOfWeek ) { dayOfWeekOffset = requiredDayOfWeek - ...
Moves a calendar to the nth named day of the month .
20,494
private void setCalendarToLastRelativeDay ( Calendar calendar ) { calendar . set ( Calendar . DAY_OF_MONTH , calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; int currentDayOfWeek = calendar . get ( Calendar . DAY_OF_WEEK ) ; int requiredDayOfWeek = getDayOfWeek ( ) . getValue ( ) ; int dayOfWeekOffset = 0 ; ...
Moves a calendar to the last named day of the month .
20,495
public void setYearlyAbsoluteFromDate ( Date date ) { if ( date != null ) { Calendar cal = DateHelper . popCalendar ( date ) ; m_dayNumber = Integer . valueOf ( cal . get ( Calendar . DAY_OF_MONTH ) ) ; m_monthNumber = Integer . valueOf ( cal . get ( Calendar . MONTH ) + 1 ) ; DateHelper . pushCalendar ( cal ) ; } }
Sets the yearly absolute date .
20,496
private String getOrdinal ( Integer value ) { String result ; int index = value . intValue ( ) ; if ( index >= ORDINAL . length ) { result = "every " + index + "th" ; } else { result = ORDINAL [ index ] ; } return result ; }
Retrieve the ordinal text for a given integer .
20,497
public static Priority getInstance ( Locale locale , String priority ) { int index = DEFAULT_PRIORITY_INDEX ; if ( priority != null ) { String [ ] priorityTypes = LocaleData . getStringArray ( locale , LocaleData . PRIORITY_TYPES ) ; for ( int loop = 0 ; loop < priorityTypes . length ; loop ++ ) { if ( priorityTypes [ ...
This method takes the textual version of a priority and returns an appropriate instance of this class . Note that unrecognised values are treated as medium priority .
20,498
public static Duration add ( Duration a , Duration b , ProjectProperties defaults ) { if ( a == null && b == null ) { return null ; } if ( a == null ) { return b ; } if ( b == null ) { return a ; } TimeUnit unit = a . getUnits ( ) ; if ( b . getUnits ( ) != unit ) { b = b . convertUnits ( unit , defaults ) ; } return D...
If a and b are not null returns a new duration of a + b . If a is null and b is not null returns b . If a is not null and b is null returns a . If a and b are null returns null . If needed b is converted to a s time unit using the project properties .
20,499
public static ProjectReader getProjectReader ( String name ) throws MPXJException { int index = name . lastIndexOf ( '.' ) ; if ( index == - 1 ) { throw new IllegalArgumentException ( "Filename has no extension: " + name ) ; } String extension = name . substring ( index + 1 ) . toUpperCase ( ) ; Class < ? extends Proje...
Retrieves a ProjectReader instance which can read a file of the type specified by the supplied file name .