signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CollaboratorServiceImpl { /** * Security collaborator methods */ public void setWebAppSecurityCollaborator ( ServiceReference < IWebAppSecurityCollaborator > ref ) { } }
String securityType = getSecurityType ( ref ) ; webAppSecurityCollaborators . putReference ( securityType , ref ) ;
public class Config { /** * Returns a read - only { @ link com . hazelcast . cardinality . CardinalityEstimator } * configuration for the given name . * The name is matched by pattern to the configuration and by stripping the * partition ID qualifier from the given { @ code name } . * If there is no config found by the name , it will return the configuration * with the name { @ code default } . * @ param name name of the cardinality estimator config * @ return the cardinality estimator configuration * @ throws ConfigurationException if ambiguous configurations are found * @ see StringPartitioningStrategy # getBaseName ( java . lang . String ) * @ see # setConfigPatternMatcher ( ConfigPatternMatcher ) * @ see # getConfigPatternMatcher ( ) * @ see EvictionConfig # setSize ( int ) */ public CardinalityEstimatorConfig findCardinalityEstimatorConfig ( String name ) { } }
name = getBaseName ( name ) ; CardinalityEstimatorConfig config = lookupByPattern ( configPatternMatcher , cardinalityEstimatorConfigs , name ) ; if ( config != null ) { return config . getAsReadOnly ( ) ; } return getCardinalityEstimatorConfig ( "default" ) . getAsReadOnly ( ) ;
public class VectorLayerInfo { /** * Get layer style by name . * @ param name layer style name * @ return layer style */ public NamedStyleInfo getNamedStyleInfo ( String name ) { } }
for ( NamedStyleInfo info : namedStyleInfos ) { if ( info . getName ( ) . equals ( name ) ) { return info ; } } return null ;
public class DiffFactory { /** * Check parameters for validity and assign global static variables . * @ param paramBuilder * { @ link Builder } reference */ private static void checkParams ( final Builder paramBuilder ) { } }
checkState ( paramBuilder . mSession != null && paramBuilder . mKey >= 0 && paramBuilder . mNewRev >= 0 && paramBuilder . mOldRev >= 0 && paramBuilder . mObservers != null && paramBuilder . mKind != null , "No valid arguments specified!" ) ; checkState ( paramBuilder . mNewRev != paramBuilder . mOldRev && paramBuilder . mNewRev >= paramBuilder . mOldRev , "Revision numbers must not be the same and the new revision must have a greater number than the old revision!" ) ;
public class Time { /** * Convert a date and a time string to a Unix time ( in milliseconds ) . * Either date or time can be null . */ public static long parse ( String date , String time ) { } }
return parseDate ( date ) + parseTime ( time ) + timeZoneOffset ;
public class ConsumerMonitorRegistrar { /** * Method removeConsumerFromRegisteredMonitors * Removes a specified MonitoredConsumer from the appropriate places in the maps . * @ param mc * @ param exactMonitorList * @ param wildcardMonitorList */ public void removeConsumerFromRegisteredMonitors ( MonitoredConsumer mc , ArrayList exactMonitorList , ArrayList wildcardMonitorList ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "removeConsumerFromRegisteredMonitors" , new Object [ ] { mc , exactMonitorList , wildcardMonitorList } ) ; // Remove consumer from correct places in the maps removeConsumerFromRegisteredMonitorMap ( mc , exactMonitorList , _registeredExactConsumerMonitors ) ; // Now process the wildcard monitor list removeConsumerFromRegisteredMonitorMap ( mc , wildcardMonitorList , _registeredWildcardConsumerMonitors ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "removeConsumerFromRegisteredMonitors" ) ;
public class Categorical { /** * Add key to this map ( treated as hash set in this case ) . */ int addKey ( BufferedString str ) { } }
// _ map is shared and be cast to null ( if categorical is killed ) - > grab local copy IcedHashMap < BufferedString , Integer > m = _map ; if ( m == null ) return Integer . MAX_VALUE ; // Nuked already Integer res = m . get ( str ) ; if ( res != null ) return res ; // Recorded already assert str . length ( ) < 65535 ; // Length limit so 65535 can be used as a sentinel int newVal = _id . incrementAndGet ( ) ; res = m . putIfAbsent ( new BufferedString ( str ) , newVal ) ; if ( res != null ) return res ; if ( m . size ( ) > MAX_CATEGORICAL_COUNT ) maxDomainExceeded = true ; return newVal ;
public class CmsImageScaler { /** * Returns a new image scaler that is a width based down scale from the size of < code > this < / code > scaler * to the given scaler size . < p > * If no down scale from this to the given scaler is required because the width of < code > this < / code > * scaler is not larger than the target width , then the image dimensions of < code > this < / code > scaler * are unchanged in the result scaler . No up scaling is done ! < p > * @ param downScaler the image scaler that holds the down scaled target image dimensions * @ return a new image scaler that is a down scale from the size of < code > this < / code > scaler * to the given target scaler size */ public CmsImageScaler getWidthScaler ( CmsImageScaler downScaler ) { } }
int width = downScaler . getWidth ( ) ; int height ; if ( getWidth ( ) > width ) { // width is too large , re - calculate height float scale = ( float ) width / ( float ) getWidth ( ) ; height = Math . round ( getHeight ( ) * scale ) ; } else { // width is ok width = getWidth ( ) ; height = getHeight ( ) ; } // now create and initialize the result scaler return new CmsImageScaler ( downScaler , width , height ) ;
public class BufferedRandomAccessFile { /** * / * Flush any dirty bytes in the buffer to disk . */ private void flushBuffer ( ) throws IOException { } }
if ( this . dirty_ ) { if ( this . diskPos_ != this . lo_ ) { super . seek ( this . lo_ ) ; } int len = ( int ) ( this . curr_ - this . lo_ ) ; super . write ( this . buff_ , 0 , len ) ; this . diskPos_ = this . curr_ ; this . dirty_ = false ; }
public class HttpContext { /** * Execute a GET request and return the result . * @ param < T > The type parameter used for the return object * @ param uri The URI to call * @ param returnType The type to marshall the result back into * @ return The return type */ protected < T > Optional < T > executeGetRequest ( URI uri , GenericType < T > returnType ) { } }
return executeGetRequest ( uri , null , null , returnType ) ;
public class PageFlowControllerConfig { /** * This gets the multipart class . If it was explicitly set on the associated < controller > element , just use that ; * otherwise , get the value from WEB - INF / beehive - netui - config . xml . */ public String getMultipartClass ( ) { } }
if ( _forceMultipartDisabled ) return null ; if ( _overrideMultipartClass != null ) return _overrideMultipartClass ; MultipartHandler mpHandler = InternalUtils . getMultipartHandlerType ( ) ; if ( mpHandler != null ) { switch ( mpHandler . getValue ( ) ) { case MultipartHandler . INT_DISABLED : return null ; case MultipartHandler . INT_MEMORY : return COMMONS_MULTIPART_HANDLER_CLASS ; case MultipartHandler . INT_DISK : return COMMONS_MULTIPART_HANDLER_CLASS ; default : assert false : "unknown value for multipart handler: " + mpHandler . toString ( ) ; } } return null ;
public class ExampleFisheyeToEquirectangular { /** * Creates a mask telling the algorithm which pixels are valid and which are not . The field - of - view ( FOV ) of the * camera is known so we will use that information to do a better job of filtering out invalid pixels than * it can do alone . */ public static GrayU8 createMask ( CameraUniversalOmni model , LensDistortionWideFOV distortion , double fov ) { } }
GrayU8 mask = new GrayU8 ( model . width , model . height ) ; Point2Transform3_F64 p2s = distortion . undistortPtoS_F64 ( ) ; Point3D_F64 ref = new Point3D_F64 ( 0 , 0 , 1 ) ; Point3D_F64 X = new Point3D_F64 ( ) ; p2s . compute ( model . cx , model . cy , X ) ; for ( int y = 0 ; y < model . height ; y ++ ) { for ( int x = 0 ; x < model . width ; x ++ ) { p2s . compute ( x , y , X ) ; if ( Double . isNaN ( X . x ) || Double . isNaN ( X . y ) || Double . isNaN ( X . z ) ) { continue ; } double angle = UtilVector3D_F64 . acute ( ref , X ) ; if ( Double . isNaN ( angle ) ) { continue ; } if ( angle <= fov / 2.0 ) mask . unsafe_set ( x , y , 1 ) ; } } return mask ;
public class OAuth20TokenManagementEndpoint { /** * Gets access token . * @ param ticketId the ticket id * @ return the access token */ @ ReadOperation public Ticket getToken ( @ Selector final String ticketId ) { } }
var ticket = ( Ticket ) ticketRegistry . getTicket ( ticketId , AccessToken . class ) ; if ( ticket == null ) { ticket = ticketRegistry . getTicket ( ticketId , RefreshToken . class ) ; } if ( ticket == null ) { LOGGER . debug ( "Ticket [{}] is not found" , ticketId ) ; return null ; } if ( ticket . isExpired ( ) ) { LOGGER . debug ( "Ticket [{}] is has expired" , ticketId ) ; return null ; } return ticket ;
public class BProgramSyncSnapshot { /** * Runs the program from the snapshot , triggering the passed event . * @ param exSvc the executor service that will advance the threads . * @ param anEvent the event selected . * @ param listeners will be informed in case of b - thread interrupts * @ return A set of b - thread snapshots that should participate in the next cycle . * @ throws InterruptedException ( since it ' s a blocking call ) */ public BProgramSyncSnapshot triggerEvent ( BEvent anEvent , ExecutorService exSvc , Iterable < BProgramRunnerListener > listeners ) throws InterruptedException , BPjsRuntimeException { } }
if ( anEvent == null ) throw new IllegalArgumentException ( "Cannot trigger a null event." ) ; if ( triggered ) { throw new IllegalStateException ( "A BProgramSyncSnapshot is not allowed to be triggered twice." ) ; } triggered = true ; Set < BThreadSyncSnapshot > resumingThisRound = new HashSet < > ( threadSnapshots . size ( ) ) ; Set < BThreadSyncSnapshot > sleepingThisRound = new HashSet < > ( threadSnapshots . size ( ) ) ; Set < BThreadSyncSnapshot > nextRound = new HashSet < > ( threadSnapshots . size ( ) ) ; List < BEvent > nextExternalEvents = new ArrayList < > ( getExternalEvents ( ) ) ; try { Context ctxt = Context . enter ( ) ; handleInterrupts ( anEvent , listeners , bprog , ctxt ) ; nextExternalEvents . addAll ( bprog . drainEnqueuedExternalEvents ( ) ) ; // Split threads to those that advance this round and those that sleep . threadSnapshots . forEach ( snapshot -> { ( snapshot . getSyncStatement ( ) . shouldWakeFor ( anEvent ) ? resumingThisRound : sleepingThisRound ) . add ( snapshot ) ; } ) ; } finally { Context . exit ( ) ; } BPEngineTask . Listener halter = new ViolationRecorder ( bprog , violationRecord ) ; // add the run results of all those who advance this stage try { nextRound . addAll ( exSvc . invokeAll ( resumingThisRound . stream ( ) . map ( bt -> new ResumeBThread ( bt , anEvent , halter ) ) . collect ( toList ( ) ) ) . stream ( ) . map ( f -> safeGet ( f ) ) . filter ( Objects :: nonNull ) . collect ( toList ( ) ) ) ; // inform listeners which b - threads completed Set < String > nextRoundIds = nextRound . stream ( ) . map ( t -> t . getName ( ) ) . collect ( toSet ( ) ) ; resumingThisRound . stream ( ) . filter ( t -> ! nextRoundIds . contains ( t . getName ( ) ) ) . forEach ( t -> listeners . forEach ( l -> l . bthreadDone ( bprog , t ) ) ) ; executeAllAddedBThreads ( nextRound , exSvc , halter ) ; } catch ( RuntimeException re ) { Throwable cause = re ; while ( cause . getCause ( ) != null ) { cause = cause . getCause ( ) ; } if ( cause instanceof BPjsRuntimeException ) { throw ( BPjsRuntimeException ) cause ; } else if ( cause instanceof EcmaError ) { throw new BPjsRuntimeException ( "JavaScript Error: " + cause . getMessage ( ) , cause ) ; } else throw re ; } nextExternalEvents . addAll ( bprog . drainEnqueuedExternalEvents ( ) ) ; // carry over BThreads that did not advance this round to next round . nextRound . addAll ( sleepingThisRound ) ; return new BProgramSyncSnapshot ( bprog , nextRound , nextExternalEvents , violationRecord . get ( ) ) ;
public class JprotobufPreCompileMain { /** * The main method . * @ param args the arguments */ public static void main ( String [ ] args ) { } }
if ( args == null || args . length == 0 || args . length != 3 ) { throw new RuntimeException ( printUsage ( ) ) ; } final File outputPath = new File ( args [ 0 ] + File . separator + "temp" ) ; try { FileUtils . deleteDirectory ( outputPath ) ; } catch ( Exception e ) { // dummy exception } outputPath . mkdirs ( ) ; JDKCompilerHelper . setCompiler ( new JdkCompiler ( Thread . currentThread ( ) . getContextClassLoader ( ) ) ) ; final String filterClassPackage = args [ 2 ] ; if ( filterClassPackage == null ) { return ; } final String [ ] split = filterClassPackage . split ( MULTI_PKG_SPLIT ) ; ClassScanner scanner = new ClassScanner ( ) { @ Override protected void onEntry ( EntryData entryData ) throws Exception { String name = entryData . getName ( ) ; if ( ! isStartWith ( name , split ) ) { return ; } Class c = getByClass ( name ) ; if ( c == null ) { return ; } try { List < Field > fields = FieldUtils . findMatchedFields ( c , Protobuf . class ) ; if ( ! fields . isEmpty ( ) ) { ProtobufProxy . create ( c , false , outputPath ) ; } } catch ( Throwable e ) { throw new Exception ( e . getMessage ( ) , e ) ; } } } ; scanner . scanDefaultClasspath ( ) ; // copy files try { FileUtils . copyDirectory ( outputPath , new File ( args [ 1 ] ) ) ; } catch ( IOException e ) { }
public class RetryStrategy { /** * Sleeps before retry ; default implementation is exponential back - off , or the specified duration * @ param currentTries 1 after first fail , then 2 , 3 . . . up to nbTriesMax - 1. * @ param optDuration _ ms if positive , the delay to apply */ private void doWait ( int currentTries , long optDuration_ms ) { } }
if ( optDuration_ms < 0 ) { optDuration_ms = ( long ) ( firstSleep_ms * ( Math . random ( ) + 0.5 ) * ( 1L << ( currentTries - 1 ) ) ) ; } LOGGER . debug ( "Will retry request after {} millis" , optDuration_ms ) ; try { Thread . sleep ( optDuration_ms ) ; } catch ( InterruptedException ex ) { throw new CStorageException ( "Retry waiting interrupted" , ex ) ; }
public class BigImage { /** * Create an big image from a image data source . * @ param data The pixelData to use to create the image * @ param imageBuffer The buffer containing texture data * @ param filter The filter to use when scaling this image * @ param tileSize The maximum size of the tiles to use to build the bigger image */ private void build ( final LoadableImageData data , final ByteBuffer imageBuffer , int filter , int tileSize ) { } }
final int dataWidth = data . getTexWidth ( ) ; final int dataHeight = data . getTexHeight ( ) ; realWidth = width = data . getWidth ( ) ; realHeight = height = data . getHeight ( ) ; if ( ( dataWidth <= tileSize ) && ( dataHeight <= tileSize ) ) { images = new Image [ 1 ] [ 1 ] ; ImageData tempData = new ImageData ( ) { public int getDepth ( ) { return data . getDepth ( ) ; } public int getHeight ( ) { return dataHeight ; } public ByteBuffer getImageBufferData ( ) { return imageBuffer ; } public int getTexHeight ( ) { return dataHeight ; } public int getTexWidth ( ) { return dataWidth ; } public int getWidth ( ) { return dataWidth ; } } ; images [ 0 ] [ 0 ] = new Image ( tempData , filter ) ; xcount = 1 ; ycount = 1 ; inited = true ; return ; } xcount = ( ( realWidth - 1 ) / tileSize ) + 1 ; ycount = ( ( realHeight - 1 ) / tileSize ) + 1 ; images = new Image [ xcount ] [ ycount ] ; int components = data . getDepth ( ) / 8 ; for ( int x = 0 ; x < xcount ; x ++ ) { for ( int y = 0 ; y < ycount ; y ++ ) { int finalX = ( ( x + 1 ) * tileSize ) ; int finalY = ( ( y + 1 ) * tileSize ) ; final int imageWidth = Math . min ( ( realWidth - ( x * tileSize ) ) , tileSize ) ; final int imageHeight = Math . min ( ( realHeight - ( y * tileSize ) ) , tileSize ) ; final int xSize = tileSize ; final int ySize = tileSize ; final ByteBuffer subBuffer = BufferUtils . createByteBuffer ( tileSize * tileSize * components ) ; int xo = x * tileSize * components ; byte [ ] byteData = new byte [ xSize * components ] ; for ( int i = 0 ; i < ySize ; i ++ ) { int yo = ( ( ( y * tileSize ) + i ) * dataWidth ) * components ; imageBuffer . position ( yo + xo ) ; imageBuffer . get ( byteData , 0 , xSize * components ) ; subBuffer . put ( byteData ) ; } subBuffer . flip ( ) ; ImageData imgData = new ImageData ( ) { public int getDepth ( ) { return data . getDepth ( ) ; } public int getHeight ( ) { return imageHeight ; } public int getWidth ( ) { return imageWidth ; } public ByteBuffer getImageBufferData ( ) { return subBuffer ; } public int getTexHeight ( ) { return ySize ; } public int getTexWidth ( ) { return xSize ; } } ; images [ x ] [ y ] = new Image ( imgData , filter ) ; } } inited = true ;
public class TreeNode { /** * Attaches the given { @ code children } to { @ code this } node . * @ param children the children to attach to { @ code this } node * @ return { @ code this } tree - node , for method chaining * @ throws NullPointerException if the given { @ code children } array is * { @ code null } */ @ SafeVarargs public final TreeNode < T > attach ( final T ... children ) { } }
for ( T child : children ) { attach ( TreeNode . of ( child ) ) ; } return this ;
public class RenderLinkDirective { /** * Renders as DT elements , optionally wraps in DL */ private void renderAsDT ( Writer writer , ProjectModel project , Iterator < Link > links , boolean wrap ) throws IOException { } }
if ( ! links . hasNext ( ) ) return ; if ( wrap ) writer . append ( "<dl>" ) ; while ( links . hasNext ( ) ) { Link link = links . next ( ) ; writer . append ( "<dt>" ) . append ( link . getDescription ( ) ) ; writer . append ( "</dt><dd><a href='" ) . append ( link . getLink ( ) ) ; appendProject ( writer , project ) ; writer . append ( "'>Link</a></dd>" ) ; } if ( wrap ) writer . append ( "</dl>" ) ;
public class ContextRuleProcessor { /** * if reaches the end of one or more rulesMap , add all corresponding * determinants into the results * The priority of multiple applicable rulesMap can be modified . This version * uses the following three rulesMap : * 1 . if determinant spans overlap , choose the determinant with the widest * span * 2 . else if prefer right determinant , choose the determinant with the * largest end . * 3 . else if prefer left determinant , choose the determinant with the * smallest begin . * @ param rule Constructed Rules Map * @ param matches Storing the matched context spans * @ param matchBegin Keep track of the begin position of matched span * @ param currentPosition Keep track of the position where matching starts * @ param contextTokenLength contextTokenLength */ protected void addDeterminants ( HashMap rule , LinkedHashMap < String , ConTextSpan > matches , int matchBegin , int currentPosition , int contextTokenLength ) { } }
HashMap < String , ? > matchedRules = ( HashMap < String , ? > ) rule . get ( END ) ; // int id = ( Integer ) rule . values ( ) . iterator ( ) . next ( ) ; // ContextRule matchedRule = rules . get ( id ) ; // Span currentSpan = new Span ( matchBegin , i - 1 , id ) ; for ( String key : matchedRules . keySet ( ) ) { ConTextSpan originalSpan = null ; int id = ( Integer ) matchedRules . get ( key ) ; char matchedDirection = key . charAt ( 0 ) ; ContextRule matchedContextRule = getContextRuleById ( id ) ; ConTextSpan currentSpan = new ConTextSpan ( matchBegin , currentPosition - 1 , id ) ; if ( matchedContextRule . triggerType == TriggerTypes . termination ) { currentSpan . winBegin = currentSpan . begin ; currentSpan . winEnd = currentSpan . end ; } else { currentSpan . winBegin = currentSpan . begin - rules . get ( id ) . windowSize ; currentSpan . winEnd = currentSpan . end + rules . get ( id ) . windowSize ; } currentSpan . matchedDirection = matchedDirection == 'f' ? TriggerTypes . forward : TriggerTypes . backward ; if ( matches . containsKey ( key ) ) { originalSpan = matches . get ( key ) ; switch ( matchedDirection ) { case 'f' : if ( matchedContextRule . triggerType == TriggerTypes . trigger ) { if ( originalSpan . winEnd > currentSpan . winEnd || ( originalSpan . width > currentSpan . width && originalSpan . end >= currentSpan . end ) || ( contextTokenLength - currentSpan . end > getContextRuleById ( id ) . windowSize ) ) continue ; else if ( getContextRuleById ( originalSpan . ruleId ) . triggerType == TriggerTypes . termination && originalSpan . begin > currentSpan . end ) { continue ; } } else if ( ( originalSpan . begin > currentSpan . end ) || ( originalSpan . width > currentSpan . width && originalSpan . end >= currentSpan . end ) || ( contextTokenLength - currentSpan . end > getContextRuleById ( id ) . windowSize ) ) { continue ; } break ; case 'b' : if ( matchedContextRule . triggerType == TriggerTypes . trigger ) { if ( originalSpan . winBegin < currentSpan . winBegin || ( originalSpan . width > currentSpan . width && originalSpan . begin <= currentSpan . begin ) || ( currentSpan . begin > getContextRuleById ( id ) . windowSize ) ) continue ; else if ( getContextRuleById ( originalSpan . ruleId ) . triggerType == TriggerTypes . termination && originalSpan . end < currentSpan . begin ) { continue ; } } else if ( ( originalSpan . end < currentSpan . begin ) || ( originalSpan . width > currentSpan . width && originalSpan . begin <= currentSpan . begin ) || ( currentSpan . begin > getContextRuleById ( id ) . windowSize ) ) { continue ; } break ; } ContextRule matchedRule = rules . get ( id ) ; // adjust context window , for later version that support combining modifiers with shared context window terminals if ( originalSpan . begin != - 1 && ( matchedDirection == 'f' ) ) { if ( matchedRule . triggerType == TriggerTypes . termination ) { currentSpan . winBegin = originalSpan . winBegin > currentSpan . end ? originalSpan . winBegin : currentSpan . end ; } else { currentSpan . winBegin = originalSpan . winBegin ; } } else if ( originalSpan . end != - 1 && ( matchedDirection == 'b' ) ) { if ( matchedRule . triggerType == TriggerTypes . termination ) { currentSpan . winEnd = originalSpan . winEnd < currentSpan . winEnd ? originalSpan . winEnd : currentSpan . begin ; } else { currentSpan . winEnd = originalSpan . winEnd ; } } } matches . put ( key , currentSpan ) ; }
public class MPP9Reader { /** * Retrieves the description value list associated with a custom task field . * This method will return null if no descriptions for the value list has * been defined for this field . * @ param properties project properties * @ param field task field * @ param data data block * @ return list of task field values */ public List < Object > getTaskFieldValues ( ProjectProperties properties , FieldType field , byte [ ] data ) { } }
if ( field == null || data == null || data . length == 0 ) { return null ; } List < Object > list = new LinkedList < Object > ( ) ; int offset = 0 ; switch ( field . getDataType ( ) ) { case DATE : while ( offset + 4 <= data . length ) { Date date = MPPUtility . getTimestamp ( data , offset ) ; list . add ( date ) ; offset += 4 ; } break ; case CURRENCY : while ( offset + 8 <= data . length ) { Double number = NumberHelper . getDouble ( MPPUtility . getDouble ( data , offset ) / 100.0 ) ; list . add ( number ) ; offset += 8 ; } break ; case NUMERIC : while ( offset + 8 <= data . length ) { Double number = NumberHelper . getDouble ( MPPUtility . getDouble ( data , offset ) ) ; list . add ( number ) ; offset += 8 ; } break ; case DURATION : while ( offset + 6 <= data . length ) { Duration duration = MPPUtility . getAdjustedDuration ( properties , MPPUtility . getInt ( data , offset ) , MPPUtility . getDurationTimeUnits ( MPPUtility . getShort ( data , offset + 4 ) ) ) ; list . add ( duration ) ; offset += 6 ; } break ; case STRING : while ( offset < data . length ) { String s = MPPUtility . getUnicodeString ( data , offset ) ; list . add ( s ) ; offset += s . length ( ) * 2 + 2 ; } break ; case BOOLEAN : while ( offset + 2 <= data . length ) { boolean b = ( MPPUtility . getShort ( data , offset ) == 0x01 ) ; list . add ( Boolean . valueOf ( b ) ) ; offset += 2 ; } break ; default : return null ; } return list ;
public class AuthenticationAPIClient { /** * Creates a user in a DB connection using < a href = " https : / / auth0 . com / docs / api / authentication # signup " > ' / dbconnections / signup ' endpoint < / a > * Example usage : * < pre > * { @ code * client . createUser ( " { email } " , " { password } " , " { database connection name } " ) * . start ( new BaseCallback < DatabaseUser > ( ) { * { @ literal } Override * public void onSuccess ( DatabaseUser payload ) { } * { @ literal } @ Override * public void onFailure ( AuthenticationException error ) { } * < / pre > * @ param email of the user and must be non null * @ param password of the user and must be non null * @ param connection of the database to create the user on * @ return a request to start */ @ SuppressWarnings ( "WeakerAccess" ) public DatabaseConnectionRequest < DatabaseUser , AuthenticationException > createUser ( @ NonNull String email , @ NonNull String password , @ NonNull String connection ) { } }
// noinspection ConstantConditions return createUser ( email , password , null , connection ) ;
public class CPFriendlyURLEntryPersistenceImpl { /** * Returns the cp friendly url entries before and after the current cp friendly url entry in the ordered set where groupId = & # 63 ; and classNameId = & # 63 ; and classPK = & # 63 ; and main = & # 63 ; . * @ param CPFriendlyURLEntryId the primary key of the current cp friendly url entry * @ param groupId the group ID * @ param classNameId the class name ID * @ param classPK the class pk * @ param main the main * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the previous , current , and next cp friendly url entry * @ throws NoSuchCPFriendlyURLEntryException if a cp friendly url entry with the primary key could not be found */ @ Override public CPFriendlyURLEntry [ ] findByG_C_C_M_PrevAndNext ( long CPFriendlyURLEntryId , long groupId , long classNameId , long classPK , boolean main , OrderByComparator < CPFriendlyURLEntry > orderByComparator ) throws NoSuchCPFriendlyURLEntryException { } }
CPFriendlyURLEntry cpFriendlyURLEntry = findByPrimaryKey ( CPFriendlyURLEntryId ) ; Session session = null ; try { session = openSession ( ) ; CPFriendlyURLEntry [ ] array = new CPFriendlyURLEntryImpl [ 3 ] ; array [ 0 ] = getByG_C_C_M_PrevAndNext ( session , cpFriendlyURLEntry , groupId , classNameId , classPK , main , orderByComparator , true ) ; array [ 1 ] = cpFriendlyURLEntry ; array [ 2 ] = getByG_C_C_M_PrevAndNext ( session , cpFriendlyURLEntry , groupId , classNameId , classPK , main , orderByComparator , false ) ; return array ; } catch ( Exception e ) { throw processException ( e ) ; } finally { closeSession ( session ) ; }
public class TaskLog { /** * Get the real task - log file - path * @ param location Location of the log - file . This should point to an * attempt - directory . * @ param filter * @ return * @ throws IOException */ static String getRealTaskLogFilePath ( String location , LogName filter ) throws IOException { } }
return FileUtil . makeShellPath ( new File ( getBaseDir ( location ) , filter . toString ( ) ) ) ;
public class GenericObject { /** * Schema evolution of in - memory objects , operation by operation . * @ param op Schema operation object */ public void evolve ( SchemaOperation op ) { } }
// TODO this is horrible ! ! ! ArrayList < Object > fV = new ArrayList < Object > ( Arrays . asList ( fixedValues ) ) ; ArrayList < Object > vV = new ArrayList < Object > ( Arrays . asList ( variableValues ) ) ; // TODO resize only once to correct size if ( op instanceof SchemaOperation . SchemaFieldDefine ) { SchemaOperation . SchemaFieldDefine op2 = ( SchemaFieldDefine ) op ; int fieldId = op2 . getField ( ) . getFieldPos ( ) ; fV . add ( fieldId , PersistentSchemaOperation . getDefaultValue ( op2 . getField ( ) ) ) ; vV . add ( fieldId , null ) ; } if ( op instanceof SchemaOperation . SchemaFieldDelete ) { SchemaOperation . SchemaFieldDelete op2 = ( SchemaFieldDelete ) op ; int fieldId = op2 . getField ( ) . getFieldPos ( ) ; fV . remove ( fieldId ) ; vV . remove ( fieldId ) ; } fixedValues = fV . toArray ( fixedValues ) ; variableValues = vV . toArray ( variableValues ) ;
public class ApiOvhOrder { /** * Get prices and contracts information * REST : GET / order / cdn / webstorage / { serviceName } / storage / { duration } * @ param storage [ required ] Storage option that will be ordered * @ param serviceName [ required ] The internal name of your CDN Static offer * @ param duration [ required ] Duration */ public OvhOrder cdn_webstorage_serviceName_storage_duration_GET ( String serviceName , String duration , OvhOrderStorageEnum storage ) throws IOException { } }
String qPath = "/order/cdn/webstorage/{serviceName}/storage/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; query ( sb , "storage" , storage ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhOrder . class ) ;
public class ProcessUtils { /** * 拷贝单个对象 * @ param clazz 目标类型 * @ param src 原对象 * @ param < T > 原数据类型 * @ param < R > 目标数据类型 * @ return 目标对象 */ public static < T , R > R process ( Class < R > clazz , T src ) { } }
return process ( clazz , src , ( r , s ) -> { } ) ;
public class OperationStatus { /** * Builds an object that can be used to resume the polling of the operation . * @ return The OperationDescription . */ public OperationDescription buildDescription ( ) { } }
if ( this . isDone ( ) ) { return null ; } return new OperationDescription ( this . pollStrategy . methodParser ( ) . fullyQualifiedMethodName ( ) , this . pollStrategy . strategyData ( ) , this . originalHttpRequest ) ;
public class PortComponentRefTypeImpl { /** * If not already created , a new < code > respect - binding < / code > element with the given value will be created . * Otherwise , the existing < code > respect - binding < / code > element will be returned . * @ return a new or existing instance of < code > RespectBindingType < PortComponentRefType < T > > < / code > */ public RespectBindingType < PortComponentRefType < T > > getOrCreateRespectBinding ( ) { } }
Node node = childNode . getOrCreate ( "respect-binding" ) ; RespectBindingType < PortComponentRefType < T > > respectBinding = new RespectBindingTypeImpl < PortComponentRefType < T > > ( this , "respect-binding" , childNode , node ) ; return respectBinding ;
public class StrUtils { /** * Format all " " , \ t , \ r . . . , to " " , */ public static String formatSQL ( String sql ) { } }
if ( sql == null || sql . length ( ) == 0 ) return sql ; StringBuilder sb = new StringBuilder ( ) ; char [ ] chars = sql . toCharArray ( ) ; boolean addedSpace = false ; for ( char c : chars ) { if ( isInvisibleChar ( c ) ) { if ( ! addedSpace ) { sb . append ( " " ) ; addedSpace = true ; } } else { sb . append ( c ) ; addedSpace = false ; } } sb . append ( " " ) ; return sb . toString ( ) ;
public class ObjectTypeNode { /** * Retract the < code > FactHandleimpl < / code > from the < code > Rete < / code > network . Also remove the * < code > FactHandleImpl < / code > from the node memory . * @ param factHandle The fact handle . * @ param context The propagation context . * @ param workingMemory The working memory session . */ public void retractObject ( final InternalFactHandle factHandle , final PropagationContext context , final InternalWorkingMemory workingMemory ) { } }
checkDirty ( ) ; doRetractObject ( factHandle , context , workingMemory ) ;
public class Tap13Parser { /** * { @ inheritDoc } */ @ Override public TestSet parseTapStream ( Readable tapStream ) { } }
state = new StreamStatus ( ) ; baseIndentation = Integer . MAX_VALUE ; try ( Scanner scanner = new Scanner ( tapStream ) ) { while ( scanner . hasNextLine ( ) ) { String line = scanner . nextLine ( ) ; if ( line != null && line . length ( ) > 0 ) { parseLine ( line ) ; } } onFinish ( ) ; } catch ( Exception e ) { throw new ParserException ( String . format ( "Error parsing TAP Stream: %s" , e . getMessage ( ) ) , e ) ; } return state . getTestSet ( ) ;
public class SwingGroovyMethods { /** * Allow DefaultTableModel to work with subscript operators . < p > * < b > WARNING : < / b > this operation does not replace the item at the * specified index , rather it inserts the item at that index , thus * increasing the size of the model by 1 . < p > * if row . size & lt ; model . size - & gt ; row will be padded with nulls < br > * if row . size & gt ; model . size - & gt ; additional columns will be discarded * @ param self a DefaultTableModel * @ param index an index * @ param row the row to insert at the given index * @ since 1.6.4 */ public static void putAt ( DefaultTableModel self , int index , Object row ) { } }
if ( row == null ) { // adds an empty row self . insertRow ( index , ( Object [ ] ) null ) ; return ; } self . insertRow ( index , buildRowData ( self , row ) ) ;
public class HurlStack { /** * Initializes an { @ link HttpEntity } from the given { @ link HttpURLConnection } . * @ param connection * @ return an HttpEntity populated with data from < code > connection < / code > . */ private static HttpEntity entityFromConnection ( HttpURLConnection connection ) { } }
BasicHttpEntity entity = new BasicHttpEntity ( ) ; InputStream inputStream ; try { inputStream = connection . getInputStream ( ) ; } catch ( IOException ioe ) { inputStream = connection . getErrorStream ( ) ; } entity . setContent ( inputStream ) ; entity . setContentLength ( connection . getContentLength ( ) ) ; entity . setContentEncoding ( connection . getContentEncoding ( ) ) ; entity . setContentType ( connection . getContentType ( ) ) ; return entity ;
public class BasicBinder { /** * Resolve a Binding with the given source and target class . * A binding unifies a marshaller and an unmarshaller and both must be available to resolve a binding . * The source class is considered the owning class of the binding . The source can be marshalled * into the target class . Similarly , the target can be unmarshalled to produce an instance of the source type . * @ param source The source ( owning ) class * @ param target The target ( foreign ) class * @ param qualifier The qualifier for which the binding must be registered */ public < S , T > Binding < S , T > findBinding ( Class < S > source , Class < T > target , Class < ? extends Annotation > qualifier ) { } }
return findBinding ( new ConverterKey < S , T > ( source , target , qualifier == null ? DefaultBinding . class : qualifier ) ) ;
public class GraphDotFileWriter { /** * Writes a given formula ' s internal data structure as a dimacs file . * @ param fileName the file name of the dimacs file to write * @ param graph the graph * @ param < T > the type of the graph content * @ throws IOException if there was a problem writing the file */ public static < T > void write ( final String fileName , final Graph < T > graph ) throws IOException { } }
write ( new File ( fileName . endsWith ( ".dot" ) ? fileName : fileName + ".dot" ) , graph ) ;
public class InstallRemappedFileMojo { /** * Generates a minimal model from the user - supplied artifact information . * @ return The generated model , never < code > null < / code > . */ private Model generateModel ( ) { } }
Model model = new Model ( ) ; model . setModelVersion ( "4.0.0" ) ; model . setGroupId ( groupId ) ; model . setArtifactId ( artifactId ) ; model . setVersion ( version ) ; model . setPackaging ( packaging ) ; model . setDescription ( "POM was created from specialsource-maven-plugin" ) ; return model ;
public class Text { /** * Create a simple Text object with a style * @ param text the text content * @ param ts the style * @ return the Text */ public static Text styledContent ( final String text , final TextStyle ts ) { } }
return Text . builder ( ) . parStyledContent ( text , ts ) . build ( ) ;
public class WorkAloneRedisManager { /** * set * @ param key key * @ param value value * @ param expireTime expire time * @ return value */ @ Override public byte [ ] set ( byte [ ] key , byte [ ] value , int expireTime ) { } }
if ( key == null ) { return null ; } Jedis jedis = getJedis ( ) ; try { jedis . set ( key , value ) ; // -1 and 0 is not a valid expire time in Jedis if ( expireTime > 0 ) { jedis . expire ( key , expireTime ) ; } } finally { jedis . close ( ) ; } return value ;
public class ResourceIndexImpl { /** * Applies the given adds or deletes to the triplestore . If _ syncUpdates is * true , changes will be flushed before returning . */ private void updateTriples ( Set < Triple > set , boolean delete ) throws ResourceIndexException { } }
try { if ( delete ) { _writer . delete ( getTripleIterator ( set ) , _syncUpdates ) ; } else { _writer . add ( getTripleIterator ( set ) , _syncUpdates ) ; } } catch ( Exception e ) { throw new ResourceIndexException ( "Error updating triples" , e ) ; }
public class DestinationManager { /** * PK54812 Move the destination into CORRUPT state */ protected void corruptDestination ( DestinationHandler dh ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "corruptDestination" , dh ) ; if ( ! dh . isLink ( ) && destinationIndex . containsDestination ( dh ) ) { destinationIndex . corrupt ( dh ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "corruptDestination" ) ;
public class Path3d { /** * Adds a curved segment , defined by three new points , to the path by * drawing a B & eacute ; zier curve that intersects both the current * coordinates and the specified endPoint , * using the specified points controlPoint1 and controlPoint2 as * B & eacute ; zier control points . * All coordinates are specified in Point3d . * We store the property here , and not the value . So when the points changes , * the path will be automatically updated . * @ param controlPoint1 the first B & eacute ; zier control point * @ param controlPoint2 the second B & eacute ; zier control point * @ param endPoint the final end point */ public void curveTo ( Point3d controlPoint1 , Point3d controlPoint2 , Point3d endPoint ) { } }
ensureSlots ( true , 9 ) ; this . types [ this . numTypesProperty . get ( ) ] = PathElementType . CURVE_TO ; this . numTypesProperty . set ( this . numTypesProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . isEmptyProperty = null ; this . isPolylineProperty . set ( false ) ; this . graphicalBounds = null ; this . logicalBounds = null ;
public class ModuleGenerator { /** * Generates and injectts module metadata in a XML node ( JDOM element ) . * @ param module the module to inject into the XML node ( JDOM element ) . * @ param element the XML node to inject the module metadata to . */ @ Override public void generate ( final Module module , final Element element ) { } }
if ( ! ( module instanceof SimpleListExtension ) ) { return ; } final SimpleListExtension sle = ( SimpleListExtension ) module ; addNotNullElement ( element , "treatAs" , sle . getTreatAs ( ) ) ; final Group [ ] groups = sle . getGroupFields ( ) ; final Element listInfo = new Element ( "listinfo" , ModuleParser . NS ) ; for ( int i = 0 ; groups != null && i < groups . length ; i ++ ) { final Element group = new Element ( "group" , ModuleParser . NS ) ; if ( groups [ i ] . getNamespace ( ) != Namespace . NO_NAMESPACE ) { addNotNullAttribute ( group , "ns" , groups [ i ] . getNamespace ( ) . getURI ( ) ) ; } addNotNullAttribute ( group , "element" , groups [ i ] . getElement ( ) ) ; addNotNullAttribute ( group , "label" , groups [ i ] . getLabel ( ) ) ; listInfo . addContent ( group ) ; } final Sort [ ] sorts = sle . getSortFields ( ) ; for ( int i = 0 ; sorts != null && i < sorts . length ; i ++ ) { final Element sort = new Element ( "sort" , ModuleParser . NS ) ; if ( sorts [ i ] . getNamespace ( ) != Namespace . NO_NAMESPACE ) { addNotNullAttribute ( sort , "ns" , sorts [ i ] . getNamespace ( ) . getURI ( ) ) ; } addNotNullAttribute ( sort , "element" , sorts [ i ] . getElement ( ) ) ; addNotNullAttribute ( sort , "label" , sorts [ i ] . getLabel ( ) ) ; addNotNullAttribute ( sort , "data-type" , sorts [ i ] . getDataType ( ) ) ; if ( sorts [ i ] . getDefaultOrder ( ) ) { addNotNullAttribute ( sort , "default" , "true" ) ; } listInfo . addContent ( sort ) ; } if ( ! listInfo . getChildren ( ) . isEmpty ( ) ) { element . addContent ( listInfo ) ; }
public class ClassReader { /** * Read constant pool entry at start address i , use pool as a cache . */ Object readPool ( int i ) { } }
Object result = poolObj [ i ] ; if ( result != null ) return result ; int index = poolIdx [ i ] ; if ( index == 0 ) return null ; byte tag = buf [ index ] ; switch ( tag ) { case CONSTANT_Utf8 : poolObj [ i ] = names . fromUtf ( buf , index + 3 , getChar ( index + 1 ) ) ; break ; case CONSTANT_Unicode : throw badClassFile ( "unicode.str.not.supported" ) ; case CONSTANT_Class : poolObj [ i ] = readClassOrType ( getChar ( index + 1 ) ) ; break ; case CONSTANT_String : // FIXME : ( footprint ) do not use toString here poolObj [ i ] = readName ( getChar ( index + 1 ) ) . toString ( ) ; break ; case CONSTANT_Fieldref : { ClassSymbol owner = readClassSymbol ( getChar ( index + 1 ) ) ; NameAndType nt = readNameAndType ( getChar ( index + 3 ) ) ; poolObj [ i ] = new VarSymbol ( 0 , nt . name , nt . uniqueType . type , owner ) ; break ; } case CONSTANT_Methodref : case CONSTANT_InterfaceMethodref : { ClassSymbol owner = readClassSymbol ( getChar ( index + 1 ) ) ; NameAndType nt = readNameAndType ( getChar ( index + 3 ) ) ; poolObj [ i ] = new MethodSymbol ( 0 , nt . name , nt . uniqueType . type , owner ) ; break ; } case CONSTANT_NameandType : poolObj [ i ] = new NameAndType ( readName ( getChar ( index + 1 ) ) , readType ( getChar ( index + 3 ) ) , types ) ; break ; case CONSTANT_Integer : poolObj [ i ] = getInt ( index + 1 ) ; break ; case CONSTANT_Float : poolObj [ i ] = Float . valueOf ( getFloat ( index + 1 ) ) ; break ; case CONSTANT_Long : poolObj [ i ] = Long . valueOf ( getLong ( index + 1 ) ) ; break ; case CONSTANT_Double : poolObj [ i ] = Double . valueOf ( getDouble ( index + 1 ) ) ; break ; case CONSTANT_MethodHandle : skipBytes ( 4 ) ; break ; case CONSTANT_MethodType : skipBytes ( 3 ) ; break ; case CONSTANT_InvokeDynamic : skipBytes ( 5 ) ; break ; case CONSTANT_Module : case CONSTANT_Package : // this is temporary for now : treat as a simple reference to the underlying Utf8. poolObj [ i ] = readName ( getChar ( index + 1 ) ) ; break ; default : throw badClassFile ( "bad.const.pool.tag" , Byte . toString ( tag ) ) ; } return poolObj [ i ] ;
public class DefaultableConverter { /** * Builder method used to set the { @ link Object default value } to use * if the { @ link Object value } to convert is { @ literal null } . * @ param < CONVERTER > { @ link Class type } of this { @ link Converter } . * @ param defaultValue { @ link Object default value } returned if the { @ link Object value } to convert * is { @ literal null } . * @ return this { @ link Converter } . * @ see # setDefaultValue ( Object ) */ @ SuppressWarnings ( "unchecked" ) public < CONVERTER extends DefaultableConverter < S , T > > CONVERTER withDefaultValue ( T defaultValue ) { } }
setDefaultValue ( defaultValue ) ; return ( CONVERTER ) this ;
public class AbstractBigtableAdmin { /** * { @ inheritDoc } */ @ Override public HTableDescriptor [ ] disableTables ( String regex ) throws IOException { } }
HTableDescriptor [ ] tableDescriptors = listTables ( regex ) ; for ( HTableDescriptor descriptor : tableDescriptors ) { disableTable ( descriptor . getTableName ( ) ) ; } return tableDescriptors ;
public class CSSFactory { /** * This is the same as { @ link CSSFactory # getUsedStyles ( Document , String , URL , MediaSpec ) } with * the possibility of specifying a custom network processor . * @ param doc * DOM tree * @ param encoding * The default encoding used for the referenced style sheets * @ param base * Base URL against which all files are searched * @ param media * Selected media for style sheet * @ return the rules of all the style sheets used in the document including the inline styles */ public static final StyleSheet getUsedStyles ( Document doc , String encoding , URL base , MediaSpec media ) { } }
return getUsedStyles ( doc , encoding , base , media , getNetworkProcessor ( ) ) ;
public class TranslatableComponent { /** * Creates a translatable component with a translation key and arguments . * @ param key the translation key * @ param color the color * @ param args the translation arguments * @ return the translatable component */ public static TranslatableComponent of ( final @ NonNull String key , final @ Nullable TextColor color , final @ NonNull List < Component > args ) { } }
return of ( key , color , Collections . emptySet ( ) , args ) ;
public class AccumulatorHelper { /** * Takes the serialized accumulator results and tries to deserialize them using the provided * class loader . * @ param serializedAccumulators The serialized accumulator results . * @ param loader The class loader to use . * @ return The deserialized accumulator results . * @ throws IOException * @ throws ClassNotFoundException */ public static Map < String , OptionalFailure < Object > > deserializeAccumulators ( Map < String , SerializedValue < OptionalFailure < Object > > > serializedAccumulators , ClassLoader loader ) throws IOException , ClassNotFoundException { } }
if ( serializedAccumulators == null || serializedAccumulators . isEmpty ( ) ) { return Collections . emptyMap ( ) ; } Map < String , OptionalFailure < Object > > accumulators = new HashMap < > ( serializedAccumulators . size ( ) ) ; for ( Map . Entry < String , SerializedValue < OptionalFailure < Object > > > entry : serializedAccumulators . entrySet ( ) ) { OptionalFailure < Object > value = null ; if ( entry . getValue ( ) != null ) { value = entry . getValue ( ) . deserializeValue ( loader ) ; } accumulators . put ( entry . getKey ( ) , value ) ; } return accumulators ;
public class V1WorkItemHandlersModel { /** * { @ inheritDoc } */ @ Override public WorkItemHandlersModel addWorkItemHandler ( WorkItemHandlerModel workItemHandler ) { } }
addChildModel ( workItemHandler ) ; _workItemHandlers . add ( workItemHandler ) ; return this ;
public class ErrorCollector { /** * Convenience wrapper for addError ( ) . */ public void addError ( String text , CSTNode context , SourceUnit source ) throws CompilationFailedException { } }
addError ( new LocatedMessage ( text , context , source ) ) ;
public class ByteArray { /** * Compress contents using zlib . */ public void compress ( ) { } }
IoBuffer tmp = IoBuffer . allocate ( 0 ) ; tmp . setAutoExpand ( true ) ; byte [ ] tmpData = new byte [ data . limit ( ) ] ; data . position ( 0 ) ; data . get ( tmpData ) ; try ( DeflaterOutputStream deflater = new DeflaterOutputStream ( tmp . asOutputStream ( ) , new Deflater ( Deflater . BEST_COMPRESSION ) ) ) { deflater . write ( tmpData ) ; deflater . finish ( ) ; } catch ( IOException e ) { // docs state that free is optional tmp . free ( ) ; throw new RuntimeException ( "could not compress data" , e ) ; } data . free ( ) ; data = tmp ; data . flip ( ) ; prepareIO ( ) ;
public class Future { /** * ( non - Javadoc ) * @ see * com . oath . cyclops . types . ConvertableFunctor # transform ( java . util . function . Function ) */ @ Override public < R > Future < R > map ( final Function < ? super T , ? extends R > fn ) { } }
return new Future < R > ( future . thenApply ( fn ) ) ;
public class StartCommand { /** * { @ inheritDoc } */ @ Override @ SuppressWarnings ( "PMD.SystemPrintln" ) int execute ( OptionsAndArgs pOpts , Object pVm , VirtualMachineHandler pHandler ) throws InvocationTargetException , NoSuchMethodException , IllegalAccessException { } }
String agentUrl ; agentUrl = checkAgentUrl ( pVm ) ; boolean quiet = pOpts . isQuiet ( ) ; if ( agentUrl == null ) { loadAgent ( pVm , pOpts ) ; agentUrl = checkAgentUrl ( pVm ) ; if ( agentUrl == null ) { // Wait a bit and try again agentUrl = checkAgentUrl ( pVm , 500 ) ; if ( agentUrl == null ) { System . err . println ( "Couldn't start agent for " + getProcessDescription ( pOpts , pHandler ) ) ; System . err . println ( "Possible reason could be that port '" + pOpts . getPort ( ) + "' is already occupied." ) ; System . err . println ( "Please check the standard output of the target process for a detailed error message." ) ; return 1 ; } } if ( ! quiet ) { System . out . println ( "Started Jolokia for " + getProcessDescription ( pOpts , pHandler ) ) ; System . out . println ( agentUrl ) ; } return 0 ; } else { if ( ! quiet ) { System . out . println ( "Jolokia is already attached to " + getProcessDescription ( pOpts , pHandler ) ) ; System . out . println ( agentUrl ) ; } return 1 ; }
public class ListELResolver { /** * If the base object is a list , returns the most general acceptable type * for a value in this list . * < p > If the base is a < code > List < / code > , the < code > propertyResolved < / code > * property of the < code > ELContext < / code > object must be set to * < code > true < / code > by this resolver , before returning . If this property * is not < code > true < / code > after this method is called , the caller * should ignore the return value . < / p > * < p > Assuming the base is a < code > List < / code > , this method will always * return < code > Object . class < / code > . This is because < code > List < / code > s * accept any object as an element . < / p > * @ param context The context of this evaluation . * @ param base The list to analyze . Only bases of type < code > List < / code > * are handled by this resolver . * @ param property The index of the element in the list to return the * acceptable type for . Will be coerced into an integer , but * otherwise ignored by this resolver . * @ return If the < code > propertyResolved < / code > property of * < code > ELContext < / code > was set to < code > true < / code > , then * the most general acceptable type ; otherwise undefined . * @ throws PropertyNotFoundException if the given index is out of * bounds for this list . * @ throws NullPointerException if context is < code > null < / code > * @ throws ELException if an exception was thrown while performing * the property or variable resolution . The thrown exception * must be included as the cause property of this exception , if * available . */ public Class < ? > getType ( ELContext context , Object base , Object property ) { } }
if ( context == null ) { throw new NullPointerException ( ) ; } if ( base != null && base instanceof List ) { context . setPropertyResolved ( true ) ; List list = ( List ) base ; int index = toInteger ( property ) ; if ( index < 0 || index >= list . size ( ) ) { throw new PropertyNotFoundException ( ) ; } return Object . class ; } return null ;
public class UserIdentityContext { /** * Returns the list of ancestors for the effective ( the one specified in the credentials ) account * in a lazy way . * @ return */ public List < String > getEffectiveAccountLineage ( ) { } }
if ( accountLineage == null ) { if ( effectiveAccount != null ) { try { accountLineage = accountsDao . getAccountLineage ( effectiveAccount ) ; } catch ( AccountHierarchyDepthCrossed e ) { throw new RuntimeException ( "Logged account has a very big line of ancestors. Something seems wrong. Account sid: " + effectiveAccount . getSid ( ) . toString ( ) , e ) ; } } } return accountLineage ;
public class TiffReader { /** * Parses the image file descriptor data . * @ param offset the file offset ( in bytes ) pointing to the IFD * @ param isImage the is image * @ param n the IFD number * @ return the ifd reading result */ private IfdReader readIFD ( int offset , boolean isImage , int n ) { } }
IFD ifd = new IFD ( isImage ) ; ifd . setOffset ( offset ) ; IfdReader ir = new IfdReader ( ) ; ir . setIfd ( ifd ) ; int nextIfdOffset = 0 ; try { if ( offset % 2 != 0 ) { validation . addErrorLoc ( "Bad word alignment in the offset of the IFD" , "IFD" + n ) ; } int index = offset ; int directoryEntries = data . readShort ( offset ) . toInt ( ) ; if ( directoryEntries < 1 ) { validation . addError ( "Incorrect number of IFD entries" , "IFD" + n , directoryEntries ) ; validation . setFatalError ( true , "Incorrect number of IFD entries" ) ; } else if ( directoryEntries > 500 ) { if ( n < 0 ) { validation . addError ( "Incorrect number of IFD entries" , "SubIFD" + ( - n ) , directoryEntries ) ; validation . setFatalError ( true , "Incorrect number of IFD entries" ) ; } else { validation . addError ( "Incorrect number of IFD entries" , "IFD" + n , directoryEntries ) ; validation . setFatalError ( true , "Incorrect number of IFD entries" ) ; } } else { index += 2 ; // Reads the tags for ( int i = 0 ; i < directoryEntries ; i ++ ) { int tagid = 0 ; int tagType = - 1 ; int tagN = - 1 ; try { tagid = data . readShort ( index ) . toInt ( ) ; tagType = data . readShort ( index + 2 ) . toInt ( ) ; tagN = data . readLong ( index + 4 ) . toInt ( ) ; boolean ok = checkType ( tagid , tagType , n ) ; if ( ! ok && tagN > 1000 ) tagN = 1000 ; TagValue tv = getValue ( tagType , tagN , tagid , index + 8 , ifd , n ) ; if ( ifd . containsTagId ( tagid ) ) { if ( duplicateTagTolerance > 0 ) validation . addWarning ( "Duplicate tag" , "" + tagid , "IFD" + n ) ; else validation . addError ( "Duplicate tag" , "IFD" + n , tagid ) ; } ifd . addTag ( tv ) ; } catch ( Exception ex ) { validation . addErrorLoc ( "Parse error in tag #" + i + " (" + tagid + ")" , "IFD" + n ) ; TagValue tv = new TagValue ( tagid , tagType ) ; tv . setReadOffset ( index + 8 ) ; tv . setReadLength ( tagN ) ; ifd . addTag ( tv ) ; } index += 12 ; } // Reads the position of the next IFD nextIfdOffset = 0 ; try { nextIfdOffset = data . readLong ( index ) . toInt ( ) ; } catch ( Exception ex ) { nextIfdOffset = 0 ; if ( nextIFDTolerance > 0 ) validation . addWarning ( "Unreadable next IFD offset" , "" , "IFD" + n ) ; else validation . addErrorLoc ( "Unreadable next IFD offset" , "IFD" + n ) ; } if ( nextIfdOffset > 0 && nextIfdOffset < 7 ) { validation . addError ( "Invalid next IFD offset" , "IFD" + n , nextIfdOffset ) ; nextIfdOffset = 0 ; } ir . setNextIfdOffset ( nextIfdOffset ) ; ir . readImage ( ) ; if ( isImage && ! ifd . hasStrips ( ) && ! ifd . hasTiles ( ) ) { validation . setFatalError ( true , "Incorrect image" ) ; } } } catch ( Exception ex ) { validation . addErrorLoc ( "IO Exception" , "IFD" + n ) ; return null ; } return ir ;
public class ModelHandlerManagerImp { /** * return the Handler instance . */ public void returnHandlerObject ( ModelHandler modelHandler ) { } }
if ( modelHandler == null ) return ; try { handlerObjectFactory . returnHandlerObject ( modelHandler ) ; } catch ( Exception ex ) { Debug . logError ( "[JdonFramework] return modelHandler error" + ex , module ) ; }
public class StandardBullhornData { /** * Makes the " entity " api call for inserting entities * HTTP Method : PUT * @ param entity CreateEntity * @ return a UpdateResponse */ protected < C extends CrudResponse , T extends CreateEntity > C handleInsertEntity ( T entity ) { } }
Map < String , String > uriVariables = restUriVariablesFactory . getUriVariablesForEntityInsert ( BullhornEntityInfo . getTypesRestEntityName ( entity . getClass ( ) ) ) ; String url = restUrlFactory . assembleEntityUrlForInsert ( ) ; CrudResponse response ; try { String jsonString = restJsonConverter . convertEntityToJsonString ( entity ) ; response = this . performCustomRequest ( url , jsonString , CreateResponse . class , uriVariables , HttpMethod . PUT , null ) ; } catch ( HttpStatusCodeException error ) { response = restErrorHandler . handleHttpFourAndFiveHundredErrors ( new CreateResponse ( ) , error , entity . getId ( ) ) ; } return ( C ) response ;
public class CommerceTierPriceEntryPersistenceImpl { /** * Returns the first commerce tier price entry in the ordered set where commercePriceEntryId = & # 63 ; . * @ param commercePriceEntryId the commerce price entry ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the first matching commerce tier price entry , or < code > null < / code > if a matching commerce tier price entry could not be found */ @ Override public CommerceTierPriceEntry fetchByCommercePriceEntryId_First ( long commercePriceEntryId , OrderByComparator < CommerceTierPriceEntry > orderByComparator ) { } }
List < CommerceTierPriceEntry > list = findByCommercePriceEntryId ( commercePriceEntryId , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
public class ModelControllerImpl { /** * Executes an operation on the controller latching onto an existing transaction * @ param operation the operation * @ param handler the handler * @ param control the transaction control * @ param prepareStep the prepare step to be executed before any other steps * @ param operationId the id of the current transaction * @ return the result of the operation */ @ SuppressWarnings ( "deprecation" ) protected ModelNode executeReadOnlyOperation ( final ModelNode operation , final OperationMessageHandler handler , final OperationTransactionControl control , final OperationStepHandler prepareStep , final int operationId ) { } }
final AbstractOperationContext delegateContext = getDelegateContext ( operationId ) ; CurrentOperationIdHolder . setCurrentOperationID ( operationId ) ; try { return executeReadOnlyOperation ( operation , delegateContext . getManagementModel ( ) , control , prepareStep , delegateContext ) ; } finally { CurrentOperationIdHolder . setCurrentOperationID ( null ) ; }
public class ListeningAnnouncerConfig { /** * Build a path for the particular named listener . The first implementation of this is used with zookeeper , but * there is nothing restricting its use in a more general pathing ( example : http endpoint proxy for raft ) * @ param listenerName The key for the listener . * @ return A path appropriate for use in zookeeper to discover the listeners with the particular listener name */ public String getAnnouncementPath ( String listenerName ) { } }
return ZKPaths . makePath ( getListenersPath ( ) , Preconditions . checkNotNull ( StringUtils . emptyToNullNonDruidDataString ( listenerName ) , "Listener name cannot be null" ) ) ;
public class ConsumerDispatcherState { /** * Gets the busname of the topicspace that the subscription was made through * @ return */ public String getTopicSpaceBusName ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( this , tc , "getTopicSpaceBusName" ) ; SibTr . exit ( this , tc , "getTopicSpaceBusName" , topicSpaceBusName ) ; } return topicSpaceBusName ;
public class GrassLegacyUtilities { /** * create a buffered image from a set of color triplets * @ param data * @ param width * @ param height * @ return */ public static BufferedImage ByteBufferImage ( byte [ ] data , int width , int height ) { } }
int [ ] bandoffsets = { 0 , 1 , 2 , 3 } ; DataBufferByte dbb = new DataBufferByte ( data , data . length ) ; WritableRaster wr = Raster . createInterleavedRaster ( dbb , width , height , width * 4 , 4 , bandoffsets , null ) ; int [ ] bitfield = { 8 , 8 , 8 , 8 } ; ColorSpace cs = ColorSpace . getInstance ( ColorSpace . CS_sRGB ) ; ColorModel cm = new ComponentColorModel ( cs , bitfield , true , false , Transparency . TRANSLUCENT , DataBuffer . TYPE_BYTE ) ; return new BufferedImage ( cm , wr , false , null ) ;
public class CmsResourceTypesTable { /** * Returns the available menu entries . < p > * @ return the menu entries */ List < I_CmsSimpleContextMenuEntry < Set < String > > > getMenuEntries ( ) { } }
if ( m_menuEntries == null ) { m_menuEntries = new ArrayList < I_CmsSimpleContextMenuEntry < Set < String > > > ( ) ; m_menuEntries . add ( new EditEntry ( ) ) ; m_menuEntries . add ( new SchemaEditorEntry ( ) ) ; m_menuEntries . add ( new SearchEntry ( ) ) ; m_menuEntries . add ( new MoveEntry ( ) ) ; m_menuEntries . add ( new DeleteEntry ( ) ) ; } return m_menuEntries ;
public class AsyncMutateInBuilder { /** * Append to an existing array , pushing the value to the back / last position in * the array . * @ param path the path of the array . * @ param value the value to insert at the back of the array . * @ param createPath true to create missing intermediary nodes . * @ deprecated Use { @ link # arrayAppend ( String , Object , SubdocOptionsBuilder ) } instead . */ @ Deprecated public < T > AsyncMutateInBuilder arrayAppend ( String path , T value , boolean createPath ) { } }
return arrayAppend ( path , value , new SubdocOptionsBuilder ( ) . createPath ( createPath ) ) ;
public class ConfigBindingModule { /** * Bind unique sub configuration objects by type . Available for injection like * { @ code @ Inject @ Config MySubConf config } . Value may be null because if null values would be avoided , * bindings will disappear . */ @ SuppressWarnings ( "unchecked" ) private void bindUniqueSubConfigurations ( ) { } }
for ( ConfigPath item : tree . getUniqueTypePaths ( ) ) { // bind only with annotation to avoid clashes with direct bindings toValue ( bind ( Key . get ( item . getDeclaredTypeWithGenerics ( ) , Config . class ) ) , item . getValue ( ) ) ; }
public class AbstractQueryProtocol { /** * Deallocate prepare statement if not used anymore . * @ param serverPrepareResult allocation result * @ throws SQLException if de - allocation failed . */ @ Override public void releasePrepareStatement ( ServerPrepareResult serverPrepareResult ) throws SQLException { } }
// If prepared cache is enable , the ServerPrepareResult can be shared in many PrepStatement , // so synchronised use count indicator will be decrement . serverPrepareResult . decrementShareCounter ( ) ; // deallocate from server if not cached if ( serverPrepareResult . canBeDeallocate ( ) ) { forceReleasePrepareStatement ( serverPrepareResult . getStatementId ( ) ) ; }
public class GremlinExpressionFactory { /** * Generates the emit expression used in loop expressions . * @ param s * @ param dataType * @ return */ protected GroovyExpression generateLoopEmitExpression ( GraphPersistenceStrategies s , IDataType dataType ) { } }
return typeTestExpression ( s , dataType . getName ( ) , getCurrentObjectExpression ( ) ) ;
public class Slf4jAdapter { /** * { @ inheritDoc } */ @ Override public void error ( final MessageItem messageItem , final Throwable t , final Object ... parameters ) { } }
if ( getLogger ( ) . isErrorEnabled ( messageItem . getMarker ( ) ) ) { getLogger ( ) . error ( messageItem . getMarker ( ) , messageItem . getText ( parameters ) , t ) ; } throwError ( messageItem , t , parameters ) ;
public class ConnectionInformation { /** * Creates a new { @ link ConnectionInformation } instance for a { @ link Connection } which will be obtained via a * { @ link CommonDataSource } * @ param dataSource the { @ link javax . sql . CommonDataSource } which created the { @ link # connection } * @ return a new { @ link ConnectionInformation } instance */ public static ConnectionInformation fromDataSource ( CommonDataSource dataSource ) { } }
final ConnectionInformation connectionInformation = new ConnectionInformation ( ) ; connectionInformation . dataSource = dataSource ; return connectionInformation ;
public class UniverseApi { /** * Get station information Get information on a station - - - This route * expires daily at 11:05 * @ param stationId * station _ id integer ( required ) * @ param datasource * The server name you would like data from ( optional , default to * tranquility ) * @ param ifNoneMatch * ETag from a previous request . A 304 will be returned if this * matches the current ETag ( optional ) * @ return ApiResponse & lt ; StationResponse & gt ; * @ throws ApiException * If fail to call the API , e . g . server error or cannot * deserialize the response body */ public ApiResponse < StationResponse > getUniverseStationsStationIdWithHttpInfo ( Integer stationId , String datasource , String ifNoneMatch ) throws ApiException { } }
com . squareup . okhttp . Call call = getUniverseStationsStationIdValidateBeforeCall ( stationId , datasource , ifNoneMatch , null ) ; Type localVarReturnType = new TypeToken < StationResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
public class TransactionImpl { /** * cleanup tx and prepare for reuse */ protected void refresh ( ) { } }
if ( log . isDebugEnabled ( ) ) log . debug ( "Refresh this transaction for reuse: " + this ) ; try { // we reuse ObjectEnvelopeTable instance objectEnvelopeTable . refresh ( ) ; } catch ( Exception e ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "error closing object envelope table : " + e . getMessage ( ) ) ; e . printStackTrace ( ) ; } } cleanupBroker ( ) ; // clear the temporary used named roots map // we should do that , because same tx instance // could be used several times broker = null ; clearRegistrationList ( ) ; unmaterializedLocks . clear ( ) ; txStatus = Status . STATUS_NO_TRANSACTION ;
public class AbstrCFMLExprTransformer { /** * Extrahiert den Start Element einer Variale , dies ist entweder eine Funktion , eine Scope * Definition oder eine undefinierte Variable . < br / > * EBNF : < br / > * < code > identifier " ( " functionArg " ) " | scope | identifier ; < / code > * @ param name Einstiegsname * @ return CFXD Element * @ throws TemplateException */ private Variable startElement ( Data data , Identifier name , Position line ) throws TemplateException { } }
// check function if ( data . srcCode . isCurrent ( '(' ) ) { FunctionMember func = getFunctionMember ( data , name , true ) ; Variable var = name . getFactory ( ) . createVariable ( line , data . srcCode . getPosition ( ) ) ; var . addMember ( func ) ; comments ( data ) ; return var ; } // check scope Variable var = scope ( data , name , line ) ; if ( var != null ) return var ; // undefined variable var = name . getFactory ( ) . createVariable ( line , data . srcCode . getPosition ( ) ) ; var . addMember ( data . factory . createDataMember ( name ) ) ; comments ( data ) ; return var ;
public class ProGradePolicy { /** * Private method for creating new Permission object from ParsedPermission . * @ param p ParsedPermission with informations about Permission . * @ param keystore KeyStore which is used by this policy file * @ return new created Permission or null if Permission doesn ' t exist or doesn ' t be created . * @ throws Exception when there was any problem during creating Permission */ private Permission createPermission ( ParsedPermission p , KeyStore keystore ) throws Exception { } }
if ( p == null ) { return null ; } String permissionName = expandStringWithProperty ( p . getPermissionName ( ) ) ; String actions = expandStringWithProperty ( p . getActions ( ) ) ; Class < ? > clazz ; try { clazz = Class . forName ( p . getPermissionType ( ) ) ; } catch ( ClassNotFoundException ex ) { Certificate [ ] certificates = getCertificates ( expandStringWithProperty ( p . getSignedBy ( ) ) , keystore ) ; if ( p . getSignedBy ( ) != null && certificates == null ) { if ( debug ) { ProGradePolicyDebugger . log ( "Permission with signedBy " + p . getSignedBy ( ) + " is ignored. Certificate wasn't successfully found or loaded " + "from keystore" ) ; } return null ; } return new UnresolvedPermission ( p . getPermissionType ( ) , permissionName , actions , certificates ) ; } try { if ( clazz . equals ( FilePermission . class ) ) { return new FilePermission ( permissionName , actions ) ; } else if ( clazz . equals ( SocketPermission . class ) ) { return new SocketPermission ( permissionName , actions ) ; } else if ( clazz . equals ( PropertyPermission . class ) ) { return new PropertyPermission ( permissionName , actions ) ; } else if ( clazz . equals ( RuntimePermission . class ) ) { return new RuntimePermission ( permissionName , actions ) ; } else if ( clazz . equals ( AWTPermission . class ) ) { return new AWTPermission ( permissionName , actions ) ; } else if ( clazz . equals ( NetPermission . class ) ) { return new NetPermission ( permissionName , actions ) ; } else if ( clazz . equals ( ReflectPermission . class ) ) { return new ReflectPermission ( permissionName , actions ) ; } else if ( clazz . equals ( SerializablePermission . class ) ) { return new SerializablePermission ( permissionName , actions ) ; } else if ( clazz . equals ( SecurityPermission . class ) ) { return new SecurityPermission ( permissionName , actions ) ; } else if ( clazz . equals ( AllPermission . class ) ) { return new AllPermission ( permissionName , actions ) ; } else if ( clazz . equals ( AuthPermission . class ) ) { return new AuthPermission ( permissionName , actions ) ; } } catch ( IllegalArgumentException ex ) { System . err . println ( "IllegalArgumentException in permission: [" + p . getPermissionType ( ) + ", " + permissionName + ", " + actions + "]" ) ; return null ; } // check signedBy permission for classes which weren ' t loaded by boostrap classloader // in some java clazz . getClassLoader ( ) returns null for boostrap classloader if ( clazz . getClassLoader ( ) != null ) { // another check whether clazz . getClassLoader ( ) isn ' t bootstrap classloader if ( ! clazz . getClassLoader ( ) . equals ( clazz . getClassLoader ( ) . getParent ( ) ) ) { if ( p . getSignedBy ( ) != null ) { Certificate [ ] signers = ( Certificate [ ] ) clazz . getSigners ( ) ; if ( signers == null ) { return null ; } else { Certificate [ ] certificates = getCertificates ( expandStringWithProperty ( p . getSignedBy ( ) ) , keystore ) ; if ( certificates == null ) { return null ; } else { for ( int i = 0 ; i < certificates . length ; i ++ ) { Certificate certificate = certificates [ i ] ; boolean contain = false ; for ( int j = 0 ; j < signers . length ; j ++ ) { Certificate signedCertificate = signers [ j ] ; if ( certificate . equals ( signedCertificate ) ) { contain = true ; break ; } } if ( ! contain ) { return null ; } } } } } } } try { Constructor < ? > c = clazz . getConstructor ( String . class , String . class ) ; return ( Permission ) c . newInstance ( new Object [ ] { permissionName , actions } ) ; } catch ( NoSuchMethodException ex1 ) { try { Constructor < ? > c = clazz . getConstructor ( String . class ) ; return ( Permission ) c . newInstance ( new Object [ ] { permissionName } ) ; } catch ( NoSuchMethodException ex2 ) { Constructor < ? > c = clazz . getConstructor ( ) ; return ( Permission ) c . newInstance ( new Object [ ] { } ) ; } }
public class SmartBinder { /** * Create a new SmartBinder from the given Signature . * @ param inbound the Signature to start from * @ return a new SmartBinder */ public static SmartBinder from ( Signature inbound ) { } }
return new SmartBinder ( inbound , Binder . from ( inbound . type ( ) ) ) ;
public class GuacamoleWebSocketTunnelServlet { /** * Sends the given Guacamole and WebSocket numeric status * on the given WebSocket connection and closes the * connection . * @ param outbound * The outbound WebSocket connection to close . * @ param guacamoleStatusCode * The status to send . * @ param webSocketCode * The numeric WebSocket status code to send . */ private void closeConnection ( WsOutbound outbound , int guacamoleStatusCode , int webSocketCode ) { } }
try { byte [ ] message = Integer . toString ( guacamoleStatusCode ) . getBytes ( "UTF-8" ) ; outbound . close ( webSocketCode , ByteBuffer . wrap ( message ) ) ; } catch ( IOException e ) { logger . debug ( "Unable to close WebSocket tunnel." , e ) ; }
public class Latkes { /** * Sets latke . props with the specified key and value . * @ param key the specified key * @ param value the specified value */ public static void setLatkeProperty ( final String key , final String value ) { } }
if ( null == key ) { LOGGER . log ( Level . WARN , "latke.props can not set null key" ) ; return ; } if ( null == value ) { LOGGER . log ( Level . WARN , "latke.props can not set null value" ) ; return ; } latkeProps . setProperty ( key , value ) ;
public class WebRiskServiceV1Beta1Client { /** * Gets the most recent threat list diffs . * < p > Sample code : * < pre > < code > * try ( WebRiskServiceV1Beta1Client webRiskServiceV1Beta1Client = WebRiskServiceV1Beta1Client . create ( ) ) { * ThreatType threatType = ThreatType . THREAT _ TYPE _ UNSPECIFIED ; * ByteString versionToken = ByteString . copyFromUtf8 ( " " ) ; * ComputeThreatListDiffRequest . Constraints constraints = ComputeThreatListDiffRequest . Constraints . newBuilder ( ) . build ( ) ; * ComputeThreatListDiffResponse response = webRiskServiceV1Beta1Client . computeThreatListDiff ( threatType , versionToken , constraints ) ; * < / code > < / pre > * @ param threatType Required . The ThreatList to update . * @ param versionToken The current version token of the client for the requested list ( the client * version that was received from the last successful diff ) . * @ param constraints The constraints associated with this request . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final ComputeThreatListDiffResponse computeThreatListDiff ( ThreatType threatType , ByteString versionToken , ComputeThreatListDiffRequest . Constraints constraints ) { } }
ComputeThreatListDiffRequest request = ComputeThreatListDiffRequest . newBuilder ( ) . setThreatType ( threatType ) . setVersionToken ( versionToken ) . setConstraints ( constraints ) . build ( ) ; return computeThreatListDiff ( request ) ;
public class IOUtils { /** * < p > readFromResource . < / p > * @ param resource a { @ link java . lang . String } object . * @ return a { @ link java . lang . String } object . * @ throws java . io . IOException if any . */ public static String readFromResource ( String resource ) throws IOException { } }
InputStream in = getResourceAsStream ( resource ) ; if ( in == null ) { return null ; } try { return read ( in ) ; } finally { closeQuietly ( in ) ; }
public class ValidationData { /** * Find list parent validation data . * @ return the validation data */ public ValidationData findListParent ( ) { } }
if ( ! this . listChild ) { return null ; } ValidationData parent = this . parent ; while ( parent != null && ! parent . isList ( ) ) { parent = parent . parent ; } return parent ;
public class LaunchRunner { /** * Trim the topology definition for storing into state manager . * This is because the user generated spouts and bolts * might be huge . * @ return trimmed topology */ public TopologyAPI . Topology trimTopology ( TopologyAPI . Topology topology ) { } }
// create a copy of the topology physical plan TopologyAPI . Topology . Builder builder = TopologyAPI . Topology . newBuilder ( ) . mergeFrom ( topology ) ; // clear the state of user spout java objects - which can be potentially huge for ( TopologyAPI . Spout . Builder spout : builder . getSpoutsBuilderList ( ) ) { spout . getCompBuilder ( ) . clearSerializedObject ( ) ; } // clear the state of user spout java objects - which can be potentially huge for ( TopologyAPI . Bolt . Builder bolt : builder . getBoltsBuilderList ( ) ) { bolt . getCompBuilder ( ) . clearSerializedObject ( ) ; } return builder . build ( ) ;
public class CasEvent { /** * Put property . * @ param key the key * @ param value the value */ public void put ( final String key , final String value ) { } }
if ( StringUtils . isBlank ( value ) ) { this . properties . remove ( key ) ; } else { this . properties . put ( key , value ) ; }
public class ImmutableConciseSet { /** * Based on the ConciseSet implementation by Alessandro Colantonio */ private int calcSize ( ) { } }
int retVal = 0 ; for ( int i = 0 ; i <= lastWordIndex ; i ++ ) { int w = words . get ( i ) ; if ( ConciseSetUtils . isLiteral ( w ) ) { retVal += ConciseSetUtils . getLiteralBitCount ( w ) ; } else { if ( ConciseSetUtils . isZeroSequence ( w ) ) { if ( ! ConciseSetUtils . isSequenceWithNoBits ( w ) ) { retVal ++ ; } } else { retVal += ConciseSetUtils . maxLiteralLengthMultiplication ( ConciseSetUtils . getSequenceCount ( w ) + 1 ) ; if ( ! ConciseSetUtils . isSequenceWithNoBits ( w ) ) { retVal -- ; } } } } return retVal ;
public class StaticTypeCheckingVisitor { /** * If a method call returns a parameterized type , then we can perform additional inference on the * return type , so that the type gets actual type parameters . For example , the method * Arrays . asList ( T . . . ) is generified with type T which can be deduced from actual type * arguments . * @ param method the method node * @ param arguments the method call arguments * @ param explicitTypeHints explicit type hints as found for example in Collections . & lt ; String & gt ; emptyList ( ) * @ return parameterized , infered , class node */ protected ClassNode inferReturnTypeGenerics ( ClassNode receiver , MethodNode method , Expression arguments , GenericsType [ ] explicitTypeHints ) { } }
ClassNode returnType = method . getReturnType ( ) ; if ( method instanceof ExtensionMethodNode && ( isUsingGenericsOrIsArrayUsingGenerics ( returnType ) ) ) { // check if the placeholder corresponds to the placeholder of the first parameter ExtensionMethodNode emn = ( ExtensionMethodNode ) method ; MethodNode dgmMethod = emn . getExtensionMethodNode ( ) ; ClassNode dc = emn . getDeclaringClass ( ) ; ArgumentListExpression argList = new ArgumentListExpression ( ) ; VariableExpression vexp = varX ( "$foo" , receiver ) ; vexp . setNodeMetaData ( ExtensionMethodDeclaringClass . class , dc ) ; argList . addExpression ( vexp ) ; if ( arguments instanceof ArgumentListExpression ) { List < Expression > expressions = ( ( ArgumentListExpression ) arguments ) . getExpressions ( ) ; for ( Expression arg : expressions ) { argList . addExpression ( arg ) ; } } else { argList . addExpression ( arguments ) ; } return inferReturnTypeGenerics ( receiver , dgmMethod , argList ) ; } if ( ! isUsingGenericsOrIsArrayUsingGenerics ( returnType ) ) return returnType ; if ( getGenericsWithoutArray ( returnType ) == null ) return returnType ; Map < GenericsTypeName , GenericsType > resolvedPlaceholders = resolvePlaceHoldersFromDeclaration ( receiver , getDeclaringClass ( method , arguments ) , method , method . isStatic ( ) ) ; if ( ! receiver . isGenericsPlaceHolder ( ) ) { GenericsUtils . extractPlaceholders ( receiver , resolvedPlaceholders ) ; } resolvePlaceholdersFromExplicitTypeHints ( method , explicitTypeHints , resolvedPlaceholders ) ; if ( resolvedPlaceholders . isEmpty ( ) ) { return boundUnboundedWildcards ( returnType ) ; } Map < GenericsTypeName , GenericsType > placeholdersFromContext = extractGenericsParameterMapOfThis ( typeCheckingContext . getEnclosingMethod ( ) ) ; applyGenericsConnections ( placeholdersFromContext , resolvedPlaceholders ) ; // then resolve receivers from method arguments Parameter [ ] parameters = method . getParameters ( ) ; boolean isVargs = isVargs ( parameters ) ; ArgumentListExpression argList = InvocationWriter . makeArgumentList ( arguments ) ; List < Expression > expressions = argList . getExpressions ( ) ; int paramLength = parameters . length ; if ( expressions . size ( ) >= paramLength ) { for ( int i = 0 ; i < paramLength ; i ++ ) { boolean lastArg = i == paramLength - 1 ; ClassNode type = parameters [ i ] . getType ( ) ; ClassNode actualType = getType ( expressions . get ( i ) ) ; while ( ! type . isUsingGenerics ( ) && type . isArray ( ) && actualType . isArray ( ) ) { type = type . getComponentType ( ) ; actualType = actualType . getComponentType ( ) ; } if ( isUsingGenericsOrIsArrayUsingGenerics ( type ) ) { if ( implementsInterfaceOrIsSubclassOf ( actualType , CLOSURE_TYPE ) && isSAMType ( type ) ) { // implicit closure coercion in action ! Map < GenericsTypeName , GenericsType > pholders = applyGenericsContextToParameterClass ( resolvedPlaceholders , type ) ; actualType = convertClosureTypeToSAMType ( expressions . get ( i ) , actualType , type , pholders ) ; } if ( isVargs && lastArg && actualType . isArray ( ) ) { actualType = actualType . getComponentType ( ) ; } if ( isVargs && lastArg && type . isArray ( ) ) { type = type . getComponentType ( ) ; } actualType = wrapTypeIfNecessary ( actualType ) ; Map < GenericsTypeName , GenericsType > connections = new HashMap < GenericsTypeName , GenericsType > ( ) ; extractGenericsConnections ( connections , actualType , type ) ; extractGenericsConnectionsForSuperClassAndInterfaces ( resolvedPlaceholders , connections ) ; applyGenericsConnections ( connections , resolvedPlaceholders ) ; } } } return applyGenericsContext ( resolvedPlaceholders , returnType ) ;
public class SoyExpression { /** * Returns an Expression that evaluates to a list containing all the items as boxed soy values . */ public static Expression asBoxedList ( List < SoyExpression > items ) { } }
List < Expression > childExprs = new ArrayList < > ( items . size ( ) ) ; for ( SoyExpression child : items ) { childExprs . add ( child . box ( ) ) ; } return BytecodeUtils . asList ( childExprs ) ;
public class ntpserver { /** * Use this API to delete ntpserver . */ public static base_response delete ( nitro_service client , ntpserver resource ) throws Exception { } }
ntpserver deleteresource = new ntpserver ( ) ; deleteresource . serverip = resource . serverip ; deleteresource . servername = resource . servername ; return deleteresource . delete_resource ( client ) ;
public class Log { /** * Log state assertion . * @ param callInfo Call info . * @ param assertion State assertion . */ void write ( CallInfo callInfo , DataSetAssertion assertion ) { } }
Element rootNode = root ( callInfo ) ; DataSource ds = assertion . getSource ( ) ; write ( rootNode , ds ) ; Element saNode = createNode ( rootNode , ASSERTION_TAG ) ; List < MetaData . ColumnInfo > mdCols = ds . getMetaData ( ) . columns ( ) ; write ( saNode , EXPECTED_TAG , mdCols , assertion . data ( DataSetAssertion . IteratorType . EXPECTED_DATA ) ) ; if ( ! assertion . passed ( ) ) { Element errorsNode = createNode ( saNode , ERRORS_TAG ) ; write ( errorsNode , EXPECTED_TAG , mdCols , assertion . data ( DataSetAssertion . IteratorType . ERRORS_EXPECTED ) ) ; write ( errorsNode , ACTUAL_TAG , mdCols , assertion . data ( DataSetAssertion . IteratorType . ERRORS_ACTUAL ) ) ; } flush ( rootNode ) ;
public class HelloWorldController { /** * Define routes */ public void configureRoutes ( ) { } }
get ( "/hello" , request -> helloService . hi ( request . getParam ( "name" ) ) ) ; get ( "/goodbye" , request -> new GoodbyeResponse ( "guest" , "cya" , 123 ) ) ; get ( "/ping" , request -> Future . value ( "pong" ) ) ; get ( "/exception" , request -> new HelloWorldException ( "error processing request" ) ) ; get ( "/magicNum" , request -> Future . value ( magicNumber ) ) ; get ( "/moduleMagicNum" , request -> Future . value ( moduleMagicNumber ) ) ; get ( "/moduleMagicFloatNum" , request -> Future . value ( moduleMagicFloatingNumber ) ) ;
public class AlgorithmId { /** * Creates a signature algorithm name from a digest algorithm * name and a encryption algorithm name . */ public static String makeSigAlg ( String digAlg , String encAlg ) { } }
digAlg = digAlg . replace ( "-" , "" ) . toUpperCase ( Locale . ENGLISH ) ; if ( digAlg . equalsIgnoreCase ( "SHA" ) ) digAlg = "SHA1" ; encAlg = encAlg . toUpperCase ( Locale . ENGLISH ) ; if ( encAlg . equals ( "EC" ) ) encAlg = "ECDSA" ; return digAlg + "with" + encAlg ;
public class IsNull { /** * called by modifed call from translation time evaluator */ public static boolean call ( PageContext pc , String str ) { } }
try { return pc . evaluate ( str ) == null ; } catch ( PageException e ) { return true ; }
public class FieldInfo { /** * To check if type of { @ link Field } is assignable from { @ link List } * @ param field * @ return true if is assignable from { @ link List } */ private void checkListMapType ( Field field ) { } }
Class < ? > cls = field . getType ( ) ; boolean needCheckGenericType = false ; if ( List . class . isAssignableFrom ( cls ) ) { // if check is list ignore check isList = true ; needCheckGenericType = true ; } if ( Map . class . isAssignableFrom ( cls ) ) { // if check is list ignore check isMap = true ; needCheckGenericType = true ; } if ( ! needCheckGenericType ) { return ; } Type type = field . getGenericType ( ) ; if ( type instanceof ParameterizedType ) { ParameterizedType ptype = ( ParameterizedType ) type ; Type [ ] actualTypeArguments = ptype . getActualTypeArguments ( ) ; if ( actualTypeArguments != null ) { int length = actualTypeArguments . length ; // validate if ( isList ) { if ( length != 1 ) { throw new RuntimeException ( "List must use generic definiation like List<String>, please check field name '" + field . getName ( ) + " at class " + field . getDeclaringClass ( ) . getName ( ) ) ; } } else if ( isMap ) { if ( length != 2 ) { throw new RuntimeException ( "Map must use generic definiation like Map<String, String>, please check field name '" + field . getName ( ) + " at class " + field . getDeclaringClass ( ) . getName ( ) ) ; } } Type targetType = actualTypeArguments [ 0 ] ; if ( targetType instanceof Class ) { genericKeyType = ( Class ) targetType ; } if ( actualTypeArguments . length > 1 ) { targetType = actualTypeArguments [ 1 ] ; if ( targetType instanceof Class ) { genericeValueType = ( Class ) targetType ; } } } }
public class CPOptionValuePersistenceImpl { /** * Removes all the cp option values where groupId = & # 63 ; from the database . * @ param groupId the group ID */ @ Override public void removeByGroupId ( long groupId ) { } }
for ( CPOptionValue cpOptionValue : findByGroupId ( groupId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ) { remove ( cpOptionValue ) ; }
public class DatabasesInner { /** * Renames 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 serverName The name of the server . * @ param databaseName The name of the database to rename . * @ param id The target ID for the resource * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < Void > renameAsync ( String resourceGroupName , String serverName , String databaseName , String id , final ServiceCallback < Void > serviceCallback ) { } }
return ServiceFuture . fromResponse ( renameWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , id ) , serviceCallback ) ;
public class CouponTraverseMap { /** * Returns entryIndex if the given key is found . If not found , returns one ' s complement entryIndex * of an empty slot for insertion , which may be over a deleted key . * @ param key the given key * @ return the entryIndex */ @ Override int findKey ( final byte [ ] key ) { } }
final long [ ] hash = MurmurHash3 . hash ( key , SEED ) ; int entryIndex = getIndex ( hash [ 0 ] , tableEntries_ ) ; int firstDeletedIndex = - 1 ; final int loopIndex = entryIndex ; do { if ( isBitClear ( stateArr_ , entryIndex ) ) { return firstDeletedIndex == - 1 ? ~ entryIndex : ~ firstDeletedIndex ; // found empty or deleted } if ( couponsArr_ [ entryIndex * maxCouponsPerKey_ ] == 0 ) { // found deleted if ( firstDeletedIndex == - 1 ) { firstDeletedIndex = entryIndex ; } } else if ( Map . arraysEqual ( keysArr_ , entryIndex * keySizeBytes_ , key , 0 , keySizeBytes_ ) ) { return entryIndex ; // found key } entryIndex = ( entryIndex + getStride ( hash [ 1 ] , tableEntries_ ) ) % tableEntries_ ; } while ( entryIndex != loopIndex ) ; throw new SketchesArgumentException ( "Key not found and no empty slots!" ) ;
public class DescribeConfigurationResult { /** * The list of all tags associated with this configuration . * @ param tags * The list of all tags associated with this configuration . * @ return Returns a reference to this object so that method calls can be chained together . */ public DescribeConfigurationResult withTags ( java . util . Map < String , String > tags ) { } }
setTags ( tags ) ; return this ;
public class Counter { /** * This method removes all elements except of top N by counter values * @ param N */ public void keepTopNElements ( int N ) { } }
PriorityQueue < Pair < T , Double > > queue = asPriorityQueue ( ) ; clear ( ) ; for ( int e = 0 ; e < N ; e ++ ) { Pair < T , Double > pair = queue . poll ( ) ; if ( pair != null ) incrementCount ( pair . getFirst ( ) , pair . getSecond ( ) ) ; }
public class WavefrontStrings { /** * Truncate tag keys and values , to prevent them from exceeding the max * length of a tag entry . */ private static Map . Entry < String , String > maybeTruncateTagEntry ( Map . Entry < String , String > tag_entry ) { } }
String k = tag_entry . getKey ( ) ; String v = tag_entry . getValue ( ) ; if ( k . length ( ) + v . length ( ) <= MAX_TAG_KEY_VAL_CHARS - 2 ) // 2 chars for the quotes around the value return tag_entry ; if ( k . length ( ) > TRUNCATE_TAG_NAME ) k = k . substring ( 0 , TRUNCATE_TAG_NAME ) ; if ( k . length ( ) + v . length ( ) > MAX_TAG_KEY_VAL_CHARS - 2 ) v = v . substring ( 0 , MAX_TAG_KEY_VAL_CHARS - 2 - k . length ( ) ) ; return SimpleMapEntry . create ( k , v ) ;
public class BaseHttp2Server { /** * < p > Shuts down this server and releases the port to which this server was bound . If a { @ code null } event loop * group was provided at construction time , the server will also shut down its internally - managed event loop * group . < / p > * < p > If a non - null { @ code EventLoopGroup } was provided at construction time , mock servers may be reconnected and * reused after they have been shut down . If no event loop group was provided at construction time , mock servers may * not be restarted after they have been shut down via this method . < / p > * @ return a { @ code Future } that will succeed once the server has finished unbinding from its port and , if the * server was managing its own event loop group , its event loop group has shut down */ @ SuppressWarnings ( { } }
"rawtypes" , "unchecked" } ) public Future < Void > shutdown ( ) { final Future < Void > channelCloseFuture = this . allChannels . close ( ) ; final Future < Void > disconnectFuture ; if ( this . shouldShutDownEventLoopGroup ) { // Wait for the channel to close before we try to shut down the event loop group channelCloseFuture . addListener ( new GenericFutureListener < Future < Void > > ( ) { @ Override public void operationComplete ( final Future < Void > future ) throws Exception { BaseHttp2Server . this . bootstrap . config ( ) . group ( ) . shutdownGracefully ( ) ; } } ) ; // Since the termination future for the event loop group is a Future < ? > instead of a Future < Void > , // we ' ll need to create our own promise and then notify it when the termination future completes . disconnectFuture = new DefaultPromise < > ( GlobalEventExecutor . INSTANCE ) ; this . bootstrap . config ( ) . group ( ) . terminationFuture ( ) . addListener ( new GenericFutureListener ( ) { @ Override public void operationComplete ( final Future future ) throws Exception { ( ( Promise < Void > ) disconnectFuture ) . trySuccess ( null ) ; } } ) ; } else { // We ' re done once we ' ve closed all the channels , so we can return the closure future directly . disconnectFuture = channelCloseFuture ; } disconnectFuture . addListener ( new GenericFutureListener < Future < Void > > ( ) { @ Override public void operationComplete ( final Future < Void > future ) throws Exception { if ( BaseHttp2Server . this . sslContext instanceof ReferenceCounted ) { if ( BaseHttp2Server . this . hasReleasedSslContext . compareAndSet ( false , true ) ) { ( ( ReferenceCounted ) BaseHttp2Server . this . sslContext ) . release ( ) ; } } } } ) ; return disconnectFuture ;
public class Client { /** * Download object by hash . * @ param hash Object hash . * @ param handler Stream handler . * @ return Stream handler result . * @ throws FileNotFoundException File not found exception if object don ' t exists on LFS server . * @ throws IOException On some errors . */ @ NotNull public < T > T getObject ( @ NotNull final String hash , @ NotNull final StreamHandler < T > handler ) throws IOException { } }
return doWork ( auth -> { final ObjectRes links = doRequest ( auth , new MetaGet ( ) , AuthHelper . join ( auth . getHref ( ) , PATH_OBJECTS + "/" + hash ) ) ; if ( links == null ) { throw new FileNotFoundException ( ) ; } return getObject ( new Meta ( hash , - 1 ) , links , handler ) ; } , Operation . Download ) ;