signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class WhiteboxImpl { /** * Invoke a constructor . Useful for testing classes with a private * constructor when PowerMock cannot determine which constructor to invoke . * This only happens if you have two constructors with the same number of * arguments where one is using primitive data types and the other is using * the wrapped counter part . For example : * < pre > * public class MyClass { * private MyClass ( Integer i ) { * private MyClass ( int i ) { * < / pre > * This ought to be a really rare case . So for most situation , use * @ param < T > the generic type * @ param classThatContainsTheConstructorToTest the class that contains the constructor to test * @ param parameterTypes the parameter types * @ param arguments the arguments * @ return The object created after the constructor has been invoked . * @ throws Exception If an exception occur when invoking the constructor . * { @ link # invokeConstructor ( Class , Object . . . ) } instead . */ public static < T > T invokeConstructor ( Class < T > classThatContainsTheConstructorToTest , Class < ? > [ ] parameterTypes , Object [ ] arguments ) throws Exception { } }
if ( parameterTypes != null && arguments != null ) { if ( parameterTypes . length != arguments . length ) { throw new IllegalArgumentException ( "parameterTypes and arguments must have the same length" ) ; } } Constructor < T > constructor = null ; try { constructor = classThatContainsTheConstructorToTest . getDeclaredConstructor ( parameterTypes ) ; } catch ( Exception e ) { throw new ConstructorNotFoundException ( "Could not lookup the constructor" , e ) ; } return createInstance ( constructor , arguments ) ;
public class Curve25519 { /** * Calculates an ECDH agreement . * @ param publicKey The Curve25519 ( typically remote party ' s ) public key . * @ param privateKey The Curve25519 ( typically yours ) private key . * @ return A 32 - byte shared secret . */ public byte [ ] calculateAgreement ( byte [ ] publicKey , byte [ ] privateKey ) { } }
if ( publicKey == null || privateKey == null ) { throw new IllegalArgumentException ( "Keys must not be null!" ) ; } if ( publicKey . length != 32 || privateKey . length != 32 ) { throw new IllegalArgumentException ( "Keys must be 32 bytes!" ) ; } return provider . calculateAgreement ( privateKey , publicKey ) ;
public class Expressions { /** * Create a new Template expression * @ deprecated Use { @ link # numberTemplate ( Class , Template , List ) } instead . * @ param cl type of expression * @ param template template * @ param args template parameters * @ return template expression */ @ Deprecated public static < T extends Number & Comparable < ? > > NumberTemplate < T > numberTemplate ( Class < ? extends T > cl , Template template , ImmutableList < ? > args ) { } }
return new NumberTemplate < T > ( cl , template , args ) ;
public class DateCache { /** * Format a date according to our stored formatter . * @ param inDate * @ return Formatted date */ public synchronized String format ( long inDate ) { } }
long seconds = inDate / 1000 ; // Is it not suitable to cache ? if ( seconds < _lastSeconds || _lastSeconds > 0 && seconds > _lastSeconds + __hitWindow ) { // It ' s a cache miss _misses ++ ; if ( _misses < __MaxMisses ) { Date d = new Date ( inDate ) ; return _tzFormat . format ( d ) ; } } else if ( _misses > 0 ) _misses -- ; // Check if we are in the same second // and don ' t care about millis if ( _lastSeconds == seconds && ! _millis ) return _lastResult ; Date d = new Date ( inDate ) ; // Check if we need a new format string long minutes = seconds / 60 ; if ( _lastMinutes != minutes ) { _lastMinutes = minutes ; _secFormatString = _minFormat . format ( d ) ; int i ; int l ; if ( _millis ) { i = _secFormatString . indexOf ( "ss.SSS" ) ; l = 6 ; } else { i = _secFormatString . indexOf ( "ss" ) ; l = 2 ; } _secFormatString0 = _secFormatString . substring ( 0 , i ) ; _secFormatString1 = _secFormatString . substring ( i + l ) ; } // Always format if we get here _lastSeconds = seconds ; StringBuffer sb = new StringBuffer ( _secFormatString . length ( ) ) ; synchronized ( sb ) { sb . append ( _secFormatString0 ) ; int s = ( int ) ( seconds % 60 ) ; if ( s < 10 ) sb . append ( '0' ) ; sb . append ( s ) ; if ( _millis ) { long millis = inDate % 1000 ; if ( millis < 10 ) sb . append ( ".00" ) ; else if ( millis < 100 ) sb . append ( ".0" ) ; else sb . append ( '.' ) ; sb . append ( millis ) ; } sb . append ( _secFormatString1 ) ; _lastResult = sb . toString ( ) ; } return _lastResult ;
public class Parsers { /** * A { @ link Parser } that sequentially runs 3 parser objects and collects the results in a * { @ link Tuple3 } object . * @ deprecated Prefer to converting to your own object with a lambda . */ @ Deprecated public static < A , B , C > Parser < Tuple3 < A , B , C > > tuple ( Parser < ? extends A > p1 , Parser < ? extends B > p2 , Parser < ? extends C > p3 ) { } }
return sequence ( p1 , p2 , p3 , Tuple3 :: new ) ;
public class JDBCResultSet { /** * < ! - - start generic documentation - - > * Retrieves the value of the designated column in the current row * of this < code > ResultSet < / code > object as * a < code > long < / code > in the Java programming language . * < ! - - end generic documentation - - > * @ param columnIndex the first column is 1 , the second is 2 , . . . * @ return the column value ; if the value is SQL < code > NULL < / code > , the * value returned is < code > 0 < / code > * @ exception SQLException if a database access error occurs or this method is * called on a closed result set */ public long getLong ( int columnIndex ) throws SQLException { } }
Object o = getColumnInType ( columnIndex , Type . SQL_BIGINT ) ; return o == null ? 0 : ( ( Number ) o ) . longValue ( ) ;
public class XMLLibImpl { /** * TODO : Too general ; this should be split into overloaded methods . * Is that possible ? */ XmlNode . QName toNodeQName ( Context cx , Object nameValue , boolean attribute ) { } }
if ( nameValue instanceof XMLName ) { return ( ( XMLName ) nameValue ) . toQname ( ) ; } else if ( nameValue instanceof QName ) { QName qname = ( QName ) nameValue ; return qname . getDelegate ( ) ; } else if ( nameValue instanceof Boolean || nameValue instanceof Number || nameValue == Undefined . instance || nameValue == null ) { throw badXMLName ( nameValue ) ; } else { String local = null ; if ( nameValue instanceof String ) { local = ( String ) nameValue ; } else { local = ScriptRuntime . toString ( nameValue ) ; } return toNodeQName ( cx , local , attribute ) ; }
public class Computer { /** * Returns true if all the executors of this computer are idle . */ @ Exported public final boolean isIdle ( ) { } }
if ( ! oneOffExecutors . isEmpty ( ) ) return false ; for ( Executor e : executors ) if ( ! e . isIdle ( ) ) return false ; return true ;
public class PathUtils { /** * Normalize a relative path using { @ link # normalize ( String ) } and verify that * the normalized path does not begin with an upwards path element ( " . . " ) . * The path is required to be a relative path which uses forward slashes ( ' / ' ) . * The normalized path is tested as an absolute path according to { @ link # pathIsAbsolute ( String ) } . * @ param relativePath The relative path which is to be normalized . * @ return The normalized path . An empty path if the path was null . * @ throws MalformedLocationException Thrown if the normalized path starts with an upwards path element ( " . . " ) . */ @ Trivial public static String normalizeDescendentPath ( String path ) { } }
if ( path == null || path . length ( ) == 0 ) return "" ; path = normalizeRelative ( path ) ; if ( path . startsWith ( ".." ) ) throw new MalformedLocationException ( "Can not reference \"..\" when creating a descendant (path=" + path + ")" ) ; return path ;
public class ReflectUtil { /** * 获得指定类过滤后的Public方法列表 * @ param clazz 查找方法的类 * @ param excludeMethods 不包括的方法 * @ return 过滤后的方法列表 */ public static List < Method > getPublicMethods ( Class < ? > clazz , Method ... excludeMethods ) { } }
final HashSet < Method > excludeMethodSet = CollectionUtil . newHashSet ( excludeMethods ) ; return getPublicMethods ( clazz , new Filter < Method > ( ) { @ Override public boolean accept ( Method method ) { return false == excludeMethodSet . contains ( method ) ; } } ) ;
public class MmtfActions { /** * Read a Biojava structure from an { @ link InputStream } * @ param inStream the { @ link InputStream } to read from * @ return the parsed { @ link Structure } * @ throws IOException */ public static Structure readFromInputStream ( InputStream inStream ) throws IOException { } }
// Get the reader - this is the bit that people need to implement . MmtfStructureReader mmtfStructureReader = new MmtfStructureReader ( ) ; // Do the inflation new StructureDataToAdapter ( new GenericDecoder ( ReaderUtils . getDataFromInputStream ( inStream ) ) , mmtfStructureReader ) ; // Get the structue return mmtfStructureReader . getStructure ( ) ;
public class HttpServlets { /** * 设置请求 URI 。 * @ param request * 请求 * @ param requestURI * 请求 URI */ public static void setRequestURI ( final HttpServletRequest request , final String requestURI ) { } }
request . getSession ( true ) . setAttribute ( STORE_URI_KEY , requestURI ) ;
public class UnmodifiableList { /** * Returns an unmodifiable view of the list composed of elements . * @ param elements Iterable of elements . * @ param < E > Type of the elements of the list . * @ return an unmodifiable view of the list composed of elements . */ public static < E > List < E > copyOf ( Iterable < ? extends E > elements ) { } }
Preconditions . checkNotNull ( elements , "elements" ) ; List < E > result = ( elements instanceof Collection ) // can pre - allocate the array ? new ArrayList < > ( cast ( elements ) . size ( ) ) // cannot : new ArrayList < > ( ) ; for ( E e : elements ) { result . add ( e ) ; } return Collections . unmodifiableList ( result ) ;
public class GeoJsonReaderDriver { /** * Parses Json Array and returns an ArrayList * Syntax : * Json Array : * { " member1 " : value1 } , value2 , value3 , { " member4 " : value4 } ] * @ param jp the json parser * @ return the array */ private ArrayList < Object > parseArray ( JsonParser jp ) throws IOException { } }
JsonToken value = jp . nextToken ( ) ; ArrayList < Object > ret = new ArrayList < > ( ) ; while ( value != JsonToken . END_ARRAY ) { if ( value == JsonToken . START_OBJECT ) { Object object = parseObject ( jp ) ; ret . add ( object ) ; } else if ( value == JsonToken . START_ARRAY ) { ArrayList < Object > arrayList = parseArray ( jp ) ; ret . add ( arrayList . toArray ( ) ) ; } else if ( value == JsonToken . VALUE_NUMBER_INT ) { ret . add ( jp . getValueAsInt ( ) ) ; } else if ( value == JsonToken . VALUE_FALSE || value == JsonToken . VALUE_TRUE ) { ret . add ( jp . getValueAsBoolean ( ) ) ; } else if ( value == JsonToken . VALUE_NUMBER_FLOAT ) { ret . add ( jp . getValueAsDouble ( ) ) ; } else if ( value == JsonToken . VALUE_STRING ) { ret . add ( jp . getValueAsString ( ) ) ; } else if ( value == JsonToken . VALUE_NULL ) { ret . add ( "null" ) ; } value = jp . nextToken ( ) ; } return ret ;
public class FsctlPipeWaitRequest { /** * { @ inheritDoc } * @ see jcifs . Encodable # encode ( byte [ ] , int ) */ @ Override public int encode ( byte [ ] dst , int dstIndex ) { } }
int start = dstIndex ; SMBUtil . writeInt8 ( this . timeout , dst , dstIndex ) ; dstIndex += 8 ; SMBUtil . writeInt4 ( this . nameBytes . length , dst , dstIndex ) ; dstIndex += 4 ; dst [ dstIndex ] = ( byte ) ( this . timeoutSpecified ? 0x1 : 0x0 ) ; dstIndex ++ ; dstIndex ++ ; // Padding System . arraycopy ( this . nameBytes , 0 , dst , dstIndex , this . nameBytes . length ) ; dstIndex += this . nameBytes . length ; return dstIndex - start ;
public class Snippets { /** * Using a CoGroupByKey transform . */ public static PCollection < String > coGroupByKeyTuple ( TupleTag < String > emailsTag , TupleTag < String > phonesTag , PCollection < KV < String , String > > emails , PCollection < KV < String , String > > phones ) { } }
// [ START CoGroupByKeyTuple ] PCollection < KV < String , CoGbkResult > > results = KeyedPCollectionTuple . of ( emailsTag , emails ) . and ( phonesTag , phones ) . apply ( CoGroupByKey . create ( ) ) ; PCollection < String > contactLines = results . apply ( ParDo . of ( new DoFn < KV < String , CoGbkResult > , String > ( ) { @ ProcessElement public void processElement ( ProcessContext c ) { KV < String , CoGbkResult > e = c . element ( ) ; String name = e . getKey ( ) ; Iterable < String > emailsIter = e . getValue ( ) . getAll ( emailsTag ) ; Iterable < String > phonesIter = e . getValue ( ) . getAll ( phonesTag ) ; String formattedResult = Snippets . formatCoGbkResults ( name , emailsIter , phonesIter ) ; c . output ( formattedResult ) ; } } ) ) ; // [ END CoGroupByKeyTuple ] return contactLines ;
public class AbstractAggregatorImpl { /** * / * ( non - Javadoc ) * @ see javax . servlet . http . HttpServlet # doGet ( javax . servlet . http . HttpServletRequest , javax . servlet . http . HttpServletResponse ) */ @ Override protected void doGet ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException { } }
final String sourceMethod = "doGet" ; // $ NON - NLS - 1 $ boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod , new Object [ ] { req , resp } ) ; log . finer ( "Request URL=" + req . getRequestURI ( ) ) ; // $ NON - NLS - 1 $ } if ( isShuttingDown ) { // Server has been shut - down , or is in the process of shutting down . resp . setStatus ( HttpServletResponse . SC_SERVICE_UNAVAILABLE ) ; if ( isTraceLogging ) { log . finer ( "Processing request after server shutdown. Returning SC_SERVICE_UNAVAILABLE" ) ; // $ NON - NLS - 1 $ log . exiting ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod ) ; } return ; } req . setAttribute ( AGGREGATOR_REQATTRNAME , this ) ; resp . addHeader ( "Server" , "JavaScript Aggregator" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ // Check for forced error response in development mode if ( forcedErrorResponse != null && getOptions ( ) . isDevelopmentMode ( ) ) { int status = forcedErrorResponse . getStatus ( ) ; if ( status > 0 ) { // return a forced error status resp . setStatus ( status ) ; URI uri = forcedErrorResponse . getResponseBody ( ) ; if ( uri != null ) { resp . setContentType ( getContentType ( uri . getPath ( ) ) ) ; try { CopyUtil . copy ( newResource ( uri ) . getInputStream ( ) , resp . getOutputStream ( ) ) ; } catch ( IOException e ) { throw new ServletException ( e ) ; } } log . logp ( Level . WARNING , AbstractAggregatorImpl . class . getName ( ) , sourceMethod , "Returning forced error status " + status ) ; // $ NON - NLS - 1 $ return ; } else if ( status < 0 ) { // Forced error response is spent . Remove it . forcedErrorResponse = null ; } } String pathInfo = req . getPathInfo ( ) ; if ( pathInfo == null || ( ILayer . SOURCEMAP_RESOURCE_PATH ) . equals ( pathInfo ) ) { currentRequest . set ( req ) ; try { processAggregatorRequest ( req , resp ) ; } finally { currentRequest . set ( null ) ; } } else { boolean processed = false ; // search resource paths to see if we should treat as aggregator request or resource request for ( Map . Entry < String , URI > entry : resourcePaths . entrySet ( ) ) { String path = entry . getKey ( ) ; if ( entry . getValue ( ) == null ) { if ( path . equals ( pathInfo ) || ( path + ILayer . SOURCEMAP_RESOURCE_PATH ) . equals ( pathInfo ) ) { processAggregatorRequest ( req , resp ) ; processed = true ; break ; } else if ( pathInfo . startsWith ( path ) && pathInfo . charAt ( path . length ( ) ) == '/' ) { // Request for a resource in this bundle String resPath = pathInfo . substring ( path . length ( ) + 1 ) ; processResourceRequest ( req , resp , webContentUri , resPath ) ; processed = true ; break ; } } if ( pathInfo . startsWith ( path ) ) { if ( ( path . length ( ) == pathInfo . length ( ) || pathInfo . charAt ( path . length ( ) ) == '/' ) && entry . getValue ( ) != null ) { String resPath = path . length ( ) == pathInfo . length ( ) ? "" : pathInfo . substring ( path . length ( ) + 1 ) ; // $ NON - NLS - 1 $ URI res = entry . getValue ( ) ; processResourceRequest ( req , resp , res , resPath ) ; processed = true ; break ; } } } if ( ! processed ) { // No mapping found . Try to locate the resource in this bundle . String resPath = pathInfo . substring ( 1 ) ; processResourceRequest ( req , resp , webContentUri , resPath ) ; } } if ( isTraceLogging ) { log . exiting ( AbstractAggregatorImpl . class . getName ( ) , sourceMethod ) ; }
public class ElevationUtil { /** * Creates and returns a shader , which can be used to draw a shadow , which located besides an * edge of an elevated view . * @ param orientation * The orientation of the shadow in relation to the elevated view as a value of the enum * { @ link Orientation } . The orientation may either be < code > LEFT < / code > , * < code > TOP < / code > , < code > RIGHT < / code > or < code > BOTTOM < / code > * @ param bitmapWidth * The width of the bitmap , which is used to draw the shadow , in pixels as an { @ link * Integer } value * @ param bitmapHeight * The height of the bitmap , which is used to draw the shadow , in pixels as an { @ link * Integer } value * @ param shadowWidth * The width of the shadow in pixels as a { @ link Float } value * @ param shadowColor * The color of the shadow as an { @ link Integer } value * @ return The shader , which has been created as an instance of the class { @ link Shader } */ private static Shader createLinearGradient ( @ NonNull final Orientation orientation , final int bitmapWidth , final int bitmapHeight , final float shadowWidth , @ ColorInt final int shadowColor ) { } }
RectF bounds = new RectF ( ) ; switch ( orientation ) { case LEFT : bounds . left = bitmapWidth ; bounds . right = bitmapWidth - shadowWidth ; break ; case TOP : bounds . top = bitmapHeight ; bounds . bottom = bitmapHeight - shadowWidth ; break ; case RIGHT : bounds . right = shadowWidth ; break ; case BOTTOM : bounds . bottom = shadowWidth ; break ; default : throw new IllegalArgumentException ( "Invalid orientation: " + orientation ) ; } return new LinearGradient ( bounds . left , bounds . top , bounds . right , bounds . bottom , shadowColor , Color . TRANSPARENT , Shader . TileMode . CLAMP ) ;
public class SipCall { /** * The waitForIncomingCall ( ) method waits for an INVITE request addressed to this user agent to be * received from the network . Call this method after calling the listenForIncomingCall ( ) method . * This method blocks until one of the following occurs : 1 ) An INVITE message has been received , * addressed to this user agent . In this case , a value of true is returned . The * getLastReceivedRequest ( ) method can be called to get information about the received INVITE * request . Use the method sendIncomingCallResponse ( ) for responding to the received INVITE . 2) * The wait timeout period specified by the parameter to this method expires . False is returned in * this case . 3 ) An error occurs . False is returned in this case . * Any non - INVITE requests received for this user agent are collected while waiting for an INVITE * message and can be seen by calling getAllReceivedRequests ( ) once this method returns . * Regardless of the outcome , incoming requests associated with this User Agent will continue to * be queued up until the stopListeningForRequests ( ) method is called . IT IS RECOMMENDED THAT THE * CALLING PROGRAM STOP LISTENING FOR REQUESTS WHILE NONE ARE EXPECTED . Otherwise alot of overhead * is used up and wasted . Once a listenForXXX ( ) method has been called ( pre - requisite to calling * this method ) and until the stopListeningForRequests ( ) method is called , the calling program can * continue to retrieve specific subsequently received requests by calling one of the waitForXxx ( ) * methods . * @ param timeout The maximum amount of time to wait , in milliseconds . Use a value of 0 to wait * indefinitely . * @ return false in the case of wait timeout or error ; call getReturnCode ( ) and / or * getErrorMessage ( ) and , if applicable , getException ( ) for further diagnostics . A true * value is returned if an INVITE message was received . Call the getLastReceivedRequest ( ) * method to get information about the INVITE , and call the sendIncomingCallResponse ( ) * method to send a response to the INVITE . */ public boolean waitForIncomingCall ( long timeout ) { } }
initErrorInfo ( ) ; receivedRequests . clear ( ) ; receivedResponses . clear ( ) ; transaction = null ; dialog = null ; myTag = null ; callAnswered = false ; RequestEvent event = parent . waitRequest ( timeout ) ; if ( event == null ) { setReturnCode ( parent . getReturnCode ( ) ) ; setErrorMessage ( parent . getErrorMessage ( ) ) ; setException ( parent . getException ( ) ) ; return false ; } Request request = event . getRequest ( ) ; receivedRequests . add ( new SipRequest ( event ) ) ; while ( request . getMethod ( ) . equals ( Request . INVITE ) == false ) { event = parent . waitRequest ( timeout ) ; // TODO , adjust timeout if ( event == null ) { setReturnCode ( parent . getReturnCode ( ) ) ; setErrorMessage ( parent . getErrorMessage ( ) ) ; setException ( parent . getException ( ) ) ; return false ; } request = event . getRequest ( ) ; receivedRequests . add ( new SipRequest ( event ) ) ; continue ; } SipStack . dumpMessage ( "INVITE after received by stack" , request ) ; ServerTransaction tr = event . getServerTransaction ( ) ; if ( tr == null ) { try { tr = parent . getParent ( ) . getSipProvider ( ) . getNewServerTransaction ( request ) ; } catch ( Exception ex ) { setReturnCode ( SipSession . EXCEPTION_ENCOUNTERED ) ; setErrorMessage ( "Exception: " + ex . getClass ( ) . getName ( ) + ": " + ex . getMessage ( ) ) ; setException ( ex ) ; return false ; } } transaction = new SipTransaction ( ) ; transaction . setServerTransaction ( tr ) ; callId = ( CallIdHeader ) request . getHeader ( CallIdHeader . NAME ) ; parent . enableAuthorization ( callId . getCallId ( ) ) ; cseq = ( CSeqHeader ) request . getHeader ( CSeqHeader . NAME ) ; return true ;
public class SumPaths { /** * Computes the approximate sum of paths through the graph where the weight * of each path is the product of edge weights along the path ; * If consumer c is not null , it will be given the intermediate estimates as * they are available */ public static double approxSumPaths ( WeightedIntDiGraph g , RealVector startWeights , RealVector endWeights , Iterator < DiEdge > seq , DoubleConsumer c ) { } }
// we keep track of the total weight of discovered paths ending along // each edge and the total weight // of all paths ending at each node ( including the empty path ) ; on each // time step , we // at each step , we pick an edge ( s , t ) , update the sum at s , and extend // each of those ( including // the empty path starting there ) with the edge ( s , t ) DefaultDict < DiEdge , Double > prefixWeightsEndingAt = new DefaultDict < DiEdge , Double > ( Void -> 0.0 ) ; // we ' ll maintain node sums and overall sum with subtraction rather than // re - adding ( it ' s an approximation anyway ! ) RealVector currentSums = startWeights . copy ( ) ; double currentTotal = currentSums . dotProduct ( endWeights ) ; if ( c != null ) { c . accept ( currentTotal ) ; } for ( DiEdge e : ScheduleUtils . iterable ( seq ) ) { int s = e . get1 ( ) ; int t = e . get2 ( ) ; // compute the new sums double oldTargetSum = currentSums . getEntry ( t ) ; double oldEdgeSum = prefixWeightsEndingAt . get ( e ) ; // new edge sum is the source sum times the edge weight double newEdgeSum = currentSums . getEntry ( s ) * g . getWeight ( e ) ; // new target sum is the old target sum plus the difference between // the new and old edge sums double newTargetSum = oldTargetSum + ( newEdgeSum - oldEdgeSum ) ; // the new total is the old total plus the difference in new and // target double newTotal = currentTotal + ( newTargetSum - oldTargetSum ) * endWeights . getEntry ( t ) ; // store the new sums prefixWeightsEndingAt . put ( e , newEdgeSum ) ; currentSums . setEntry ( t , newTargetSum ) ; currentTotal = newTotal ; // and report the new total to the consumer if ( c != null ) { c . accept ( currentTotal ) ; } } return currentTotal ;
public class NameTable { /** * Given a period - separated name , return as a camel - cased type name . For * example , java . util . logging . Level is returned as JavaUtilLoggingLevel . */ public static String camelCaseQualifiedName ( String fqn ) { } }
StringBuilder sb = new StringBuilder ( ) ; for ( String part : fqn . split ( "\\." ) ) { sb . append ( capitalize ( part ) ) ; } return sb . toString ( ) ;
public class ManagedDatabaseVulnerabilityAssessmentScansInner { /** * Gets a vulnerability assessment scan record of a database . * @ 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 managedInstanceName The name of the managed instance . * @ param databaseName The name of the database . * @ param scanId The vulnerability assessment scan Id of the scan to retrieve . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the VulnerabilityAssessmentScanRecordInner object */ public Observable < VulnerabilityAssessmentScanRecordInner > getAsync ( String resourceGroupName , String managedInstanceName , String databaseName , String scanId ) { } }
return getWithServiceResponseAsync ( resourceGroupName , managedInstanceName , databaseName , scanId ) . map ( new Func1 < ServiceResponse < VulnerabilityAssessmentScanRecordInner > , VulnerabilityAssessmentScanRecordInner > ( ) { @ Override public VulnerabilityAssessmentScanRecordInner call ( ServiceResponse < VulnerabilityAssessmentScanRecordInner > response ) { return response . body ( ) ; } } ) ;
public class BinaryFormatUtils { /** * Read a field value from stream . * @ param in The stream to consume . * @ param fieldInfo The field info about the content . * @ param fieldType The type to generate content for . * @ param strict If the field should be read strictly . * @ return The field value , or null if no type . * @ throws IOException If unable to read from stream or invalid field type . */ public static Object readFieldValue ( BigEndianBinaryReader in , FieldInfo fieldInfo , PDescriptor fieldType , boolean strict ) throws IOException { } }
if ( fieldType != null && forType ( fieldType . getType ( ) ) != fieldInfo . type ) { throw new SerializerException ( "Wrong field type for id=%d: expected %s, got %s" , fieldInfo . id , asString ( forType ( fieldType . getType ( ) ) ) , asString ( fieldInfo . getType ( ) ) ) ; } switch ( fieldInfo . type ) { case BinaryType . VOID : return Boolean . TRUE ; case BinaryType . BOOL : return in . expectByte ( ) != 0 ; case BinaryType . BYTE : return in . expectByte ( ) ; case BinaryType . I16 : return in . expectShort ( ) ; case BinaryType . I32 : int val = in . expectInt ( ) ; if ( fieldType != null && fieldType instanceof PEnumDescriptor ) { @ SuppressWarnings ( "unchecked" ) PEnumBuilder builder = ( ( PEnumDescriptor < ? > ) fieldType ) . builder ( ) ; builder . setById ( val ) ; return builder . build ( ) ; } else { return val ; } case BinaryType . I64 : return in . expectLong ( ) ; case BinaryType . DOUBLE : return in . expectDouble ( ) ; case BinaryType . STRING : int len = in . expectUInt32 ( ) ; byte [ ] data = in . expectBytes ( len ) ; if ( fieldType != null && fieldType . getType ( ) == PType . STRING ) { return new String ( data , StandardCharsets . UTF_8 ) ; } else { return Binary . wrap ( data ) ; } case BinaryType . STRUCT : { if ( fieldType == null ) { consumeMessage ( in ) ; return null ; } return readMessage ( in , ( PMessageDescriptor < ? , ? > ) fieldType , strict ) ; } case BinaryType . MAP : { final byte keyT = in . expectByte ( ) ; final byte itemT = in . expectByte ( ) ; final int size = in . expectUInt32 ( ) ; PDescriptor keyType = null ; PDescriptor valueType = null ; PMap . Builder < Object , Object > out ; if ( fieldType != null ) { @ SuppressWarnings ( "unchecked" ) PMap < Object , Object > mapType = ( PMap < Object , Object > ) fieldType ; keyType = mapType . keyDescriptor ( ) ; valueType = mapType . itemDescriptor ( ) ; out = mapType . builder ( ) ; } else { out = new PMap . DefaultBuilder < > ( ) ; } FieldInfo keyInfo = new FieldInfo ( 1 , keyT ) ; FieldInfo itemInfo = new FieldInfo ( 2 , itemT ) ; for ( int i = 0 ; i < size ; ++ i ) { Object key = readFieldValue ( in , keyInfo , keyType , strict ) ; Object value = readFieldValue ( in , itemInfo , valueType , strict ) ; if ( key != null && value != null ) { out . put ( key , value ) ; } else if ( strict ) { if ( key == null ) { throw new SerializerException ( "Null key in map" ) ; } else { throw new SerializerException ( "Null value in map" ) ; } } } return out . build ( ) ; } case BinaryType . SET : { final byte itemT = in . expectByte ( ) ; final int size = in . expectUInt32 ( ) ; PDescriptor entryType = null ; PSet . Builder < Object > out ; if ( fieldType != null ) { @ SuppressWarnings ( "unchecked" ) PSet < Object > setType = ( PSet < Object > ) fieldType ; entryType = setType . itemDescriptor ( ) ; out = setType . builder ( ) ; } else { out = new PSet . DefaultBuilder < > ( ) ; } FieldInfo itemInfo = new FieldInfo ( 0 , itemT ) ; for ( int i = 0 ; i < size ; ++ i ) { Object value = readFieldValue ( in , itemInfo , entryType , strict ) ; if ( value != null ) { out . add ( value ) ; } else if ( strict ) { throw new SerializerException ( "Null value in set" ) ; } } return out . build ( ) ; } case BinaryType . LIST : { final byte itemT = in . expectByte ( ) ; final int size = in . expectUInt32 ( ) ; PDescriptor entryType = null ; PList . Builder < Object > out ; if ( fieldType != null ) { @ SuppressWarnings ( "unchecked" ) PList < Object > listType = ( PList < Object > ) fieldType ; entryType = listType . itemDescriptor ( ) ; out = listType . builder ( ) ; } else { out = new PList . DefaultBuilder < > ( ) ; } FieldInfo itemInfo = new FieldInfo ( 0 , itemT ) ; for ( int i = 0 ; i < size ; ++ i ) { Object value = readFieldValue ( in , itemInfo , entryType , strict ) ; if ( value != null ) { out . add ( value ) ; } else if ( strict ) { throw new SerializerException ( "Null value in list" ) ; } } return out . build ( ) ; } default : throw new SerializerException ( "unknown data type: " + fieldInfo . getType ( ) ) ; }
public class PrBuOr { /** * < p > Retrieve page . < / p > * @ param pRqVs request scoped vars * @ param pRqDt Request Data * @ param pBuyr buyer * @ throws Exception - an exception */ public final void page ( final Map < String , Object > pRqVs , final IRequestData pRqDt , final OnlineBuyer pBuyr ) throws Exception { } }
TradingSettings ts = ( TradingSettings ) pRqVs . get ( "tradSet" ) ; // orders : int page ; String pgSt = pRqDt . getParameter ( "pg" ) ; if ( pgSt != null ) { page = Integer . parseInt ( pgSt ) ; } else { page = 1 ; } String wheBr = "BUYER=" + pBuyr . getItsId ( ) ; Integer rowCount = this . srvOrm . evalRowCountWhere ( pRqVs , CustOrder . class , wheBr ) ; Integer itemsPerPage = ts . getItemsPerPage ( ) ; int totalPages = this . srvPage . evalPageCount ( rowCount , itemsPerPage ) ; if ( page > totalPages ) { page = totalPages ; } int firstResult = ( page - 1 ) * itemsPerPage ; // 0-20,20-40 Integer paginationTail = Integer . valueOf ( mngUvd . getAppSettings ( ) . get ( "paginationTail" ) ) ; List < Page > pages = this . srvPage . evalPages ( page , totalPages , paginationTail ) ; pRqDt . setAttribute ( "pgs" , pages ) ; String tbn = CustOrder . class . getSimpleName ( ) ; Set < String > ndFlNm = new HashSet < String > ( ) ; ndFlNm . add ( "itsId" ) ; ndFlNm . add ( "itsName" ) ; pRqVs . put ( "PickUpPlaceneededFields" , ndFlNm ) ; pRqVs . put ( tbn + "buyerdeepLevel" , 1 ) ; List < CustOrder > orders = getSrvOrm ( ) . retrievePageWithConditions ( pRqVs , CustOrder . class , "where " + wheBr , firstResult , itemsPerPage ) ; pRqVs . remove ( tbn + "buyerdeepLevel" ) ; pRqDt . setAttribute ( "ords" , orders ) ; // S . E . orders : pgSt = pRqDt . getParameter ( "spg" ) ; if ( pgSt != null ) { page = Integer . parseInt ( pgSt ) ; } else { page = 1 ; } rowCount = this . srvOrm . evalRowCountWhere ( pRqVs , CuOrSe . class , wheBr ) ; itemsPerPage = ts . getItemsPerPage ( ) ; totalPages = this . srvPage . evalPageCount ( rowCount , itemsPerPage ) ; if ( page > totalPages ) { page = totalPages ; } firstResult = ( page - 1 ) * itemsPerPage ; // 0-20,20-40 pages = this . srvPage . evalPages ( 1 , totalPages , paginationTail ) ; pRqDt . setAttribute ( "spgs" , pages ) ; tbn = CuOrSe . class . getSimpleName ( ) ; Set < String > ndFlDc = new HashSet < String > ( ) ; ndFlDc . add ( "seller" ) ; pRqVs . put ( "DebtorCreditorneededFields" , ndFlNm ) ; pRqVs . put ( "SeSellerneededFields" , ndFlDc ) ; pRqVs . put ( "CuOrSeseldeepLevel" , 3 ) ; pRqVs . put ( tbn + "buyerdeepLevel" , 1 ) ; List < CuOrSe > sorders = getSrvOrm ( ) . retrievePageWithConditions ( pRqVs , CuOrSe . class , "where " + wheBr , firstResult , itemsPerPage ) ; pRqVs . remove ( tbn + "buyerdeepLevel" ) ; pRqVs . remove ( "DebtorCreditorneededFields" ) ; pRqVs . remove ( "SeSellerneededFields" ) ; pRqVs . remove ( "CuOrSeseldeepLevel" ) ; pRqVs . remove ( "PickUpPlaceneededFields" ) ; pRqDt . setAttribute ( "sords" , sorders ) ;
public class RouteContext { /** * Returns a request parameter for a Long type * @ param paramName Parameter name * @ param defaultValue default long value * @ return Return Long parameter values */ public Long queryLong ( String paramName , Long defaultValue ) { } }
return this . request . queryLong ( paramName , defaultValue ) ;
public class Krb5Common { /** * This method restore the property value to the original value . * @ param propName * @ param oldPropValue * @ param newPropValue */ public static void restorePropertyAsNeeded ( final String propName , final String oldPropValue , final String newPropValue ) { } }
java . security . AccessController . doPrivileged ( new java . security . PrivilegedAction < Object > ( ) { @ Override public Object run ( ) { if ( oldPropValue == null ) { System . clearProperty ( propName ) ; } else if ( ! oldPropValue . equalsIgnoreCase ( newPropValue ) ) { System . setProperty ( propName , oldPropValue ) ; } return null ; } } ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Restore property " + propName + " to previous value: " + oldPropValue ) ;
public class CreateIssueParams { /** * Sets the multiple list type custom field . * @ param customFiledItems the custom field identifiers and custom field item identifiers * @ return CreateIssueParams instance */ public CreateIssueParams multipleListCustomField ( CustomFiledItems customFiledItems ) { } }
for ( Object id : customFiledItems . getCustomFieldItemIds ( ) ) { parameters . add ( new NameValuePair ( "customField_" + customFiledItems . getCustomFieldId ( ) , id . toString ( ) ) ) ; } return this ;
public class PrimaveraReader { /** * Process project properties . * @ param rows project properties data . * @ param projectID project ID */ public void processProjectProperties ( List < Row > rows , Integer projectID ) { } }
if ( rows . isEmpty ( ) == false ) { Row row = rows . get ( 0 ) ; ProjectProperties properties = m_project . getProjectProperties ( ) ; properties . setCreationDate ( row . getDate ( "create_date" ) ) ; properties . setFinishDate ( row . getDate ( "plan_end_date" ) ) ; properties . setName ( row . getString ( "proj_short_name" ) ) ; properties . setStartDate ( row . getDate ( "plan_start_date" ) ) ; // data _ date ? properties . setDefaultTaskType ( TASK_TYPE_MAP . get ( row . getString ( "def_duration_type" ) ) ) ; properties . setStatusDate ( row . getDate ( "last_recalc_date" ) ) ; properties . setFiscalYearStartMonth ( row . getInteger ( "fy_start_month_num" ) ) ; properties . setUniqueID ( projectID == null ? null : projectID . toString ( ) ) ; properties . setExportFlag ( row . getBoolean ( "export_flag" ) ) ; // cannot assign actual calendar yet as it has not been read yet m_defaultCalendarID = row . getInteger ( "clndr_id" ) ; }
public class CronDescriptor { /** * Provide description for a year . * @ param fields - fields to describe ; * @ return description - String */ public String describeYear ( final Map < CronFieldName , CronField > fields ) { } }
final String description = DescriptionStrategyFactory . plainInstance ( resourceBundle , fields . containsKey ( CronFieldName . YEAR ) ? fields . get ( CronFieldName . YEAR ) . getExpression ( ) : null ) . describe ( ) ; return addExpressions ( description , resourceBundle . getString ( "year" ) , resourceBundle . getString ( "years" ) ) ;
public class GetStageResult { /** * A map that defines the stage variables for a stage resource . Variable names can have alphanumeric and underscore * characters , and the values must match [ A - Za - z0-9 - . _ ~ : / ? # & = , ] + . * @ param stageVariables * A map that defines the stage variables for a stage resource . Variable names can have alphanumeric and * underscore characters , and the values must match [ A - Za - z0-9 - . _ ~ : / ? # & = , ] + . * @ return Returns a reference to this object so that method calls can be chained together . */ public GetStageResult withStageVariables ( java . util . Map < String , String > stageVariables ) { } }
setStageVariables ( stageVariables ) ; return this ;
public class RegexpUtils { /** * Returns a RegexpMatcher that works in a specific environment . < br > * When in a JVM 1.3.1 it will return a Perl5RegexpMatcher , if the JVM is * younger ( 1.4 + ) it will return a JdkRegexpMatcher . */ public static RegexpMatcher getMatcher ( String pattern , boolean multiline ) { } }
if ( isJDK13 ( ) ) { return new Perl5RegexpMatcher ( pattern , true ) ; } else { return new JdkRegexpMatcher ( pattern , true ) ; }
public class JITDeploy { /** * Parse an rmic compatibility options string . * @ param options the options string * @ return the compatibility flags * @ see # isRMICCompatibleValues */ public static int parseRMICCompatible ( String options ) // PM46698 { } }
final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "parseRMICCompatible: " + options ) ; int flags ; if ( options == null ) { flags = RMIC_COMPATIBLE_DEFAULT ; } else if ( options . equals ( "none" ) ) { flags = 0 ; } else if ( options . isEmpty ( ) || options . equals ( "all" ) ) { flags = - 1 ; } else { flags = 0 ; for ( String option : options . split ( "," ) ) { if ( option . equals ( "values" ) ) { flags |= RMIC_COMPATIBLE_VALUES ; } else if ( option . equals ( "exceptions" ) ) // PM94096 { flags |= RMIC_COMPATIBLE_EXCEPTIONS ; } else { throw new IllegalArgumentException ( "unknown RMIC compatibility option: " + option ) ; } } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "parseRMICCompatible: " + Integer . toHexString ( flags ) ) ; return flags ;
public class CanonicalXML { /** * Receive notification of the start of an element . * < p > By default , do nothing . Application writers may override this * method in a subclass to take specific actions at the start of * each element ( such as allocating a new tree node or writing * output to a file ) . < / p > * @ param uriThe Namespace URI , or the empty string if the * element has no Namespace URI or if Namespace * processing is not being performed . * @ param localName The local name ( without prefix ) , or the * empty string if Namespace processing is not being * performed . * @ param qName The qualified name ( with prefix ) , or the * empty string if qualified names are not available . * @ param atts The attributes attached to the element . If * there are no attributes , it shall be an empty * Attributes object . * @ throws org . xml . sax . SAXException Any SAX exception , possibly * wrapping another exception . * @ see org . xml . sax . ContentHandler # startElement */ @ Override public void startElement ( String uri , String localName , String qName , Attributes atts ) throws SAXException { } }
flushChars ( ) ; write ( "<" ) ; write ( qName ) ; // output the namespaces outputAttributes ( mNamespaces ) ; // output the attributes outputAttributes ( atts ) ; write ( ">" ) ; mNamespaces . clear ( ) ;
public class JSMinPostProcessor { /** * ( non - Javadoc ) * @ see net . jawr . web . resource . bundle . postprocess . impl . * AbstractChainedResourceBundlePostProcessor # doPostProcessBundle ( java . lang . * StringBuffer ) */ @ Override protected StringBuffer doPostProcessBundle ( BundleProcessingStatus status , StringBuffer bundleString ) throws IOException { } }
Charset charset = status . getJawrConfig ( ) . getResourceCharset ( ) ; // The original JSMin doesn ' t handle Dos ( CRLF ) line endings // So here we replace the CRLF with LF only String bundleContent = bundleString . toString ( ) . replaceAll ( CR_LF , LF ) ; byte [ ] bundleBytes = bundleContent . getBytes ( charset . name ( ) ) ; ByteArrayInputStream bIs = new ByteArrayInputStream ( bundleBytes ) ; ByteArrayOutputStream bOs = new ByteArrayOutputStream ( ) ; // Compress data and recover it as a byte array . JSMin minifier = new JSMin ( bIs , bOs ) ; try { minifier . jsmin ( ) ; } catch ( JSMinException e ) { formatAndThrowJSLintError ( status , bundleBytes , e ) ; } byte [ ] minified = bOs . toByteArray ( ) ; return byteArrayToString ( charset , minified ) ;
public class MonitoringServiceWrapper { /** * Sends all events to the web service . Events will be transformed with mapper before sending . * @ param events the events */ public void putEvents ( List < Event > events ) { } }
Exception lastException ; List < EventType > eventTypes = new ArrayList < EventType > ( ) ; for ( Event event : events ) { EventType eventType = EventMapper . map ( event ) ; eventTypes . add ( eventType ) ; } int i = 0 ; lastException = null ; while ( i < numberOfRetries ) { try { monitoringService . putEvents ( eventTypes ) ; break ; } catch ( Exception e ) { lastException = e ; i ++ ; } if ( i < numberOfRetries ) { try { Thread . sleep ( delayBetweenRetry ) ; } catch ( InterruptedException e ) { break ; } } } if ( i == numberOfRetries ) { throw new MonitoringException ( "1104" , "Could not send events to monitoring service after " + numberOfRetries + " retries." , lastException , events ) ; }
public class PlaylistSubscriberStream { /** * { @ inheritDoc } */ public String scheduleOnceJob ( IScheduledJob job ) { } }
String jobName = schedulingService . addScheduledOnceJob ( 10 , job ) ; return jobName ;
public class OpenSSLAnalyzer { /** * Retrieves the contents of a given file . * @ param actualFile the file to read * @ return the contents of the file * @ throws AnalysisException thrown if there is an IO Exception */ private String getFileContents ( final File actualFile ) throws AnalysisException { } }
try { return FileUtils . readFileToString ( actualFile , Charset . defaultCharset ( ) ) . trim ( ) ; } catch ( IOException e ) { throw new AnalysisException ( "Problem occurred while reading dependency file." , e ) ; }
public class IntegerList { /** * Replies the segment index for the specified value . * < p > The given array must be pre - allocated with at least 2 cells . * The first cell will the the index of the segment . The * second cell will be the first integer value . * @ param offset is the number of integer values to skip from the * begining of the value set . * @ param tofill is the 2 - cell array to fill * @ return < code > true < / code > on success , < code > false < / code > otherwise . */ protected boolean get ( int offset , int [ ] tofill ) { } }
if ( this . values != null ) { int idxTab = 0 ; for ( int idxStart = 0 ; idxStart < this . values . length - 1 ; idxStart += 2 ) { for ( int n = this . values [ idxStart ] ; n <= this . values [ idxStart + 1 ] ; ++ n ) { if ( offset == idxTab ) { tofill [ 0 ] = idxStart ; tofill [ 1 ] = n ; return true ; } ++ idxTab ; } } } tofill [ 0 ] = - 1 ; tofill [ 1 ] = 0 ; return false ;
public class ClassInfo { /** * Check for the type query bean and type query user annotations . */ public void checkTypeQueryAnnotation ( String desc ) { } }
if ( isEntityBeanAnnotation ( desc ) ) { throw new NoEnhancementRequiredException ( "Not enhancing entity bean" ) ; } if ( isTypeQueryBeanAnnotation ( desc ) ) { typeQueryBean = true ; } else if ( isAlreadyEnhancedAnnotation ( desc ) ) { alreadyEnhanced = true ; }
public class BinaryArrayWeakHeap { /** * Join two weak heaps into one . * @ param i * root of the first weak heap * @ param j * root of the second weak heap * @ return true if already a weak heap , false if a flip was needed */ @ SuppressWarnings ( "unchecked" ) protected boolean join ( int i , int j ) { } }
if ( ( ( Comparable < ? super K > ) array [ j ] ) . compareTo ( array [ i ] ) < 0 ) { K tmp = array [ i ] ; array [ i ] = array [ j ] ; array [ j ] = tmp ; reverse . flip ( j ) ; return false ; } return true ;
public class Query { /** * Create a copy of this query , but that returns results that include the columns specified by this query as well as the * supplied columns . * @ param columns the additional columns that should be included in the the results ; may not be null * @ return the copy of the query returning the supplied result columns ; never null */ public Query adding ( Column ... columns ) { } }
List < Column > newColumns = null ; if ( this . columns != null ) { newColumns = new ArrayList < Column > ( this . columns ) ; for ( Column column : columns ) { newColumns . add ( column ) ; } } else { newColumns = Arrays . asList ( columns ) ; } return new Query ( source , constraint , orderings ( ) , newColumns , getLimits ( ) , distinct ) ;
public class PNGDecoder { /** * Decodes the image into the specified buffer . The last line is placed at * the current position . After decode the buffer position is at the end of * the first line . * @ param buffer the buffer * @ param stride the stride in bytes from start of a line to start of the next line , must be positive . * @ param fmt the target format into which the image should be decoded . * @ throws IOException if a read or data error occurred * @ throws IllegalArgumentException if the start position of a line falls outside the buffer * @ throws UnsupportedOperationException if the image can ' t be decoded into the desired format */ public void decodeFlipped ( ByteBuffer buffer , int stride , Format fmt ) throws IOException { } }
if ( stride <= 0 ) { throw new IllegalArgumentException ( "stride" ) ; } int pos = buffer . position ( ) ; int posDelta = ( height - 1 ) * stride ; buffer . position ( pos + posDelta ) ; decode ( buffer , - stride , fmt ) ; buffer . position ( buffer . position ( ) + posDelta ) ;
public class GuiceyBootstrap { /** * May be used to access unique sub configuration object . This is helpful for bundles universality : * suppose bundle X requires configuration object XConf and we are sure that only one declaration of XConf would * be used in target configuration class , then we can simply request it : * { @ code configuration ( XConf . class ) = = < instance of XConf or null > } . * Note that uniqueness is checked by declaration class : * < pre > { @ code class Config extends Configuration { * Sub sub ; * SubExt ext ; / / SubExt extends Sub * } } < / pre > * are unique declarations ( declaration of the same type never appears in configuration on any level ) . * { @ code configuration ( Sub . class ) = = sub } and { @ code configuration ( SubExt . class ) = = ext } . * Example of accessing server config from dropwizard configuration : * { @ code configuration ( ServerFactory . class ) = = DefaultServerFactory ( or SimpleServerFactory ) } * ( see dropwizard { @ link Configuration } class ) . * @ param type target configuration declaration type * @ param < T > declaration type * @ param < K > required value type ( may be the same or extending type ) * @ return unique configuration value or null if value is null or no declaration found * @ see # configurationTree ( ) for custom configuration searches */ public < T , K extends T > K configuration ( final Class < T > type ) { } }
return configurationTree ( ) . valueByUniqueDeclaredType ( type ) ;
public class nsip { /** * Use this API to fetch filtered set of nsip resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static nsip [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
nsip obj = new nsip ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; nsip [ ] response = ( nsip [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class DateUtils { /** * Helper for getting epoch { @ link DateTime } object * @ return { @ link DateTime } representing epoch */ public static DateTime epoch ( ) { } }
MutableDateTime epoch = new MutableDateTime ( ) ; epoch . setDate ( 0 ) ; epoch . setTime ( 0 ) ; return epoch . toDateTime ( ) ;
public class API { /** * Gets the HTML representation of the given API { @ code response } . * An empty HTML head with the HTML body containing the API response ( as given by { @ link ApiResponse # toHTML ( StringBuilder ) } . * @ param response the API response , must not be { @ code null } . * @ return the HTML representation of the given response . */ static String responseToHtml ( ApiResponse response ) { } }
StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<head>\n" ) ; sb . append ( "</head>\n" ) ; sb . append ( "<body>\n" ) ; response . toHTML ( sb ) ; sb . append ( "</body>\n" ) ; return sb . toString ( ) ;
public class NetworkImageView { /** * Loads the image for the view if it isn ' t already loaded . * @ param isInLayoutPass True if this was invoked from a layout pass , false otherwise . */ synchronized void loadImageIfNecessary ( final boolean isInLayoutPass ) { } }
int width = getWidth ( ) ; int height = getHeight ( ) ; boolean wrapWidth = false , wrapHeight = false ; if ( getLayoutParams ( ) != null ) { wrapWidth = getLayoutParams ( ) . width == LayoutParams . WRAP_CONTENT ; wrapHeight = getLayoutParams ( ) . height == LayoutParams . WRAP_CONTENT ; } // if the view ' s bounds aren ' t known yet , and this is not a wrap - content / wrap - content // view , hold off on loading the image . boolean isFullyWrapContent = wrapWidth && wrapHeight ; if ( width == 0 && height == 0 && ! isFullyWrapContent ) { return ; } // if the URL to be loaded in this view is empty , cancel any old requests and clear the // currently loaded image . if ( TextUtils . isEmpty ( url ) ) { if ( imageContainer != null ) { imageContainer . cancelRequest ( ) ; imageContainer = null ; } setDefaultImageOrNull ( ) ; return ; } // if there was an old request in this view , check if it needs to be canceled . if ( imageContainer != null && imageContainer . getRequestUrl ( ) != null ) { if ( imageContainer . getRequestUrl ( ) . equals ( url ) ) { // if the request is from the same URL , return . return ; } else { // if there is a pre - existing request , cancel it if it ' s fetching a different URL . imageContainer . cancelRequest ( ) ; setDefaultImageOrNull ( ) ; } } // Calculate the max image width / height to use while ignoring WRAP _ CONTENT dimens . int maxWidth = wrapWidth ? 0 : width ; int maxHeight = wrapHeight ? 0 : height ; // The pre - existing content of this view didn ' t match the current URL . Load the new image // from the network . ImageContainer newContainer = imageLoader . get ( url , new ImageListener ( ) { @ Override public void onError ( JusError error ) { if ( errorImageId != 0 ) { setImageResource ( errorImageId ) ; } } @ Override public void onResponse ( final ImageContainer response , boolean isImmediate ) { // verify if we expect the same url if ( NetworkImageView . this . url == null || ! NetworkImageView . this . url . equals ( response . getRequestUrl ( ) ) ) { JusLog . error ( "NetworkImageView received: " + response . getRequestUrl ( ) + ", expected: " + NetworkImageView . this . url ) ; return ; } // If this was an immediate response that was delivered inside of a layout // pass do not set the image immediately as it will trigger a requestLayout // inside of a layout . Instead , defer setting the image by posting back to // the main threadId . if ( isImmediate && isInLayoutPass ) { post ( new Runnable ( ) { @ Override public void run ( ) { onResponse ( response , false ) ; } } ) ; return ; } if ( response . getBitmap ( ) != null && isOk2Draw ( response . getBitmap ( ) ) ) { setImageBitmap ( response . getBitmap ( ) ) ; } else if ( defaultImageId != 0 ) { if ( ! isImmediate ) { JusLog . error ( "NetworkImageView received null for: " + response . getRequestUrl ( ) ) ; } setImageResource ( defaultImageId ) ; } } } , maxWidth , maxHeight , tag ) ; // update the ImageContainer to be the new bitmap container . imageContainer = newContainer ;
public class CreativeTemplate { /** * Sets the variables value for this CreativeTemplate . * @ param variables * The list of creative template variables . This attribute is * required . */ public void setVariables ( com . google . api . ads . admanager . axis . v201805 . CreativeTemplateVariable [ ] variables ) { } }
this . variables = variables ;
public class ManagementClientAsync { /** * Retrieves the runtime information of a subscription in a given topic * @ param topicPath - The path of the topic relative to service bus namespace . * @ param subscriptionName - The name of the subscription * @ return - SubscriptionRuntimeInfo containing the runtime information about the subscription . * @ throws IllegalArgumentException - Thrown if path is null , empty , or not in right format or length . */ public CompletableFuture < SubscriptionRuntimeInfo > getSubscriptionRuntimeInfoAsync ( String topicPath , String subscriptionName ) { } }
EntityNameHelper . checkValidTopicName ( topicPath ) ; EntityNameHelper . checkValidSubscriptionName ( subscriptionName ) ; String path = EntityNameHelper . formatSubscriptionPath ( topicPath , subscriptionName ) ; CompletableFuture < String > contentFuture = getEntityAsync ( path , null , true ) ; CompletableFuture < SubscriptionRuntimeInfo > sdFuture = new CompletableFuture < > ( ) ; contentFuture . handleAsync ( ( content , ex ) -> { if ( ex != null ) { sdFuture . completeExceptionally ( ex ) ; } else { try { sdFuture . complete ( SubscriptionRuntimeInfoSerializer . parseFromContent ( topicPath , content ) ) ; } catch ( MessagingEntityNotFoundException e ) { sdFuture . completeExceptionally ( e ) ; } } return null ; } , MessagingFactory . INTERNAL_THREAD_POOL ) ; return sdFuture ;
public class ModularParser { /** * Returns the number of Equality Chars which are used to specify the level * of the Section . */ private int getSectionLevel ( SpanManager sm , Span sectionNameSpan ) { } }
int begin = sectionNameSpan . getStart ( ) ; int end = sectionNameSpan . getEnd ( ) ; int level = 0 ; try { while ( ( sm . charAt ( begin + level ) == '=' ) && ( sm . charAt ( end - 1 - level ) == '=' ) ) { level ++ ; } } catch ( StringIndexOutOfBoundsException e ) { // there is no need to do anything ! logger . debug ( "EXCEPTION IS OK: {}" , e . getLocalizedMessage ( ) ) ; } if ( begin + level == end ) { level = ( level - 1 ) / 2 ; } return level ;
public class AbstractLibertySupport { /** * Resolves the Artifact from the remote repository if necessary . If no version is specified , it will * be retrieved from the dependency list or from the DependencyManagement section of the pom . * @ param item The item to create an artifact for ; must not be null * @ return The artifact for the given item * @ throws MojoExecutionException Failed to create artifact */ @ Override protected Artifact getArtifact ( final ArtifactItem item ) throws MojoExecutionException { } }
assert item != null ; Artifact artifact = null ; if ( item . getVersion ( ) != null ) { // if version is set in ArtifactItem , it will always override the one in project dependency artifact = createArtifact ( item ) ; } else { // Return the artifact from the project dependency if it is available and the mojo // should have requiresDependencyResolution = ResolutionScope . COMPILE _ PLUS _ RUNTIME set artifact = resolveFromProjectDependencies ( item ) ; if ( artifact != null ) { // in case it is not resolved yet if ( ! artifact . isResolved ( ) ) { item . setVersion ( artifact . getVersion ( ) ) ; artifact = createArtifact ( item ) ; } } else if ( resolveFromProjectDepMgmt ( item ) != null ) { // if item has no version set , try to get it from the project dependencyManagement section // get version from dependencyManagement item . setVersion ( resolveFromProjectDepMgmt ( item ) . getVersion ( ) ) ; artifact = createArtifact ( item ) ; } else { throw new MojoExecutionException ( "Unable to find artifact version of " + item . getGroupId ( ) + ":" + item . getArtifactId ( ) + " in either project dependencies or in project dependencyManagement." ) ; } } return artifact ;
public class AmazonCloudWatchEventsClient { /** * Sends custom events to Amazon CloudWatch Events so that they can be matched to rules . * @ param putEventsRequest * @ return Result of the PutEvents operation returned by the service . * @ throws InternalException * This exception occurs due to unexpected causes . * @ sample AmazonCloudWatchEvents . PutEvents * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / events - 2015-10-07 / PutEvents " target = " _ top " > AWS API * Documentation < / a > */ @ Override public PutEventsResult putEvents ( PutEventsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executePutEvents ( request ) ;
public class DateTableEditor { /** * getTableCellRendererComponent , Returns the renderer that is used for drawing the cell . This * is required by the TableCellRenderer interface . * For additional details , see the Javadocs for the function : * TableCellRenderer . getTableCellRendererComponent ( ) . */ @ Override public Component getTableCellRendererComponent ( JTable table , Object value , boolean isSelected , boolean hasFocus , int row , int column ) { } }
// Save the supplied value to the date picker . setCellEditorValue ( value ) ; // Draw the appropriate background colors to indicate a selected or unselected state . if ( isSelected ) { if ( matchTableSelectionBackgroundColor ) { datePicker . getComponentDateTextField ( ) . setBackground ( table . getSelectionBackground ( ) ) ; datePicker . setBackground ( table . getSelectionBackground ( ) ) ; } else { datePicker . zDrawTextFieldIndicators ( ) ; } } if ( ! isSelected ) { if ( matchTableBackgroundColor ) { datePicker . getComponentDateTextField ( ) . setBackground ( table . getBackground ( ) ) ; datePicker . setBackground ( table . getBackground ( ) ) ; } else { datePicker . zDrawTextFieldIndicators ( ) ; } } // Draw the appropriate borders to indicate a focused or unfocused state . if ( hasFocus ) { datePicker . setBorder ( borderFocusedCell ) ; } else { datePicker . setBorder ( borderUnfocusedCell ) ; } // If needed , adjust the minimum row height for the table . zAdjustTableRowHeightIfNeeded ( table ) ; // This fixes a bug where the date text could " move around " during a table resize event . datePicker . getComponentDateTextField ( ) . setScrollOffset ( 0 ) ; // Return the date picker component . return datePicker ;
public class ContentExtractor { /** * / * 输入Jsoup的Document , 获取正文文本 */ public static String getContentByDoc ( Document doc ) throws Exception { } }
ContentExtractor ce = new ContentExtractor ( doc ) ; return ce . getContentElement ( ) . text ( ) ;
public class AbstractWebPageForm { /** * Check if passed object allows for the specified action . * @ param aWPEC * The web page execution context . Never < code > null < / code > . * @ param eFormAction * The form action that is to be checked . Never < code > null < / code > and * never { @ link EWebPageFormAction # SHOW _ LIST } . * @ param aSelectedObject * The currently selected object . May be < code > null < / code > . * @ return < code > true < / code > if the action is allowed , < code > false < / code > if * not */ @ OverrideOnDemand protected boolean isActionAllowed ( @ Nonnull final WPECTYPE aWPEC , @ Nonnull final EWebPageFormAction eFormAction , @ Nullable final DATATYPE aSelectedObject ) { } }
return true ;
public class DeflateOutputHandler { /** * @ see com . ibm . wsspi . http . channel . compression . CompressionHandler # finish ( ) */ public List < WsByteBuffer > finish ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "finish" ) ; } List < WsByteBuffer > list = new LinkedList < WsByteBuffer > ( ) ; if ( isFinished ( ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "finish, previously finished" ) ; } return list ; } WsByteBuffer buffer = null ; this . deflater . finish ( ) ; while ( ! this . deflater . finished ( ) ) { int num = this . deflater . deflate ( this . buf , 0 , this . buf . length ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Compressed amount=" + num + " read=" + this . deflater . getBytesRead ( ) + " written=" + this . deflater . getBytesWritten ( ) ) ; } if ( 0 < num ) { buffer = makeBuffer ( num ) ; list . add ( buffer ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "finish, return list of size " + list . size ( ) ) ; } return list ;
public class DecimalWithUoMType { /** * { @ inheritDoc } */ @ Override public Object format ( final Object _object , final String _pattern ) throws EFapsException { } }
final Object ret ; final DecimalFormat formatter = ( DecimalFormat ) NumberFormat . getInstance ( Context . getThreadContext ( ) . getLocale ( ) ) ; formatter . applyPattern ( _pattern ) ; if ( _object instanceof Object [ ] ) { final String tmp = formatter . format ( ( ( Object [ ] ) _object ) [ 0 ] ) ; ( ( Object [ ] ) _object ) [ 0 ] = tmp ; ret = _object ; } else { ret = formatter . format ( _object ) ; } return ret ;
public class PseudoClassSpecifierChecker { /** * Add the { @ code : root } element . * @ see < a href = " http : / / www . w3 . org / TR / css3 - selectors / # root - pseudo " > < code > : root < / code > pseudo - class < / a > */ private void addRootElement ( ) { } }
if ( root instanceof Document ) { // Get the single element child of the document node . // There could be a doctype node and comment nodes that we must skip . Element element = DOMHelper . getFirstChildElement ( root ) ; Assert . notNull ( element , "there should be a root element!" ) ; result . add ( element ) ; } else { Assert . isTrue ( root instanceof Element , "root must be a document or element node!" ) ; result . add ( root ) ; }
public class IndexTree { /** * Returns the node with the specified id . * @ param nodeID the page id of the node to be returned * @ return the node with the specified id */ public N getNode ( int nodeID ) { } }
if ( nodeID == getPageID ( rootEntry ) ) { return getRoot ( ) ; } else { return file . readPage ( nodeID ) ; }
public class Configuration { /** * Adds the given byte array to the configuration object . If key is < code > null < / code > then nothing is added . * @ param key * The key under which the bytes are added . * @ param bytes * The bytes to be added . */ public void setBytes ( String key , byte [ ] bytes ) { } }
String encoded = new String ( Base64 . encodeBase64 ( bytes ) ) ; setStringInternal ( key , encoded ) ;
public class JasonShanksAgent { /** * ( non - Javadoc ) * @ see jason . architecture . AgArch # act ( jason . asSemantics . ActionExec , * java . util . List ) */ public void act ( ActionExec action , List < ActionExec > feedback ) { } }
if ( ! isRunning ( ) ) return ; if ( this . getSimulation ( ) == null ) return ; boolean result = false ; Structure actionStructure = action . getActionTerm ( ) ; String actionID = actionStructure . getFunctor ( ) ; try { if ( this . actions . containsKey ( actionID ) ) { Constructor < ? extends JasonShanksAgentAction > c = this . actions . get ( actionID ) . getConstructor ( new Class [ ] { String . class , Steppable . class } ) ; JasonShanksAgentAction shanksAction = c . newInstance ( this . getID ( ) , this , this . getLogger ( ) ) ; result = shanksAction . executeAction ( this . getSimulation ( ) , this , actionStructure . getTerms ( ) ) ; } else { throw new UnknownShanksAgentActionException ( actionID , this . getID ( ) ) ; } } catch ( UnknownShanksAgentActionException e ) { logger . severe ( "Action was not executed -> " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( InstantiationException e ) { logger . severe ( "InstantiationException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( IllegalAccessException e ) { logger . severe ( "IllegalAccessException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( SecurityException e ) { logger . severe ( "SecurityException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( NoSuchMethodException e ) { logger . severe ( "NoSuchMethodException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( IllegalArgumentException e ) { logger . severe ( "IllegalArgumentException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } catch ( InvocationTargetException e ) { logger . severe ( "InvocationTargetException" + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } action . setResult ( result ) ; this . getTS ( ) . getC ( ) . addFeedbackAction ( action ) ;
public class DataGenerator { /** * Read file structure file under the input directory . Create each file * under the specified root . The file names are relative to the root . */ private void genFiles ( ) throws IOException { } }
// BufferedReader in = new BufferedReader ( new FileReader ( new File ( inDir , // StructureGenerator . FILE _ STRUCTURE _ FILE _ NAME ) ) ) ; // String line ; // while ( ( line = in . readLine ( ) ) ! = null ) { // String [ ] tokens = line . split ( " " ) ; // if ( tokens . length ! = 2 ) { // throw new IOException ( " Expect at most 2 tokens per line : " // + line ) ; // String fileName = root + tokens [ 0 ] ; // long fileSize = ( long ) ( BLOCK _ SIZE * Double . parseDouble ( tokens [ 1 ] ) ) ; // genFile ( new Path ( fileName ) , fileSize ) ; config = new Configuration ( getConf ( ) ) ; config . setInt ( "dfs.replication" , 3 ) ; config . set ( "dfs.rootdir" , root . toString ( ) ) ; JobConf job = new JobConf ( config , DataGenerator . class ) ; job . setJobName ( "data-genarator" ) ; FileOutputFormat . setOutputPath ( job , new Path ( "data-generator-result" ) ) ; // create the input for the map - reduce job Path inputPath = new Path ( ROOT + "load_input" ) ; fs . mkdirs ( inputPath ) ; fs . copyFromLocalFile ( new Path ( inDir + "/" + StructureGenerator . FILE_STRUCTURE_FILE_NAME ) , inputPath ) ; FileInputFormat . setInputPaths ( job , new Path ( ROOT + "load_input" ) ) ; job . setInputFormat ( TextInputFormat . class ) ; job . setOutputKeyClass ( Text . class ) ; job . setOutputValueClass ( Text . class ) ; job . setMapperClass ( CreateFiles . class ) ; job . setNumMapTasks ( nFiles / 10 ) ; job . setNumReduceTasks ( 0 ) ; JobClient . runJob ( job ) ;
public class Delay { /** * Creates a new { @ link LinearDelay } with a custom boundaries and factor . * @ param unit the unit of the delay . * @ param upper the upper boundary . * @ param lower the lower boundary . * @ param growBy the multiplication factor . * @ return a created { @ link LinearDelay } . */ public static Delay linear ( TimeUnit unit , long upper , long lower , long growBy ) { } }
return new LinearDelay ( unit , upper , lower , growBy ) ;
public class ControlWrapper { /** * Puts the wrapper of the parameter element to the upstream of this Control . * @ param element to put at upstream */ private void bindUpstream ( BioPAXElement element ) { } }
AbstractNode node = ( AbstractNode ) graph . getGraphObject ( element ) ; if ( node != null ) { Edge edge = new EdgeL3 ( node , this , graph ) ; node . getDownstreamNoInit ( ) . add ( edge ) ; this . getUpstreamNoInit ( ) . add ( edge ) ; }
public class PickerSpinner { /** * { @ inheritDoc } */ @ Override public void setSelection ( int position ) { } }
PickerSpinnerAdapter adapter = ( PickerSpinnerAdapter ) getAdapter ( ) ; if ( position == adapter . getCount ( ) - 1 && adapter . hasFooter ( ) ) onFooterClick ( ) ; // the footer has been clicked , so don ' t update the selection else { // remove any previous temporary selection : ( ( PickerSpinnerAdapter ) getAdapter ( ) ) . selectTemporary ( null ) ; reselectTemporaryItem = false ; restoreTemporarySelection = false ; // check that the selection goes through : interceptSelectionCallbacks . clear ( ) ; super . setSelection ( position ) ; super . setSelection ( position , false ) ; }
public class SourceParams { /** * Sets the { @ link SourceType } for this source . If you are creating a custom type , * use { @ link # setTypeRaw ( String ) } . * @ param type the { @ link SourceType } * @ return { @ code this } , for chaining purposes */ @ NonNull public SourceParams setType ( @ Source . SourceType String type ) { } }
mType = type ; mTypeRaw = type ; return this ;
public class HttpUtil { /** * Performs an HTTP DELETE on the given URI . * Basic auth is used if both username and pw are not null . * @ param uri The URI to connect to . * @ param username username * @ param password password * @ return The HTTP response as Response object . * @ throws URISyntaxException * @ throws HttpException */ public static Response delete ( URI uri , String username , String password ) throws URISyntaxException , HttpException { } }
return send ( new HttpDelete ( uri ) , new UsernamePasswordCredentials ( username , password ) , null ) ;
public class CommerceOrderNoteLocalServiceUtil { /** * Updates the commerce order note in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners . * @ param commerceOrderNote the commerce order note * @ return the commerce order note that was updated */ public static com . liferay . commerce . model . CommerceOrderNote updateCommerceOrderNote ( com . liferay . commerce . model . CommerceOrderNote commerceOrderNote ) { } }
return getService ( ) . updateCommerceOrderNote ( commerceOrderNote ) ;
public class PrettyTime { /** * Set the the { @ link Locale } for this { @ link PrettyTime } object . This may be an expensive operation , since this * operation calls { @ link TimeUnit # setLocale ( Locale ) } for each { @ link TimeUnit } in { @ link # getUnits ( ) } . */ public PrettyTime setLocale ( Locale locale ) { } }
if ( locale == null ) locale = Locale . getDefault ( ) ; this . locale = locale ; for ( TimeUnit unit : units . keySet ( ) ) { if ( unit instanceof LocaleAware ) ( ( LocaleAware < ? > ) unit ) . setLocale ( locale ) ; } for ( TimeFormat format : units . values ( ) ) { if ( format instanceof LocaleAware ) ( ( LocaleAware < ? > ) format ) . setLocale ( locale ) ; } return this ;
public class HostAndPort { /** * Returns the validation state of the config * @ throws ConfigException if the hostname is empty or the port is not between 0 and 65536 */ @ Override public void basicValidate ( final String section ) throws ConfigException { } }
if ( StringUtils . isEmpty ( host ) || port == null || port <= 0 || port > MAX_PORT ) { throw new ConfigException ( section , "Invalid host and port" ) ; }
public class KrakenAccountServiceRaw { /** * Retrieves all ledger entries between the start date and the end date . This method iterates over * ledger pages until it has retrieved all entries between the start date and the end date . The * ledger records the activity ( trades , deposit , withdrawals ) of the account for all assets . * @ param assets Set of assets to restrict output to ( can be null , defaults to all ) * @ param ledgerType { @ link LedgerType } to retrieve ( can be null , defaults to all types ) * @ param start Start unix timestamp or ledger id of results ( can be null ) * @ param end End unix timestamp or ledger id of results ( can be null ) * @ param offset Result offset ( can be null ) * @ return * @ throws IOException */ public Map < String , KrakenLedger > getKrakenLedgerInfo ( LedgerType ledgerType , Date start , Date end , Long offset , Currency ... assets ) throws IOException { } }
String startTime = null ; String endTime = null ; long longOffset = 0 ; if ( start != null ) { startTime = String . valueOf ( DateUtils . toUnixTime ( start ) ) ; } if ( end != null ) { endTime = String . valueOf ( DateUtils . toUnixTime ( end ) ) ; } if ( offset != null ) { longOffset = offset ; } Map < String , KrakenLedger > fullLedgerMap = getKrakenPartialLedgerInfo ( ledgerType , startTime , endTime , offset , assets ) ; Map < String , KrakenLedger > lastLedgerMap = fullLedgerMap ; while ( ! lastLedgerMap . isEmpty ( ) ) { longOffset += lastLedgerMap . size ( ) ; lastLedgerMap = getKrakenPartialLedgerInfo ( ledgerType , startTime , endTime , longOffset , assets ) ; if ( lastLedgerMap . size ( ) == 1 && fullLedgerMap . keySet ( ) . containsAll ( lastLedgerMap . keySet ( ) ) ) { break ; } fullLedgerMap . putAll ( lastLedgerMap ) ; } return fullLedgerMap ;
public class ID3v2Tag { /** * Return a binary representation of this object to be written to a file . * This is in the format of the id3v2 specifications . This includes the * header , extended header ( if it exists ) , the frames , padding ( if it * exists ) , and a footer ( if it exists ) . * @ return a binary representation of this id3v2 tag */ public byte [ ] getBytes ( ) { } }
byte [ ] b = new byte [ getSize ( ) + padding ] ; int bytesCopied = 0 ; int length = 0 ; length = head . getHeaderSize ( ) ; System . arraycopy ( head . getBytes ( ) , 0 , b , bytesCopied , length ) ; bytesCopied += length ; if ( head . getExtendedHeader ( ) ) { length = ext_head . getSize ( ) ; System . arraycopy ( ext_head . getBytes ( ) , 0 , b , bytesCopied , length ) ; bytesCopied += length ; } length = frames . getLength ( ) ; System . arraycopy ( frames . getBytes ( ) , 0 , b , bytesCopied , length ) ; bytesCopied += length ; // Bytes should all be zero ' s by default System . arraycopy ( new byte [ padding ] , 0 , b , bytesCopied , padding ) ; bytesCopied += padding ; if ( head . getFooter ( ) ) { length = foot . getFooterSize ( ) ; System . arraycopy ( foot . getBytes ( ) , 0 , b , bytesCopied , length ) ; bytesCopied += length ; } return b ;
public class StringToTranscriptEffect { /** * Parse the specified string as a fraction and return the denominator , if any . * @ param s string to parse * @ return the denominator from the specified string parsed as a fraction , * or null if the string is empty or if the fraction has no denominator */ static Integer denominator ( final String s ) { } }
if ( "" . equals ( s ) ) { return null ; } String [ ] tokens = s . split ( "/" ) ; return ( tokens . length < 2 ) ? null : emptyToNullInteger ( tokens [ 1 ] ) ;
public class AbstractTileBasedLayer { @ Override public LayerRenderer getRenderer ( ) { } }
if ( renderer == null ) { renderer = new DomTileLevelLayerRenderer ( viewPort , this , eventBus ) { @ Override public TileLevelRenderer createNewScaleRenderer ( int tileLevel , View view , HtmlContainer container ) { return new DomTileLevelRenderer ( AbstractTileBasedLayer . this , tileLevel , viewPort , container , getTileRenderer ( ) ) ; } } ; } return renderer ;
public class TokenizerME { /** * Returns the probabilities associated with the most recent * calls to tokenize ( ) or tokenizePos ( ) . * @ return probability for each token returned for the most recent * call to tokenize . If not applicable an empty array is * returned . */ public double [ ] getTokenProbabilities ( ) { } }
double [ ] tokProbArray = new double [ tokProbs . size ( ) ] ; for ( int i = 0 ; i < tokProbArray . length ; i ++ ) { tokProbArray [ i ] = ( ( Double ) tokProbs . get ( i ) ) . doubleValue ( ) ; } return tokProbArray ;
public class DefaultCoreEnvironment { /** * This method wraps an Observable of Boolean ( for shutdown hook ) into an Observable of ShutdownStatus . * It will log each status with a short message indicating which target has been shut down , and the result of * the call . * Additionally it will ignore signals that shutdown status is false ( as long as no exception is detected ) , logging that the target is " best effort " only . */ private Observable < ShutdownStatus > wrapBestEffortShutdown ( Observable < Boolean > source , final String target ) { } }
return wrapShutdown ( source , target ) . map ( new Func1 < ShutdownStatus , ShutdownStatus > ( ) { @ Override public ShutdownStatus call ( ShutdownStatus original ) { if ( original . cause == null && ! original . success ) { LOGGER . info ( target + " shutdown is best effort, ignoring failure" ) ; return new ShutdownStatus ( target , true , null ) ; } else { return original ; } } } ) ;
public class PlayEngine { /** * Send resume status notification * @ param item * Playlist item */ private void sendResumeStatus ( IPlayItem item ) { } }
Status resume = new Status ( StatusCodes . NS_UNPAUSE_NOTIFY ) ; resume . setClientid ( streamId ) ; resume . setDetails ( item . getName ( ) ) ; doPushMessage ( resume ) ;
public class StaticWord2Vec { /** * Returns the similarity of 2 words * @ param label1 the first word * @ param label2 the second word * @ return a normalized similarity ( cosine similarity ) */ @ Override public double similarity ( String label1 , String label2 ) { } }
if ( label1 == null || label2 == null ) { log . debug ( "LABELS: " + label1 + ": " + ( label1 == null ? "null" : "exists" ) + ";" + label2 + " vec2:" + ( label2 == null ? "null" : "exists" ) ) ; return Double . NaN ; } INDArray vec1 = getWordVectorMatrix ( label1 ) . dup ( ) ; INDArray vec2 = getWordVectorMatrix ( label2 ) . dup ( ) ; if ( vec1 == null || vec2 == null ) { log . debug ( label1 + ": " + ( vec1 == null ? "null" : "exists" ) + ";" + label2 + " vec2:" + ( vec2 == null ? "null" : "exists" ) ) ; return Double . NaN ; } if ( label1 . equals ( label2 ) ) return 1.0 ; vec1 = Transforms . unitVec ( vec1 ) ; vec2 = Transforms . unitVec ( vec2 ) ; return Transforms . cosineSim ( vec1 , vec2 ) ;
public class CommonsPortlet2MultipartResolver { /** * < p > cleanupMultipart . < / p > * @ param request a { @ link org . jasig . springframework . web . portlet . upload . MultipartResourceRequest } object . */ public void cleanupMultipart ( MultipartResourceRequest request ) { } }
if ( request != null ) { try { cleanupFileItems ( request . getMultiFileMap ( ) ) ; } catch ( Throwable ex ) { logger . warn ( "Failed to perform multipart cleanup for portlet request" , ex ) ; } }
public class DefaultHistoryManager { /** * ( non - Javadoc ) * @ see org . activiti . engine . impl . history . HistoryManagerInterface # recordProcessDefinitionChange ( java . lang . String , java . lang . String ) */ @ Override public void recordProcessDefinitionChange ( String processInstanceId , String processDefinitionId ) { } }
if ( isHistoryLevelAtLeast ( HistoryLevel . ACTIVITY ) ) { HistoricProcessInstanceEntity historicProcessInstance = getHistoricProcessInstanceEntityManager ( ) . findById ( processInstanceId ) ; if ( historicProcessInstance != null ) { historicProcessInstance . setProcessDefinitionId ( processDefinitionId ) ; } }
public class Links { /** * / * clears the link table , returns a copy */ synchronized Link [ ] clearLinks ( ) { } }
Link [ ] ret = null ; if ( count != 0 ) { ret = new Link [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { ret [ i ] = links [ i ] ; links [ i ] = null ; } count = 0 ; } return ret ;
public class ClaimBean { /** * { @ inheritDoc } */ @ Override public Set < InjectionPoint > getInjectionPoints ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "getInjectionPoints" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "getInjectionPoints" , Collections . emptySet ( ) ) ; } return Collections . emptySet ( ) ;
public class RegisterOnPremisesInstanceRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( RegisterOnPremisesInstanceRequest registerOnPremisesInstanceRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( registerOnPremisesInstanceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( registerOnPremisesInstanceRequest . getInstanceName ( ) , INSTANCENAME_BINDING ) ; protocolMarshaller . marshall ( registerOnPremisesInstanceRequest . getIamSessionArn ( ) , IAMSESSIONARN_BINDING ) ; protocolMarshaller . marshall ( registerOnPremisesInstanceRequest . getIamUserArn ( ) , IAMUSERARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BaseBigtableInstanceAdminClient { /** * Deletes an app profile from an instance . * < p > Sample code : * < pre > < code > * try ( BaseBigtableInstanceAdminClient baseBigtableInstanceAdminClient = BaseBigtableInstanceAdminClient . create ( ) ) { * AppProfileName name = AppProfileName . of ( " [ PROJECT ] " , " [ INSTANCE ] " , " [ APP _ PROFILE ] " ) ; * baseBigtableInstanceAdminClient . deleteAppProfile ( name . toString ( ) ) ; * < / code > < / pre > * @ param name The unique name of the app profile to be deleted . Values are of the form * ` projects / & lt ; project & gt ; / instances / & lt ; instance & gt ; / appProfiles / & lt ; app _ profile & gt ; ` . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final void deleteAppProfile ( String name ) { } }
DeleteAppProfileRequest request = DeleteAppProfileRequest . newBuilder ( ) . setName ( name ) . build ( ) ; deleteAppProfile ( request ) ;
public class GeometryExpressions { /** * Create a new GeometryExpression * @ param expr Expression of type Geometry * @ return new GeometryExpression */ public static < T extends Geometry > GeometryExpression < T > asGeometry ( Expression < T > expr ) { } }
Expression < T > underlyingMixin = ExpressionUtils . extract ( expr ) ; if ( underlyingMixin instanceof PathImpl ) { return new GeometryPath < T > ( ( PathImpl < T > ) underlyingMixin ) ; } else if ( underlyingMixin instanceof OperationImpl ) { return new GeometryOperation < T > ( ( OperationImpl < T > ) underlyingMixin ) ; } else { return new GeometryExpression < T > ( underlyingMixin ) { private static final long serialVersionUID = - 6714044005570420009L ; @ Override public < R , C > R accept ( Visitor < R , C > v , C context ) { return this . mixin . accept ( v , context ) ; } } ; }
public class ApiOvhVps { /** * Veeam restore points for the VPS * REST : GET / vps / { serviceName } / veeam / restorePoints * @ param creationTime [ required ] Filter the value of creationTime property ( like ) * @ param serviceName [ required ] The internal name of your VPS offer */ public ArrayList < Long > serviceName_veeam_restorePoints_GET ( String serviceName , Date creationTime ) throws IOException { } }
String qPath = "/vps/{serviceName}/veeam/restorePoints" ; StringBuilder sb = path ( qPath , serviceName ) ; query ( sb , "creationTime" , creationTime ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , t4 ) ;
public class MainFrame { /** * < / editor - fold > / / GEN - END : initComponents */ private void btInitActionPerformed ( java . awt . event . ActionEvent evt ) // GEN - FIRST : event _ btInitActionPerformed { } }
// GEN - HEADEREND : event _ btInitActionPerformed InitDialog dlg = new InitDialog ( this , true , corpusAdministration ) ; dlg . setVisible ( true ) ; if ( ! wasStarted && isInitialized ( ) && ! serviceWorker . isDone ( ) ) { btImport . setEnabled ( true ) ; btList . setEnabled ( true ) ; serviceWorker . execute ( ) ; }
public class TimeSeriesUtils { /** * Reverse a ( per time step ) time series mask , with shape [ minibatch , timeSeriesLength ] * @ param mask Mask to reverse along time dimension * @ return Mask after reversing */ public static INDArray reverseTimeSeriesMask ( INDArray mask , LayerWorkspaceMgr workspaceMgr , ArrayType arrayType ) { } }
if ( mask == null ) { return null ; } if ( mask . rank ( ) == 3 ) { // Should normally not be used - but handle the per - output masking case return reverseTimeSeries ( mask , workspaceMgr , arrayType ) ; } else if ( mask . rank ( ) != 2 ) { throw new IllegalArgumentException ( "Invalid mask rank: must be rank 2 or 3. Got rank " + mask . rank ( ) + " with shape " + Arrays . toString ( mask . shape ( ) ) ) ; } // FIXME : int cast int [ ] idxs = new int [ ( int ) mask . size ( 1 ) ] ; int j = 0 ; for ( int i = idxs . length - 1 ; i >= 0 ; i -- ) { idxs [ j ++ ] = i ; } INDArray ret = workspaceMgr . createUninitialized ( arrayType , mask . dataType ( ) , new long [ ] { mask . size ( 0 ) , idxs . length } , 'f' ) ; return Nd4j . pullRows ( mask , ret , 0 , idxs ) ; /* / / Assume input mask is 2d : [ minibatch , tsLength ] INDArray out = Nd4j . createUninitialized ( mask . shape ( ) , ' f ' ) ; CustomOp op = DynamicCustomOp . builder ( " reverse " ) . addIntegerArguments ( new int [ ] { 1 } ) . addInputs ( mask ) . addOutputs ( out ) . callInplace ( false ) . build ( ) ; Nd4j . getExecutioner ( ) . exec ( op ) ; return out ; */
public class RegistryImpl { /** * @ Override * public void publish ( String address , RampBroker broker ) * _ brokerMap . put ( address , broker ) ; */ @ Override public void shutdown ( ShutdownModeAmp mode ) { } }
TreeSet < String > serviceNames = new TreeSet < > ( _serviceMap . keySet ( ) ) ; // HashSet < ServiceRefAmp > serviceSet = new HashSet < > ( _ serviceMap . values ( ) ) ; if ( mode == ShutdownModeAmp . GRACEFUL ) { save ( serviceNames ) ; } for ( String serviceName : serviceNames ) { try { ServiceRefAmp serviceRef = _serviceMap . get ( serviceName ) ; serviceRef . shutdown ( mode ) ; } catch ( Throwable e ) { log . log ( Level . FINE , e . toString ( ) , e ) ; } }
public class TtmlDestinationSettingsMarshaller { /** * Marshall the given parameter object . */ public void marshall ( TtmlDestinationSettings ttmlDestinationSettings , ProtocolMarshaller protocolMarshaller ) { } }
if ( ttmlDestinationSettings == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( ttmlDestinationSettings . getStylePassthrough ( ) , STYLEPASSTHROUGH_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ICUService { /** * Convenience override for get ( Key , String [ ] ) . This uses * createKey to create a key from the provided descriptor . */ public Object get ( String descriptor , String [ ] actualReturn ) { } }
if ( descriptor == null ) { throw new NullPointerException ( "descriptor must not be null" ) ; } return getKey ( createKey ( descriptor ) , actualReturn ) ;
public class ProjectScanner { /** * Gets the list of resource files from { @ literal src / main / resources } or { @ literal src / test / resources } . * This method scans for all files that are not classes from { @ literal target / classes } or { @ literal * target / test - classes } . The distinction is made according to the value of { @ code test } . * @ param test whether or not we analyse tests resources . * @ return the list of packages , empty if none . */ public Set < String > getLocalResources ( boolean test ) { } }
Set < String > resources = new LinkedHashSet < > ( ) ; File classes = getClassesDirectory ( ) ; if ( test ) { classes = new File ( basedir , "target/test-classes" ) ; } if ( classes . isDirectory ( ) ) { DirectoryScanner scanner = new DirectoryScanner ( ) ; scanner . setBasedir ( classes ) ; scanner . setExcludes ( new String [ ] { "**/*.class" } ) ; scanner . addDefaultExcludes ( ) ; scanner . scan ( ) ; Collections . addAll ( resources , scanner . getIncludedFiles ( ) ) ; } return resources ;
public class UnixSshPath { /** * { @ inheritDoc } */ @ Override public boolean startsWith ( Path other ) { } }
if ( ! getFileSystem ( ) . equals ( other . getFileSystem ( ) ) ) { return false ; } if ( ( other . isAbsolute ( ) && ! isAbsolute ( ) ) || ( isAbsolute ( ) && ! other . isAbsolute ( ) ) ) { return false ; } int count = getNameCount ( ) ; int otherCount = other . getNameCount ( ) ; if ( otherCount > count ) { return false ; } for ( int i = 0 ; i < otherCount ; i ++ ) { if ( ! other . getName ( i ) . toString ( ) . equals ( getName ( i ) . toString ( ) ) ) { return false ; } } return true ;
public class IOUtils { /** * Writes integer in reverse order * @ param out * Data buffer to fill * @ param value * Integer */ public final static void writeReverseInt ( IoBuffer out , int value ) { } }
out . putInt ( ( int ) ( ( value & 0xFF ) << 24 | ( ( value >> 8 ) & 0x00FF ) << 16 | ( ( value >>> 16 ) & 0x000000FF ) << 8 | ( ( value >>> 24 ) & 0x000000FF ) ) ) ;
public class Profiler { /** * Ends the specified section . * Time elapsed from the call to { @ link Profiler # startSection ( String ) } is stored * @ param section The name of the section */ public synchronized void endSection ( String section ) { } }
long now = System . nanoTime ( ) ; section = section . toLowerCase ( ) ; if ( ! this . startTime . containsKey ( section ) ) throw new IllegalArgumentException ( "Section \"" + section + "\" hasn't been started!" ) ; long elapsed = now - this . startTime . remove ( section ) ; this . elapsedTime . put ( section , elapsed ) ; if ( this . verbose ) System . out . println ( "Section " + section + " lasted " + elapsed + "ns" ) ;
public class GreenPepperXmlRpcServer { /** * { @ inheritDoc } */ public Vector < Object > getSpecificationHierarchy ( Vector < Object > repositoryParams , Vector < Object > sutParams ) { } }
try { Repository repository = loadRepository ( repositoryParams ) ; SystemUnderTest systemUnderTest = XmlRpcDataMarshaller . toSystemUnderTest ( sutParams ) ; DocumentNode hierarchy = service . getSpecificationHierarchy ( repository , systemUnderTest ) ; return hierarchy . marshallize ( ) ; } catch ( Exception e ) { return errorAsVector ( e , SPECIFICATIONS_NOT_FOUND ) ; }
public class ComputationGraph { /** * Conduct forward pass using an array of inputs * @ param input An array of ComputationGraph inputs * @ param layerTillIndex the index of the layer to feed forward to * @ param train If true : do forward pass at training time ; false : do forward pass at test time * @ return A map of activations for each layer ( not each GraphVertex ) . Keys = layer name , values = layer activations */ public Map < String , INDArray > feedForward ( INDArray [ ] input , int layerTillIndex , boolean train ) { } }
setInputs ( input ) ; return feedForward ( train , layerTillIndex ) ;
public class KeySignature { /** * Returns < TT > true < / TT > if the key without exotic accidentals has only * flats . * e . g . : * < ul > * < li > Dm returns true * < li > Dm ^ c returns also true * < li > D returns false * < / ul > * @ see # hasOnlyFlats ( ) * @ see # hasSharpsAndFlats ( ) */ public boolean isFlatDominant ( ) { } }
return ( ( keyIndex == 1 && m_keyAccidental . isFlat ( ) ) || keyIndex == 3 || keyIndex == 5 || ( keyIndex == 6 && m_keyAccidental . isFlat ( ) ) || keyIndex == 8 || keyIndex == 10 || ( keyIndex == 11 && m_keyAccidental . isFlat ( ) ) ) ;
public class PersistenceController { /** * Insert or update a list of conversations . * @ param conversationsToAdd List of conversations to insert or apply an update . * @ return Observable emitting result . */ public Observable < Boolean > upsertConversations ( List < ChatConversation > conversationsToAdd ) { } }
return asObservable ( new Executor < Boolean > ( ) { @ Override void execute ( ChatStore store , Emitter < Boolean > emitter ) { store . beginTransaction ( ) ; boolean isSuccess = true ; for ( ChatConversation conversation : conversationsToAdd ) { ChatConversation . Builder toSave = ChatConversation . builder ( ) . populate ( conversation ) ; ChatConversationBase saved = store . getConversation ( conversation . getConversationId ( ) ) ; if ( saved == null ) { toSave . setFirstLocalEventId ( - 1L ) ; toSave . setLastLocalEventId ( - 1L ) ; if ( conversation . getLastRemoteEventId ( ) == null ) { toSave . setLastRemoteEventId ( - 1L ) ; } else { toSave . setLastRemoteEventId ( conversation . getLastRemoteEventId ( ) ) ; } if ( conversation . getUpdatedOn ( ) == null ) { toSave . setUpdatedOn ( System . currentTimeMillis ( ) ) ; } else { toSave . setUpdatedOn ( conversation . getUpdatedOn ( ) ) ; } } else { toSave . setFirstLocalEventId ( saved . getFirstLocalEventId ( ) ) ; toSave . setLastLocalEventId ( saved . getLastLocalEventId ( ) ) ; if ( conversation . getLastRemoteEventId ( ) == null ) { toSave . setLastRemoteEventId ( saved . getLastRemoteEventId ( ) ) ; } else { toSave . setLastRemoteEventId ( Math . max ( saved . getLastRemoteEventId ( ) , conversation . getLastRemoteEventId ( ) ) ) ; } if ( conversation . getUpdatedOn ( ) == null ) { toSave . setUpdatedOn ( System . currentTimeMillis ( ) ) ; } else { toSave . setUpdatedOn ( conversation . getUpdatedOn ( ) ) ; } } isSuccess = isSuccess && store . upsert ( toSave . build ( ) ) ; } store . endTransaction ( ) ; emitter . onNext ( isSuccess ) ; emitter . onCompleted ( ) ; } } ) ;
public class ClassFileWriter { /** * Add the single - byte opcode to the current method . * @ param theOpCode the opcode of the bytecode */ public void add ( int theOpCode ) { } }
if ( opcodeCount ( theOpCode ) != 0 ) throw new IllegalArgumentException ( "Unexpected operands" ) ; int newStack = itsStackTop + stackChange ( theOpCode ) ; if ( newStack < 0 || Short . MAX_VALUE < newStack ) badStack ( newStack ) ; if ( DEBUGCODE ) System . out . println ( "Add " + bytecodeStr ( theOpCode ) ) ; addToCodeBuffer ( theOpCode ) ; itsStackTop = ( short ) newStack ; if ( newStack > itsMaxStack ) itsMaxStack = ( short ) newStack ; if ( DEBUGSTACK ) { System . out . println ( "After " + bytecodeStr ( theOpCode ) + " stack = " + itsStackTop ) ; } if ( theOpCode == ByteCode . ATHROW ) { addSuperBlockStart ( itsCodeBufferTop ) ; }