idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
143,600
public static TimeZone get ( String suffix ) { if ( SUFFIX_TIMEZONES . containsKey ( suffix ) ) { return SUFFIX_TIMEZONES . get ( suffix ) ; } log . warn ( "Cannot find time zone for exchange suffix: '{}'. Using default: America/New_York" , suffix ) ; return SUFFIX_TIMEZONES . get ( "" ) ; }
Get the time zone for a specific exchange suffix
143,601
public static TimeZone getStockTimeZone ( String symbol ) { if ( INDEX_TIMEZONES . containsKey ( symbol ) ) { return INDEX_TIMEZONES . get ( symbol ) ; } if ( ! symbol . contains ( "." ) ) { return ExchangeTimeZone . get ( "" ) ; } String [ ] split = symbol . split ( "\\." ) ; return ExchangeTimeZone . get ( split [ sp...
Get the time zone for a specific stock or index . For stocks the exchange suffix is extracted from the stock symbol to retrieve the time zone .
143,602
protected Class getPrototypeClass ( Video content ) { Class prototypeClass ; if ( content . isFavorite ( ) ) { prototypeClass = FavoriteVideoRenderer . class ; } else if ( content . isLive ( ) ) { prototypeClass = LiveVideoRenderer . class ; } else { prototypeClass = LikeVideoRenderer . class ; } return prototypeClass ...
Method to declare Video - VideoRenderer mapping . Favorite videos will be rendered using FavoriteVideoRenderer . Live videos will be rendered using LiveVideoRenderer . Liked videos will be rendered using LikeVideoRenderer .
143,603
public int getItemViewType ( int position ) { T content = getItem ( position ) ; return rendererBuilder . getItemViewType ( content ) ; }
Indicate to the RecyclerView the type of Renderer used to one position using a numeric value .
143,604
public RendererViewHolder onCreateViewHolder ( ViewGroup viewGroup , int viewType ) { rendererBuilder . withParent ( viewGroup ) ; rendererBuilder . withLayoutInflater ( LayoutInflater . from ( viewGroup . getContext ( ) ) ) ; rendererBuilder . withViewType ( viewType ) ; RendererViewHolder viewHolder = rendererBuilder...
One of the two main methods in this class . Creates a RendererViewHolder instance with a Renderer inside ready to be used . The RendererBuilder to create a RendererViewHolder using the information given as parameter .
143,605
public void onBindViewHolder ( RendererViewHolder viewHolder , int position ) { T content = getItem ( position ) ; Renderer < T > renderer = viewHolder . getRenderer ( ) ; if ( renderer == null ) { throw new NullRendererBuiltException ( "RendererBuilder have to return a not null renderer" ) ; } renderer . setContent ( ...
Given a RendererViewHolder passed as argument and a position renders the view using the Renderer previously stored into the RendererViewHolder .
143,606
public void diffUpdate ( List < T > newList ) { if ( getCollection ( ) . size ( ) == 0 ) { addAll ( newList ) ; notifyDataSetChanged ( ) ; } else { DiffCallback diffCallback = new DiffCallback ( collection , newList ) ; DiffUtil . DiffResult diffResult = DiffUtil . calculateDiff ( diffCallback ) ; clear ( ) ; addAll ( ...
Provides a ready to use diff update for our adapter based on the implementation of the standard equals method from Object .
143,607
public RendererBuilder < T > withPrototype ( Renderer < ? extends T > renderer ) { if ( renderer == null ) { throw new NeedsPrototypesException ( "RendererBuilder can't use a null Renderer<T> instance as prototype" ) ; } this . prototypes . add ( renderer ) ; return this ; }
Add a Renderer instance as prototype .
143,608
public < G extends T > RendererBuilder < T > bind ( Class < G > clazz , Renderer < ? extends G > prototype ) { if ( clazz == null || prototype == null ) { throw new IllegalArgumentException ( "The binding RecyclerView binding can't be configured using null instances" ) ; } prototypes . add ( prototype ) ; binding . put...
Given a class configures the binding between a class and a Renderer class .
143,609
int getItemViewType ( T content ) { Class prototypeClass = getPrototypeClass ( content ) ; validatePrototypeClass ( prototypeClass ) ; return getItemViewType ( prototypeClass ) ; }
Return the item view type used by the adapter to implement recycle mechanism .
143,610
protected Renderer build ( ) { validateAttributes ( ) ; Renderer renderer ; if ( isRecyclable ( convertView , content ) ) { renderer = recycle ( convertView , content ) ; } else { renderer = createRenderer ( content , parent ) ; } return renderer ; }
Main method of this class related to ListView widget . This method is the responsible of recycle or create a new Renderer instance with all the needed information to implement the rendering . This method will validate all the attributes passed in the builder constructor and will check if can recycle or has to create a ...
143,611
protected RendererViewHolder buildRendererViewHolder ( ) { validateAttributesToCreateANewRendererViewHolder ( ) ; Renderer renderer = getPrototypeByIndex ( viewType ) . copy ( ) ; renderer . onCreate ( null , layoutInflater , parent ) ; return new RendererViewHolder ( renderer ) ; }
Main method of this class related to RecyclerView widget . This method is the responsible of create a new Renderer instance with all the needed information to implement the rendering . This method will validate all the attributes passed in the builder constructor and will create a RendererViewHolder instance .
143,612
private Renderer recycle ( View convertView , T content ) { Renderer renderer = ( Renderer ) convertView . getTag ( ) ; renderer . onRecycle ( content ) ; return renderer ; }
Recycles the Renderer getting it from the tag associated to the renderer root view . This view is not used with RecyclerView widget .
143,613
private Renderer createRenderer ( T content , ViewGroup parent ) { int prototypeIndex = getPrototypeIndex ( content ) ; Renderer renderer = getPrototypeByIndex ( prototypeIndex ) . copy ( ) ; renderer . onCreate ( content , layoutInflater , parent ) ; return renderer ; }
Create a Renderer getting a copy from the prototypes collection .
143,614
private Renderer getPrototypeByIndex ( final int prototypeIndex ) { Renderer prototypeSelected = null ; int i = 0 ; for ( Renderer prototype : prototypes ) { if ( i == prototypeIndex ) { prototypeSelected = prototype ; } i ++ ; } return prototypeSelected ; }
Search one prototype using the prototype index which is equals to the view type . This method has to be implemented because prototypes member is declared with Collection and that interface doesn t allow the client code to get one element by index .
143,615
private boolean isRecyclable ( View convertView , T content ) { boolean isRecyclable = false ; if ( convertView != null && convertView . getTag ( ) != null ) { Class prototypeClass = getPrototypeClass ( content ) ; validatePrototypeClass ( prototypeClass ) ; isRecyclable = prototypeClass . equals ( convertView . getTag...
Check if one Renderer is recyclable getting it from the convertView s tag and checking the class used .
143,616
private int getItemViewType ( Class prototypeClass ) { int itemViewType = - 1 ; for ( Renderer renderer : prototypes ) { if ( renderer . getClass ( ) . equals ( prototypeClass ) ) { itemViewType = getPrototypeIndex ( renderer ) ; break ; } } if ( itemViewType == - 1 ) { throw new PrototypeNotFoundException ( "Review yo...
Return the Renderer class associated to the prototype .
143,617
private int getPrototypeIndex ( Renderer renderer ) { int index = 0 ; for ( Renderer prototype : prototypes ) { if ( prototype . getClass ( ) . equals ( renderer . getClass ( ) ) ) { break ; } index ++ ; } return index ; }
Return the index associated to the Renderer .
143,618
private void validateAttributes ( ) { if ( content == null ) { throw new NullContentException ( "RendererBuilder needs content to create Renderer instances" ) ; } if ( parent == null ) { throw new NullParentException ( "RendererBuilder needs a parent to inflate Renderer instances" ) ; } if ( layoutInflater == null ) { ...
Throws one RendererException if the content parent or layoutInflater are null .
143,619
private void validateAttributesToCreateANewRendererViewHolder ( ) { if ( viewType == null ) { throw new NullContentException ( "RendererBuilder needs a view type to create a RendererViewHolder" ) ; } if ( layoutInflater == null ) { throw new NullLayoutInflaterException ( "RendererBuilder needs a LayoutInflater to creat...
Throws one RendererException if the viewType layoutInflater or parent are null .
143,620
protected Class getPrototypeClass ( T content ) { if ( prototypes . size ( ) == 1 ) { return prototypes . get ( 0 ) . getClass ( ) ; } else { return binding . get ( content . getClass ( ) ) ; } }
Method to be implemented by the RendererBuilder subtypes . In this method the library user will define the mapping between content and renderer class .
143,621
protected View inflate ( LayoutInflater inflater , ViewGroup parent ) { View inflatedView = inflater . inflate ( R . layout . video_renderer , parent , false ) ; ButterKnife . bind ( this , inflatedView ) ; return inflatedView ; }
Inflate the main layout used to render videos in the list view .
143,622
public void render ( ) { Video video = getContent ( ) ; renderThumbnail ( video ) ; renderTitle ( video ) ; renderMarker ( video ) ; renderLabel ( ) ; }
Main render algorithm based on render the video thumbnail render the title render the marker and the label .
143,623
private void renderThumbnail ( Video video ) { Picasso . with ( getContext ( ) ) . cancelRequest ( thumbnail ) ; Picasso . with ( getContext ( ) ) . load ( video . getThumbnail ( ) ) . placeholder ( R . drawable . placeholder ) . into ( thumbnail ) ; }
Use picasso to render the video thumbnail into the thumbnail widget using a temporal placeholder .
143,624
public void onCreate ( T content , LayoutInflater layoutInflater , ViewGroup parent ) { this . content = content ; this . rootView = inflate ( layoutInflater , parent ) ; if ( rootView == null ) { throw new NotInflateViewException ( "Renderer instances have to return a not null view in inflateView method" ) ; } this . ...
Method called when the renderer is going to be created . This method has the responsibility of inflate the xml layout using the layoutInflater and the parent ViewGroup set itself to the tag and call setUpView and hookListeners methods .
143,625
Renderer copy ( ) { Renderer copy = null ; try { copy = ( Renderer ) this . clone ( ) ; } catch ( CloneNotSupportedException e ) { Log . e ( "Renderer" , "All your renderers should be clonables." ) ; } return copy ; }
Create a clone of the Renderer . This method is the base of the prototype mechanism implemented to avoid create new objects from RendererBuilder . Pay an special attention implementing clone method in Renderer subtypes .
143,626
public View getView ( int position , View convertView , ViewGroup parent ) { T content = getItem ( position ) ; rendererBuilder . withContent ( content ) ; rendererBuilder . withConvertView ( convertView ) ; rendererBuilder . withParent ( parent ) ; rendererBuilder . withLayoutInflater ( LayoutInflater . from ( parent ...
Main method of RendererAdapter . This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer . Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ListView .
143,627
public Object instantiateItem ( ViewGroup parent , int position ) { T content = getItem ( position ) ; rendererBuilder . withContent ( content ) ; rendererBuilder . withParent ( parent ) ; rendererBuilder . withLayoutInflater ( LayoutInflater . from ( parent . getContext ( ) ) ) ; Renderer < T > renderer = rendererBuil...
Main method of VPRendererAdapter . This method has the responsibility of update the RendererBuilder values and create or recycle a new Renderer . Once the renderer has been obtained the RendereBuilder will call the render method in the renderer and will return the Renderer root view to the ViewPager .
143,628
public VideoCollection generate ( final int videoCount ) { List < Video > videos = new LinkedList < Video > ( ) ; for ( int i = 0 ; i < videoCount ; i ++ ) { Video video = generateRandomVideo ( ) ; videos . add ( video ) ; } return new VideoCollection ( videos ) ; }
Generate a VideoCollection with random data obtained form VIDEO_INFO map . You don t need o create your own AdapteeCollections . Review ListAdapteeCollection if needed .
143,629
private void initializeVideoInfo ( ) { VIDEO_INFO . put ( "The Big Bang Theory" , "http://thetvdb.com/banners/_cache/posters/80379-9.jpg" ) ; VIDEO_INFO . put ( "Breaking Bad" , "http://thetvdb.com/banners/_cache/posters/81189-22.jpg" ) ; VIDEO_INFO . put ( "Arrow" , "http://thetvdb.com/banners/_cache/posters/257655-15...
Initialize VIDEO_INFO data .
143,630
private Video generateRandomVideo ( ) { Video video = new Video ( ) ; configureFavoriteStatus ( video ) ; configureLikeStatus ( video ) ; configureLiveStatus ( video ) ; configureTitleAndThumbnail ( video ) ; return video ; }
Create a random video .
143,631
protected final ByteBuffer parseContent ( ByteBuffer in ) throws BaseExceptions . ParserException { if ( contentComplete ( ) ) { throw new BaseExceptions . InvalidState ( "content already complete: " + _endOfContent ) ; } else { switch ( _endOfContent ) { case UNKNOWN_CONTENT : _endOfContent = EndOfContent . EOF_CONTEN...
Parses the buffer into body content
143,632
final protected void putChar ( char c ) { final int clen = _internalBuffer . length ; if ( clen == _bufferPosition ) { final char [ ] next = new char [ 2 * clen + 1 ] ; System . arraycopy ( _internalBuffer , 0 , next , 0 , _bufferPosition ) ; _internalBuffer = next ; } _internalBuffer [ _bufferPosition ++ ] = c ; }
Store the char in the internal buffer
143,633
final protected String getTrimmedString ( ) throws BadMessage { if ( _bufferPosition == 0 ) return "" ; int start = 0 ; boolean quoted = false ; while ( start < _bufferPosition ) { final char ch = _internalBuffer [ start ] ; if ( ch == '"' ) { quoted = true ; break ; } else if ( ch != HttpTokens . SPACE && ch != HttpTo...
Returns the string in the buffer minus an leading or trailing whitespace or quotes
143,634
final protected char next ( final ByteBuffer buffer , boolean allow8859 ) throws BaseExceptions . BadMessage { if ( ! buffer . hasRemaining ( ) ) return HttpTokens . EMPTY_BUFF ; if ( _segmentByteLimit <= _segmentBytePosition ) { shutdownParser ( ) ; throw new BaseExceptions . BadMessage ( "Request length limit exceede...
Removes CRs but returns LFs
143,635
protected int mapGanttBarHeight ( int height ) { switch ( height ) { case 0 : { height = 6 ; break ; } case 1 : { height = 8 ; break ; } case 2 : { height = 10 ; break ; } case 3 : { height = 12 ; break ; } case 4 : { height = 14 ; break ; } case 5 : { height = 18 ; break ; } case 6 : { height = 24 ; break ; } } return...
This method maps the encoded height of a Gantt bar to the height in pixels .
143,636
protected TableFontStyle getColumnFontStyle ( byte [ ] data , int offset , Map < Integer , FontBase > fontBases ) { int uniqueID = MPPUtility . getInt ( data , offset ) ; FieldType fieldType = MPPTaskField . getInstance ( MPPUtility . getShort ( data , offset + 4 ) ) ; Integer index = Integer . valueOf ( MPPUtility . g...
Retrieve column font details from a block of property data .
143,637
private InputStream prepareInputStream ( InputStream stream ) throws IOException { InputStream result ; BufferedInputStream bis = new BufferedInputStream ( stream ) ; readHeaderProperties ( bis ) ; if ( isCompressed ( ) ) { result = new InflaterInputStream ( bis ) ; } else { result = bis ; } return result ; }
If the file is compressed handle this so that the stream is ready to read .
143,638
private String readHeaderString ( BufferedInputStream stream ) throws IOException { int bufferSize = 100 ; stream . mark ( bufferSize ) ; byte [ ] buffer = new byte [ bufferSize ] ; stream . read ( buffer ) ; Charset charset = CharsetHelper . UTF8 ; String header = new String ( buffer , charset ) ; int prefixIndex = he...
Read the header from the Phoenix file .
143,639
private void readHeaderProperties ( BufferedInputStream stream ) throws IOException { String header = readHeaderString ( stream ) ; for ( String property : header . split ( "\\|" ) ) { String [ ] expression = property . split ( "=" ) ; m_properties . put ( expression [ 0 ] , expression [ 1 ] ) ; } }
Read properties from the raw header data .
143,640
public void process ( MPPReader reader , ProjectFile file , DirectoryEntry root ) throws MPXJException , IOException { try { populateMemberData ( reader , file , root ) ; processProjectProperties ( ) ; if ( ! reader . getReadPropertiesOnly ( ) ) { processCalendarData ( ) ; processResourceData ( ) ; processTaskData ( ) ...
This method is used to process an MPP8 file . This is the file format used by Project 98 .
143,641
private void updateBaseCalendarNames ( List < Pair < ProjectCalendar , Integer > > baseCalendars ) { for ( Pair < ProjectCalendar , Integer > pair : baseCalendars ) { ProjectCalendar cal = pair . getFirst ( ) ; Integer baseCalendarID = pair . getSecond ( ) ; ProjectCalendar baseCal = m_calendarMap . get ( baseCalendarI...
The way calendars are stored in an MPP8 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 conve...
143,642
private void setTaskNotes ( Task task , byte [ ] data , ExtendedData taskExtData , FixDeferFix taskVarData ) { String notes = taskExtData . getString ( TASK_NOTES ) ; if ( notes == null && data . length == 366 ) { byte [ ] offsetData = taskVarData . getByteArray ( getOffset ( data , 362 ) ) ; if ( offsetData != null &&...
There appear to be two ways of representing task notes in an MPP8 file . This method tries to determine which has been used .
143,643
private void processHyperlinkData ( Task task , byte [ ] data ) { if ( data != null ) { int offset = 12 ; String hyperlink ; String address ; String subaddress ; offset += 12 ; hyperlink = MPPUtility . getUnicodeString ( data , offset ) ; offset += ( ( hyperlink . length ( ) + 1 ) * 2 ) ; offset += 12 ; address = MPPUt...
This method is used to extract the task hyperlink attributes from a block of data and call the appropriate modifier methods to configure the specified task object .
143,644
public void process ( String driverClass , String connectionString , String projectID , String outputFile ) throws Exception { System . out . println ( "Reading Primavera database started." ) ; Class . forName ( driverClass ) ; Properties props = new Properties ( ) ; if ( driverClass . equals ( "org.sqlite.JDBC" ) ) { ...
Extract Primavera project data and export in another format .
143,645
private void processProject ( PrimaveraDatabaseReader reader , int projectID , String outputFile ) throws Exception { long start = System . currentTimeMillis ( ) ; reader . setProjectID ( projectID ) ; ProjectFile projectFile = reader . read ( ) ; long elapsed = System . currentTimeMillis ( ) - start ; System . out . p...
Process a single project .
143,646
public static ResourceField getInstance ( int value ) { ResourceField result = null ; if ( value >= 0 && value < FIELD_ARRAY . length ) { result = FIELD_ARRAY [ value ] ; } else { if ( ( value & 0x8000 ) != 0 ) { int baseValue = ResourceField . ENTERPRISE_CUSTOM_FIELD1 . getValue ( ) ; int id = baseValue + ( value & 0x...
Retrieve an instance of the ResourceField class based on the data read from an MS Project file .
143,647
public void update ( Record record , boolean isText ) throws MPXJException { int length = record . getLength ( ) ; for ( int i = 0 ; i < length ; i ++ ) { if ( isText == true ) { add ( getTaskCode ( record . getString ( i ) ) ) ; } else { add ( record . getInteger ( i ) . intValue ( ) ) ; } } }
This method populates the task model from data read from an MPX file .
143,648
private void add ( int field ) { if ( field < m_flags . length ) { if ( m_flags [ field ] == false ) { m_flags [ field ] = true ; m_fields [ m_count ] = field ; ++ m_count ; } } }
This method is called from the task class each time an attribute is added ensuring that all of the attributes present in each task record are present in the resource model .
143,649
@ SuppressWarnings ( "unchecked" ) private boolean isFieldPopulated ( Task task , TaskField field ) { boolean result = false ; if ( field != null ) { Object value = task . getCachedValue ( field ) ; switch ( field ) { case PREDECESSORS : case SUCCESSORS : { result = value != null && ! ( ( List < Relation > ) value ) . ...
Determine if a task field contains data .
143,650
private String getTaskField ( int key ) { String result = null ; if ( ( key > 0 ) && ( key < m_taskNames . length ) ) { result = m_taskNames [ key ] ; } return ( result ) ; }
Returns Task field name of supplied code no .
143,651
private int getTaskCode ( String field ) throws MPXJException { Integer result = m_taskNumbers . get ( field . trim ( ) ) ; if ( result == null ) { throw new MPXJException ( MPXJException . INVALID_TASK_FIELD_NAME + " " + field ) ; } return ( result . intValue ( ) ) ; }
Returns code number of Task field supplied .
143,652
public static String parseString ( String value ) { if ( value != null ) { if ( ! value . isEmpty ( ) && value . charAt ( 0 ) == '<' ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } if ( ! value . isEmpty ( ) && value . charAt ( 0 ) == '"' ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; }...
Parse a string .
143,653
public static Number parseDouble ( String value ) throws ParseException { Number result = null ; value = parseString ( value ) ; if ( value != null && ! value . isEmpty ( ) && ! value . equals ( "-1 -1" ) ) { int index = value . indexOf ( "E+" ) ; if ( index != - 1 ) { value = value . substring ( 0 , index ) + 'E' + va...
Parse the string representation of a double .
143,654
public static Boolean parseBoolean ( String value ) throws ParseException { Boolean result = null ; Integer number = parseInteger ( value ) ; if ( number != null ) { result = number . intValue ( ) == 0 ? Boolean . FALSE : Boolean . TRUE ; } return result ; }
Parse a string representation of a Boolean value .
143,655
public static Integer parseInteger ( String value ) throws ParseException { Integer result = null ; if ( value . length ( ) > 0 && value . indexOf ( ' ' ) == - 1 ) { if ( value . indexOf ( '.' ) == - 1 ) { result = Integer . valueOf ( value ) ; } else { Number n = DatatypeConverter . parseDouble ( value ) ; result = In...
Parse a string representation of an Integer value .
143,656
public static Date parseEpochTimestamp ( String value ) { Date result = null ; if ( value . length ( ) > 0 ) { if ( ! value . equals ( "-1 -1" ) ) { Calendar cal = DateHelper . popCalendar ( JAVA_EPOCH ) ; int index = value . indexOf ( ' ' ) ; if ( index == - 1 ) { if ( value . length ( ) < 6 ) { value = "000000" + val...
Parse the string representation of a timestamp .
143,657
protected void processProjectListItem ( Map < Integer , String > result , Row row ) { Integer id = row . getInteger ( "PROJ_ID" ) ; String name = row . getString ( "PROJ_NAME" ) ; result . put ( id , name ) ; }
Retrieve the details of a single project from the database .
143,658
protected void processCalendarData ( ProjectCalendar calendar , Row row ) { int dayIndex = row . getInt ( "CD_DAY_OR_EXCEPTION" ) ; if ( dayIndex == 0 ) { processCalendarException ( calendar , row ) ; } else { processCalendarHours ( calendar , row , dayIndex ) ; } }
Read calendar hours and exception data .
143,659
private void processCalendarException ( ProjectCalendar calendar , Row row ) { Date fromDate = row . getDate ( "CD_FROM_DATE" ) ; Date toDate = row . getDate ( "CD_TO_DATE" ) ; boolean working = row . getInt ( "CD_WORKING" ) != 0 ; ProjectCalendarException exception = calendar . addCalendarException ( fromDate , toDate...
Process a calendar exception .
143,660
private void processCalendarHours ( ProjectCalendar calendar , Row row , int dayIndex ) { Day day = Day . getInstance ( dayIndex ) ; boolean working = row . getInt ( "CD_WORKING" ) != 0 ; calendar . setWorkingDay ( day , working ) ; if ( working == true ) { ProjectCalendarHours hours = calendar . addCalendarHours ( day...
Process calendar hours .
143,661
protected void processResourceBaseline ( Row row ) { Integer id = row . getInteger ( "RES_UID" ) ; Resource resource = m_project . getResourceByUniqueID ( id ) ; if ( resource != null ) { int index = row . getInt ( "RB_BASE_NUM" ) ; resource . setBaselineWork ( index , row . getDuration ( "RB_BASE_WORK" ) ) ; resource ...
Read resource baseline values .
143,662
protected void processDurationField ( Row row ) { processField ( row , "DUR_FIELD_ID" , "DUR_REF_UID" , MPDUtility . getAdjustedDuration ( m_project , row . getInt ( "DUR_VALUE" ) , MPDUtility . getDurationTimeUnits ( row . getInt ( "DUR_FMT" ) ) ) ) ; }
Read a single duration field extended attribute .
143,663
protected void processOutlineCodeField ( Integer entityID , Row row ) { processField ( row , "OC_FIELD_ID" , entityID , row . getString ( "OC_NAME" ) ) ; }
Read a single outline code field extended attribute .
143,664
protected void processTaskBaseline ( Row row ) { Integer id = row . getInteger ( "TASK_UID" ) ; Task task = m_project . getTaskByUniqueID ( id ) ; if ( task != null ) { int index = row . getInt ( "TB_BASE_NUM" ) ; task . setBaselineDuration ( index , MPDUtility . getAdjustedDuration ( m_project , row . getInt ( "TB_BAS...
Read task baseline values .
143,665
protected void processLink ( Row row ) { Task predecessorTask = m_project . getTaskByUniqueID ( row . getInteger ( "LINK_PRED_UID" ) ) ; Task successorTask = m_project . getTaskByUniqueID ( row . getInteger ( "LINK_SUCC_UID" ) ) ; if ( predecessorTask != null && successorTask != null ) { RelationType type = RelationTyp...
Process a relationship between two tasks .
143,666
protected void processAssignmentBaseline ( Row row ) { Integer id = row . getInteger ( "ASSN_UID" ) ; ResourceAssignment assignment = m_assignmentMap . get ( id ) ; if ( assignment != null ) { int index = row . getInt ( "AB_BASE_NUM" ) ; assignment . setBaselineStart ( index , row . getDate ( "AB_BASE_START" ) ) ; assi...
Read resource assignment baseline values .
143,667
protected void postProcessing ( ) { ProjectConfig config = m_project . getProjectConfig ( ) ; config . setAutoWBS ( m_autoWBS ) ; config . setAutoOutlineNumber ( true ) ; m_project . updateStructure ( ) ; config . setAutoOutlineNumber ( false ) ; for ( Task task : m_project . getTasks ( ) ) { task . setSummary ( task ....
Carry out any post - processing required to tidy up the data read from the database .
143,668
private Integer getNullOnValue ( Integer value , int nullValue ) { return ( NumberHelper . getInt ( value ) == nullValue ? null : value ) ; }
This method returns the value it is passed or null if the value matches the nullValue argument .
143,669
public void process ( DirectoryEntry projectDir , ProjectFile file , DocumentInputStreamFactory inputStreamFactory ) throws IOException { DirectoryEntry consDir ; try { consDir = ( DirectoryEntry ) projectDir . getEntry ( "TBkndCons" ) ; } catch ( FileNotFoundException ex ) { consDir = null ; } if ( consDir != null ) {...
Main entry point when called to process constraint data .
143,670
private Object getColumnValue ( String table , String column , String data , int type , boolean epochDateFormat ) throws MPXJException { try { Object value = null ; switch ( type ) { case Types . BIT : { value = DatatypeConverter . parseBoolean ( data ) ; break ; } case Types . VARCHAR : case Types . LONGVARCHAR : { va...
Maps the text representation of column data to Java types .
143,671
public List < Callouts . Callout > getCallout ( ) { if ( callout == null ) { callout = new ArrayList < Callouts . Callout > ( ) ; } return this . callout ; }
Gets the value of the callout property .
143,672
public static final Integer parseMinutesFromHours ( String value ) { Integer result = null ; if ( value != null ) { result = Integer . valueOf ( Integer . parseInt ( value ) * 60 ) ; } return result ; }
Parse a duration in minutes form a number of hours .
143,673
public static final CurrencySymbolPosition parseCurrencySymbolPosition ( String value ) { CurrencySymbolPosition result = MAP_TO_CURRENCY_SYMBOL_POSITION . get ( value ) ; result = result == null ? CurrencySymbolPosition . BEFORE_WITH_SPACE : result ; return result ; }
Parse a currency symbol position from a string representation .
143,674
public static final Date parseDate ( String value ) { Date result = null ; try { if ( value != null && ! value . isEmpty ( ) ) { result = DATE_FORMAT . get ( ) . parse ( value ) ; } } catch ( ParseException ex ) { } return result ; }
Parse a date value .
143,675
public static final Date parseDateTime ( String value ) { Date result = null ; try { if ( value != null && ! value . isEmpty ( ) ) { result = DATE_TIME_FORMAT . get ( ) . parse ( value ) ; } } catch ( ParseException ex ) { } return result ; }
Parse a date time value .
143,676
public static final int getInt ( byte [ ] data , int offset ) { int result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 32 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; }
Read a four byte integer .
143,677
public static final int getShort ( byte [ ] data , int offset ) { int result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 16 ; shiftBy += 8 ) { result |= ( ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; }
Read a two byte integer .
143,678
public static final String getString ( byte [ ] data , int offset ) { return getString ( data , offset , data . length - offset ) ; }
Retrieve a string value .
143,679
public static final Date getFinishDate ( byte [ ] data , int offset ) { Date result ; long days = getShort ( data , offset ) ; if ( days == 0x8000 ) { result = null ; } else { result = DateHelper . getDateFromLong ( EPOCH + ( ( days - 1 ) * DateHelper . MS_PER_DAY ) ) ; } return ( result ) ; }
Retrieve a finish date .
143,680
public void setDefaultCalendarName ( String calendarName ) { if ( calendarName == null || calendarName . length ( ) == 0 ) { calendarName = DEFAULT_CALENDAR_NAME ; } set ( ProjectField . DEFAULT_CALENDAR_NAME , calendarName ) ; }
Sets the Calendar used . Standard if no value is set .
143,681
public Date getStartDate ( ) { Date result = ( Date ) getCachedValue ( ProjectField . START_DATE ) ; if ( result == null ) { result = getParentFile ( ) . getStartDate ( ) ; } return ( result ) ; }
Retrieves the project start date . If an explicit start date has not been set this method calculates the start date by looking for the earliest task start date .
143,682
public Date getFinishDate ( ) { Date result = ( Date ) getCachedValue ( ProjectField . FINISH_DATE ) ; if ( result == null ) { result = getParentFile ( ) . getFinishDate ( ) ; } return ( result ) ; }
Retrieves the project finish date . If an explicit finish date has not been set this method calculates the finish date by looking for the latest task finish date .
143,683
public void setCurrencySymbol ( String symbol ) { if ( symbol == null ) { symbol = DEFAULT_CURRENCY_SYMBOL ; } set ( ProjectField . CURRENCY_SYMBOL , symbol ) ; }
Sets currency symbol .
143,684
public void setSymbolPosition ( CurrencySymbolPosition posn ) { if ( posn == null ) { posn = DEFAULT_CURRENCY_SYMBOL_POSITION ; } set ( ProjectField . CURRENCY_SYMBOL_POSITION , posn ) ; }
Sets the position of the currency symbol .
143,685
public void setCurrencyDigits ( Integer currDigs ) { if ( currDigs == null ) { currDigs = DEFAULT_CURRENCY_DIGITS ; } set ( ProjectField . CURRENCY_DIGITS , currDigs ) ; }
Sets no of currency digits .
143,686
public Number getMinutesPerMonth ( ) { return Integer . valueOf ( NumberHelper . getInt ( getMinutesPerDay ( ) ) * NumberHelper . getInt ( getDaysPerMonth ( ) ) ) ; }
Retrieve the default number of minutes per month .
143,687
public Number getMinutesPerYear ( ) { return Integer . valueOf ( NumberHelper . getInt ( getMinutesPerDay ( ) ) * NumberHelper . getInt ( getDaysPerMonth ( ) ) * 12 ) ; }
Retrieve the default number of minutes per year .
143,688
@ SuppressWarnings ( "unchecked" ) public Map < String , Object > getCustomProperties ( ) { return ( Map < String , Object > ) getCachedValue ( ProjectField . CUSTOM_PROPERTIES ) ; }
Retrieve a map of custom document properties .
143,689
private char getCachedCharValue ( FieldType field , char defaultValue ) { Character c = ( Character ) getCachedValue ( field ) ; return c == null ? defaultValue : c . charValue ( ) ; }
Handles retrieval of primitive char type .
143,690
private void set ( FieldType field , boolean value ) { set ( field , ( value ? Boolean . TRUE : Boolean . FALSE ) ) ; }
This method inserts a name value pair into internal storage .
143,691
private List < Row > getRows ( String sql ) throws SQLException { allocateConnection ( ) ; try { List < Row > result = new LinkedList < Row > ( ) ; m_ps = m_connection . prepareStatement ( sql ) ; m_rs = m_ps . executeQuery ( ) ; populateMetaData ( ) ; while ( m_rs . next ( ) ) { result . add ( new MpdResultSetRow ( m_...
Retrieve a number of rows matching the supplied query .
143,692
private void releaseConnection ( ) { if ( m_rs != null ) { try { m_rs . close ( ) ; } catch ( SQLException ex ) { } m_rs = null ; } if ( m_ps != null ) { try { m_ps . close ( ) ; } catch ( SQLException ex ) { } m_ps = null ; } }
Releases a database connection and cleans up any resources associated with that connection .
143,693
private void populateMetaData ( ) throws SQLException { m_meta . clear ( ) ; ResultSetMetaData meta = m_rs . getMetaData ( ) ; int columnCount = meta . getColumnCount ( ) + 1 ; for ( int loop = 1 ; loop < columnCount ; loop ++ ) { String name = meta . getColumnName ( loop ) ; Integer type = Integer . valueOf ( meta . g...
Retrieves basic meta data from the result set .
143,694
public void setSchema ( String schema ) { if ( schema . charAt ( schema . length ( ) - 1 ) != '.' ) { schema = schema + '.' ; } m_schema = schema ; }
Set the name of the schema containing the schedule tables .
143,695
public ActivityCodeValue addValue ( Integer uniqueID , String name , String description ) { ActivityCodeValue value = new ActivityCodeValue ( this , uniqueID , name , description ) ; m_values . add ( value ) ; return value ; }
Add a value to this activity code .
143,696
public static final long getLong ( byte [ ] data , int offset ) { long result = 0 ; int i = offset ; for ( int shiftBy = 0 ; shiftBy < 64 ; shiftBy += 8 ) { result |= ( ( long ) ( data [ i ] & 0xff ) ) << shiftBy ; ++ i ; } return result ; }
Read a long int from a byte array .
143,697
public static final int getInt ( InputStream is ) throws IOException { byte [ ] data = new byte [ 4 ] ; is . read ( data ) ; return getInt ( data , 0 ) ; }
Read an int from an input stream .
143,698
public static final int getShort ( InputStream is ) throws IOException { byte [ ] data = new byte [ 2 ] ; is . read ( data ) ; return getShort ( data , 0 ) ; }
Read a short int from an input stream .
143,699
public static final long getLong ( InputStream is ) throws IOException { byte [ ] data = new byte [ 8 ] ; is . read ( data ) ; return getLong ( data , 0 ) ; }
Read a long int from an input stream .