signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NFVORequestor { /** * Returns a ConfigurationAgent with which requests regarding Configurations can be sent to the * NFVO . * @ return a ConfigurationAgent */ public synchronized ConfigurationAgent getConfigurationAgent ( ) { } }
if ( this . configurationAgent == null ) { if ( isService ) { this . configurationAgent = new ConfigurationAgent ( this . serviceName , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version , this . serviceKey ) ; } else { this . configurationAgent = new ConfigurationAgent ( this . username , this . password , this . projectId , this . sslEnabled , this . nfvoIp , this . nfvoPort , this . version ) ; } } return this . configurationAgent ;
public class JoltUtils { /** * Navigate a JSON tree ( made up of Maps and Lists ) to " lookup " the value * at a particular path , but will return the supplied default value if * there are any problems . * @ param source the source JSON object ( Map , List , String , Number ) * @ param paths varargs path you want to travel * @ return the object of Type < T > at final destination or defaultValue if non existent */ public static < T > T navigateOrDefault ( final T defaultValue , final Object source , final Object ... paths ) { } }
Object destination = source ; for ( Object path : paths ) { if ( path == null || destination == null ) { return defaultValue ; } if ( destination instanceof Map ) { Map destinationMap = ( Map ) destination ; if ( ! destinationMap . containsKey ( path ) ) { return defaultValue ; } else { destination = destinationMap . get ( path ) ; } } else if ( path instanceof Integer && destination instanceof List ) { List destList = ( List ) destination ; int pathInt = ( Integer ) path ; if ( pathInt < 0 || pathInt >= destList . size ( ) ) { return defaultValue ; } else { destination = destList . get ( pathInt ) ; } } else { return defaultValue ; } } return cast ( destination ) ;
public class LeaderRole { /** * Appends an entry to the Raft log and compacts logs if necessary . * @ param entry the entry to append * @ param < E > the entry type * @ return a completable future to be completed once the entry has been appended */ private < E extends RaftLogEntry > CompletableFuture < Indexed < E > > appendAndCompact ( E entry ) { } }
return appendAndCompact ( entry , 0 ) ;
public class IndexingTagHandler { /** * All fields that were not seen until the end of this message are missing and will be indexed with their default * value or null if none was declared . The null value is replaced with a special null token placeholder because * Lucene cannot index nulls . */ private void indexMissingFields ( ) { } }
for ( FieldDescriptor fieldDescriptor : messageContext . getMessageDescriptor ( ) . getFields ( ) ) { if ( ! messageContext . isFieldMarked ( fieldDescriptor . getNumber ( ) ) ) { Object defaultValue = fieldDescriptor . getJavaType ( ) == JavaType . MESSAGE || fieldDescriptor . hasDefaultValue ( ) ? fieldDescriptor . getDefaultValue ( ) : null ; IndexingMetadata indexingMetadata = messageContext . getMessageDescriptor ( ) . getProcessedAnnotation ( IndexingMetadata . INDEXED_ANNOTATION ) ; FieldMapping fieldMapping = indexingMetadata != null ? indexingMetadata . getFieldMapping ( fieldDescriptor . getName ( ) ) : null ; if ( indexingMetadata == null && isLegacyIndexingEnabled || fieldMapping != null && fieldMapping . index ( ) ) { addFieldToDocument ( fieldDescriptor , defaultValue , fieldMapping ) ; } } }
public class NNStorageDirectoryRetentionManager { /** * Check if we have not exceeded the maximum number of backups . */ static void cleanUpAndCheckBackup ( Configuration conf , File origin ) throws IOException { } }
// get all backups String [ ] backups = getBackups ( origin ) ; File root = origin . getParentFile ( ) ; // maximum total number of backups int copiesToKeep = conf . getInt ( NN_IMAGE_COPIES_TOKEEP , NN_IMAGE_COPIES_TOKEEP_DEFAULT ) ; // days to keep , if set to 0 than keep only last backup int daysToKeep = conf . getInt ( NN_IMAGE_DAYS_TOKEEP , NN_IMAGE_DAYS_TOKEEP_DEFAULT ) ; if ( copiesToKeep == 0 && daysToKeep == 0 ) { // Do not delete anything in this case // every startup will create extra checkpoint return ; } // cleanup copies older than daysToKeep deleteOldBackups ( root , backups , daysToKeep , copiesToKeep ) ; // check remaining backups backups = getBackups ( origin ) ; if ( backups . length >= copiesToKeep ) { throw new IOException ( "Exceeded maximum number of standby backups of " + origin + " under " + origin . getParentFile ( ) + " max: " + copiesToKeep ) ; }
public class Environment { /** * And Set the same * @ param key key * @ param value value * @ return return Environment instance */ public Environment add ( @ NonNull String key , @ NonNull Object value ) { } }
return set ( key , value ) ;
public class Stopwatch { /** * Stop the stopwatch and record the statistics for the latest run . This method does nothing if the stopwatch is not currently * { @ link # isRunning ( ) running } * @ see # isRunning ( ) */ public void stop ( ) { } }
if ( this . isRunning ( ) ) { long duration = System . nanoTime ( ) - this . lastStarted ; this . lastStarted = 0l ; this . stats . add ( new Duration ( duration ) ) ; }
public class SleeSipProviderImpl { /** * ( non - Javadoc ) * @ see * javax . sip . SipProvider # getNewClientTransaction ( javax . sip . message . Request ) */ public ClientTransaction getNewClientTransaction ( Request request ) throws TransactionUnavailableException { } }
checkState ( ) ; final SIPClientTransaction ct = ( SIPClientTransaction ) provider . getNewClientTransaction ( request ) ; final ClientTransactionWrapper ctw = new ClientTransactionWrapper ( ct , ra ) ; ctw . setActivity ( true ) ; final DialogWrapper dw = ctw . getDialogWrapper ( ) ; if ( dw != null ) { dw . addOngoingTransaction ( ctw ) ; } if ( ! ra . addSuspendedActivity ( ctw ) ) { throw new TransactionUnavailableException ( "Failed to create activity" ) ; } return ctw ;
public class JarHash { /** * Given a path name ( without preceding and appending " / " ) , * return the names of all file and directory names contained * in the path location ( not recursive ) . * @ param path - name of resource path * @ return - list of resource names at that path */ public static List < String > getResourcesList ( String path ) { } }
Set < String > resList = new HashSet < > ( ) ; // subdirectories can cause duplicate entries try { // Java doesn ' t allow simple exploration of resources as directories // when the resources are inside a jar file . This searches the contents // of the jar to get the list URL classUrl = JarHash . class . getResource ( "/water/H2O.class" ) ; if ( classUrl != null && classUrl . getProtocol ( ) . equals ( "jar" ) ) { // extract jarPath from classUrl string String jarPath = classUrl . getPath ( ) . substring ( 5 , classUrl . getPath ( ) . indexOf ( "!" ) ) ; JarFile jar = new JarFile ( URLDecoder . decode ( jarPath , "UTF-8" ) ) ; Enumeration < JarEntry > files = jar . entries ( ) ; // look for all entries within the supplied resource path while ( files . hasMoreElements ( ) ) { String fName = files . nextElement ( ) . getName ( ) ; if ( fName . startsWith ( path + "/" ) ) { String resourceName = fName . substring ( ( path + "/" ) . length ( ) ) ; int checkSubdir = resourceName . indexOf ( "/" ) ; if ( checkSubdir >= 0 ) // subdir , trim to subdir name resourceName = resourceName . substring ( 0 , checkSubdir ) ; if ( resourceName . length ( ) > 0 ) resList . add ( resourceName ) ; } } } else { // not a jar , retrieve resource from file system String resourceName ; BufferedReader resources = new BufferedReader ( new InputStreamReader ( JarHash . class . getResourceAsStream ( "/gaid" ) ) ) ; if ( resources != null ) { while ( ( resourceName = resources . readLine ( ) ) != null ) if ( resourceName . length ( ) > 0 ) resList . add ( resourceName ) ; } } } catch ( Exception ignore ) { Log . debug ( "Failed in reading gaid resources." ) ; } return new ArrayList < > ( resList ) ;
public class V1JsExprTranslator { /** * Helper function to translate a variable or data reference . * < p > Examples : * < pre > * $ boo - - > opt _ data . boo ( var ref ) * < / pre > * @ param variableMappings The current replacement JS expressions for the local variables ( and * foreach - loop special functions ) current in scope . * @ param matcher Matcher formed from { @ link V1JsExprTranslator # VAR _ OR _ REF } . * @ return Generated translation for the variable or data reference . */ private static String translateVar ( SoyToJsVariableMappings variableMappings , Matcher matcher ) { } }
Preconditions . checkArgument ( matcher . matches ( ) ) ; String firstPart = matcher . group ( 1 ) ; StringBuilder exprTextSb = new StringBuilder ( ) ; // - - - - - Translate the first key , which may be a variable or a data key - - - - - String translation = getLocalVarTranslation ( firstPart , variableMappings ) ; if ( translation != null ) { // Case 1 : In - scope local var . exprTextSb . append ( translation ) ; } else { // Case 2 : Data reference . exprTextSb . append ( "opt_data." ) . append ( firstPart ) ; } return exprTextSb . toString ( ) ;
public class ProbeHandlerThread { /** * If the probe yields responses from the handler , then send this method will * send the responses to the given respondTo addresses . * @ param respondToURL - address to send the response to * @ param payloadType - JSON or XML * @ param payload - the actual service records to return * @ return true if the send was successful */ private boolean sendResponse ( String respondToURL , String payloadType , ResponseWrapper payload ) { } }
// This method will likely need some thought and care in the error handling // and error reporting // It ' s a had job at the moment . String responseStr = null ; String contentType = null ; // MIME type boolean success = true ; switch ( payloadType ) { case "XML" : { responseStr = payload . toXML ( ) ; contentType = "application/xml" ; break ; } case "JSON" : { responseStr = payload . toJSON ( ) ; contentType = "application/json" ; break ; } default : responseStr = payload . toJSON ( ) ; } try { HttpPost postRequest = new HttpPost ( respondToURL ) ; StringEntity input = new StringEntity ( responseStr ) ; input . setContentType ( contentType ) ; postRequest . setEntity ( input ) ; LOGGER . debug ( "Sending response" ) ; LOGGER . debug ( "Response payload:" ) ; LOGGER . debug ( responseStr ) ; CloseableHttpResponse httpResponse = httpClient . execute ( postRequest ) ; try { int statusCode = httpResponse . getStatusLine ( ) . getStatusCode ( ) ; if ( statusCode > 300 ) { throw new RuntimeException ( "Failed : HTTP error code : " + httpResponse . getStatusLine ( ) . getStatusCode ( ) ) ; } if ( statusCode != 204 ) { BufferedReader br = new BufferedReader ( new InputStreamReader ( ( httpResponse . getEntity ( ) . getContent ( ) ) ) ) ; LOGGER . debug ( "Successful response from response target - " + respondToURL ) ; String output ; LOGGER . debug ( "Output from Listener .... \n" ) ; while ( ( output = br . readLine ( ) ) != null ) { LOGGER . debug ( output ) ; } br . close ( ) ; } } finally { httpResponse . close ( ) ; } LOGGER . info ( "Successfully handled probeID: " + probe . getProbeId ( ) + " sending response to: " + respondToURL ) ; } catch ( MalformedURLException e ) { success = false ; LOGGER . error ( "MalformedURLException occured for probeID [" + payload . getProbeID ( ) + "]" + "\nThe respondTo URL was a no good. respondTo URL is: " + respondToURL ) ; } catch ( IOException e ) { success = false ; LOGGER . error ( "An IOException occured for probeID [" + payload . getProbeID ( ) + "]" + " - " + e . getLocalizedMessage ( ) ) ; LOGGER . debug ( "Stack trace for IOException for probeID [" + payload . getProbeID ( ) + "]" , e ) ; } catch ( Exception e ) { success = false ; LOGGER . error ( "Some other error occured for probeID [" + payload . getProbeID ( ) + "]" + ". respondTo URL is: " + respondToURL + " - " + e . getLocalizedMessage ( ) ) ; LOGGER . debug ( "Stack trace for probeID [" + payload . getProbeID ( ) + "]" , e ) ; } return success ;
public class xen_nsvpx_image { /** * < pre > * Use this operation to get NetScaler XVA file . * < / pre > */ public static xen_nsvpx_image [ ] get ( nitro_service client ) throws Exception { } }
xen_nsvpx_image resource = new xen_nsvpx_image ( ) ; resource . validate ( "get" ) ; return ( xen_nsvpx_image [ ] ) resource . get_resources ( client ) ;
public class PdfPageLabels { /** * Adds or replaces a page label . */ public void addPageLabel ( PdfPageLabelFormat format ) { } }
addPageLabel ( format . physicalPage , format . numberStyle , format . prefix , format . logicalPage ) ;
public class LinkedList { /** * Find the previous link before the start link , visible to a transaction , before the unlockPoint . * Caller must be synchronized on LinkedList . * @ param start * the link where the search for the next link is to start , * null implies the tail of the list . * @ param transaction which determines the visibility of Links . null indicates that no transaction * visibility is to be checked . * @ param transactionUnlockPoint which the next link must have been unlocked at * or before . * @ return Link in the list following the start position , as viewed by the transaction . * Returns null if there is none , or the start is deleted . * @ throws ObjectManagerException */ protected Link previousLink ( Link start , Transaction transaction , long transactionUnlockPoint ) throws ObjectManagerException { } }
if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "previousLink" , new Object [ ] { start , transaction , new Long ( transactionUnlockPoint ) } ) ; Token previousToken = null ; Link previousLink = null ; // The link to return . if ( start == null ) { // Start at the tail of the list ? previousToken = tail ; } else if ( start . state == Link . stateRemoved || start . state == Link . stateDeleted ) { // Start in the body of the list , as long as the start point is not already deleted . // Deleted links are no loner part of the list . if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "previousLink" , "returns null" + " start link is deleted" ) ; return null ; } else { // if in body but deleted . previousToken = start . previous ; } // if ( start = = null ) . // Move forward through the ramaining list until we find an element // that is visible to this transaction . searchBackward : while ( previousToken != null ) { previousLink = ( Link ) ( previousToken . getManagedObject ( ) ) ; if ( previousLink . state == Link . stateAdded ) if ( ! previousLink . wasLocked ( transactionUnlockPoint ) ) break searchBackward ; // Transaction may be null , indicaiting sateToBeAdded links are not eligible . if ( previousLink . state == Link . stateToBeAdded && transaction != null && previousLink . lockedBy ( transaction ) ) break searchBackward ; previousToken = previousLink . next ; // Try the folowing link . } // while ( previousToken ! = null ) . if ( previousToken == null ) { // At the start of the list ? if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "nextLink" , "returns null" + " empty list" ) ; return null ; } // ( previousToken = = null ) . if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "previousLink" , new Object [ ] { previousLink } ) ; return previousLink ;
public class BaseOsgiServlet { /** * process an HTML get or post . * @ exception ServletException From inherited class . * @ exception IOException From inherited class . */ public void service ( HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException { } }
boolean fileFound = sendResourceFile ( req , resp ) ; if ( ! fileFound ) resp . sendError ( HttpServletResponse . SC_NOT_FOUND , "File not found" ) ; // super . service ( req , resp ) ;
public class Precedence { /** * Instantiate discrete constraints to force a single VM to migrate after a set of VMs . * @ param vmsBefore the VMs to migrate before the other one { @ see vmAfter } * @ param vmAfter the ( single ) VM to migrate after the others { @ see vmsBefore } * @ return the associated list of constraints */ public static List < Precedence > newPrecedence ( Collection < VM > vmsBefore , VM vmAfter ) { } }
return newPrecedence ( vmsBefore , Collections . singleton ( vmAfter ) ) ;
public class Transformation2D { /** * Sets the transformation to be a flip around the Y axis . Flips the Y * coordinates so that the y0 becomes y1 and vice verse . * @ param y0 * The Y coordinate to flip . * @ param y1 * The Y coordinate to flip to . */ public void setFlipY ( double y0 , double y1 ) { } }
xx = 1 ; xy = 0 ; xd = 0 ; yx = 0 ; yy = - 1 ; yd = y0 + y1 ;
public class CmsResourceInfoTable { /** * Initializes the table . < p > * @ param resources List of resources * @ param user List user */ private void init ( Set < CmsResource > resources , List < CmsUser > user ) { } }
addStyleName ( "o-no-padding" ) ; m_container = new IndexedContainer ( ) ; m_container . addContainerProperty ( PROP_ELEMENT , CmsResourceInfo . class , null ) ; for ( CmsResource res : resources ) { Item item = m_container . addItem ( res ) ; if ( item != null ) { // Item is null if resource is dependency of multiple groups / user to delete item . getItemProperty ( PROP_ELEMENT ) . setValue ( new CmsResourceInfo ( res ) ) ; } } if ( user != null ) { for ( CmsUser us : user ) { Item item = m_container . addItem ( us ) ; if ( item != null ) { // Item is null if User is dependency of multiple groups to delete item . getItemProperty ( PROP_ELEMENT ) . setValue ( new CmsResourceInfo ( us . getSimpleName ( ) , us . getDescription ( ) , new CmsCssIcon ( OpenCmsTheme . ICON_USER ) ) ) ; } } } setColumnHeaderMode ( ColumnHeaderMode . HIDDEN ) ; setContainerDataSource ( m_container ) ; setVisibleColumns ( PROP_ELEMENT ) ;
public class FactoryBackgroundModel { /** * Creates an instance of { @ link BackgroundStationaryGaussian } . * @ param config Configures the background model * @ param imageType Type of input image * @ return new instance of the background model */ public static < T extends ImageBase < T > > BackgroundStationaryGaussian < T > stationaryGaussian ( @ Nonnull ConfigBackgroundGaussian config , ImageType < T > imageType ) { } }
config . checkValidity ( ) ; BackgroundStationaryGaussian < T > ret ; switch ( imageType . getFamily ( ) ) { case GRAY : ret = new BackgroundStationaryGaussian_SB ( config . learnRate , config . threshold , imageType . getImageClass ( ) ) ; break ; case PLANAR : ret = new BackgroundStationaryGaussian_PL ( config . learnRate , config . threshold , imageType ) ; break ; case INTERLEAVED : ret = new BackgroundStationaryGaussian_IL ( config . learnRate , config . threshold , imageType ) ; break ; default : throw new IllegalArgumentException ( "Unknown image type" ) ; } ret . setInitialVariance ( config . initialVariance ) ; ret . setMinimumDifference ( config . minimumDifference ) ; ret . setUnknownValue ( config . unknownValue ) ; return ret ;
public class Solo { /** * Clears edit text for the specified widget * @ param editText - Identifier for the correct widget ( ex : android . widget . EditText @ 409af0b0 ) - Can be found using getViews */ public static void clearEditText ( String editText ) throws Exception { } }
Client . getInstance ( ) . map ( Constants . ROBOTIUM_SOLO , "clearEditText" , editText ) ;
public class LogUniform { /** * Sets the minimum and maximum values for this distribution * @ param min the minimum value , must be positive * @ param max the maximum value , must be larger than { @ code min } */ public void setMinMax ( double min , double max ) { } }
if ( min <= 0 || Double . isNaN ( min ) || Double . isInfinite ( min ) ) throw new IllegalArgumentException ( "min value must be positive, not " + min ) ; else if ( min >= max || Double . isNaN ( max ) || Double . isInfinite ( max ) ) throw new IllegalArgumentException ( "max (" + max + ") must be larger than min (" + min + ")" ) ; this . max = max ; this . min = min ; this . logMax = Math . log ( max ) ; this . logMin = Math . log ( min ) ; this . logDiff = logMax - logMin ; this . diff = max - min ;
public class HelpViewerProxy { /** * Sends a request to the remote viewer . * @ param helpRequest The request to send . * @ param startRemoteViewer If true and the remote viewer is not running , start it . */ private void sendRequest ( InvocationRequest helpRequest , boolean startRemoteViewer ) { } }
this . helpRequest = helpRequest ; if ( helpRequest != null ) { if ( remoteViewerActive ( ) ) { remoteQueue . sendRequest ( helpRequest ) ; this . helpRequest = null ; } else if ( startRemoteViewer ) { startRemoteViewer ( ) ; } else { this . helpRequest = null ; } }
public class ActiveDirectory { private Hashtable < String , Object > setupBasicProperties ( Hashtable < String , Object > env , String providerUrl ) throws NamingException { } }
// set the tracing level if ( tracing ) env . put ( "com.sun.jndi.ldap.trace.ber" , System . err ) ; // always use ldap v3 env . put ( "java.naming.ldap.version" , "3" ) ; // use jndi provider if ( env . get ( Context . INITIAL_CONTEXT_FACTORY ) == null ) env . put ( Context . INITIAL_CONTEXT_FACTORY , DEFAULT_CTX ) ; // usually what we want env . put ( "java.naming.ldap.deleteRDN" , "false" ) ; // follow , ignore , throw env . put ( Context . REFERRAL , referralType ) ; // to handle non - standard binary attributes env . put ( "java.naming.ldap.attributes.binary" , "photo jpegphoto jpegPhoto" ) ; // finding , searching , etc . env . put ( "java.naming.ldap.derefAliases" , aliasType ) ; // no authentication ( may be modified by other code ) env . put ( Context . SECURITY_AUTHENTICATION , "none" ) ; // the ldap url to connect to ; e . g . " ldap : / / foo . com : 389" env . put ( Context . PROVIDER_URL , providerUrl ) ; return env ;
public class UrlsInterface { /** * Lookup the username for the specified User URL . * @ param url * The user profile URL * @ return The username * @ throws FlickrException */ public String lookupUser ( String url ) throws FlickrException { } }
Map < String , Object > parameters = new HashMap < String , Object > ( ) ; parameters . put ( "method" , METHOD_LOOKUP_USER ) ; parameters . put ( "url" , url ) ; Response response = transport . get ( transport . getPath ( ) , parameters , apiKey , sharedSecret ) ; if ( response . isError ( ) ) { throw new FlickrException ( response . getErrorCode ( ) , response . getErrorMessage ( ) ) ; } Element payload = response . getPayload ( ) ; Element groupnameElement = ( Element ) payload . getElementsByTagName ( "username" ) . item ( 0 ) ; return ( ( Text ) groupnameElement . getFirstChild ( ) ) . getData ( ) ;
public class appfwjsoncontenttype { /** * Use this API to fetch appfwjsoncontenttype resources of given names . */ public static appfwjsoncontenttype [ ] get ( nitro_service service , String jsoncontenttypevalue [ ] ) throws Exception { } }
if ( jsoncontenttypevalue != null && jsoncontenttypevalue . length > 0 ) { appfwjsoncontenttype response [ ] = new appfwjsoncontenttype [ jsoncontenttypevalue . length ] ; appfwjsoncontenttype obj [ ] = new appfwjsoncontenttype [ jsoncontenttypevalue . length ] ; for ( int i = 0 ; i < jsoncontenttypevalue . length ; i ++ ) { obj [ i ] = new appfwjsoncontenttype ( ) ; obj [ i ] . set_jsoncontenttypevalue ( jsoncontenttypevalue [ i ] ) ; response [ i ] = ( appfwjsoncontenttype ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ;
public class diff_match_patch { /** * Crush the diff into an encoded string which describes the operations * required to transform text1 into text2 . E . g . = 3 \ t - 2 \ t + ing - > Keep 3 * chars , delete 2 chars , insert ' ing ' . Operations are tab - separated . * Inserted text is escaped using % xx notation . * @ param diffs * Array of Diff objects . * @ return Delta text . */ public String diff_toDelta ( LinkedList < Diff > diffs ) { } }
StringBuilder text = new StringBuilder ( ) ; for ( Diff aDiff : diffs ) { switch ( aDiff . operation ) { case INSERT : try { text . append ( "+" ) . append ( URLEncoder . encode ( aDiff . text , "UTF-8" ) . replace ( '+' , ' ' ) ) . append ( "\t" ) ; } catch ( UnsupportedEncodingException e ) { // Not likely on modern system . throw new Error ( "This system does not support UTF-8." , e ) ; } break ; case DELETE : text . append ( "-" ) . append ( aDiff . text . length ( ) ) . append ( "\t" ) ; break ; case EQUAL : text . append ( "=" ) . append ( aDiff . text . length ( ) ) . append ( "\t" ) ; break ; } } String delta = text . toString ( ) ; if ( delta . length ( ) != 0 ) { // Strip off trailing tab character . delta = delta . substring ( 0 , delta . length ( ) - 1 ) ; delta = unescapeForEncodeUriCompatability ( delta ) ; } return delta ;
public class LogUtils { /** * Logs a string to the console using the source object ' s name as the log tag at the verbose * level . If the source object is null , the default tag ( see { @ link LogUtils # TAG } ) is used . * @ param source The object that generated the log event . * @ param format A format string , see { @ link String # format ( String , Object . . . ) } . * @ param args String formatter arguments . */ public static void v ( Object source , String format , Object ... args ) { } }
log ( source , Log . VERBOSE , format , args ) ;
public class AbstractTraceRegion { /** * Produces trees from a sorted list of locations . If the locations overlap , they ' ll be splitted automatically to * fulfill the contract of invariant of trace regions . */ protected List < AbstractTraceRegion > toInvertedTraceRegions ( List < Pair < ILocationData , AbstractTraceRegion > > locations , SourceRelativeURI myPath ) { } }
List < AbstractTraceRegion > result = Lists . newArrayListWithCapacity ( 2 ) ; TraceRegion current = null ; int currentEndOffset = 0 ; outer : for ( int i = 0 ; i < locations . size ( ) ; i ++ ) { // avoid concurrent modification exceptions Pair < ILocationData , AbstractTraceRegion > nextPair = locations . get ( i ) ; ILocationData nextLocation = nextPair . getFirst ( ) ; if ( nextLocation . getOffset ( ) == nextLocation . getLength ( ) && nextLocation . getOffset ( ) == 0 ) { continue ; } AbstractTraceRegion nextRegion = nextPair . getSecond ( ) ; if ( current != null ) { // equal region - add mapped location if ( current . getMyOffset ( ) == nextLocation . getOffset ( ) && current . getMyLength ( ) == nextLocation . getLength ( ) ) { List < ILocationData > writableLocations = current . getWritableAssociatedLocations ( ) ; ILocationData newData = createLocationData ( nextRegion , myPath ) ; if ( ! writableLocations . contains ( newData ) ) writableLocations . add ( newData ) ; continue outer ; } else { // walk upwards if necessary while ( current != null && currentEndOffset <= nextLocation . getOffset ( ) ) { current = ( TraceRegion ) current . getParent ( ) ; if ( current != null ) currentEndOffset = current . getMyOffset ( ) + current . getMyLength ( ) ; else currentEndOffset = 0 ; } } } if ( current != null ) { int nextOffset = nextLocation . getOffset ( ) ; if ( nextOffset + nextLocation . getLength ( ) <= currentEndOffset ) { current = new TraceRegion ( nextOffset , nextLocation . getLength ( ) , nextLocation . getLineNumber ( ) , nextLocation . getEndLineNumber ( ) , true , createLocationData ( nextRegion , myPath ) , current ) ; currentEndOffset = nextLocation . getOffset ( ) + nextLocation . getLength ( ) ; } else { int nextLength = currentEndOffset - nextOffset ; int nextEndLine = current . getMyEndLineNumber ( ) ; int splittedLength = nextLocation . getLength ( ) - nextLength ; int splittedBeginLine = nextEndLine ; ILocationData splitted = new LocationData ( currentEndOffset , splittedLength , splittedBeginLine , nextLocation . getEndLineNumber ( ) , nextLocation . getSrcRelativePath ( ) ) ; for ( int j = i + 1 ; j < locations . size ( ) && splitted != null ; j ++ ) { ILocationData shiftMe = locations . get ( j ) . getFirst ( ) ; if ( splitted . getOffset ( ) == shiftMe . getOffset ( ) ) { if ( splitted . getLength ( ) > shiftMe . getLength ( ) ) { locations . add ( j , Tuples . create ( splitted , nextRegion ) ) ; splitted = null ; } } else if ( splitted . getOffset ( ) < shiftMe . getOffset ( ) ) { locations . add ( j , Tuples . create ( splitted , nextRegion ) ) ; splitted = null ; } } if ( splitted != null ) { locations . add ( Tuples . create ( splitted , nextRegion ) ) ; } current = new TraceRegion ( nextOffset , nextLength , nextLocation . getLineNumber ( ) , splittedBeginLine , true , createLocationData ( nextRegion , myPath ) , current ) ; currentEndOffset = nextOffset + nextLength ; } } else { current = new TraceRegion ( nextLocation . getOffset ( ) , nextLocation . getLength ( ) , nextLocation . getLineNumber ( ) , nextLocation . getEndLineNumber ( ) , true , createLocationData ( nextRegion , myPath ) , null ) ; currentEndOffset = nextLocation . getOffset ( ) + nextLocation . getLength ( ) ; result . add ( current ) ; } } return result ;
public class ImageArchiveUtil { /** * Read the ( possibly compressed ) image archive stream provided and return the archive manifest . * If there is no manifest found , then null is returned . Incomplete manifests are returned * with as much information parsed as possible . * @ param inputStream * @ return the parsed manifest , or null if none found . * @ throws IOException * @ throws JsonParseException */ public static ImageArchiveManifest readManifest ( InputStream inputStream ) throws IOException , JsonParseException { } }
Map < String , JsonParseException > parseExceptions = new LinkedHashMap < > ( ) ; Map < String , JsonElement > parsedEntries = new LinkedHashMap < > ( ) ; try ( TarArchiveInputStream tarStream = new TarArchiveInputStream ( createUncompressedStream ( inputStream ) ) ) { TarArchiveEntry tarEntry ; Gson gson = new Gson ( ) ; while ( ( tarEntry = tarStream . getNextTarEntry ( ) ) != null ) { if ( tarEntry . isFile ( ) && tarEntry . getName ( ) . endsWith ( ".json" ) ) { try { JsonElement element = gson . fromJson ( new InputStreamReader ( tarStream , StandardCharsets . UTF_8 ) , JsonElement . class ) ; parsedEntries . put ( tarEntry . getName ( ) , element ) ; } catch ( JsonParseException exception ) { parseExceptions . put ( tarEntry . getName ( ) , exception ) ; } } } } JsonElement manifestJson = parsedEntries . get ( MANIFEST_JSON ) ; if ( manifestJson == null ) { JsonParseException parseException = parseExceptions . get ( MANIFEST_JSON ) ; if ( parseException != null ) { throw parseException ; } return null ; } ImageArchiveManifestAdapter manifest = new ImageArchiveManifestAdapter ( manifestJson ) ; for ( ImageArchiveManifestEntry entry : manifest . getEntries ( ) ) { JsonElement entryConfigJson = parsedEntries . get ( entry . getConfig ( ) ) ; if ( entryConfigJson != null && entryConfigJson . isJsonObject ( ) ) { manifest . putConfig ( entry . getConfig ( ) , entryConfigJson . getAsJsonObject ( ) ) ; } } return manifest ;
public class NavigableTextPane { /** * scroll the specified line into view , with a margin of ' margin ' pixels * above and below */ public void scrollLineToVisible ( int line , int margin ) { } }
int maxMargin = ( parentHeight ( ) - 20 ) / 2 ; if ( margin > maxMargin ) { margin = Math . max ( 0 , maxMargin ) ; } scrollLineToVisibleImpl ( line , margin ) ;
public class DataSourceConnectionSupplierImpl { /** * dataSourceNameで指定したデータソースに対するReadOnlyオプションの指定 * @ param dataSourceName データソース名 * @ param readOnly readOnlyを指定する場合は < code > true < / code > */ public void setReadOnly ( final String dataSourceName , final boolean readOnly ) { } }
Map < String , String > props = getConnPropsByDataSourceName ( dataSourceName ) ; props . put ( PROPS_READ_ONLY , Boolean . toString ( readOnly ) ) ;
public class StandardsSubscription { /** * @ param standardsInput * @ return Returns a reference to this object so that method calls can be chained together . */ public StandardsSubscription withStandardsInput ( java . util . Map < String , String > standardsInput ) { } }
setStandardsInput ( standardsInput ) ; return this ;
public class PooledExecutionServiceConfiguration { /** * Adds a new default pool with the provided minimum and maximum . * The default pool will be used by any service requiring threads but not specifying a pool alias . * It is not mandatory to have a default pool . * But without one < i > ALL < / i > services have to specify a pool alias . * @ param alias the pool alias * @ param minSize the minimum size * @ param maxSize the maximum size * @ throws NullPointerException if alias is null * @ throws IllegalArgumentException if another default was configured already or if another pool with the same * alias was configured already */ public void addDefaultPool ( String alias , int minSize , int maxSize ) { } }
if ( alias == null ) { throw new NullPointerException ( "Pool alias cannot be null" ) ; } if ( defaultAlias == null ) { addPool ( alias , minSize , maxSize ) ; defaultAlias = alias ; } else { throw new IllegalArgumentException ( "'" + defaultAlias + "' is already configured as the default pool" ) ; }
public class KiteConnect { /** * Get the profile details of the use . * @ return Profile is a POJO which contains profile related data . * @ throws IOException is thrown when there is connection error . * @ throws KiteException is thrown for all Kite trade related errors . */ public Profile getProfile ( ) throws IOException , KiteException , JSONException { } }
String url = routes . get ( "user.profile" ) ; JSONObject response = new KiteRequestHandler ( proxy ) . getRequest ( url , apiKey , accessToken ) ; return gson . fromJson ( String . valueOf ( response . get ( "data" ) ) , Profile . class ) ;
public class ContinuousDistributions { /** * Calculates probability pi , ai under dirichlet distribution * @ param pi The vector with probabilities . * @ param ai The vector with pseudocounts . * @ return The probability */ public static double dirichletPdf ( double [ ] pi , double [ ] ai ) { } }
double probability = 1.0 ; double sumAi = 0.0 ; double productGammaAi = 1.0 ; double tmp ; int piLength = pi . length ; for ( int i = 0 ; i < piLength ; ++ i ) { tmp = ai [ i ] ; sumAi += tmp ; productGammaAi *= gamma ( tmp ) ; probability *= Math . pow ( pi [ i ] , tmp - 1 ) ; } probability *= gamma ( sumAi ) / productGammaAi ; return probability ;
public class SCSICommandParser { /** * { @ inheritDoc } */ @ Override protected final int serializeBytes1to3 ( ) { } }
int line = 0 ; line |= taskAttributes . value ( ) << Constants . TWO_BYTES_SHIFT ; if ( writeExpectedFlag ) { line |= WRITE_EXPECTED_FLAG_MASK ; } if ( readExpectedFlag ) { line |= READ_EXPECTED_FLAG_MASK ; } return line ;
public class BetaDistribution { /** * Returns the regularized incomplete beta function I _ x ( a , b ) by quadrature , * based on the book " Numerical Recipes " . * @ param alpha Parameter a * @ param beta Parameter b * @ param x Parameter x * @ return result */ protected static double regularizedIncBetaQuadrature ( double alpha , double beta , double x ) { } }
final double alphapbeta = alpha + beta ; final double a1 = alpha - 1.0 ; final double b1 = beta - 1.0 ; final double mu = alpha / alphapbeta ; final double lnmu = FastMath . log ( mu ) ; final double lnmuc = FastMath . log1p ( - mu ) ; double t = FastMath . sqrt ( alpha * beta / ( alphapbeta * alphapbeta * ( alphapbeta + 1.0 ) ) ) ; final double xu ; if ( x > alpha / alphapbeta ) { if ( x >= 1.0 ) { return 1.0 ; } xu = Math . min ( 1.0 , Math . max ( mu + 10.0 * t , x + 5.0 * t ) ) ; } else { if ( x <= 0.0 ) { return 0.0 ; } xu = Math . max ( 0.0 , Math . min ( mu - 10.0 * t , x - 5.0 * t ) ) ; } double sum = 0.0 ; for ( int i = 0 ; i < GAUSSLEGENDRE_Y . length ; i ++ ) { t = x + ( xu - x ) * GAUSSLEGENDRE_Y [ i ] ; sum += GAUSSLEGENDRE_W [ i ] * FastMath . exp ( a1 * ( FastMath . log ( t ) - lnmu ) + b1 * ( FastMath . log1p ( - t ) - lnmuc ) ) ; } double ans = sum * ( xu - x ) * FastMath . exp ( a1 * lnmu - GammaDistribution . logGamma ( alpha ) + b1 * lnmuc - GammaDistribution . logGamma ( beta ) + GammaDistribution . logGamma ( alphapbeta ) ) ; return ans > 0 ? 1.0 - ans : - ans ;
public class JsMessageImpl { /** * Provide the contribution of this part to the estimated encoded length * Subclasses that wish to contribute to a quick guess at the length of a * flattened / encoded message should override this method , invoke their * superclass and add on their own contribution . * @ return int Description of returned value */ int guessApproxLength ( ) { } }
// Make a guess at the contribution of the header . The header size is // reasonably constant , with the exception of the forward / reverse routing // paths . int total = 400 ; // Approx 400 bytes in normal use header fields int size = 0 ; // Only get the FRP list out of the message if it is NOT the singleton empty list // as we don ' t want to spawn a real one unnecessarily if ( getHdr2 ( ) . isNotEMPTYlist ( JsHdr2Access . FORWARDROUTINGPATH_DESTINATIONNAME ) ) { List frp = ( List ) getHdr2 ( ) . getField ( JsHdr2Access . FORWARDROUTINGPATH_DESTINATIONNAME ) ; if ( frp != null ) size += frp . size ( ) ; } // Only get the RRP list out of the message if it is NOT the singleton empty list // as we don ' t want to spawn a real one unnecessarily if ( getHdr2 ( ) . isNotEMPTYlist ( JsHdr2Access . REVERSEROUTINGPATH_DESTINATIONNAME ) ) { List rrp = ( List ) getHdr2 ( ) . getField ( JsHdr2Access . REVERSEROUTINGPATH_DESTINATIONNAME ) ; if ( rrp != null ) size += rrp . size ( ) ; } // Assume about 50 bytes per routing path entry ( 2 strings + UUID ) if ( size > 0 ) { total += size * 50 ; } // Add on the contents of the first slice of a flattened message ( i . e . classname , // Schema ids , etc ) total += 77 ; return total ;
public class QueryRpc { /** * Parses the " rate " section of the query string and returns an instance * of the RateOptions class that contains the values found . * The format of the rate specification is rate [ { counter [ , # [ , # ] ] } ] . * @ param rate If true , then the query is set as a rate query and the rate * specification will be parsed . If false , a default RateOptions instance * will be returned and largely ignored by the rest of the processing * @ param spec The part of the query string that pertains to the rate * @ return An initialized RateOptions instance based on the specification * @ throws BadRequestException if the parameter is malformed * @ since 2.0 */ static final public RateOptions parseRateOptions ( final boolean rate , final String spec ) { } }
if ( ! rate || spec . length ( ) == 4 ) { return new RateOptions ( false , Long . MAX_VALUE , RateOptions . DEFAULT_RESET_VALUE ) ; } if ( spec . length ( ) < 6 ) { throw new BadRequestException ( "Invalid rate options specification: " + spec ) ; } String [ ] parts = Tags . splitString ( spec . substring ( 5 , spec . length ( ) - 1 ) , ',' ) ; if ( parts . length < 1 || parts . length > 3 ) { throw new BadRequestException ( "Incorrect number of values in rate options specification, must be " + "counter[,counter max value,reset value], recieved: " + parts . length + " parts" ) ; } final boolean counter = parts [ 0 ] . endsWith ( "counter" ) ; try { final long max = ( parts . length >= 2 && parts [ 1 ] . length ( ) > 0 ? Long . parseLong ( parts [ 1 ] ) : Long . MAX_VALUE ) ; try { final long reset = ( parts . length >= 3 && parts [ 2 ] . length ( ) > 0 ? Long . parseLong ( parts [ 2 ] ) : RateOptions . DEFAULT_RESET_VALUE ) ; final boolean drop_counter = parts [ 0 ] . equals ( "dropcounter" ) ; return new RateOptions ( counter , max , reset , drop_counter ) ; } catch ( NumberFormatException e ) { throw new BadRequestException ( "Reset value of counter was not a number, received '" + parts [ 2 ] + "'" ) ; } } catch ( NumberFormatException e ) { throw new BadRequestException ( "Max value of counter was not a number, received '" + parts [ 1 ] + "'" ) ; }
public class MonitoringProxyActivator { /** * Create a jar file that contains the proxy code that will live in the * boot delegation package . * @ return the jar file containing the proxy code to append to the boot * class path * @ throws IOException if a file I / O error occurs */ JarFile createBootProxyJar ( ) throws IOException { } }
File dataFile = bundleContext . getDataFile ( "boot-proxy.jar" ) ; // Create the file if it doesn ' t already exist if ( ! dataFile . exists ( ) ) { dataFile . createNewFile ( ) ; } // Generate a manifest Manifest manifest = createBootJarManifest ( ) ; // Create the file FileOutputStream fileOutputStream = new FileOutputStream ( dataFile , false ) ; JarOutputStream jarOutputStream = new JarOutputStream ( fileOutputStream , manifest ) ; // Add the jar path entries to reduce class load times createDirectoryEntries ( jarOutputStream , BOOT_DELEGATED_PACKAGE ) ; // Map the template classes into the delegation package and add to the jar Bundle bundle = bundleContext . getBundle ( ) ; Enumeration < ? > entryPaths = bundle . getEntryPaths ( TEMPLATE_CLASSES_PATH ) ; if ( entryPaths != null ) { while ( entryPaths . hasMoreElements ( ) ) { URL sourceClassResource = bundle . getEntry ( ( String ) entryPaths . nextElement ( ) ) ; if ( sourceClassResource != null ) writeRemappedClass ( sourceClassResource , jarOutputStream , BOOT_DELEGATED_PACKAGE ) ; } } jarOutputStream . close ( ) ; fileOutputStream . close ( ) ; return new JarFile ( dataFile ) ;
public class SessionDataManager { /** * Returns true if the item with < code > identifier < / code > was deleted in this session . Within a transaction , * isDelete on an Item may return false ( because the item has been saved ) even if that Item is not in * persistent storage ( because the transaction has not yet been committed ) . * @ param identifier * of the item * @ return boolean , true if the item was deleted */ public boolean isDeleted ( String identifier ) { } }
ItemState lastState = changesLog . getItemState ( identifier ) ; if ( lastState != null && lastState . isDeleted ( ) ) { return true ; } return false ;
public class TransactionOutput { /** * Returns a copy of the output detached from its containing transaction , if need be . */ public TransactionOutput duplicateDetached ( ) { } }
return new TransactionOutput ( params , null , Coin . valueOf ( value ) , Arrays . copyOf ( scriptBytes , scriptBytes . length ) ) ;
public class AtomContainerDiscretePartitionRefinerImpl { /** * Gets the automorphism group of the atom container . By default it uses an * initial partition based on the element symbols ( so all the carbons are in * one cell , all the nitrogens in another , etc ) . If this behaviour is not * desired , then use the { @ link # ignoreElements } flag in the constructor . * @ param atomContainer the atom container to use * @ return the automorphism group of the atom container */ public PermutationGroup getAutomorphismGroup ( IAtomContainer atomContainer ) { } }
setup ( atomContainer ) ; super . refine ( refinable . getInitialPartition ( ) ) ; return super . getAutomorphismGroup ( ) ;
public class MessageServiceConfigProcessor { /** * Tries to find a sensible default AMF channel for the default MessageService * If a application - level default is set on the MessageBroker , that will be used . Otherwise will use the first * AMFEndpoint from services - config . xml that it finds with polling enabled . * @ param broker * @ param service */ @ Override public void findDefaultChannel ( MessageBroker broker , Service service ) { } }
if ( ! CollectionUtils . isEmpty ( broker . getDefaultChannels ( ) ) ) { return ; } Iterator < String > channels = broker . getChannelIds ( ) . iterator ( ) ; while ( channels . hasNext ( ) ) { Endpoint endpoint = broker . getEndpoint ( channels . next ( ) ) ; if ( endpoint instanceof AMFEndpoint && isPollingEnabled ( endpoint ) ) { service . addDefaultChannel ( endpoint . getId ( ) ) ; return ; } } log . warn ( "No appropriate default channels were detected for the MessageService. " + "The channels must be explicitly set on any exported service." ) ;
public class ParameterValueImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case BpsimPackage . PARAMETER_VALUE__INSTANCE : return INSTANCE_EDEFAULT == null ? instance != null : ! INSTANCE_EDEFAULT . equals ( instance ) ; case BpsimPackage . PARAMETER_VALUE__RESULT : return isSetResult ( ) ; case BpsimPackage . PARAMETER_VALUE__VALID_FOR : return VALID_FOR_EDEFAULT == null ? validFor != null : ! VALID_FOR_EDEFAULT . equals ( validFor ) ; } return super . eIsSet ( featureID ) ;
public class InstanceFleetStateChangeReasonMarshaller { /** * Marshall the given parameter object . */ public void marshall ( InstanceFleetStateChangeReason instanceFleetStateChangeReason , ProtocolMarshaller protocolMarshaller ) { } }
if ( instanceFleetStateChangeReason == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( instanceFleetStateChangeReason . getCode ( ) , CODE_BINDING ) ; protocolMarshaller . marshall ( instanceFleetStateChangeReason . getMessage ( ) , MESSAGE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class QueryFactory { /** * Method declaration * @ param classToSearchFrom * @ param criteria * @ param distinct * @ return QueryByCriteria */ public static QueryByCriteria newQuery ( Class classToSearchFrom , Criteria criteria , boolean distinct ) { } }
criteria = addCriteriaForOjbConcreteClasses ( getRepository ( ) . getDescriptorFor ( classToSearchFrom ) , criteria ) ; return new QueryByCriteria ( classToSearchFrom , criteria , distinct ) ;
public class Bootstrap { /** * Delegate method for { @ link ServiceProvider # getServices ( Class ) } . * @ param serviceType the service type . * @ return the service found , or { @ code null } . * @ see ServiceProvider # getServices ( Class ) */ public static < T > T getService ( Class < T > serviceType ) { } }
List < T > services = getServiceProvider ( ) . getServices ( serviceType ) ; return services . stream ( ) . findFirst ( ) . orElse ( null ) ;
public class TypicalLoginAssist { /** * Save login info as user bean to session . * @ param userEntity The entity of the found user . ( NotNull ) * @ return The user bean saved in session . ( NotNull ) */ protected USER_BEAN saveLoginInfoToSession ( USER_ENTITY userEntity ) { } }
regenerateSessionId ( ) ; logger . debug ( "...Saving login info to session" ) ; final USER_BEAN userBean = createUserBean ( userEntity ) ; sessionManager . setAttribute ( getUserBeanKey ( ) , userBean ) ; return userBean ;
public class PerformanceCollector { /** * Start measurement of user and cpu time . * @ param label description of code block between startTiming and * stopTiming , used to label output */ public void startTiming ( String label ) { } }
if ( mPerfWriter != null ) mPerfWriter . writeStartTiming ( label ) ; mPerfMeasurement = new Bundle ( ) ; mPerfMeasurement . putParcelableArrayList ( METRIC_KEY_ITERATIONS , new ArrayList < Parcelable > ( ) ) ; mExecTime = SystemClock . uptimeMillis ( ) ; mCpuTime = Process . getElapsedCpuTime ( ) ;
public class DeviceAppearanceImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . DEVICE_APPEARANCE__DEV_APP : return getDevApp ( ) ; case AfplibPackage . DEVICE_APPEARANCE__RESERVED : return getReserved ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class Gen { /** * Derived visitor method : check whether CharacterRangeTable * should be emitted , if so , put a new entry into CRTable * and call method to generate bytecode . * If not , just call method to generate bytecode . * @ see # genStat ( JCTree , Env ) * @ param tree The tree to be visited . * @ param env The environment to use . * @ param crtFlags The CharacterRangeTable flags * indicating type of the entry . */ public void genStat ( JCTree tree , Env < GenContext > env , int crtFlags ) { } }
if ( ! genCrt ) { genStat ( tree , env ) ; return ; } int startpc = code . curCP ( ) ; genStat ( tree , env ) ; if ( tree . hasTag ( Tag . BLOCK ) ) crtFlags |= CRT_BLOCK ; code . crt . put ( tree , crtFlags , startpc , code . curCP ( ) ) ;
public class AbstractDirector { /** * Checks if installResources contains any resources * @ param installResources the list of lists containing Install Resources * @ return true if all lists are empty */ boolean isEmpty ( List < List < RepositoryResource > > installResources ) { } }
if ( installResources == null ) return true ; for ( List < RepositoryResource > mrList : installResources ) { if ( ! mrList . isEmpty ( ) ) return false ; } return true ;
public class AbstractMinMaxTextBox { /** * set distance value should be increased / decreased when using up / down buttons . * @ param pstep step distance */ public void setStep ( final String pstep ) { } }
try { this . setStep ( Integer . valueOf ( pstep ) ) ; } catch ( final NumberFormatException e ) { this . setStep ( ( Integer ) null ) ; }
public class PortComponentType { /** * { @ inheritDoc } */ @ Override public boolean handleChild ( DDParser parser , String localName ) throws ParseException { } }
if ( "description" . equals ( localName ) ) { DescriptionType description = new DescriptionType ( ) ; parser . parse ( description ) ; this . description = description ; return true ; } if ( "display-name" . equals ( localName ) ) { DisplayNameType display_name = new DisplayNameType ( ) ; parser . parse ( display_name ) ; this . display_name = display_name ; return true ; } if ( "icon" . equals ( localName ) ) { IconType icon = new IconType ( ) ; parser . parse ( icon ) ; this . icon = icon ; return true ; } if ( "port-component-name" . equals ( localName ) ) { parser . parse ( port_component_name ) ; return true ; } if ( "wsdl-service" . equals ( localName ) ) { XSDQNameType wsdl_service = new XSDQNameType ( ) ; parser . parse ( wsdl_service ) ; wsdl_service . resolve ( parser ) ; this . wsdl_service = wsdl_service ; return true ; } if ( "wsdl-port" . equals ( localName ) ) { XSDQNameType wsdl_port = new XSDQNameType ( ) ; parser . parse ( wsdl_port ) ; wsdl_port . resolve ( parser ) ; this . wsdl_port = wsdl_port ; return true ; } if ( "enable-mtom" . equals ( localName ) ) { XSDBooleanType enable_mtom = new XSDBooleanType ( ) ; parser . parse ( enable_mtom ) ; this . enable_mtom = enable_mtom ; return true ; } if ( "mtom-threshold" . equals ( localName ) ) { XSDIntegerType mtom_threshold = new XSDIntegerType ( ) ; parser . parse ( mtom_threshold ) ; this . mtom_threshold = mtom_threshold ; return true ; } if ( "addressing" . equals ( localName ) ) { AddressingType addressing = new AddressingType ( ) ; parser . parse ( addressing ) ; this . addressing = addressing ; return true ; } if ( "respect-binding" . equals ( localName ) ) { RespectBindingType respect_binding = new RespectBindingType ( ) ; parser . parse ( respect_binding ) ; this . respect_binding = respect_binding ; return true ; } if ( "protocol-binding" . equals ( localName ) ) { TokenType protocol_binding = new TokenType ( ) ; parser . parse ( protocol_binding ) ; this . protocol_binding = protocol_binding ; return true ; } if ( "service-endpoint-interface" . equals ( localName ) ) { XSDTokenType service_endpoint_interface = new XSDTokenType ( ) ; parser . parse ( service_endpoint_interface ) ; this . service_endpoint_interface = service_endpoint_interface ; return true ; } if ( "service-impl-bean" . equals ( localName ) ) { parser . parse ( service_impl_bean ) ; return true ; } if ( "handler" . equals ( localName ) ) { HandlerType handler = new HandlerType ( ) ; parser . parse ( handler ) ; addHandler ( handler ) ; return true ; } if ( "handler-chains" . equals ( localName ) ) { HandlerChainsType handler_chains = new HandlerChainsType ( ) ; parser . parse ( handler_chains ) ; this . handler_chains = handler_chains ; return true ; } return false ;
public class HttpMethodBase { /** * Returns the specified request header . Note that header - name matching is * case insensitive . < tt > null < / tt > will be returned if either * < i > headerName < / i > is < tt > null < / tt > or there is no matching header for * < i > headerName < / i > . * @ param headerName The name of the header to be returned . * @ return The specified request header . * @ since 3.0 */ @ Override public Header getRequestHeader ( String headerName ) { } }
if ( headerName == null ) { return null ; } else { return getRequestHeaderGroup ( ) . getCondensedHeader ( headerName ) ; }
public class GroupVersionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GroupVersion groupVersion , ProtocolMarshaller protocolMarshaller ) { } }
if ( groupVersion == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( groupVersion . getConnectorDefinitionVersionArn ( ) , CONNECTORDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getCoreDefinitionVersionArn ( ) , COREDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getDeviceDefinitionVersionArn ( ) , DEVICEDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getFunctionDefinitionVersionArn ( ) , FUNCTIONDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getLoggerDefinitionVersionArn ( ) , LOGGERDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getResourceDefinitionVersionArn ( ) , RESOURCEDEFINITIONVERSIONARN_BINDING ) ; protocolMarshaller . marshall ( groupVersion . getSubscriptionDefinitionVersionArn ( ) , SUBSCRIPTIONDEFINITIONVERSIONARN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class GraphObjectModificationState { /** * Update * node * changelog for Verb . link */ public void updateChangeLog ( final Principal user , final Verb verb , final String linkType , final String linkId , final String object , final Direction direction ) { } }
if ( Settings . ChangelogEnabled . getValue ( ) ) { final JsonObject obj = new JsonObject ( ) ; obj . add ( "time" , toElement ( System . currentTimeMillis ( ) ) ) ; obj . add ( "userId" , toElement ( user . getUuid ( ) ) ) ; obj . add ( "userName" , toElement ( user . getName ( ) ) ) ; obj . add ( "verb" , toElement ( verb ) ) ; obj . add ( "rel" , toElement ( linkType ) ) ; obj . add ( "relId" , toElement ( linkId ) ) ; obj . add ( "relDir" , toElement ( direction ) ) ; obj . add ( "target" , toElement ( object ) ) ; changeLog . append ( obj . toString ( ) ) ; changeLog . append ( "\n" ) ; }
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 * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < ServiceResponse < Void > > renameWithServiceResponseAsync ( String resourceGroupName , String serverName , String databaseName , String id ) { } }
if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( serverName == null ) { throw new IllegalArgumentException ( "Parameter serverName is required and cannot be null." ) ; } if ( databaseName == null ) { throw new IllegalArgumentException ( "Parameter databaseName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } if ( id == null ) { throw new IllegalArgumentException ( "Parameter id is required and cannot be null." ) ; } ResourceMoveDefinition parameters = new ResourceMoveDefinition ( ) ; parameters . withId ( id ) ; return service . rename ( resourceGroupName , serverName , databaseName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , parameters , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Void > > > ( ) { @ Override public Observable < ServiceResponse < Void > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Void > clientResponse = renameDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class ResolveStageBaseImpl { /** * { @ inheritDoc } * @ see org . jboss . shrinkwrap . resolver . api . ResolveStage # addDependencies ( Coordinate [ ] ) */ @ Override public final RESOLVESTAGETYPE addDependencies ( final MavenDependency ... dependencies ) throws IllegalArgumentException { } }
if ( dependencies == null || dependencies . length == 0 ) { throw new IllegalArgumentException ( "At least one coordinate must be specified" ) ; } for ( final MavenDependency dependency : dependencies ) { if ( dependency == null ) { throw new IllegalArgumentException ( "null dependency not permitted" ) ; } final MavenDependency resolved = this . resolveDependency ( dependency ) ; this . session . getDependenciesForResolution ( ) . add ( resolved ) ; } return this . covarientReturn ( ) ;
public class AbstractModelControllerClient { /** * Execute a request . * @ param executionContext the execution context * @ return the future result * @ throws IOException */ private AsyncFuture < OperationResponse > execute ( final OperationExecutionContext executionContext ) throws IOException { } }
return executeRequest ( new AbstractManagementRequest < OperationResponse , OperationExecutionContext > ( ) { @ Override public byte getOperationType ( ) { return ModelControllerProtocol . EXECUTE_ASYNC_CLIENT_REQUEST ; } @ Override protected void sendRequest ( final ActiveOperation . ResultHandler < OperationResponse > resultHandler , final ManagementRequestContext < OperationExecutionContext > context , final FlushableDataOutput output ) throws IOException { // Write the operation final List < InputStream > streams = executionContext . operation . getInputStreams ( ) ; final ModelNode operation = executionContext . operation . getOperation ( ) ; int inputStreamLength = 0 ; if ( streams != null ) { inputStreamLength = streams . size ( ) ; } output . write ( ModelControllerProtocol . PARAM_OPERATION ) ; operation . writeExternal ( output ) ; output . write ( ModelControllerProtocol . PARAM_INPUTSTREAMS_LENGTH ) ; output . writeInt ( inputStreamLength ) ; } @ Override public void handleRequest ( final DataInput input , final ActiveOperation . ResultHandler < OperationResponse > resultHandler , final ManagementRequestContext < OperationExecutionContext > context ) throws IOException { expectHeader ( input , ModelControllerProtocol . PARAM_RESPONSE ) ; final ModelNode node = new ModelNode ( ) ; node . readExternal ( input ) ; resultHandler . done ( getOperationResponse ( node , context . getOperationId ( ) ) ) ; expectHeader ( input , ManagementProtocol . RESPONSE_END ) ; } } , executionContext ) ;
public class JSDocInfoBuilder { /** * Records a visibility . * @ return { @ code true } if the visibility was recorded and { @ code false } * if it was already defined */ public boolean recordVisibility ( Visibility visibility ) { } }
if ( currentInfo . getVisibility ( ) == null ) { populated = true ; currentInfo . setVisibility ( visibility ) ; return true ; } else { return false ; }
public class BFNImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . BFN__RS_NAME : setRSName ( RS_NAME_EDEFAULT ) ; return ; case AfplibPackage . BFN__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class Parser { private void assembleDissectorPhases ( ) throws InvalidDissectorException { } }
for ( final Dissector dissector : allDissectors ) { final String inputType = dissector . getInputType ( ) ; if ( inputType == null ) { throw new InvalidDissectorException ( "Dissector returns null on getInputType(): [" + dissector . getClass ( ) . getCanonicalName ( ) + "]" ) ; } final List < String > outputs = dissector . getPossibleOutput ( ) ; if ( outputs == null || outputs . isEmpty ( ) ) { throw new InvalidDissectorException ( "Dissector cannot create any outputs: [" + dissector . getClass ( ) . getCanonicalName ( ) + "]" ) ; } // Create all dissector phases for ( final String output : outputs ) { final int colonPos = output . indexOf ( ':' ) ; final String outputType = output . substring ( 0 , colonPos ) ; final String name = output . substring ( colonPos + 1 ) ; availableDissectors . add ( new DissectorPhase ( inputType , outputType , name , dissector ) ) ; } }
public class WriteRequestCommand { /** * < pre > * Cancel , close and error will be handled by standard gRPC stream APIs . * < / pre > * < code > optional . alluxio . proto . dataserver . CreateUfsFileOptions create _ ufs _ file _ options = 6 ; < / code > */ public alluxio . proto . dataserver . Protocol . CreateUfsFileOptionsOrBuilder getCreateUfsFileOptionsOrBuilder ( ) { } }
return createUfsFileOptions_ == null ? alluxio . proto . dataserver . Protocol . CreateUfsFileOptions . getDefaultInstance ( ) : createUfsFileOptions_ ;
public class RestRepository { /** * consume the scroll */ Scroll scroll ( String scrollId , ScrollReader reader ) throws IOException { } }
InputStream scroll = client . scroll ( scrollId ) ; try { return reader . read ( scroll ) ; } finally { if ( scroll instanceof StatsAware ) { stats . aggregate ( ( ( StatsAware ) scroll ) . stats ( ) ) ; } }
public class ClusterTierManagerClientEntityFactory { /** * Attempts to create and configure the { @ code EhcacheActiveEntity } in the Ehcache clustered server . * @ param identifier the instance identifier for the { @ code EhcacheActiveEntity } * @ param config the { @ code EhcacheActiveEntity } configuration to use for creation * @ throws EntityAlreadyExistsException if the { @ code EhcacheActiveEntity } for { @ code identifier } already exists * @ throws ClusterTierManagerCreationException if an error preventing { @ code EhcacheActiveEntity } creation was raised * @ throws EntityBusyException if another client holding operational leadership prevented this client * from becoming leader and creating the { @ code EhcacheActiveEntity } instance */ public void create ( final String identifier , final ServerSideConfiguration config ) throws EntityAlreadyExistsException , ClusterTierManagerCreationException , EntityBusyException { } }
Hold existingMaintenance = maintenanceHolds . get ( identifier ) ; try ( Hold localMaintenance = ( existingMaintenance == null ? createAccessLockFor ( identifier ) . tryWriteLock ( ) : null ) ) { if ( localMaintenance == null && existingMaintenance == null ) { throw new EntityBusyException ( "Unable to obtain maintenance lease for " + identifier ) ; } EntityRef < ClusterTierManagerClientEntity , ClusterTierManagerConfiguration , ClusterTierUserData > ref = getEntityRef ( identifier ) ; try { ref . create ( new ClusterTierManagerConfiguration ( identifier , config ) ) ; } catch ( EntityConfigurationException e ) { throw new ClusterTierManagerCreationException ( "Unable to configure cluster tier manager for id " + identifier , e ) ; } catch ( EntityNotProvidedException | EntityVersionMismatchException e ) { LOGGER . error ( "Unable to create cluster tier manager for id {}" , identifier , e ) ; throw new AssertionError ( e ) ; } }
public class ServiceEngine { /** * Note : The caller must lock the specified ServiceContext ! */ protected Object internalSearchAndInvokeWithBlocking ( AbstractServiceContext context , String mName , String mDescriptor , Object [ ] arguments ) throws Exception { } }
// FIXME : reuse providers already looked - up ! long timeout = context . getTimeout ( ) ; long searchStart = System . currentTimeMillis ( ) ; Synchroniser sync = new Synchroniser ( ) ; final String serviceName = context . serviceClass . getName ( ) ; synchronized ( sync ) { // wait at most one third of the timeout for search responses _requestProtocol . broadcastRequest ( SEARCH , serviceName , SEARCH_GROUP , timeout / 3 , sync ) ; sync . wait ( timeout ) ; } if ( sync . source == null || sync . content == null || ! serviceName . equals ( sync . content ) ) { throw new RuntimeException ( "service unavailable: '" + serviceName + "'" ) ; } String providerAddress = sync . source ; sync . source = null ; sync . content = null ; timeout -= ( System . currentTimeMillis ( ) - searchStart ) ; if ( timeout <= 0 ) { throw new RuntimeException ( "no time to invoke service: '" + serviceName + "'" ) ; } synchronized ( sync ) { ServiceInvocation invocation = new ServiceInvocation ( serviceName , mName , mDescriptor , arguments ) ; _requestProtocol . request ( INVOKE , invocation , providerAddress , timeout , sync ) ; sync . wait ( timeout ) ; } if ( sync . content == null ) { throw new RuntimeException ( "service invocation timed out: " + serviceName + "'" ) ; } return ( ( ServiceInvocation ) sync . content ) . result ;
public class BeliefPropagation { /** * Computes the product of all messages being sent to a node , optionally excluding messages sent * from another node or two . * Upon completion , prod will be multiplied by the product of all incoming messages to node , * except for the message from exclNode1 / exclNode2 if specified . * @ param node The node to which all the messages are being sent . * @ param prod An input / output tensor with which the product will ( destructively ) be taken . * @ param exclNode1 If non - null , any message sent from exclNode1 to node will be excluded from * the product . * @ param exclNode2 If non - null , any message sent from exclNode2 to node will be excluded from * the product . */ private void calcProductAtVar ( int v , VarTensor prod , int excl1 , int excl2 ) { } }
for ( int nb = 0 ; nb < bg . numNbsT1 ( v ) ; nb ++ ) { if ( nb == excl1 || nb == excl2 ) { // Don ' t include messages to these neighbors . continue ; } // Get message from neighbor to this node . VarTensor nbMsg = msgs [ bg . opposingT1 ( v , nb ) ] ; // Since the node is a variable , this is an element - wise product . prod . elemMultiply ( nbMsg ) ; }
public class ProxyTask { /** * Get the next ( String ) param . * @ param strName The param name ( in most implementations this is optional ) . * @ param properties The temporary remote session properties * @ return The next param as a string . */ public Object getNextObjectParam ( InputStream in , String strName , Map < String , Object > properties ) { } }
String strParam = this . getNextStringParam ( in , strName , properties ) ; strParam = Base64 . decode ( strParam ) ; return org . jbundle . thin . base . remote . proxy . transport . BaseTransport . convertStringToObject ( strParam ) ;
public class ConfigureForm { /** * Sets the node type . * @ param type The node type */ public void setNodeType ( NodeType type ) { } }
addField ( ConfigureNodeFields . node_type , FormField . Type . list_single ) ; setAnswer ( ConfigureNodeFields . node_type . getFieldName ( ) , getListSingle ( type . toString ( ) ) ) ;
public class Parser { /** * Decides if it ' s possible to format provided Strings into calculated number of columns while the output will not exceed * terminal width * @ param displayList * @ param numRows * @ param terminalWidth * @ return true if it ' s possible to format strings to columns and false otherwise . */ private static boolean canDisplayColumns ( List < TerminalString > displayList , int numRows , int terminalWidth ) { } }
int numColumns = displayList . size ( ) / numRows ; if ( displayList . size ( ) % numRows > 0 ) { numColumns ++ ; } int [ ] columnSizes = calculateColumnSizes ( displayList , numColumns , numRows , terminalWidth ) ; int totalSize = 0 ; for ( int columnSize : columnSizes ) { totalSize += columnSize ; } return totalSize <= terminalWidth ;
public class NotifierImpl { /** * { @ inheritDoc } */ @ Override public boolean removeListener ( NotificationListener listenerToRemove ) { } }
// Get the listener that is registered with the delegate and remove it ArtifactListener delegateListener = this . listenerDelegates . remove ( listenerToRemove ) ; return this . delegateNotifier . removeListener ( delegateListener ) ;
public class ModifyFpgaImageAttributeRequest { /** * The AWS account IDs . This parameter is valid only when modifying the < code > loadPermission < / code > attribute . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setUserIds ( java . util . Collection ) } or { @ link # withUserIds ( java . util . Collection ) } if you want to override * the existing values . * @ param userIds * The AWS account IDs . This parameter is valid only when modifying the < code > loadPermission < / code > * attribute . * @ return Returns a reference to this object so that method calls can be chained together . */ public ModifyFpgaImageAttributeRequest withUserIds ( String ... userIds ) { } }
if ( this . userIds == null ) { setUserIds ( new com . amazonaws . internal . SdkInternalList < String > ( userIds . length ) ) ; } for ( String ele : userIds ) { this . userIds . add ( ele ) ; } return this ;
public class ArrayMatrix { /** * { @ inheritDoc } */ public void setColumn ( int column , DoubleVector values ) { } }
checkIndices ( values . length ( ) - 1 , column ) ; for ( int row = 0 ; row < rows ; ++ row ) matrix [ getIndex ( row , column ) ] = values . get ( row ) ;
public class Options { /** * Returns the JavaScript statement corresponding to options . */ public CharSequence getJavaScriptOptions ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; this . optionsRenderer . renderBefore ( sb ) ; int count = 0 ; for ( Entry < String , Object > entry : options . entrySet ( ) ) { String key = entry . getKey ( ) ; Object value = entry . getValue ( ) ; if ( value instanceof IModelOption < ? > ) value = ( ( IModelOption < ? > ) value ) . wrapOnAssignment ( owner ) ; boolean isLast = ! ( count < options . size ( ) - 1 ) ; if ( value instanceof JsScope ) { // Case of a JsScope sb . append ( this . optionsRenderer . renderOption ( key , ( ( JsScope ) value ) . render ( ) , isLast ) ) ; } else if ( value instanceof ICollectionItemOptions ) { // Case of an ICollectionItemOptions sb . append ( this . optionsRenderer . renderOption ( key , ( ( ICollectionItemOptions ) value ) . getJavascriptOption ( ) , isLast ) ) ; } else if ( value instanceof IComplexOption ) { // Case of an IComplexOption sb . append ( this . optionsRenderer . renderOption ( key , ( ( IComplexOption ) value ) . getJavascriptOption ( ) , isLast ) ) ; } else if ( value instanceof ITypedOption < ? > ) { // Case of an ITypedOption sb . append ( this . optionsRenderer . renderOption ( key , ( ( ITypedOption < ? > ) value ) . getJavascriptOption ( ) , isLast ) ) ; } else { // Other cases sb . append ( this . optionsRenderer . renderOption ( key , value , isLast ) ) ; } count ++ ; } this . optionsRenderer . renderAfter ( sb ) ; return sb ;
public class LeafNode { /** * Purges the node of all items . * < p > Note : Some implementations may keep the last item * sent . * @ throws XMPPErrorException * @ throws NoResponseException if there was no response from the server . * @ throws NotConnectedException * @ throws InterruptedException */ public void deleteAllItems ( ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
PubSub request = createPubsubPacket ( Type . set , new NodeExtension ( PubSubElementType . PURGE_OWNER , getId ( ) ) ) ; pubSubManager . getConnection ( ) . createStanzaCollectorAndSend ( request ) . nextResultOrThrow ( ) ;
public class ItemsSketch { /** * Returns an array of Rows that include frequent items , estimates , upper and lower bounds * given a threshold and an ErrorCondition . If the threshold is lower than getMaximumError ( ) , * then getMaximumError ( ) will be used instead . * < p > The method first examines all active items in the sketch ( items that have a counter ) . * < p > If < i > ErrorType = NO _ FALSE _ NEGATIVES < / i > , this will include an item in the result * list if getUpperBound ( item ) & gt ; threshold . * There will be no false negatives , i . e . , no Type II error . * There may be items in the set with true frequencies less than the threshold * ( false positives ) . < / p > * < p > If < i > ErrorType = NO _ FALSE _ POSITIVES < / i > , this will include an item in the result * list if getLowerBound ( item ) & gt ; threshold . * There will be no false positives , i . e . , no Type I error . * There may be items omitted from the set with true frequencies greater than the * threshold ( false negatives ) . < / p > * @ param threshold to include items in the result list * @ param errorType determines whether no false positives or no false negatives are * desired . * @ return an array of frequent items */ public Row < T > [ ] getFrequentItems ( final long threshold , final ErrorType errorType ) { } }
return sortItems ( threshold > getMaximumError ( ) ? threshold : getMaximumError ( ) , errorType ) ;
public class Expression { /** * Checks if the provided value matches the variable pattern , if one is defined . Always true if no * pattern is defined . * @ param value to check . * @ return true if it matches . */ boolean matches ( String value ) { } }
if ( pattern == null ) { return true ; } return pattern . matcher ( value ) . matches ( ) ;
public class DToA { /** * / * Return the number ( 0 through 32 ) of most significant zero bits in x . */ private static int hi0bits ( int x ) { } }
int k = 0 ; if ( ( x & 0xffff0000 ) == 0 ) { k = 16 ; x <<= 16 ; } if ( ( x & 0xff000000 ) == 0 ) { k += 8 ; x <<= 8 ; } if ( ( x & 0xf0000000 ) == 0 ) { k += 4 ; x <<= 4 ; } if ( ( x & 0xc0000000 ) == 0 ) { k += 2 ; x <<= 2 ; } if ( ( x & 0x80000000 ) == 0 ) { k ++ ; if ( ( x & 0x40000000 ) == 0 ) return 32 ; } return k ;
public class BaseAbilityBot { /** * Gets the user with the specified username . * @ param username the username of the required user * @ return the user */ protected User getUser ( String username ) { } }
Integer id = userIds ( ) . get ( username . toLowerCase ( ) ) ; if ( id == null ) { throw new IllegalStateException ( format ( "Could not find ID corresponding to username [%s]" , username ) ) ; } return getUser ( id ) ;
public class AWSWAFRegionalClient { /** * Permanently deletes a < a > RuleGroup < / a > . You can ' t delete a < code > RuleGroup < / code > if it ' s still used in any * < code > WebACL < / code > objects or if it still includes any rules . * If you just want to remove a < code > RuleGroup < / code > from a < code > WebACL < / code > , use < a > UpdateWebACL < / a > . * To permanently delete a < code > RuleGroup < / code > from AWS WAF , perform the following steps : * < ol > * < li > * Update the < code > RuleGroup < / code > to remove rules , if any . For more information , see < a > UpdateRuleGroup < / a > . * < / li > * < li > * Use < a > GetChangeToken < / a > to get the change token that you provide in the < code > ChangeToken < / code > parameter of a * < code > DeleteRuleGroup < / code > request . * < / li > * < li > * Submit a < code > DeleteRuleGroup < / code > request . * < / li > * < / ol > * @ param deleteRuleGroupRequest * @ return Result of the DeleteRuleGroup operation returned by the service . * @ throws WAFStaleDataException * The operation failed because you tried to create , update , or delete an object by using a change token * that has already been used . * @ throws WAFInternalErrorException * The operation failed because of a system problem , even though the request was valid . Retry your request . * @ throws WAFNonexistentItemException * The operation failed because the referenced object doesn ' t exist . * @ throws WAFReferencedItemException * The operation failed because you tried to delete an object that is still in use . For example : < / p > * < ul > * < li > * You tried to delete a < code > ByteMatchSet < / code > that is still referenced by a < code > Rule < / code > . * < / li > * < li > * You tried to delete a < code > Rule < / code > that is still referenced by a < code > WebACL < / code > . * < / li > * @ throws WAFNonEmptyEntityException * The operation failed because you tried to delete an object that isn ' t empty . For example : < / p > * < ul > * < li > * You tried to delete a < code > WebACL < / code > that still contains one or more < code > Rule < / code > objects . * < / li > * < li > * You tried to delete a < code > Rule < / code > that still contains one or more < code > ByteMatchSet < / code > objects * or other predicates . * < / li > * < li > * You tried to delete a < code > ByteMatchSet < / code > that contains one or more < code > ByteMatchTuple < / code > * objects . * < / li > * < li > * You tried to delete an < code > IPSet < / code > that references one or more IP addresses . * < / li > * @ throws WAFInvalidOperationException * The operation failed because there was nothing to do . For example : < / p > * < ul > * < li > * You tried to remove a < code > Rule < / code > from a < code > WebACL < / code > , but the < code > Rule < / code > isn ' t in * the specified < code > WebACL < / code > . * < / li > * < li > * You tried to remove an IP address from an < code > IPSet < / code > , but the IP address isn ' t in the specified * < code > IPSet < / code > . * < / li > * < li > * You tried to remove a < code > ByteMatchTuple < / code > from a < code > ByteMatchSet < / code > , but the * < code > ByteMatchTuple < / code > isn ' t in the specified < code > WebACL < / code > . * < / li > * < li > * You tried to add a < code > Rule < / code > to a < code > WebACL < / code > , but the < code > Rule < / code > already exists * in the specified < code > WebACL < / code > . * < / li > * < li > * You tried to add a < code > ByteMatchTuple < / code > to a < code > ByteMatchSet < / code > , but the * < code > ByteMatchTuple < / code > already exists in the specified < code > WebACL < / code > . * < / li > * @ sample AWSWAFRegional . DeleteRuleGroup * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / waf - regional - 2016-11-28 / DeleteRuleGroup " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DeleteRuleGroupResult deleteRuleGroup ( DeleteRuleGroupRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDeleteRuleGroup ( request ) ;
public class SchemaStoreItemStream { /** * Override addItem ( ) to ensure we maintain our index */ public void addItem ( Item item , Transaction tran ) throws OutOfCacheSpace , StreamIsFull , ProtocolException , TransactionException , PersistenceException , SevereMessageStoreException { } }
super . addItem ( item , tran ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "addItem" ) ; if ( item instanceof SchemaStoreItem ) { addToIndex ( ( SchemaStoreItem ) item ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "JSchema added to store: " + ( ( SchemaStoreItem ) item ) . getSchema ( ) . getID ( ) ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "addItem" ) ;
public class TransactionLock { /** * Releases the lock on the transaction . * @ param objectManagerState within which the transaction is unlocked . */ protected final void unLock ( ObjectManagerState objectManagerState ) { } }
synchronized ( objectManagerState . transactionUnlockSequenceLock ) { unlockSequence = objectManagerState . getNewGlobalTransactionUnlockSequence ( ) ; lockingTransaction = null ; } // synchronized .
public class FileUtils { /** * Ensure writeable directory . * If doesn ' t exist , we attempt creation . * @ param dir Directory to test for exitence and is writeable . * @ return The passed < code > dir < / code > . * @ exception IOException If passed directory does not exist and is not * createable , or directory is not writeable or is not a directory . */ public static File ensureWriteableDirectory ( File dir ) throws IOException { } }
if ( ! dir . exists ( ) ) { boolean success = dir . mkdirs ( ) ; if ( ! success ) { throw new IOException ( "Failed to create directory: " + dir ) ; } } else { if ( ! dir . canWrite ( ) ) { throw new IOException ( "Dir " + dir . getAbsolutePath ( ) + " not writeable." ) ; } else if ( ! dir . isDirectory ( ) ) { throw new IOException ( "Dir " + dir . getAbsolutePath ( ) + " is not a directory." ) ; } } return dir ;
public class URLParser { /** * Breaks down a standard query string ( ie " param1 = foo & param2 = bar " ) * @ return an empty map if the query is empty or null */ public static Map < String , String > parseQuery ( String query ) { } }
Map < String , String > result = new LinkedHashMap < String , String > ( ) ; if ( query != null ) { for ( String keyValue : query . split ( "&" ) ) { String [ ] pair = keyValue . split ( "=" ) ; result . put ( StringUtils . urlDecode ( pair [ 0 ] ) , StringUtils . urlDecode ( pair [ 1 ] ) ) ; } } return result ;
public class SocketExtensions { /** * Writes the given Object . * @ param serverName * The Name from the receiver ( Server ) . * @ param port * The port who listen the receiver . * @ param objectToSend * The Object to send . * @ throws IOException * Signals that an I / O exception has occurred . */ public static void writeObject ( final String serverName , final int port , final Object objectToSend ) throws IOException { } }
final InetAddress inetAddress = InetAddress . getByName ( serverName ) ; writeObject ( inetAddress , port , objectToSend ) ;
public class GlobalVarReferenceMap { /** * Resets global var reference map with the new provide map . * @ param globalRefMap The reference map result of a * { @ link ReferenceCollectingCallback } pass collected from the whole AST . */ private void resetGlobalVarReferences ( Map < Var , ReferenceCollection > globalRefMap ) { } }
refMap = new LinkedHashMap < > ( ) ; for ( Entry < Var , ReferenceCollection > entry : globalRefMap . entrySet ( ) ) { Var var = entry . getKey ( ) ; if ( var . isGlobal ( ) ) { refMap . put ( var . getName ( ) , entry . getValue ( ) ) ; } }
public class ApiOvhCore { /** * Connect to the OVH API using a consumerKey contains in your ovh config file * or environment variable * @ return an ApiOvhCore authenticate by consumerKey */ public static ApiOvhCore getInstance ( ) { } }
ApiOvhCore core = new ApiOvhCore ( ) ; // core . _ consumerKey = core . config . getConsumerKey ( ) ; core . _consumerKey = core . getConsumerKeyOrNull ( ) ; // config . getConsumerKey ( ) ; if ( core . _consumerKey == null ) { File file = ApiOvhConfigBasic . getOvhConfig ( ) ; String location = ApiOvhConfigBasic . configFiles ; if ( file != null ) location = file . getAbsolutePath ( ) ; String url = "" ; String CK = "" ; try { OvhCredential credential = core . requestToken ( null ) ; url = credential . validationUrl ; CK = credential . consumerKey ; } catch ( Exception e ) { log . error ( "Fail to request a new Credential" , e ) ; } log . error ( "activate the CK {} here: {}" , CK , url ) ; throw new NullPointerException ( "no 'consumer_key' present in " + location + " or environement 'OVH_CONSUMER_KEY', activate the CK '" + CK + "' here: " + url ) ; } return core ;
public class Matrix4f { /** * Apply rotation of < code > angles . z < / code > radians about the Z axis , followed by a rotation of < code > angles . y < / code > radians about the Y axis and * followed by a rotation of < code > angles . x < / code > radians about the X axis . * When used with a right - handed coordinate system , the produced rotation will rotate a vector * counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin . * When used with a left - handed coordinate system , the rotation is clockwise . * If < code > M < / code > is < code > this < / code > matrix and < code > R < / code > the rotation matrix , * then the new matrix will be < code > M * R < / code > . So when transforming a * vector < code > v < / code > with the new matrix by using < code > M * R * v < / code > , the * rotation will be applied first ! * This method is equivalent to calling : < code > rotateZ ( angles . z ) . rotateY ( angles . y ) . rotateX ( angles . x ) < / code > * @ param angles * the Euler angles * @ return this */ public Matrix4f rotateZYX ( Vector3f angles ) { } }
return rotateZYX ( angles . z , angles . y , angles . x ) ;
public class MultidimensionalReward { /** * Merge in another multidimensional reward structure . * @ param other * the other multidimensional reward structure . */ public void add ( MultidimensionalReward other ) { } }
for ( Map . Entry < Integer , Float > entry : other . map . entrySet ( ) ) { Integer dimension = entry . getKey ( ) ; Float reward_value = entry . getValue ( ) ; this . add ( dimension . intValue ( ) , reward_value . floatValue ( ) ) ; }
public class TableLayout { /** * Adds a new cell to the current grid * @ param cell the td component */ public void addCell ( TableLayoutCell cell ) { } }
GridBagConstraints constraints = cell . getConstraints ( ) ; constraints . insets = new Insets ( cellpadding , cellpadding , cellpadding , cellpadding ) ; add ( cell . getComponent ( ) , constraints ) ;
public class HttpSender { /** * Send and receive a HttpMessage . * @ param msg * @ param isFollowRedirect * @ throws HttpException * @ throws IOException * @ see # sendAndReceive ( HttpMessage , HttpRequestConfig ) */ public void sendAndReceive ( HttpMessage msg , boolean isFollowRedirect ) throws IOException { } }
log . debug ( "sendAndReceive " + msg . getRequestHeader ( ) . getMethod ( ) + " " + msg . getRequestHeader ( ) . getURI ( ) + " start" ) ; msg . setTimeSentMillis ( System . currentTimeMillis ( ) ) ; try { notifyRequestListeners ( msg ) ; if ( ! isFollowRedirect || ! ( msg . getRequestHeader ( ) . getMethod ( ) . equalsIgnoreCase ( HttpRequestHeader . POST ) || msg . getRequestHeader ( ) . getMethod ( ) . equalsIgnoreCase ( HttpRequestHeader . PUT ) ) ) { // ZAP : Reauthentication when sending a message from the perspective of a User sendAuthenticated ( msg , isFollowRedirect ) ; return ; } // ZAP : Reauthentication when sending a message from the perspective of a User sendAuthenticated ( msg , false ) ; HttpMessage temp = msg . cloneAll ( ) ; temp . setRequestingUser ( getUser ( msg ) ) ; // POST / PUT method cannot be redirected by library . Need to follow by code // loop 1 time only because httpclient can handle redirect itself after first GET . for ( int i = 0 ; i < 1 && ( HttpStatusCode . isRedirection ( temp . getResponseHeader ( ) . getStatusCode ( ) ) && temp . getResponseHeader ( ) . getStatusCode ( ) != HttpStatusCode . NOT_MODIFIED ) ; i ++ ) { String location = temp . getResponseHeader ( ) . getHeader ( HttpHeader . LOCATION ) ; URI baseUri = temp . getRequestHeader ( ) . getURI ( ) ; URI newLocation = new URI ( baseUri , location , false ) ; temp . getRequestHeader ( ) . setURI ( newLocation ) ; temp . getRequestHeader ( ) . setMethod ( HttpRequestHeader . GET ) ; temp . getRequestHeader ( ) . setHeader ( HttpHeader . CONTENT_LENGTH , null ) ; // ZAP : Reauthentication when sending a message from the perspective of a User sendAuthenticated ( temp , true ) ; } msg . setResponseHeader ( temp . getResponseHeader ( ) ) ; msg . setResponseBody ( temp . getResponseBody ( ) ) ; } finally { msg . setTimeElapsedMillis ( ( int ) ( System . currentTimeMillis ( ) - msg . getTimeSentMillis ( ) ) ) ; log . debug ( "sendAndReceive " + msg . getRequestHeader ( ) . getMethod ( ) + " " + msg . getRequestHeader ( ) . getURI ( ) + " took " + msg . getTimeElapsedMillis ( ) ) ; notifyResponseListeners ( msg ) ; }
public class CircularImageView { /** * Checkable */ @ Override public void setChecked ( final boolean checked ) { } }
if ( mChecked == checked ) return ; if ( mAllowCheckStateAnimation ) { final int duration = 150 ; final Interpolator interpolator = new DecelerateInterpolator ( ) ; ObjectAnimator animation = ObjectAnimator . ofFloat ( this , "scaleX" , 1f , 0f ) ; animation . setDuration ( duration ) ; animation . setInterpolator ( interpolator ) ; animation . addListener ( new AnimatorListenerAdapter ( ) { @ Override public void onAnimationEnd ( Animator animation ) { mChecked = checked ; invalidate ( ) ; ObjectAnimator reverse = ObjectAnimator . ofFloat ( CircularImageView . this , "scaleX" , 0f , 1f ) ; reverse . setDuration ( duration ) ; reverse . setInterpolator ( interpolator ) ; reverse . start ( ) ; } } ) ; animation . start ( ) ; } else { mChecked = checked ; invalidate ( ) ; }
public class Mac { /** * Processes the given array of bytes and finishes the MAC operation . * < p > A call to this method resets this < code > Mac < / code > object to the * state it was in when previously initialized via a call to * < code > init ( Key ) < / code > or * < code > init ( Key , AlgorithmParameterSpec ) < / code > . * That is , the object is reset and available to generate another MAC from * the same key , if desired , via new calls to < code > update < / code > and * < code > doFinal < / code > . * ( In order to reuse this < code > Mac < / code > object with a different key , * it must be reinitialized via a call to < code > init ( Key ) < / code > or * < code > init ( Key , AlgorithmParameterSpec ) < / code > . * @ param input data in bytes * @ return the MAC result . * @ exception IllegalStateException if this < code > Mac < / code > has not been * initialized . */ public final byte [ ] doFinal ( byte [ ] input ) throws IllegalStateException { } }
chooseFirstProvider ( ) ; if ( initialized == false ) { throw new IllegalStateException ( "MAC not initialized" ) ; } update ( input ) ; return doFinal ( ) ;
public class NodeDataIndexing { /** * Property data . * @ return PropertyData */ public PropertyData getProperty ( String name ) { } }
return properties == null ? null : properties . get ( name ) ;
public class UICommands { /** * Uses the given converter to convert to a nicer UI value and return the JSON safe version */ public static Object convertValueToSafeJson ( Converter converter , Object value ) { } }
value = Proxies . unwrap ( value ) ; if ( isJsonObject ( value ) ) { return value ; } if ( converter != null ) { // TODO converters ususally go from String - > CustomType ? try { Object converted = converter . convert ( value ) ; if ( converted != null ) { value = converted ; } } catch ( Exception e ) { // ignore - invalid converter } } if ( value != null ) { return toSafeJsonValue ( value ) ; } else { return null ; }
public class XLogPDescriptor { /** * Gets the carbonsCount attribute of the XLogPDescriptor object . * @ param ac Description of the Parameter * @ param atom Description of the Parameter * @ return The carbonsCount value */ private int getCarbonsCount ( IAtomContainer ac , IAtom atom ) { } }
List < IAtom > neighbours = ac . getConnectedAtomsList ( atom ) ; int ccounter = 0 ; for ( IAtom neighbour : neighbours ) { if ( neighbour . getSymbol ( ) . equals ( "C" ) ) { if ( ! neighbour . getFlag ( CDKConstants . ISAROMATIC ) ) { ccounter += 1 ; } } } return ccounter ;
public class UploadApi { /** * Method to upload an attachment to Facebook ' s server in order to use it * later . Requires the pages _ messaging permission . * @ param attachmentType * the type of attachment to upload to Facebook . Please notice * that currently Facebook supports only image , audio , video and * file attachments . * @ param attachmentUrl * the URL of the attachment to upload to Facebook . * @ return nonexpiring ID for the attachment . */ public static UploadAttachmentResponse uploadAttachment ( AttachmentType attachmentType , String attachmentUrl ) { } }
AttachmentPayload payload = new AttachmentPayload ( attachmentUrl , true ) ; Attachment attachment = new Attachment ( attachmentType , payload ) ; AttachmentMessage message = new AttachmentMessage ( attachment ) ; FbBotMillMessageResponse toSend = new FbBotMillMessageResponse ( null , message ) ; return FbBotMillNetworkController . postUploadAttachment ( toSend ) ;
public class ImplOrientationAverageGradientIntegral { /** * Compute the gradient while checking for border conditions */ protected double computeWeighted ( double tl_x , double tl_y , double samplePeriod , SparseImageGradient < T , G > g ) { } }
// add 0.5 to c _ x and c _ y to have it round tl_x += 0.5 ; tl_y += 0.5 ; double Dx = 0 , Dy = 0 ; int i = 0 ; for ( int y = 0 ; y < sampleWidth ; y ++ ) { int pixelsY = ( int ) ( tl_y + y * samplePeriod ) ; for ( int x = 0 ; x < sampleWidth ; x ++ , i ++ ) { int pixelsX = ( int ) ( tl_x + x * samplePeriod ) ; double w = weights . data [ i ] ; GradientValue v = g . compute ( pixelsX , pixelsY ) ; Dx += w * v . getX ( ) ; Dy += w * v . getY ( ) ; } } return Math . atan2 ( Dy , Dx ) ;