idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
20,100 | private void writeTasks ( Project project ) { Project . Tasks tasks = m_factory . createProjectTasks ( ) ; project . setTasks ( tasks ) ; List < Project . Tasks . Task > list = tasks . getTask ( ) ; for ( Task task : m_projectFile . getTasks ( ) ) { list . add ( writeTask ( task ) ) ; } } | This method writes task data to an MSPDI file . |
20,101 | private void writeTaskBaselines ( Project . Tasks . Task xmlTask , Task mpxjTask ) { Project . Tasks . Task . Baseline baseline = m_factory . createProjectTasksTaskBaseline ( ) ; boolean populated = false ; Number cost = mpxjTask . getBaselineCost ( ) ; if ( cost != null && cost . intValue ( ) != 0 ) { populated = true... | Writes task baseline data . |
20,102 | private void writeTaskExtendedAttributes ( Project . Tasks . Task xml , Task mpx ) { Project . Tasks . Task . ExtendedAttribute attrib ; List < Project . Tasks . Task . ExtendedAttribute > extendedAttributes = xml . getExtendedAttribute ( ) ; for ( TaskField mpxFieldID : getAllTaskExtendedAttributes ( ) ) { Object valu... | This method writes extended attribute data for a task . |
20,103 | private BigInteger printExtendedAttributeDurationFormat ( Object value ) { BigInteger result = null ; if ( value instanceof Duration ) { result = DatatypeConverter . printDurationTimeUnits ( ( ( Duration ) value ) . getUnits ( ) , false ) ; } return ( result ) ; } | Converts a duration to duration time units . |
20,104 | private BigInteger getTaskCalendarID ( Task mpx ) { BigInteger result = null ; ProjectCalendar cal = mpx . getCalendar ( ) ; if ( cal != null ) { result = NumberHelper . getBigInteger ( cal . getUniqueID ( ) ) ; } else { result = NULL_CALENDAR_ID ; } return ( result ) ; } | This method retrieves the UID for a calendar associated with a task . |
20,105 | private void writePredecessors ( Project . Tasks . Task xml , Task mpx ) { List < Project . Tasks . Task . PredecessorLink > list = xml . getPredecessorLink ( ) ; List < Relation > predecessors = mpx . getPredecessors ( ) ; for ( Relation rel : predecessors ) { Integer taskUniqueID = rel . getTargetTask ( ) . getUnique... | This method writes predecessor data to an MSPDI 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,106 | private Project . Tasks . Task . PredecessorLink writePredecessor ( Integer taskID , RelationType type , Duration lag ) { Project . Tasks . Task . PredecessorLink link = m_factory . createProjectTasksTaskPredecessorLink ( ) ; link . setPredecessorUID ( NumberHelper . getBigInteger ( taskID ) ) ; link . setType ( BigInt... | This method writes a single predecessor link to the MSPDI file . |
20,107 | private void writeAssignments ( Project project ) { Project . Assignments assignments = m_factory . createProjectAssignments ( ) ; project . setAssignments ( assignments ) ; List < Project . Assignments . Assignment > list = assignments . getAssignment ( ) ; for ( ResourceAssignment assignment : m_projectFile . getReso... | This method writes assignment data to an MSPDI file . |
20,108 | private void writeAssignmentBaselines ( Project . Assignments . Assignment xml , ResourceAssignment mpxj ) { Project . Assignments . Assignment . Baseline baseline = m_factory . createProjectAssignmentsAssignmentBaseline ( ) ; boolean populated = false ; Number cost = mpxj . getBaselineCost ( ) ; if ( cost != null && c... | Writes assignment baseline data . |
20,109 | private void writeAssignmentExtendedAttributes ( Project . Assignments . Assignment xml , ResourceAssignment mpx ) { Project . Assignments . Assignment . ExtendedAttribute attrib ; List < Project . Assignments . Assignment . ExtendedAttribute > extendedAttributes = xml . getExtendedAttribute ( ) ; for ( AssignmentField... | This method writes extended attribute data for an assignment . |
20,110 | private void writeAssignmentTimephasedData ( ResourceAssignment mpx , Project . Assignments . Assignment xml ) { if ( m_writeTimphasedData && mpx . getHasTimephasedData ( ) ) { List < TimephasedDataType > list = xml . getTimephasedData ( ) ; ProjectCalendar calendar = mpx . getCalendar ( ) ; BigInteger assignmentID = x... | Writes the timephased data for a resource assignment . |
20,111 | private void writeAssignmentTimephasedData ( BigInteger assignmentID , List < TimephasedDataType > list , List < TimephasedWork > data , int type ) { for ( TimephasedWork mpx : data ) { TimephasedDataType xml = m_factory . createTimephasedDataType ( ) ; list . add ( xml ) ; xml . setStart ( mpx . getStart ( ) ) ; xml .... | Writes a list of timephased data to the MSPDI file . |
20,112 | private List < AssignmentField > getAllAssignmentExtendedAttributes ( ) { ArrayList < AssignmentField > result = new ArrayList < AssignmentField > ( ) ; result . addAll ( Arrays . asList ( AssignmentFieldLists . CUSTOM_COST ) ) ; result . addAll ( Arrays . asList ( AssignmentFieldLists . CUSTOM_DATE ) ) ; result . addA... | Retrieve list of assignment extended attributes . |
20,113 | private List < TaskField > getAllTaskExtendedAttributes ( ) { ArrayList < TaskField > result = new ArrayList < TaskField > ( ) ; result . addAll ( Arrays . asList ( TaskFieldLists . CUSTOM_TEXT ) ) ; result . addAll ( Arrays . asList ( TaskFieldLists . CUSTOM_START ) ) ; result . addAll ( Arrays . asList ( TaskFieldLis... | Retrieve list of task extended attributes . |
20,114 | private List < ResourceField > getAllResourceExtendedAttributes ( ) { ArrayList < ResourceField > result = new ArrayList < ResourceField > ( ) ; result . addAll ( Arrays . asList ( ResourceFieldLists . CUSTOM_TEXT ) ) ; result . addAll ( Arrays . asList ( ResourceFieldLists . CUSTOM_START ) ) ; result . addAll ( Arrays... | Retrieve list of resource extended attributes . |
20,115 | private void processUDF ( UDFTypeType udf ) { FieldTypeClass fieldType = FIELD_TYPE_MAP . get ( udf . getSubjectArea ( ) ) ; if ( fieldType != null ) { UserFieldDataType dataType = UserFieldDataType . getInstanceFromXmlName ( udf . getDataType ( ) ) ; String name = udf . getTitle ( ) ; FieldType field = addUserDefinedF... | Process an individual UDF . |
20,116 | private FieldType addUserDefinedField ( FieldTypeClass fieldType , UserFieldDataType dataType , String name ) { FieldType field = null ; try { switch ( fieldType ) { case TASK : { do { field = m_taskUdfCounters . nextField ( TaskField . class , dataType ) ; } while ( RESERVED_TASK_FIELDS . contains ( field ) ) ; m_proj... | Map the Primavera UDF to a custom field . |
20,117 | private Double zeroIsNull ( Double value ) { if ( value != null && value . doubleValue ( ) == 0 ) { value = null ; } return value ; } | Render a zero Double as null . |
20,118 | private Duration getDuration ( Double duration ) { Duration result = null ; if ( duration != null ) { result = Duration . getInstance ( NumberHelper . getDouble ( duration ) , TimeUnit . HOURS ) ; } return result ; } | Extracts a duration from a JAXBElement instance . |
20,119 | private void readUDFTypes ( FieldContainer mpxj , List < UDFAssignmentType > udfs ) { for ( UDFAssignmentType udf : udfs ) { FieldType fieldType = m_fieldTypeMap . get ( Integer . valueOf ( udf . getTypeObjectId ( ) ) ) ; if ( fieldType != null ) { mpxj . set ( fieldType , getUdfValue ( udf ) ) ; } } } | Process UDFs for a specific object . |
20,120 | private Object getUdfValue ( UDFAssignmentType udf ) { if ( udf . getCostValue ( ) != null ) { return udf . getCostValue ( ) ; } if ( udf . getDoubleValue ( ) != null ) { return udf . getDoubleValue ( ) ; } if ( udf . getFinishDateValue ( ) != null ) { return udf . getFinishDateValue ( ) ; } if ( udf . getIndicatorValu... | Retrieve the value of a UDF . |
20,121 | private Integer mapTaskID ( Integer id ) { Integer mappedID = m_clashMap . get ( id ) ; if ( mappedID == null ) { mappedID = id ; } return ( mappedID ) ; } | Deals with the case where we have had to map a task ID to a new value . |
20,122 | public int evaluate ( FieldContainer container ) { List < GraphicalIndicatorCriteria > criteria ; if ( container instanceof Task ) { Task task = ( Task ) container ; if ( NumberHelper . getInt ( task . getUniqueID ( ) ) == 0 ) { if ( m_projectSummaryInheritsFromSummaryRows == false ) { criteria = m_projectSummaryCriter... | This method evaluates a if a graphical indicator should be displayed given a set of Task or Resource data . The method will return - 1 if no indicator should be displayed . |
20,123 | private void writeFileCreationRecord ( ) throws IOException { ProjectProperties properties = m_projectFile . getProjectProperties ( ) ; m_buffer . setLength ( 0 ) ; m_buffer . append ( "MPX" ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( properties . getMpxProgramName ( ) ) ; m_buffer . append ( m_delimite... | Write file creation record . |
20,124 | private void writeCalendar ( ProjectCalendar record ) throws IOException { if ( record . getParent ( ) == null || record . getResource ( ) != null ) { m_buffer . setLength ( 0 ) ; if ( record . getParent ( ) == null ) { m_buffer . append ( MPXConstants . BASE_CALENDAR_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter )... | Write a calendar . |
20,125 | private void writeCalendarHours ( ProjectCalendar parentCalendar , ProjectCalendarHours record ) throws IOException { m_buffer . setLength ( 0 ) ; int recordNumber ; if ( ! parentCalendar . isDerived ( ) ) { recordNumber = MPXConstants . BASE_CALENDAR_HOURS_RECORD_NUMBER ; } else { recordNumber = MPXConstants . RESOURC... | Write calendar hours . |
20,126 | private void writeResource ( Resource record ) throws IOException { m_buffer . setLength ( 0 ) ; int [ ] fields = m_resourceModel . getModel ( ) ; m_buffer . append ( MPXConstants . RESOURCE_RECORD_NUMBER ) ; for ( int loop = 0 ; loop < fields . length ; loop ++ ) { int mpxFieldType = fields [ loop ] ; if ( mpxFieldTyp... | Write a resource . |
20,127 | private void writeNotes ( int recordNumber , String text ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( recordNumber ) ; m_buffer . append ( m_delimiter ) ; if ( text != null ) { String note = stripLineBreaks ( text , MPXConstants . EOL_PLACEHOLDER_STRING ) ; boolean quote = ( note . indexOf ( ... | Write notes . |
20,128 | private void writeResourceAssignment ( ResourceAssignment record ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( MPXConstants . RESOURCE_ASSIGNMENT_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( formatResource ( record . getResource ( ) ) ) ; m_buffer . append ( m_deli... | Write resource assignment . |
20,129 | private void writeResourceAssignmentWorkgroupFields ( ResourceAssignmentWorkgroupFields record ) throws IOException { m_buffer . setLength ( 0 ) ; m_buffer . append ( MPXConstants . RESOURCE_ASSIGNMENT_WORKGROUP_FIELDS_RECORD_NUMBER ) ; m_buffer . append ( m_delimiter ) ; m_buffer . append ( format ( record . getMessag... | Write resource assignment workgroup . |
20,130 | private void writeTasks ( List < Task > tasks ) throws IOException { for ( Task task : tasks ) { writeTask ( task ) ; writeTasks ( task . getChildTasks ( ) ) ; } } | Recursively write tasks . |
20,131 | private Integer getIntegerTimeInMinutes ( Date date ) { Integer result = null ; if ( date != null ) { Calendar cal = DateHelper . popCalendar ( date ) ; int time = cal . get ( Calendar . HOUR_OF_DAY ) * 60 ; time += cal . get ( Calendar . MINUTE ) ; DateHelper . pushCalendar ( cal ) ; result = Integer . valueOf ( time ... | This internal method is used to convert from a Date instance to an integer representing the number of minutes past midnight . |
20,132 | private String escapeQuotes ( String value ) { StringBuilder sb = new StringBuilder ( ) ; int length = value . length ( ) ; char c ; sb . append ( '"' ) ; for ( int index = 0 ; index < length ; index ++ ) { c = value . charAt ( index ) ; sb . append ( c ) ; if ( c == '"' ) { sb . append ( '"' ) ; } } sb . append ( '"' ... | This method is called when double quotes are found as part of a value . The quotes are escaped by adding a second quote character and the entire value is quoted . |
20,133 | private String stripLineBreaks ( String text , String replacement ) { if ( text . indexOf ( '\r' ) != - 1 || text . indexOf ( '\n' ) != - 1 ) { StringBuilder sb = new StringBuilder ( text ) ; int index ; while ( ( index = sb . indexOf ( "\r\n" ) ) != - 1 ) { sb . replace ( index , index + 2 , replacement ) ; } while ( ... | This method removes line breaks from a piece of text and replaces them with the supplied text . |
20,134 | private String format ( Object o ) { String result ; if ( o == null ) { result = "" ; } else { if ( o instanceof Boolean == true ) { result = LocaleData . getString ( m_locale , ( ( ( Boolean ) o ) . booleanValue ( ) == true ? LocaleData . YES : LocaleData . NO ) ) ; } else { if ( o instanceof Float == true || o instan... | This method returns the string representation of an object . In most cases this will simply involve calling the normal toString method on the object but a couple of exceptions are handled here . |
20,135 | private void stripTrailingDelimiters ( StringBuilder buffer ) { int index = buffer . length ( ) - 1 ; while ( index > 0 && buffer . charAt ( index ) == m_delimiter ) { -- index ; } buffer . setLength ( index + 1 ) ; } | This method removes trailing delimiter characters . |
20,136 | private String formatTime ( Date value ) { return ( value == null ? null : m_formats . getTimeFormat ( ) . format ( value ) ) ; } | This method is called to format a time value . |
20,137 | private String formatCurrency ( Number value ) { return ( value == null ? null : m_formats . getCurrencyFormat ( ) . format ( value ) ) ; } | This method is called to format a currency value . |
20,138 | private String formatUnits ( Number value ) { return ( value == null ? null : m_formats . getUnitsDecimalFormat ( ) . format ( value . doubleValue ( ) / 100 ) ) ; } | This method is called to format a units value . |
20,139 | private String formatDateTimeNull ( Date value ) { return ( value == null ? m_formats . getNullText ( ) : m_formats . getDateTimeFormat ( ) . format ( value ) ) ; } | This method is called to format a date . It will return the null text if a null value is supplied . |
20,140 | private String formatPercentage ( Number value ) { return ( value == null ? null : m_formats . getPercentageDecimalFormat ( ) . format ( value ) + "%" ) ; } | This method is called to format a percentage value . |
20,141 | private String formatAccrueType ( AccrueType type ) { return ( type == null ? null : LocaleData . getStringArray ( m_locale , LocaleData . ACCRUE_TYPES ) [ type . getValue ( ) - 1 ] ) ; } | This method is called to format an accrue type value . |
20,142 | private String formatConstraintType ( ConstraintType type ) { return ( type == null ? null : LocaleData . getStringArray ( m_locale , LocaleData . CONSTRAINT_TYPES ) [ type . getValue ( ) ] ) ; } | This method is called to format a constraint type . |
20,143 | private String formatDuration ( Object value ) { String result = null ; if ( value instanceof Duration ) { Duration duration = ( Duration ) value ; result = m_formats . getDurationDecimalFormat ( ) . format ( duration . getDuration ( ) ) + formatTimeUnit ( duration . getUnits ( ) ) ; } return result ; } | This method is called to format a duration . |
20,144 | private String formatRate ( Rate value ) { String result = null ; if ( value != null ) { StringBuilder buffer = new StringBuilder ( m_formats . getCurrencyFormat ( ) . format ( value . getAmount ( ) ) ) ; buffer . append ( "/" ) ; buffer . append ( formatTimeUnit ( value . getUnits ( ) ) ) ; result = buffer . toString ... | This method is called to format a rate . |
20,145 | private String formatPriority ( Priority value ) { String result = null ; if ( value != null ) { String [ ] priorityTypes = LocaleData . getStringArray ( m_locale , LocaleData . PRIORITY_TYPES ) ; int priority = value . getValue ( ) ; if ( priority < Priority . LOWEST ) { priority = Priority . LOWEST ; } else { if ( pr... | This method is called to format a priority . |
20,146 | private String formatTaskType ( TaskType value ) { return ( LocaleData . getString ( m_locale , ( value == TaskType . FIXED_DURATION ? LocaleData . YES : LocaleData . NO ) ) ) ; } | This method is called to format a task type . |
20,147 | private String formatRelationList ( List < Relation > value ) { String result = null ; if ( value != null && value . size ( ) != 0 ) { StringBuilder sb = new StringBuilder ( ) ; for ( Relation relation : value ) { if ( sb . length ( ) != 0 ) { sb . append ( m_delimiter ) ; } sb . append ( formatRelation ( relation ) ) ... | This method is called to format a relation list . |
20,148 | private String formatRelation ( Relation relation ) { String result = null ; if ( relation != null ) { StringBuilder sb = new StringBuilder ( relation . getTargetTask ( ) . getID ( ) . toString ( ) ) ; Duration duration = relation . getLag ( ) ; RelationType type = relation . getType ( ) ; double durationValue = durati... | This method is called to format a relation . |
20,149 | private String formatTimeUnit ( TimeUnit timeUnit ) { int units = timeUnit . getValue ( ) ; String result ; String [ ] [ ] unitNames = LocaleData . getStringArrays ( m_locale , LocaleData . TIME_UNITS_ARRAY ) ; if ( units < 0 || units >= unitNames . length ) { result = "" ; } else { result = unitNames [ units ] [ 0 ] ;... | This method formats a time unit . |
20,150 | @ SuppressWarnings ( "unchecked" ) private Object formatType ( DataType type , Object value ) { switch ( type ) { case DATE : { value = formatDateTime ( value ) ; break ; } case CURRENCY : { value = formatCurrency ( ( Number ) value ) ; break ; } case UNITS : { value = formatUnits ( ( Number ) value ) ; break ; } case ... | Converts a value to the appropriate type . |
20,151 | public final boolean getBoolean ( String name ) { boolean result = false ; Boolean value = ( Boolean ) getObject ( name ) ; if ( value != null ) { result = BooleanHelper . getBoolean ( value ) ; } return result ; } | Retrieve a boolean value . |
20,152 | public InputStream getInstance ( DirectoryEntry directory , String name ) throws IOException { DocumentEntry entry = ( DocumentEntry ) directory . getEntry ( name ) ; InputStream stream ; if ( m_encrypted ) { stream = new EncryptedDocumentInputStream ( entry , m_encryptionCode ) ; } else { stream = new DocumentInputStr... | Method used to instantiate the appropriate input stream reader a standard one or one which can deal with encrypted data . |
20,153 | private TaskField getTaskField ( int field ) { TaskField result = MPPTaskField14 . getInstance ( field ) ; if ( result != null ) { switch ( result ) { case START_TEXT : { result = TaskField . START ; break ; } case FINISH_TEXT : { result = TaskField . FINISH ; break ; } case DURATION_TEXT : { result = TaskField . DURAT... | Maps an integer field ID to a field type . |
20,154 | public void updateUniqueCounters ( ) { for ( Task task : m_parent . getTasks ( ) ) { int uniqueID = NumberHelper . getInt ( task . getUniqueID ( ) ) ; if ( uniqueID > m_taskUniqueID ) { m_taskUniqueID = uniqueID ; } } for ( Resource resource : m_parent . getResources ( ) ) { int uniqueID = NumberHelper . getInt ( resou... | This method is called to ensure that after a project file has been read the cached unique ID values used to generate new unique IDs start after the end of the existing set of unique IDs . |
20,155 | public static Date min ( Date d1 , Date d2 ) { Date result ; if ( d1 == null ) { result = d2 ; } else if ( d2 == null ) { result = d1 ; } else { result = ( d1 . compareTo ( d2 ) < 0 ) ? d1 : d2 ; } return result ; } | Returns the earlier of two dates handling null values . A non - null Date is always considered to be earlier than a null Date . |
20,156 | public static Date max ( Date d1 , Date d2 ) { Date result ; if ( d1 == null ) { result = d2 ; } else if ( d2 == null ) { result = d1 ; } else { result = ( d1 . compareTo ( d2 ) > 0 ) ? d1 : d2 ; } return result ; } | Returns the later of two dates handling null values . A non - null Date is always considered to be later than a null Date . |
20,157 | public static Duration getVariance ( Task task , Date date1 , Date date2 , TimeUnit format ) { Duration variance = null ; if ( date1 != null && date2 != null ) { ProjectCalendar calendar = task . getEffectiveCalendar ( ) ; if ( calendar != null ) { variance = calendar . getWork ( date1 , date2 , format ) ; } } if ( var... | This utility method calculates the difference in working time between two dates given the context of a task . |
20,158 | public static Date getDateFromLong ( long date ) { TimeZone tz = TimeZone . getDefault ( ) ; return ( new Date ( date - tz . getRawOffset ( ) ) ) ; } | Creates a date from the equivalent long value . This conversion takes account of the time zone . |
20,159 | public static Date getTimestampFromLong ( long timestamp ) { TimeZone tz = TimeZone . getDefault ( ) ; Date result = new Date ( timestamp - tz . getRawOffset ( ) ) ; if ( tz . inDaylightTime ( result ) == true ) { int savings ; if ( HAS_DST_SAVINGS == true ) { savings = tz . getDSTSavings ( ) ; } else { savings = DEFAU... | Creates a timestamp from the equivalent long value . This conversion takes account of the time zone and any daylight savings time . |
20,160 | public static Date getTime ( int hour , int minutes ) { Calendar cal = popCalendar ( ) ; cal . set ( Calendar . HOUR_OF_DAY , hour ) ; cal . set ( Calendar . MINUTE , minutes ) ; cal . set ( Calendar . SECOND , 0 ) ; Date result = cal . getTime ( ) ; pushCalendar ( cal ) ; return result ; } | Create a Date instance representing a specific time . |
20,161 | public static void setTime ( Calendar cal , Date time ) { if ( time != null ) { Calendar startCalendar = popCalendar ( time ) ; cal . set ( Calendar . HOUR_OF_DAY , startCalendar . get ( Calendar . HOUR_OF_DAY ) ) ; cal . set ( Calendar . MINUTE , startCalendar . get ( Calendar . MINUTE ) ) ; cal . set ( Calendar . SEC... | Given a date represented by a Calendar instance set the time component of the date based on the hours and minutes of the time supplied by the Date instance . |
20,162 | public static Date setTime ( Date date , Date canonicalTime ) { Date result ; if ( canonicalTime == null ) { result = date ; } else { Calendar cal = popCalendar ( canonicalTime ) ; int dayOffset = cal . get ( Calendar . DAY_OF_YEAR ) - 1 ; int hourOfDay = cal . get ( Calendar . HOUR_OF_DAY ) ; int minute = cal . get ( ... | Given a date represented by a Date instance set the time component of the date based on the hours and minutes of the time supplied by the Date instance . |
20,163 | public static Date addDays ( Date date , int days ) { Calendar cal = popCalendar ( date ) ; cal . add ( Calendar . DAY_OF_YEAR , days ) ; Date result = cal . getTime ( ) ; pushCalendar ( cal ) ; return result ; } | Add a number of days to the supplied date . |
20,164 | public static Calendar popCalendar ( ) { Calendar result ; Deque < Calendar > calendars = CALENDARS . get ( ) ; if ( calendars . isEmpty ( ) ) { result = Calendar . getInstance ( ) ; } else { result = calendars . pop ( ) ; } return result ; } | Acquire a calendar instance . |
20,165 | public List < MapRow > read ( ) throws IOException { List < MapRow > result = new ArrayList < MapRow > ( ) ; int fileCount = m_stream . readInt ( ) ; if ( fileCount != 0 ) { for ( int index = 0 ; index < fileCount ; index ++ ) { Map < String , Object > map = new LinkedHashMap < String , Object > ( ) ; readBlock ( map )... | Read a list of fixed sized blocks from the input stream . |
20,166 | protected int readByte ( InputStream is ) throws IOException { byte [ ] data = new byte [ 1 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getByte ( data , 0 ) ) ; } | This method reads a single byte from the input stream . |
20,167 | protected int readShort ( InputStream is ) throws IOException { byte [ ] data = new byte [ 2 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getShort ( data , 0 ) ) ; } | This method reads a two byte integer from the input stream . |
20,168 | protected int readInt ( InputStream is ) throws IOException { byte [ ] data = new byte [ 4 ] ; if ( is . read ( data ) != data . length ) { throw new EOFException ( ) ; } return ( MPPUtility . getInt ( data , 0 ) ) ; } | This method reads a four byte integer from the input stream . |
20,169 | protected byte [ ] readByteArray ( InputStream is , int size ) throws IOException { byte [ ] buffer = new byte [ size ] ; if ( is . read ( buffer ) != buffer . length ) { throw new EOFException ( ) ; } return ( buffer ) ; } | This method reads a byte array from the input stream . |
20,170 | public int blast ( InputStream input , OutputStream output ) throws IOException { m_input = input ; m_output = output ; int lit ; int dict ; int symbol ; int len ; int dist ; int copy ; lit = bits ( 8 ) ; if ( lit > 1 ) { return - 1 ; } dict = bits ( 8 ) ; if ( dict < 4 || dict > 6 ) { return - 2 ; } do { if ( bits ( 1... | Decode PKWare Compression Library stream . |
20,171 | private int decode ( Huffman h ) throws IOException { int len ; int code ; int first ; int count ; int index ; int bitbuf ; int left ; bitbuf = m_bitbuf ; left = m_bitcnt ; code = first = index = 0 ; len = 1 ; int nextIndex = 1 ; while ( true ) { while ( left -- != 0 ) { code |= ( bitbuf & 1 ) ^ 1 ; bitbuf >>= 1 ; coun... | Decode a code from the stream s using huffman table h . Return the symbol or a negative value if there is an error . If all of the lengths are zero i . e . an empty code or if the code is incomplete and an invalid code is received then - 9 is returned after reading MAXBITS bits . |
20,172 | private void validateSameDay ( ProjectCalendar calendar , LinkedList < TimephasedWork > list ) { for ( TimephasedWork assignment : list ) { Date assignmentStart = assignment . getStart ( ) ; Date calendarStartTime = calendar . getStartTime ( assignmentStart ) ; Date assignmentStartTime = DateHelper . getCanonicalTime (... | Ensures that the start and end dates for ranges fit within the working times for a given day . |
20,173 | public Table createTable ( ProjectFile file , byte [ ] data , VarMeta varMeta , Var2Data varData ) { Table table = new Table ( ) ; table . setID ( MPPUtility . getInt ( data , 0 ) ) ; table . setResourceFlag ( MPPUtility . getShort ( data , 108 ) == 1 ) ; table . setName ( MPPUtility . removeAmpersands ( MPPUtility . g... | Creates a new Table instance from data extracted from an MPP file . |
20,174 | private final boolean parseBoolean ( String value ) { return value != null && ( value . equalsIgnoreCase ( "true" ) || value . equalsIgnoreCase ( "y" ) || value . equalsIgnoreCase ( "yes" ) ) ; } | Parse a string representation of a Boolean value . XER files sometimes have N and Y to indicate boolean |
20,175 | public void processActivityCodes ( List < Row > types , List < Row > typeValues , List < Row > assignments ) { ActivityCodeContainer container = m_project . getActivityCodes ( ) ; Map < Integer , ActivityCode > map = new HashMap < Integer , ActivityCode > ( ) ; for ( Row row : types ) { ActivityCode code = new Activity... | Read activity code types and values . |
20,176 | public void processCalendar ( Row row ) { ProjectCalendar calendar = m_project . addCalendar ( ) ; Integer id = row . getInteger ( "clndr_id" ) ; m_calMap . put ( id , calendar ) ; calendar . setName ( row . getString ( "clndr_name" ) ) ; try { calendar . setMinutesPerDay ( Integer . valueOf ( ( int ) NumberHelper . ge... | Process data for an individual calendar . |
20,177 | private void processCalendarDays ( ProjectCalendar calendar , Record root ) { Record daysOfWeek = root . getChild ( "DaysOfWeek" ) ; if ( daysOfWeek != null ) { for ( Record dayRecord : daysOfWeek . getChildren ( ) ) { processCalendarHours ( calendar , dayRecord ) ; } } } | Process calendar days of the week . |
20,178 | private void processCalendarHours ( ProjectCalendar calendar , Record dayRecord ) { Day day = Day . getInstance ( Integer . parseInt ( dayRecord . getField ( ) ) ) ; List < Record > recHours = dayRecord . getChildren ( ) ; if ( recHours . size ( ) == 0 ) { calendar . setWorkingDay ( day , false ) ; } else { calendar . ... | Process hours in a working day . |
20,179 | private void addHours ( ProjectCalendarDateRanges ranges , Record hoursRecord ) { if ( hoursRecord . getValue ( ) != null ) { String [ ] wh = hoursRecord . getValue ( ) . split ( "\\|" ) ; try { String startText ; String endText ; if ( wh [ 0 ] . equals ( "s" ) ) { startText = wh [ 1 ] ; endText = wh [ 3 ] ; } else { s... | Parses a record containing hours and add them to a container . |
20,180 | private ProjectCalendar getResourceCalendar ( Integer calendarID ) { ProjectCalendar result = null ; if ( calendarID != null ) { ProjectCalendar calendar = m_calMap . get ( calendarID ) ; if ( calendar != null ) { if ( ! calendar . isDerived ( ) ) { ProjectCalendar resourceCalendar = m_project . addCalendar ( ) ; resou... | Retrieve the correct calendar for a resource . |
20,181 | private FieldType getActivityIDField ( Map < FieldType , String > map ) { FieldType result = null ; for ( Map . Entry < FieldType , String > entry : map . entrySet ( ) ) { if ( entry . getValue ( ) . equals ( "task_code" ) ) { result = entry . getKey ( ) ; break ; } } return result ; } | Determine which field the Activity ID has been mapped to . |
20,182 | private void addUserDefinedField ( FieldTypeClass fieldType , UserFieldDataType dataType , String name ) { try { switch ( fieldType ) { case TASK : TaskField taskField ; do { taskField = m_taskUdfCounters . nextField ( TaskField . class , dataType ) ; } while ( m_taskFields . containsKey ( taskField ) || m_wbsFields . ... | Configure a new user defined field . |
20,183 | private void addUDFValue ( FieldTypeClass fieldType , FieldContainer container , Row row ) { Integer fieldId = row . getInteger ( "udf_type_id" ) ; String fieldName = m_udfFields . get ( fieldId ) ; Object value = null ; FieldType field = m_project . getCustomFields ( ) . getFieldByAlias ( fieldType , fieldName ) ; if ... | Adds a user defined field value to a task . |
20,184 | private void populateUserDefinedFieldValues ( String tableName , FieldTypeClass type , FieldContainer container , Integer uniqueID ) { Map < Integer , List < Row > > tableData = m_udfValues . get ( tableName ) ; if ( tableData != null ) { List < Row > udf = tableData . get ( uniqueID ) ; if ( udf != null ) { for ( Row ... | Populate the UDF values for this entity . |
20,185 | public void processDefaultCurrency ( Row row ) { ProjectProperties properties = m_project . getProjectProperties ( ) ; properties . setCurrencySymbol ( row . getString ( "curr_symbol" ) ) ; properties . setSymbolPosition ( CURRENCY_SYMBOL_POSITION_MAP . get ( row . getString ( "pos_curr_fmt_type" ) ) ) ; properties . s... | Code common to both XER and database readers to extract currency format data . |
20,186 | private void processFields ( Map < FieldType , String > map , Row row , FieldContainer container ) { for ( Map . Entry < FieldType , String > entry : map . entrySet ( ) ) { FieldType field = entry . getKey ( ) ; String name = entry . getValue ( ) ; Object value ; switch ( field . getDataType ( ) ) { case INTEGER : { va... | Generic method to extract Primavera fields and assign to MPXJ fields . |
20,187 | private void applyAliases ( Map < FieldType , String > aliases ) { CustomFieldContainer fields = m_project . getCustomFields ( ) ; for ( Map . Entry < FieldType , String > entry : aliases . entrySet ( ) ) { fields . getCustomField ( entry . getKey ( ) ) . setAlias ( entry . getValue ( ) ) ; } } | Apply aliases to task and resource fields . |
20,188 | private Number calculatePercentComplete ( Row row ) { Number result ; switch ( PercentCompleteType . getInstance ( row . getString ( "complete_pct_type" ) ) ) { case UNITS : { result = calculateUnitsPercentComplete ( row ) ; break ; } case DURATION : { result = calculateDurationPercentComplete ( row ) ; break ; } defau... | Determine which type of percent complete is used on on this task and calculate the required value . |
20,189 | private Number calculateUnitsPercentComplete ( Row row ) { double result = 0 ; double actualWorkQuantity = NumberHelper . getDouble ( row . getDouble ( "act_work_qty" ) ) ; double actualEquipmentQuantity = NumberHelper . getDouble ( row . getDouble ( "act_equip_qty" ) ) ; double numerator = actualWorkQuantity + actualE... | Calculate the units percent complete . |
20,190 | private Number calculateDurationPercentComplete ( Row row ) { double result = 0 ; double targetDuration = row . getDuration ( "target_drtn_hr_cnt" ) . getDuration ( ) ; double remainingDuration = row . getDuration ( "remain_drtn_hr_cnt" ) . getDuration ( ) ; if ( targetDuration == 0 ) { if ( remainingDuration == 0 ) { ... | Calculate the duration percent complete . |
20,191 | public static Map < FieldType , String > getDefaultResourceFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( ResourceField . UNIQUE_ID , "rsrc_id" ) ; map . put ( ResourceField . GUID , "guid" ) ; map . put ( ResourceField . NAME , "rsrc_name" ) ; map . put ( Res... | Retrieve the default mapping between MPXJ resource fields and Primavera resource field names . |
20,192 | public static Map < FieldType , String > getDefaultWbsFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( TaskField . UNIQUE_ID , "wbs_id" ) ; map . put ( TaskField . GUID , "guid" ) ; map . put ( TaskField . NAME , "wbs_name" ) ; map . put ( TaskField . BASELINE_C... | Retrieve the default mapping between MPXJ task fields and Primavera wbs field names . |
20,193 | public static Map < FieldType , String > getDefaultTaskFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( TaskField . UNIQUE_ID , "task_id" ) ; map . put ( TaskField . GUID , "guid" ) ; map . put ( TaskField . NAME , "task_name" ) ; map . put ( TaskField . ACTUAL_... | Retrieve the default mapping between MPXJ task fields and Primavera task field names . |
20,194 | public static Map < FieldType , String > getDefaultAssignmentFieldMap ( ) { Map < FieldType , String > map = new LinkedHashMap < FieldType , String > ( ) ; map . put ( AssignmentField . UNIQUE_ID , "taskrsrc_id" ) ; map . put ( AssignmentField . GUID , "guid" ) ; map . put ( AssignmentField . REMAINING_WORK , "remain_q... | Retrieve the default mapping between MPXJ assignment fields and Primavera assignment field names . |
20,195 | public static Map < FieldType , String > getDefaultAliases ( ) { Map < FieldType , String > map = new HashMap < FieldType , String > ( ) ; map . put ( TaskField . DATE1 , "Suspend Date" ) ; map . put ( TaskField . DATE2 , "Resume Date" ) ; map . put ( TaskField . TEXT1 , "Code" ) ; map . put ( TaskField . TEXT2 , "Acti... | Retrieve the default aliases to be applied to MPXJ task and resource fields . |
20,196 | private static void filter ( String filename , String filtername ) throws Exception { ProjectFile project = new UniversalProjectReader ( ) . read ( filename ) ; Filter filter = project . getFilters ( ) . getFilterByName ( filtername ) ; if ( filter == null ) { displayAvailableFilters ( project ) ; } else { System . out... | This method opens the named project applies the named filter and displays the filtered list of tasks or resources . If an invalid filter name is supplied a list of valid filter names is shown . |
20,197 | private static void displayAvailableFilters ( ProjectFile project ) { System . out . println ( "Unknown filter name supplied." ) ; System . out . println ( "Available task filters:" ) ; for ( Filter filter : project . getFilters ( ) . getTaskFilters ( ) ) { System . out . println ( " " + filter . getName ( ) ) ; } Sy... | This utility displays a list of available task filters and a list of available resource filters . |
20,198 | private static void processTaskFilter ( ProjectFile project , Filter filter ) { for ( Task task : project . getTasks ( ) ) { if ( filter . evaluate ( task , null ) ) { System . out . println ( task . getID ( ) + "," + task . getUniqueID ( ) + "," + task . getName ( ) ) ; } } } | Apply a filter to the list of all tasks and show the results . |
20,199 | private static void processResourceFilter ( ProjectFile project , Filter filter ) { for ( Resource resource : project . getResources ( ) ) { if ( filter . evaluate ( resource , null ) ) { System . out . println ( resource . getID ( ) + "," + resource . getUniqueID ( ) + "," + resource . getName ( ) ) ; } } } | Apply a filter to the list of all resources and show the results . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.