signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AmazonAlexaForBusinessClient { /** * Disassociates a device from its current room . The device continues to be connected to the Wi - Fi network and is * still registered to the account . The device settings and skills are removed from the room . * @ param disassociateDeviceFromRoomRequest * @ return Result of the DisassociateDeviceFromRoom operation returned by the service . * @ throws ConcurrentModificationException * There is a concurrent modification of resources . * @ throws DeviceNotRegisteredException * The request failed because this device is no longer registered and therefore no longer managed by this * account . * @ sample AmazonAlexaForBusiness . DisassociateDeviceFromRoom * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / alexaforbusiness - 2017-11-09 / DisassociateDeviceFromRoom " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DisassociateDeviceFromRoomResult disassociateDeviceFromRoom ( DisassociateDeviceFromRoomRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDisassociateDeviceFromRoom ( request ) ;
public class DirectedGraph { /** * Adds the edge and its nodes if not already present in the graph . */ public void add ( E edge ) { } }
if ( ! edge . added ) { edges . add ( edge ) ; edge . added = true ; add ( edge . getChild ( ) ) ; add ( edge . getParent ( ) ) ; }
public class BaseRecordMessageListener { /** * Constructor . */ public void free ( ) { } }
super . free ( ) ; if ( m_closeOnFreeBehavior != null ) if ( m_record != null ) { FileListener listener = m_closeOnFreeBehavior ; m_closeOnFreeBehavior = null ; m_record . removeListener ( listener , false ) ; }
public class ImgCompressUtils { /** * 根据宽或者高和指定压缩质量进行等比例压缩 , 注意如果指定的宽或者高大于源图片的高或者宽 , * 那么压缩图片将直接使用源图片的宽高 。 * 注 : 若isForceWh为true , 不论如何均按照指定宽高进行等比例压缩 * @ param srcImg 源图片地址 * @ param base 指定压缩后图片的宽或者高 * @ param wh 此参数用于指定base参数是宽还是高 , 该参数应由 { @ link ImgCompressUtils } 里的 * 静态常量指定 * @ param quality 指定压缩质量 , 范围 [ 0.0,1.0 ] , 如果指定为null则按照默认值 * @ param isForceWh 指定是否强制使用指定宽高进行等比例压缩 , true代表强制 , false反之 * @ return 返回压缩后的图像对象 */ public static BufferedImage imgCompressByScale ( Image srcImg , double base , int wh , Float quality , boolean isForceWh ) { } }
int width = 0 ; int height = 0 ; BufferedImage bufferedImage = null ; try { if ( wh == ImgCompressUtils . HEIGHT ) { if ( base > srcImg . getHeight ( null ) && ! isForceWh ) { width = srcImg . getWidth ( null ) ; height = srcImg . getHeight ( null ) ; } else { // 根据高度等比例设置宽高 height = ( int ) Math . floor ( base ) ; width = ( int ) Math . floor ( ( srcImg . getWidth ( null ) * base / srcImg . getHeight ( null ) ) ) ; } } else if ( wh == ImgCompressUtils . WIDTH ) { // 根据宽度等比例设置宽高 if ( base > srcImg . getWidth ( null ) && ! isForceWh ) { height = srcImg . getHeight ( null ) ; width = srcImg . getWidth ( null ) ; } else { width = ( int ) Math . floor ( base ) ; height = ( int ) Math . floor ( ( srcImg . getHeight ( null ) * base / srcImg . getWidth ( null ) ) ) ; } } else if ( wh == ImgCompressUtils . NO_CHANGE ) { // 不改变原始宽高 height = srcImg . getHeight ( null ) ; width = srcImg . getWidth ( null ) ; } else { throw new Exception ( "wh参数指定值不正确" ) ; } // 指定目标图像 BufferedImage desImg = new BufferedImage ( width , height , BufferedImage . TYPE_3BYTE_BGR ) ; // 绘制目标图像 desImg . getGraphics ( ) . drawImage ( srcImg , 0 , 0 , width , height , null ) ; bufferedImage = encodeImg ( desImg , quality ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } return bufferedImage ;
public class BeanUtils { /** * Fills a Java object with the provided values . The key of the map * corresponds to the name of the property to set . The value of the map * corresponds to the value to set on the Java object . * The keys can contain ' . ' to set nested values . * Override parameter allows to indicate which source has higher priority : * < ul > * < li > If true , then all values provided in the map will be always set on * the bean < / li > * < li > If false then there are two cases : * < ul > * < li > If the property value of the bean is null , then the value that comes * from the map is used < / li > * < li > If the property value of the bean is not null , then this value is * unchanged and the value in the map is not used < / li > * < / ul > * < / li > * < / ul > * Skip unknown parameter allows to indicate if execution should fail or * not : * < ul > * < li > If true and a property provided in the map doesn ' t exist , then there * is no failure and no change is applied to the bean < / li > * < li > If false and a property provided in the map doesn ' t exist , then the * method fails immediately . < / li > * < / ul > * @ param bean * the bean to populate * @ param values * the name / value pairs * @ param options * options used to * @ throws BeanException * when the bean couldn ' t be populated */ public static void populate ( Object bean , Map < String , Object > values , Options options ) throws BeanException { } }
try { for ( Entry < String , Object > entry : values . entrySet ( ) ) { populate ( bean , entry , options ) ; } } catch ( InvocationTargetException | IllegalAccessException e ) { throw new BeanException ( "Failed to populate bean" , bean , e ) ; }
public class NAPTRRecord { /** * Converts rdata to a String */ String rrToString ( ) { } }
StringBuffer sb = new StringBuffer ( ) ; sb . append ( order ) ; sb . append ( " " ) ; sb . append ( preference ) ; sb . append ( " " ) ; sb . append ( byteArrayToString ( flags , true ) ) ; sb . append ( " " ) ; sb . append ( byteArrayToString ( service , true ) ) ; sb . append ( " " ) ; sb . append ( byteArrayToString ( regexp , true ) ) ; sb . append ( " " ) ; sb . append ( replacement ) ; return sb . toString ( ) ;
public class ForkJoinPool { /** * Returns an estimate of the total number of tasks currently held * in queues by worker threads ( but not including tasks submitted * to the pool that have not begun executing ) . This value is only * an approximation , obtained by iterating across all threads in * the pool . This method may be useful for tuning task * granularities . * @ return the number of queued tasks */ public long getQueuedTaskCount ( ) { } }
long count = 0 ; WorkQueue [ ] ws ; WorkQueue w ; if ( ( ws = workQueues ) != null ) { for ( int i = 1 ; i < ws . length ; i += 2 ) { if ( ( w = ws [ i ] ) != null ) count += w . queueSize ( ) ; } } return count ;
public class JTables { /** * Convert all of the given model row indices to view row indices * for the given table * @ param table The table * @ param modelRows The model row indices * @ return The view row indices */ public static Set < Integer > convertRowIndicesToView ( JTable table , Iterable < ? extends Integer > modelRows ) { } }
Set < Integer > viewRows = new LinkedHashSet < Integer > ( ) ; for ( Integer modelRow : modelRows ) { int viewRow = table . convertRowIndexToView ( modelRow ) ; viewRows . add ( viewRow ) ; } return viewRows ;
public class WebSocketClientConnectorConfig { /** * Get sub protocols as a comma separated values string . * @ return a string of comma separated values of sub protocols . */ public String getSubProtocolsAsCSV ( ) { } }
if ( subProtocols == null ) { return null ; } String subProtocolsAsCSV = "" ; for ( String subProtocol : subProtocols ) { subProtocolsAsCSV = subProtocolsAsCSV . concat ( subProtocol + "," ) ; } subProtocolsAsCSV = subProtocolsAsCSV . substring ( 0 , subProtocolsAsCSV . length ( ) - 1 ) ; return subProtocolsAsCSV ;
public class DFA { /** * Calculates the minimum length of accepted string . For " if | while " * returns 2 . For " a * " returns 0. * @ return */ public int minDepth ( ) { } }
Map < DFAState < T > , Integer > indexOf = new NumMap < > ( ) ; Map < DFAState < T > , Integer > skip = new NumMap < > ( ) ; Deque < DFAState < T > > stack = new ArrayDeque < > ( ) ; DFAState < T > first = root ; return minDepth ( first , indexOf , stack , 0 ) ;
public class LineDocRecordReader { /** * / * ( non - Javadoc ) * @ see org . apache . hadoop . mapred . RecordReader # getProgress ( ) */ public float getProgress ( ) throws IOException { } }
if ( start == end ) { return 0.0f ; } else { return Math . min ( 1.0f , ( pos - start ) / ( float ) ( end - start ) ) ; }
public class BitvUnit { /** * JUnit Assertion to verify a { @ link URL } instance for accessibility . * @ param url { @ link java . net . URL } instance * @ param testable rule ( s ) to apply */ public static void assertAccessibility ( URL url , Testable testable ) { } }
assertThat ( url , is ( compliantTo ( testable ) ) ) ;
public class QueryInterfacePanel { /** * update the number of rows when the table change */ @ Override public void tableChanged ( TableModelEvent e ) { } }
int rows = ( ( TableModel ) e . getSource ( ) ) . getRowCount ( ) ; updateStatus ( rows ) ;
public class ServerChannelUpdaterDelegateImpl { /** * Populates the maps which contain the permission overwrites . */ private void populatePermissionOverwrites ( ) { } }
if ( overwrittenUserPermissions == null ) { overwrittenUserPermissions = new HashMap < > ( ) ; overwrittenUserPermissions . putAll ( ( ( ServerChannelImpl ) channel ) . getInternalOverwrittenUserPermissions ( ) ) ; } if ( overwrittenRolePermissions == null ) { overwrittenRolePermissions = new HashMap < > ( ) ; overwrittenRolePermissions . putAll ( ( ( ServerChannelImpl ) channel ) . getInternalOverwrittenRolePermissions ( ) ) ; }
public class Reductions { /** * Yields true if ANY predicate application on the given array yields true * ( giving up on the first positive match ) . * @ param < E > the array element type parameter * @ param array the array where elements are fetched from * @ param predicate the predicate applied to every element until a match is * found * @ return true if ANY predicate application yields true ( gives up on the * first positive match ) */ public static < E > boolean any ( E [ ] array , Predicate < E > predicate ) { } }
return new Any < E > ( predicate ) . test ( new ArrayIterator < E > ( array ) ) ;
public class Bits { /** * Reads an AsciiString from buf . The length is read first , followed by the chars . Each char is a single byte * @ param in the input stream * @ return the string read from buf */ public static AsciiString readAsciiString ( DataInput in ) throws IOException { } }
short len = in . readShort ( ) ; if ( len < 0 ) return null ; AsciiString retval = new AsciiString ( len ) ; in . readFully ( retval . chars ( ) ) ; return retval ;
public class Assistant { /** * Update entity value synonym . * Update an existing entity value synonym with new text . * This operation is limited to 1000 requests per 30 minutes . For more information , see * * Rate limiting * * . * @ param updateSynonymOptions the { @ link UpdateSynonymOptions } containing the options for the call * @ return a { @ link ServiceCall } with a response type of { @ link Synonym } */ public ServiceCall < Synonym > updateSynonym ( UpdateSynonymOptions updateSynonymOptions ) { } }
Validator . notNull ( updateSynonymOptions , "updateSynonymOptions cannot be null" ) ; String [ ] pathSegments = { "v1/workspaces" , "entities" , "values" , "synonyms" } ; String [ ] pathParameters = { updateSynonymOptions . workspaceId ( ) , updateSynonymOptions . entity ( ) , updateSynonymOptions . value ( ) , updateSynonymOptions . synonym ( ) } ; RequestBuilder builder = RequestBuilder . post ( RequestBuilder . constructHttpUrl ( getEndPoint ( ) , pathSegments , pathParameters ) ) ; builder . query ( "version" , versionDate ) ; Map < String , String > sdkHeaders = SdkCommon . getSdkHeaders ( "conversation" , "v1" , "updateSynonym" ) ; for ( Entry < String , String > header : sdkHeaders . entrySet ( ) ) { builder . header ( header . getKey ( ) , header . getValue ( ) ) ; } builder . header ( "Accept" , "application/json" ) ; final JsonObject contentJson = new JsonObject ( ) ; if ( updateSynonymOptions . newSynonym ( ) != null ) { contentJson . addProperty ( "synonym" , updateSynonymOptions . newSynonym ( ) ) ; } builder . bodyJson ( contentJson ) ; return createServiceCall ( builder . build ( ) , ResponseConverterUtils . getObject ( Synonym . class ) ) ;
public class AlignedBox3d { /** * Change the frame of the box . * @ param x1 is the coordinate of the first corner . * @ param y1 is the coordinate of the first corner . * @ param z1 is the coordinate of the first corner . * @ param x2 is the coordinate of the second corner . * @ param y2 is the coordinate of the second corner . * @ param z2 is the coordinate of the second corner . */ @ Override public void setFromCorners ( double x1 , double y1 , double z1 , double x2 , double y2 , double z2 ) { } }
if ( x1 < x2 ) { this . minxProperty . set ( x1 ) ; this . maxxProperty . set ( x2 ) ; } else { this . minxProperty . set ( x2 ) ; this . maxxProperty . set ( x1 ) ; } if ( y1 < y2 ) { this . minyProperty . set ( y1 ) ; this . maxyProperty . set ( y2 ) ; } else { this . minyProperty . set ( y2 ) ; this . maxyProperty . set ( y1 ) ; } if ( z1 < z2 ) { this . minzProperty . set ( z1 ) ; this . maxzProperty . set ( z2 ) ; } else { this . minzProperty . set ( z2 ) ; this . maxzProperty . set ( z1 ) ; }
public class ResultPacketFactory { /** * private static EOFPacket eof = new EOFPacket ( ) ; */ public static ResultPacket createResultPacket ( final RawPacket rawPacket ) throws IOException { } }
byte b = rawPacket . getByteBuffer ( ) . get ( 0 ) ; switch ( b ) { case ERROR : return new ErrorPacket ( rawPacket ) ; case OK : return new OKPacket ( rawPacket ) ; case EOF : return new EOFPacket ( rawPacket ) ; default : return new ResultSetPacket ( rawPacket ) ; }
public class TreePattern { /** * Compiles the given tree pattern string . * @ param pattern the tree pattern string * @ return the compiled pattern * @ throws NullPointerException if the given pattern is { @ code null } * @ throws IllegalArgumentException if the given parentheses tree string * doesn ' t represent a valid pattern tree */ public static TreePattern compile ( final String pattern ) { } }
return new TreePattern ( TreeNode . parse ( pattern , Decl :: of ) ) ;
public class SqlpKit { /** * make SqlPara use the model with attr datas . * @ param model * @ columns fetch columns */ public static SqlPara selectOne ( ModelExt < ? > model , String ... columns ) { } }
return SqlpKit . select ( model , FLAG . ONE , columns ) ;
public class ForkJoinPool { /** * If worker w exists and is active , enqueues and sets status to inactive . * @ param w the worker * @ param ss current ( non - negative ) scanState */ private void inactivate ( WorkQueue w , int ss ) { } }
int ns = ( ss + SS_SEQ ) | UNSIGNALLED ; long lc = ns & SP_MASK , nc , c ; if ( w != null ) { w . scanState = ns ; do { nc = lc | ( UC_MASK & ( ( c = ctl ) - AC_UNIT ) ) ; w . stackPred = ( int ) c ; } while ( ! U . compareAndSwapLong ( this , CTL , c , nc ) ) ; }
public class RouterClient { /** * Creates a Router resource in the specified project and region using the data included in the * request . * < p > Sample code : * < pre > < code > * try ( RouterClient routerClient = RouterClient . create ( ) ) { * ProjectRegionName region = ProjectRegionName . of ( " [ PROJECT ] " , " [ REGION ] " ) ; * Router routerResource = Router . newBuilder ( ) . build ( ) ; * Operation response = routerClient . insertRouter ( region , routerResource ) ; * < / code > < / pre > * @ param region Name of the region for this request . * @ param routerResource Router resource . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ @ BetaApi public final Operation insertRouter ( ProjectRegionName region , Router routerResource ) { } }
InsertRouterHttpRequest request = InsertRouterHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . setRouterResource ( routerResource ) . build ( ) ; return insertRouter ( request ) ;
public class PasswordUtil { /** * Gets the byte array of the given password from using UTF - 8 encoding . * @ param password the string of the password to encode . * @ return the byte array representation of the text string */ @ Sensitive public static byte [ ] getByteArrayPassword ( @ Sensitive String password ) throws WIMSystemException { } }
String METHODNAME = "getByteArrayPassword" ; try { if ( password != null ) { return password . getBytes ( "UTF-8" ) ; } else { return null ; } } catch ( java . io . UnsupportedEncodingException e ) { if ( tc . isErrorEnabled ( ) ) { Tr . error ( tc , WIMMessageKey . GENERIC , WIMMessageHelper . generateMsgParms ( e . toString ( ) ) ) ; } throw new WIMSystemException ( WIMMessageKey . GENERIC , Tr . formatMessage ( tc , WIMMessageKey . GENERIC , WIMMessageHelper . generateMsgParms ( e . toString ( ) ) ) ) ; }
public class ModifiersPreprocessor { /** * Returns the declared and inherited fields of the specified class . * @ param type the class whose fields to list * @ return a list of fields */ private static List < Field > getAllFields ( Class type ) { } }
final List < Field > fields = new ArrayList < > ( ) ; for ( Class < ? > c = type ; c != null ; c = c . getSuperclass ( ) ) { fields . addAll ( Arrays . asList ( c . getDeclaredFields ( ) ) ) ; } return fields ;
public class ZipUtils { /** * The method decompresses the string using gzip . * @ param text The string to decompress . * @ return The decompressed string . * @ throws java . io . IOException Does some thing in old style . * @ deprecated use { @ link # decompressString ( String ) } instead . */ public static String decompress ( String text ) throws IOException { } }
if ( text == null || text . length ( ) == 0 ) { return text ; } // byte [ ] bytes = new BASE64Decoder ( ) . decodeBuffer ( text ) ; byte [ ] bytes = Base64 . decodeBase64 ( text ) ; try ( GZIPInputStream gis = new GZIPInputStream ( new ByteArrayInputStream ( bytes ) ) ; BufferedReader bf = new BufferedReader ( new InputStreamReader ( gis , UTF_8 ) ) ; ) { StringBuilder outStr = new StringBuilder ( ) ; String line ; while ( ( line = bf . readLine ( ) ) != null ) { outStr . append ( line ) ; } return outStr . toString ( ) ; }
public class Project { /** * A collection of sub - projects that belong to this project . * @ param filter Criteria to filter on . Project will be set automatically . * If null , all child projects in the project are returned . * @ param includeSubprojects Specifies whether to include items from * sub - project or not . This only adds open subprojects . * @ return A collection projects that belong to this project filtered by the * passed in filter . */ public Collection < Project > getChildProjects ( ProjectFilter filter , boolean includeSubprojects ) { } }
if ( filter == null ) { filter = new ProjectFilter ( ) ; } filter . parent . clear ( ) ; if ( includeSubprojects ) { filter . parent . addAll ( getThisAndAllChildProjects ( ) ) ; } else { filter . parent . add ( this ) ; } return getInstance ( ) . get ( ) . projects ( filter ) ;
public class SystemKeyspace { /** * Return a map of stored tokens to IP addresses */ public static SetMultimap < InetAddress , Token > loadTokens ( ) { } }
SetMultimap < InetAddress , Token > tokenMap = HashMultimap . create ( ) ; for ( UntypedResultSet . Row row : executeInternal ( "SELECT peer, tokens FROM system." + PEERS_CF ) ) { InetAddress peer = row . getInetAddress ( "peer" ) ; if ( row . has ( "tokens" ) ) tokenMap . putAll ( peer , deserializeTokens ( row . getSet ( "tokens" , UTF8Type . instance ) ) ) ; } return tokenMap ;
public class ViewFetcher { /** * Returns the most recent view container * @ param views the views to check * @ return the most recent view container */ private final View getRecentContainer ( View [ ] views ) { } }
View container = null ; long drawingTime = 0 ; View view ; for ( int i = 0 ; i < views . length ; i ++ ) { view = views [ i ] ; if ( view != null && view . isShown ( ) && view . hasWindowFocus ( ) && view . getDrawingTime ( ) > drawingTime ) { container = view ; drawingTime = view . getDrawingTime ( ) ; } } return container ;
public class DisassociateServiceRoleFromAccountRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DisassociateServiceRoleFromAccountRequest disassociateServiceRoleFromAccountRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( disassociateServiceRoleFromAccountRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ListActivatedRulesInRuleGroupResult { /** * An array of < code > ActivatedRules < / code > objects . * @ param activatedRules * An array of < code > ActivatedRules < / code > objects . */ public void setActivatedRules ( java . util . Collection < ActivatedRule > activatedRules ) { } }
if ( activatedRules == null ) { this . activatedRules = null ; return ; } this . activatedRules = new java . util . ArrayList < ActivatedRule > ( activatedRules ) ;
public class UcumEssenceService { /** * / * ( non - Javadoc ) * @ see org . eclipse . ohf . ucum . UcumServiceEx # validate ( java . lang . String ) */ @ Override public String validate ( String unit ) { } }
assert unit != null : paramError ( "validate" , "unit" , "must not be null" ) ; try { new ExpressionParser ( model ) . parse ( unit ) ; return null ; } catch ( Exception e ) { return e . getMessage ( ) ; }
public class PatchParser { /** * http : / / en . wikipedia . org / wiki / Diff _ utility # Unified _ format */ public static Optional < Integer > findLineInDiff ( final String patchString , final Integer lineToComment ) { } }
if ( patchString == null ) { return Optional . empty ( ) ; } int currentLine = - 1 ; int patchLocation = 0 ; for ( final String line : patchString . split ( "\n" ) ) { if ( line . startsWith ( "@" ) ) { final Matcher matcher = Pattern . compile ( "@@\\p{IsWhite_Space}-[0-9]+(?:,[0-9]+)?\\p{IsWhite_Space}\\+([0-9]+)(?:,[0-9]+)?\\p{IsWhite_Space}@@.*" ) . matcher ( line ) ; if ( ! matcher . matches ( ) ) { throw new IllegalStateException ( "Unable to parse patch line " + line + "\nFull patch: \n" + patchString ) ; } currentLine = Integer . parseInt ( matcher . group ( 1 ) ) ; } else if ( line . startsWith ( "+" ) || line . startsWith ( " " ) ) { // Added or unmodified if ( currentLine == lineToComment ) { return Optional . ofNullable ( patchLocation ) ; } currentLine ++ ; } patchLocation ++ ; } return Optional . empty ( ) ;
public class NetworkInterface { /** * A list of the security groups associated with the network interface . Includes the groupId and groupName . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setSecurityGroups ( java . util . Collection ) } or { @ link # withSecurityGroups ( java . util . Collection ) } if you want * to override the existing values . * @ param securityGroups * A list of the security groups associated with the network interface . Includes the groupId and groupName . * @ return Returns a reference to this object so that method calls can be chained together . */ public NetworkInterface withSecurityGroups ( SecurityGroup ... securityGroups ) { } }
if ( this . securityGroups == null ) { setSecurityGroups ( new java . util . ArrayList < SecurityGroup > ( securityGroups . length ) ) ; } for ( SecurityGroup ele : securityGroups ) { this . securityGroups . add ( ele ) ; } return this ;
public class ComponentOriginalVisitor { /** * find the visitable component from container , and execute it ' s accept * method , the return result is the tager service object . */ public Object visit ( ) { } }
Object o = null ; try { ContainerWrapper containerWrapper = containerCallback . getContainerWrapper ( ) ; TargetMetaRequest targetMetaRequest = targetMetaRequestsHolder . getTargetMetaRequest ( ) ; Debug . logVerbose ( "[JdonFramework] ComponentOriginalVisitor active:" + targetMetaRequest . getVisitableName ( ) , module ) ; // targetMetaRequest . setVisitableName change the value Visitable vo = ( Visitable ) containerWrapper . lookup ( targetMetaRequest . getVisitableName ( ) ) ; o = vo . accept ( ) ; } catch ( Exception ex ) { Debug . logError ( "[JdonFramework] ComponentOriginalVisitor active error: " + ex ) ; } return o ;
public class Searcher { /** * Excises a model to the given elements . * @ param result elements to excise to * @ return excised model */ private static Model excise ( Set < BioPAXElement > result ) { } }
Completer c = new Completer ( EM ) ; result = c . complete ( result ) ; Cloner cln = new Cloner ( EM , BioPAXLevel . L3 . getDefaultFactory ( ) ) ; return cln . clone ( result ) ;
public class ScheduleExpressionParser { /** * Parses the specified attribute of this parsers schedule expression and * stores the result in parsedExpr . This method sets the ivAttr , ivString , * and ivPos member variables that are accessed by other parsing methods . * Only ivPos should be modified by those other methods . * @ param parsedExpr the object in which to store the result * @ param attr the attribute being parsed * @ param string the value of the attribute from the schedule expression * @ throws ScheduleExpressionParserException if the expression contains an * invalid attribute value */ private void parseAttribute ( ParsedScheduleExpression parsedExpr , Attribute attr , String string ) { } }
// Reset state . ivAttr = attr ; ivString = string ; ivPos = 0 ; if ( string == null ) { // d660135 - Per CTS , null values must be rejected rather than being // translated to the default attribute value . error ( ScheduleExpressionParserException . Error . VALUE ) ; } // Loop for lists : " x , x , . . . " for ( boolean inList = false ; ; inList = true ) { skipWhitespace ( ) ; int value = readSingleValue ( ) ; skipWhitespace ( ) ; // Ranges : " x - x " if ( ivPos < ivString . length ( ) && ivString . charAt ( ivPos ) == '-' ) { ivPos ++ ; skipWhitespace ( ) ; int maxValue = readSingleValue ( ) ; skipWhitespace ( ) ; if ( value == ENCODED_WILD_CARD || maxValue == ENCODED_WILD_CARD ) { error ( ScheduleExpressionParserException . Error . RANGE_BOUND ) ; // F743-506 } attr . addRange ( parsedExpr , value , maxValue ) ; } // Increments : " x / x " else if ( ivPos < ivString . length ( ) && ivString . charAt ( ivPos ) == '/' ) { ivPos ++ ; skipWhitespace ( ) ; int interval = readSingleValue ( ) ; skipWhitespace ( ) ; if ( interval == ENCODED_WILD_CARD ) { error ( ScheduleExpressionParserException . Error . INCREMENT_INTERVAL ) ; // F743-506 } if ( inList ) { error ( ScheduleExpressionParserException . Error . LIST_VALUE ) ; // F743-506 } if ( ! ivAttr . isIncrementable ( ) ) { error ( ScheduleExpressionParserException . Error . UNINCREMENTABLE ) ; // F743-506 } if ( value == ENCODED_WILD_CARD ) { value = 0 ; } if ( interval == 0 ) { // "30/0 " is interpreted as the single value " 30 " . attr . add ( parsedExpr , value ) ; } else { for ( ; value <= ivAttr . getMax ( ) ; value += interval ) { attr . add ( parsedExpr , value ) ; } } break ; } // Wild cards : " * " else if ( value == ENCODED_WILD_CARD ) { if ( inList ) { error ( ScheduleExpressionParserException . Error . LIST_VALUE ) ; // F743-506 } attr . setWildCard ( parsedExpr ) ; break ; } // Single values else { attr . add ( parsedExpr , value ) ; } if ( ivPos >= ivString . length ( ) || ivString . charAt ( ivPos ) != ',' ) { break ; } // Skip the comma ivPos ++ ; } skipWhitespace ( ) ; if ( ivPos < ivString . length ( ) ) { error ( ScheduleExpressionParserException . Error . VALUE ) ; // F743-506 }
public class WebServiceTemplateBuilder { /** * Indicates whether the connection should be checked for fault indicators * ( { @ code true } ) , or whether we should rely on the message only ( { @ code false } ) . * @ param checkConnectionForFault whether to check for fault indicators * @ return a new builder instance . * @ see WebServiceTemplate # setCheckConnectionForFault ( boolean ) */ public WebServiceTemplateBuilder setCheckConnectionForFault ( boolean checkConnectionForFault ) { } }
return new WebServiceTemplateBuilder ( this . detectHttpMessageSender , this . interceptors , append ( this . internalCustomizers , new CheckConnectionFaultCustomizer ( checkConnectionForFault ) ) , this . customizers , this . messageSenders , this . marshaller , this . unmarshaller , this . destinationProvider , this . transformerFactoryClass , this . messageFactory ) ;
public class Functions { /** * Runs current date function with arguments . * @ return */ public static String currentDate ( TestContext context ) { } }
return new CurrentDateFunction ( ) . execute ( Collections . < String > emptyList ( ) , context ) ;
public class TargetField { /** * Returns the range of categories for this categorical or ordinal field . * @ return A non - empty list , or < code > null < / code > . * @ see # getOpType ( ) * @ see CategoricalResultFeature * @ see CategoricalResultFeature # getCategories ( ) */ public List < String > getCategories ( ) { } }
List < String > categories = FieldUtil . getCategories ( getField ( ) ) ; if ( categories != null && ! categories . isEmpty ( ) ) { return categories ; } return null ;
public class Credentials { /** * Read username and password from the request ' s { @ code Authorization } header and create a { @ code Credentials } * object . Requires authorization header to be base64 encoded . * @ param request incoming http request * @ return { @ code Optional } with parsed { @ code Credentials } if { @ code Authorization } header and credentials * are present , { @ code Optional . empty } otherwise . */ public static Optional < Credentials > readFrom ( HttpServletRequest request ) { } }
String authorizationHeader = request . getHeader ( "Authorization" ) ; if ( ! StringUtils . isEmpty ( authorizationHeader ) ) { String credentials = authorizationHeader . substring ( 6 , authorizationHeader . length ( ) ) ; String [ ] decodedCredentialParts = new String ( Base64Utils . decode ( credentials . getBytes ( ) ) ) . split ( ":" , 2 ) ; if ( ! decodedCredentialParts [ 0 ] . isEmpty ( ) && ! decodedCredentialParts [ 1 ] . isEmpty ( ) ) { return Optional . of ( new Credentials ( decodedCredentialParts [ 0 ] , decodedCredentialParts [ 1 ] ) ) ; } } return Optional . empty ( ) ;
public class VariableVisibilityAnalysis { /** * Determines the visibility class for each variable in root . */ @ Override public void process ( Node externs , Node root ) { } }
ReferenceCollectingCallback callback = new ReferenceCollectingCallback ( compiler , ReferenceCollectingCallback . DO_NOTHING_BEHAVIOR , new Es6SyntacticScopeCreator ( compiler ) ) ; callback . process ( root ) ; for ( Var variable : callback . getAllSymbols ( ) ) { ReferenceCollection referenceCollection = callback . getReferences ( variable ) ; VariableVisibility visibility ; if ( variableIsParameter ( variable ) ) { visibility = VariableVisibility . PARAMETER ; } else if ( variable . isLocal ( ) ) { if ( referenceCollection . isEscaped ( ) ) { visibility = VariableVisibility . CAPTURED_LOCAL ; } else { visibility = VariableVisibility . LOCAL ; } } else if ( variable . isGlobal ( ) ) { visibility = VariableVisibility . GLOBAL ; } else { throw new IllegalStateException ( "Un-handled variable visibility for " + variable ) ; } visibilityByDeclaringNameNode . put ( variable . getNameNode ( ) , visibility ) ; }
public class RoseWebAppContext { /** * 返回对应类型的唯一 Bean , 包括可能的祖先 { @ link ApplicationContext } 中对应类型的 Bean . * @ param beanType - Bean 的类型 * @ throws BeansException */ public < T > T getBean ( Class < T > beanType ) throws BeansException { } }
return beanType . cast ( BeanFactoryUtils . beanOfTypeIncludingAncestors ( this , beanType ) ) ;
public class ContactsApi { /** * Get corporation contacts Return contacts of a corporation - - - This route * is cached for up to 300 seconds SSO Scope : * esi - corporations . read _ contacts . v1 * @ param corporationId * An EVE corporation ID ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ param page * Which page of results to return ( optional , default to 1) * @ param token * Access token to use if unable to set a header ( optional ) * @ return List & lt ; CorporationContactsResponse & gt ; * @ throws ApiException * If fail to call the API , e . g . server error or cannot * deserialize the response body */ public List < CorporationContactsResponse > getCorporationsCorporationIdContacts ( Integer corporationId , String datasource , String ifNoneMatch , Integer page , String token ) throws ApiException { } }
ApiResponse < List < CorporationContactsResponse > > resp = getCorporationsCorporationIdContactsWithHttpInfo ( corporationId , datasource , ifNoneMatch , page , token ) ; return resp . getData ( ) ;
public class DescriptorList { /** * Gets the actual data store . This is the key to control the dual - mode nature of { @ link DescriptorList } */ private List < Descriptor < T > > store ( ) { } }
if ( type == null ) return legacy ; else return Jenkins . getInstance ( ) . < T , Descriptor < T > > getDescriptorList ( type ) ;
public class ModuleArchiver { /** * Adds a file or directory ( recursively ) to the archive directory if it is not already present * in the archive directory . * @ param relativeDir * the directory relative to the archive root directory which the specified file or * directory is added to * @ param fileOrDirToAdd * the file or directory to add * @ throws IOException * if an IO error occurs during copying */ public void addToArchive ( final File relativeDir , final File fileOrDirToAdd ) throws IOException { } }
checkArgument ( ! relativeDir . isAbsolute ( ) , "'relativeDir' must be a relative directory" ) ; if ( isArchivingDisabled ( ) ) { return ; } if ( fileOrDirToAdd . getCanonicalPath ( ) . startsWith ( moduleArchiveDir . getCanonicalPath ( ) ) ) { // File already in archive dir log . info ( "File '" + fileOrDirToAdd + "' already in archive directory. No copying necessary." ) ; return ; } File archiveTargetDir = new File ( moduleArchiveDir , relativeDir . getPath ( ) ) ; if ( fileOrDirToAdd . isDirectory ( ) ) { copyDirectory ( fileOrDirToAdd , archiveTargetDir ) ; } else { copyFileToDirectory ( fileOrDirToAdd , archiveTargetDir ) ; }
public class CountHashMap { /** * Set the count for the specified key . * @ return the old count . */ public int setCount ( K key , int count ) { } }
int [ ] val = get ( key ) ; if ( val == null ) { put ( key , new int [ ] { count } ) ; return 0 ; // old value } int oldVal = val [ 0 ] ; val [ 0 ] = count ; return oldVal ;
public class HashtableOnDisk { /** * isByteArray Find out if object is a byte array so we can avoid serialization * and subsequent deserialization . * @ param x the Object to inspect * @ return true if x is a byte array ( byte [ ] ) * @ return false if x is not a byte array */ static public boolean isByteArray ( Object x ) { } }
if ( x == null ) return false ; Class c = x . getClass ( ) ; if ( c . isArray ( ) ) { Class ct = c . getComponentType ( ) ; if ( ct == Byte . TYPE ) { return true ; } } return false ;
public class GetEndpointRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetEndpointRequest getEndpointRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getEndpointRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getEndpointRequest . getApplicationId ( ) , APPLICATIONID_BINDING ) ; protocolMarshaller . marshall ( getEndpointRequest . getEndpointId ( ) , ENDPOINTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ElemLiteralResult { /** * Throw a DOMException * @ param msg key of the error that occured . */ public void throwDOMException ( short code , String msg ) { } }
String themsg = XSLMessages . createMessage ( msg , null ) ; throw new DOMException ( code , themsg ) ;
public class ExtSSHExec { /** * Execute the command on the remote host . * @ exception BuildException Most likely a network error or bad parameter . */ public void execute ( ) throws BuildException { } }
if ( getHost ( ) == null ) { throw new BuildException ( "Host is required." ) ; } if ( getUserInfo ( ) . getName ( ) == null ) { throw new BuildException ( "Username is required." ) ; } if ( getUserInfo ( ) . getKeyfile ( ) == null && getUserInfo ( ) . getPassword ( ) == null && getSshKeyData ( ) == null ) { throw new BuildException ( "Password or Keyfile is required." ) ; } if ( command == null && commandResource == null ) { throw new BuildException ( "Command or commandResource is required." ) ; } if ( inputFile != null && inputProperty != null ) { throw new BuildException ( "You can't specify both inputFile and" + " inputProperty." ) ; } if ( inputFile != null && ! inputFile . exists ( ) ) { throw new BuildException ( "The input file " + inputFile . getAbsolutePath ( ) + " does not exist." ) ; } Session session = null ; StringBuffer output = new StringBuffer ( ) ; try { session = openSession ( ) ; if ( null != getDisconnectHolder ( ) ) { final Session sub = session ; getDisconnectHolder ( ) . setDisconnectable ( new Disconnectable ( ) { public void disconnect ( ) { sub . disconnect ( ) ; } } ) ; } /* called once */ if ( command != null ) { executeCommand ( session , command , output ) ; } else { // read command resource and execute for each command try { BufferedReader br = new BufferedReader ( new InputStreamReader ( commandResource . getInputStream ( ) ) ) ; String cmd ; while ( ( cmd = br . readLine ( ) ) != null ) { executeCommand ( session , cmd , output ) ; output . append ( "\n" ) ; } FileUtils . close ( br ) ; } catch ( IOException e ) { if ( getFailonerror ( ) ) { throw new BuildException ( e ) ; } else { log ( "Caught exception: " + e . getMessage ( ) , Project . MSG_ERR ) ; } } } } catch ( JSchException e ) { if ( getFailonerror ( ) ) { throw new BuildException ( e ) ; } else { log ( "Caught exception: " + e . getMessage ( ) , Project . MSG_ERR ) ; } } finally { try { if ( null != this . sshAgentProcess ) { this . sshAgentProcess . stopAgent ( ) ; } } catch ( IOException e ) { log ( "Caught exception: " + e . getMessage ( ) , Project . MSG_ERR ) ; } if ( outputProperty != null ) { getProject ( ) . setNewProperty ( outputProperty , output . toString ( ) ) ; } if ( session != null && session . isConnected ( ) ) { session . disconnect ( ) ; } }
public class ActionRequestProcessor { public VirtualAction createAction ( ActionRuntime runtime , ActionResponseReflector reflector ) { } }
return newGodHandableAction ( runtime , reflector , prepareVestibuleTxStage ( ) , getRequestManager ( ) ) ;
public class SetStoragePolicyTaskParameters { /** * Parses properties from task parameter string * @ param taskParameters - JSON formatted set of parameters */ public static SetStoragePolicyTaskParameters deserialize ( String taskParameters ) { } }
JaxbJsonSerializer < SetStoragePolicyTaskParameters > serializer = new JaxbJsonSerializer < > ( SetStoragePolicyTaskParameters . class ) ; try { SetStoragePolicyTaskParameters params = serializer . deserialize ( taskParameters ) ; // Verify expected parameters if ( null == params . getSpaceId ( ) || params . getSpaceId ( ) . isEmpty ( ) || null == params . getStorageClass ( ) || params . getStorageClass ( ) . isEmpty ( ) || null == params . daysToTransition || params . daysToTransition < 0 ) { throw new TaskDataException ( "Task parameter values may not be empty" ) ; } return params ; } catch ( IOException e ) { throw new TaskDataException ( "Unable to parse task parameters due to: " + e . getMessage ( ) ) ; }
public class FileSystem { /** * Replies the user configuration directory for the specified software . * < p > On Unix operating systems , the user directory for a * software is by default { @ code $ HOME / . software } where { @ code software } * is the given parameter ( case - sensitive ) . On Windows & reg ; operating systems , the user * directory for a software is by default * { @ code C : < span > \ < / span > Documents and Settings < span > \ < / span > userName < span > \ < / span > Local Settings < span > \ < / span > * Application Data < span > \ < / span > software } * where { @ code userName } is the login of the current user and { @ code software } * is the given parameter ( case - insensitive ) . * @ param software is the name of the concerned software . * @ return the configuration directory of the software for the current user . */ @ Pure public static String getUserConfigurationDirectoryNameFor ( String software ) { } }
final File directory = getUserConfigurationDirectoryFor ( software ) ; if ( directory != null ) { return directory . getAbsolutePath ( ) ; } return null ;
public class RobotUtil { /** * ctrl + 按键 * @ param key 按键 */ public static void keyPressWithCtrl ( int key ) { } }
robot . keyPress ( KeyEvent . VK_CONTROL ) ; robot . keyPress ( key ) ; robot . keyRelease ( key ) ; robot . keyRelease ( KeyEvent . VK_CONTROL ) ; delay ( ) ;
public class SDBaseOps { /** * Element - wise scalar minimum operation : out = min ( in , value ) * @ param in Input variable * @ param value Scalar value to compare * @ return Output variable */ public SDVariable scalarMin ( SDVariable in , Number value ) { } }
return scalarMin ( null , in , value ) ;
public class SmartsheetImpl { /** * Returns the { @ link ServerInfoResources } instance that provides access to ServerInfo resources . * @ return the ServerInfo resources */ public ServerInfoResources serverInfoResources ( ) { } }
if ( serverInfo . get ( ) == null ) { serverInfo . compareAndSet ( null , new ServerInfoResourcesImpl ( this ) ) ; } return serverInfo . get ( ) ;
public class JsonStyleParserHelper { /** * Create a style from a list of rules . * @ param styleRules the rules */ public Style createStyle ( final List < Rule > styleRules ) { } }
final Rule [ ] rulesArray = styleRules . toArray ( new Rule [ 0 ] ) ; final FeatureTypeStyle featureTypeStyle = this . styleBuilder . createFeatureTypeStyle ( null , rulesArray ) ; final Style style = this . styleBuilder . createStyle ( ) ; style . featureTypeStyles ( ) . add ( featureTypeStyle ) ; return style ;
public class SessionMgrCoordinator { /** * Since the location service is only used during SessionManager initialization , * we don ' t need to re - register the SessionManager service or restart applications * if there ' s a change to the location service . * @ param wsLocationAdmin the service used to determine the default session clone ID */ protected void setLocationService ( WsLocationAdmin wsLocationAdmin ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINER ) ) { LoggingUtil . SESSION_LOGGER_CORE . entering ( CLASS_NAME , "setLocationService" , wsLocationAdmin ) ; } this . wsLocationAdmin = wsLocationAdmin ; if ( TraceComponent . isAnyTracingEnabled ( ) && LoggingUtil . SESSION_LOGGER_CORE . isLoggable ( Level . FINER ) ) { LoggingUtil . SESSION_LOGGER_CORE . exiting ( CLASS_NAME , "setLocationService" ) ; }
public class NutDaoStarter { /** * 返回值不能是CacheManager , 因为要考虑没有加ehcache的情况 */ protected Object getCacheManager ( ) { } }
CacheManager cacheManager = CacheManager . getInstance ( ) ; if ( cacheManager != null ) return cacheManager ; return CacheManager . newInstance ( ) ;
public class CacheEventListenerConfigurationBuilder { /** * Adds specific { @ link EventOrdering } to the returned builder . * < ul > * < li > { @ link EventOrdering } defaults to { @ link EventOrdering # UNORDERED } < / li > * < / ul > * @ param eventOrdering the { @ code EventOrdering } to use * @ return a new builder with the specified event ordering * @ see # ordered ( ) * @ see # unordered ( ) */ public CacheEventListenerConfigurationBuilder eventOrdering ( EventOrdering eventOrdering ) { } }
CacheEventListenerConfigurationBuilder otherBuilder = new CacheEventListenerConfigurationBuilder ( this ) ; otherBuilder . eventOrdering = eventOrdering ; return otherBuilder ;
public class UriEscape { /** * Perform am URI query parameter ( name or value ) < strong > unescape < / strong > operation * on a < tt > char [ ] < / tt > input using < tt > UTF - 8 < / tt > as encoding . * This method will unescape every percent - encoded ( < tt > % HH < / tt > ) sequences present in input , * even for those characters that do not need to be percent - encoded in this context ( unreserved characters * can be percent - encoded even if / when this is not required , though it is not generally considered a * good practice ) . * This method will use < tt > UTF - 8 < / tt > in order to determine the characters specified in the * percent - encoded byte sequences . * This method is < strong > thread - safe < / strong > . * @ param text the < tt > char [ ] < / tt > to be unescaped . * @ param offset the position in < tt > text < / tt > at which the escape operation should start . * @ param len the number of characters in < tt > text < / tt > that should be escaped . * @ param writer the < tt > java . io . Writer < / tt > to which the unescaped result will be written . Nothing will * be written at all to this writer if input is < tt > null < / tt > . * @ throws IOException if an input / output exception occurs */ public static void unescapeUriQueryParam ( final char [ ] text , final int offset , final int len , final Writer writer ) throws IOException { } }
unescapeUriQueryParam ( text , offset , len , writer , DEFAULT_ENCODING ) ;
public class ValueChangeListenerHandler { /** * See taglib documentation . * @ see javax . faces . view . facelets . FaceletHandler # apply ( javax . faces . view . facelets . FaceletContext , javax . faces . component . UIComponent ) */ public void apply ( FaceletContext ctx , UIComponent parent ) throws IOException , FacesException , FaceletException , ELException { } }
if ( ! ComponentHandler . isNew ( parent ) ) { return ; } if ( parent instanceof EditableValueHolder ) { applyAttachedObject ( ctx . getFacesContext ( ) , parent ) ; } else if ( UIComponent . isCompositeComponent ( parent ) ) { FaceletCompositionContext mctx = FaceletCompositionContext . getCurrentInstance ( ctx ) ; mctx . addAttachedObjectHandler ( parent , this ) ; } else { throw new TagException ( this . tag , "Parent not composite component or an instance of EditableValueHolder: " + parent ) ; }
public class Math { /** * Solve the tridiagonal linear set which is of diagonal dominance * | b < sub > i < / sub > | & gt ; | a < sub > i < / sub > | + | c < sub > i < / sub > | . * < pre > * | b0 c0 0 0 0 . . . | * | a1 b1 c1 0 0 . . . | * | 0 a2 b2 c2 0 . . . | * | . . . a ( n - 2 ) b ( n - 2 ) c ( n - 2 ) | * | . . . 0 a ( n - 1 ) b ( n - 1 ) | * < / pre > * @ param a the lower part of tridiagonal matrix . a [ 0 ] is undefined and not * referenced by the method . * @ param b the diagonal of tridiagonal matrix . * @ param c the upper of tridiagonal matrix . c [ n - 1 ] is undefined and not * referenced by the method . * @ param r the right - hand side of linear equations . * @ return the solution . */ public static double [ ] solve ( double [ ] a , double [ ] b , double [ ] c , double [ ] r ) { } }
if ( b [ 0 ] == 0.0 ) { throw new IllegalArgumentException ( "Invalid value of b[0] == 0. The equations should be rewritten as a set of order n - 1." ) ; } int n = a . length ; double [ ] u = new double [ n ] ; double [ ] gam = new double [ n ] ; double bet = b [ 0 ] ; u [ 0 ] = r [ 0 ] / bet ; for ( int j = 1 ; j < n ; j ++ ) { gam [ j ] = c [ j - 1 ] / bet ; bet = b [ j ] - a [ j ] * gam [ j ] ; if ( bet == 0.0 ) { throw new IllegalArgumentException ( "The tridagonal matrix is not of diagonal dominance." ) ; } u [ j ] = ( r [ j ] - a [ j ] * u [ j - 1 ] ) / bet ; } for ( int j = ( n - 2 ) ; j >= 0 ; j -- ) { u [ j ] -= gam [ j + 1 ] * u [ j + 1 ] ; } return u ;
public class BasicCredentials { /** * Parse { @ code Authorization } header for Basic authentication . * @ param input * The value of { @ code Authorization } header . Expected inputs * are either < code > " Basic < i > { Base64 - Encoded - UserID - and - Password } < / i > " < / code > , * or < code > " < i > { Base64 - Encoded - UserID - and - Password } < / i > " < / code > . * @ return * Parsed credentials . If { @ code input } is { @ code null } is returned . */ public static BasicCredentials parse ( String input ) { } }
if ( input == null ) { return null ; } Matcher matcher = CHALLENGE_PATTERN . matcher ( input ) ; if ( matcher . matches ( ) == false ) { return new BasicCredentials ( null , null ) ; } // " userid : password " encoded in Base64. String encoded = matcher . group ( 1 ) ; // Decode the base64 string . byte [ ] decoded = Base64 . decodeBase64 ( encoded ) ; // Convert the byte array to String . String value = createString ( decoded ) ; // Split " userid : password " into " userid " and " password " . String [ ] credentials = value . split ( ":" , 2 ) ; // User ID and Password . String userId = null ; String password = null ; switch ( credentials . length ) { case 2 : // Password password = credentials [ 1 ] ; // FALLTHROUGH case 1 : // User ID userId = credentials [ 0 ] ; } return new BasicCredentials ( userId , password ) ;
public class RSAUtils { /** * Decrypt encrypted data with RSA private key . * Note : if long data was encrypted using * { @ link # encryptWithPublicKey ( String , byte [ ] , String , int ) } , it will be correctly decrypted . * @ param base64PrivateKeyData * RSA private key in base64 ( base64 of { @ link RSAPrivateKey # getEncoded ( ) } ) * @ param encryptedData * @ param cipherTransformation * cipher - transformation to use . If empty , { @ link # DEFAULT _ CIPHER _ TRANSFORMATION } * will be used * @ return * @ throws NoSuchAlgorithmException * @ throws InvalidKeySpecException * @ throws InvalidKeyException * @ throws NoSuchPaddingException * @ throws IllegalBlockSizeException * @ throws BadPaddingException * @ throws IOException */ public static byte [ ] decryptWithPrivateKey ( String base64PrivateKeyData , byte [ ] encryptedData , String cipherTransformation ) throws NoSuchAlgorithmException , InvalidKeySpecException , InvalidKeyException , NoSuchPaddingException , IllegalBlockSizeException , BadPaddingException , IOException { } }
RSAPrivateKey privateKey = buildPrivateKey ( base64PrivateKeyData ) ; return decrypt ( privateKey , encryptedData , cipherTransformation ) ;
public class Base64Context { /** * Ensure , that the output data buffer has enough space left for { @ code size } mode bytes . * @ return the output buffer */ public byte [ ] ensureBufferHasCapacityLeft ( int size ) throws FileParsingException { } }
if ( bytesHolder == null ) { bytesHolder = new ByteArrayHolder ( size ) ; } else { bytesHolder . ensureHasSpace ( size ) ; } return bytesHolder . getUnderlyingBytes ( ) ;
public class GVRPreference { /** * Gets a boolean property with a boolean value . * @ param key The key string . * @ param defaultValue The default value . * @ return The boolean property value . */ public Boolean getBooleanProperty ( String key , Boolean defaultValue ) { } }
String val = getProperty ( key , defaultValue . toString ( ) ) ; Boolean booleanVal = Boolean . parseBoolean ( val ) ; return booleanVal ;
public class ColorPalettePreference { /** * Obtains the size , which should be used to preview colors in the preference ' s dialog , from a * specific typed array . * @ param typedArray * The typed array , the size should be obtained from , as an instance of the class { @ link * TypedArray } . The typed array may not be null */ private void obtainDialogPreviewSize ( @ NonNull final TypedArray typedArray ) { } }
int defaultValue = getContext ( ) . getResources ( ) . getDimensionPixelSize ( R . dimen . color_palette_preference_default_dialog_preview_size ) ; setDialogPreviewSize ( typedArray . getDimensionPixelSize ( R . styleable . ColorPalettePreference_dialogPreviewSize , defaultValue ) ) ;
public class Solo { /** * Returns the current web page URL . * @ return the current web page URL */ public String getWebUrl ( ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "getWebUrl()" ) ; } final WebView webView = waiter . waitForAndGetView ( 0 , WebView . class ) ; if ( webView == null ) Assert . fail ( "WebView is not found!" ) ; instrumentation . runOnMainSync ( new Runnable ( ) { public void run ( ) { webUrl = webView . getUrl ( ) ; } } ) ; return webUrl ;
public class LinkClustering { /** * { @ inheritDoc } * @ throws IllegalArgumentException if { @ code matrix } is not square , or is * not an instance of { @ link SparseMatrix } */ public Assignments cluster ( Matrix matrix , Properties props ) { } }
if ( matrix . rows ( ) != matrix . columns ( ) ) throw new IllegalArgumentException ( "Input matrix is not square. " + "Matrix is expected to be a square matrix whose values (i,j) " + "denote an edge from row i to row j" ) ; if ( ! ( matrix instanceof SparseMatrix ) ) { throw new IllegalArgumentException ( "Input matrix must be a " + "sparse matrix." ) ; } SparseMatrix sm = ( SparseMatrix ) matrix ; String inMemProp = props . getProperty ( KEEP_SIMILARITY_MATRIX_IN_MEMORY_PROPERTY ) ; boolean keepSimMatrixInMem = ( inMemProp != null ) ? Boolean . parseBoolean ( inMemProp ) : true ; // IMPLEMENTATION NOTE : Ahn et al . used single - linkage HAC , which can be // efficiently implemented in O ( n ^ 2 ) time as a special case of HAC . // However , we currently don ' t optimize for this special case and // instead use our HAC class . Because of the complexity of the edge // similarity function , we build our own similarity matrix and then pass // it in , rather than passing in the edge matrix directly . final int rows = sm . rows ( ) ; numRows = rows ; LOGGER . fine ( "Generating link similarity matrix for " + rows + " nodes" ) ; // Rather than create an O ( row ^ 3 ) matrix for representing the edges , // compress the edge matrix by getting a mapping for each edge to a row // in the new matrix . final List < Edge > edgeList = new ArrayList < Edge > ( ) ; this . edgeList = edgeList ; for ( int r = 0 ; r < rows ; ++ r ) { SparseDoubleVector row = sm . getRowVector ( r ) ; int [ ] edges = row . getNonZeroIndices ( ) ; for ( int col : edges ) { // Always add edges from the upper triangular if ( r > col ) edgeList . add ( new Edge ( r , col ) ) ; // Otherwise , we only add the edge from the lower triangular if // it wasn ' t present in the upper . This avoids counting // duplicate edges . else if ( r < col && sm . get ( col , r ) == 0 ) edgeList . add ( new Edge ( r , col ) ) ; } } final int numEdges = edgeList . size ( ) ; LOGGER . fine ( "Number of edges to cluster: " + numEdges ) ; Matrix edgeSimMatrix = getEdgeSimMatrix ( edgeList , sm , keepSimMatrixInMem ) ; LOGGER . fine ( "Computing single linkage link clustering" ) ; final List < Merge > mergeOrder = new HierarchicalAgglomerativeClustering ( ) . buildDendrogram ( edgeSimMatrix , ClusterLinkage . SINGLE_LINKAGE ) ; this . mergeOrder = mergeOrder ; LOGGER . fine ( "Calculating partition densitities" ) ; // Set up a concurrent map that each thread will update once it has // calculated the densitites of each of its partitions . This map is // only written to once per thread . final ConcurrentNavigableMap < Double , Integer > partitionDensities = new ConcurrentSkipListMap < Double , Integer > ( ) ; // Register a task group for calculating all of the partition // densitities Object key = workQueue . registerTaskGroup ( mergeOrder . size ( ) ) ; for ( int p = 0 ; p < mergeOrder . size ( ) ; ++ p ) { final int part = p ; workQueue . add ( key , new Runnable ( ) { public void run ( ) { // Get the merges for this particular partitioning of // the links List < Merge > mergeSteps = mergeOrder . subList ( 0 , part ) ; // Convert the merges to a specific cluster labeling MultiMap < Integer , Integer > clusterToElements = convertMergesToAssignments ( mergeSteps , numEdges ) ; // Based on the link partitioning , calculate the // partition density for each cluster double partitionDensitySum = 0d ; for ( Integer cluster : clusterToElements . keySet ( ) ) { Set < Integer > linkPartition = clusterToElements . get ( cluster ) ; int numLinks = linkPartition . size ( ) ; BitSet nodesInPartition = new BitSet ( rows ) ; for ( Integer linkIndex : linkPartition ) { Edge link = edgeList . get ( linkIndex ) ; nodesInPartition . set ( link . from ) ; nodesInPartition . set ( link . to ) ; } int numNodes = nodesInPartition . cardinality ( ) ; // This reflects the density of this particular // cluster double partitionDensity = ( numLinks - ( numNodes - 1d ) ) / ( ( ( numNodes * ( numNodes - 1d ) ) / 2d ) - ( numLinks - 1 ) ) ; partitionDensitySum += partitionDensity ; } // Compute the density for the total partitioning // solution double partitionDensity = ( 2d / numEdges ) * partitionDensitySum ; LOGGER . log ( Level . FINER , "Partition solution {0} had " + "density {1}" , new Object [ ] { part , partitionDensity } ) ; // Update the thread - shared partition density map with // this task ' s calculation partitionDensities . put ( partitionDensity , part ) ; } } ) ; } // Wait for all the partition densities to be calculated workQueue . await ( key ) ; Map . Entry < Double , Integer > densest = partitionDensities . lastEntry ( ) ; LOGGER . fine ( "Partition " + densest . getValue ( ) + " had the highest density: " + densest . getKey ( ) ) ; int partitionWithMaxDensity = densest . getValue ( ) ; // Select the solution with the highest partition density and assign // nodes accordingly MultiMap < Integer , Integer > bestEdgeAssignment = convertMergesToAssignments ( mergeOrder . subList ( 0 , partitionWithMaxDensity ) , numEdges ) ; List < Set < Integer > > nodeClusters = new ArrayList < Set < Integer > > ( rows ) ; for ( int i = 0 ; i < rows ; ++ i ) nodeClusters . add ( new HashSet < Integer > ( ) ) ; // Ignore the original partition labeling , and use our own cluster // labeling to ensure that the IDs are contiguous . int clusterId = 0 ; // For each of the partitions , add the partion ' s cluster ID to all the // nodes that are connected by one of the partition ' s edges for ( Integer cluster : bestEdgeAssignment . keySet ( ) ) { Set < Integer > edgePartition = bestEdgeAssignment . get ( cluster ) ; for ( Integer edgeId : edgePartition ) { Edge e = edgeList . get ( edgeId ) ; nodeClusters . get ( e . from ) . add ( clusterId ) ; nodeClusters . get ( e . to ) . add ( clusterId ) ; } // Update the cluster id clusterId ++ ; } int numClusters = 0 ; Assignment [ ] nodeAssignments = new Assignment [ rows ] ; for ( int i = 0 ; i < nodeAssignments . length ; ++ i ) { nodeAssignments [ i ] = new SoftAssignment ( nodeClusters . get ( i ) ) ; } return new Assignments ( numClusters , nodeAssignments , matrix ) ;
public class DeleteBackupRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteBackupRequest deleteBackupRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteBackupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteBackupRequest . getBackupId ( ) , BACKUPID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DataEncoder { /** * Encodes the given optional byte array into a variable amount of * bytes . If the byte array is null , exactly 1 byte is written . Otherwise , * the amount written can be determined by calling calculateEncodedLength . * @ param value byte array value to encode , may be null * @ param valueOffset offset into byte array * @ param valueLength length of data in byte array * @ param dst destination for encoded bytes * @ param dstOffset offset into destination array * @ return amount of bytes written */ public static int encode ( byte [ ] value , int valueOffset , int valueLength , byte [ ] dst , int dstOffset ) { } }
if ( value == null ) { dst [ dstOffset ] = NULL_BYTE_HIGH ; return 1 ; } // Write the value length first , in a variable amount of bytes . int amt = encodeUnsignedVarInt ( valueLength , dst , dstOffset ) ; // Now write the value . System . arraycopy ( value , valueOffset , dst , dstOffset + amt , valueLength ) ; return amt + valueLength ;
public class ReflectionUtils { /** * Checks if the method methodToFind is the overridden method from the superclass or superinterface . * @ param methodToFind is method to check * @ param cls is method class * @ return true if the method is overridden method */ public static boolean isOverriddenMethod ( Method methodToFind , Class < ? > cls ) { } }
Set < Class < ? > > superClasses = new HashSet < > ( ) ; for ( Class < ? > class1 : cls . getInterfaces ( ) ) { superClasses . add ( class1 ) ; } if ( cls . getSuperclass ( ) != null ) { superClasses . add ( cls . getSuperclass ( ) ) ; } for ( Class < ? > superClass : superClasses ) { if ( superClass != null && ! ( superClass . equals ( Object . class ) ) ) { for ( Method method : superClass . getMethods ( ) ) { if ( method . getName ( ) . equals ( methodToFind . getName ( ) ) && method . getReturnType ( ) . isAssignableFrom ( methodToFind . getReturnType ( ) ) && Arrays . equals ( method . getParameterTypes ( ) , methodToFind . getParameterTypes ( ) ) && ! Arrays . equals ( method . getGenericParameterTypes ( ) , methodToFind . getGenericParameterTypes ( ) ) ) { return true ; } } if ( isOverriddenMethod ( methodToFind , superClass ) ) { return true ; } } } return false ;
public class JsonApiResponseFilter { /** * Determines whether the given response entity is either a Katharsis * resource or a list of Katharsis resources . * @ param response the response entity * @ return < code > true < / code > , if < code > response < / code > is a ( list of ) * Katharsis resource ( s ) , < br / > * < code > false < / code > , otherwise */ private boolean isResourceResponse ( Object response ) { } }
boolean singleResource = response . getClass ( ) . getAnnotation ( JsonApiResource . class ) != null ; boolean resourceList = ResourceListBase . class . isAssignableFrom ( response . getClass ( ) ) ; return singleResource || resourceList ;
public class JobGraph { /** * Checks if any vertex of this job graph has an outgoing edge which is set to < code > null < / code > . If this is the * case the respective vertex is returned . * @ return the vertex which has an outgoing edge set to < code > null < / code > or < code > null < / code > if no such vertex * exists */ public AbstractJobVertex findVertexWithNullEdges ( ) { } }
final AbstractJobVertex [ ] allVertices = getAllJobVertices ( ) ; for ( int i = 0 ; i < allVertices . length ; i ++ ) { for ( int j = 0 ; j < allVertices [ i ] . getNumberOfForwardConnections ( ) ; j ++ ) { if ( allVertices [ i ] . getForwardConnection ( j ) == null ) { return allVertices [ i ] ; } } for ( int j = 0 ; j < allVertices [ i ] . getNumberOfBackwardConnections ( ) ; j ++ ) { if ( allVertices [ i ] . getBackwardConnection ( j ) == null ) { return allVertices [ i ] ; } } } return null ;
public class SXmlCharacterMethods { /** * Convenience method to convert XML reserved chars . * @ param input String to be converted . * @ return Converted string . */ public static String convertCharsToXml ( String input ) { } }
StringBuffer result = new StringBuffer ( ) ; for ( int i = 0 ; i < input . length ( ) ; i ++ ) { switch ( input . charAt ( i ) ) { case '<' : result . append ( "&lt;" ) ; break ; case '>' : result . append ( "&gt;" ) ; break ; case '"' : result . append ( "&quot;" ) ; break ; case '\'' : result . append ( "&apos;" ) ; break ; case '&' : result . append ( "&amp;" ) ; break ; default : result . append ( input . charAt ( i ) ) ; } } return result . toString ( ) . trim ( ) ;
public class InternalSARLParser { /** * InternalSARL . g : 8973:1 : entryRuleXUnaryOperation returns [ EObject current = null ] : iv _ ruleXUnaryOperation = ruleXUnaryOperation EOF ; */ public final EObject entryRuleXUnaryOperation ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleXUnaryOperation = null ; try { // InternalSARL . g : 8973:56 : ( iv _ ruleXUnaryOperation = ruleXUnaryOperation EOF ) // InternalSARL . g : 8974:2 : iv _ ruleXUnaryOperation = ruleXUnaryOperation EOF { if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getXUnaryOperationRule ( ) ) ; } pushFollow ( FOLLOW_1 ) ; iv_ruleXUnaryOperation = ruleXUnaryOperation ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = iv_ruleXUnaryOperation ; } match ( input , EOF , FOLLOW_2 ) ; if ( state . failed ) return current ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ;
public class LoggerWrapper { /** * Delegate to the appropriate method of the underlying logger . */ public void warn ( String format , Object arg ) { } }
if ( ! logger . isWarnEnabled ( ) ) return ; if ( instanceofLAL ) { String formattedMessage = MessageFormatter . format ( format , arg ) . getMessage ( ) ; ( ( LocationAwareLogger ) logger ) . log ( null , fqcn , LocationAwareLogger . WARN_INT , formattedMessage , new Object [ ] { arg } , null ) ; } else { logger . warn ( format , arg ) ; }
public class JdbcUtil { /** * Here is the general code pattern to work with { @ code SimpleTransaction } . * The transaction will be shared in the same thread for the same { @ code DataSource } or { @ code Connection } . * < pre > * < code > * public void doSomethingA ( ) { * final SimpleTransaction tranA = JdbcUtil . beginTransacion ( conn1 , isolation ) ; * final Connection conn = tranA . connection ( ) ; * try { * / / do your work with the conn . . . * doSomethingB ( ) ; / / Share the same transaction ' tranA ' because they ' re in the same thread and start transaction with same Connection ' conn1 ' . * doSomethingC ( ) ; / / won ' t share the same transaction ' tranA ' although they ' re in the same thread but start transaction with different Connections . * tranA . commit ( ) ; * } finally { * tranA . rollbackIfNotCommitted ( ) ; * public void doSomethingB ( ) { * final SimpleTransaction tranB = JdbcUtil . beginTransacion ( conn1 , isolation ) ; * final Connection conn = tranB . connection ( ) ; * try { * / / do your work with the conn . . . * tranB . commit ( ) ; * } finally { * tranB . rollbackIfNotCommitted ( ) ; * public void doSomethingC ( ) { * final SimpleTransaction tranC = JdbcUtil . beginTransacion ( conn2 , isolation ) ; * final Connection conn = tranC . connection ( ) ; * try { * / / do your work with the conn . . . * tranC . commit ( ) ; * } finally { * tranC . rollbackIfNotCommitted ( ) ; * < / pre > * < / code > * It ' s incorrect to use flag to identity the transaction should be committed or rolled back . * Don ' t write below code : * < pre > * < code > * public void doSomethingA ( ) { * final SimpleTransaction tranA = JdbcUtil . beginTransacion ( conn1 , isolation ) ; * final Connection conn = tranA . connection ( ) ; * boolean flagToCommit = false ; * try { * / / do your work with the conn . . . * flagToCommit = true ; * } finally { * if ( flagToCommit ) { * tranA . commit ( ) ; * } else { * tranA . rollbackIfNotCommitted ( ) ; * < / code > * < / pre > * Never write below code because it will definitely cause { @ code Connection } leak : * < pre > * < code > * JdbcUtil . beginTransaction ( dataSource . getConnection ( ) , isolationLevel ) ; * < / code > * < / pre > * @ param conn the specified { @ code conn } won ' t be close after the created transaction is committed or rolled back . * @ param isolationLevel * @ return * @ throws SQLException */ public static SimpleTransaction beginTransaction ( Connection conn , IsolationLevel isolationLevel ) throws UncheckedSQLException { } }
N . checkArgNotNull ( conn ) ; N . checkArgNotNull ( isolationLevel ) ; final String ttid = SimpleTransaction . getTransactionThreadId ( conn ) ; SimpleTransaction tran = SimpleTransaction . threadTransacionMap . get ( ttid ) ; if ( tran == null ) { try { tran = new SimpleTransaction ( ttid , conn , isolationLevel , false ) ; tran . incrementAndGet ( isolationLevel ) ; } catch ( SQLException e ) { throw new UncheckedSQLException ( e ) ; } logger . info ( "Create a new transaction(id={})" , tran . id ( ) ) ; SimpleTransaction . threadTransacionMap . put ( ttid , tran ) ; } else { logger . info ( "Reusing the existing transaction(id={})" , tran . id ( ) ) ; tran . incrementAndGet ( isolationLevel ) ; } logger . debug ( "Current active transaction: {}" , SimpleTransaction . threadTransacionMap . values ( ) ) ; return tran ;
public class CommitLogArchiver { /** * Differs from the above because it can be used on any file , rather than only * managed commit log segments ( and thus cannot call waitForFinalSync ) . * Used to archive files present in the commit log directory at startup ( CASSANDRA - 6904) */ public void maybeArchive ( final String path , final String name ) { } }
if ( Strings . isNullOrEmpty ( archiveCommand ) ) return ; archivePending . put ( name , executor . submit ( new WrappedRunnable ( ) { protected void runMayThrow ( ) throws IOException { String command = archiveCommand . replace ( "%name" , name ) ; command = command . replace ( "%path" , path ) ; exec ( command ) ; } } ) ) ;
public class CPSpecificationOptionPersistenceImpl { /** * Returns the first cp specification option in the ordered set where CPOptionCategoryId = & # 63 ; . * @ param CPOptionCategoryId the cp option category ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching cp specification option * @ throws NoSuchCPSpecificationOptionException if a matching cp specification option could not be found */ @ Override public CPSpecificationOption findByCPOptionCategoryId_First ( long CPOptionCategoryId , OrderByComparator < CPSpecificationOption > orderByComparator ) throws NoSuchCPSpecificationOptionException { } }
CPSpecificationOption cpSpecificationOption = fetchByCPOptionCategoryId_First ( CPOptionCategoryId , orderByComparator ) ; if ( cpSpecificationOption != null ) { return cpSpecificationOption ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "CPOptionCategoryId=" ) ; msg . append ( CPOptionCategoryId ) ; msg . append ( "}" ) ; throw new NoSuchCPSpecificationOptionException ( msg . toString ( ) ) ;
public class CmsDateBox { /** * Hides the date time popup . < p > */ protected void hidePopup ( ) { } }
if ( CmsDateConverter . validateTime ( getTimeText ( ) ) ) { // before hiding the date picker remove the date box popup from the auto hide partners of the parent popup if ( m_autoHideParent != null ) { m_autoHideParent . removeAutoHidePartner ( getElement ( ) ) ; } m_popup . hide ( ) ; if ( m_previewHandlerRegistration != null ) { m_previewHandlerRegistration . removeHandler ( ) ; } m_previewHandlerRegistration = null ; }
public class Constraints { /** * Apply a " less than or equal to " constraint to two properties . * @ param propertyName The first property * @ param otherPropertyName The other property * @ return The constraint */ public PropertyConstraint lteProperty ( String propertyName , String otherPropertyName ) { } }
return valueProperties ( propertyName , LessThanEqualTo . instance ( ) , otherPropertyName ) ;
public class Graphics { /** * Sets the position of the camera through setting the eye position , the * center of the scene , and which axis is facing upward . Moving the eye * position and the direction it is pointing ( the center of the scene ) * allows the images to be seen from different angles . * @ param eyeX * x - coordinate for the eye * @ param eyeY * y - coordinate for the eye * @ param eyeZ * z - coordinate for the eye * @ param centerX * x - coordinate for the center of the scene * @ param centerY * x - coordinate for the center of the scene * @ param centerZ * z - coordinate for the center of the scene * @ param upX * usually 0.0 , 1.0 , or - 1.0 * @ param upY * usually 0.0 , 1.0 , or - 1.0 * @ param upZ * usually 0.0 , 1.0 , or - 1.0 */ public void setCamera ( double eyeX , double eyeY , double eyeZ , double centerX , double centerY , double centerZ , double upX , double upY , double upZ ) { } }
glu . gluLookAt ( eyeX , eyeY , eyeZ , centerX , centerY , centerZ , upX , upY , upZ ) ;
public class FirmataI2CDevice { /** * { @ link FirmataDevice } calls this method when receives a message from I2C * device . * @ param register The device register read from . * @ param message actual data from I2C device */ void onReceive ( int register , byte [ ] message ) { } }
I2CEvent evt = new I2CEvent ( this , register , message ) ; I2CListener listener = callbacks . remove ( register ) ; if ( listener == null ) { for ( I2CListener subscriber : subscribers ) { subscriber . onReceive ( evt ) ; } } else { listener . onReceive ( evt ) ; }
public class Spectrogram { /** * Build spectrogram */ private void buildSpectrogram ( ) { } }
short [ ] amplitudes = wave . getSampleAmplitudes ( ) ; int numSamples = amplitudes . length ; int pointer = 0 ; // overlapping if ( overlapFactor > 1 ) { int numOverlappedSamples = numSamples * overlapFactor ; int backSamples = fftSampleSize * ( overlapFactor - 1 ) / overlapFactor ; short [ ] overlapAmp = new short [ numOverlappedSamples ] ; pointer = 0 ; for ( int i = 0 ; i < amplitudes . length ; i ++ ) { overlapAmp [ pointer ++ ] = amplitudes [ i ] ; if ( pointer % fftSampleSize == 0 ) { // overlap i -= backSamples ; } } numSamples = numOverlappedSamples ; amplitudes = overlapAmp ; } // end overlapping numFrames = numSamples / fftSampleSize ; framesPerSecond = ( int ) ( numFrames / wave . length ( ) ) ; // set signals for fft WindowFunction window = new WindowFunction ( ) ; window . setWindowType ( "Hamming" ) ; double [ ] win = window . generate ( fftSampleSize ) ; double [ ] [ ] signals = new double [ numFrames ] [ ] ; for ( int f = 0 ; f < numFrames ; f ++ ) { signals [ f ] = new double [ fftSampleSize ] ; int startSample = f * fftSampleSize ; for ( int n = 0 ; n < fftSampleSize ; n ++ ) { signals [ f ] [ n ] = amplitudes [ startSample + n ] * win [ n ] ; } } // end set signals for fft absoluteSpectrogram = new double [ numFrames ] [ ] ; // for each frame in signals , do fft on it FastFourierTransform fft = new FastFourierTransform ( ) ; for ( int i = 0 ; i < numFrames ; i ++ ) { absoluteSpectrogram [ i ] = fft . getMagnitudes ( signals [ i ] , false ) ; } if ( absoluteSpectrogram . length > 0 ) { numFrequencyUnit = absoluteSpectrogram [ 0 ] . length ; unitFrequency = ( double ) wave . getWaveHeader ( ) . getSampleRate ( ) / 2 / numFrequencyUnit ; // frequency could be caught within the half of nSamples according to Nyquist theory // normalization of absoultSpectrogram spectrogram = new double [ numFrames ] [ numFrequencyUnit ] ; // set max and min amplitudes double maxAmp = Double . MIN_VALUE ; double minAmp = Double . MAX_VALUE ; for ( int i = 0 ; i < numFrames ; i ++ ) { for ( int j = 0 ; j < numFrequencyUnit ; j ++ ) { if ( absoluteSpectrogram [ i ] [ j ] > maxAmp ) { maxAmp = absoluteSpectrogram [ i ] [ j ] ; } else if ( absoluteSpectrogram [ i ] [ j ] < minAmp ) { minAmp = absoluteSpectrogram [ i ] [ j ] ; } } } // end set max and min amplitudes // normalization // avoiding divided by zero double minValidAmp = 0.00000000001F ; if ( minAmp == 0 ) { minAmp = minValidAmp ; } double diff = Math . log10 ( maxAmp / minAmp ) ; // perceptual difference for ( int i = 0 ; i < numFrames ; i ++ ) { for ( int j = 0 ; j < numFrequencyUnit ; j ++ ) { if ( absoluteSpectrogram [ i ] [ j ] < minValidAmp ) { spectrogram [ i ] [ j ] = 0 ; } else { spectrogram [ i ] [ j ] = ( Math . log10 ( absoluteSpectrogram [ i ] [ j ] / minAmp ) ) / diff ; } } } // end normalization }
public class DatastoreEmulator { /** * Stops the emulator . Multiple calls are allowed . * @ throws DatastoreEmulatorException if the emulator cannot be stopped */ public synchronized void stop ( ) throws DatastoreEmulatorException { } }
// We intentionally don ' t check the internal state . If people want to try and stop the server // multiple times that ' s fine . stopEmulatorInternal ( ) ; if ( state != State . STOPPED ) { state = State . STOPPED ; if ( projectDirectory != null ) { try { Process process = new ProcessBuilder ( "rm" , "-r" , projectDirectory . getAbsolutePath ( ) ) . start ( ) ; if ( process . waitFor ( ) != 0 ) { throw new IOException ( "Temporary project directory deletion exited with " + process . exitValue ( ) ) ; } } catch ( IOException e ) { throw new IllegalStateException ( "Could not delete temporary project directory" , e ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; throw new IllegalStateException ( "Could not delete temporary project directory" , e ) ; } } }
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcWindowPanelProperties ( ) { } }
if ( ifcWindowPanelPropertiesEClass == null ) { ifcWindowPanelPropertiesEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 766 ) ; } return ifcWindowPanelPropertiesEClass ;
public class PermissionsImpl { /** * Removes a user from the allowed list of users to access this LUIS application . Users are removed using their email address . * @ param appId The application ID . * @ param deleteOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the OperationStatus object */ public Observable < ServiceResponse < OperationStatus > > deleteWithServiceResponseAsync ( UUID appId , DeletePermissionsOptionalParameter deleteOptionalParameter ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } final String email = deleteOptionalParameter != null ? deleteOptionalParameter . email ( ) : null ; return deleteWithServiceResponseAsync ( appId , email ) ;
public class LinkHandler { /** * Cold start version of State Handler creation . * @ param messageProcessor * @ throws SIResourceException */ protected void createRealizationAndState ( MessageProcessor messageProcessor , TransactionCommon transaction ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "createRealizationAndState" , new Object [ ] { messageProcessor , transaction } ) ; /* * Create associated state handler of appropriate type */ _ptoPRealization = new LinkState ( this , messageProcessor , getLocalisationManager ( ) ) ; _protoRealization = _ptoPRealization ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "createRealizationAndState" ) ;
public class Tuple6 { /** * Split this tuple into two tuples of degree 1 and 5. */ public final Tuple2 < Tuple1 < T1 > , Tuple5 < T2 , T3 , T4 , T5 , T6 > > split1 ( ) { } }
return new Tuple2 < > ( limit1 ( ) , skip1 ( ) ) ;
public class BuilderMolecule { /** * method to build a molecule for a given monomer * @ param monomer input monomer * @ return generated molecule for the given monomer * @ throws BuilderMoleculeException if the monomer can ' t be built * @ throws ChemistryException if the Chemistry Engine can not be initialized */ public static AbstractMolecule getMoleculeForMonomer ( final Monomer monomer ) throws BuilderMoleculeException , ChemistryException { } }
String input = getInput ( monomer ) ; if ( input != null ) { List < Attachment > listAttachments = monomer . getAttachmentList ( ) ; AttachmentList list = new AttachmentList ( ) ; for ( Attachment attachment : listAttachments ) { list . add ( new org . helm . chemtoolkit . Attachment ( attachment . getAlternateId ( ) , attachment . getLabel ( ) , attachment . getCapGroupName ( ) , attachment . getCapGroupSMILES ( ) ) ) ; } try { return Chemistry . getInstance ( ) . getManipulator ( ) . getMolecule ( input , list ) ; } catch ( IOException | CTKException e ) { throw new BuilderMoleculeException ( "Molecule can't be built for the given monomer" ) ; } } return null ;
public class HeliosClient { /** * Lists all jobs in the cluster whose name starts with the given string , and that are deployed to * hosts that match the given name pattern . * @ param jobQuery job name filter * @ param hostNamePattern hostname filter */ public ListenableFuture < Map < JobId , Job > > jobs ( @ Nullable final String jobQuery , @ Nullable final String hostNamePattern ) { } }
final Map < String , String > params = new HashMap < > ( ) ; if ( ! Strings . isNullOrEmpty ( jobQuery ) ) { params . put ( "q" , jobQuery ) ; } if ( ! Strings . isNullOrEmpty ( hostNamePattern ) ) { params . put ( "hostPattern" , hostNamePattern ) ; } return get ( uri ( "/jobs" , params ) , jobIdMap ) ;
public class Dialogs { /** * 弹出输入框 * @ param title 标题 * @ param header 信息头 * @ param content 内容 * @ param defaultValue 输入框默认值 * @ return 输入的内容 */ public static String showInputDialog ( String title , String header , String content , String defaultValue ) { } }
TextInputDialog dialog = new TextInputDialog ( defaultValue ) ; dialog . setTitle ( title ) ; dialog . setHeaderText ( header ) ; dialog . setContentText ( content ) ; Optional < String > result = dialog . showAndWait ( ) ; return result . orElse ( null ) ;
public class IndexNode { /** * Visit first index index node . * @ param visitor the visitor * @ return the index node */ public IndexNode visitFirstIndex ( Consumer < ? super IndexNode > visitor ) { } }
visitor . accept ( this ) ; IndexNode refresh = refresh ( ) ; refresh . getChildren ( ) . forEach ( n -> n . visitFirstIndex ( visitor ) ) ; return refresh ;
public class ObjectUtil { /** * 针对Class . forName ( clsname ) . newInstance ( ) 的一个简单封装 * @ param clsName * @ return 如果未能创建实例 , 则抛出runtime异常 */ public static Object instance ( String clsName , ClassLoader loader ) { } }
try { return Class . forName ( clsName , true , loader ) . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RuntimeException ( e ) ; } catch ( IllegalAccessException e ) { throw new RuntimeException ( e ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; }
public class ShowTablesMergedResult { /** * Reset column label . * @ param schema schema */ public void resetColumnLabel ( final String schema ) { } }
Map < String , Integer > labelAndIndexMap = new HashMap < > ( 1 , 1 ) ; labelAndIndexMap . put ( schema , 1 ) ; resetLabelAndIndexMap ( labelAndIndexMap ) ;
public class DatabaseServiceRamp { /** * Queries the database , returning an iterator of results . * @ param sql the select query for the search * @ param result callback for the result iterator * @ param args arguments to the sql */ @ Override public void findAllLocal ( String sql , Result < Iterable < Cursor > > result , Object ... args ) { } }
_kraken . findAllLocal ( sql , args , result ) ;
public class JMSUtil { /** * Creates a message selector which considers JMSType and recipients properties . * @ param eventName The event name ( i . e . DESKTOP . LOCK ) . * @ param publisherInfo Info on the publisher . If null , then no recipients properties are added . * @ return The message selector . */ public static String getMessageSelector ( String eventName , IPublisherInfo publisherInfo ) { } }
StringBuilder sb = new StringBuilder ( "(JMSType='" + eventName + "' OR JMSType LIKE '" + eventName + ".%') AND (Recipients IS NULL" ) ; if ( publisherInfo != null ) { for ( String selector : publisherInfo . getAttributes ( ) . values ( ) ) { addRecipientSelector ( selector , sb ) ; } } sb . append ( ')' ) ; return sb . toString ( ) ;