signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class UtilDateTime { /** * datetime is the String of System . currentTimeMillis ( ) 返回标准中国 ( 缺省 ) 的时间显示格式 */ public static String getDateTimeDisp ( String datetime ) { } }
if ( ( datetime == null ) || ( datetime . equals ( "" ) ) ) return "" ; DateFormat formatter = DateFormat . getDateTimeInstance ( DateFormat . MEDIUM , DateFormat . MEDIUM ) ; long datel = Long . parseLong ( datetime ) ; return formatter . format ( new Date ( datel ) ) ;
public class PredictionsImpl { /** * Gets predictions for a given utterance , in the form of intents and entities . The current maximum query size is 500 characters . * @ param appId The LUIS application ID ( Guid ) . * @ param query The utterance to predict . * @ param resolveOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws APIErrorException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the LuisResult object if successful . */ public LuisResult resolve ( String appId , String query , ResolveOptionalParameter resolveOptionalParameter ) { } }
return resolveWithServiceResponseAsync ( appId , query , resolveOptionalParameter ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AssignmentImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case XtextPackage . ASSIGNMENT__FEATURE : return getFeature ( ) ; case XtextPackage . ASSIGNMENT__OPERATOR : return getOperator ( ) ; case XtextPackage . ASSIGNMENT__TERMINAL : return getTerminal ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class Identity { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "unchecked" ) public < B , App extends Applicative < ? , App > , TravB extends Traversable < B , Identity < ? > > , AppB extends Applicative < B , App > , AppTrav extends Applicative < TravB , App > > AppTrav traverse ( Function < ? super A , ? extends AppB > fn , Function < ? super TravB , ? extends AppTrav > pure ) { } }
return ( AppTrav ) fn . apply ( runIdentity ( ) ) . fmap ( Identity :: new ) ;
public class BaseFileCopier { /** * Return a temporary filepath for a file to be copied to the node , given the input filename ( without directory * path ) * @ param node the destination node * @ param project project * @ param framework framework * @ param scriptfileName the name of the file to copy * @ param fileExtension optional extension to use for the temp file , or null for default * @ param identity unique identifier , or null to include a random string * @ return a filepath specifying destination of the file to copy that should be unique */ public static String generateRemoteFilepathForNode ( final INodeEntry node , final IRundeckProject project , final IFramework framework , final String scriptfileName , final String fileExtension , final String identity ) { } }
return util . generateRemoteFilepathForNode ( node , project , framework , scriptfileName , fileExtension , identity ) ;
public class AppServicePlansInner { /** * Get all apps associated with an App Service plan . * Get all apps associated with an App Service plan . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of the App Service plan . * @ param skipToken Skip to a web app in the list of webapps associated with app service plan . If specified , the resulting list will contain web apps starting from ( including ) the skipToken . Otherwise , the resulting list contains web apps from the start of the list * @ param filter Supported filter : $ filter = state eq running . Returns only web apps that are currently running * @ param top List page size . If specified , results are paged . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < SiteInner > > listWebAppsAsync ( final String resourceGroupName , final String name , final String skipToken , final String filter , final String top , final ListOperationCallback < SiteInner > serviceCallback ) { } }
return AzureServiceFuture . fromPageResponse ( listWebAppsSinglePageAsync ( resourceGroupName , name , skipToken , filter , top ) , new Func1 < String , Observable < ServiceResponse < Page < SiteInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SiteInner > > > call ( String nextPageLink ) { return listWebAppsNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ;
public class XMLSerializer { /** * Close start tag . * @ throws IOException Signals that an I / O exception has occurred . */ protected void closeStartTag ( ) throws IOException { } }
if ( finished ) { throw new IllegalArgumentException ( "trying to write past already finished output" + getLocation ( ) ) ; } if ( seenBracket ) { seenBracket = seenBracketBracket = false ; } if ( startTagIncomplete || setPrefixCalled ) { if ( setPrefixCalled ) { throw new IllegalArgumentException ( "startTag() must be called immediately after setPrefix()" + getLocation ( ) ) ; } if ( ! startTagIncomplete ) { throw new IllegalArgumentException ( "trying to close start tag that is not opened" + getLocation ( ) ) ; } // write all namespace delcarations ! writeNamespaceDeclarations ( ) ; out . write ( '>' ) ; elNamespaceCount [ depth ] = namespaceEnd ; startTagIncomplete = false ; }
public class DdlUtilsDataHandling { /** * Writes a DTD that can be used for data XML files matching the current model to the given writer . * @ param output The writer to write the DTD to */ public void getDataDTD ( Writer output ) throws DataTaskException { } }
try { output . write ( "<!ELEMENT dataset (\n" ) ; for ( Iterator it = _preparedModel . getElementNames ( ) ; it . hasNext ( ) ; ) { String elementName = ( String ) it . next ( ) ; output . write ( " " ) ; output . write ( elementName ) ; output . write ( "*" ) ; output . write ( it . hasNext ( ) ? " |\n" : "\n" ) ; } output . write ( ")>\n<!ATTLIST dataset\n name CDATA #REQUIRED\n>\n" ) ; for ( Iterator it = _preparedModel . getElementNames ( ) ; it . hasNext ( ) ; ) { String elementName = ( String ) it . next ( ) ; List classDescs = _preparedModel . getClassDescriptorsMappingTo ( elementName ) ; if ( classDescs == null ) { output . write ( "\n<!-- Indirection table" ) ; } else { output . write ( "\n<!-- Mapped to : " ) ; for ( Iterator classDescIt = classDescs . iterator ( ) ; classDescIt . hasNext ( ) ; ) { ClassDescriptor classDesc = ( ClassDescriptor ) classDescIt . next ( ) ; output . write ( classDesc . getClassNameOfObject ( ) ) ; if ( classDescIt . hasNext ( ) ) { output . write ( "\n " ) ; } } } output . write ( " -->\n<!ELEMENT " ) ; output . write ( elementName ) ; output . write ( " EMPTY>\n<!ATTLIST " ) ; output . write ( elementName ) ; output . write ( "\n" ) ; for ( Iterator attrIt = _preparedModel . getAttributeNames ( elementName ) ; attrIt . hasNext ( ) ; ) { String attrName = ( String ) attrIt . next ( ) ; output . write ( " " ) ; output . write ( attrName ) ; output . write ( " CDATA #" ) ; output . write ( _preparedModel . isRequired ( elementName , attrName ) ? "REQUIRED" : "IMPLIED" ) ; output . write ( "\n" ) ; } output . write ( ">\n" ) ; } } catch ( IOException ex ) { throw new DataTaskException ( ex ) ; }
public class IntegerDecodingState { /** * { @ inheritDoc } */ public DecodingState decode ( IoBuffer in , ProtocolDecoderOutput out ) throws Exception { } }
while ( in . hasRemaining ( ) ) { switch ( counter ) { case 0 : firstByte = in . getUnsigned ( ) ; break ; case 1 : secondByte = in . getUnsigned ( ) ; break ; case 2 : thirdByte = in . getUnsigned ( ) ; break ; case 3 : counter = 0 ; return finishDecode ( ( firstByte << 24 ) | ( secondByte << 16 ) | ( thirdByte << 8 ) | in . getUnsigned ( ) , out ) ; default : throw new InternalError ( ) ; } counter ++ ; } return this ;
public class ConcurrentLinkedHashMap { /** * Returns the segment that should be used for key with given hash * @ param hash the hash code for the key * @ return the segment */ private LinkedHashMapSegment < K , V > segmentFor ( int hash ) { } }
int h = hash ( hash ) ; return segments [ ( h >>> segmentShift ) & segmentMask ] ;
public class SupportedProductConfig { /** * The list of user - supplied arguments . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setArgs ( java . util . Collection ) } or { @ link # withArgs ( java . util . Collection ) } if you want to override the * existing values . * @ param args * The list of user - supplied arguments . * @ return Returns a reference to this object so that method calls can be chained together . */ public SupportedProductConfig withArgs ( String ... args ) { } }
if ( this . args == null ) { setArgs ( new com . amazonaws . internal . SdkInternalList < String > ( args . length ) ) ; } for ( String ele : args ) { this . args . add ( ele ) ; } return this ;
public class AutomationAccountsInner { /** * Retrieve a list of accounts within a given resource group . * @ param resourceGroupName Name of an Azure Resource group . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; AutomationAccountInner & gt ; object */ public Observable < Page < AutomationAccountInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } }
return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < AutomationAccountInner > > , Page < AutomationAccountInner > > ( ) { @ Override public Page < AutomationAccountInner > call ( ServiceResponse < Page < AutomationAccountInner > > response ) { return response . body ( ) ; } } ) ;
public class RuntimeCollectionFieldFactory { /** * private static final ObjectSchema OBJECT _ COLLECTION _ VALUE _ SCHEMA = new ObjectSchema ( ) { * @ SuppressWarnings ( " unchecked " ) protected void setValue ( Object value , Object owner ) { / / the owner will always be * a Collection ( ( Collection < Object > ) owner ) . add ( value ) ; } } ; */ private static < T > Field < T > createCollectionInlineV ( int number , String name , java . lang . reflect . Field f , MessageFactory messageFactory , final Delegate < Object > inline ) { } }
final Accessor accessor = AF . create ( f ) ; return new RuntimeCollectionField < T , Object > ( inline . getFieldType ( ) , number , name , f . getAnnotation ( Tag . class ) , messageFactory ) { @ Override protected void mergeFrom ( Input input , T message ) throws IOException { accessor . set ( message , input . mergeObject ( accessor . < Collection < Object > > get ( message ) , schema ) ) ; } @ Override protected void writeTo ( Output output , T message ) throws IOException { final Collection < Object > existing = accessor . get ( message ) ; if ( existing != null ) output . writeObject ( number , existing , schema , false ) ; } @ Override protected void transfer ( Pipe pipe , Input input , Output output , boolean repeated ) throws IOException { output . writeObject ( number , pipe , schema . pipeSchema , repeated ) ; } @ Override protected void addValueFrom ( Input input , Collection < Object > collection ) throws IOException { collection . add ( inline . readFrom ( input ) ) ; } @ Override protected void writeValueTo ( Output output , int fieldNumber , Object value , boolean repeated ) throws IOException { inline . writeTo ( output , fieldNumber , value , repeated ) ; } @ Override protected void transferValue ( Pipe pipe , Input input , Output output , int number , boolean repeated ) throws IOException { inline . transfer ( pipe , input , output , number , repeated ) ; } } ;
public class OAuth10aService { /** * Start the request to retrieve the access token . The optionally provided callback will be called with the Token * when it is available . * @ param requestToken request token ( obtained previously or null ) * @ param oauthVerifier oauth _ verifier * @ param callback optional callback * @ return Future */ public Future < OAuth1AccessToken > getAccessTokenAsync ( OAuth1RequestToken requestToken , String oauthVerifier , OAuthAsyncRequestCallback < OAuth1AccessToken > callback ) { } }
log ( "async obtaining access token from %s" , api . getAccessTokenEndpoint ( ) ) ; final OAuthRequest request = prepareAccessTokenRequest ( requestToken , oauthVerifier ) ; return execute ( request , callback , new OAuthRequest . ResponseConverter < OAuth1AccessToken > ( ) { @ Override public OAuth1AccessToken convert ( Response response ) throws IOException { return getApi ( ) . getAccessTokenExtractor ( ) . extract ( response ) ; } } ) ;
public class DeviceProxy { DeviceData command_inout_reply ( AsyncCallObject aco , int timeout ) throws DevFailed , AsynReplyNotArrived { } }
return deviceProxyDAO . command_inout_reply ( this , aco , timeout ) ;
public class OntopOWLBinding { /** * TODO ( xiao ) : how about null ? ? */ @ Override public OWLObject getValue ( ) throws OWLException { } }
try { return translate ( ontopBinding . getValue ( ) ) ; } catch ( OntopResultConversionException e ) { throw new OntopOWLException ( e ) ; }
public class AbstractCLA { /** * { @ inheritDoc } */ @ Override public ICmdLineArg < E > setListCriteria ( final String [ ] arrayOfValidValues ) throws ParseException , IOException { } }
final List < E > list = new ArrayList < > ( ) ; for ( final String arrayOfValidValue : arrayOfValidValues ) list . add ( convert ( arrayOfValidValue , caseSensitive , null ) ) ; setCriteria ( new ListCriteria < > ( list ) ) ; return this ;
public class FeaturesInner { /** * Gets all the preview features in a provider namespace that are available through AFEC for the subscription . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; FeatureResultInner & gt ; object */ public Observable < Page < FeatureResultInner > > list1NextAsync ( final String nextPageLink ) { } }
return list1NextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < FeatureResultInner > > , Page < FeatureResultInner > > ( ) { @ Override public Page < FeatureResultInner > call ( ServiceResponse < Page < FeatureResultInner > > response ) { return response . body ( ) ; } } ) ;
public class OSchemaHelper { /** * Create an { @ link ODocument } if required of an current class . * Existance of an document checked by specified primary key field name and required value * @ param pkField primary key field name * @ param pkValue required primary key value * @ return this helper */ public OSchemaHelper oDocument ( String pkField , Object pkValue ) { } }
checkOClass ( ) ; List < ODocument > docs = db . query ( new OSQLSynchQuery < ODocument > ( "select from " + lastClass . getName ( ) + " where " + pkField + " = ?" , 1 ) , pkValue ) ; if ( docs != null && ! docs . isEmpty ( ) ) { lastDocument = docs . get ( 0 ) ; } else { lastDocument = new ODocument ( lastClass ) ; lastDocument . field ( pkField , pkValue ) ; } return this ;
public class DrizzleBlob { /** * Writes all or part of the given < code > byte < / code > array to the < code > BLOB < / code > value that this * < code > Blob < / code > object represents and returns the number of bytes written . Writing starts at position * < code > pos < / code > in the < code > BLOB < / code > value ; < code > len < / code > bytes from the given byte array are written . * The array of bytes will overwrite the existing bytes in the < code > Blob < / code > object starting at the position * < code > pos < / code > . If the end of the < code > Blob < / code > value is reached while writing the array of bytes , then * the length of the < code > Blob < / code > value will be increased to accomodate the extra bytes . * < b > Note : < / b > If the value specified for < code > pos < / code > is greater then the length + 1 of the < code > BLOB < / code > * value then the behavior is undefined . Some JDBC drivers may throw a < code > SQLException < / code > while other drivers * may support this operation . * @ param pos the position in the < code > BLOB < / code > object at which to start writing ; the first position is 1 * @ param bytes the array of bytes to be written to this < code > BLOB < / code > object * @ param offset the offset into the array < code > bytes < / code > at which to start reading the bytes to be set * @ param len the number of bytes to be written to the < code > BLOB < / code > value from the array of bytes * < code > bytes < / code > * @ return the number of bytes written * @ throws java . sql . SQLException if there is an error accessing the < code > BLOB < / code > value or if pos is less than * @ see # getBytes */ public int setBytes ( final long pos , final byte [ ] bytes , final int offset , final int len ) throws SQLException { } }
int bytesWritten = 0 ; if ( blobContent == null ) { this . blobContent = new byte [ ( int ) ( pos + bytes . length ) - ( len - offset ) ] ; for ( int i = ( int ) pos + offset ; i < len ; i ++ ) { this . blobContent [ ( ( int ) ( pos + i ) ) ] = bytes [ i ] ; bytesWritten ++ ; } } else if ( this . blobContent . length < ( pos + bytes . length ) - ( len - offset ) ) { for ( int i = ( int ) pos + offset ; i < len ; i ++ ) { this . blobContent [ ( ( int ) ( pos + i ) ) ] = bytes [ i ] ; bytesWritten ++ ; } } this . actualSize += bytesWritten ; return bytesWritten ;
public class CreatePresignedNotebookInstanceUrlRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreatePresignedNotebookInstanceUrlRequest createPresignedNotebookInstanceUrlRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createPresignedNotebookInstanceUrlRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createPresignedNotebookInstanceUrlRequest . getNotebookInstanceName ( ) , NOTEBOOKINSTANCENAME_BINDING ) ; protocolMarshaller . marshall ( createPresignedNotebookInstanceUrlRequest . getSessionExpirationDurationInSeconds ( ) , SESSIONEXPIRATIONDURATIONINSECONDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class WildCardURL { /** * Gets the authority part of this < code > URL < / code > ( the domain ) . * Eg : www . lime49 . com OR user : pwd @ domain . com * @ return The authority part of this < code > URL < / code > */ public String getAuthority ( ) { } }
String userInfo = getUserInfo ( ) ; StringBuilder auth = new StringBuilder ( ) ; if ( ! "*" . equals ( userInfo ) ) { auth . append ( userInfo ) . append ( "@" ) ; } auth . append ( '@' ) . append ( host ) . append ( ':' ) . append ( port ) ; return auth . toString ( ) ;
public class ApplicationGatewaysInner { /** * Updates the specified application gateway tags . * @ param resourceGroupName The name of the resource group . * @ param applicationGatewayName The name of the application gateway . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the ApplicationGatewayInner object if successful . */ public ApplicationGatewayInner updateTags ( String resourceGroupName , String applicationGatewayName ) { } }
return updateTagsWithServiceResponseAsync ( resourceGroupName , applicationGatewayName ) . toBlocking ( ) . last ( ) . body ( ) ;
public class DateIndexFormatter { /** * Work - around for year formatting in JDK 6 vs 7 + . * JDK6 : does not know about ' YYYY ' ( only ' yyyy ' ) . Considers ' y ' and ' yyy ' as ' yy ' . * JDK7 : understands both ' YYYY ' and ' yyyy ' . Considers ' y ' and ' yyy ' as ' yyyy ' * This method checks the pattern and converts it into JDK7 when running on JDK6. */ private String fixDateForJdk ( String format ) { } }
if ( Constants . JRE_IS_MINIMUM_JAVA7 ) { return format ; } // JDK 6 - fix year formatting // a . lower case Y to y if ( format . contains ( "Y" ) ) { format = format . replace ( "Y" , "y" ) ; } // gotta love regex // use lookahead to match isolated y / yyy with yyyy format = format . replaceAll ( "((?<!y)(?:y|yyy)(?!y))" , "yyyy" ) ; return format ;
public class AbstractContainerHelper { /** * Support standard processing of the render phase of a request . * @ throws IOException IO Exception */ public void render ( ) throws IOException { } }
if ( isDisposed ( ) ) { LOG . debug ( "Skipping render phase." ) ; return ; } try { // Check user context has been prepared if ( getNewConversation ( ) == null ) { throw new IllegalStateException ( "User context has not been prepared before the render phase" ) ; } prepareRender ( ) ; UIContext uic = getUIContext ( ) ; if ( uic == null ) { throw new IllegalStateException ( "No user context set for the render phase." ) ; } UIContextHolder . pushContext ( uic ) ; prepareRequest ( ) ; // Handle errors from the action phase now . if ( havePropogatedError ( ) ) { handleError ( getPropogatedError ( ) ) ; return ; } WComponent uiComponent = getUI ( ) ; if ( uiComponent == null ) { throw new SystemException ( "No UI Component exists." ) ; } Environment environment = uiComponent . getEnvironment ( ) ; if ( environment == null ) { throw new SystemException ( "No WEnvironment exists." ) ; } getInterceptor ( ) . attachResponse ( getResponse ( ) ) ; getInterceptor ( ) . preparePaint ( getRequest ( ) ) ; String contentType = getUI ( ) . getHeaders ( ) . getContentType ( ) ; Response response = getResponse ( ) ; response . setContentType ( contentType ) ; addGenericHeaders ( uic , getUI ( ) ) ; PrintWriter writer = getPrintWriter ( ) ; getInterceptor ( ) . paint ( new WebXmlRenderContext ( writer , uic . getLocale ( ) ) ) ; // The following only matters for a Portal context String title = uiComponent instanceof WApplication ? ( ( WApplication ) uiComponent ) . getTitle ( ) : null ; if ( title != null ) { setTitle ( title ) ; } } catch ( Escape esc ) { LOG . debug ( "Escape performed during render phase." ) ; handleEscape ( esc ) ; } catch ( Throwable t ) { // We try not to let any exception propagate to container . String message = "Caught exception during render phase." ; LOG . error ( message , t ) ; handleError ( t ) ; } finally { UIContextHolder . reset ( ) ; dispose ( ) ; }
public class Matrix4 { /** * { @ inheritDoc } This uses the iterative polar decomposition algorithm described by * < a href = " http : / / www . cs . wisc . edu / graphics / Courses / 838 - s2002 / Papers / polar - decomp . pdf " > Ken * Shoemake < / a > . */ @ Override // from IMatrix4 public Quaternion extractRotation ( Quaternion result ) throws SingularMatrixException { } }
// start with the contents of the upper 3x3 portion of the matrix float n00 = this . m00 , n10 = this . m10 , n20 = this . m20 ; float n01 = this . m01 , n11 = this . m11 , n21 = this . m21 ; float n02 = this . m02 , n12 = this . m12 , n22 = this . m22 ; for ( int ii = 0 ; ii < 10 ; ii ++ ) { // store the results of the previous iteration float o00 = n00 , o10 = n10 , o20 = n20 ; float o01 = n01 , o11 = n11 , o21 = n21 ; float o02 = n02 , o12 = n12 , o22 = n22 ; // compute average of the matrix with its inverse transpose float sd00 = o11 * o22 - o21 * o12 ; float sd10 = o01 * o22 - o21 * o02 ; float sd20 = o01 * o12 - o11 * o02 ; float det = o00 * sd00 + o20 * sd20 - o10 * sd10 ; if ( Math . abs ( det ) == 0f ) { // determinant is zero ; matrix is not invertible throw new SingularMatrixException ( this . toString ( ) ) ; } float hrdet = 0.5f / det ; n00 = + sd00 * hrdet + o00 * 0.5f ; n10 = - sd10 * hrdet + o10 * 0.5f ; n20 = + sd20 * hrdet + o20 * 0.5f ; n01 = - ( o10 * o22 - o20 * o12 ) * hrdet + o01 * 0.5f ; n11 = + ( o00 * o22 - o20 * o02 ) * hrdet + o11 * 0.5f ; n21 = - ( o00 * o12 - o10 * o02 ) * hrdet + o21 * 0.5f ; n02 = + ( o10 * o21 - o20 * o11 ) * hrdet + o02 * 0.5f ; n12 = - ( o00 * o21 - o20 * o01 ) * hrdet + o12 * 0.5f ; n22 = + ( o00 * o11 - o10 * o01 ) * hrdet + o22 * 0.5f ; // compute the difference ; if it ' s small enough , we ' re done float d00 = n00 - o00 , d10 = n10 - o10 , d20 = n20 - o20 ; float d01 = n01 - o01 , d11 = n11 - o11 , d21 = n21 - o21 ; float d02 = n02 - o02 , d12 = n12 - o12 , d22 = n22 - o22 ; if ( d00 * d00 + d10 * d10 + d20 * d20 + d01 * d01 + d11 * d11 + d21 * d21 + d02 * d02 + d12 * d12 + d22 * d22 < MathUtil . EPSILON ) { break ; } } // now that we have a nice orthogonal matrix , we can extract the rotation quaternion // using the method described in http : / / en . wikipedia . org / wiki / Rotation _ matrix # Conversions float x2 = Math . abs ( 1f + n00 - n11 - n22 ) ; float y2 = Math . abs ( 1f - n00 + n11 - n22 ) ; float z2 = Math . abs ( 1f - n00 - n11 + n22 ) ; float w2 = Math . abs ( 1f + n00 + n11 + n22 ) ; result . set ( 0.5f * FloatMath . sqrt ( x2 ) * ( n12 >= n21 ? + 1f : - 1f ) , 0.5f * FloatMath . sqrt ( y2 ) * ( n20 >= n02 ? + 1f : - 1f ) , 0.5f * FloatMath . sqrt ( z2 ) * ( n01 >= n10 ? + 1f : - 1f ) , 0.5f * FloatMath . sqrt ( w2 ) ) ; return result ;
public class Request { /** * Returns input stream to read server response from . * @ return input stream to read server response from . */ public InputStream getInputStream ( ) { } }
try { return connection . getInputStream ( ) ; } catch ( SocketTimeoutException e ) { throw new HttpException ( "Failed URL: " + url + ", waited for: " + connection . getConnectTimeout ( ) + " milliseconds" , e ) ; } catch ( Exception e ) { throw new HttpException ( "Failed URL: " + url , e ) ; }
public class MPP8Reader { /** * This method extracts and collates task data . * @ throws IOException */ private void processTaskData ( ) throws IOException { } }
DirectoryEntry taskDir = ( DirectoryEntry ) m_projectDir . getEntry ( "TBkndTask" ) ; FixFix taskFixedData = new FixFix ( 316 , new DocumentInputStream ( ( ( DocumentEntry ) taskDir . getEntry ( "FixFix 0" ) ) ) ) ; if ( taskFixedData . getDiff ( ) != 0 ) { taskFixedData = new FixFix ( 366 , new DocumentInputStream ( ( ( DocumentEntry ) taskDir . getEntry ( "FixFix 0" ) ) ) ) ; } FixDeferFix taskVarData = null ; ExtendedData taskExtData = null ; int tasks = taskFixedData . getItemCount ( ) ; byte [ ] data ; int uniqueID ; int id ; int deleted ; Task task ; boolean autoWBS = true ; byte [ ] flags = new byte [ 3 ] ; RecurringTaskReader recurringTaskReader = null ; ProjectProperties properties = m_file . getProjectProperties ( ) ; TimeUnit defaultProjectTimeUnits = properties . getDefaultDurationUnits ( ) ; for ( int loop = 0 ; loop < tasks ; loop ++ ) { data = taskFixedData . getByteArrayValue ( loop ) ; // Test for a valid unique id uniqueID = MPPUtility . getInt ( data , 0 ) ; if ( uniqueID < 1 ) { continue ; } // Test to ensure this task has not been deleted . // This appears to be a set of flags rather than a single value . // The data I have seen to date shows deleted tasks having values of // 0x0001 and 0x0002 . Valid tasks have had values of 0x0000 , 0x0914, // 0x0040 , 0x004A , 0x203D and 0x0031 deleted = MPPUtility . getShort ( data , 272 ) ; if ( ( deleted & 0xC0 ) == 0 && ( deleted & 0x03 ) != 0 && deleted != 0x0031 && deleted != 0x203D ) { continue ; } // Load the var data if we have not already done so if ( taskVarData == null ) { taskVarData = new FixDeferFix ( new DocumentInputStream ( ( ( DocumentEntry ) taskDir . getEntry ( "FixDeferFix 0" ) ) ) ) ; } // Blank rows can be present in MPP files . The following flag // appears to indicate that a row is blank , and should be // ignored . if ( ( data [ 8 ] & 0x01 ) != 0 ) { continue ; } taskExtData = new ExtendedData ( taskVarData , getOffset ( data , 312 ) ) ; byte [ ] recurringData = taskExtData . getByteArray ( TASK_RECURRING_DATA ) ; id = MPPUtility . getInt ( data , 4 ) ; flags [ 0 ] = ( byte ) ( data [ 268 ] & data [ 303 ] ) ; flags [ 1 ] = ( byte ) ( data [ 269 ] & data [ 304 ] ) ; flags [ 2 ] = ( byte ) ( data [ 270 ] & data [ 305 ] ) ; task = m_file . addTask ( ) ; task . setActualCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 234 ) ) / 100 ) ) ; task . setActualDuration ( MPPUtility . getAdjustedDuration ( properties , MPPUtility . getInt ( data , 74 ) , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , 72 ) , defaultProjectTimeUnits ) ) ) ; task . setActualFinish ( MPPUtility . getTimestamp ( data , 108 ) ) ; task . setActualOvertimeCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 210 ) ) / 100 ) ) ; task . setActualOvertimeWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 192 ) ) / 100 , TimeUnit . HOURS ) ) ; task . setActualStart ( MPPUtility . getTimestamp ( data , 104 ) ) ; task . setActualWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 180 ) ) / 100 , TimeUnit . HOURS ) ) ; // task . setACWP ( ) ; / / Calculated value // task . setAssignment ( ) ; / / Calculated value // task . setAssignmentDelay ( ) ; / / Calculated value // task . setAssignmentUnits ( ) ; / / Calculated value task . setBaselineCost ( NumberHelper . getDouble ( ( double ) MPPUtility . getLong6 ( data , 246 ) / 100 ) ) ; task . setBaselineDuration ( MPPUtility . getAdjustedDuration ( properties , MPPUtility . getInt ( data , 82 ) , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , 72 ) , defaultProjectTimeUnits ) ) ) ; task . setBaselineFinish ( MPPUtility . getTimestamp ( data , 116 ) ) ; task . setBaselineStart ( MPPUtility . getTimestamp ( data , 112 ) ) ; task . setBaselineWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 174 ) ) / 100 , TimeUnit . HOURS ) ) ; // task . setBCWP ( ) ; / / Calculated value // task . setBCWS ( ) ; / / Calculated value // task . setConfirmed ( ) ; / / Calculated value task . setConstraintDate ( MPPUtility . getTimestamp ( data , 120 ) ) ; task . setConstraintType ( ConstraintType . getInstance ( MPPUtility . getShort ( data , 88 ) ) ) ; task . setContact ( taskExtData . getUnicodeString ( TASK_CONTACT ) ) ; task . setCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 222 ) ) / 100 ) ) ; task . setCost ( 1 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST1 ) ) / 100 ) ) ; task . setCost ( 2 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST2 ) ) / 100 ) ) ; task . setCost ( 3 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST3 ) ) / 100 ) ) ; task . setCost ( 4 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST4 ) ) / 100 ) ) ; task . setCost ( 5 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST5 ) ) / 100 ) ) ; task . setCost ( 6 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST6 ) ) / 100 ) ) ; task . setCost ( 7 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST7 ) ) / 100 ) ) ; task . setCost ( 8 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST8 ) ) / 100 ) ) ; task . setCost ( 9 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST9 ) ) / 100 ) ) ; task . setCost ( 10 , NumberHelper . getDouble ( ( ( double ) taskExtData . getLong ( TASK_COST10 ) ) / 100 ) ) ; // task . setCostRateTable ( ) ; / / Calculated value // task . setCostVariance ( ) ; / / Populated below task . setCreateDate ( MPPUtility . getTimestamp ( data , 138 ) ) ; // task . setCritical ( ) ; / / Calculated value // task . setCV ( ) ; / / Calculated value task . setDate ( 1 , taskExtData . getTimestamp ( TASK_DATE1 ) ) ; task . setDate ( 2 , taskExtData . getTimestamp ( TASK_DATE2 ) ) ; task . setDate ( 3 , taskExtData . getTimestamp ( TASK_DATE3 ) ) ; task . setDate ( 4 , taskExtData . getTimestamp ( TASK_DATE4 ) ) ; task . setDate ( 5 , taskExtData . getTimestamp ( TASK_DATE5 ) ) ; task . setDate ( 6 , taskExtData . getTimestamp ( TASK_DATE6 ) ) ; task . setDate ( 7 , taskExtData . getTimestamp ( TASK_DATE7 ) ) ; task . setDate ( 8 , taskExtData . getTimestamp ( TASK_DATE8 ) ) ; task . setDate ( 9 , taskExtData . getTimestamp ( TASK_DATE9 ) ) ; task . setDate ( 10 , taskExtData . getTimestamp ( TASK_DATE10 ) ) ; // task . setDelay ( ) ; / / No longer supported by MS Project ? task . setDuration ( MPPUtility . getAdjustedDuration ( properties , MPPUtility . getInt ( data , 68 ) , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , 72 ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 1 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION1 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION1_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 2 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION2 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION2_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 3 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION3 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION3_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 4 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION4 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION4_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 5 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION5 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION5_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 6 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION6 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION6_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 7 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION7 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION7_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 8 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION8 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION8_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 9 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION9 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION9_UNITS ) , defaultProjectTimeUnits ) ) ) ; task . setDuration ( 10 , MPPUtility . getAdjustedDuration ( properties , taskExtData . getInt ( TASK_DURATION10 ) , MPPUtility . getDurationTimeUnits ( taskExtData . getShort ( TASK_DURATION10_UNITS ) , defaultProjectTimeUnits ) ) ) ; // task . setDurationVariance ( ) ; / / Calculated value task . setEarlyFinish ( MPPUtility . getTimestamp ( data , 20 ) ) ; task . setEarlyStart ( MPPUtility . getTimestamp ( data , 96 ) ) ; task . setEffortDriven ( ( data [ 17 ] & 0x08 ) != 0 ) ; // task . setExternalTask ( ) ; / / Calculated value task . setFinish ( MPPUtility . getTimestamp ( data , 20 ) ) ; task . setFinish ( 1 , taskExtData . getTimestamp ( TASK_FINISH1 ) ) ; task . setFinish ( 2 , taskExtData . getTimestamp ( TASK_FINISH2 ) ) ; task . setFinish ( 3 , taskExtData . getTimestamp ( TASK_FINISH3 ) ) ; task . setFinish ( 4 , taskExtData . getTimestamp ( TASK_FINISH4 ) ) ; task . setFinish ( 5 , taskExtData . getTimestamp ( TASK_FINISH5 ) ) ; task . setFinish ( 6 , taskExtData . getTimestamp ( TASK_FINISH6 ) ) ; task . setFinish ( 7 , taskExtData . getTimestamp ( TASK_FINISH7 ) ) ; task . setFinish ( 8 , taskExtData . getTimestamp ( TASK_FINISH8 ) ) ; task . setFinish ( 9 , taskExtData . getTimestamp ( TASK_FINISH9 ) ) ; task . setFinish ( 10 , taskExtData . getTimestamp ( TASK_FINISH10 ) ) ; // task . setFinishVariance ( ) ; / / Calculated value task . setFixedCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 228 ) ) / 100 ) ) ; task . setFixedCostAccrual ( AccrueType . getInstance ( MPPUtility . getShort ( data , 136 ) ) ) ; task . setFlag ( 1 , ( flags [ 0 ] & 0x02 ) != 0 ) ; task . setFlag ( 2 , ( flags [ 0 ] & 0x04 ) != 0 ) ; task . setFlag ( 3 , ( flags [ 0 ] & 0x08 ) != 0 ) ; task . setFlag ( 4 , ( flags [ 0 ] & 0x10 ) != 0 ) ; task . setFlag ( 5 , ( flags [ 0 ] & 0x20 ) != 0 ) ; task . setFlag ( 6 , ( flags [ 0 ] & 0x40 ) != 0 ) ; task . setFlag ( 7 , ( flags [ 0 ] & 0x80 ) != 0 ) ; task . setFlag ( 8 , ( flags [ 1 ] & 0x01 ) != 0 ) ; task . setFlag ( 9 , ( flags [ 1 ] & 0x02 ) != 0 ) ; task . setFlag ( 10 , ( flags [ 1 ] & 0x04 ) != 0 ) ; task . setFlag ( 11 , ( flags [ 1 ] & 0x08 ) != 0 ) ; task . setFlag ( 12 , ( flags [ 1 ] & 0x10 ) != 0 ) ; task . setFlag ( 13 , ( flags [ 1 ] & 0x20 ) != 0 ) ; task . setFlag ( 14 , ( flags [ 1 ] & 0x40 ) != 0 ) ; task . setFlag ( 15 , ( flags [ 1 ] & 0x80 ) != 0 ) ; task . setFlag ( 16 , ( flags [ 2 ] & 0x01 ) != 0 ) ; task . setFlag ( 17 , ( flags [ 2 ] & 0x02 ) != 0 ) ; task . setFlag ( 18 , ( flags [ 2 ] & 0x04 ) != 0 ) ; task . setFlag ( 19 , ( flags [ 2 ] & 0x08 ) != 0 ) ; task . setFlag ( 20 , ( flags [ 2 ] & 0x10 ) != 0 ) ; // note that this is not correct // task . setFreeSlack ( ) ; / / Calculated value task . setHideBar ( ( data [ 16 ] & 0x01 ) != 0 ) ; processHyperlinkData ( task , taskVarData . getByteArray ( - 1 - taskExtData . getInt ( TASK_HYPERLINK ) ) ) ; task . setID ( Integer . valueOf ( id ) ) ; // task . setIndicators ( ) ; / / Calculated value task . setLateFinish ( MPPUtility . getTimestamp ( data , 160 ) ) ; task . setLateStart ( MPPUtility . getTimestamp ( data , 24 ) ) ; task . setLevelAssignments ( ( data [ 19 ] & 0x10 ) != 0 ) ; task . setLevelingCanSplit ( ( data [ 19 ] & 0x08 ) != 0 ) ; task . setLevelingDelay ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getInt ( data , 90 ) ) / 3 , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , 94 ) , defaultProjectTimeUnits ) ) ) ; // task . setLinkedFields ( ) ; / / Calculated value task . setMarked ( ( data [ 13 ] & 0x02 ) != 0 ) ; task . setMilestone ( ( data [ 12 ] & 0x01 ) != 0 ) ; task . setName ( taskVarData . getUnicodeString ( getOffset ( data , 264 ) ) ) ; task . setNumber ( 1 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER1 ) ) ) ; task . setNumber ( 2 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER2 ) ) ) ; task . setNumber ( 3 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER3 ) ) ) ; task . setNumber ( 4 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER4 ) ) ) ; task . setNumber ( 5 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER5 ) ) ) ; task . setNumber ( 6 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER6 ) ) ) ; task . setNumber ( 7 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER7 ) ) ) ; task . setNumber ( 8 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER8 ) ) ) ; task . setNumber ( 9 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER9 ) ) ) ; task . setNumber ( 10 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER10 ) ) ) ; task . setNumber ( 11 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER11 ) ) ) ; task . setNumber ( 12 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER12 ) ) ) ; task . setNumber ( 13 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER13 ) ) ) ; task . setNumber ( 14 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER14 ) ) ) ; task . setNumber ( 15 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER15 ) ) ) ; task . setNumber ( 16 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER16 ) ) ) ; task . setNumber ( 17 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER17 ) ) ) ; task . setNumber ( 18 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER18 ) ) ) ; task . setNumber ( 19 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER19 ) ) ) ; task . setNumber ( 20 , NumberHelper . getDouble ( taskExtData . getDouble ( TASK_NUMBER20 ) ) ) ; // task . setObjects ( ) ; / / Calculated value task . setOutlineLevel ( Integer . valueOf ( MPPUtility . getShort ( data , 48 ) ) ) ; // task . setOutlineNumber ( ) ; / / Calculated value // task . setOverallocated ( ) ; / / Calculated value task . setOvertimeCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 204 ) ) / 100 ) ) ; // task . setOvertimeWork ( ) ; / / Calculated value // task . getPredecessors ( ) ; / / Calculated value task . setPercentageComplete ( MPPUtility . getPercentage ( data , 130 ) ) ; task . setPercentageWorkComplete ( MPPUtility . getPercentage ( data , 132 ) ) ; task . setPreleveledFinish ( MPPUtility . getTimestamp ( data , 148 ) ) ; task . setPreleveledStart ( MPPUtility . getTimestamp ( data , 144 ) ) ; task . setPriority ( Priority . getInstance ( ( MPPUtility . getShort ( data , 128 ) + 1 ) * 100 ) ) ; // task . setProject ( ) ; / / Calculated value task . setRecurring ( MPPUtility . getShort ( data , 142 ) != 0 ) ; // task . setRegularWork ( ) ; / / Calculated value task . setRemainingCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 240 ) ) / 100 ) ) ; task . setRemainingDuration ( MPPUtility . getAdjustedDuration ( properties , MPPUtility . getInt ( data , 78 ) , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , 72 ) , defaultProjectTimeUnits ) ) ) ; task . setRemainingOvertimeCost ( NumberHelper . getDouble ( ( ( double ) MPPUtility . getLong6 ( data , 216 ) ) / 100 ) ) ; task . setRemainingOvertimeWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 198 ) ) / 100 , TimeUnit . HOURS ) ) ; task . setRemainingWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 186 ) ) / 100 , TimeUnit . HOURS ) ) ; // task . setResourceGroup ( ) ; / / Calculated value from resource // task . setResourceInitials ( ) ; / / Calculated value from resource // task . setResourceNames ( ) ; / / Calculated value from resource // task . setResourcePhonetics ( ) ; / / Calculated value from resource // task . setResponsePending ( ) ; / / Calculated value task . setResume ( MPPUtility . getTimestamp ( data , 32 ) ) ; // task . setResumeNoEarlierThan ( ) ; / / Not in MSP98? task . setRollup ( ( data [ 15 ] & 0x04 ) != 0 ) ; task . setStart ( MPPUtility . getTimestamp ( data , 96 ) ) ; task . setStart ( 1 , taskExtData . getTimestamp ( TASK_START1 ) ) ; task . setStart ( 2 , taskExtData . getTimestamp ( TASK_START2 ) ) ; task . setStart ( 3 , taskExtData . getTimestamp ( TASK_START3 ) ) ; task . setStart ( 4 , taskExtData . getTimestamp ( TASK_START4 ) ) ; task . setStart ( 5 , taskExtData . getTimestamp ( TASK_START5 ) ) ; task . setStart ( 6 , taskExtData . getTimestamp ( TASK_START6 ) ) ; task . setStart ( 7 , taskExtData . getTimestamp ( TASK_START7 ) ) ; task . setStart ( 8 , taskExtData . getTimestamp ( TASK_START8 ) ) ; task . setStart ( 9 , taskExtData . getTimestamp ( TASK_START9 ) ) ; task . setStart ( 10 , taskExtData . getTimestamp ( TASK_START10 ) ) ; // task . setStartVariance ( ) ; / / Calculated value task . setStop ( MPPUtility . getTimestamp ( data , 124 ) ) ; // task . setSubprojectFile ( ) ; // task . setSubprojectReadOnly ( ) ; // task . setSuccessors ( ) ; / / Calculated value // task . setSummary ( ) ; / / Automatically generated by MPXJ // task . setSV ( ) ; / / Calculated value // task . teamStatusPending ( ) ; / / Calculated value task . setText ( 1 , taskExtData . getUnicodeString ( TASK_TEXT1 ) ) ; task . setText ( 2 , taskExtData . getUnicodeString ( TASK_TEXT2 ) ) ; task . setText ( 3 , taskExtData . getUnicodeString ( TASK_TEXT3 ) ) ; task . setText ( 4 , taskExtData . getUnicodeString ( TASK_TEXT4 ) ) ; task . setText ( 5 , taskExtData . getUnicodeString ( TASK_TEXT5 ) ) ; task . setText ( 6 , taskExtData . getUnicodeString ( TASK_TEXT6 ) ) ; task . setText ( 7 , taskExtData . getUnicodeString ( TASK_TEXT7 ) ) ; task . setText ( 8 , taskExtData . getUnicodeString ( TASK_TEXT8 ) ) ; task . setText ( 9 , taskExtData . getUnicodeString ( TASK_TEXT9 ) ) ; task . setText ( 10 , taskExtData . getUnicodeString ( TASK_TEXT10 ) ) ; task . setText ( 11 , taskExtData . getUnicodeString ( TASK_TEXT11 ) ) ; task . setText ( 12 , taskExtData . getUnicodeString ( TASK_TEXT12 ) ) ; task . setText ( 13 , taskExtData . getUnicodeString ( TASK_TEXT13 ) ) ; task . setText ( 14 , taskExtData . getUnicodeString ( TASK_TEXT14 ) ) ; task . setText ( 15 , taskExtData . getUnicodeString ( TASK_TEXT15 ) ) ; task . setText ( 16 , taskExtData . getUnicodeString ( TASK_TEXT16 ) ) ; task . setText ( 17 , taskExtData . getUnicodeString ( TASK_TEXT17 ) ) ; task . setText ( 18 , taskExtData . getUnicodeString ( TASK_TEXT18 ) ) ; task . setText ( 19 , taskExtData . getUnicodeString ( TASK_TEXT19 ) ) ; task . setText ( 20 , taskExtData . getUnicodeString ( TASK_TEXT20 ) ) ; task . setText ( 21 , taskExtData . getUnicodeString ( TASK_TEXT21 ) ) ; task . setText ( 22 , taskExtData . getUnicodeString ( TASK_TEXT22 ) ) ; task . setText ( 23 , taskExtData . getUnicodeString ( TASK_TEXT23 ) ) ; task . setText ( 24 , taskExtData . getUnicodeString ( TASK_TEXT24 ) ) ; task . setText ( 25 , taskExtData . getUnicodeString ( TASK_TEXT25 ) ) ; task . setText ( 26 , taskExtData . getUnicodeString ( TASK_TEXT26 ) ) ; task . setText ( 27 , taskExtData . getUnicodeString ( TASK_TEXT27 ) ) ; task . setText ( 28 , taskExtData . getUnicodeString ( TASK_TEXT28 ) ) ; task . setText ( 29 , taskExtData . getUnicodeString ( TASK_TEXT29 ) ) ; task . setText ( 30 , taskExtData . getUnicodeString ( TASK_TEXT30 ) ) ; // task . setTotalSlack ( ) ; / / Calculated value task . setType ( TaskType . getInstance ( MPPUtility . getShort ( data , 134 ) ) ) ; task . setUniqueID ( Integer . valueOf ( uniqueID ) ) ; // task . setUniqueIDPredecessors ( ) ; / / Calculated value // task . setUniqueIDSuccessors ( ) ; / / Calculated value // task . setUpdateNeeded ( ) ; / / Calculated value task . setWBS ( taskExtData . getUnicodeString ( TASK_WBS ) ) ; task . setWork ( MPPUtility . getDuration ( ( ( double ) MPPUtility . getLong6 ( data , 168 ) ) / 100 , TimeUnit . HOURS ) ) ; // task . setWorkContour ( ) ; / / Calculated from resource // task . setWorkVariance ( ) ; / / Calculated value // Retrieve task recurring data if ( recurringData != null ) { if ( recurringTaskReader == null ) { recurringTaskReader = new RecurringTaskReader ( properties ) ; } recurringTaskReader . processRecurringTask ( task , recurringData ) ; } // Retrieve the task notes . setTaskNotes ( task , data , taskExtData , taskVarData ) ; // If we have a WBS value from the MPP file , don ' t autogenerate if ( task . getWBS ( ) != null ) { autoWBS = false ; } m_eventManager . fireTaskReadEvent ( task ) ; // Uncommenting the call to this method is useful when trying // to determine the function of unknown task data . // dumpUnknownData ( task . getName ( ) , UNKNOWN _ TASK _ DATA , data ) ; } // Enable auto WBS if necessary m_file . getProjectConfig ( ) . setAutoWBS ( autoWBS ) ;
public class UtlReflection { /** * < p > Retrieve method from given class by name . < / p > * @ param pClazz - class * @ param pMethodName - method name * @ return Method method . * @ throws Exception if method not exist */ @ Override public final Method retrieveMethod ( final Class < ? > pClazz , final String pMethodName ) throws Exception { } }
for ( Method mfd : pClazz . getDeclaredMethods ( ) ) { if ( mfd . getName ( ) . equals ( pMethodName ) ) { return mfd ; } } final Class < ? > superClazz = pClazz . getSuperclass ( ) ; Method method = null ; if ( superClazz != null && superClazz != java . lang . Object . class ) { method = retrieveMethod ( superClazz , pMethodName ) ; } if ( method == null ) { throw new Exception ( "There is no method " + pMethodName + " in class " + pClazz ) ; // TO - DO class must be original } return method ;
public class KeyVaultClientBaseImpl { /** * Permanently deletes the specified storage account . * The purge deleted storage account operation removes the secret permanently , without the possibility of recovery . This operation can only be performed on a soft - delete enabled vault . This operation requires the storage / purge permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param storageAccountName The name of the storage account . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < Void > purgeDeletedStorageAccountAsync ( String vaultBaseUrl , String storageAccountName ) { } }
return purgeDeletedStorageAccountWithServiceResponseAsync ( vaultBaseUrl , storageAccountName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class SyncUtil { /** * Returns an update report with statistics of created , updated and deleted references and components . * @ return a String with the report . */ public String getReport ( ) { } }
return "Report\n - Created " + newComponents . size ( ) + " components\n - Updated " + this . updatedComponentCount + " components\n - Created " + newRefs . size ( ) + " references\n - Updated " + this . updatedRefCount + " references\n - Deleted " + this . deletedComponents + " components\n - Deleted " + this . deletedRefs + " references" ;
public class JSONConverter { /** * Decode a JSON document to retrieve a NotificationFilter array . * @ param in The stream to read JSON from * @ return The decoded NotificationFilter array * @ throws ConversionException If JSON uses unexpected structure / format * @ throws IOException If an I / O error occurs or if JSON is ill - formed . * @ throws ClassNotFoundException If needed class can ' t be found . * @ see # writeNotificationFilters ( OutputStream , NotificationFilter [ ] ) */ public NotificationFilter [ ] readNotificationFilters ( InputStream in ) throws ConversionException , IOException , ClassNotFoundException { } }
return readNotificationFiltersInternal ( parseArray ( in ) ) ;
public class PrimaveraReader { /** * See the notes above . * @ param parentTask parent task */ private void updateTaskCosts ( Task parentTask ) { } }
double baselineCost = 0 ; double actualCost = 0 ; double remainingCost = 0 ; double cost = 0 ; // process children first before adding their costs for ( Task child : parentTask . getChildTasks ( ) ) { updateTaskCosts ( child ) ; baselineCost += NumberHelper . getDouble ( child . getBaselineCost ( ) ) ; actualCost += NumberHelper . getDouble ( child . getActualCost ( ) ) ; remainingCost += NumberHelper . getDouble ( child . getRemainingCost ( ) ) ; cost += NumberHelper . getDouble ( child . getCost ( ) ) ; } List < ResourceAssignment > resourceAssignments = parentTask . getResourceAssignments ( ) ; for ( ResourceAssignment assignment : resourceAssignments ) { baselineCost += NumberHelper . getDouble ( assignment . getBaselineCost ( ) ) ; actualCost += NumberHelper . getDouble ( assignment . getActualCost ( ) ) ; remainingCost += NumberHelper . getDouble ( assignment . getRemainingCost ( ) ) ; cost += NumberHelper . getDouble ( assignment . getCost ( ) ) ; } parentTask . setBaselineCost ( NumberHelper . getDouble ( baselineCost ) ) ; parentTask . setActualCost ( NumberHelper . getDouble ( actualCost ) ) ; parentTask . setRemainingCost ( NumberHelper . getDouble ( remainingCost ) ) ; parentTask . setCost ( NumberHelper . getDouble ( cost ) ) ;
public class FaultToleranceTckLauncher { /** * Run the TCK ( controlled by autoFVT / publish / tckRunner / tcl / tck - suite . html ) * On Java EE7 the TCK will only run if the mode is full , otherwise it will be skipped entirely . * @ throws Exception */ @ Test @ AllowedFFDC // The tested exceptions cause FFDC so we have to allow for this . @ Mode ( TestMode . FULL ) @ SkipForRepeat ( SkipForRepeat . EE8_FEATURES ) public void launchFaultToleranceTCKEE7 ( ) throws Exception { } }
MvnUtils . runTCKMvnCmd ( server , "com.ibm.ws.microprofile.faulttolerance_fat_tck" , this . getClass ( ) + ":launchFaultToleranceTCK" ) ;
public class KeyVaultClientBaseImpl { /** * Gets the specified deleted sas definition . * The Get Deleted SAS Definition operation returns the specified deleted SAS definition along with its attributes . This operation requires the storage / getsas permission . * @ param vaultBaseUrl The vault name , for example https : / / myvault . vault . azure . net . * @ param storageAccountName The name of the storage account . * @ param sasDefinitionName The name of the SAS definition . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < DeletedSasDefinitionBundle > getDeletedSasDefinitionAsync ( String vaultBaseUrl , String storageAccountName , String sasDefinitionName , final ServiceCallback < DeletedSasDefinitionBundle > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getDeletedSasDefinitionWithServiceResponseAsync ( vaultBaseUrl , storageAccountName , sasDefinitionName ) , serviceCallback ) ;
public class IdemixUtils { /** * bigToBytes turns a BIG into a byte array * @ param big the BIG to turn into bytes * @ return a byte array representation of the BIG */ public static byte [ ] bigToBytes ( BIG big ) { } }
byte [ ] ret = new byte [ IdemixUtils . FIELD_BYTES ] ; big . toBytes ( ret ) ; return ret ;
public class Counters { /** * Returns the set of keys whose counts are at or above the given threshold . * This set may have 0 elements but will not be null . * @ param c * The Counter to examine * @ param countThreshold * Items equal to or above this number are kept * @ return A ( non - null ) Set of keys whose counts are at or above the given * threshold . */ public static < E > Set < E > keysAbove ( Counter < E > c , double countThreshold ) { } }
Set < E > keys = new HashSet < E > ( ) ; for ( E key : c . keySet ( ) ) { if ( c . getCount ( key ) >= countThreshold ) { keys . add ( key ) ; } } return ( keys ) ;
public class Model { /** * Update set statement with lambda * @ param function table column name with lambda * @ param value column value * @ param < T > * @ param < R > * @ return AnimaQuery */ public < T extends Model , R > AnimaQuery < ? extends Model > set ( TypeFunction < T , R > function , Object value ) { } }
return query . set ( function , value ) ;
public class LPAResetParameter { /** * Reset the parameter to not override the value specified by a fragment . This is done by * removing the parm edit in the PLF and setting the value in the ILF to the passed - in fragment * value . */ @ Override public void perform ( ) throws PortalException { } }
// push the change into the PLF if ( nodeId . startsWith ( Constants . FRAGMENT_ID_USER_PREFIX ) ) { // remove the parm edit ParameterEditManager . removeParmEditDirective ( nodeId , name , person ) ; } // push the fragment value into the ILF LPAChangeParameter . changeParameterChild ( ilfNode , name , fragmentValue ) ;
public class Models { /** * Creates a configured Jackson object mapper for parsing JSON */ public static ObjectMapper createObjectMapper ( ) { } }
ObjectMapper mapper = new ObjectMapper ( ) ; mapper . enable ( SerializationFeature . INDENT_OUTPUT ) ; return mapper ;
public class DestinationChangeListener { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . trm . dlm . DestinationLocationChangeListener # destinationLocationChange ( com . ibm . ws . sib . utils . SIBUuid12 , java . util . Set , java . util . Set , com . ibm . ws . sib . trm . dlm . Capability ) */ public void destinationLocationChange ( SIBUuid12 destId , Set additions , Set deletions , Capability capability ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "destinationLocationChange" , new Object [ ] { destId , additions , deletions , capability } ) ; BaseDestinationHandler destinationHandler = ( BaseDestinationHandler ) _destinationManager . getDestinationInternal ( destId , false ) ; if ( destinationHandler != null ) { // Check if the localisation should be deleted Set localitySet = getDestinationLocalitySet ( destinationHandler , capability ) ; synchronized ( destinationHandler ) { // d526250 - If a remote destination is deleted then its ME stopped we might // get a trm notification in . Meanwhile , admin has told us to delete the dest // already . If we dont do the following we end up performing cleanup on a // dest that no longer exists and we get nullpointers . if ( ! destinationHandler . isToBeDeleted ( ) ) { // Process deletions from the WLM set for the destination // ( No requirement to react to additions ) Iterator i = deletions . iterator ( ) ; while ( i . hasNext ( ) ) { SIBUuid8 meUuid = ( SIBUuid8 ) i . next ( ) ; // No point reacting to our own ME uuid if ( ! ( meUuid . equals ( _messageProcessor . getMessagingEngineUuid ( ) ) ) ) { PtoPMessageItemStream ptoPMessageItemStream ; ptoPMessageItemStream = destinationHandler . getXmitQueuePoint ( meUuid ) ; // Dont touch a localisation that doesnt exist if ( ptoPMessageItemStream != null ) { if ( ( localitySet == null ) || ! localitySet . contains ( meUuid . toString ( ) ) ) { // The localisation is not known in WCCM or WLM , so mark it for deletion cleanupDestination ( ptoPMessageItemStream , destinationHandler , meUuid , capability ) ; } } } } if ( capability != Capability . GET ) { // Reallocate the transmitQs to evenly spread messages destinationHandler . requestReallocation ( ) ; } } } } // Iterate over the registered MP listeners and alert them to the location change for ( int i = 0 ; i < _destinationChangeListeners . size ( ) ; i ++ ) { MPDestinationChangeListener listener = _destinationChangeListeners . get ( i ) ; if ( listener != null ) listener . destinationLocationChange ( destId , additions , deletions , capability ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "destinationLocationChange" ) ; return ;
public class CollUtil { /** * 获取给定Bean列表中指定字段名对应字段值的列表 < br > * 列表元素支持Bean与Map * @ param collection Bean集合或Map集合 * @ param fieldName 字段名或map的键 * @ return 字段值列表 * @ since 3.1.0 */ public static List < Object > getFieldValues ( Iterable < ? > collection , final String fieldName ) { } }
return getFieldValues ( collection , fieldName , false ) ;
public class Cargo { /** * Check if cargo is misdirected . * < ul > * < li > A cargo is misdirected if it is in a location that ' s not in the itinerary . * < li > A cargo with no itinerary can not be misdirected . * < li > A cargo that has received no handling events can not be misdirected . * < / ul > * @ return < code > true < / code > if the cargo has been misdirected , */ public boolean isMisdirected ( ) { } }
final HandlingEvent lastEvent = deliveryHistory ( ) . lastEvent ( ) ; if ( lastEvent == null ) { return false ; } else { return ! itinerary ( ) . isExpected ( lastEvent ) ; }
public class CompositeByteBuf { /** * Remove the { @ link ByteBuf } from the given index . * @ param cIndex the index on from which the { @ link ByteBuf } will be remove */ public CompositeByteBuf removeComponent ( int cIndex ) { } }
checkComponentIndex ( cIndex ) ; Component comp = components [ cIndex ] ; if ( lastAccessed == comp ) { lastAccessed = null ; } comp . free ( ) ; removeComp ( cIndex ) ; if ( comp . length ( ) > 0 ) { // Only need to call updateComponentOffsets if the length was > 0 updateComponentOffsets ( cIndex ) ; } return this ;
public class CmsLocaleManager { /** * Returns the content encoding set for the given resource . < p > * The content encoding is controlled by the property { @ link CmsPropertyDefinition # PROPERTY _ CONTENT _ ENCODING } , * which can be set on the resource or on a parent folder for all resources in this folder . < p > * In case no encoding has been set , the default encoding from * { @ link org . opencms . main . CmsSystemInfo # getDefaultEncoding ( ) } is returned . < p > * @ param cms the current OpenCms user context * @ param res the resource to read the encoding for * @ return the content encoding set for the given resource */ public static final String getResourceEncoding ( CmsObject cms , CmsResource res ) { } }
String encoding = null ; // get the encoding try { encoding = cms . readPropertyObject ( res , CmsPropertyDefinition . PROPERTY_CONTENT_ENCODING , true ) . getValue ( ) ; if ( encoding != null ) { encoding = CmsEncoder . lookupEncoding ( encoding . trim ( ) , encoding ) ; } } catch ( CmsException e ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_READ_ENCODING_PROP_1 , res . getRootPath ( ) ) , e ) ; } } if ( encoding == null ) { encoding = OpenCms . getSystemInfo ( ) . getDefaultEncoding ( ) ; } return encoding ;
public class COMObject { /** * public Object set ( PageContext pc , String propertyName , Object value ) { return * setEL ( pc , propertyName , value ) ; } */ @ Override public Object set ( PageContext pc , Collection . Key propertyName , Object value ) throws PageException { } }
Dispatch . put ( dispatch , propertyName . getString ( ) , value ) ; return value ;
public class ImageLoading { /** * Loading bitmap without any modifications * @ param uri content uri for bitmap * @ param context Application Context * @ return loaded bitmap ( always not null ) * @ throws ImageLoadException if it is unable to load file */ public static Bitmap loadBitmap ( Uri uri , Context context ) throws ImageLoadException { } }
return loadBitmap ( new UriSource ( uri , context ) ) ;
public class CmsRelationType { /** * Returns all user defined relation types in the given list . < p > * @ param relationTypes the collection of relation types to filter * @ return a list of { @ link CmsRelationType } objects */ public static List < CmsRelationType > filterUserDefined ( Collection < CmsRelationType > relationTypes ) { } }
List < CmsRelationType > result = new ArrayList < CmsRelationType > ( relationTypes ) ; Iterator < CmsRelationType > it = result . iterator ( ) ; while ( it . hasNext ( ) ) { CmsRelationType type = it . next ( ) ; if ( type . isInternal ( ) ) { it . remove ( ) ; } } return result ;
public class PathsDocument { /** * Apply extension context to all OperationsContentExtension . * @ param context context */ private void applyPathsDocumentExtension ( Context context ) { } }
extensionRegistry . getPathsDocumentExtensions ( ) . forEach ( extension -> extension . apply ( context ) ) ;
public class BooleanIterator { /** * Returns an infinite { @ code BooleanIterator } . * @ param supplier * @ return */ public static BooleanIterator generate ( final BooleanSupplier supplier ) { } }
N . checkArgNotNull ( supplier ) ; return new BooleanIterator ( ) { @ Override public boolean hasNext ( ) { return true ; } @ Override public boolean nextBoolean ( ) { return supplier . getAsBoolean ( ) ; } } ;
public class CPTaxCategoryServiceBaseImpl { /** * Sets the cp attachment file entry remote service . * @ param cpAttachmentFileEntryService the cp attachment file entry remote service */ public void setCPAttachmentFileEntryService ( com . liferay . commerce . product . service . CPAttachmentFileEntryService cpAttachmentFileEntryService ) { } }
this . cpAttachmentFileEntryService = cpAttachmentFileEntryService ;
public class FTPArchiveJob { /** * / * ( non - Javadoc ) * @ see org . audit4j . core . handler . file . ArchiveJob # archive ( ) */ @ Override void archive ( ) { } }
FTPArchiveClient client = new FTPArchiveClient ( ) ; try { client . init ( clientArguments ) ; } catch ( UnknownHostException e ) { throw new Audit4jRuntimeException ( "Excepting in running archive client." , e ) ; }
public class InjectionProcessor { /** * Gets an object factory for the specified class or class name . This * method must be used to support configurations without a class loader . * @ param klass the class or < tt > null < / tt > if unavailable * @ param className the class name or < tt > null < / tt > if klass was specified * @ return the ObjectFactory */ protected final ObjectFactoryInfo getObjectFactoryInfo ( Class < ? > klass , String className ) // F743-32443 { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getObjectFactory: " + klass + ", " + className ) ; if ( ivObjectFactoryMap == null ) { if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectFactory: no factories" ) ; return null ; } if ( klass != null && klass != Object . class ) // d700708 { ObjectFactoryInfo result = ivObjectFactoryMap . get ( klass ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectFactory: " + result ) ; return result ; } if ( ivObjectFactoryByNameMap == null ) { ivObjectFactoryByNameMap = new HashMap < String , ObjectFactoryInfo > ( ) ; for ( Map . Entry < Class < ? > , ObjectFactoryInfo > entry : ivObjectFactoryMap . entrySet ( ) ) { ivObjectFactoryByNameMap . put ( entry . getKey ( ) . getName ( ) , entry . getValue ( ) ) ; } } ObjectFactoryInfo result = ivObjectFactoryByNameMap . get ( className ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getObjectFactory (by-name): " + result ) ; return result ;
public class LinkedPE { /** * Gets to the linked PhysicalEntity . * @ param match current pattern match * @ param ind mapped indices * @ return linked PhysicalEntity */ @ Override public Collection < BioPAXElement > generate ( Match match , int ... ind ) { } }
PhysicalEntity pe = ( PhysicalEntity ) match . get ( ind [ 0 ] ) ; Set < BioPAXElement > set = getLinkedElements ( pe ) ; return set ;
public class Flow { /** * converts B into T with Mapper , ignores null - values */ public < T > Flow < T > map ( Mapper < ? super B , T > mapper ) { } }
return then ( new FlowMap < B , T > ( mapper ) ) ;
public class AtomikosPoolAdapter { /** * { @ inheritDoc } */ @ Override protected boolean isAcquireTimeoutException ( Exception e ) { } }
if ( e instanceof AtomikosSQLException ) { AtomikosSQLException atomikosSQLException = ( AtomikosSQLException ) e ; return atomikosSQLException . getMessage ( ) != null && ACQUIRE_TIMEOUT_MESSAGE . equals ( atomikosSQLException . getMessage ( ) ) ; } return false ;
public class TopicChanged { /** * Converts old serialized data to newer construct . * @ return itself */ @ SuppressWarnings ( "unused" ) private Object readResolve ( ) { } }
if ( StringUtils . isNotEmpty ( oldTopic ) ) { oldTopicObject = new Topic ( oldTopic ) ; oldTopic = null ; } if ( oldTopicObject != null && StringUtils . isEmpty ( oldTopicObject . getName ( ) ) ) { oldTopicObject = null ; } return this ;
public class TaggerUtils { /** * Converts training data as sequences into assignments that can be * used for parameter estimation . * @ param sequences * @ param featureGen * @ param model * @ return */ public static < I , O > List < Example < DynamicAssignment , DynamicAssignment > > reformatTrainingData ( List < ? extends TaggedSequence < I , O > > sequences , FeatureVectorGenerator < LocalContext < I > > featureGen , Function < ? super LocalContext < I > , ? extends Object > inputGen , DynamicVariableSet modelVariables , I startInput , O startLabel ) { } }
Preconditions . checkArgument ( ! ( startInput == null ^ startLabel == null ) ) ; DynamicVariableSet plate = modelVariables . getPlate ( PLATE_NAME ) ; VariableNumMap x = plate . getFixedVariables ( ) . getVariablesByName ( INPUT_FEATURES_NAME ) ; VariableNumMap xInput = plate . getFixedVariables ( ) . getVariablesByName ( INPUT_NAME ) ; VariableNumMap y = plate . getFixedVariables ( ) . getVariablesByName ( OUTPUT_NAME ) ; List < Example < DynamicAssignment , DynamicAssignment > > examples = Lists . newArrayList ( ) ; for ( TaggedSequence < I , O > sequence : sequences ) { List < Assignment > inputs = Lists . newArrayList ( ) ; if ( startInput != null ) { List < I > newItems = Lists . newArrayList ( ) ; newItems . add ( startInput ) ; newItems . addAll ( sequence . getItems ( ) ) ; LocalContext < I > startContext = new ListLocalContext < I > ( newItems , 0 ) ; Assignment inputFeatureVector = x . outcomeArrayToAssignment ( featureGen . apply ( startContext ) ) ; Assignment inputElement = xInput . outcomeArrayToAssignment ( inputGen . apply ( startContext ) ) ; Assignment firstLabel = y . outcomeArrayToAssignment ( startLabel ) ; inputs . add ( Assignment . unionAll ( inputFeatureVector , inputElement , firstLabel ) ) ; } List < LocalContext < I > > contexts = sequence . getLocalContexts ( ) ; for ( int i = 0 ; i < contexts . size ( ) ; i ++ ) { Assignment inputFeatureVector = x . outcomeArrayToAssignment ( featureGen . apply ( contexts . get ( i ) ) ) ; Assignment inputElement = xInput . outcomeArrayToAssignment ( inputGen . apply ( contexts . get ( i ) ) ) ; inputs . add ( inputFeatureVector . union ( inputElement ) ) ; } DynamicAssignment input = DynamicAssignment . createPlateAssignment ( PLATE_NAME , inputs ) ; DynamicAssignment output = DynamicAssignment . EMPTY ; if ( sequence . getLabels ( ) != null ) { List < Assignment > outputs = Lists . newArrayList ( ) ; if ( startInput != null ) { // First label is given ( and equal to the special start label ) . outputs . add ( Assignment . EMPTY ) ; } List < O > labels = sequence . getLabels ( ) ; for ( int i = 0 ; i < contexts . size ( ) ; i ++ ) { outputs . add ( y . outcomeArrayToAssignment ( labels . get ( i ) ) ) ; } output = DynamicAssignment . createPlateAssignment ( PLATE_NAME , outputs ) ; } examples . add ( Example . create ( input , output ) ) ; } return examples ;
public class CmsElementRename { /** * Does validate the request parameters and returns a buffer with error messages . < p > * If there were no error messages , the buffer is empty . < p > */ public void validateParameters ( ) { } }
// localisation CmsMessages messages = Messages . get ( ) . getBundle ( getLocale ( ) ) ; StringBuffer validationErrors = new StringBuffer ( ) ; if ( CmsStringUtil . isEmpty ( getParamResource ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_RESOURCE_FOLDER_0 ) ) . append ( "<br>" ) ; } if ( CmsStringUtil . isEmpty ( getParamTemplate ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_SELECT_TEMPLATE_0 ) ) . append ( "<br>" ) ; } if ( CmsStringUtil . isEmpty ( getParamLocale ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_SELECT_LANGUAGE_0 ) ) . append ( "<br>" ) ; } if ( CmsStringUtil . isEmpty ( getParamOldElement ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_ENTER_OLD_ELEM_0 ) ) . append ( "<br>" ) ; } if ( CmsStringUtil . isEmpty ( getParamNewElement ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_ENTER_NEW_ELEM_0 ) ) . append ( "<br>" ) ; } if ( ! isValidElement ( getParamNewElement ( ) ) ) { validationErrors . append ( messages . key ( Messages . GUI_ELEM_RENAME_VALIDATE_INVALID_NEW_ELEM_2 , getParamNewElement ( ) , getParamTemplate ( ) ) ) . append ( "<br>" ) ; } setErrorMessage ( validationErrors . toString ( ) ) ;
public class Rectangle { /** * Sets the location and size . * @ param x The horizontal location . * @ param y The vertical location . * @ param w The rectangle width . * @ param h The rectangle height . */ public void set ( double x , double y , double w , double h ) { } }
this . x = x ; this . y = y ; width = w ; height = h ;
public class CmsFileExplorer { /** * Initializes the app specific toolbar buttons . < p > * @ param context the UI context */ private void initToolbarButtons ( I_CmsAppUIContext context ) { } }
m_publishButton = context . addPublishButton ( new I_CmsUpdateListener < String > ( ) { public void onUpdate ( List < String > updatedItems ) { updateAll ( false ) ; } } ) ; m_newButton = CmsToolBar . createButton ( FontOpenCms . WAND , CmsVaadinUtils . getMessageText ( Messages . GUI_NEW_RESOURCE_TITLE_0 ) ) ; if ( CmsAppWorkplaceUi . isOnlineProject ( ) ) { m_newButton . setEnabled ( false ) ; m_newButton . setDescription ( CmsVaadinUtils . getMessageText ( Messages . GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0 ) ) ; } m_newButton . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = 1L ; public void buttonClick ( ClickEvent event ) { onClickNew ( ) ; } } ) ; context . addToolbarButton ( m_newButton ) ; m_uploadButton = new CmsUploadButton ( FontOpenCms . UPLOAD , "/" ) ; m_uploadButton . addStyleName ( ValoTheme . BUTTON_BORDERLESS ) ; m_uploadButton . addStyleName ( OpenCmsTheme . TOOLBAR_BUTTON ) ; if ( CmsAppWorkplaceUi . isOnlineProject ( ) ) { m_uploadButton . setEnabled ( false ) ; m_uploadButton . setDescription ( CmsVaadinUtils . getMessageText ( Messages . GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0 ) ) ; } else { m_uploadButton . setDescription ( CmsVaadinUtils . getMessageText ( Messages . GUI_UPLOAD_BUTTON_TITLE_0 ) ) ; } m_uploadButton . addUploadListener ( new I_UploadListener ( ) { public void onUploadFinished ( List < String > uploadedFiles ) { updateAll ( true ) ; } } ) ; context . addToolbarButton ( m_uploadButton ) ;
public class DocumentRevisionTree { /** * < p > Returns the { @ link InternalDocumentRevision } for a document ID and revision ID . < / p > * @ param id document ID * @ param rev revision ID * @ return the { @ code DocumentRevision } for the document and revision ID */ public InternalDocumentRevision lookup ( String id , String rev ) { } }
for ( DocumentRevisionNode n : sequenceMap . values ( ) ) { if ( n . getData ( ) . getId ( ) . equals ( id ) && n . getData ( ) . getRevision ( ) . equals ( rev ) ) { return n . getData ( ) ; } } return null ;
public class Traits { /** * Reflection API to find the method corresponding to the default implementation of a trait , given a bridge method . * @ param someMethod a method node * @ return null if it is not a method implemented in a trait . If it is , returns the method from the trait class . */ public static Method getBridgeMethodTarget ( Method someMethod ) { } }
TraitBridge annotation = someMethod . getAnnotation ( TraitBridge . class ) ; if ( annotation == null ) { return null ; } Class aClass = annotation . traitClass ( ) ; String desc = annotation . desc ( ) ; for ( Method method : aClass . getDeclaredMethods ( ) ) { String methodDescriptor = BytecodeHelper . getMethodDescriptor ( method . getReturnType ( ) , method . getParameterTypes ( ) ) ; if ( desc . equals ( methodDescriptor ) ) { return method ; } } return null ;
public class GenomicsDataSourceBase { /** * Gets unmapped mates so we can inject them besides their mapped pairs . * @ throws GeneralSecurityException * @ throws IOException */ protected UnmappedReads < Read > getUnmappedMatesOfMappedReads ( String readsetId ) throws GeneralSecurityException , IOException { } }
LOG . info ( "Collecting unmapped mates of mapped reads for injection" ) ; final Iterable < Read > unmappedReadsIterable = getUnmappedReadsIterator ( readsetId ) ; final UnmappedReads < Read > unmappedReads = createUnmappedReads ( ) ; for ( Read read : unmappedReadsIterable ) { unmappedReads . maybeAddRead ( read ) ; } LOG . info ( "Finished collecting unmapped mates of mapped reads: " + unmappedReads . getReadCount ( ) + " found." ) ; return unmappedReads ;
public class RateLimiterBucket { /** * Resets the count if the period boundary has been crossed . Returns true if the * count was reset to 0 or false otherwise . * @ param period the period */ public boolean resetIfNecessary ( RateBucketPeriod period ) { } }
long periodBoundary = getLastPeriodBoundary ( period ) ; if ( System . currentTimeMillis ( ) >= periodBoundary ) { setCount ( 0 ) ; return true ; } return false ;
public class CmsIndexingThread { /** * Creates a document for the resource without extracting the content . The aim is to get a content indexed , * even if extraction runs into a timeout . * @ return the document for the resource generated if the content is discarded , * i . e . , only meta information are indexed . */ protected I_CmsSearchDocument createDefaultIndexDocument ( ) { } }
try { return m_index . getFieldConfiguration ( ) . createDocument ( m_cms , m_res , m_index , null ) ; } catch ( CmsException e ) { LOG . error ( "Default document for " + m_res . getRootPath ( ) + " and index " + m_index . getName ( ) + " could not be created." , e ) ; return null ; }
public class CommonFunction { /** * Utility method to hide passwords from a map structure . * Make a copy of the map and * < li > replace password values with * * * * * * < li > replace map values by recursively invoking this method * @ param map collection of name / value pairs . Values might be passwords or submaps of * name / value pairs that might contain more submaps or passwords . * @ param depth depth of the map . A map without any submaps is depth 1. * @ return copy of the map with passwords hidden . */ @ SuppressWarnings ( "unchecked" ) public static final Map < ? , ? > hidePasswords ( Map < ? , ? > map , int depth ) { } }
if ( map != null && depth > 0 ) { map = new HashMap < Object , Object > ( map ) ; for ( @ SuppressWarnings ( "rawtypes" ) Map . Entry entry : map . entrySet ( ) ) if ( entry . getKey ( ) instanceof String && ( ( String ) entry . getKey ( ) ) . toUpperCase ( ) . contains ( "PASSWORD" ) ) entry . setValue ( "******" ) ; else if ( entry . getValue ( ) instanceof Map ) entry . setValue ( hidePasswords ( ( Map < ? , ? > ) entry . getValue ( ) , depth - 1 ) ) ; } return map ;
public class Base64 { /** * Tests a given byte array to see if it contains only valid characters within the Base64 alphabet . * @ param arrayOctet * byte array to test * @ return < code > true < / code > if any byte is a valid character in the Base64 alphabet ; false herwise */ private static boolean containsBase64Byte ( byte [ ] arrayOctet ) { } }
for ( int i = 0 ; i < arrayOctet . length ; i ++ ) { if ( isBase64 ( arrayOctet [ i ] ) ) { return true ; } } return false ;
public class GuavaOptionalSubject { /** * Fails if the { @ link Optional } { @ code < T > } does not have the given value or the subject is null . * < p > To make more complex assertions on the optional ' s value split your assertion in two : * < pre > { @ code * assertThat ( myOptional ) . isPresent ( ) ; * assertThat ( myOptional . get ( ) ) . contains ( " foo " ) ; * } < / pre > */ public void hasValue ( Object expected ) { } }
if ( expected == null ) { throw new NullPointerException ( "Optional cannot have a null value." ) ; } if ( actual ( ) == null ) { failWithActual ( "expected an optional with value" , expected ) ; } else if ( ! actual ( ) . isPresent ( ) ) { failWithoutActual ( fact ( "expected to have value" , expected ) , simpleFact ( "but was absent" ) ) ; } else { checkNoNeedToDisplayBothValues ( "get()" ) . that ( actual ( ) . get ( ) ) . isEqualTo ( expected ) ; }
public class CatalogUtil { /** * Computes a MD5 digest ( 128 bits - > 2 longs - > UUID which is comprised of * two longs ) of a deployment file stripped of all comments and its hostcount * attribute set to 0. * @ param deploymentBytes * @ return MD5 digest for for configuration */ public static UUID makeDeploymentHashForConfig ( byte [ ] deploymentBytes ) { } }
String normalized = new String ( deploymentBytes , StandardCharsets . UTF_8 ) ; Matcher matcher = XML_COMMENT_RE . matcher ( normalized ) ; normalized = matcher . replaceAll ( "" ) ; matcher = HOSTCOUNT_RE . matcher ( normalized ) ; normalized = matcher . replaceFirst ( "hostcount=\"0\"" ) ; return Digester . md5AsUUID ( normalized ) ;
public class RangeTombstoneList { /** * Adds the new tombstone at index i , growing and / or moving elements to make room for it . */ private void addInternal ( int i , Composite start , Composite end , long markedAt , int delTime ) { } }
assert i >= 0 ; if ( size == capacity ( ) ) growToFree ( i ) ; else if ( i < size ) moveElements ( i ) ; setInternal ( i , start , end , markedAt , delTime ) ; size ++ ;
public class PropertyList { /** * Returns a list of properties with the specified name . * @ param name name of properties to return * @ return a property list */ @ SuppressWarnings ( "unchecked" ) public final < C extends T > PropertyList < C > getProperties ( final String name ) { } }
final PropertyList < C > list = new PropertyList < C > ( ) ; for ( final T p : this ) { if ( p . getName ( ) . equalsIgnoreCase ( name ) ) { list . add ( ( C ) p ) ; } } return list ;
public class Command { /** * Validate the command * @ param restClient */ public void validate ( RESTClient restClient ) { } }
Utils . require ( this . commandName != null , "missing command name" ) ; // validate command name this . metadataJson = matchCommand ( restMetadataJson , this . commandName , commandParams . containsKey ( STORAGE_SERVICE ) ? ( String ) commandParams . get ( STORAGE_SERVICE ) : _SYSTEM ) ; if ( this . metadataJson == null ) { // application command not found , look for system command if ( commandParams . containsKey ( STORAGE_SERVICE ) ) { this . metadataJson = matchCommand ( restMetadataJson , this . commandName , _SYSTEM ) ; } } if ( this . metadataJson == null ) { throw new RuntimeException ( "unsupported command name: " + this . commandName ) ; } // validate required params validateRequiredParams ( ) ;
public class CycleHandler { /** * Removes cycles from the graph that was used to construct the cycle handler . * @ throws WikiApiException Thrown if errors occurred . */ public void removeCycles ( ) throws WikiApiException { } }
DefaultEdge edge = null ; while ( ( edge = findCycle ( ) ) != null ) { Category sourceCat = wiki . getCategory ( categoryGraph . getGraph ( ) . getEdgeSource ( edge ) ) ; Category targetCat = wiki . getCategory ( categoryGraph . getGraph ( ) . getEdgeTarget ( edge ) ) ; logger . info ( "Removing cycle: " + sourceCat . getTitle ( ) + " - " + targetCat . getTitle ( ) ) ; categoryGraph . getGraph ( ) . removeEdge ( edge ) ; }
public class YamlFileFixture { /** * Adds the yaml loaded from the specified file to current values . * @ param filename YAML file to load * @ return true when file is loaded */ @ Override public boolean loadValuesFrom ( String filename ) { } }
String yamlStr = textIn ( filename ) ; Object y = yaml . load ( yamlStr ) ; if ( y instanceof Map ) { getCurrentValues ( ) . putAll ( ( Map ) y ) ; } else { getCurrentValues ( ) . put ( "elements" , y ) ; } return true ;
public class RuntimeExceptionsFactory { /** * Constructs and initializes a new { @ link IllegalArgumentException } with the given { @ link Throwable cause } * and { @ link String message } formatted with the given { @ link Object [ ] arguments } . * @ param cause { @ link Throwable } identified as the reason this { @ link IllegalArgumentException } was thrown . * @ param message { @ link String } describing the { @ link IllegalArgumentException exception } . * @ param args { @ link Object [ ] arguments } used to replace format placeholders in the { @ link String message } . * @ return a new { @ link IllegalArgumentException } with the given { @ link Throwable cause } and { @ link String message } . * @ see java . lang . IllegalArgumentException */ public static IllegalArgumentException newIllegalArgumentException ( Throwable cause , String message , Object ... args ) { } }
return new IllegalArgumentException ( format ( message , args ) , cause ) ;
public class AbstractStreamEx { /** * Performs a mapping of the stream content to a partial function * removing the elements to which the function is not applicable . * If the mapping function returns { @ link Optional # empty ( ) } , the original * value will be removed from the resulting stream . The mapping function * may not return null . * This is an < a href = " package - summary . html # StreamOps " > intermediate * operation < / a > . * The { @ code mapPartial ( ) } operation has the effect of applying a * one - to - zero - or - one transformation to the elements of the stream , and then * flattening the resulting elements into a new stream . * @ param < R > The element type of the new stream * @ param mapper a < a * href = " package - summary . html # NonInterference " > non - interfering < / a > , * < a href = " package - summary . html # Statelessness " > stateless < / a > * partial function to apply to each element which returns a present optional * if it ' s applicable , or an empty optional otherwise * @ return the new stream * @ since 0.6.8 */ public < R > StreamEx < R > mapPartial ( Function < ? super T , ? extends Optional < ? extends R > > mapper ) { } }
return new StreamEx < > ( stream ( ) . map ( value -> mapper . apply ( value ) . orElse ( null ) ) . filter ( Objects :: nonNull ) , context ) ;
public class GrpcUtils { /** * Converts a proto type to a wire type . * @ param workerInfo the proto type to convert * @ return the converted wire type */ public static WorkerInfo fromProto ( alluxio . grpc . WorkerInfo workerInfo ) { } }
return new WorkerInfo ( ) . setAddress ( fromProto ( workerInfo . getAddress ( ) ) ) . setCapacityBytes ( workerInfo . getCapacityBytes ( ) ) . setCapacityBytesOnTiers ( workerInfo . getCapacityBytesOnTiers ( ) ) . setId ( workerInfo . getId ( ) ) . setLastContactSec ( workerInfo . getLastContactSec ( ) ) . setStartTimeMs ( workerInfo . getStartTimeMs ( ) ) . setState ( workerInfo . getState ( ) ) . setUsedBytes ( workerInfo . getUsedBytes ( ) ) . setUsedBytesOnTiers ( workerInfo . getUsedBytesOnTiersMap ( ) ) ;
public class JsonUtils { /** * Converts a given Json string to an JSONPath ReadContext * @ param json The json string to convert * @ return JSPNPath read context */ public static ReadContext fromJson ( String json ) { } }
Objects . requireNonNull ( json , Required . JSON . toString ( ) ) ; return JsonPath . parse ( json ) ;
public class DrawerManager { /** * Push and display a drawer on the page during an AJAX request , * and inject an optional CSS class onto the drawer ' s immediate container . * @ param drawer * The drawer to be pushed . Cannot be null . * @ param target * The current AJAX target . * @ param cssClass * The name of the class to be injected . */ public void push ( AbstractDrawer drawer , AjaxRequestTarget target , String cssClass ) { } }
ListItem item = new ListItem ( "next" , drawer , this , cssClass ) ; drawers . push ( item ) ; if ( first == null ) { first = item ; addOrReplace ( first ) ; } else { ListItem iter = first ; while ( iter . next != null ) { iter = iter . next ; } iter . add ( item ) ; } if ( target != null ) { target . add ( item ) ; target . appendJavaScript ( "$('#" + item . item . getMarkupId ( ) + "').modaldrawer('show');" ) ; if ( item . previous != null ) { target . appendJavaScript ( "$('#" + item . previous . item . getMarkupId ( ) + "').removeClass('shown-modal');" ) ; target . appendJavaScript ( "$('#" + item . previous . item . getMarkupId ( ) + "').addClass('hidden-modal');" ) ; } } drawer . setManager ( this ) ;
public class WebColors { /** * Gives you a Color based on a name . * @ param name * a name such as black , violet , cornflowerblue or # RGB or # RRGGBB * or rgb ( R , G , B ) * @ return the corresponding Color object * @ throws IllegalArgumentException * if the String isn ' t a know representation of a color . */ public static Color getRGBColor ( String name ) throws IllegalArgumentException { } }
int [ ] c = { 0 , 0 , 0 , 0 } ; if ( name . startsWith ( "#" ) ) { if ( name . length ( ) == 4 ) { c [ 0 ] = Integer . parseInt ( name . substring ( 1 , 2 ) , 16 ) * 16 ; c [ 1 ] = Integer . parseInt ( name . substring ( 2 , 3 ) , 16 ) * 16 ; c [ 2 ] = Integer . parseInt ( name . substring ( 3 ) , 16 ) * 16 ; return new Color ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] ) ; } if ( name . length ( ) == 7 ) { c [ 0 ] = Integer . parseInt ( name . substring ( 1 , 3 ) , 16 ) ; c [ 1 ] = Integer . parseInt ( name . substring ( 3 , 5 ) , 16 ) ; c [ 2 ] = Integer . parseInt ( name . substring ( 5 ) , 16 ) ; return new Color ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] ) ; } throw new IllegalArgumentException ( "Unknown color format. Must be #RGB or #RRGGBB" ) ; } else if ( name . startsWith ( "rgb(" ) ) { StringTokenizer tok = new StringTokenizer ( name , "rgb(), \t\r\n\f" ) ; for ( int k = 0 ; k < 3 ; ++ k ) { String v = tok . nextToken ( ) ; if ( v . endsWith ( "%" ) ) c [ k ] = Integer . parseInt ( v . substring ( 0 , v . length ( ) - 1 ) ) * 255 / 100 ; else c [ k ] = Integer . parseInt ( v ) ; if ( c [ k ] < 0 ) c [ k ] = 0 ; else if ( c [ k ] > 255 ) c [ k ] = 255 ; } return new Color ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] ) ; } name = name . toLowerCase ( ) ; if ( ! NAMES . containsKey ( name ) ) throw new IllegalArgumentException ( "Color '" + name + "' not found." ) ; c = ( int [ ] ) NAMES . get ( name ) ; return new Color ( c [ 0 ] , c [ 1 ] , c [ 2 ] , c [ 3 ] ) ;
public class JmxMonitor { /** * Tries to guess a context path for the running application . * If this is a web application running under a tomcat server this will work . * If unsuccessful , returns null . * @ return A string representing the current context path or null if it cannot be determined . */ private String getContextPath ( ) { } }
ClassLoader loader = getClass ( ) . getClassLoader ( ) ; if ( loader == null ) return null ; URL url = loader . getResource ( "/" ) ; if ( url != null ) { String [ ] elements = url . toString ( ) . split ( "/" ) ; for ( int i = elements . length - 1 ; i > 0 ; -- i ) { // URLs look like this : file : / . . . / ImageServer / WEB - INF / classes / // And we want that part that ' s just before WEB - INF if ( "WEB-INF" . equals ( elements [ i ] ) ) { return elements [ i - 1 ] ; } } } return null ;
public class ModCluster { /** * Get the handler proxying the requests . * @ return the proxy handler */ public HttpHandler createProxyHandler ( ) { } }
return ProxyHandler . builder ( ) . setProxyClient ( container . getProxyClient ( ) ) . setMaxRequestTime ( maxRequestTime ) . setMaxConnectionRetries ( maxRetries ) . setReuseXForwarded ( reuseXForwarded ) . build ( ) ;
public class BundleTrackerAggregator { /** * { @ inheritDoc } */ @ Override public ServiceType addingService ( ServiceReference < ServiceType > reference ) { } }
ServiceType service = super . addingService ( reference ) ; for ( ServiceTrackerAggregatorReadyChildren < ServiceType > child : children ) { child . addingService ( reference , service ) ; } return service ;
public class TypeAnnotationPosition { /** * Create a { @ code TypeAnnotationPosition } for a method * invocation type argument . * @ param location The type path . * @ param type _ index The index of the type argument . */ public static TypeAnnotationPosition methodInvocationTypeArg ( final List < TypePathEntry > location , final int type_index ) { } }
return methodInvocationTypeArg ( location , null , type_index , - 1 ) ;
public class CommerceNotificationQueueEntryPersistenceImpl { /** * Returns the last commerce notification queue entry in the ordered set where sentDate & lt ; & # 63 ; . * @ param sentDate the sent date * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce notification queue entry , or < code > null < / code > if a matching commerce notification queue entry could not be found */ @ Override public CommerceNotificationQueueEntry fetchByLtS_Last ( Date sentDate , OrderByComparator < CommerceNotificationQueueEntry > orderByComparator ) { } }
int count = countByLtS ( sentDate ) ; if ( count == 0 ) { return null ; } List < CommerceNotificationQueueEntry > list = findByLtS ( sentDate , count - 1 , count , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class LinkedList { /** * Unlinks non - null first node f . */ private E unlinkFirst ( Node < E > f ) { } }
// assert f = = first & & f ! = null ; final E element = f . item ; final Node < E > next = f . next ; f . item = null ; f . next = null ; // help GC first = next ; if ( next == null ) last = null ; else next . prev = null ; size -- ; modCount ++ ; return element ;
public class BaseCustomDfuImpl { /** * Starts sending the data . This method is SYNCHRONOUS and terminates when the whole file will * be uploaded or the device get disconnected . If connection state will change , or an error * will occur , an exception will be thrown . * @ param packetCharacteristic the characteristic to write file content to . Must be the DFU PACKET . * @ throws DeviceDisconnectedException Thrown when the device will disconnect in the middle * of the transmission . * @ throws DfuException Thrown if DFU error occur . * @ throws UploadAbortedException Thrown if DFU operation was aborted by user . */ void uploadFirmwareImage ( final BluetoothGattCharacteristic packetCharacteristic ) throws DeviceDisconnectedException , DfuException , UploadAbortedException { } }
if ( mAborted ) throw new UploadAbortedException ( ) ; mReceivedData = null ; mError = 0 ; mFirmwareUploadInProgress = true ; mPacketsSentSinceNotification = 0 ; final byte [ ] buffer = mBuffer ; try { final int size = mFirmwareStream . read ( buffer ) ; mService . sendLogBroadcast ( DfuBaseService . LOG_LEVEL_VERBOSE , "Sending firmware to characteristic " + packetCharacteristic . getUuid ( ) + "..." ) ; writePacket ( mGatt , packetCharacteristic , buffer , size ) ; } catch ( final HexFileValidationException e ) { throw new DfuException ( "HEX file not valid" , DfuBaseService . ERROR_FILE_INVALID ) ; } catch ( final IOException e ) { throw new DfuException ( "Error while reading file" , DfuBaseService . ERROR_FILE_IO_EXCEPTION ) ; } try { synchronized ( mLock ) { while ( ( mFirmwareUploadInProgress && mReceivedData == null && mConnected && mError == 0 ) || mPaused ) mLock . wait ( ) ; } } catch ( final InterruptedException e ) { loge ( "Sleeping interrupted" , e ) ; } if ( ! mConnected ) throw new DeviceDisconnectedException ( "Uploading Firmware Image failed: device disconnected" ) ; if ( mError != 0 ) throw new DfuException ( "Uploading Firmware Image failed" , mError ) ;
public class H2O { /** * Dead stupid argument parser . */ static void parseArguments ( String [ ] args ) { } }
for ( AbstractH2OExtension e : extManager . getCoreExtensions ( ) ) { args = e . parseArguments ( args ) ; } parseH2OArgumentsTo ( args , ARGS ) ;
public class HttpChannelConfig { /** * Check the configuration map for to see if we should send or not content - length on 1xx and 204 responses * @ param props */ private void parseRemoveCLHeaderInTempStatusRespRFC7230compat ( Map props ) { } }
// PI35277 String value = ( String ) props . get ( HttpConfigConstants . REMOVE_CLHEADER_IN_TEMP_STATUS_RFC7230_COMPAT ) ; if ( null != value ) { this . removeCLHeaderInTempStatusRespRFC7230compat = convertBoolean ( value ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Config: RemoveCLHeaderInTempStatusRespRFC7230compat " + shouldRemoveCLHeaderInTempStatusRespRFC7230compat ( ) ) ; } }
public class Contract { /** * Checks that the collections have the same number of elements , otherwise throws an exception * @ param collection1 the first collection * @ param collection2 the second collection * @ param collection1Name the name of the first collection * @ param collection2Name the name of the second collection * @ throws IllegalArgumentException if collection1 or collection2 are null or if the collections don ' t agree on the number of elements */ public static void sameSize ( final Collection < ? > collection1 , final Collection < ? > collection2 , final String collection1Name , final String collection2Name ) { } }
notNull ( collection1 , collection1Name ) ; notNull ( collection2 , collection2Name ) ; if ( collection1 . size ( ) != collection2 . size ( ) ) { throw new IllegalArgumentException ( "expecting " + maskNullArgument ( collection1Name ) + " to have the same size as " + maskNullArgument ( collection2Name ) ) ; }
public class SipNamingContextListener { /** * Removes the sip subcontext from JNDI * @ param envCtx the envContext from which the sip subcontext should be removed */ public static void removeSipSubcontext ( Context envCtx ) { } }
try { envCtx . destroySubcontext ( SIP_SUBCONTEXT ) ; } catch ( NamingException e ) { logger . error ( sm . getString ( "naming.unbindFailed" , e ) ) ; }
public class Predicates { /** * Returns a predicate that that tests if an iterable contains an argument . * @ param iterable the iterable , may not be null * @ param < T > the type of the argument to the predicate * @ return a predicate that that tests if an iterable contains an argument */ public static < T > Predicate < T > contains ( final Iterable < T > iterable ) { } }
return new Predicate < T > ( ) { @ Override public boolean test ( final T testValue ) { return Iterables . contains ( iterable , testValue ) ; } } ;
public class Tree { /** * Adds a TSUID to the not - matched local list when strict _ matching is enabled . * Must be synced with storage . * @ param tsuid TSUID to add to the set * @ throws IllegalArgumentException if the tsuid was invalid */ public void addNotMatched ( final String tsuid , final String message ) { } }
if ( tsuid == null || tsuid . isEmpty ( ) ) { throw new IllegalArgumentException ( "Empty or null non matches not allowed" ) ; } if ( not_matched == null ) { not_matched = new HashMap < String , String > ( ) ; } if ( ! not_matched . containsKey ( tsuid ) ) { not_matched . put ( tsuid , message ) ; changed . put ( "not_matched" , true ) ; }
public class AfplibPackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EEnum getMediaEjectControlEjCtrl ( ) { } }
if ( mediaEjectControlEjCtrlEEnum == null ) { mediaEjectControlEjCtrlEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( AfplibPackage . eNS_URI ) . getEClassifiers ( ) . get ( 93 ) ; } return mediaEjectControlEjCtrlEEnum ;
public class JvmFloatAnnotationValueImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EList < Float > getValues ( ) { } }
if ( values == null ) { values = new EDataTypeEList < Float > ( Float . class , this , TypesPackage . JVM_FLOAT_ANNOTATION_VALUE__VALUES ) ; } return values ;
public class Value { /** * < code > . google . protobuf . Timestamp timestamp _ value = 5 ; < / code > */ public com . google . protobuf . Timestamp getTimestampValue ( ) { } }
if ( typeCase_ == 5 ) { return ( com . google . protobuf . Timestamp ) type_ ; } return com . google . protobuf . Timestamp . getDefaultInstance ( ) ;
public class ArchiveFactory { /** * Creates a new archive of the specified type as imported from the specified { @ link File } . The file is expected to * be encoded as ZIP ( ie . JAR / WAR / EAR ) . The name of the archive will be set to { @ link File # getName ( ) } . The archive * will be be backed by the { @ link Configuration } specific to this { @ link ArchiveFactory } . * @ param type * The type of the archive e . g . { @ link org . jboss . shrinkwrap . api . spec . WebArchive } * @ param archiveFile * the archiveFile to use * @ return An { @ link Assignable } view * @ throws IllegalArgumentException * If either argument is not supplied , if the specified { @ link File } does not exist , or is not a valid * ZIP file * @ throws org . jboss . shrinkwrap . api . importer . ArchiveImportException * If an error occurred during the import process */ public < T extends Assignable > T createFromZipFile ( final Class < T > type , final File archiveFile ) throws IllegalArgumentException , ArchiveImportException { } }
// Precondition checks if ( type == null ) { throw new IllegalArgumentException ( "Type must be specified" ) ; } if ( archiveFile == null ) { throw new IllegalArgumentException ( "File must be specified" ) ; } if ( ! archiveFile . exists ( ) ) { throw new IllegalArgumentException ( "File for import does not exist: " + archiveFile . getAbsolutePath ( ) ) ; } if ( archiveFile . isDirectory ( ) ) { throw new IllegalArgumentException ( "File for import must not be a directory: " + archiveFile . getAbsolutePath ( ) ) ; } try { // Import return ShrinkWrap . create ( type , archiveFile . getName ( ) ) . as ( ZipImporter . class ) . importFrom ( new ZipFile ( archiveFile ) ) . as ( type ) ; } catch ( final ZipException ze ) { throw new IllegalArgumentException ( "Does not appear to be a valid ZIP file: " + archiveFile . getAbsolutePath ( ) ) ; } catch ( final IOException ioe ) { throw new RuntimeException ( "I/O Error in importing new archive from ZIP: " + archiveFile . getAbsolutePath ( ) , ioe ) ; }
public class JSONTool { /** * Serialize a Java object to the JSON format . * Examples : * < ul > * < li > numbers and boolean values : 23 , 13.5 , true , false < / li > * < li > strings : " one \ " two ' three " ( quotes included ) < / li > * < li > arrays and collections : [ 1 , 2 , 3 ] < / li > * < li > maps : { " number " : 23 , " boolean " : false , " string " : " value " } < / li > * < li > beans : { " enabled " : true , " name " : " XWiki " } for a bean that has # isEnabled ( ) and # getName ( ) getters < / li > * < / ul > * @ param object the object to be serialized to the JSON format * @ return the JSON - verified string representation of the given object */ public String serialize ( Object object ) { } }
try { ObjectMapper mapper = new ObjectMapper ( ) ; SimpleModule m = new SimpleModule ( "org.json.* serializer" , new Version ( 1 , 0 , 0 , "" , "org.json" , "json" ) ) ; m . addSerializer ( JSONObject . class , new JSONObjectSerializer ( ) ) ; m . addSerializer ( JSONArray . class , new JSONArraySerializer ( ) ) ; mapper . registerModule ( m ) ; return mapper . writeValueAsString ( object ) ; } catch ( JsonProcessingException e ) { LOGGER . error ( "Failed to serialize object to JSON" , e ) ; } return null ;
public class FindIdentifiers { /** * Finds the set of all bare variable identifiers in scope at the current location . Identifiers * are ordered by ascending distance / scope count from the current location to match shadowing * rules . That is , if two variables with the same simple names appear in the set , the one that * appears first in iteration order is the one you get if you use the bare name in the source * code . * < p > We do not report variables that would require a qualified access . We also do not handle * wildcard imports . */ public static LinkedHashSet < VarSymbol > findAllIdents ( VisitorState state ) { } }
ImmutableSet . Builder < VarSymbol > result = new ImmutableSet . Builder < > ( ) ; Tree prev = state . getPath ( ) . getLeaf ( ) ; for ( Tree curr : state . getPath ( ) . getParentPath ( ) ) { switch ( curr . getKind ( ) ) { case BLOCK : for ( StatementTree stmt : ( ( BlockTree ) curr ) . getStatements ( ) ) { if ( stmt . equals ( prev ) ) { break ; } addIfVariable ( stmt , result ) ; } break ; case METHOD : for ( VariableTree param : ( ( MethodTree ) curr ) . getParameters ( ) ) { result . add ( ASTHelpers . getSymbol ( param ) ) ; } break ; case CATCH : result . add ( ASTHelpers . getSymbol ( ( ( CatchTree ) curr ) . getParameter ( ) ) ) ; break ; case CLASS : case INTERFACE : case ENUM : case ANNOTATION_TYPE : // Collect fields declared in this class . If we are in a field initializer , only // include fields declared before this one . JLS 8.3.3 allows forward references if the // field is referred to by qualified name , but we don ' t support that . for ( Tree member : ( ( ClassTree ) curr ) . getMembers ( ) ) { if ( member . equals ( prev ) ) { break ; } addIfVariable ( member , result ) ; } // Collect inherited fields . Type classType = ASTHelpers . getType ( curr ) ; List < Type > classTypeClosure = state . getTypes ( ) . closure ( classType ) ; List < Type > superTypes = classTypeClosure . size ( ) <= 1 ? Collections . emptyList ( ) : classTypeClosure . subList ( 1 , classTypeClosure . size ( ) ) ; for ( Type type : superTypes ) { Scope scope = type . tsym . members ( ) ; ImmutableList . Builder < VarSymbol > varsList = ImmutableList . builder ( ) ; for ( Symbol var : scope . getSymbols ( VarSymbol . class :: isInstance ) ) { varsList . add ( ( VarSymbol ) var ) ; } result . addAll ( varsList . build ( ) . reverse ( ) ) ; } break ; case FOR_LOOP : addAllIfVariable ( ( ( ForLoopTree ) curr ) . getInitializer ( ) , result ) ; break ; case ENHANCED_FOR_LOOP : result . add ( ASTHelpers . getSymbol ( ( ( EnhancedForLoopTree ) curr ) . getVariable ( ) ) ) ; break ; case TRY : TryTree tryTree = ( TryTree ) curr ; boolean inResources = false ; for ( Tree resource : tryTree . getResources ( ) ) { if ( resource . equals ( prev ) ) { inResources = true ; break ; } } if ( inResources ) { // Case 1 : we ' re in one of the resource declarations for ( Tree resource : tryTree . getResources ( ) ) { if ( resource . equals ( prev ) ) { break ; } addIfVariable ( resource , result ) ; } } else if ( tryTree . getBlock ( ) . equals ( prev ) ) { // Case 2 : We ' re in the block ( not a catch or finally ) addAllIfVariable ( tryTree . getResources ( ) , result ) ; } break ; case COMPILATION_UNIT : for ( ImportTree importTree : ( ( CompilationUnitTree ) curr ) . getImports ( ) ) { if ( importTree . isStatic ( ) && importTree . getQualifiedIdentifier ( ) . getKind ( ) == Kind . MEMBER_SELECT ) { MemberSelectTree memberSelectTree = ( MemberSelectTree ) importTree . getQualifiedIdentifier ( ) ; Scope scope = state . getTypes ( ) . membersClosure ( ASTHelpers . getType ( memberSelectTree . getExpression ( ) ) , /* skipInterface = */ false ) ; for ( Symbol var : scope . getSymbols ( sym -> sym instanceof VarSymbol && sym . getSimpleName ( ) . equals ( memberSelectTree . getIdentifier ( ) ) ) ) { result . add ( ( VarSymbol ) var ) ; } } } break ; default : // other node types don ' t introduce variables break ; } prev = curr ; } // TODO ( eaftan ) : switch out collector for ImmutableSet . toImmutableSet ( ) return result . build ( ) . stream ( ) . filter ( var -> isVisible ( var , state . getPath ( ) ) ) . collect ( Collectors . toCollection ( LinkedHashSet :: new ) ) ;