signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ConvertDMatrixStruct { /** * Converts { @ link DMatrixRMaj } into { @ link DMatrix3x3} * @ param input Input matrix . * @ param output Output matrix . If null a new matrix will be declared . * @ return Converted matrix . */ public static DMatrix3x3 convert ( DMatrixRMaj input , DMatrix3x3 output ) { } }
if ( output == null ) output = new DMatrix3x3 ( ) ; if ( input . getNumRows ( ) != output . getNumRows ( ) ) throw new IllegalArgumentException ( "Number of rows do not match" ) ; if ( input . getNumCols ( ) != output . getNumCols ( ) ) throw new IllegalArgumentException ( "Number of columns do not match" ) ; output . a11 = input . data [ 0 ] ; output . a12 = input . data [ 1 ] ; output . a13 = input . data [ 2 ] ; output . a21 = input . data [ 3 ] ; output . a22 = input . data [ 4 ] ; output . a23 = input . data [ 5 ] ; output . a31 = input . data [ 6 ] ; output . a32 = input . data [ 7 ] ; output . a33 = input . data [ 8 ] ; return output ;
public class ServerTransportAcceptListener { /** * This method is used to clean up any resources that * @ param connectionReference */ public void removeAllConversations ( Object connectionReference ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "removeAllConversations" , connectionReference ) ; final ArrayList list ; synchronized ( activeConversations ) { list = ( ArrayList ) activeConversations . remove ( connectionReference ) ; } // Remove the connection reference from the list if ( list != null ) { try { for ( int x = 0 ; x < list . size ( ) ; x ++ ) { Conversation conv = ( Conversation ) list . get ( x ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Found a Conversation in the table: " , conv ) ; // Now call the server transport receive listener to clean up the resources serverTransportReceiveListener . cleanupConnection ( conv ) ; } } catch ( Throwable t ) { FFDCFilter . processException ( t , CLASS_NAME + ".removeAllConversations" , CommsConstants . SERVERTRANSPORTACCEPTLISTENER_REMOVEALL_01 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Caught an exception cleaning up a connection" , t ) ; } // Now clear the list list . clear ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "removeAllConversations" ) ;
public class ClassUtil { /** * extracts the package from a className , return null , if there is none . * @ param className * @ return */ public static String extractPackage ( String className ) { } }
if ( className == null ) return null ; int index = className . lastIndexOf ( '.' ) ; if ( index != - 1 ) return className . substring ( 0 , index ) ; return null ;
public class CPFriendlyURLEntryPersistenceImpl { /** * Returns all the cp friendly url entries . * @ return the cp friendly url entries */ @ Override public List < CPFriendlyURLEntry > findAll ( ) { } }
return findAll ( QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ;
public class MatchConditionOnElements { /** * Removes the pseudo class from the given element name . Element names are case - insensitive . * @ param name the element name * @ param pseudoClass the pseudo class to be removed */ public void removeMatch ( String name , PseudoClassType pseudoClass ) { } }
if ( names != null ) { Set < PseudoClassType > classes = names . get ( name ) ; if ( classes != null ) classes . remove ( pseudoClass ) ; }
public class MessageBirdClient { /** * List voice messages * @ param offset offset for result list * @ param limit limit for result list * @ return VoiceMessageList * @ throws UnauthorizedException if client is unauthorized * @ throws GeneralException general exception */ public VoiceMessageList listVoiceMessages ( final Integer offset , final Integer limit ) throws UnauthorizedException , GeneralException { } }
if ( offset != null && offset < 0 ) { throw new IllegalArgumentException ( "Offset must be > 0" ) ; } if ( limit != null && limit < 0 ) { throw new IllegalArgumentException ( "Limit must be > 0" ) ; } return messageBirdService . requestList ( VOICEMESSAGESPATH , offset , limit , VoiceMessageList . class ) ;
public class RegionInstanceGroupManagerClient { /** * Deletes the specified managed instance group and all of the instances in that group . * < p > Sample code : * < pre > < code > * try ( RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient . create ( ) ) { * ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ INSTANCE _ GROUP _ MANAGER ] " ) ; * Operation response = regionInstanceGroupManagerClient . deleteRegionInstanceGroupManager ( instanceGroupManager . toString ( ) ) ; * < / code > < / pre > * @ param instanceGroupManager Name of the managed instance group to delete . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation deleteRegionInstanceGroupManager ( String instanceGroupManager ) { } }
DeleteRegionInstanceGroupManagerHttpRequest request = DeleteRegionInstanceGroupManagerHttpRequest . newBuilder ( ) . setInstanceGroupManager ( instanceGroupManager ) . build ( ) ; return deleteRegionInstanceGroupManager ( request ) ;
public class ProtoParser { /** * com / dyuproject / protostuff / parser / ProtoParser . g : 581:1 : rpc _ block [ Proto proto , Service service ] : RPC n = ID LEFTPAREN ( ap = FULL _ ID | a = ( VOID | ID ) ) RIGHTPAREN RETURNS LEFTPAREN ( rp = FULL _ ID | r = ( VOID | ID ) ) RIGHTPAREN ( rpc _ body _ block [ proto , rm ] ) ? SEMICOLON ; */ public final ProtoParser . rpc_block_return rpc_block ( Proto proto , Service service ) throws RecognitionException { } }
ProtoParser . rpc_block_return retval = new ProtoParser . rpc_block_return ( ) ; retval . start = input . LT ( 1 ) ; Object root_0 = null ; Token n = null ; Token ap = null ; Token a = null ; Token rp = null ; Token r = null ; Token RPC146 = null ; Token LEFTPAREN147 = null ; Token RIGHTPAREN148 = null ; Token RETURNS149 = null ; Token LEFTPAREN150 = null ; Token RIGHTPAREN151 = null ; Token SEMICOLON153 = null ; ProtoParser . rpc_body_block_return rpc_body_block152 = null ; Object n_tree = null ; Object ap_tree = null ; Object a_tree = null ; Object rp_tree = null ; Object r_tree = null ; Object RPC146_tree = null ; Object LEFTPAREN147_tree = null ; Object RIGHTPAREN148_tree = null ; Object RETURNS149_tree = null ; Object LEFTPAREN150_tree = null ; Object RIGHTPAREN151_tree = null ; Object SEMICOLON153_tree = null ; String argName = null , argPackage = null , retName = null , retPackage = null ; Service . RpcMethod rm = null ; try { // com / dyuproject / protostuff / parser / ProtoParser . g : 586:5 : ( RPC n = ID LEFTPAREN ( ap = FULL _ ID | a = ( VOID | ID ) ) RIGHTPAREN RETURNS LEFTPAREN ( rp = FULL _ ID | r = ( VOID | ID ) ) RIGHTPAREN ( rpc _ body _ block [ proto , rm ] ) ? SEMICOLON ) // com / dyuproject / protostuff / parser / ProtoParser . g : 586:9 : RPC n = ID LEFTPAREN ( ap = FULL _ ID | a = ( VOID | ID ) ) RIGHTPAREN RETURNS LEFTPAREN ( rp = FULL _ ID | r = ( VOID | ID ) ) RIGHTPAREN ( rpc _ body _ block [ proto , rm ] ) ? SEMICOLON { root_0 = ( Object ) adaptor . nil ( ) ; RPC146 = ( Token ) match ( input , RPC , FOLLOW_RPC_in_rpc_block2378 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { RPC146_tree = ( Object ) adaptor . create ( RPC146 ) ; adaptor . addChild ( root_0 , RPC146_tree ) ; } n = ( Token ) match ( input , ID , FOLLOW_ID_in_rpc_block2382 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { n_tree = ( Object ) adaptor . create ( n ) ; adaptor . addChild ( root_0 , n_tree ) ; } LEFTPAREN147 = ( Token ) match ( input , LEFTPAREN , FOLLOW_LEFTPAREN_in_rpc_block2384 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { LEFTPAREN147_tree = ( Object ) adaptor . create ( LEFTPAREN147 ) ; adaptor . addChild ( root_0 , LEFTPAREN147_tree ) ; } // com / dyuproject / protostuff / parser / ProtoParser . g : 586:28 : ( ap = FULL _ ID | a = ( VOID | ID ) ) int alt30 = 2 ; switch ( input . LA ( 1 ) ) { case FULL_ID : { alt30 = 1 ; } break ; case VOID : case ID : { alt30 = 2 ; } break ; default : if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 30 , 0 , input ) ; throw nvae ; } switch ( alt30 ) { case 1 : // com / dyuproject / protostuff / parser / ProtoParser . g : 586:29 : ap = FULL _ ID { ap = ( Token ) match ( input , FULL_ID , FOLLOW_FULL_ID_in_rpc_block2389 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { ap_tree = ( Object ) adaptor . create ( ap ) ; adaptor . addChild ( root_0 , ap_tree ) ; } if ( state . backtracking == 0 ) { String argFull = ( ap != null ? ap . getText ( ) : null ) ; int lastDot = argFull . lastIndexOf ( '.' ) ; argPackage = argFull . substring ( 0 , lastDot ) ; argName = argFull . substring ( lastDot + 1 ) ; } } break ; case 2 : // com / dyuproject / protostuff / parser / ProtoParser . g : 591:13 : a = ( VOID | ID ) { a = ( Token ) input . LT ( 1 ) ; if ( ( input . LA ( 1 ) >= VOID && input . LA ( 1 ) <= ID ) ) { input . consume ( ) ; if ( state . backtracking == 0 ) adaptor . addChild ( root_0 , ( Object ) adaptor . create ( a ) ) ; state . errorRecovery = false ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; throw mse ; } if ( state . backtracking == 0 ) { argName = ( a != null ? a . getText ( ) : null ) ; } } break ; } RIGHTPAREN148 = ( Token ) match ( input , RIGHTPAREN , FOLLOW_RIGHTPAREN_in_rpc_block2406 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { RIGHTPAREN148_tree = ( Object ) adaptor . create ( RIGHTPAREN148 ) ; adaptor . addChild ( root_0 , RIGHTPAREN148_tree ) ; } RETURNS149 = ( Token ) match ( input , RETURNS , FOLLOW_RETURNS_in_rpc_block2417 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { RETURNS149_tree = ( Object ) adaptor . create ( RETURNS149 ) ; adaptor . addChild ( root_0 , RETURNS149_tree ) ; } LEFTPAREN150 = ( Token ) match ( input , LEFTPAREN , FOLLOW_LEFTPAREN_in_rpc_block2419 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { LEFTPAREN150_tree = ( Object ) adaptor . create ( LEFTPAREN150 ) ; adaptor . addChild ( root_0 , LEFTPAREN150_tree ) ; } // com / dyuproject / protostuff / parser / ProtoParser . g : 592:27 : ( rp = FULL _ ID | r = ( VOID | ID ) ) int alt31 = 2 ; switch ( input . LA ( 1 ) ) { case FULL_ID : { alt31 = 1 ; } break ; case VOID : case ID : { alt31 = 2 ; } break ; default : if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 31 , 0 , input ) ; throw nvae ; } switch ( alt31 ) { case 1 : // com / dyuproject / protostuff / parser / ProtoParser . g : 592:28 : rp = FULL _ ID { rp = ( Token ) match ( input , FULL_ID , FOLLOW_FULL_ID_in_rpc_block2424 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { rp_tree = ( Object ) adaptor . create ( rp ) ; adaptor . addChild ( root_0 , rp_tree ) ; } if ( state . backtracking == 0 ) { String retFull = ( rp != null ? rp . getText ( ) : null ) ; int lastDot = retFull . lastIndexOf ( '.' ) ; retPackage = retFull . substring ( 0 , lastDot ) ; retName = retFull . substring ( lastDot + 1 ) ; } } break ; case 2 : // com / dyuproject / protostuff / parser / ProtoParser . g : 597:13 : r = ( VOID | ID ) { r = ( Token ) input . LT ( 1 ) ; if ( ( input . LA ( 1 ) >= VOID && input . LA ( 1 ) <= ID ) ) { input . consume ( ) ; if ( state . backtracking == 0 ) adaptor . addChild ( root_0 , ( Object ) adaptor . create ( r ) ) ; state . errorRecovery = false ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; throw mse ; } if ( state . backtracking == 0 ) { retName = ( r != null ? r . getText ( ) : null ) ; } } break ; } RIGHTPAREN151 = ( Token ) match ( input , RIGHTPAREN , FOLLOW_RIGHTPAREN_in_rpc_block2441 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { RIGHTPAREN151_tree = ( Object ) adaptor . create ( RIGHTPAREN151 ) ; adaptor . addChild ( root_0 , RIGHTPAREN151_tree ) ; } if ( state . backtracking == 0 ) { rm = service . addRpcMethod ( ( n != null ? n . getText ( ) : null ) , argName , argPackage , retName , retPackage ) ; proto . addAnnotationsTo ( rm ) ; } // com / dyuproject / protostuff / parser / ProtoParser . g : 600:11 : ( rpc _ body _ block [ proto , rm ] ) ? int alt32 = 2 ; switch ( input . LA ( 1 ) ) { case LEFTCURLY : { alt32 = 1 ; } break ; } switch ( alt32 ) { case 1 : // com / dyuproject / protostuff / parser / ProtoParser . g : 600:11 : rpc _ body _ block [ proto , rm ] { pushFollow ( FOLLOW_rpc_body_block_in_rpc_block2445 ) ; rpc_body_block152 = rpc_body_block ( proto , rm ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) adaptor . addChild ( root_0 , rpc_body_block152 . getTree ( ) ) ; } break ; } SEMICOLON153 = ( Token ) match ( input , SEMICOLON , FOLLOW_SEMICOLON_in_rpc_block2449 ) ; if ( state . failed ) return retval ; } retval . stop = input . LT ( - 1 ) ; if ( state . backtracking == 0 ) { retval . tree = ( Object ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( Object ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { } return retval ;
public class DeleteMatchmakingConfigurationRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteMatchmakingConfigurationRequest deleteMatchmakingConfigurationRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteMatchmakingConfigurationRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteMatchmakingConfigurationRequest . getName ( ) , NAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Config { /** * newConfigFromText create an empty configuration representation from text . * @ param text the model text . * @ return the constructor of Config . */ public static Config newConfigFromText ( String text ) { } }
Config c = new Config ( ) ; c . parseBuffer ( new BufferedReader ( new StringReader ( text ) ) ) ; return c ;
public class DexProxyBuilder { /** * Generates dynamic { @ link android . view . View } proxy class . */ @ SuppressWarnings ( "unchecked" ) static < T , G extends T > Class < G > generateProxyClass ( Context context , Class < T > baseClass ) throws IOException { } }
// Cache missed ; generate the proxy class . final DexMaker dexMaker = new DexMaker ( ) ; final String proxyClassName = getClassNameForProxyOf ( baseClass ) ; final TypeId < G > generatedType = TypeId . get ( "L" + proxyClassName + ";" ) ; final TypeId < T > baseType = TypeId . get ( baseClass ) ; generateConstructorAndFields ( dexMaker , generatedType , baseType ) ; generateOnMeasureMethod ( dexMaker , generatedType , baseType ) ; generateOnLayoutMethod ( dexMaker , generatedType , baseType ) ; generateDrawMethods ( dexMaker , generatedType , baseType ) ; generateRequestLayoutMethod ( dexMaker , generatedType , baseType ) ; generateForceLayoutMethod ( dexMaker , generatedType , baseType ) ; generateSetMeasuredDimension ( dexMaker , generatedType , baseType ) ; generateSetInterceptor ( dexMaker , generatedType , baseType ) ; dexMaker . declare ( generatedType , proxyClassName + ".generated" , PUBLIC , baseType , INTERCEPTABLE_VIEW_TYPE ) ; final ClassLoader classLoader = dexMaker . generateAndLoad ( context . getClassLoader ( ) , context . getDir ( DEX_CACHE_DIRECTORY , Context . MODE_PRIVATE ) ) ; try { return ( Class < G > ) classLoader . loadClass ( proxyClassName ) ; } catch ( IllegalAccessError e ) { // Thrown when the base class is not accessible . throw new UnsupportedOperationException ( "cannot proxy inaccessible class " + baseClass , e ) ; } catch ( ClassNotFoundException e ) { // Should not be thrown , we ' re sure to have generated this class . throw new AssertionError ( e ) ; }
public class FileSystemGroupStore { /** * Answers if < code > file < / code > contains < code > member < / code > . * @ param file * @ param member * @ return boolean */ private boolean fileContains ( File file , IGroupMember member ) throws GroupsException { } }
Collection ids = null ; try { ids = member . isGroup ( ) ? getGroupIdsFromFile ( file ) : getEntityIdsFromFile ( file ) ; } catch ( Exception ex ) { throw new GroupsException ( "Error retrieving ids from file" , ex ) ; } return ids . contains ( member . getKey ( ) ) ;
public class ReflectionUtils { /** * Searches the method methodToFind in given class cls . If the method is found returns it , else return null . * @ param methodToFind is the method to search * @ param cls is the class or interface where to search * @ return method if it is found */ public static Method findMethod ( Method methodToFind , Class < ? > cls ) { } }
if ( cls == null ) { return null ; } String methodToSearch = methodToFind . getName ( ) ; Class < ? > [ ] soughtForParameterType = methodToFind . getParameterTypes ( ) ; Type [ ] soughtForGenericParameterType = methodToFind . getGenericParameterTypes ( ) ; for ( Method method : cls . getMethods ( ) ) { if ( method . getName ( ) . equals ( methodToSearch ) && method . getReturnType ( ) . isAssignableFrom ( methodToFind . getReturnType ( ) ) ) { Class < ? > [ ] srcParameterTypes = method . getParameterTypes ( ) ; Type [ ] srcGenericParameterTypes = method . getGenericParameterTypes ( ) ; if ( soughtForParameterType . length == srcParameterTypes . length && soughtForGenericParameterType . length == srcGenericParameterTypes . length ) { if ( hasIdenticalParameters ( srcParameterTypes , soughtForParameterType , srcGenericParameterTypes , soughtForGenericParameterType ) ) { return method ; } } } } return null ;
public class JSONUtil { /** * 对所有双引号做转义处理 ( 使用双反斜杠做转义 ) < br > * 为了能在HTML中较好的显示 , 会将 & lt ; / 转义为 & lt ; \ / < br > * JSON字符串中不能包含控制字符和未经转义的引号和反斜杠 * @ param string 字符串 * @ param isWrap 是否使用双引号包装字符串 * @ return 适合在JSON中显示的字符串 * @ since 3.3.1 */ public static String quote ( String string , boolean isWrap ) { } }
StringWriter sw = new StringWriter ( ) ; try { return quote ( string , sw , isWrap ) . toString ( ) ; } catch ( IOException ignored ) { // will never happen - we are writing to a string writer return StrUtil . EMPTY ; }
public class GridSearch { /** * Start a new grid search job . This is the method that gets called by GridSearchHandler . do _ train ( ) . * This method launches a " classical " grid search traversing cartesian grid of parameters * point - by - point , < b > or < / b > a random hyperparameter search , depending on the value of the < i > strategy < / i > * parameter . * @ param destKey A key to store result of grid search under . * @ param params Default parameters for model builder . This object is used to create * a specific model parameters for a combination of hyper parameters . * @ param hyperParams A set of arrays of hyper parameter values , used to specify a simple * fully - filled - in grid search . * @ param paramsBuilderFactory defines a strategy for creating a new model parameters based on * common parameters and list of hyper - parameters * @ return GridSearch Job , with models run with these parameters , built as needed - expected to be * an expensive operation . If the models in question are " in progress " , a 2nd build will NOT be * kicked off . This is a non - blocking call . */ public static < MP extends Model . Parameters > Job < Grid > startGridSearch ( final Key < Grid > destKey , final MP params , final Map < String , Object [ ] > hyperParams , final ModelParametersBuilderFactory < MP > paramsBuilderFactory , final HyperSpaceSearchCriteria searchCriteria ) { } }
return startGridSearch ( destKey , BaseWalker . WalkerFactory . create ( params , hyperParams , paramsBuilderFactory , searchCriteria ) ) ;
public class OptionalInt { /** * If a value is present , performs the given action with the value , * otherwise performs the empty - based action . * @ param consumer the consumer function to be executed , if a value is present * @ param emptyAction the empty - based action to be performed , if no value is present * @ throws NullPointerException if a value is present and the given consumer function is null , * or no value is present and the given empty - based action is null . * @ since 1.1.4 */ public void ifPresentOrElse ( @ NotNull IntConsumer consumer , @ NotNull Runnable emptyAction ) { } }
if ( isPresent ) { consumer . accept ( value ) ; } else { emptyAction . run ( ) ; }
public class ChangedByHandler { /** * Set this cloned listener to the same state at this listener . * @ param field The field this new listener will be added to . * @ param The new listener to sync to this . * @ param Has the init method been called ? * @ return True if I called init . */ public boolean syncClonedListener ( BaseField field , FieldListener listener , boolean bInitCalled ) { } }
bInitCalled = super . syncClonedListener ( field , listener , bInitCalled ) ; ( ( ChangedByHandler ) listener ) . setMainFilesFieldSeq ( m_iMainFilesFieldSeq ) ; return bInitCalled ;
public class SampleSetEQOracle { /** * Adds several query words to the sample set . The expected output is determined by means of the specified * membership oracle . * @ param oracle * the membership oracle used to determine expected outputs * @ param words * the words to be added to the sample set * @ return { @ code this } , to enable chained { @ code add } or { @ code addAll } calls */ @ SafeVarargs public final SampleSetEQOracle < I , D > addAll ( MembershipOracle < I , D > oracle , Word < I > ... words ) { } }
return addAll ( oracle , Arrays . asList ( words ) ) ;
public class AWSIotClient { /** * Lists the Device Defender security profile violations discovered during the given time period . You can use * filters to limit the results to those alerts issued for a particular security profile , behavior or thing * ( device ) . * @ param listViolationEventsRequest * @ return Result of the ListViolationEvents operation returned by the service . * @ throws InvalidRequestException * The request is not valid . * @ throws ThrottlingException * The rate exceeds the limit . * @ throws InternalFailureException * An unexpected error has occurred . * @ sample AWSIot . ListViolationEvents */ @ Override public ListViolationEventsResult listViolationEvents ( ListViolationEventsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeListViolationEvents ( request ) ;
public class MaterialAPI { /** * 新增其他类型永久素材 * @ param access _ token access _ token * @ param mediaType mediaType * @ param inputStream 多媒体文件有格式和大小限制 , 如下 : * 图片 ( image ) : 2M , 支持bmp / png / jpeg / jpg / gif格式 * 语音 ( voice ) : 5M , 播放长度不超过60s , 支持AMR \ MP3格式 * 视频 ( video ) : 10MB , 支持MP4格式 * 缩略图 ( thumb ) : 64KB , 支持JPG格式 * @ param description 视频文件类型额外字段 , 其它类型不用添加 * @ return Media */ public static Media add_material ( String access_token , MediaType mediaType , InputStream inputStream , Description description ) { } }
HttpPost httpPost = new HttpPost ( BASE_URI + "/cgi-bin/material/add_material" ) ; byte [ ] data = null ; try { data = StreamUtils . copyToByteArray ( inputStream ) ; } catch ( IOException e ) { logger . error ( "" , e ) ; } MultipartEntityBuilder multipartEntityBuilder = MultipartEntityBuilder . create ( ) . addBinaryBody ( "media" , data , ContentType . DEFAULT_BINARY , "temp." + mediaType . fileSuffix ( ) ) ; if ( description != null ) { multipartEntityBuilder . addTextBody ( "description" , JsonUtil . toJSONString ( description ) , ContentType . create ( "text/plain" , Charset . forName ( "utf-8" ) ) ) ; } HttpEntity reqEntity = multipartEntityBuilder . addTextBody ( PARAM_ACCESS_TOKEN , API . accessToken ( access_token ) ) . addTextBody ( "type" , mediaType . uploadType ( ) ) . build ( ) ; httpPost . setEntity ( reqEntity ) ; return LocalHttpClient . executeJsonResult ( httpPost , Media . class ) ;
public class RebalanceUtils { /** * Prints a stores xml to a file . * @ param outputDirName * @ param fileName * @ param list of storeDefs */ public static void dumpStoreDefsToFile ( String outputDirName , String fileName , List < StoreDefinition > storeDefs ) { } }
if ( outputDirName != null ) { File outputDir = new File ( outputDirName ) ; if ( ! outputDir . exists ( ) ) { Utils . mkdirs ( outputDir ) ; } try { FileUtils . writeStringToFile ( new File ( outputDirName , fileName ) , new StoreDefinitionsMapper ( ) . writeStoreList ( storeDefs ) ) ; } catch ( IOException e ) { logger . error ( "IOException during dumpStoreDefsToFile: " + e ) ; } }
public class MyMultiSegmentationEvaluator { /** * it ' s bad , but mallet logging is worse */ @ SuppressWarnings ( "rawtypes" ) public void evaluateInstanceList ( TransducerTrainer tt , InstanceList data , String description ) { } }
Transducer model = tt . getTransducer ( ) ; int numCorrectTokens , totalTokens ; int [ ] numTrueSegments , numPredictedSegments , numCorrectSegments ; int allIndex = segmentStartTags . length ; numTrueSegments = new int [ allIndex + 1 ] ; numPredictedSegments = new int [ allIndex + 1 ] ; numCorrectSegments = new int [ allIndex + 1 ] ; totalTokens = numCorrectTokens = 0 ; for ( int n = 0 ; n < numTrueSegments . length ; n ++ ) numTrueSegments [ n ] = numPredictedSegments [ n ] = numCorrectSegments [ n ] = 0 ; for ( int i = 0 ; i < data . size ( ) ; i ++ ) { Instance instance = data . get ( i ) ; Sequence input = ( Sequence ) instance . getData ( ) ; // String tokens = null ; // if ( instance . getSource ( ) ! = null ) // tokens = ( String ) instance . getSource ( ) . toString ( ) ; Sequence trueOutput = ( Sequence ) instance . getTarget ( ) ; assert ( input . size ( ) == trueOutput . size ( ) ) ; Sequence predOutput = model . transduce ( input ) ; assert ( predOutput . size ( ) == trueOutput . size ( ) ) ; int trueStart , predStart ; // -1 for non - start , otherwise index into // segmentStartTag boolean hasIncorrect = false ; StringBuilder sentencePrint = new StringBuilder ( ) ; for ( int j = 0 ; j < trueOutput . size ( ) ; j ++ ) { totalTokens ++ ; if ( trueOutput . get ( j ) . equals ( predOutput . get ( j ) ) ) { numCorrectTokens ++ ; if ( printMissclassified ) sentencePrint . append ( getText ( input , j ) + " " ) ; } else if ( printMissclassified ) { // not predicted correctly hasIncorrect = true ; sentencePrint . append ( "{{" + getText ( input , j ) + "}} " ) ; } trueStart = predStart = - 1 ; // Count true segment starts for ( int n = 0 ; n < segmentStartTags . length ; n ++ ) { if ( segmentStartTags [ n ] . equals ( trueOutput . get ( j ) ) ) { numTrueSegments [ n ] ++ ; numTrueSegments [ allIndex ] ++ ; trueStart = n ; break ; } } // Count predicted segment starts for ( int n = 0 ; n < segmentStartTags . length ; n ++ ) { if ( segmentStartTags [ n ] . equals ( predOutput . get ( j ) ) ) { numPredictedSegments [ n ] ++ ; numPredictedSegments [ allIndex ] ++ ; predStart = n ; } } if ( trueStart != - 1 && trueStart == predStart ) { // Truth and Prediction both agree that the same segment // tag - type is starting now int m ; boolean trueContinue = false ; boolean predContinue = false ; for ( m = j + 1 ; m < trueOutput . size ( ) ; m ++ ) { trueContinue = segmentContinueTags [ predStart ] . equals ( trueOutput . get ( m ) ) ; predContinue = segmentContinueTags [ predStart ] . equals ( predOutput . get ( m ) ) ; if ( ! trueContinue || ! predContinue ) { if ( trueContinue == predContinue ) { // They agree about a segment is ending somehow numCorrectSegments [ predStart ] ++ ; numCorrectSegments [ allIndex ] ++ ; } break ; } } // for the case of the end of the sequence if ( m == trueOutput . size ( ) ) { if ( trueContinue == predContinue ) { numCorrectSegments [ predStart ] ++ ; numCorrectSegments [ allIndex ] ++ ; } } } } if ( hasIncorrect && printMissclassified ) System . out . println ( sentencePrint . toString ( ) ) ; } tokenAccuracy = ( ( double ) numCorrectTokens ) / totalTokens ; for ( int n = 0 ; n < numCorrectSegments . length ; n ++ ) { if ( ! ( n < allIndex ) ) { // only " OVERALL " precision = numPredictedSegments [ n ] == 0 ? 1 : ( ( double ) numCorrectSegments [ n ] ) / numPredictedSegments [ n ] ; recall = numTrueSegments [ n ] == 0 ? 1 : ( ( double ) numCorrectSegments [ n ] ) / numTrueSegments [ n ] ; f1 = recall + precision == 0.0 ? 0.0 : ( 2.0 * recall * precision ) / ( recall + precision ) ; } }
public class SessionUtils { /** * Sets the name of the Dart controller name as defined in the dart file ( @ NGController ' s publishAs attribute ) . * @ param name the name of the Dart controller */ public static void setControllerName ( String name ) { } }
Map < String , Object > sessionMap = FacesContext . getCurrentInstance ( ) . getExternalContext ( ) . getSessionMap ( ) ; sessionMap . put ( DART_CONTROLLER_NAME , name ) ;
public class ContainerProperties { /** * The mount points for data volumes in your container . This parameter maps to < code > Volumes < / code > in the < a * href = " https : / / docs . docker . com / engine / api / v1.23 / # create - a - container " > Create a container < / a > section of the < a * href = " https : / / docs . docker . com / engine / api / v1.23 / " > Docker Remote API < / a > and the < code > - - volume < / code > option to < a * href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setMountPoints ( java . util . Collection ) } or { @ link # withMountPoints ( java . util . Collection ) } if you want to * override the existing values . * @ param mountPoints * The mount points for data volumes in your container . This parameter maps to < code > Volumes < / code > in the < a * href = " https : / / docs . docker . com / engine / api / v1.23 / # create - a - container " > Create a container < / a > section of the * < a href = " https : / / docs . docker . com / engine / api / v1.23 / " > Docker Remote API < / a > and the < code > - - volume < / code > * option to < a href = " https : / / docs . docker . com / engine / reference / run / " > docker run < / a > . * @ return Returns a reference to this object so that method calls can be chained together . */ public ContainerProperties withMountPoints ( MountPoint ... mountPoints ) { } }
if ( this . mountPoints == null ) { setMountPoints ( new java . util . ArrayList < MountPoint > ( mountPoints . length ) ) ; } for ( MountPoint ele : mountPoints ) { this . mountPoints . add ( ele ) ; } return this ;
public class IntegerKeyframeAnimation { /** * Optimization to avoid autoboxing . */ int getIntValue ( Keyframe < Integer > keyframe , float keyframeProgress ) { } }
if ( keyframe . startValue == null || keyframe . endValue == null ) { throw new IllegalStateException ( "Missing values for keyframe." ) ; } if ( valueCallback != null ) { // noinspection ConstantConditions Integer value = valueCallback . getValueInternal ( keyframe . startFrame , keyframe . endFrame , keyframe . startValue , keyframe . endValue , keyframeProgress , getLinearCurrentKeyframeProgress ( ) , getProgress ( ) ) ; if ( value != null ) { return value ; } } return MiscUtils . lerp ( keyframe . getStartValueInt ( ) , keyframe . getEndValueInt ( ) , keyframeProgress ) ;
public class ImageArchiveUtil { /** * Search the manifest for an entry that has the repository and tag provided . * @ param repoTag the repository and tag to search ( e . g . busybox : latest ) . * @ param manifest the manifest to be searched * @ return the entry found , or null if no match . */ public static ImageArchiveManifestEntry findEntryByRepoTag ( String repoTag , ImageArchiveManifest manifest ) { } }
if ( repoTag == null || manifest == null ) { return null ; } for ( ImageArchiveManifestEntry entry : manifest . getEntries ( ) ) { for ( String entryRepoTag : entry . getRepoTags ( ) ) { if ( repoTag . equals ( entryRepoTag ) ) { return entry ; } } } return null ;
public class DatabaseRecommendedActionsInner { /** * Gets list of Database Recommended Actions . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database . * @ param advisorName The name of the Database Advisor . * @ 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 < RecommendedActionInner > > listByDatabaseAdvisorAsync ( String resourceGroupName , String serverName , String databaseName , String advisorName , final ServiceCallback < List < RecommendedActionInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listByDatabaseAdvisorWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , advisorName ) , serviceCallback ) ;
public class CmsConfigurationCache { /** * Loads the available element views . < p > * @ return the element views */ protected Map < CmsUUID , CmsElementView > loadElementViews ( ) { } }
List < CmsElementView > views = new ArrayList < CmsElementView > ( ) ; if ( m_cms . existsResource ( "/" ) ) { views . add ( CmsElementView . DEFAULT_ELEMENT_VIEW ) ; try { @ SuppressWarnings ( "deprecation" ) CmsResourceFilter filter = CmsResourceFilter . ONLY_VISIBLE_NO_DELETED . addRequireType ( m_elementViewType . getTypeId ( ) ) ; List < CmsResource > groups = m_cms . readResources ( "/" , filter ) ; for ( CmsResource res : groups ) { try { views . add ( new CmsElementView ( m_cms , res ) ) ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; } } } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } Collections . sort ( views , new CmsElementView . ElementViewComparator ( ) ) ; Map < CmsUUID , CmsElementView > elementViews = new LinkedHashMap < CmsUUID , CmsElementView > ( ) ; for ( CmsElementView view : views ) { elementViews . put ( view . getId ( ) , view ) ; } return elementViews ; } return null ;
public class ProductViewDetailMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ProductViewDetail productViewDetail , ProtocolMarshaller protocolMarshaller ) { } }
if ( productViewDetail == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( productViewDetail . getProductViewSummary ( ) , PRODUCTVIEWSUMMARY_BINDING ) ; protocolMarshaller . marshall ( productViewDetail . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( productViewDetail . getProductARN ( ) , PRODUCTARN_BINDING ) ; protocolMarshaller . marshall ( productViewDetail . getCreatedTime ( ) , CREATEDTIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ClassUtils { /** * Lookup the setter method for the given property . * @ param clazz * type which contains the property . * @ param propertyName * name of the property . * @ param propertyType * type of the property . * @ return a Method with write - access for the property . */ public static final Method getWriteMethod ( Class < ? > clazz , String propertyName , Class < ? > propertyType ) { } }
String propertyNameCapitalized = capitalize ( propertyName ) ; try { return clazz . getMethod ( "set" + propertyNameCapitalized , new Class [ ] { propertyType } ) ; } catch ( Exception e ) { return null ; }
public class PackageManagerUtils { /** * Checks if the device has a GPS location feature . * @ param context the context . * @ return { @ code true } if the device has a GPS location feature . */ @ TargetApi ( Build . VERSION_CODES . FROYO ) public static boolean hasGpsLocationFeature ( Context context ) { } }
return hasGpsLocationFeature ( context . getPackageManager ( ) ) ;
public class CmsJspVfsAccessBean { /** * Returns a map that lazily reads resources from the OpenCms VFS . < p > * Usage example on a JSP with the EL : < pre > * Root path of the " / index . html " resource : $ { cms : vfs ( pageContext ) . readResource [ ' / index . html ' ] . rootPath } * < / pre > * Usage example on a JSP with the < code > & lt ; cms : contentaccess & gt ; < / code > tag : < pre > * & lt ; cms : contentload . . . & gt ; * & lt ; cms : contentaccess var = " content " / & gt ; * Root path of the " / index . html " resource : $ { content . vfs . readResource [ ' / index . html ' ] . rootPath } * & lt ; / cms : contentload & gt ; < / pre > * @ return a map that lazily reads resources from the OpenCms VFS * @ see # getResource ( ) for a short form of this method */ public Map < String , CmsJspResourceWrapper > getReadResource ( ) { } }
if ( m_resources == null ) { // create lazy map only on demand m_resources = CmsCollectionsGenericWrapper . createLazyMap ( new CmsResourceLoaderTransformer ( ) ) ; } return m_resources ;
public class HFClient { /** * Query the peer for installed chaincode information * @ param peer The peer to query . * @ return List of ChaincodeInfo on installed chaincode @ see { @ link ChaincodeInfo } * @ throws InvalidArgumentException * @ throws ProposalException * @ deprecated See { @ link LifecycleQueryInstalledChaincodesRequest } */ public List < ChaincodeInfo > queryInstalledChaincodes ( Peer peer ) throws InvalidArgumentException , ProposalException { } }
clientCheck ( ) ; if ( null == peer ) { throw new InvalidArgumentException ( "peer set to null" ) ; } try { // Run this on a system channel . Channel systemChannel = Channel . newSystemChannel ( this ) ; return systemChannel . queryInstalledChaincodes ( peer ) ; } catch ( ProposalException e ) { logger . error ( format ( "queryInstalledChaincodes for peer %s failed." + e . getMessage ( ) , peer . getName ( ) ) , e ) ; throw e ; }
public class CommerceShipmentItemPersistenceImpl { /** * Returns a range of all the commerce shipment items where commerceShipmentId = & # 63 ; . * Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceShipmentItemModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order . * @ param commerceShipmentId the commerce shipment ID * @ param start the lower bound of the range of commerce shipment items * @ param end the upper bound of the range of commerce shipment items ( not inclusive ) * @ return the range of matching commerce shipment items */ @ Override public List < CommerceShipmentItem > findByCommerceShipment ( long commerceShipmentId , int start , int end ) { } }
return findByCommerceShipment ( commerceShipmentId , start , end , null ) ;
public class BaseAuthenticationProvider { /** * Merges authorities granted ( or revoked ) by the system with those granted by the security * domain . * @ param userGrants Authorities granted by the security domain . * @ param systemGrants Authorities granted by the system . * @ return A merged set of granted authorities . */ protected Set < String > mergeAuthorities ( List < String > userGrants , List < String > systemGrants ) { } }
Set < String > authorities = userGrants == null ? new HashSet < > ( ) : new HashSet < > ( userGrants ) ; for ( String grantedAuthority : systemGrantedAuthorities ) { if ( grantedAuthority . startsWith ( "-" ) ) { authorities . remove ( grantedAuthority . substring ( 1 ) ) ; } else { authorities . add ( grantedAuthority ) ; } } return authorities ;
public class Bytes { /** * Appends two bytes array into one . * @ param a A byte [ ] . * @ param b A byte [ ] . * @ return A byte [ ] . */ public static byte [ ] append ( byte [ ] a , byte [ ] b ) { } }
byte [ ] z = new byte [ a . length + b . length ] ; System . arraycopy ( a , 0 , z , 0 , a . length ) ; System . arraycopy ( b , 0 , z , a . length , b . length ) ; return z ;
public class ResourceRecordSets { /** * creates mx set of { @ link denominator . model . rdata . MXData MX } records for the specified name and * ttl . * @ param name ex . { @ code denominator . io . } * @ param mxdata { @ code 1 mx1 . denominator . io . } */ public static ResourceRecordSet < MXData > mx ( String name , String mxdata ) { } }
return new MXBuilder ( ) . name ( name ) . add ( mxdata ) . build ( ) ;
public class FormLayout { /** * Inserts the specified column at the specified position . Shifts components that intersect the * new column to the right and readjusts column groups . < p > * The component shift works as follows : components that were located on the right hand side of * the inserted column are shifted one column to the right ; component column span is increased * by one if it intersects the new column . < p > * Column group indices that are greater or equal than the given column index will be increased * by one . * @ param rowIndex index of the row to be inserted * @ param rowSpec specification of the row to be inserted * @ throws IndexOutOfBoundsException if the row index is out of range */ public void insertRow ( int rowIndex , RowSpec rowSpec ) { } }
if ( rowIndex < 1 || rowIndex > getRowCount ( ) ) { throw new IndexOutOfBoundsException ( "The row index " + rowIndex + " must be in the range [1, " + getRowCount ( ) + "]." ) ; } rowSpecs . add ( rowIndex - 1 , rowSpec ) ; shiftComponentsVertically ( rowIndex , false ) ; adjustGroupIndices ( rowGroupIndices , rowIndex , false ) ;
public class NetworkEndpointGroupClient { /** * Retrieves the list of network endpoint groups and sorts them by zone . * < p > Sample code : * < pre > < code > * try ( NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient . create ( ) ) { * ProjectName project = ProjectName . of ( " [ PROJECT ] " ) ; * for ( NetworkEndpointGroupsScopedList element : networkEndpointGroupClient . aggregatedListNetworkEndpointGroups ( project . toString ( ) ) . iterateAll ( ) ) { * / / doThingsWith ( element ) ; * < / code > < / pre > * @ param project Project ID for this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final AggregatedListNetworkEndpointGroupsPagedResponse aggregatedListNetworkEndpointGroups ( String project ) { } }
AggregatedListNetworkEndpointGroupsHttpRequest request = AggregatedListNetworkEndpointGroupsHttpRequest . newBuilder ( ) . setProject ( project ) . build ( ) ; return aggregatedListNetworkEndpointGroups ( request ) ;
public class CmsSolrQuery { /** * Creates a filter query on the given field name . < p > * Creates and adds a filter query . < p > * @ param fieldName the field name to create a filter query on * @ param vals the values that should match for the given field * @ param all < code > true < / code > to combine the given values with ' AND ' , < code > false < / code > for ' OR ' * @ param useQuotes < code > true < / code > to surround the given values with double quotes , < code > false < / code > otherwise * @ return a filter query String e . g . < code > fq = fieldname : val1 < / code > */ private String createFilterQuery ( String fieldName , List < String > vals , boolean all , boolean useQuotes ) { } }
String filterQuery = null ; if ( ( vals != null ) ) { if ( vals . size ( ) == 1 ) { if ( useQuotes ) { filterQuery = fieldName + ":" + "\"" + vals . get ( 0 ) + "\"" ; } else { filterQuery = fieldName + ":" + vals . get ( 0 ) ; } } else if ( vals . size ( ) > 1 ) { filterQuery = fieldName + ":(" ; for ( int j = 0 ; j < vals . size ( ) ; j ++ ) { String val ; if ( useQuotes ) { val = "\"" + vals . get ( j ) + "\"" ; } else { val = vals . get ( j ) ; } filterQuery += val ; if ( vals . size ( ) > ( j + 1 ) ) { if ( all ) { filterQuery += " AND " ; } else { filterQuery += " OR " ; } } } filterQuery += ")" ; } } return filterQuery ;
public class AbstractParsedStmt { /** * Lookup or define the shared part of a common table by name . This happens when the * common table name is first encountered . For example , * in the SQL : " with name as ( select * from ttt ) select name as a , name as b " * the name " name " is a common table name . It ' s not an * alias . This is comparable to defining a table name in * the catalog , but it does not persist past the current * statement . So it does not make any sense to make it a * catalog entry . * @ param tableName The table name , not the table alias . */ protected StmtCommonTableScanShared defineCommonTableScanShared ( String tableName , int stmtId ) { } }
assert ( m_commonTableSharedMap . get ( tableName ) == null ) ; StmtCommonTableScanShared answer = new StmtCommonTableScanShared ( tableName , stmtId ) ; m_commonTableSharedMap . put ( tableName , answer ) ; return answer ;
public class SqlValidatorImpl { /** * Checks that all pattern variables within a function are the same , * and canonizes expressions such as { @ code PREV ( B . price ) } to * { @ code LAST ( B . price , 0 ) } . */ private SqlNode navigationInDefine ( SqlNode node , String alpha ) { } }
Set < String > prefix = node . accept ( new PatternValidator ( false ) ) ; Util . discard ( prefix ) ; node = new NavigationExpander ( ) . go ( node ) ; node = new NavigationReplacer ( alpha ) . go ( node ) ; return node ;
public class PicassoImageLoader { /** * Given a listener passed as argument creates or returns a lazy instance of a Picasso Target . * This implementation is needed because Picasso doesn ' t keep a strong reference to the target * passed as parameter . Without this method Picasso looses the reference to the target and never * notifies when the resource has been downloaded . * Listener and Target instances are going to be stored into a WeakHashMap to avoid a memory leak * when ImageLoader client code is garbage collected . */ private ListenerTarget getLinearTarget ( final Listener listener ) { } }
ListenerTarget target = targets . get ( listener ) ; if ( target == null ) { target = new ListenerTarget ( listener ) ; targets . put ( listener , target ) ; } return target ;
public class ScopedResponseImpl { /** * Gets the first header with the given name . * @ return an Object ( String , Integer , Date , Cookie ) that is the first header with the given name , * or < code > null < / code > if none is found . */ public Object getFirstHeader ( String name ) { } }
List foundHeaders = ( List ) _headers . get ( name ) ; return ! foundHeaders . isEmpty ( ) ? foundHeaders . get ( 0 ) : null ;
public class InstrumentedScheduledExecutorService { /** * { @ inheritDoc } */ @ Override public < T > Future < T > submit ( Callable < T > task ) { } }
submitted . mark ( ) ; return delegate . submit ( new InstrumentedCallable < > ( task ) ) ;
public class Statement { /** * Return an Observable that emits the emissions from one specified * Observable if a condition evaluates to true , or from another specified * Observable otherwise . * < img width = " 640 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / ifThen . e . png " alt = " " > * @ param < R > * the result value type * @ param condition * the condition that decides which Observable to emit the * emissions from * @ param then * the Observable sequence to emit to if { @ code condition } is { @ code true } * @ param orElse * the Observable sequence to emit to if { @ code condition } is { @ code false } * @ return an Observable that mimics either the { @ code then } or { @ code orElse } Observables depending on a condition function */ public static < R > Observable < R > ifThen ( Func0 < Boolean > condition , Observable < ? extends R > then , Observable < ? extends R > orElse ) { } }
return Observable . create ( new OperatorIfThen < R > ( condition , then , orElse ) ) ;
public class HeightSpec { /** * Create a height element with an absolute value . * @ param fValue * The height to use . Must be & gt ; 0. * @ return Never < code > null < / code > . */ @ Nonnull public static HeightSpec abs ( @ Nonnegative final float fValue ) { } }
ValueEnforcer . isGT0 ( fValue , "Value" ) ; return new HeightSpec ( EValueUOMType . ABSOLUTE , fValue ) ;
public class AddOn { /** * Removes the given { @ code extension } from the list of loaded extensions of this add - on . * The add - on of the given { @ code extension } is set to { @ code null } . * The call to this method has no effect if the given { @ code extension } does not belong to this add - on . * @ param extension the loaded extension of this add - on that should be removed * @ throws IllegalArgumentException if extension is { @ code null } * @ since 2.4.0 * @ see # addLoadedExtension ( Extension ) * @ see Extension # setAddOn ( AddOn ) */ public void removeLoadedExtension ( Extension extension ) { } }
if ( extension == null ) { throw new IllegalArgumentException ( "Parameter extension must not be null." ) ; } if ( loadedExtensions != null && loadedExtensions . contains ( extension ) ) { loadedExtensions . remove ( extension ) ; extension . setAddOn ( null ) ; }
public class InfixParser { /** * Parse infix string expression with additional properties * @ param operationRegister * @ param properties * @ param infixExpression * @ param values * @ return * @ throws ParseException */ public CList parse ( UseExtension operationRegister , Properties properties , String infixExpression , Object ... values ) throws ParseException { } }
pUsedExtensions = null ; this . usedExtensions = operationRegister ; this . properties = properties ; return parse ( infixExpression , values ) ;
public class AbstractRegionPainter { /** * Gets the rendered image for this painter at the requested size , either * from cache or create a new one * @ param config the graphics configuration . * @ param c the component to paint . * @ param w the component width . * @ param h the component height . * @ param extendedCacheKeys extended cache keys . * @ return the new image . */ private VolatileImage getImage ( GraphicsConfiguration config , JComponent c , int w , int h , Object [ ] extendedCacheKeys ) { } }
ImageCache imageCache = ImageCache . getInstance ( ) ; // get the buffer for this component VolatileImage buffer = ( VolatileImage ) imageCache . getImage ( config , w , h , this , extendedCacheKeys ) ; int renderCounter = 0 ; // to avoid any potential , though unlikely , // infinite loop do { // validate the buffer so we can check for surface loss int bufferStatus = VolatileImage . IMAGE_INCOMPATIBLE ; if ( buffer != null ) { bufferStatus = buffer . validate ( config ) ; } // If the buffer status is incompatible or restored , then we need to // re - render to the volatile image if ( bufferStatus == VolatileImage . IMAGE_INCOMPATIBLE || bufferStatus == VolatileImage . IMAGE_RESTORED ) { // if the buffer is null ( hasn ' t been created ) , or isn ' t the // right size , or has lost its contents , // then recreate the buffer if ( buffer == null || buffer . getWidth ( ) != w || buffer . getHeight ( ) != h || bufferStatus == VolatileImage . IMAGE_INCOMPATIBLE ) { // clear any resources related to the old back buffer if ( buffer != null ) { buffer . flush ( ) ; buffer = null ; } // recreate the buffer buffer = config . createCompatibleVolatileImage ( w , h , Transparency . TRANSLUCENT ) ; // put in cache for future imageCache . setImage ( buffer , config , w , h , this , extendedCacheKeys ) ; } // create the graphics context with which to paint to the buffer Graphics2D bg = buffer . createGraphics ( ) ; // clear the background before configuring the graphics bg . setComposite ( AlphaComposite . Clear ) ; bg . fillRect ( 0 , 0 , w , h ) ; bg . setComposite ( AlphaComposite . SrcOver ) ; configureGraphics ( bg ) ; // paint the painter into buffer paintDirectly ( bg , c , w , h , extendedCacheKeys ) ; // close buffer graphics bg . dispose ( ) ; } } while ( buffer . contentsLost ( ) && renderCounter ++ < 3 ) ; // check if we failed if ( renderCounter == 3 ) return null ; // return image return buffer ;
public class LastaPrepareFilter { protected void viaHotdeploy ( HttpServletRequest request , HttpServletResponse response , FilterChain chain ) throws IOException , ServletException { } }
if ( ! ManagedHotdeploy . isHotdeploy ( ) ) { // e . g . production , unit - test toNextFilter ( request , response , chain ) ; // # to _ action return ; } final String loaderKey = HOTDEPLOY_CLASSLOADER_KEY ; if ( request . getAttribute ( loaderKey ) != null ) { // check recursive call final ClassLoader loader = ( ClassLoader ) request . getAttribute ( loaderKey ) ; Thread . currentThread ( ) . setContextClassLoader ( loader ) ; toNextFilter ( request , response , chain ) ; // # to _ action return ; } synchronized ( HotdeployLock . class ) { final ClassLoader originalLoader = ManagedHotdeploy . start ( ) ; try { final HotdeployHttpServletRequest hotdeployRequest = newHotdeployHttpServletRequest ( request ) ; ContainerUtil . overrideExternalRequest ( hotdeployRequest ) ; // override formal request try { request . setAttribute ( loaderKey , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; toNextFilter ( hotdeployRequest , response , chain ) ; // # to _ action } finally { final HotdeployHttpSession session = ( HotdeployHttpSession ) hotdeployRequest . getSession ( false ) ; if ( session != null ) { session . flush ( ) ; } request . removeAttribute ( loaderKey ) ; } } finally { ManagedHotdeploy . stop ( originalLoader ) ; } }
public class ESSharedStateComponent { /** * Reads a stored primitive . * @ param result */ protected Object readPrimitive ( JestResult result ) throws Exception { } }
PrimitiveBean pb = result . getSourceAsObject ( PrimitiveBean . class ) ; String value = pb . getValue ( ) ; Class < ? > c = Class . forName ( pb . getType ( ) ) ; return BackingStoreUtil . readPrimitive ( c , value ) ;
public class EmailExtensions { /** * Creates an Address from the given the email address as String object . * @ param address * The address in RFC822 format . * @ return The created InternetAddress - object from the given address . * @ throws UnsupportedEncodingException * is thrown if the encoding not supported * @ throws AddressException * is thrown if the parse failed */ public static Address newAddress ( final String address ) throws AddressException , UnsupportedEncodingException { } }
return newAddress ( address , null , null ) ;
public class MapSubject { /** * Fails if the map contains the given entry . */ public void doesNotContainEntry ( @ NullableDecl Object key , @ NullableDecl Object value ) { } }
checkNoNeedToDisplayBothValues ( "entrySet()" ) . that ( actual ( ) . entrySet ( ) ) . doesNotContain ( immutableEntry ( key , value ) ) ;
public class MysqlBaseService { /** * This is a utility function to get the names of all * the tables that ' re in the database supplied * @ param database the database name * @ param stmt Statement object * @ return List \ < String \ > * @ throws SQLException exception */ static List < String > getAllTables ( String database , Statement stmt ) throws SQLException { } }
List < String > table = new ArrayList < > ( ) ; ResultSet rs ; rs = stmt . executeQuery ( "SHOW TABLE STATUS FROM `" + database + "`;" ) ; while ( rs . next ( ) ) { table . add ( rs . getString ( "Name" ) ) ; } return table ;
public class FessMessages { /** * Add the created action message for the key ' constraints . Mod11Check . message ' with parameters . * < pre > * message : The check digit for $ { value } is invalid , Modulo 11 checksum failed . * < / pre > * @ param property The property name for the message . ( NotNull ) * @ param value The parameter value for message . ( NotNull ) * @ return this . ( NotNull ) */ public FessMessages addConstraintsMod11CheckMessage ( String property , String value ) { } }
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( CONSTRAINTS_Mod11Check_MESSAGE , value ) ) ; return this ;
public class CompactIntArray { /** * Set the integer at the given index . < b > Warning : < / b > if you attempt to store an integer that * is wider than the width given to the constructor { @ link # CompactIntArray ( int , int ) } , the integer * is truncated . * @ param index The index . * @ param value The value to store . */ public void set ( int index , int value ) { } }
if ( d_bitsPerElem == 0 ) return ; int startIdx = ( index * d_bitsPerElem ) / INT_SIZE ; int startBit = ( index * d_bitsPerElem ) % INT_SIZE ; // Clear data d_data [ startIdx ] &= ~ ( MASK [ d_bitsPerElem ] << startBit ) ; // And set . d_data [ startIdx ] |= value << startBit ; // If the integer didn ' t have enough bits available , write the rest in the next integer . if ( ( startBit + d_bitsPerElem ) > INT_SIZE ) { int done = INT_SIZE - startBit ; d_data [ startIdx + 1 ] &= ~ MASK [ d_bitsPerElem - done ] ; d_data [ startIdx + 1 ] |= value >>> done ; }
public class AssertKripton { /** * Fail incompatible attributes in annotation exception . * @ param messageFormat * the message format * @ param args * the args */ public static void failIncompatibleAttributesInAnnotationException ( String messageFormat , Object ... args ) { } }
throw ( new IncompatibleAttributesInAnnotationException ( String . format ( messageFormat , args ) ) ) ;
public class AmazonIdentityManagementWaiters { /** * Builds a PolicyExists waiter by using custom parameters waiterParameters and other parameters defined in the * waiters specification , and then polls until it determines whether the resource entered the desired state or not , * where polling criteria is bound by either default polling strategy or custom polling strategy . */ public Waiter < GetPolicyRequest > policyExists ( ) { } }
return new WaiterBuilder < GetPolicyRequest , GetPolicyResult > ( ) . withSdkFunction ( new GetPolicyFunction ( client ) ) . withAcceptors ( new HttpSuccessStatusAcceptor ( WaiterState . SUCCESS ) , new PolicyExists . IsNoSuchEntityMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 20 ) , new FixedDelayStrategy ( 1 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
public class GraphicalModel { /** * Add a conditional factor , as per a Bayes net . * Note that unlike the case with other factors , this function takes as input < b > probabilities < / b > and not * unnormalized factor values . * In other words , we do not exponentiate the values coming from the assignment function into a log - linear model . * @ param antecedents The antecedents of the conditional probability . There can be many of these . * @ param consequent The consequent of the conditional probability . There is only one of these . * @ param antecedentDimensions The variable dimmensions of the antecedents . * @ param consequentDimension The variable dimmension of the consequent . * @ param conditionalProbaility The assignment function , taking as input an assignment of the antecedents , * and an assignment of the consequent , and producing as output a < b > probability < / b > * ( value between 0 and 1 ) for this assignment . * This can be an unnormallized probability , but it should not be a log probability , as you ' d * expect from a Markov net factor . * @ return a reference to the created factor . This can be safely ignored , as the factor is already saved in the model */ public StaticFactor addStaticConditionalFactor ( int [ ] antecedents , int consequent , int [ ] antecedentDimensions , int consequentDimension , BiFunction < int [ ] , Integer , Double > conditionalProbaility ) { } }
// Create variables for the global factor int [ ] allDimensions = new int [ antecedentDimensions . length + 1 ] ; System . arraycopy ( antecedentDimensions , 0 , allDimensions , 0 , antecedentDimensions . length ) ; allDimensions [ allDimensions . length - 1 ] = consequentDimension ; int [ ] allNeighbors = new int [ antecedents . length + 1 ] ; System . arraycopy ( antecedents , 0 , allNeighbors , 0 , antecedents . length ) ; allNeighbors [ allNeighbors . length - 1 ] = consequent ; NDArrayDoubles totalFactor = new NDArrayDoubles ( allDimensions ) ; // Compute each conditional table NDArrayDoubles antecedentOnly = new NDArrayDoubles ( antecedentDimensions ) ; for ( int [ ] assignment : antecedentOnly ) { double localPartitionFunction = 0.0 ; for ( int consequentValue = 0 ; consequentValue < consequentDimension ; ++ consequentValue ) { localPartitionFunction += conditionalProbaility . apply ( assignment , consequentValue ) ; } for ( int consequentValue = 0 ; consequentValue < consequentDimension ; ++ consequentValue ) { int [ ] totalAssignment = new int [ assignment . length + 1 ] ; System . arraycopy ( assignment , 0 , totalAssignment , 0 , assignment . length ) ; totalAssignment [ totalAssignment . length - 1 ] = consequentValue ; totalFactor . setAssignmentValue ( totalAssignment , Math . log ( conditionalProbaility . apply ( assignment , consequentValue ) ) - Math . log ( localPartitionFunction ) ) ; } } // Create the joint factor return addStaticFactor ( totalFactor , allNeighbors ) ;
public class Ifc2x3tc1FactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public IfcPhysicalOrVirtualEnum createIfcPhysicalOrVirtualEnumFromString ( EDataType eDataType , String initialValue ) { } }
IfcPhysicalOrVirtualEnum result = IfcPhysicalOrVirtualEnum . get ( initialValue ) ; if ( result == null ) throw new IllegalArgumentException ( "The value '" + initialValue + "' is not a valid enumerator of '" + eDataType . getName ( ) + "'" ) ; return result ;
public class CacheManagerBuilder { /** * Adds a default { @ link SizeOfEngine } configuration , that limits the max object graph to * size , to the returned builder . * @ param size the max object graph size * @ return a new builder with the added configuration */ public CacheManagerBuilder < T > withDefaultSizeOfMaxObjectGraph ( long size ) { } }
DefaultSizeOfEngineProviderConfiguration configuration = configBuilder . findServiceByClass ( DefaultSizeOfEngineProviderConfiguration . class ) ; if ( configuration == null ) { return new CacheManagerBuilder < > ( this , configBuilder . addService ( new DefaultSizeOfEngineProviderConfiguration ( DEFAULT_MAX_OBJECT_SIZE , DEFAULT_UNIT , size ) ) ) ; } else { ConfigurationBuilder builder = configBuilder . removeService ( configuration ) ; return new CacheManagerBuilder < > ( this , builder . addService ( new DefaultSizeOfEngineProviderConfiguration ( configuration . getMaxObjectSize ( ) , configuration . getUnit ( ) , size ) ) ) ; }
public class ContentManager { /** * Gets document stream from WorkDocs . * If VersionId of GetDocumentStreamRequest is not specified , * then the latest version of specified document is retrieved . * Clients must close the stream once content is read . * @ param getDocumentStreamRequest Request specifying parameters of the operation . * @ return Result containing stream of requested document content . */ public GetDocumentStreamResult getDocumentStream ( final GetDocumentStreamRequest getDocumentStreamRequest ) { } }
String versionId = getDocumentStreamRequest . getVersionId ( ) ; if ( versionId == null ) { GetDocumentRequest getDocumentRequest = new GetDocumentRequest ( ) ; getDocumentRequest . setDocumentId ( getDocumentStreamRequest . getDocumentId ( ) ) ; String requestAuthenticationToken = getDocumentStreamRequest . getAuthenticationToken ( ) ; if ( requestAuthenticationToken != null ) { getDocumentRequest . setAuthenticationToken ( requestAuthenticationToken ) ; } else { getDocumentRequest . setAuthenticationToken ( authenticationToken ) ; } GetDocumentResult result = client . getDocument ( getDocumentRequest ) ; versionId = result . getMetadata ( ) . getLatestVersionMetadata ( ) . getId ( ) ; } GetDocumentStreamResult getDocumentStreamResult = new GetDocumentStreamResult ( getDocumentStreamRequest ) ; getDocumentStreamResult . setVersionId ( versionId ) ; InputStream stream = getDocumentVersionStream ( getDocumentStreamRequest . getDocumentId ( ) , versionId ) ; getDocumentStreamResult . setStream ( stream ) ; return getDocumentStreamResult ;
public class IPSImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public void setXpsOset ( Integer newXpsOset ) { } }
Integer oldXpsOset = xpsOset ; xpsOset = newXpsOset ; if ( eNotificationRequired ( ) ) eNotify ( new ENotificationImpl ( this , Notification . SET , AfplibPackage . IPS__XPS_OSET , oldXpsOset , xpsOset ) ) ;
public class SlaveComputer { /** * Obtains a { @ link VirtualChannel } that allows some computation to be performed on the master . * This method can be called from any thread on the master , or from agent ( more precisely , * it only works from the remoting request - handling thread in agents , which means if you ' ve started * separate thread on agents , that ' ll fail . ) * @ return null if the calling thread doesn ' t have any trace of where its master is . * @ since 1.362 */ public static VirtualChannel getChannelToMaster ( ) { } }
if ( Jenkins . getInstanceOrNull ( ) != null ) // check if calling thread is on master or on slave return FilePath . localChannel ; // if this method is called from within the agent computation thread , this should work Channel c = Channel . current ( ) ; if ( c != null && Boolean . TRUE . equals ( c . getProperty ( "slave" ) ) ) return c ; return null ;
public class Kit { /** * Attempt to load the class of the given name . Note that the type parameter * isn ' t checked . */ public static Class < ? > classOrNull ( ClassLoader loader , String className ) { } }
try { return loader . loadClass ( className ) ; } catch ( ClassNotFoundException ex ) { } catch ( SecurityException ex ) { } catch ( LinkageError ex ) { } catch ( IllegalArgumentException e ) { // Can be thrown if name has characters that a class name // can not contain } return null ;
public class TThreadedSelectorServerWithFix { /** * Helper to create the invoker if one is not specified */ protected static ExecutorService createDefaultExecutor ( Args options ) { } }
return ( options . workerThreads > 0 ) ? Executors . newFixedThreadPool ( options . workerThreads ) : null ;
public class QueueName { /** * Add this key area description to the Record . */ public KeyArea setupKey ( int iKeyArea ) { } }
KeyArea keyArea = null ; if ( iKeyArea == 0 ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , ID_KEY ) ; keyArea . addKeyField ( ID , DBConstants . ASCENDING ) ; } if ( iKeyArea == 1 ) { keyArea = this . makeIndex ( DBConstants . SECONDARY_KEY , NAME_KEY ) ; keyArea . addKeyField ( NAME , DBConstants . ASCENDING ) ; } if ( iKeyArea == 2 ) { keyArea = this . makeIndex ( DBConstants . NOT_UNIQUE , CODE_KEY ) ; keyArea . addKeyField ( CODE , DBConstants . ASCENDING ) ; } if ( iKeyArea == 3 ) { keyArea = this . makeIndex ( DBConstants . NOT_UNIQUE , EXTERNAL_QUEUE_NAME_KEY ) ; keyArea . addKeyField ( EXTERNAL_QUEUE_NAME , DBConstants . ASCENDING ) ; } if ( keyArea == null ) keyArea = super . setupKey ( iKeyArea ) ; return keyArea ;
public class FSDataset { /** * is this block finalized ? Returns true if the block is already * finalized , otherwise returns false . */ private boolean isBlockFinalizedWithLock ( int namespaceId , Block b ) { } }
lock . readLock ( ) . lock ( ) ; try { return isBlockFinalizedInternal ( namespaceId , b , true ) ; } finally { lock . readLock ( ) . unlock ( ) ; }
public class Utils { /** * Replies if the given type is an interface . * @ param type - the type to test . * @ return < code > true < / code > if the given type is an interface . */ public static boolean isInterface ( LightweightTypeReference type ) { } }
return type . getType ( ) instanceof JvmGenericType && ( ( JvmGenericType ) type . getType ( ) ) . isInterface ( ) ;
public class IndexByPlaceRenderer { /** * Build the index . * @ return the complete index */ private Map < String , Set < PersonRenderer > > createWholeIndex ( ) { } }
logger . info ( "In getWholeIndex" ) ; final Map < String , Set < PersonRenderer > > aMap = new TreeMap < > ( ) ; if ( ! getRenderingContext ( ) . isUser ( ) ) { logger . info ( "Leaving getWholeIndex not logged in" ) ; return aMap ; } final Collection < Person > persons = getGedObject ( ) . find ( Person . class ) ; for ( final Person person : persons ) { if ( isHidden ( person ) ) { continue ; } locatePerson ( aMap , person ) ; } logger . info ( "Leaving getWholeIndex" ) ; return aMap ;
public class TimeoutHelper { /** * Calls task but ensures it ends . * @ param description description of task . * @ param timeout timeout in milliseconds . * @ param task task to execute . */ public void callWithTimeout ( String description , int timeout , Runnable task ) { } }
Future < ? > callFuture = threadPool . submit ( task ) ; getWithTimeout ( callFuture , timeout , description ) ;
public class WildcardsCompiler { /** * Compiles wildcard pattern into a regular expression . * Allowed wildcards : < br > * < br > * & nbsp ; & nbsp ; & nbsp ; * - matches any sequence of characters < br > * & nbsp ; & nbsp ; & nbsp ; $ - matches end of sequence < br > * @ param patternWithWildcards pattern with wildcards * @ return compiled pattern */ public static Pattern compile ( String patternWithWildcards ) { } }
StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < patternWithWildcards . length ( ) ; i ++ ) { char c = patternWithWildcards . charAt ( i ) ; switch ( c ) { case '*' : sb . append ( ".*" ) ; break ; case '$' : if ( i == patternWithWildcards . length ( ) - 1 ) { sb . append ( c ) ; } else { sb . append ( "[" ) . append ( c ) . append ( "]" ) ; } break ; case '[' : case ']' : sb . append ( "[" ) . append ( "\\" ) . append ( c ) . append ( "]" ) ; break ; default : sb . append ( "[" ) . append ( c ) . append ( "]" ) ; } } return Pattern . compile ( sb . toString ( ) ) ;
public class MultipleAlignmentJmol { /** * Generate a Jmol command String that colors the aligned residues of every * structure . */ public static String getJmolString ( MultipleAlignment multAln , List < Atom [ ] > transformedAtoms , ColorBrewer colorPalette , boolean colorByBlocks ) { } }
// Color by blocks if specified if ( colorByBlocks ) return getMultiBlockJmolString ( multAln , transformedAtoms , colorPalette , colorByBlocks ) ; Color [ ] colors = colorPalette . getColorPalette ( multAln . size ( ) ) ; StringBuffer j = new StringBuffer ( ) ; j . append ( DEFAULT_SCRIPT ) ; // Color the equivalent residues of every structure StringBuffer sel = new StringBuffer ( ) ; sel . append ( "select *; color lightgrey; backbone 0.1; " ) ; List < List < String > > allPDB = new ArrayList < List < String > > ( ) ; // Get the aligned residues of every structure for ( int i = 0 ; i < multAln . size ( ) ; i ++ ) { List < String > pdb = MultipleAlignmentJmolDisplay . getPDBresnum ( i , multAln , transformedAtoms . get ( i ) ) ; allPDB . add ( pdb ) ; sel . append ( "select " ) ; int pos = 0 ; for ( String res : pdb ) { if ( pos > 0 ) sel . append ( "," ) ; pos ++ ; sel . append ( res ) ; sel . append ( "/" + ( i + 1 ) ) ; } if ( pos == 0 ) sel . append ( "none" ) ; sel . append ( "; backbone 0.3 ; color [" + colors [ i ] . getRed ( ) + "," + colors [ i ] . getGreen ( ) + "," + colors [ i ] . getBlue ( ) + "]; " ) ; } j . append ( sel ) ; j . append ( "model 0; " ) ; j . append ( LIGAND_DISPLAY_SCRIPT ) ; return j . toString ( ) ;
public class PredicatedSubscriber { /** * A method that casts the message and calls the method that uses generics . < br > * Do not override . * @ param o * - The message . * @ return Returns the same as the applies method . * @ exception SubscriberTypeMismatchException * the type the subscriber was bound to is incompatible with * the type that is being received . */ public boolean appliesO ( Object o ) { } }
try { @ SuppressWarnings ( "unchecked" ) T o2 = ( T ) o ; return applies ( o2 ) ; } catch ( ClassCastException e ) { throw new SubscriberTypeMismatchException ( e ) ; }
public class MultiLayerNetwork { /** * Fit the model for one iteration on the provided data * @ param examples the examples to classify ( one example in each row ) * @ param labels the labels for each example ( the number of labels must match */ @ Override public void fit ( INDArray examples , int [ ] labels ) { } }
org . deeplearning4j . nn . conf . layers . OutputLayer layerConf = ( org . deeplearning4j . nn . conf . layers . OutputLayer ) getOutputLayer ( ) . conf ( ) . getLayer ( ) ; // FIXME : int cast fit ( examples , FeatureUtil . toOutcomeMatrix ( labels , ( int ) layerConf . getNOut ( ) ) ) ;
public class XMLUtil { /** * Replies the boolean value that corresponds to the specified attribute ' s path . * < p > The path is an ordered list of tag ' s names and ended by the name of * the attribute . * @ param document is the XML document to explore . * @ param defaultValue is the default value to reply . * @ param path is the list of and ended by the attribute ' s name . * @ return the boolean value of the specified attribute or < code > false < / code > if * it was node found in the document */ @ Pure public static Boolean getAttributeBooleanWithDefault ( Node document , Boolean defaultValue , String ... path ) { } }
assert document != null : AssertMessages . notNullParameter ( 0 ) ; return getAttributeBooleanWithDefault ( document , true , defaultValue , path ) ;
public class LuceneQueryFactory { /** * Creates a new query factory which can be used to produce Lucene queries for { @ link org . modeshape . jcr . index . lucene . MultiColumnIndex } * indexes . * @ param factories a { @ link ValueFactories } instance ; may not be null * @ param variables a { @ link Map } instance which contains the query variables for a particular query ; may be { @ code null } * @ param propertyTypesByName a { @ link Map } representing the columns and their types for the index definition * for which the query should be created ; may not be null . * @ return a { @ link LuceneQueryFactory } instance , never { @ code null } */ public static LuceneQueryFactory forMultiColumnIndex ( ValueFactories factories , Map < String , Object > variables , Map < String , PropertyType > propertyTypesByName ) { } }
return new LuceneQueryFactory ( factories , variables , propertyTypesByName ) ;
public class Cron4jNow { @ Override public synchronized void destroy ( ) { } }
if ( JobChangeLog . isEnabled ( ) ) { JobChangeLog . log ( "#job ...Destroying scheduler completely: jobs={} scheduler={}" , jobKeyJobMap . size ( ) , cron4jScheduler ) ; } // not use AsyncManager here , because not frequent call , keep no dependency to core new Thread ( ( ) -> { // to release synchronized lock to avoid deadlock try { cron4jScheduler . stop ( ) ; } catch ( RuntimeException e ) { final String msg = "#job Failed to stop jobs: jobs={} scheduler={}" ; if ( JobChangeLog . isEnabled ( ) ) { JobChangeLog . log ( msg , jobKeyJobMap . size ( ) , cron4jScheduler , e ) ; } else { // just in case logger . info ( msg , jobKeyJobMap . size ( ) , cron4jScheduler , e ) ; } } Cron4jJobHistory . clear ( ) ; } ) . start ( ) ;
public class CsvReader { public < T > T get ( int row , int col , DataType dataType ) { } }
List < String > rowList = row ( row ) ; if ( rowList == null || rowList . isEmpty ( ) || col >= rowList . size ( ) ) return nullFor ( dataType ) ; String cell = rowList . get ( col ) ; T results = toType ( cell , dataType ) ; return results ;
public class JolokiaServerConfig { /** * Add detector specific options if given on the command line */ protected void prepareDetectorOptions ( Map < String , String > pConfig ) { } }
StringBuffer detectorOpts = new StringBuffer ( "{" ) ; if ( pConfig . containsKey ( "bootAmx" ) && Boolean . parseBoolean ( pConfig . get ( "bootAmx" ) ) ) { detectorOpts . append ( "\"glassfish\" : { \"bootAmx\" : true }" ) ; } if ( detectorOpts . length ( ) > 1 ) { detectorOpts . append ( "}" ) ; pConfig . put ( ConfigKey . DETECTOR_OPTIONS . getKeyValue ( ) , detectorOpts . toString ( ) ) ; }
public class OWLExistentialReasonerImpl { /** * Gets the fillers of the existential restrictions that are entailed to be superclasses the specified class * expression and act along the specified property . In essence , this finds bindings for ? x with respect to * the following template : < code > SubClassOf ( ce ObjectSomeValuesFrom ( property , ? x ) ) < / code > * @ param ce The class expression . Not { @ code null } . * @ param property The property expression . Not { @ code null } . * @ return A set of class expressions that are the entailed fillers of entailed existential restriction superclasses . */ public NodeSet < OWLClass > getFillers ( OWLClassExpression ce , OWLObjectPropertyExpression property ) { } }
return getFillers ( ce , Arrays . asList ( property ) ) ;
public class PolicyInformation { /** * Get the attribute value . */ public Object get ( String name ) throws IOException { } }
if ( name . equalsIgnoreCase ( ID ) ) { return policyIdentifier ; } else if ( name . equalsIgnoreCase ( QUALIFIERS ) ) { return policyQualifiers ; } else { throw new IOException ( "Attribute name [" + name + "] not recognized by PolicyInformation." ) ; }
public class JsDocInfoParser { /** * ResultType : = < empty > | ' : ' void | ' : ' TypeExpression */ private Node parseResultType ( ) { } }
skipEOLs ( ) ; if ( ! match ( JsDocToken . COLON ) ) { return newNode ( Token . EMPTY ) ; } next ( ) ; skipEOLs ( ) ; if ( match ( JsDocToken . STRING ) && "void" . equals ( stream . getString ( ) ) ) { next ( ) ; return newNode ( Token . VOID ) ; } else { return parseTypeExpression ( next ( ) ) ; }
public class DomHelpers { /** * Compare two DOM documents * @ param d1 First DOM document * @ param d2 Second DOM document * @ return true if both are equal * @ throws MarshalException */ public static boolean compare ( Document d1 , Document d2 ) throws MarshalException { } }
d1 . normalize ( ) ; d2 . normalize ( ) ; return d1 . isEqualNode ( d2 ) ;
public class TransTypes { /** * Get the instance for this context . */ public static TransTypes instance ( Context context ) { } }
TransTypes instance = context . get ( transTypesKey ) ; if ( instance == null ) instance = new TransTypes ( context ) ; return instance ;
public class TemplateFaxJob2HTTPRequestConverter { /** * This function initializes the component . */ @ Override protected void initializeImpl ( ) { } }
// init templates map this . httpRequestTemplateMap = new HashMap < String , String > ( ) ; String [ ] templateNames = new String [ ] { FaxJob2HTTPRequestConverterConfigurationConstants . SUBMIT_FAX_JOB_TEMPLATE_PROPERTY_KEY . toString ( ) , FaxJob2HTTPRequestConverterConfigurationConstants . SUSPEND_FAX_JOB_TEMPLATE_PROPERTY_KEY . toString ( ) , FaxJob2HTTPRequestConverterConfigurationConstants . RESUME_FAX_JOB_TEMPLATE_PROPERTY_KEY . toString ( ) , FaxJob2HTTPRequestConverterConfigurationConstants . CANCEL_FAX_JOB_TEMPLATE_PROPERTY_KEY . toString ( ) , FaxJob2HTTPRequestConverterConfigurationConstants . GET_FAX_JOB_STATUS_TEMPLATE_PROPERTY_KEY . toString ( ) } ; // get templates amount int amount = templateNames . length ; // get template encoding value String encoding = this . getConfigurationValue ( FaxJob2HTTPRequestConverterConfigurationConstants . TEMPLATE_ENCODING_PROPERTY_KEY ) ; String templateName = null ; String urlStr = null ; URL url = null ; String template = null ; for ( int index = 0 ; index < amount ; index ++ ) { // get next element templateName = templateNames [ index ] ; // get URL string urlStr = this . getConfigurationValue ( templateName ) ; if ( urlStr != null ) { try { // create URL url = new URL ( urlStr ) ; // read template InputStream stream = url . openStream ( ) ; Reader reader = IOHelper . createReader ( stream , encoding ) ; template = IOHelper . readTextStream ( reader ) ; // cache template this . httpRequestTemplateMap . put ( templateName , template ) ; } catch ( Throwable throwable ) { throw new FaxException ( "Unable to load template for URL: " + urlStr , throwable ) ; } } }
public class CfgParser { /** * Computes the marginal distribution over CFG parses given terminals . * @ param terminals * @ param useSumProduct * @ return */ public CfgParseChart parseMarginal ( List < ? > terminals , boolean useSumProduct ) { } }
Factor rootDist = TableFactor . unity ( parentVar ) ; return parseMarginal ( terminals , rootDist , useSumProduct ) ;
public class JPEGImageReader { /** * TODO : Util method ? */ static byte [ ] readFully ( DataInput stream , int len ) throws IOException { } }
if ( len == 0 ) { return null ; } byte [ ] data = new byte [ len ] ; stream . readFully ( data ) ; return data ;
public class GlobalizationPreferences { /** * Sets the timezone ID . If this has not been set , uses default for territory . * @ param timezone a valid TZID ( see UTS # 35 ) . * @ return this , for chaining * @ hide draft / provisional / internal are hidden on Android */ public GlobalizationPreferences setTimeZone ( TimeZone timezone ) { } }
if ( isFrozen ( ) ) { throw new UnsupportedOperationException ( "Attempt to modify immutable object" ) ; } this . timezone = ( TimeZone ) timezone . clone ( ) ; // clone for safety ; return this ;
public class ProbeMethodAdapter { /** * Generate the instruction sequence needed to " unbox " the boxed data at * the top of stack . * @ param type the < code > Type < / code > associated with the unboxed data */ protected void unbox ( final Type type ) { } }
switch ( type . getSort ( ) ) { case Type . BOOLEAN : visitTypeInsn ( CHECKCAST , "java/lang/Boolean" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Boolean" , "booleanValue" , "()Z" , false ) ; break ; case Type . BYTE : visitTypeInsn ( CHECKCAST , "java/lang/Byte" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Byte" , "byteValue" , "()B" , false ) ; break ; case Type . CHAR : visitTypeInsn ( CHECKCAST , "java/lang/Character" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Character" , "charValue" , "()C" , false ) ; break ; case Type . DOUBLE : visitTypeInsn ( CHECKCAST , "java/lang/Double" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Double" , "doubleValue" , "()D" , false ) ; break ; case Type . FLOAT : visitTypeInsn ( CHECKCAST , "java/lang/Float" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Float" , "floatValue" , "()F" , false ) ; break ; case Type . INT : visitTypeInsn ( CHECKCAST , "java/lang/Integer" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Integer" , "intValue" , "()I" , false ) ; break ; case Type . LONG : visitTypeInsn ( CHECKCAST , "java/lang/Long" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Long" , "longValue" , "()J" , false ) ; break ; case Type . SHORT : visitTypeInsn ( CHECKCAST , "java/lang/Short" ) ; visitMethodInsn ( INVOKEVIRTUAL , "java/lang/Short" , "shortValue" , "()S" , false ) ; break ; case Type . ARRAY : case Type . OBJECT : visitTypeInsn ( CHECKCAST , type . getInternalName ( ) ) ; break ; default : break ; }
public class Settings { /** * Logs the properties . This will not log any properties that contain * ' password ' in the key . * @ param header the header to print with the log message * @ param properties the properties to log */ private void logProperties ( @ NotNull final String header , @ NotNull final Properties properties ) { } }
if ( LOGGER . isDebugEnabled ( ) ) { final StringWriter sw = new StringWriter ( ) ; try ( final PrintWriter pw = new PrintWriter ( sw ) ) { pw . format ( "%s:%n%n" , header ) ; final Enumeration < ? > e = properties . propertyNames ( ) ; while ( e . hasMoreElements ( ) ) { final String key = ( String ) e . nextElement ( ) ; if ( key . contains ( "password" ) ) { pw . format ( "%s='*****'%n" , key ) ; } else { final String value = properties . getProperty ( key ) ; if ( value != null ) { pw . format ( "%s='%s'%n" , key , value ) ; } } } pw . flush ( ) ; LOGGER . debug ( sw . toString ( ) ) ; } }
public class AuthorizationManager { /** * delete authorizations / / / / / */ public void deleteAuthorizationsByResourceId ( Resource resource , String resourceId ) { } }
if ( resourceId == null ) { throw new IllegalArgumentException ( "Resource id cannot be null" ) ; } if ( isAuthorizationEnabled ( ) ) { Map < String , Object > deleteParams = new HashMap < String , Object > ( ) ; deleteParams . put ( "resourceType" , resource . resourceType ( ) ) ; deleteParams . put ( "resourceId" , resourceId ) ; getDbEntityManager ( ) . delete ( AuthorizationEntity . class , "deleteAuthorizationsForResourceId" , deleteParams ) ; }
public class EntityClassReader { /** * Wraps the given object in a feature interface . This method will first validate whether the * class it represents is indeed a feature ( containing exactly one geometry and id ) and will then * generate a wrapper around the original object that obeys to the Feature interface . * If this method is invoked multiple times on the same object , the same wrapper will be returned in * each of these calls . * @ param objectToTransform the object for which a feature is desired . * @ return a feature wrapper around the given object * @ throws InvalidObjectReaderException If the class of objectToTransform does not correspond with the entityclass * of this reader * @ throws IllegalArgumentException if the given objectToTransform is null */ public Feature asFeature ( Object objectToTransform ) throws InvalidObjectReaderException { } }
if ( objectToTransform == null ) { throw new IllegalArgumentException ( "Given object may not be null" ) ; } if ( objectToTransform . getClass ( ) != entityClass ) { throw new InvalidObjectReaderException ( "Class of target object does not correspond with entityclass of this reader." ) ; } Feature proxy = ( Feature ) Proxy . newProxyInstance ( entityClass . getClassLoader ( ) , new Class [ ] { Feature . class } , new ObjectInvocationHandler ( objectToTransform ) ) ; return proxy ;
public class RowBuilder { /** * timestamp valued column . * @ param name the column name */ public RowBuilder timestampCol ( String name ) { } }
Column column = new ColumnTimestamp ( _columns . size ( ) , name , _offset ) ; _offset += column . length ( ) ; _columns . add ( column ) ; return this ;
public class Parser { /** * Determines if a token stream contains only numeric tokens * @ param stream * @ return true if all tokens in the given stream can be parsed as an integer */ private boolean isAllNumeric ( TokenStream stream ) { } }
List < Token > tokens = ( ( NattyTokenSource ) stream . getTokenSource ( ) ) . getTokens ( ) ; for ( Token token : tokens ) { try { Integer . parseInt ( token . getText ( ) ) ; } catch ( NumberFormatException e ) { return false ; } } return true ;
public class TangoEnv { private static String readFile ( String filename ) throws FileNotFoundException , SecurityException , IOException { } }
FileInputStream fid = new FileInputStream ( filename ) ; int nb = fid . available ( ) ; byte [ ] inStr = new byte [ nb ] ; nb = fid . read ( inStr ) ; fid . close ( ) ; return new String ( inStr ) ;
public class StructrOAuthClient { /** * Build an OAuth2 server from the configured values for the given name . * @ param name * @ return server */ public static StructrOAuthClient getServer ( final String name ) { } }
String configuredOauthServers = Settings . OAuthServers . getValue ( ) ; String [ ] authServers = configuredOauthServers . split ( " " ) ; for ( String authServer : authServers ) { if ( authServer . equals ( name ) ) { String authLocation = Settings . getOrCreateStringSetting ( "oauth" , authServer , "authorization_location" ) . getValue ( "" ) ; String tokenLocation = Settings . getOrCreateStringSetting ( "oauth" , authServer , "token_location" ) . getValue ( "" ) ; String clientId = Settings . getOrCreateStringSetting ( "oauth" , authServer , "client_id" ) . getValue ( "" ) ; String clientSecret = Settings . getOrCreateStringSetting ( "oauth" , authServer , "client_secret" ) . getValue ( "" ) ; String redirectUri = Settings . getOrCreateStringSetting ( "oauth" , authServer , "redirect_uri" ) . getValue ( "" ) ; // Minumum required fields if ( clientId != null && clientSecret != null && redirectUri != null ) { Class serverClass = getServerClassForName ( name ) ; Class tokenResponseClass = getTokenResponseClassForName ( name ) ; if ( serverClass != null ) { StructrOAuthClient oauthServer ; try { oauthServer = ( StructrOAuthClient ) serverClass . newInstance ( ) ; oauthServer . init ( authLocation , tokenLocation , clientId , clientSecret , redirectUri , tokenResponseClass ) ; logger . info ( "Using OAuth server {}" , oauthServer ) ; return oauthServer ; } catch ( Throwable t ) { logger . error ( "Could not instantiate auth server" , t ) ; } } else { logger . warn ( "No OAuth provider found for name {}, ignoring." , name ) ; } } } } return null ;
public class FastHDLC { /** * Returns a data character if available , logical OR ' d with zero or more of RETURN _ COMPLETE _ FLAG , RETURN _ DISCARD _ FLAG , and * RETURN _ EMPTY _ FLAG , signifying a complete frame , a discarded frame , or there is nothing to return . */ public int fasthdlc_rx_run ( HdlcState h ) { } }
int next ; int retval = RETURN_EMPTY_FLAG ; while ( ( h . bits >= minbits [ h . state ] ) && ( retval == RETURN_EMPTY_FLAG ) ) { /* * Run until we can no longer be assured that we will have enough bits to continue */ switch ( h . state ) { case FRAME_SEARCH : /* * Look for an HDLC frame , keying from the top byte . */ next = hdlc_search [ ( h . data >> 24 ) & 0xff ] ; h . bits -= next & 0x0f ; h . data <<= next & 0x0f ; h . state = ( next >> 4 ) & 0xff ; h . ones = 0 ; break ; case PROCESS_FRAME : /* Process as much as the next ten bits */ next = hdlc_frame [ h . ones ] [ ( h . data >>> 22 ) & 0x3ff ] ; // Must be 10 bits here , not 8 , that ' s all // next = hdlc _ frame _ precalc ( h . ones , ( h . data > > 22 ) & 0x3ff ) ; h . bits -= ( ( ( next & 0x0f00 ) >> 8 ) & 0xff ) ; h . data <<= ( ( ( next & 0x0f00 ) >> 8 ) & 0xff ) ; h . state = ( ( next & STATE_MASK ) >> 15 ) & 0xff ; h . ones = ( ( ( next & ONES_MASK ) >> 12 ) & 0xff ) ; switch ( next & STATUS_MASK ) { case STATUS_CONTROL : if ( ( next & CONTROL_COMPLETE ) != 0 ) { /* A complete , valid frame received */ retval = ( RETURN_COMPLETE_FLAG ) ; /* Stay in this state */ h . state = 1 ; } else { /* An abort ( either out of sync of explicit ) */ retval = ( RETURN_DISCARD_FLAG ) ; } break ; case STATUS_VALID : retval = ( next & DATA_MASK ) ; } } } return retval ;
public class CacheSupport { /** * a generic type at all here , just to be sure */ @ Override public List values ( CacheKeyFilter filter ) throws IOException { } }
if ( CacheUtil . allowAll ( filter ) ) return values ( ) ; List < String > keys = keys ( ) ; List < Object > list = new ArrayList < Object > ( ) ; Iterator < String > it = keys . iterator ( ) ; String key ; while ( it . hasNext ( ) ) { key = it . next ( ) ; if ( filter . accept ( key ) ) { CacheEntry ce = getQuiet ( key , null ) ; if ( ce != null ) // possible that the entry is gone since keys ( ) ; call above list . add ( ce . getValue ( ) ) ; } } return list ;