signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class BaseFunction { /** * { @ inheritDoc } */
public boolean update ( int currentVectorIndex ) { } } | int currentClusterIndex = assignments [ currentVectorIndex ] ; double bestDelta = ( isMaximize ( ) ) ? 0 : Double . MAX_VALUE ; int bestDeltaIndex = - 1 ; // Get the current vector .
DoubleVector vector = matrix . get ( currentVectorIndex ) ; // Get the current centroid without the current data point assigned to
// it . Compute the cost delta with that point removed from the cluster .
// DoubleVector altCurrentCentroid = subtract (
// centroids [ currentClusterIndex ] , vector ) ;
double deltaBase = ( clusterSizes [ currentClusterIndex ] == 1 ) ? 0 : getOldCentroidScore ( vector , currentClusterIndex , clusterSizes [ currentClusterIndex ] - 1 ) ; deltaBase -= costs [ currentClusterIndex ] ; // Compute the cost delta for moving that data point to each of the
// other possible clusters .
for ( int i = 0 ; i < centroids . length ; ++ i ) { // Skip the cluster the data point is already assigned to .
if ( currentClusterIndex == i ) continue ; // Compute the cost of adding the data point to the current
// alternate cluster .
double newCost = getNewCentroidScore ( i , vector ) ; // Compute the cost delta for that change and the removal from the
// data points original cluster .
double delta = newCost - costs [ i ] + deltaBase ; if ( isMaximize ( ) ) { // Remember this move if it ' s positive and the best seen so far .
// Negative detlas can be safely ignored since we only want to
// maximize the cost .
if ( delta > 0 && delta > bestDelta ) { bestDelta = delta ; bestDeltaIndex = i ; } } else { // Remember this move if it ' s the best seen so far .
if ( delta < bestDelta ) { bestDelta = delta ; bestDeltaIndex = i ; } } } // If the best delta index was modified , make an update and return true .
if ( bestDeltaIndex >= 0 ) { // Change the costs .
double newDelta = bestDelta - deltaBase ; costs [ currentClusterIndex ] += deltaBase ; costs [ bestDeltaIndex ] += newDelta ; updateScores ( bestDeltaIndex , currentClusterIndex , vector ) ; // Update the sizes .
clusterSizes [ currentClusterIndex ] -- ; clusterSizes [ bestDeltaIndex ] ++ ; // Update the centroids .
centroids [ currentClusterIndex ] = subtract ( centroids [ currentClusterIndex ] , vector ) ; centroids [ bestDeltaIndex ] = VectorMath . add ( centroids [ bestDeltaIndex ] , vector ) ; // Update the assignment .
assignments [ currentVectorIndex ] = bestDeltaIndex ; return true ; } // Otherwise , this data point cannot be relocated , so return false .
return false ; |
public class JDKLogger { /** * Logs the provided data .
* @ param level
* The log level
* @ param message
* The message parts ( may be null )
* @ param throwable
* The error ( may be null ) */
@ Override protected void logImpl ( LogLevel level , Object [ ] message , Throwable throwable ) { } } | // get log level
int levelValue = level . getValue ( ) ; Level jdkLevel = null ; switch ( levelValue ) { case LogLevel . DEBUG_LOG_LEVEL_VALUE : jdkLevel = Level . FINEST ; break ; case LogLevel . ERROR_LOG_LEVEL_VALUE : jdkLevel = Level . SEVERE ; break ; case LogLevel . INFO_LOG_LEVEL_VALUE : default : jdkLevel = Level . FINE ; break ; } if ( jdkLevel != null ) { // format log message ( without exception )
String text = this . formatLogMessage ( level , message , null ) ; // log
this . JDK_LOGGER . log ( jdkLevel , text , throwable ) ; } |
public class ByteToMessageDecoder { /** * Decode the from one { @ link ByteBuf } to an other . This method will be called till either the input
* { @ link ByteBuf } has nothing to read when return from this method or till nothing was read from the input
* { @ link ByteBuf } .
* @ param ctx the { @ link ChannelHandlerContext } which this { @ link ByteToMessageDecoder } belongs to
* @ param in the { @ link ByteBuf } from which to read data
* @ param out the { @ link List } to which decoded messages should be added
* @ throws Exception is thrown if an error occurs */
final void decodeRemovalReentryProtection ( ChannelHandlerContext ctx , ByteBuf in , List < Object > out ) throws Exception { } } | decodeState = STATE_CALLING_CHILD_DECODE ; try { decode ( ctx , in , out ) ; } finally { boolean removePending = decodeState == STATE_HANDLER_REMOVED_PENDING ; decodeState = STATE_INIT ; if ( removePending ) { handlerRemoved ( ctx ) ; } } |
public class ByteCodeMetaData { /** * Scan the bytecode of all classes in the hierarchy unless already done . */
private void scan ( ) { } } | if ( ivScanned ) { return ; } ivScanned = true ; final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; for ( Class < ? > klass = ivClass ; klass != null && klass != Object . class ; klass = klass . getSuperclass ( ) ) { if ( isTraceOn && ( tc . isDebugEnabled ( ) || tcMetaData . isDebugEnabled ( ) ) ) Tr . debug ( tc . isDebugEnabled ( ) ? tc : tcMetaData , "scanning " + klass . getName ( ) ) ; ivCurrentClassName = klass . getName ( ) ; ivCurrentPrivateMethodMetaData = null ; ClassLoader classLoader = klass . getClassLoader ( ) ; if ( classLoader == null ) { classLoader = getBootClassLoader ( ) ; // d742751
} String resourceName = klass . getName ( ) . replace ( '.' , '/' ) + ".class" ; InputStream input = classLoader . getResourceAsStream ( resourceName ) ; if ( input == null ) // d728537
{ if ( isTraceOn && ( tc . isDebugEnabled ( ) || tcMetaData . isDebugEnabled ( ) ) ) Tr . debug ( tc . isDebugEnabled ( ) ? tc : tcMetaData , "failed to find " + resourceName + " from " + classLoader ) ; ivScanException = new FileNotFoundException ( resourceName ) ; return ; } try { ClassReader classReader = new ClassReader ( input ) ; classReader . accept ( this , ClassReader . SKIP_DEBUG | ClassReader . SKIP_FRAMES ) ; } // If the class is malformed , ASM might throw any exception . d728537
catch ( Throwable t ) { FFDCFilter . processException ( t , CLASS_NAME + ".scan" , "168" , this , new Object [ ] { resourceName , klass , classLoader } ) ; if ( isTraceOn && ( tc . isDebugEnabled ( ) || tcMetaData . isDebugEnabled ( ) ) ) Tr . debug ( tc . isDebugEnabled ( ) ? tc : tcMetaData , "scan exception" , t ) ; ivScanException = t ; return ; } finally { try { input . close ( ) ; } catch ( IOException ex ) { if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "error closing input stream" , ex ) ; } } } |
public class CmsSearchFieldConfiguration { /** * Returns the locale extended name for the given lookup String . < p >
* @ param lookup the lookup String
* @ param locale the locale
* @ return the locale extended name for the given lookup String */
public static final String getLocaleExtendedName ( String lookup , String locale ) { } } | StringBuffer result = new StringBuffer ( 32 ) ; result . append ( lookup ) ; result . append ( '_' ) ; result . append ( locale ) ; return result . toString ( ) ; |
public class PdfDocument { /** * Gets the < CODE > PdfCatalog < / CODE > - object .
* @ param pages an indirect reference to this document pages
* @ return < CODE > PdfCatalog < / CODE > */
PdfCatalog getCatalog ( PdfIndirectReference pages ) { } } | PdfCatalog catalog = new PdfCatalog ( pages , writer ) ; // [ C1 ] outlines
if ( rootOutline . getKids ( ) . size ( ) > 0 ) { catalog . put ( PdfName . PAGEMODE , PdfName . USEOUTLINES ) ; catalog . put ( PdfName . OUTLINES , rootOutline . indirectReference ( ) ) ; } // [ C2 ] version
writer . getPdfVersion ( ) . addToCatalog ( catalog ) ; // [ C3 ] preferences
viewerPreferences . addToCatalog ( catalog ) ; // [ C4 ] pagelabels
if ( pageLabels != null ) { catalog . put ( PdfName . PAGELABELS , pageLabels . getDictionary ( writer ) ) ; } // [ C5 ] named objects
catalog . addNames ( localDestinations , getDocumentLevelJS ( ) , documentFileAttachment , writer ) ; // [ C6 ] actions
if ( openActionName != null ) { PdfAction action = getLocalGotoAction ( openActionName ) ; catalog . setOpenAction ( action ) ; } else if ( openActionAction != null ) catalog . setOpenAction ( openActionAction ) ; if ( additionalActions != null ) { catalog . setAdditionalActions ( additionalActions ) ; } // [ C7 ] portable collections
if ( collection != null ) { catalog . put ( PdfName . COLLECTION , collection ) ; } // [ C8 ] AcroForm
if ( annotationsImp . hasValidAcroForm ( ) ) { try { catalog . put ( PdfName . ACROFORM , writer . addToBody ( annotationsImp . getAcroForm ( ) ) . getIndirectReference ( ) ) ; } catch ( IOException e ) { throw new ExceptionConverter ( e ) ; } } return catalog ; |
public class StorageAccountsInner { /** * Gets the SAS token associated with the specified Data Lake Analytics and Azure Storage account and container combination .
* ServiceResponse < PageImpl < SasTokenInformationInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; SasTokenInformationInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < SasTokenInformationInner > > > listSasTokensNextSinglePageAsync ( final String nextPageLink ) { } } | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . listSasTokensNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < SasTokenInformationInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SasTokenInformationInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < SasTokenInformationInner > > result = listSasTokensNextDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < SasTokenInformationInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class RtfStylesheetList { /** * Gets the RtfParagraphStyle with the given name . Makes sure that the defaults
* have been loaded .
* @ param styleName The name of the RtfParagraphStyle to get .
* @ return The RtfParagraphStyle with the given name or null . */
public RtfParagraphStyle getRtfParagraphStyle ( String styleName ) { } } | if ( ! defaultsLoaded ) { registerDefaultStyles ( ) ; } if ( this . styleMap . containsKey ( styleName ) ) { return ( RtfParagraphStyle ) this . styleMap . get ( styleName ) ; } else { return null ; } |
public class WSContext { /** * Perform any needed conversions on an object retrieved from the context tree .
* @ param o the object to be resolved
* @ return the resolved object
* @ throws Exception
* @ throws NamingException */
@ FFDCIgnore ( { } } | NamingException . class } ) @ Sensitive Object resolveObject ( Object o , WSName subname ) throws NamingException { ServiceReference < ? > ref = null ; try { if ( o instanceof ContextNode ) return new WSContext ( userContext , ( ContextNode ) o , env ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Resolving object" , o ) ; if ( o instanceof ServiceReference ) { ref = ( ServiceReference < ? > ) o ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "External service registry entry." ) ; } else if ( o instanceof AutoBindNode ) { if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "AutoBindNode entry." ) ; AutoBindNode abNode = ( AutoBindNode ) o ; ref = ( ServiceReference < ? > ) abNode . getLastEntry ( ) ; // null means the node was removed in another thread .
if ( ref == null ) { // Use the same semantics as ContextNode . lookup .
throw new NameNotFoundException ( subname . toString ( ) ) ; } } else if ( o instanceof ServiceRegistration ) { ref = ( ( ServiceRegistration < ? > ) o ) . getReference ( ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Programmatic JNDI entry." ) ; } boolean getObjectInstance ; if ( ref == null ) { getObjectInstance = true ; } else { o = getReference ( userContext , ref ) ; if ( o == null ) { throw new NamingException ( Tr . formatMessage ( tc , "jndi.servicereference.failed" , subname . toString ( ) ) ) ; } Object origin = ref . getProperty ( JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN ) ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Retrieved service from registry" , o , JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN + "=" + origin , Constants . OBJECTCLASS + "=" + Arrays . toString ( ( String [ ] ) ref . getProperty ( Constants . OBJECTCLASS ) ) ) ; getObjectInstance = JNDIServiceBinder . OSGI_JNDI_SERVICE_ORIGIN_VALUE . equals ( origin ) || contains ( ( String [ ] ) ref . getProperty ( Constants . OBJECTCLASS ) , Reference . class . getName ( ) ) ; } if ( getObjectInstance ) { // give JNDI a chance to resolve any references
try { Object oldO = o ; o = NamingManager . getObjectInstance ( o , subname , this , env ) ; if ( o != oldO ) if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "Resolved object through NamingManager" ) ; // remove logging object o since it might contain the sensitive information .
} catch ( NamingException e ) { throw e ; } catch ( Exception e ) { // FFDC and proceed
} } return o ; } catch ( NamingException e ) { throw e ; } catch ( Exception e ) { NamingException ne = new NamingException ( ) ; ne . setRootCause ( e ) ; throw ne ; } |
public class Toposort { /** * TODO : detect cycles . */
public static < T > HashSet < T > dfs ( T root , Set < T > visited , Deps < T > deps ) { } } | // The set of leaves ( excluding any which were already marked as visited ) .
HashSet < T > leaves = new HashSet < T > ( ) ; // The stack for DFS .
Stack < T > stack = new Stack < T > ( ) ; stack . push ( root ) ; while ( stack . size ( ) > 0 ) { T p = stack . pop ( ) ; if ( visited . add ( p ) ) { // Unseen .
if ( deps . getDeps ( p ) . size ( ) == 0 ) { // Is leaf .
leaves . add ( p ) ; } else { // Not a leaf .
stack . addAll ( deps . getDeps ( p ) ) ; } } else { // Seen .
continue ; } } return leaves ; |
public class JournalConsumer { /** * Reject API calls from outside while we are in recovery mode . */
public Date setDatastreamVersionable ( Context context , String pid , String dsID , boolean versionable , String logMessage ) throws ServerException { } } | throw rejectCallsFromOutsideWhileInRecoveryMode ( ) ; |
public class FactoryImageSegmentation { /** * Creates a new instance of { @ link SegmentFelzenszwalbHuttenlocher04 } which is in a wrapper for { @ link ImageSuperpixels } .
* @ see SegmentFelzenszwalbHuttenlocher04
* @ param config Configuration . If null defaults are used .
* @ param imageType Type of input image .
* @ param < T > Image type
* @ return new instance of { @ link ImageSuperpixels } */
public static < T extends ImageBase < T > > ImageSuperpixels < T > fh04 ( @ Nullable ConfigFh04 config , ImageType < T > imageType ) { } } | if ( config == null ) config = new ConfigFh04 ( ) ; SegmentFelzenszwalbHuttenlocher04 < T > fh = FactorySegmentationAlg . fh04 ( config , imageType ) ; return new Fh04_to_ImageSuperpixels < > ( fh , config . connectRule ) ; |
public class ConfigUtil { /** * Returns the user id . The user id is obtained by executing ' id - u '
* external program .
* < BR > < BR > < B > Note : < / B > < I >
* Under some circumstances , this function executes an external program ;
* thus , its behavior is influenced by environment variables such as the
* caller ' s PATH and the environment variables that control dynamic
* loading . Care should be used if calling this function from a program
* that will be run as a Unix setuid program , or in any other manner in
* which the owner of the Unix process does not completely control its
* runtime environment .
* @ throws IOException if unable to determine the user id .
* @ return the user id */
public static String getUID ( ) throws IOException { } } | String exec = "id" ; String osname = System . getProperty ( "os.name" ) ; if ( osname != null ) { osname = osname . toLowerCase ( ) ; if ( ( osname . indexOf ( "solaris" ) != - 1 ) || ( osname . indexOf ( "sunos" ) != - 1 ) ) { if ( ( new File ( SOLARIS_ID_EXEC ) . exists ( ) ) ) { exec = SOLARIS_ID_EXEC ; } } else if ( osname . indexOf ( "windows" ) != - 1 ) { throw new IOException ( "Unable to determine the user id" ) ; } } Runtime runTime = Runtime . getRuntime ( ) ; Process process = null ; BufferedReader buffInReader = null ; String s = null ; StringBuffer output = new StringBuffer ( ) ; int exitValue = - 1 ; try { process = runTime . exec ( exec + " -u" ) ; buffInReader = new BufferedReader ( new InputStreamReader ( process . getInputStream ( ) ) ) ; while ( ( s = buffInReader . readLine ( ) ) != null ) { output . append ( s ) ; } exitValue = process . waitFor ( ) ; } catch ( Exception e ) { throw new IOException ( "Unable to execute 'id -u'" ) ; } finally { if ( buffInReader != null ) { try { buffInReader . close ( ) ; } catch ( IOException e ) { } } if ( process != null ) { try { process . getErrorStream ( ) . close ( ) ; } catch ( IOException e ) { } try { process . getOutputStream ( ) . close ( ) ; } catch ( IOException e ) { } } } if ( exitValue != 0 ) { throw new IOException ( "Unable to perform 'id -u'" ) ; } return output . toString ( ) . trim ( ) ; |
public class InetUtilities { /** * Downloads a file as a byte array
* @ param url The URL of the resource to download
* @ return The byte array containing the data of the downloaded file */
public static byte [ ] getURLData ( final String url ) { } } | final int readBytes = 1000 ; URL u ; InputStream is = null ; final ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; // See http : / / www . exampledepot . com / egs / javax . net . ssl / TrustAll . html
// Create a trust manager that does not validate certificate chains
final TrustManager [ ] trustAllCerts = new TrustManager [ ] { new X509TrustManager ( ) { public java . security . cert . X509Certificate [ ] getAcceptedIssuers ( ) { return null ; } public void checkClientTrusted ( java . security . cert . X509Certificate [ ] certs , String authType ) { } public void checkServerTrusted ( java . security . cert . X509Certificate [ ] certs , String authType ) { } } } ; // Install the all - trusting trust manager
// FIXME from Lee : This doesn ' t seem like a wise idea to install an all - trusting cert manager by default
try { final SSLContext sc = SSLContext . getInstance ( "SSL" ) ; sc . init ( null , trustAllCerts , new java . security . SecureRandom ( ) ) ; HttpsURLConnection . setDefaultSSLSocketFactory ( sc . getSocketFactory ( ) ) ; } catch ( final Exception ex ) { LOG . error ( "Unable to install the all-trust SSL Manager" , ex ) ; } try { u = new URL ( url ) ; is = u . openStream ( ) ; // throws an IOException
int nRead ; byte [ ] data = new byte [ readBytes ] ; while ( ( nRead = is . read ( data , 0 , readBytes ) ) != - 1 ) { buffer . write ( data , 0 , nRead ) ; } } catch ( final Exception ex ) { LOG . error ( "Unable to read data from URL" , ex ) ; } finally { try { buffer . flush ( ) ; if ( is != null ) is . close ( ) ; } catch ( final Exception ex ) { LOG . error ( "Unable to flush and close URL Input Stream" , ex ) ; } } return buffer . toByteArray ( ) ; |
public class CResponse { /** * Extracts string from input stream
* @ return Get the response as a String */
public String asString ( ) { } } | try { return EntityUtils . toString ( entity , PcsUtils . UTF8 . name ( ) ) ; } catch ( IOException e ) { throw new CStorageException ( "Can't get string from HTTP entity" , e ) ; } |
public class OptionGroupOption { /** * The options that are prerequisites for this option .
* @ param optionsDependedOn
* The options that are prerequisites for this option . */
public void setOptionsDependedOn ( java . util . Collection < String > optionsDependedOn ) { } } | if ( optionsDependedOn == null ) { this . optionsDependedOn = null ; return ; } this . optionsDependedOn = new com . amazonaws . internal . SdkInternalList < String > ( optionsDependedOn ) ; |
public class Jdk14Logger { /** * Log a message and exception with debug log level . */
public void debug ( Object message , Throwable exception ) { } } | log ( Level . FINE , String . valueOf ( message ) , exception ) ; |
public class Schema { /** * remove a given edge label
* @ param edgeLabel the edge label
* @ param preserveData should we keep the SQL data */
void removeEdgeLabel ( EdgeLabel edgeLabel , boolean preserveData ) { } } | getTopology ( ) . lock ( ) ; String fn = this . name + "." + EDGE_PREFIX + edgeLabel . getName ( ) ; if ( ! uncommittedRemovedEdgeLabels . contains ( fn ) ) { uncommittedRemovedEdgeLabels . add ( fn ) ; TopologyManager . removeEdgeLabel ( this . sqlgGraph , edgeLabel ) ; for ( VertexLabel lbl : edgeLabel . getOutVertexLabels ( ) ) { lbl . removeOutEdge ( edgeLabel ) ; } for ( VertexLabel lbl : edgeLabel . getInVertexLabels ( ) ) { lbl . removeInEdge ( edgeLabel ) ; } if ( ! preserveData ) { edgeLabel . delete ( ) ; } getTopology ( ) . fire ( edgeLabel , "" , TopologyChangeAction . DELETE ) ; } |
public class RevisionApi { /** * This method returns the correct mapping of the given input .
* @ param mapping
* mapping sequence
* @ param revisionCounter
* index to map
* @ return mapped index */
private int getMapping ( final String mapping , final int revisionCounter ) { } } | String tempA , tempB ; int length = 0 ; int revC = - 1 , mapC = - 1 ; int index , max = mapping . length ( ) ; while ( length < max && revC < revisionCounter ) { // Read revisionCounter
index = mapping . indexOf ( ' ' , length ) ; tempA = mapping . substring ( length , index ) ; length = index + 1 ; // Read mappedCounter
index = mapping . indexOf ( ' ' , length ) ; if ( index == - 1 ) { index = mapping . length ( ) ; } tempB = mapping . substring ( length , index ) ; length = index + 1 ; // Parse values
revC = Integer . parseInt ( tempA ) ; mapC = Integer . parseInt ( tempB ) ; // System . out . println ( revC + " - > " + mapC ) ;
} if ( revC == revisionCounter ) { // System . out . println ( revC + " > > " + mapC ) ;
return mapC ; } return revisionCounter ; |
public class DomainObject { /** * Remove a value from a list at the given index .
* < br / > Shifts any subsequent elements to the left ( subtracts one from their indices ) .
* @ param fieldName
* @ param index */
public void removeListFieldValue ( String fieldName , int index ) { } } | Object val = getFieldValue ( fieldName , true ) ; // internal
DOField fld = getDomainObjectType ( ) . getFieldByName ( fieldName ) ; String ctn = fld . getComponentTypeName ( ) ; Class < ? > clazz ; try { clazz = getDomainObjectType ( ) . getDomainModel ( ) . getClassForName ( ctn ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } if ( val instanceof List < ? > ) ( ( List < ? > ) val ) . remove ( index ) ; else if ( val != null && val . getClass ( ) . isArray ( ) ) { int len = Array . getLength ( val ) ; Object array = Array . newInstance ( clazz , len - 1 ) ; for ( int i = 0 ; i < index ; i ++ ) { Array . set ( array , i , Array . get ( val , i ) ) ; } for ( int i = index ; i < len - 1 ; i ++ ) { Array . set ( array , i , Array . get ( val , i - 1 ) ) ; } } else { if ( ! getDomainObjectType ( ) . getFieldByName ( fieldName ) . isListOrArray ( ) ) throw new RuntimeException ( "field: [" + fieldName + "] is neither list nor array" ) ; if ( val == null ) throw new RuntimeException ( "list or array field: [" + fieldName + "] is null" ) ; } |
public class PushNotificationPayload { /** * Create a custom alert ( if none exist ) and add a custom text for the right button of the popup .
* @ param actionLocKey the title of the alert ' s right button , or null to remove the button
* @ throws JSONException if the custom alert cannot be added because a simple alert already exists */
public void addCustomAlertActionLocKey ( String actionLocKey ) throws JSONException { } } | Object value = actionLocKey != null ? actionLocKey : new JSONNull ( ) ; put ( "action-loc-key" , value , getOrAddCustomAlert ( ) , false ) ; |
public class HtmlGraphics { /** * Sizes or resizes the root element that contains the PlayN view .
* @ param width the new width , in pixels , of the view .
* @ param height the new height , in pixels , of the view . */
public void setSize ( int width , int height ) { } } | rootElement . getStyle ( ) . setWidth ( width , Unit . PX ) ; rootElement . getStyle ( ) . setHeight ( height , Unit . PX ) ; |
public class PlainDate { /** * / * [ deutsch ]
* < p > Normalisiert die angegebene Zeitspanne , indem Jahre , Monate und Tage
* verwendet werden . < / p >
* < p > Dieser Normalisierer kann auch von Tagen zu Monaten konvertieren .
* Beispiel : < / p >
* < pre >
* Duration & lt ; CalendarUnit & gt ; dur = Duration . of ( 30 , CalendarUnit . DAYS ) ;
* Duration & lt ; CalendarUnit & gt ; result =
* PlainDate . of ( 2012 , 2 , 28 ) . normalize ( dur ) ;
* System . out . println ( result ) ; / / Ausgabe : P1M1D ( Schaltjahr ! )
* < / pre >
* @ param timespan to be normalized
* @ return normalized duration in years , months and days */
@ Override public Duration < CalendarUnit > normalize ( TimeSpan < ? extends CalendarUnit > timespan ) { } } | return this . until ( this . plus ( timespan ) , Duration . inYearsMonthsDays ( ) ) ; |
public class AttributeSetElement { /** * Append base table if not added already from other element .
* @ param _ sqlSelect the sql select
* @ param _ sqlTable the sql table */
protected void appendBaseTable ( final SQLSelect _sqlSelect , final SQLTable _sqlTable ) { } } | if ( _sqlSelect . getFromTables ( ) . isEmpty ( ) ) { final TableIdx tableidx = _sqlSelect . getIndexer ( ) . getTableIdx ( _sqlTable . getSqlTable ( ) ) ; if ( tableidx . isCreated ( ) ) { _sqlSelect . from ( tableidx . getTable ( ) , tableidx . getIdx ( ) ) ; } } |
public class AmazonSnowballClient { /** * Returns the < code > UnlockCode < / code > code value for the specified job . A particular < code > UnlockCode < / code > value
* can be accessed for up to 90 days after the associated job has been created .
* The < code > UnlockCode < / code > value is a 29 - character code with 25 alphanumeric characters and 4 hyphens . This code
* is used to decrypt the manifest file when it is passed along with the manifest to the Snowball through the
* Snowball client when the client is started for the first time .
* As a best practice , we recommend that you don ' t save a copy of the < code > UnlockCode < / code > in the same location
* as the manifest file for that job . Saving these separately helps prevent unauthorized parties from gaining access
* to the Snowball associated with that job .
* @ param getJobUnlockCodeRequest
* @ return Result of the GetJobUnlockCode operation returned by the service .
* @ throws InvalidResourceException
* The specified resource can ' t be found . Check the information you provided in your last request , and try
* again .
* @ throws InvalidJobStateException
* The action can ' t be performed because the job ' s current state doesn ' t allow that action to be performed .
* @ sample AmazonSnowball . GetJobUnlockCode
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / snowball - 2016-06-30 / GetJobUnlockCode " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public GetJobUnlockCodeResult getJobUnlockCode ( GetJobUnlockCodeRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeGetJobUnlockCode ( request ) ; |
public class AbstractRegionPainter { /** * Returns a new color with the saturation cut to one third the original ,
* and the brightness moved one third closer to white .
* @ param color the original color .
* @ return the new color . */
protected Color desaturate ( Color color ) { } } | float [ ] tmp = Color . RGBtoHSB ( color . getRed ( ) , color . getGreen ( ) , color . getBlue ( ) , null ) ; tmp [ 1 ] /= 3.0f ; tmp [ 2 ] = clamp ( 1.0f - ( 1.0f - tmp [ 2 ] ) / 3f ) ; return new Color ( ( Color . HSBtoRGB ( tmp [ 0 ] , tmp [ 1 ] , tmp [ 2 ] ) & 0xFFFFFF ) ) ; |
public class HtmlDocletWriter { /** * Get the type name for profile search .
* @ param cd the classDoc object for which the type name conversion is needed
* @ return a type name string for the type */
public String getTypeNameForProfile ( ClassDoc cd ) { } } | StringBuilder typeName = new StringBuilder ( ( cd . containingPackage ( ) ) . name ( ) . replace ( "." , "/" ) ) ; typeName . append ( "/" ) . append ( cd . name ( ) . replace ( "." , "$" ) ) ; return typeName . toString ( ) ; |
public class LogAction { /** * 显示登陆次数 */
public String loginCountStat ( ) { } } | OqlBuilder < SessioninfoLogBean > query = OqlBuilder . from ( SessioninfoLogBean . class , "sessioninfoLog" ) ; addConditions ( query ) ; query . select ( "sessioninfoLog.username,sessioninfoLog.fullname,count(*)" ) . groupBy ( "sessioninfoLog.username,sessioninfoLog.fullname" ) . orderBy ( get ( "orderBy" ) ) . limit ( getPageLimit ( ) ) ; put ( "loginCountStats" , entityDao . search ( query ) ) ; return forward ( ) ; |
public class HessianOutput { /** * Replaces a reference from one object to another . */
public boolean replaceRef ( Object oldRef , Object newRef ) throws IOException { } } | Integer value = ( Integer ) _refs . remove ( oldRef ) ; if ( value != null ) { _refs . put ( newRef , value ) ; return true ; } else return false ; |
public class IonTextUtils { /** * @ param token the symbolToken to be printed .
* @ return a string representing the symboltoken . */
public static String printSymbol ( SymbolToken token ) { } } | return String . format ( "{$%s:%s}" , token . getText ( ) , token . getSid ( ) ) ; |
public class MapcodeCodec { /** * Is coordinate near multiple territory borders ?
* @ param point Latitude / Longitude in degrees .
* @ param territory Territory .
* @ return true Iff the coordinate is near more than one territory border ( and thus encode ( decode ( M ) ) may not produce M ) . */
public static boolean isNearMultipleBorders ( @ Nonnull final Point point , @ Nonnull final Territory territory ) { } } | checkDefined ( "point" , point ) ; if ( territory != Territory . AAA ) { final int territoryNumber = territory . getNumber ( ) ; if ( territory . getParentTerritory ( ) != null ) { // There is a parent ! check its borders as well . . .
if ( isNearMultipleBorders ( point , territory . getParentTerritory ( ) ) ) { return true ; } } int nrFound = 0 ; final int fromTerritoryRecord = DATA_MODEL . getDataFirstRecord ( territoryNumber ) ; final int uptoTerritoryRecord = DATA_MODEL . getDataLastRecord ( territoryNumber ) ; for ( int territoryRecord = uptoTerritoryRecord ; territoryRecord >= fromTerritoryRecord ; territoryRecord -- ) { if ( ! Data . isRestricted ( territoryRecord ) ) { final Boundary boundary = Boundary . createBoundaryForTerritoryRecord ( territoryRecord ) ; final int xdiv8 = Common . xDivider ( boundary . getLatMicroDegMin ( ) , boundary . getLatMicroDegMax ( ) ) / 4 ; if ( boundary . extendBoundary ( 60 , xdiv8 ) . containsPoint ( point ) ) { if ( ! boundary . extendBoundary ( - 60 , - xdiv8 ) . containsPoint ( point ) ) { nrFound ++ ; if ( nrFound > 1 ) { return true ; } } } } } } return false ; |
public class ProductSegmentation { /** * Sets the mobileDeviceSubmodelSegment value for this ProductSegmentation .
* @ param mobileDeviceSubmodelSegment * The mobile device submodel segmentation . { @ link
* MobileDeviceSubmodelTargeting # excludedMobileDeviceSubmodels }
* must be empty or null . */
public void setMobileDeviceSubmodelSegment ( com . google . api . ads . admanager . axis . v201811 . MobileDeviceSubmodelTargeting mobileDeviceSubmodelSegment ) { } } | this . mobileDeviceSubmodelSegment = mobileDeviceSubmodelSegment ; |
public class ProtoLexer { /** * $ ANTLR start " DOUBLE " */
public final void mDOUBLE ( ) throws RecognitionException { } } | try { int _type = DOUBLE ; int _channel = DEFAULT_TOKEN_CHANNEL ; // com / dyuproject / protostuff / parser / ProtoLexer . g : 199:5 : ( ' double ' )
// com / dyuproject / protostuff / parser / ProtoLexer . g : 199:9 : ' double '
{ match ( "double" ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class OggPacketReader { /** * Skips forward until the first packet with a Granule Position
* of equal or greater than that specified . Call { @ link # getNextPacket ( ) }
* to retrieve this packet .
* This method advances across all streams , but only searches the
* specified one .
* @ param sid The ID of the stream who ' s packets we will search
* @ param granulePosition The granule position we ' re looking for */
public void skipToGranulePosition ( int sid , long granulePosition ) throws IOException { } } | OggPacket p = null ; while ( ( p = getNextPacket ( ) ) != null ) { if ( p . getSid ( ) == sid && p . getGranulePosition ( ) >= granulePosition ) { nextPacket = p ; break ; } } |
public class Nucleotide { /** * return the natural analog of this nucleotide
* @ param monomerStore - store in which base monomer is located
* @ return natural Analog or X if natural analog is not available */
public String getNaturalAnalog ( MonomerStore monomerStore ) { } } | String baseNotation = null ; String notation = getNotation ( ) ; char [ ] notationChar = notation . toCharArray ( ) ; for ( int i = 0 ; i < notationChar . length ; i ++ ) { if ( notationChar [ i ] == '[' ) { int pos = NucleotideParser . getMatchingBracketPosition ( notationChar , i , '[' , ']' ) ; i = pos ; continue ; } // must be the base
if ( notationChar [ i ] == '(' ) { int pos = NucleotideParser . getMatchingBracketPosition ( notationChar , i , '(' , ')' ) ; baseNotation = notation . substring ( i + 1 , pos ) ; break ; } } // No base found
if ( baseNotation == null ) { return "X" ; } // remove first and last bracket
if ( ( baseNotation . charAt ( 0 ) == '[' ) && ( baseNotation . charAt ( baseNotation . length ( ) - 1 ) == ']' ) ) { baseNotation = baseNotation . substring ( 1 , baseNotation . length ( ) - 1 ) ; } else { baseNotation = baseNotation ; } try { Map < String , Monomer > monomers = monomerStore . getMonomers ( Monomer . NUCLIEC_ACID_POLYMER_TYPE ) ; Monomer m = monomers . get ( baseNotation ) ; if ( m == null ) { Map < String , Monomer > smiles = monomerStore . getSmilesMonomerDB ( ) ; m = smiles . get ( baseNotation ) ; } return m . getNaturalAnalog ( ) ; } catch ( Exception e ) { LOG . info ( "Unable to get natural analog for " + baseNotation ) ; return "X" ; } |
public class RangeStringParser { /** * Checks that right boundary is greater than left boundary .
* @ param rc
* The range configuration
* @ throws RangeException
* If right < left */
private static void checkBoundaries ( final RangeConfig rc ) throws RangeException { } } | if ( rc . isNegativeInfinity ( ) ) { // No other checks necessary . Negative infinity is less than any
// number
return ; } if ( rc . isPositiveInfinity ( ) ) { // No other checks necessary . Positive infinity is greater than any
// number
return ; } if ( rc . getLeftBoundary ( ) . compareTo ( rc . getRightBoundary ( ) ) > 0 ) { throw new RangeException ( "Left boundary must be less than right boundary (left:" + rc . getLeftBoundary ( ) + ", right:" + rc . getRightBoundary ( ) + ")" ) ; } |
public class AWSServiceCatalogClient { /** * Lists the paths to the specified product . A path is how the user has access to a specified product , and is
* necessary when provisioning a product . A path also determines the constraints put on the product .
* @ param listLaunchPathsRequest
* @ return Result of the ListLaunchPaths operation returned by the service .
* @ throws InvalidParametersException
* One or more parameters provided to the operation are not valid .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ sample AWSServiceCatalog . ListLaunchPaths
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / servicecatalog - 2015-12-10 / ListLaunchPaths " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public ListLaunchPathsResult listLaunchPaths ( ListLaunchPathsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListLaunchPaths ( request ) ; |
public class nd6ravariables { /** * Use this API to fetch filtered set of nd6ravariables resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static nd6ravariables [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | nd6ravariables obj = new nd6ravariables ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; nd6ravariables [ ] response = ( nd6ravariables [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class SceneBlock { /** * Returns the index into our arrays of the specified tile . */
protected final int index ( int tx , int ty ) { } } | // if ( ! _ bounds . contains ( tx , ty ) ) {
// String errmsg = " Coordinates out of bounds : + " + tx + " + " + ty +
// " not in " + StringUtil . toString ( _ bounds ) ;
// throw new IllegalArgumentException ( errmsg ) ;
return ( ty - _bounds . y ) * _bounds . width + ( tx - _bounds . x ) ; |
public class ODatabaseObjectTxPooled { /** * Avoid to close it but rather release itself to the owner pool . */
@ Override public void close ( ) { } } | if ( isClosed ( ) ) return ; objects2Records . clear ( ) ; records2Objects . clear ( ) ; rid2Records . clear ( ) ; checkOpeness ( ) ; rollback ( ) ; getMetadata ( ) . close ( ) ; ( ( ODatabaseRaw ) ( ( ODatabaseRecord ) underlying . getUnderlying ( ) ) . getUnderlying ( ) ) . callOnCloseListeners ( ) ; getLevel1Cache ( ) . clear ( ) ; ownerPool . release ( this ) ; ownerPool = null ; |
public class MongoDbConnectionFactory { /** * Build mongo db client .
* @ param mongo the mongo
* @ return the mongo client */
public static MongoClient buildMongoDbClient ( final BaseMongoDbProperties mongo ) { } } | if ( StringUtils . isNotBlank ( mongo . getClientUri ( ) ) ) { LOGGER . debug ( "Using MongoDb client URI [{}] to connect to MongoDb instance" , mongo . getClientUri ( ) ) ; return buildMongoDbClient ( mongo . getClientUri ( ) , buildMongoDbClientOptions ( mongo ) ) ; } val serverAddresses = mongo . getHost ( ) . split ( "," ) ; if ( serverAddresses . length == 0 ) { throw new BeanCreationException ( "Unable to build a MongoDb client without any hosts/servers defined" ) ; } List < ServerAddress > servers = new ArrayList < > ( ) ; if ( serverAddresses . length > 1 ) { LOGGER . debug ( "Multiple MongoDb server addresses are defined. Ignoring port [{}], " + "assuming ports are defined as part of the address" , mongo . getPort ( ) ) ; servers = Arrays . stream ( serverAddresses ) . filter ( StringUtils :: isNotBlank ) . map ( ServerAddress :: new ) . collect ( Collectors . toList ( ) ) ; } else { val port = mongo . getPort ( ) > 0 ? mongo . getPort ( ) : DEFAULT_PORT ; LOGGER . debug ( "Found single MongoDb server address [{}] using port [{}]" , mongo . getHost ( ) , port ) ; val addr = new ServerAddress ( mongo . getHost ( ) , port ) ; servers . add ( addr ) ; } val credential = buildMongoCredential ( mongo ) ; return new MongoClient ( servers , CollectionUtils . wrap ( credential ) , buildMongoDbClientOptions ( mongo ) ) ; |
public class ExecutePLSQLAction { /** * Create SQL statements from inline script .
* @ param context the current test context .
* @ return list of SQL statements . */
private List < String > createStatementsFromScript ( TestContext context ) { } } | List < String > stmts = new ArrayList < > ( ) ; script = context . replaceDynamicContentInString ( script ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Found inline PLSQL script " + script ) ; } StringTokenizer tok = new StringTokenizer ( script , PLSQL_STMT_ENDING ) ; while ( tok . hasMoreTokens ( ) ) { String next = tok . nextToken ( ) . trim ( ) ; if ( StringUtils . hasText ( next ) ) { stmts . add ( next ) ; } } return stmts ; |
public class CallableRejectionConfig { /** * Return the object that helps the UI rendering by providing the details . */
public List < RejectedCallable > describe ( ) { } } | List < RejectedCallable > l = new ArrayList < > ( ) ; for ( Class c : get ( ) ) { if ( ! whitelist . contains ( c . getName ( ) ) ) l . add ( new RejectedCallable ( c ) ) ; } return l ; |
public class ProcedureStatsCollector { /** * Specifies the columns of statistics that are added by this class to the schema of a statistical results .
* @ param columns List of columns that are in a stats row . */
@ Override protected void populateColumnSchema ( ArrayList < VoltTable . ColumnInfo > columns ) { } } | super . populateColumnSchema ( columns ) ; columns . add ( new VoltTable . ColumnInfo ( "PARTITION_ID" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "PROCEDURE" , VoltType . STRING ) ) ; columns . add ( new VoltTable . ColumnInfo ( "STATEMENT" , VoltType . STRING ) ) ; columns . add ( new VoltTable . ColumnInfo ( "INVOCATIONS" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "TIMED_INVOCATIONS" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MIN_EXECUTION_TIME" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MAX_EXECUTION_TIME" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "AVG_EXECUTION_TIME" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MIN_RESULT_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MAX_RESULT_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "AVG_RESULT_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MIN_PARAMETER_SET_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "MAX_PARAMETER_SET_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "AVG_PARAMETER_SET_SIZE" , VoltType . INTEGER ) ) ; columns . add ( new VoltTable . ColumnInfo ( "ABORTS" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "FAILURES" , VoltType . BIGINT ) ) ; columns . add ( new VoltTable . ColumnInfo ( "TRANSACTIONAL" , VoltType . TINYINT ) ) ; |
public class ThreadSet { /** * Extract the only thread from set .
* @ throws IllegalStateException if not exactly one thread present . */
public @ Nonnull ThreadType onlyThread ( ) throws IllegalStateException { } } | if ( size ( ) != 1 ) throw new IllegalStateException ( "Exactly one thread expected in the set. Found " + size ( ) ) ; return threads . iterator ( ) . next ( ) ; |
public class JQMForm { /** * Set a general error on the form . */
public void setError ( String string ) { } } | Label errorLabel = new Label ( string ) ; errorLabel . setStyleName ( JQM4GWT_ERROR_LABEL_STYLENAME ) ; errorLabel . addStyleName ( JQM4GWT_GENERAL_ERROR_LABEL_STYLENAME ) ; generalErrors . add ( errorLabel ) ; generalErrors . getElement ( ) . scrollIntoView ( ) ; |
public class PurchaseScheduledInstancesResult { /** * Information about the Scheduled Instances .
* @ param scheduledInstanceSet
* Information about the Scheduled Instances . */
public void setScheduledInstanceSet ( java . util . Collection < ScheduledInstance > scheduledInstanceSet ) { } } | if ( scheduledInstanceSet == null ) { this . scheduledInstanceSet = null ; return ; } this . scheduledInstanceSet = new com . amazonaws . internal . SdkInternalList < ScheduledInstance > ( scheduledInstanceSet ) ; |
public class ModelListAction { /** * 获得ModelListForm实例
* @ param actionMapping
* @ param actionForm
* @ param request
* @ return
* @ throws java . lang . Exception */
protected ModelListForm getModelListForm ( ActionMapping actionMapping , ActionForm actionForm , HttpServletRequest request ) throws Exception { } } | ModelListForm modelListForm = null ; if ( actionForm == null ) { modelListForm = new ModelListForm ( ) ; FormBeanUtil . saveActionForm ( modelListForm , actionMapping , request ) ; } else if ( actionForm instanceof ModelListForm ) modelListForm = ( ModelListForm ) actionForm ; if ( modelListForm == null ) throw new Exception ( "not found the bean of com.jdon.strutsutil.ModelListForm" ) ; else return modelListForm ; |
public class ClassNode { /** * Accept a visitor that visit all public descendants of the
* class represented by this ` ClassNode ` NOT including this ` ClassNode ` itself
* @ param visitor the function that take ` ClassNode ` as argument
* @ return this ` ClassNode ` instance */
public ClassNode visitPublicNotAbstractSubTreeNodes ( $ . Visitor < ClassNode > visitor ) { } } | return visitSubTree ( $ . guardedVisitor ( new $ . Predicate < ClassNode > ( ) { @ Override public boolean test ( ClassNode classNode ) { return classNode . publicNotAbstract ( ) ; } } , visitor ) ) ; |
public class AWSDatabaseMigrationServiceClient { /** * Modifies the settings for the specified replication subnet group .
* @ param modifyReplicationSubnetGroupRequest
* @ return Result of the ModifyReplicationSubnetGroup operation returned by the service .
* @ throws AccessDeniedException
* AWS DMS was denied access to the endpoint . Check that the role is correctly configured .
* @ throws ResourceNotFoundException
* The resource could not be found .
* @ throws ResourceQuotaExceededException
* The quota for this resource quota has been exceeded .
* @ throws SubnetAlreadyInUseException
* The specified subnet is already in use .
* @ throws ReplicationSubnetGroupDoesNotCoverEnoughAZsException
* The replication subnet group does not cover enough Availability Zones ( AZs ) . Edit the replication subnet
* group and add more AZs .
* @ throws InvalidSubnetException
* The subnet provided is invalid .
* @ sample AWSDatabaseMigrationService . ModifyReplicationSubnetGroup
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / dms - 2016-01-01 / ModifyReplicationSubnetGroup "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ModifyReplicationSubnetGroupResult modifyReplicationSubnetGroup ( ModifyReplicationSubnetGroupRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeModifyReplicationSubnetGroup ( request ) ; |
public class HBasePanel { /** * Add this hidden param to the output stream .
* @ param out The html output stream .
* @ param strParam The parameter .
* @ param strValue The param ' s value . */
public void addHiddenParam ( PrintWriter out , String strParam , String strValue ) { } } | out . println ( "<input type=\"hidden\" name=\"" + strParam + "\" value=\"" + strValue + "\">" ) ; |
public class PubSubManager { /** * CHECKSTYLE : OFF : RegexpSingleline */
public static PubSubManager getInstanceFor ( XMPPConnection connection ) { } } | // CHECKSTYLE : ON : RegexpSingleline
DomainBareJid pubSubService = null ; if ( connection . isAuthenticated ( ) ) { try { pubSubService = getPubSubService ( connection ) ; } catch ( NoResponseException | XMPPErrorException | NotConnectedException e ) { LOGGER . log ( Level . WARNING , "Could not determine PubSub service" , e ) ; } catch ( InterruptedException e ) { LOGGER . log ( Level . FINE , "Interrupted while trying to determine PubSub service" , e ) ; } } if ( pubSubService == null ) { try { // Perform an educated guess about what the PubSub service ' s domain bare JID may be
pubSubService = JidCreate . domainBareFrom ( "pubsub." + connection . getXMPPServiceDomain ( ) ) ; } catch ( XmppStringprepException e ) { throw new RuntimeException ( e ) ; } } return getInstanceFor ( connection , pubSubService ) ; |
public class MRAsyncDiskService { /** * Move the path name to a temporary location and then delete it .
* Note that if there is no volume that contains this path , the path
* will stay as it is , and the function will return false .
* This functions returns when the moves are done , but not necessarily all
* deletions are done . This is usually good enough because applications
* won ' t see the path name under the old name anyway after the move .
* @ param absolutePathName The path name from root " / "
* @ throws IOException If the move failed
* @ return false if we are unable to move the path name */
public boolean moveAndDeleteAbsolutePath ( String absolutePathName ) throws IOException { } } | for ( int v = 0 ; v < volumes . length ; v ++ ) { String relative = getRelativePathName ( absolutePathName , volumes [ v ] ) ; if ( relative != null ) { return moveAndDeleteRelativePath ( volumes [ v ] , relative ) ; } } throw new IOException ( "Cannot delete " + absolutePathName + " because it's outside of all volumes." ) ; |
public class PriorityQueue { /** * Returns true iff this priority queue is empty .
* @ throws SIConnectionDroppedException if the priorty queue has been
* closed or purged .
* @ return True iff this priority queue is empty . */
public boolean isEmpty ( ) throws SIConnectionDroppedException { } } | synchronized ( queueMonitor ) { if ( state == CLOSED ) throw new SIConnectionDroppedException ( TraceNLS . getFormattedMessage ( JFapChannelConstants . MSG_BUNDLE , "PRIORITY_QUEUE_PURGED_SICJ0077" , null , "PRIORITY_QUEUE_PURGED_SICJ0077" ) ) ; return totalQueueDepth == 0 ; } |
public class BermudanSwaption { /** * Return the conditional expectation estimator suitable for this product .
* @ param fixingDate The condition time .
* @ param model The model
* @ return The conditional expectation estimator suitable for this product
* @ throws net . finmath . exception . CalculationException Thrown if the valuation fails , specific cause may be available via the < code > cause ( ) < / code > method . */
public ConditionalExpectationEstimatorInterface getConditionalExpectationEstimator ( double fixingDate , LIBORModelMonteCarloSimulationInterface model ) throws CalculationException { } } | MonteCarloConditionalExpectationRegression condExpEstimator = new MonteCarloConditionalExpectationRegression ( getRegressionBasisFunctions ( fixingDate , model ) ) ; return condExpEstimator ; |
public class PoissonDistribution { /** * Poisson probability mass function ( PMF ) for integer values .
* @ param x integer values
* @ return Probability */
@ Reference ( title = "Fast and accurate computation of binomial probabilities" , authors = "C. Loader" , booktitle = "" , url = "http://projects.scipy.org/scipy/raw-attachment/ticket/620/loader2000Fast.pdf" , bibkey = "web/Loader00" ) public static double pmf ( double x , int n , double p ) { } } | // Invalid values
if ( x < 0 || x > n ) { return 0. ; } // Extreme probabilities
if ( p <= 0. ) { return x == 0 ? 1. : 0. ; } if ( p >= 1. ) { return x == n ? 1. : 0. ; } final double q = 1 - p ; // FIXME : check for x to be integer , return 0 otherwise ?
// Extreme values of x
if ( x == 0 ) { if ( p < .1 ) { return FastMath . exp ( - devianceTerm ( n , n * q ) - n * p ) ; } else { return FastMath . exp ( n * FastMath . log ( q ) ) ; } } if ( x == n ) { if ( p > .9 ) { return FastMath . exp ( - devianceTerm ( n , n * p ) - n * q ) ; } else { return FastMath . exp ( n * FastMath . log ( p ) ) ; } } final double lc = stirlingError ( n ) - stirlingError ( x ) - stirlingError ( n - x ) - devianceTerm ( x , n * p ) - devianceTerm ( n - x , n * q ) ; final double f = ( MathUtil . TWOPI * x * ( n - x ) ) / n ; return FastMath . exp ( lc ) / FastMath . sqrt ( f ) ; |
public class VirtualMachinesInner { /** * The operation to create or update a virtual machine .
* @ param resourceGroupName The name of the resource group .
* @ param vmName The name of the virtual machine .
* @ param parameters Parameters supplied to the Create Virtual Machine operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < VirtualMachineInner > createOrUpdateAsync ( String resourceGroupName , String vmName , VirtualMachineInner parameters ) { } } | return createOrUpdateWithServiceResponseAsync ( resourceGroupName , vmName , parameters ) . map ( new Func1 < ServiceResponse < VirtualMachineInner > , VirtualMachineInner > ( ) { @ Override public VirtualMachineInner call ( ServiceResponse < VirtualMachineInner > response ) { return response . body ( ) ; } } ) ; |
public class Element { /** * Simulates moving the mouse around while the cursor is pressed . Can be
* used for drawing on canvases , or swiping on certain elements . Note , this is not supported in HTMLUNIT
* @ param points - a list of points to connect . At least one point must be
* provided in the list */
public void draw ( List < Point < Integer , Integer > > points ) { } } | if ( points . isEmpty ( ) ) { reporter . fail ( "Drawing object in " + prettyOutput ( ) , "Drew object in " + prettyOutput ( ) , "Unable to draw in " + prettyOutput ( ) + " as no points were supplied" ) ; return ; } StringBuilder pointString = new StringBuilder ( ) ; String prefix = "" ; for ( Point < Integer , Integer > point : points ) { pointString . append ( prefix ) ; prefix = " to " ; pointString . append ( "<i>" ) . append ( point . getX ( ) ) . append ( "x" ) . append ( point . getY ( ) ) . append ( "</i>" ) ; } String action = "Drawing object from " + pointString . toString ( ) + " in " + prettyOutput ( ) ; String expected = prettyOutputStart ( ) + " now has object drawn on it from " + pointString . toString ( ) ; try { // wait for element to be present , displayed , and enabled
if ( isNotPresentDisplayedEnabled ( action , expected , "Unable to drawn in " ) ) { return ; } WebElement webElement = getWebElement ( ) ; // do our actions
Actions builder = new Actions ( driver ) ; Point < Integer , Integer > firstPoint = points . get ( 0 ) ; points . remove ( 0 ) ; builder . moveToElement ( webElement , firstPoint . getX ( ) , firstPoint . getY ( ) ) . clickAndHold ( ) ; for ( Point < Integer , Integer > point : points ) { builder . moveByOffset ( point . getX ( ) , point . getY ( ) ) ; } Action drawAction = builder . release ( ) . build ( ) ; drawAction . perform ( ) ; } catch ( Exception e ) { log . error ( e ) ; reporter . fail ( action , expected , "Unable to draw in " + prettyOutputEnd ( ) + e . getMessage ( ) ) ; return ; } reporter . pass ( action , expected , "Drew object in " + prettyOutput ( ) + getScreenshot ( ) ) ; |
public class EJBMDOrchestratorImpl { /** * d456907 */
private void validateEJBBindings ( BeanMetaData bmd ) // F743-36290.1
throws EJBConfigurationException { } } | // Check out the binding ( s ) that have been specified for this bean and / or it ' s home .
// When business interface bindings are supplied there needs to be a matching business interface
// class for each of the bindings . Also , local buisiness interface bindgins must begin with
// " ejblocal : " and remote business interface bindings must NOT begin with " ejblocal : " .
// If a home binding has been specified , there needs to be a matcthing home interface . Also ,
// local home bindings must begin with " ejblocal : " , and remote home bindings must NOT begin with " ejblocal : " .
// Since all of the checks in this section only apply to EJB3 beans so we will throw an exception
// and fail application start if any of the listed configuration errors are detected .
if ( bmd . businessInterfaceJndiBindingNames != null ) { for ( Map . Entry < String , String > entry : bmd . businessInterfaceJndiBindingNames . entrySet ( ) ) { String bindingInterface = entry . getKey ( ) ; String bindingValue = entry . getValue ( ) ; boolean matchFound = false ; String [ ] localBusinessInterfaces = bmd . ivBusinessLocalInterfaceClassNames ; if ( localBusinessInterfaces != null ) { for ( String localBusinessInterface : localBusinessInterfaces ) { if ( bindingInterface . equals ( localBusinessInterface ) ) { matchFound = true ; // Also , make sure binding for this local business interface begins with ejblocal :
if ( ! bindingValue . startsWith ( EJBLOCAL_BINDING_PREFIX ) ) { Tr . error ( tc , "IMPROPER_LOCAL_JNDI_BINDING_PREFIX_CNTR0136E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bindingValue } ) ; throw new EJBConfigurationException ( "The specific Java Naming and Directory Interface (JNDI)" + " binding name provided for a local bean does not begin with" + " ejblocal:. The " + bindingValue + " binding name that is specified for the " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module does not begin with ejblocal:." ) ; } } } } String [ ] remoteBusinessInterfaces = bmd . ivBusinessRemoteInterfaceClassNames ; if ( remoteBusinessInterfaces != null ) { for ( String remoteBusinessInterface : remoteBusinessInterfaces ) { if ( bindingInterface . equals ( remoteBusinessInterface ) ) { matchFound = true ; // Also , make sure binding for this remote business interface does NOT begin with ejblocal :
if ( bindingValue . startsWith ( EJBLOCAL_BINDING_PREFIX ) ) { Tr . error ( tc , "IMPROPER_REMOTE_JNDI_BINDING_PREFIX_CNTR0137E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bindingValue } ) ; throw new EJBConfigurationException ( "The specific Java Naming and Directory Interface (JNDI)" + " binding name that is provided for a remote" + " bean begins with ejblocal:. The " + bindingValue + " remote binding name that is specified for the " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module cannot begin with ejblocal:." ) ; } } } } if ( bmd . ivLocalBean ) // d617690
{ if ( bindingInterface . equals ( bmd . enterpriseBeanClassName ) ) // F743-1756.3
{ matchFound = true ; // Also , make sure binding for this local interface begins with ejblocal :
if ( ! bindingValue . startsWith ( EJBLOCAL_BINDING_PREFIX ) ) { Tr . error ( tc , "IMPROPER_LOCAL_JNDI_BINDING_PREFIX_CNTR0136E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bindingValue } ) ; throw new EJBConfigurationException ( "The specific Java Naming and Directory Interface (JNDI)" + " binding name provided for a local bean does not begin with" + " ejblocal:. The " + bindingValue + " binding name that is specified for the " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module does not begin with ejblocal:." ) ; } } } if ( ! matchFound ) { Tr . error ( tc , "JNDI_BINDING_HAS_NO_CORRESPONDING_BUSINESS_INTERFACE_CLASS_CNTR0140E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bindingInterface } ) ; throw new EJBConfigurationException ( "The " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module has specified the [" + bindingInterface + "] business interface, which does not exist" + " for a business interface Java Naming and Directory Interface (JNDI) binding." ) ; } } } if ( bmd . localHomeJndiBindingName != null ) { if ( bmd . localHomeInterfaceClassName == null ) { Tr . error ( tc , "JNDI_BINDING_HAS_NO_CORRESPONDING_HOME_INTERFACE_CLASS_CNTR0141E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName } ) ; throw new EJBConfigurationException ( "The " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module has specified a home Java Naming and Directory Interface (JNDI)" + " binding. The binding does not have a matching home interface class." ) ; } if ( ! bmd . localHomeJndiBindingName . startsWith ( EJBLOCAL_BINDING_PREFIX ) ) { Tr . error ( tc , "IMPROPER_LOCAL_JNDI_BINDING_PREFIX_CNTR0136E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bmd . localHomeJndiBindingName } ) ; throw new EJBConfigurationException ( "The specific Java Naming and Directory Interface (JNDI)" + " binding name provided for a local home does not begin with" + " ejblocal:. The " + bmd . localHomeJndiBindingName + " binding name that is specified for the home of " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module does not begin with ejblocal:." ) ; } } if ( bmd . remoteHomeJndiBindingName != null ) { if ( bmd . homeInterfaceClassName == null ) { Tr . error ( tc , "JNDI_BINDING_HAS_NO_CORRESPONDING_HOME_INTERFACE_CLASS_CNTR0141E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName } ) ; throw new EJBConfigurationException ( "The " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module has specified a home Java Naming and Directory Interface (JNDI)" + " binding. The binding does not have a matching home interface class." ) ; } if ( bmd . remoteHomeJndiBindingName . startsWith ( EJBLOCAL_BINDING_PREFIX ) ) { Tr . error ( tc , "IMPROPER_REMOTE_JNDI_BINDING_PREFIX_CNTR0137E" , new Object [ ] { bmd . enterpriseBeanName , bmd . _moduleMetaData . ivName , bmd . remoteHomeJndiBindingName } ) ; throw new EJBConfigurationException ( "The specific Java Naming and Directory Interface (JNDI)" + " binding name that is provided for a remote" + " home begins with ejblocal:. The " + bmd . remoteHomeJndiBindingName + " remote binding name that is specified for the home of " + bmd . enterpriseBeanName + " bean in the " + bmd . _moduleMetaData . ivName + " module cannot begin with ejblocal:." ) ; } } |
public class ZigZagEncoding { /** * Read an LEB128-64b9B ZigZag encoded long value from the given buffer
* @ param buffer the buffer to read from
* @ return the value read from the buffer */
static long getLong ( ByteBuffer buffer ) { } } | long v = buffer . get ( ) ; long value = v & 0x7F ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 7 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 14 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 21 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 28 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 35 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 42 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= ( v & 0x7F ) << 49 ; if ( ( v & 0x80 ) != 0 ) { v = buffer . get ( ) ; value |= v << 56 ; } } } } } } } } value = ( value >>> 1 ) ^ ( - ( value & 1 ) ) ; return value ; |
public class WorkspacesApi { /** * List File Pages
* Retrieves a workspace file as rasterized pages .
* @ param accountId The external account number ( int ) or account ID Guid . ( required )
* @ param workspaceId Specifies the workspace ID GUID . ( required )
* @ param folderId The ID of the folder being accessed . ( required )
* @ param fileId Specifies the room file ID GUID . ( required )
* @ param options for modifying the method behavior .
* @ return PageImages
* @ throws ApiException if fails to make API call */
public PageImages listWorkspaceFilePages ( String accountId , String workspaceId , String folderId , String fileId , WorkspacesApi . ListWorkspaceFilePagesOptions options ) throws ApiException { } } | Object localVarPostBody = "{}" ; // verify the required parameter ' accountId ' is set
if ( accountId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'accountId' when calling listWorkspaceFilePages" ) ; } // verify the required parameter ' workspaceId ' is set
if ( workspaceId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'workspaceId' when calling listWorkspaceFilePages" ) ; } // verify the required parameter ' folderId ' is set
if ( folderId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'folderId' when calling listWorkspaceFilePages" ) ; } // verify the required parameter ' fileId ' is set
if ( fileId == null ) { throw new ApiException ( 400 , "Missing the required parameter 'fileId' when calling listWorkspaceFilePages" ) ; } // create path and map variables
String localVarPath = "/v2/accounts/{accountId}/workspaces/{workspaceId}/folders/{folderId}/files/{fileId}/pages" . replaceAll ( "\\{format\\}" , "json" ) . replaceAll ( "\\{" + "accountId" + "\\}" , apiClient . escapeString ( accountId . toString ( ) ) ) . replaceAll ( "\\{" + "workspaceId" + "\\}" , apiClient . escapeString ( workspaceId . toString ( ) ) ) . replaceAll ( "\\{" + "folderId" + "\\}" , apiClient . escapeString ( folderId . toString ( ) ) ) . replaceAll ( "\\{" + "fileId" + "\\}" , apiClient . escapeString ( fileId . toString ( ) ) ) ; // query params
java . util . List < Pair > localVarQueryParams = new java . util . ArrayList < Pair > ( ) ; java . util . Map < String , String > localVarHeaderParams = new java . util . HashMap < String , String > ( ) ; java . util . Map < String , Object > localVarFormParams = new java . util . HashMap < String , Object > ( ) ; if ( options != null ) { localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "count" , options . count ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "dpi" , options . dpi ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "max_height" , options . maxHeight ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "max_width" , options . maxWidth ) ) ; localVarQueryParams . addAll ( apiClient . parameterToPairs ( "" , "start_position" , options . startPosition ) ) ; } final String [ ] localVarAccepts = { "application/json" } ; final String localVarAccept = apiClient . selectHeaderAccept ( localVarAccepts ) ; final String [ ] localVarContentTypes = { } ; final String localVarContentType = apiClient . selectHeaderContentType ( localVarContentTypes ) ; String [ ] localVarAuthNames = new String [ ] { "docusignAccessCode" } ; GenericType < PageImages > localVarReturnType = new GenericType < PageImages > ( ) { } ; return apiClient . invokeAPI ( localVarPath , "GET" , localVarQueryParams , localVarPostBody , localVarHeaderParams , localVarFormParams , localVarAccept , localVarContentType , localVarAuthNames , localVarReturnType ) ; |
public class LinkedInTemplate { /** * private helpers */
private void registerLinkedInJsonModule ( ) { } } | List < HttpMessageConverter < ? > > converters = getRestTemplate ( ) . getMessageConverters ( ) ; for ( HttpMessageConverter < ? > converter : converters ) { if ( converter instanceof MappingJackson2HttpMessageConverter ) { MappingJackson2HttpMessageConverter jsonConverter = ( MappingJackson2HttpMessageConverter ) converter ; objectMapper = new ObjectMapper ( ) ; objectMapper . registerModule ( new LinkedInModule ( ) ) ; objectMapper . configure ( SerializationFeature . WRITE_ENUMS_USING_TO_STRING , true ) ; objectMapper . configure ( Feature . ALLOW_NUMERIC_LEADING_ZEROS , true ) ; objectMapper . setSerializationInclusion ( JsonInclude . Include . NON_NULL ) ; jsonConverter . setObjectMapper ( objectMapper ) ; } } |
public class WCollapsible { /** * Override preparePaintComponent in order to toggle the visibility of the content , or to register the appropriate
* ajax operation .
* @ param request the request being responded to */
@ Override protected void preparePaintComponent ( final Request request ) { } } | super . preparePaintComponent ( request ) ; if ( content != null ) { switch ( getMode ( ) ) { case EAGER : { // Always visible
content . setVisible ( true ) ; AjaxHelper . registerContainer ( getId ( ) , getId ( ) + "-content" , content . getId ( ) ) ; break ; } case LAZY : content . setVisible ( ! isCollapsed ( ) ) ; if ( isCollapsed ( ) ) { AjaxHelper . registerContainer ( getId ( ) , getId ( ) + "-content" , content . getId ( ) ) ; } break ; case DYNAMIC : { content . setVisible ( ! isCollapsed ( ) ) ; AjaxHelper . registerContainer ( getId ( ) , getId ( ) + "-content" , content . getId ( ) ) ; break ; } case SERVER : { content . setVisible ( ! isCollapsed ( ) ) ; break ; } case CLIENT : { // Will always be visible
content . setVisible ( true ) ; break ; } default : { throw new SystemException ( "Unknown mode: " + getMode ( ) ) ; } } } |
public class TimeParametersImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public NotificationChain basicSetReworkTime ( Parameter newReworkTime , NotificationChain msgs ) { } } | Parameter oldReworkTime = reworkTime ; reworkTime = newReworkTime ; if ( eNotificationRequired ( ) ) { ENotificationImpl notification = new ENotificationImpl ( this , Notification . SET , BpsimPackage . TIME_PARAMETERS__REWORK_TIME , oldReworkTime , newReworkTime ) ; if ( msgs == null ) msgs = notification ; else msgs . add ( notification ) ; } return msgs ; |
public class PageFlowStack { /** * Get a stack of PageFlowControllers , not of PushedPageFlows . */
Stack getLegacyStack ( ) { } } | Stack ret = new Stack ( ) ; for ( int i = 0 ; i < _stack . size ( ) ; ++ i ) { ret . push ( ( ( PushedPageFlow ) _stack . get ( i ) ) . getPageFlow ( ) ) ; } return ret ; |
public class CommerceShippingFixedOptionRelPersistenceImpl { /** * Returns a range of all the commerce shipping fixed option rels .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CommerceShippingFixedOptionRelModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce shipping fixed option rels
* @ param end the upper bound of the range of commerce shipping fixed option rels ( not inclusive )
* @ return the range of commerce shipping fixed option rels */
@ Override public List < CommerceShippingFixedOptionRel > findAll ( int start , int end ) { } } | return findAll ( start , end , null ) ; |
public class FindBugsJob { /** * Acquires an analysis permit unless first cancelled .
* @ return { @ code true } if permit has been acquired , { @ code false } if
* cancellation was observed and permit has not been acquired */
private static boolean acquireAnalysisPermitUnlessCancelled ( IProgressMonitor monitor ) throws InterruptedException { } } | do { if ( analysisSem . tryAcquire ( 1 , TimeUnit . SECONDS ) ) { return true ; } } while ( ! monitor . isCanceled ( ) ) ; return false ; |
public class StatementServiceImp { /** * / * ( non - Javadoc )
* @ see com . popbill . api . StatementService # registIssue ( java . lang . String , com . popbill . api . statement . Statement ,
* java . lang . String , java . lang . String ) */
@ Override public Response registIssue ( String CorpNum , Statement statement , String memo , String UserID ) throws PopbillException { } } | statement . setMemo ( memo ) ; String PostData = toJsonString ( statement ) ; return httppost ( "/Statement" , CorpNum , PostData , UserID , "ISSUE" , Response . class ) ; |
public class CloudControlClientSupport { /** * { @ inheritDoc } */
@ Override protected < T > Response < T > deserialize ( String response , Request < T > request ) { } } | Response < T > target = RequestUtil . getInstanceOfParameterizedType ( request ) ; target . setContent ( response ) ; target . setError ( false ) ; try { return jsonDeserializer . fromJSON ( response , target ) ; } catch ( SerializationException jse ) { return target ; } |
public class Whitelist { /** * Use proxy user or submit user ( if proxy user does not exist ) from property and check if it is
* whitelisted . */
public void validateWhitelisted ( Props props ) { } } | String id = null ; if ( props . containsKey ( PROXY_USER_KEY ) ) { id = props . get ( PROXY_USER_KEY ) ; Preconditions . checkArgument ( ! StringUtils . isEmpty ( id ) , PROXY_USER_KEY + " is required." ) ; } else if ( props . containsKey ( CommonJobProperties . SUBMIT_USER ) ) { id = props . get ( CommonJobProperties . SUBMIT_USER ) ; Preconditions . checkArgument ( ! StringUtils . isEmpty ( id ) , CommonJobProperties . SUBMIT_USER + " is required." ) ; } else { throw new IllegalArgumentException ( "Property neither has " + PROXY_USER_KEY + " nor " + CommonJobProperties . SUBMIT_USER ) ; } validateWhitelisted ( id ) ; |
public class JavaScriptBindings { /** * { @ inheritDoc } */
@ Override public boolean containsKey ( Object key ) { } } | String keyStr = ( String ) key ; if ( keyStr . startsWith ( "nashorn." ) ) { return super . containsKey ( key ) ; } Expression var = formatter . getVariable ( '@' + keyStr ) ; return var != null ; |
public class AmazonSQSExtendedClient { /** * Deletes up to ten messages from the specified queue . This is a batch
* version of DeleteMessage . The result of the delete action on each message
* is reported individually in the response . Also deletes the message
* payloads from Amazon S3 when necessary .
* < b > IMPORTANT : < / b > Because the batch request can result in a combination
* of successful and unsuccessful actions , you should check for batch errors
* even when the call returns an HTTP status code of 200.
* < b > NOTE : < / b > Some API actions take lists of parameters . These lists are
* specified using the param . n notation . Values of n are integers starting
* from 1 . For example , a parameter list with two elements looks like this :
* < code > & Attribute . 1 = this < / code >
* < code > & Attribute . 2 = that < / code >
* @ param deleteMessageBatchRequest
* Container for the necessary parameters to execute the
* DeleteMessageBatch service method on AmazonSQS .
* @ return The response from the DeleteMessageBatch service method , as
* returned by AmazonSQS .
* @ throws BatchEntryIdsNotDistinctException
* @ throws TooManyEntriesInBatchRequestException
* @ throws InvalidBatchEntryIdException
* @ throws EmptyBatchRequestException
* @ throws AmazonClientException
* If any internal errors are encountered inside the client
* while attempting to make the request or handle the response .
* For example if a network connection is not available .
* @ throws AmazonServiceException
* If an error response is returned by AmazonSQS indicating
* either a problem with the data in the request , or a server
* side issue . */
public DeleteMessageBatchResult deleteMessageBatch ( DeleteMessageBatchRequest deleteMessageBatchRequest ) { } } | if ( deleteMessageBatchRequest == null ) { String errorMessage = "deleteMessageBatchRequest cannot be null." ; LOG . error ( errorMessage ) ; throw new AmazonClientException ( errorMessage ) ; } deleteMessageBatchRequest . getRequestClientOptions ( ) . appendUserAgent ( SQSExtendedClientConstants . USER_AGENT_HEADER ) ; if ( ! clientConfiguration . isLargePayloadSupportEnabled ( ) ) { return super . deleteMessageBatch ( deleteMessageBatchRequest ) ; } for ( DeleteMessageBatchRequestEntry entry : deleteMessageBatchRequest . getEntries ( ) ) { String receiptHandle = entry . getReceiptHandle ( ) ; String origReceiptHandle = receiptHandle ; if ( isS3ReceiptHandle ( receiptHandle ) ) { deleteMessagePayloadFromS3 ( receiptHandle ) ; origReceiptHandle = getOrigReceiptHandle ( receiptHandle ) ; } entry . setReceiptHandle ( origReceiptHandle ) ; } return super . deleteMessageBatch ( deleteMessageBatchRequest ) ; |
public class VerifierFactory { /** * processes a schema into a Schema object , which is a compiled representation
* of a schema .
* The obtained schema object can then be used concurrently across multiple
* threads .
* Some of XML parsers accepts filenames as well as URLs , while others
* reject them . Therefore , to parse a file as a schema , you should use
* a File object .
* @ paramurl
* A source url of a schema file to be compiled . */
public Schema compileSchema ( String url ) throws VerifierConfigurationException , SAXException , IOException { } } | return compileSchema ( new InputSource ( url ) ) ; |
public class AlignmentTools { /** * only shift CA positions . */
public static void shiftCA2 ( AFPChain afpChain , Atom [ ] ca2 , Matrix m , Atom shift , Group [ ] twistedGroups ) { } } | int i = - 1 ; for ( Atom a : ca2 ) { i ++ ; Group g = a . getGroup ( ) ; Calc . rotate ( g , m ) ; Calc . shift ( g , shift ) ; if ( g . hasAltLoc ( ) ) { for ( Group alt : g . getAltLocs ( ) ) { for ( Atom alta : alt . getAtoms ( ) ) { if ( g . getAtoms ( ) . contains ( alta ) ) continue ; Calc . rotate ( alta , m ) ; Calc . shift ( alta , shift ) ; } } } twistedGroups [ i ] = g ; } |
public class ListSpaceDimension { /** * returns the value at the given point in the dimension .
* @ param xthe x - th point on the axis
* @ returnthe value at the given position */
public Object getValue ( int x ) { } } | if ( x >= width ( ) ) throw new IllegalArgumentException ( "Index out of scope on axis (" + x + " >= " + width ( ) + ")!" ) ; return m_List [ ( int ) m_Min + x ] ; |
public class MapboxUncaughtExceptionHanlder { /** * Installs exception handler for Mapbox module / sdk
* Crash data will land in context . getFilesDir ( ) / $ { mapboxPackage } /
* @ param context application context .
* @ param mapboxPackage mapbox package name exceptions to handle .
* @ param version version of mapbox package
* Note : Package name used to filter exceptions : i . e . ` com . mapbox . android . telemetry `
* will catch all telemetry exceptions in the context of a single app process . */
public static void install ( @ NonNull Context context , @ NonNull String mapboxPackage , @ NonNull String version ) { } } | Context applicationContext ; if ( context . getApplicationContext ( ) == null ) { // In shared processes content providers getApplicationContext ( ) can return null .
applicationContext = context ; } else { applicationContext = context . getApplicationContext ( ) ; } Thread . setDefaultUncaughtExceptionHandler ( new MapboxUncaughtExceptionHanlder ( applicationContext , applicationContext . getSharedPreferences ( MAPBOX_CRASH_REPORTER_PREFERENCES , Context . MODE_PRIVATE ) , mapboxPackage , version , Thread . getDefaultUncaughtExceptionHandler ( ) ) ) ; |
public class Karyon { /** * Creates a new { @ link KaryonServer } which combines lifecycle of the passed { @ link HttpServer } with
* it ' s own lifecycle .
* @ param server HTTP server
* @ param modules Additional bootstrapModules if any .
* @ return { @ link KaryonServer } which is to be used to start the created server . */
public static KaryonServer forHttpServer ( HttpServer < ? , ? > server , Module ... modules ) { } } | return forHttpServer ( server , toBootstrapModule ( modules ) ) ; |
public class StreamRemoteConnector { /** * This is the loop that handles a connection by reading messages until there ' s an IOException , or the transport
* or thread change to an end state . */
protected void processMessagesOnConnection ( ) { } } | try { logger . log ( INFO , "Connected to " + getConnectionName ( ) ) ; state . set ( StreamState . CONNECTED ) ; notifyConnection ( ) ; inputBuffer . flip ( ) ; while ( ! Thread . currentThread ( ) . isInterrupted ( ) && isConnected ( ) ) { try { // Find the start of message
byte byStart = 0 ; while ( byStart != START_OF_MSG && ! Thread . currentThread ( ) . isInterrupted ( ) && isConnected ( ) ) { byStart = nextByte ( inputBuffer ) ; } // and then make sure there are enough bytes and read the protocol
readCompleteMessage ( inputBuffer ) ; if ( inputBuffer . get ( ) != protocol . getKeyIdentifier ( ) ) throw new TcProtocolException ( "Bad protocol" ) ; logByteBuffer ( "Line read from stream" , inputBuffer ) ; // now we take a shallow buffer copy and process the message
MenuCommand mc = protocol . fromChannel ( inputBuffer ) ; logger . log ( INFO , "Command received: " + mc ) ; notifyListeners ( mc ) ; } catch ( TcProtocolException ex ) { // a protocol problem shouldn ' t drop the connection
logger . log ( WARNING , "Probable Bad message reason='{0}' Remote={1} " , ex . getMessage ( ) , getConnectionName ( ) ) ; } } logger . log ( INFO , "Disconnected from " + getConnectionName ( ) ) ; } catch ( Exception e ) { logger . log ( ERROR , "Problem with connectivity on " + getConnectionName ( ) , e ) ; } finally { close ( ) ; } |
public class EpicsApi { /** * Gets all issues that are assigned to an epic and the authenticated user has access to as a Stream .
* < pre > < code > GitLab Endpoint : GET / groups / : id / epics / : epic _ iid / issues < / code > < / pre >
* @ param groupIdOrPath the group ID , path of the group , or a Group instance holding the group ID or path
* @ param epicIid the IID of the epic to get issues for
* @ return a Stream of all epic issues belonging to the specified epic
* @ throws GitLabApiException if any exception occurs */
public Stream < Epic > getEpicIssuesStream ( Object groupIdOrPath , Integer epicIid ) throws GitLabApiException { } } | return ( getEpicIssues ( groupIdOrPath , epicIid , getDefaultPerPage ( ) ) . stream ( ) ) ; |
public class ResultUtil { /** * " key " : " demoproject " ,
* " doc _ count " : 30,
* " successsums " : {
* " doc _ count _ error _ upper _ bound " : 0,
* " sum _ other _ doc _ count " : 0,
* " buckets " : [
* " key " : 0,
* " doc _ count " : 30
* @ param map
* @ param metrics successsums - > buckets
* @ return */
public static Object getAggBuckets ( Map < String , ? > map , String metrics ) { } } | if ( map != null ) { Map < String , Object > metrics_ = ( Map < String , Object > ) map . get ( metrics ) ; if ( metrics_ != null ) { return metrics_ . get ( "buckets" ) ; } } return null ; |
public class SeaGlassSynthPainterImpl { /** * Paints the foreground of an arrow button . This method is responsible for
* drawing a graphical representation of a direction , typically an arrow .
* Arrow buttons are created by some components , such as < code >
* JScrollBar < / code >
* @ param context SynthContext identifying the < code > JComponent < / code > and
* < code > Region < / code > to paint to
* @ param g < code > Graphics < / code > to paint to
* @ param x X coordinate of the area to paint to
* @ param y Y coordinate of the area to paint to
* @ param w Width of the area to paint to
* @ param h Height of the area to paint to
* @ param direction One of SwingConstants . NORTH , SwingConstants . SOUTH
* SwingConstants . EAST or SwingConstants . WEST */
public void paintArrowButtonForeground ( SynthContext context , Graphics g , int x , int y , int w , int h , int direction ) { } } | // assume that the painter is arranged with the arrow pointing . . . LEFT ?
String compName = context . getComponent ( ) . getName ( ) ; boolean ltr = context . getComponent ( ) . getComponentOrientation ( ) . isLeftToRight ( ) ; // The hard coding for spinners here needs to be replaced by a more
// general method for disabling rotation
if ( "Spinner.nextButton" . equals ( compName ) || "Spinner.previousButton" . equals ( compName ) ) { if ( ltr ) { paintForeground ( context , g , x , y , w , h , null ) ; } else { AffineTransform transform = new AffineTransform ( ) ; transform . translate ( w , 0 ) ; transform . scale ( - 1 , 1 ) ; paintForeground ( context , g , x , y , w , h , transform ) ; } } else if ( direction == SwingConstants . WEST ) { paintForeground ( context , g , x , y , w , h , null ) ; } else if ( direction == SwingConstants . NORTH ) { if ( ltr ) { AffineTransform transform = new AffineTransform ( ) ; transform . scale ( - 1 , 1 ) ; transform . rotate ( Math . toRadians ( 90 ) ) ; paintForeground ( context , g , y , x , h , w , transform ) ; } else { AffineTransform transform = new AffineTransform ( ) ; transform . rotate ( Math . toRadians ( 90 ) ) ; transform . translate ( 0 , - ( x + w ) ) ; paintForeground ( context , g , y , x , h , w , transform ) ; } } else if ( direction == SwingConstants . EAST ) { AffineTransform transform = new AffineTransform ( ) ; transform . translate ( w , 0 ) ; transform . scale ( - 1 , 1 ) ; paintForeground ( context , g , x , y , w , h , transform ) ; } else if ( direction == SwingConstants . SOUTH ) { if ( ltr ) { AffineTransform transform = new AffineTransform ( ) ; transform . rotate ( Math . toRadians ( - 90 ) ) ; transform . translate ( - h , 0 ) ; paintForeground ( context , g , y , x , h , w , transform ) ; } else { AffineTransform transform = new AffineTransform ( ) ; transform . scale ( - 1 , 1 ) ; transform . rotate ( Math . toRadians ( - 90 ) ) ; transform . translate ( - ( h + y ) , - ( w + x ) ) ; paintForeground ( context , g , y , x , h , w , transform ) ; } } |
public class UsernameExistsValidator { /** * / * ( non - Javadoc )
* @ see javax . validation . ConstraintValidator # isValid ( java . lang . Object , javax . validation . ConstraintValidatorContext ) */
@ Override public boolean isValid ( String value , ConstraintValidatorContext context ) { } } | try { this . duracloudUserService . checkUsername ( value ) ; return false ; } catch ( InvalidUsernameException ex ) { return false ; } catch ( UserAlreadyExistsException ex ) { return true ; } |
public class SARLProjectConfigurator { /** * Add the SARL natures to the given project .
* @ param project the project .
* @ param monitor the monitor .
* @ return the status if the operation . */
public static IStatus addSarlNatures ( IProject project , IProgressMonitor monitor ) { } } | return addNatures ( project , monitor , getSarlNatures ( ) ) ; |
public class PropertyBuilder { /** * Return a new PropertyBuilder of type { @ link Property . Type # Select }
* @ param name name
* @ return this builder */
public PropertyBuilder options ( final String name ) { } } | name ( name ) ; type ( Property . Type . Options ) ; return this ; |
public class CmsModuleManager { /** * Checks if a modules dependencies are fulfilled . < p >
* The possible values for the < code > mode < / code > parameter are : < dl >
* < dt > { @ link # DEPENDENCY _ MODE _ DELETE } < / dt >
* < dd > Check for module deleting , i . e . are other modules dependent on the
* given module ? < / dd >
* < dt > { @ link # DEPENDENCY _ MODE _ IMPORT } < / dt >
* < dd > Check for module importing , i . e . are all dependencies required by the given
* module available ? < / dd > < / dl >
* @ param module the module to check the dependencies for
* @ param mode the dependency check mode
* @ return a list of dependencies that are not fulfilled , if empty all dependencies are fulfilled */
public List < CmsModuleDependency > checkDependencies ( CmsModule module , int mode ) { } } | List < CmsModuleDependency > result = new ArrayList < CmsModuleDependency > ( ) ; if ( mode == DEPENDENCY_MODE_DELETE ) { // delete mode , check if other modules depend on this module
Iterator < CmsModule > i = m_modules . values ( ) . iterator ( ) ; while ( i . hasNext ( ) ) { CmsModule otherModule = i . next ( ) ; CmsModuleDependency dependency = otherModule . checkDependency ( module ) ; if ( dependency != null ) { // dependency found , add to list
result . add ( new CmsModuleDependency ( otherModule . getName ( ) , otherModule . getVersion ( ) ) ) ; } } } else if ( mode == DEPENDENCY_MODE_IMPORT ) { // import mode , check if all module dependencies are fulfilled
Iterator < CmsModule > i = m_modules . values ( ) . iterator ( ) ; // add all dependencies that must be found
result . addAll ( module . getDependencies ( ) ) ; while ( i . hasNext ( ) && ( result . size ( ) > 0 ) ) { CmsModule otherModule = i . next ( ) ; CmsModuleDependency dependency = module . checkDependency ( otherModule ) ; if ( dependency != null ) { // dependency found , remove from list
result . remove ( dependency ) ; } } } else { // invalid mode selected
throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_CHECK_DEPENDENCY_INVALID_MODE_1 , new Integer ( mode ) ) ) ; } return result ; |
public class TangoEventsAdapter { public void addTangoDataReadyListener ( ITangoDataReadyListener listener , String attrName , boolean stateless ) throws DevFailed { } } | addTangoDataReadyListener ( listener , attrName , new String [ 0 ] , stateless ) ; |
public class CmsConfigurationCopyResource { /** * Returns the copy type as String . < p >
* @ see # getType ( )
* @ return the copy type as String */
public String getTypeString ( ) { } } | if ( CmsResource . COPY_AS_SIBLING == m_type ) { return CmsConfigurationCopyResource . COPY_AS_SIBLING ; } else if ( CmsResource . COPY_PRESERVE_SIBLING == m_type ) { return CmsConfigurationCopyResource . COPY_AS_PRESERVE ; } return CmsConfigurationCopyResource . COPY_AS_NEW ; |
public class Expressions { /** * Translates " condition " to a Druid filter , or returns null if we cannot translate the condition .
* @ param plannerContext planner context
* @ param querySignature row signature of the dataSource to be filtered
* @ param expression Calcite row expression */
@ Nullable public static DimFilter toFilter ( final PlannerContext plannerContext , final DruidQuerySignature querySignature , final RexNode expression ) { } } | final SqlKind kind = expression . getKind ( ) ; if ( kind == SqlKind . IS_TRUE || kind == SqlKind . IS_NOT_FALSE ) { return toFilter ( plannerContext , querySignature , Iterables . getOnlyElement ( ( ( RexCall ) expression ) . getOperands ( ) ) ) ; } else if ( kind == SqlKind . IS_FALSE || kind == SqlKind . IS_NOT_TRUE ) { return new NotDimFilter ( toFilter ( plannerContext , querySignature , Iterables . getOnlyElement ( ( ( RexCall ) expression ) . getOperands ( ) ) ) ) ; } else if ( kind == SqlKind . CAST && expression . getType ( ) . getSqlTypeName ( ) == SqlTypeName . BOOLEAN ) { // Calcite sometimes leaves errant , useless cast - to - booleans inside filters . Strip them and continue .
return toFilter ( plannerContext , querySignature , Iterables . getOnlyElement ( ( ( RexCall ) expression ) . getOperands ( ) ) ) ; } else if ( kind == SqlKind . AND || kind == SqlKind . OR || kind == SqlKind . NOT ) { final List < DimFilter > filters = new ArrayList < > ( ) ; for ( final RexNode rexNode : ( ( RexCall ) expression ) . getOperands ( ) ) { final DimFilter nextFilter = toFilter ( plannerContext , querySignature , rexNode ) ; if ( nextFilter == null ) { return null ; } filters . add ( nextFilter ) ; } if ( kind == SqlKind . AND ) { return new AndDimFilter ( filters ) ; } else if ( kind == SqlKind . OR ) { return new OrDimFilter ( filters ) ; } else { assert kind == SqlKind . NOT ; return new NotDimFilter ( Iterables . getOnlyElement ( filters ) ) ; } } else { // Handle filter conditions on everything else .
return toLeafFilter ( plannerContext , querySignature , expression ) ; } |
public class RequestResponse { /** * Get a response value from the JSON tree using dPath expression .
* @ param path
* @ param clazz
* @ return */
public < T > Optional < T > getResponseValueOptional ( String path , Class < T > clazz ) { } } | return JacksonUtils . getValueOptional ( responseJson , path , clazz ) ; |
public class DBConnection { /** * Closes all cached { @ link PreparedStatement } objects and then
* closes the database { @ link Connection } .
* This must be called before the instance goes out of scope . */
public synchronized void close ( ) { } } | for ( PreparedStatement ps : threadedPsMap . get ( ) . values ( ) ) { if ( null != ps ) { try { ps . close ( ) ; } catch ( SQLException e ) { // swallowed
} } } try { if ( null != connection ) { this . connection . close ( ) ; } } catch ( SQLException e ) { // swallowed
} |
public class UserPreferences { /** * Additional plugins which could be used or shouldn ' t be used ( depending on
* given argument ) by { @ link IFindBugsEngine } . If a plugin is not included
* in the set , it ' s enablement depends on it ' s default settings .
* @ return set with additional third party plugins , might be empty , never
* null . The elements are either absolute plugin paths or plugin id ' s .
* < b > Special case < / b > : if the path consists of one path segment
* then it represents the plugin id for a plugin to be
* < b > disabled < / b > .
* @ see Plugin # isCorePlugin ( )
* @ see Plugin # isGloballyEnabled ( ) */
public Set < String > getCustomPlugins ( boolean enabled ) { } } | Set < Entry < String , Boolean > > entrySet = customPlugins . entrySet ( ) ; Set < String > result = new TreeSet < > ( ) ; for ( Entry < String , Boolean > entry : entrySet ) { if ( enabled ) { if ( entry . getValue ( ) != null && entry . getValue ( ) . booleanValue ( ) ) { result . add ( entry . getKey ( ) ) ; } } else { if ( entry . getValue ( ) == null || ! entry . getValue ( ) . booleanValue ( ) ) { result . add ( entry . getKey ( ) ) ; } } } return result ; |
public class HistoryHandler { /** * Called when a change is the record status is about to happen / has happened .
* @ param field If this file change is due to a field , this is the field .
* @ param iChangeType The type of change that occurred .
* @ param bDisplayOption If true , display any changes .
* @ return an error code . */
public int doRecordChange ( FieldInfo field , int iChangeType , boolean bDisplayOption ) { } } | // Read a valid record
int iErrorCode = DBConstants . NORMAL_RETURN ; switch ( iChangeType ) { case DBConstants . LOCK_TYPE : try { this . getHistoryRecord ( ) . addNew ( ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; // Never
} int iLastField = this . getOwner ( ) . getFieldCount ( ) + DBConstants . MAIN_FIELD - 1 ; for ( int iFieldSeq = DBConstants . MAIN_FIELD ; iFieldSeq <= iLastField ; iFieldSeq ++ ) { // Move all the current fields to the history table
BaseField fldDest = this . getHistoryRecord ( ) . getField ( iFieldSeq ) ; BaseField fldSource = this . getOwner ( ) . getField ( iFieldSeq ) ; if ( ( fldSource == null ) || ( ! fldDest . getFieldName ( ) . equals ( fldSource . getFieldName ( ) ) ) ) fldSource = this . getHistoryRecord ( ) . getField ( fldDest . getFieldName ( ) ) ; // Being very careful
if ( fldSource != null ) fldDest . moveFieldToThis ( fldSource ) ; } break ; case DBConstants . AFTER_UPDATE_TYPE : case DBConstants . AFTER_DELETE_TYPE : // x if ( this . getOwner ( ) . isModified ( ) )
{ this . moveDateToTarget ( ) ; iErrorCode = DBConstants . ERROR_RETURN ; while ( iErrorCode != DBConstants . NORMAL_RETURN ) { try { if ( this . getHistoryRecord ( ) . getEditMode ( ) == DBConstants . EDIT_ADD ) // It is possible that a nested set called this already
if ( this . getOwner ( ) . isModified ( true ) ) this . getHistoryRecord ( ) . add ( ) ; iErrorCode = DBConstants . NORMAL_RETURN ; // Good
} catch ( DBException ex ) { iErrorCode = ex . getErrorCode ( ) ; if ( ( iErrorCode != DBConstants . DUPLICATE_KEY ) && ( iErrorCode != DBConstants . DUPLICATE_COUNTER ) ) { ex . printStackTrace ( ) ; break ; } else { DateTimeField fieldTarget = ( DateTimeField ) this . getHistoryRecord ( ) . getField ( m_iHistoryDateSeq ) ; Date dateBefore = this . bumpTime ( fieldTarget ) ; if ( ( fieldTarget . getDateTime ( ) == null ) || ( fieldTarget . getDateTime ( ) . equals ( dateBefore ) ) ) break ; // Should never happen - being careful .
// Try again
} } } } break ; } return super . doRecordChange ( field , iChangeType , bDisplayOption ) ; // Initialize the record |
public class Split { /** * Get the group of VMs that contains the given VM .
* @ param u the VM identifier
* @ return the group of VM if exists , an empty collection otherwise */
public Collection < VM > getAssociatedVGroup ( VM u ) { } } | for ( Collection < VM > vGrp : sets ) { if ( vGrp . contains ( u ) ) { return vGrp ; } } return Collections . emptySet ( ) ; |
public class CmsProjectDriver { /** * Creates a new { @ link CmsLogEntry } object from the given result set entry . < p >
* @ param res the result set
* @ return the new { @ link CmsLogEntry } object
* @ throws SQLException if something goes wrong */
protected CmsLogEntry internalReadLogEntry ( ResultSet res ) throws SQLException { } } | CmsUUID userId = new CmsUUID ( res . getString ( m_sqlManager . readQuery ( "C_LOG_USER_ID" ) ) ) ; long date = res . getLong ( m_sqlManager . readQuery ( "C_LOG_DATE" ) ) ; CmsUUID structureId = new CmsUUID ( res . getString ( m_sqlManager . readQuery ( "C_LOG_STRUCTURE_ID" ) ) ) ; CmsLogEntryType type = CmsLogEntryType . valueOf ( res . getInt ( m_sqlManager . readQuery ( "C_LOG_TYPE" ) ) ) ; String [ ] data = CmsStringUtil . splitAsArray ( res . getString ( m_sqlManager . readQuery ( "C_LOG_DATA" ) ) , '|' ) ; return new CmsLogEntry ( userId , date , structureId , type , data ) ; |
public class GeometryEngine { /** * Indicates if the given relation holds for the two geometries .
* See OperatorRelate .
* @ param geometry1
* The first geometry for the relation .
* @ param geometry2
* The second geometry for the relation .
* @ param spatialReference
* The spatial reference of the geometries .
* @ param relation
* The DE - 9IM relation .
* @ return TRUE if the given relation holds between geometry1 and geometry2. */
public static boolean relate ( Geometry geometry1 , Geometry geometry2 , SpatialReference spatialReference , String relation ) { } } | OperatorRelate op = ( OperatorRelate ) factory . getOperator ( Operator . Type . Relate ) ; boolean result = op . execute ( geometry1 , geometry2 , spatialReference , relation , null ) ; return result ; |
public class FileSystemUtil { /** * Returns a FileStatus for a split . */
public static FileStatus getSplitFileStatus ( Path rootPath , String table , String split , long size , int blockSize ) { } } | return new FileStatus ( size , false , 1 , blockSize , - 1 , - 1 , FILE_PERMISSION , null , null , getSplitPath ( rootPath , table , split ) ) ; |
public class OperaDesktopDriver { /** * Gets a list of all widgets in the window with the given window name .
* @ param windowName name of window to list widgets inside
* @ return list of widgets in the window with name windowName If windowName is empty , it gets the
* widgets in the active window */
public List < QuickWidget > getQuickWidgetList ( String windowName ) { } } | int id = getQuickWindowID ( windowName ) ; if ( id >= 0 || windowName . isEmpty ( ) ) { return getQuickWidgetList ( id ) ; } return Collections . emptyList ( ) ; |
public class ManagementModule { /** * Build a proxy chain as configured by the module parameters .
* @ param m The concrete Management implementation to wrap .
* @ return A proxy chain for Management
* @ throws ModuleInitializationException */
private Management getProxyChain ( Management m ) throws ModuleInitializationException { } } | try { invocationHandlers = getInvocationHandlers ( ) ; return ( Management ) ProxyFactory . getProxy ( m , invocationHandlers ) ; } catch ( Exception e ) { throw new ModuleInitializationException ( e . getMessage ( ) , getRole ( ) ) ; } |
public class ListUtils { /** * Obtains a random sample without replacement from a source collection and
* places it in the destination collection . This is done without modifying
* the source collection . < br >
* This random sampling is oblivious to failures to add to a collection that
* may occur , such as if the collection is a { @ link Set }
* @ param < T > the list content type involved
* @ param source the source of values to randomly sample from
* @ param dest the collection to store the random samples in . It does
* not need to be empty for the sampling to work correctly
* @ param samples the number of samples to select from the source
* @ param rand the source of randomness for the sampling
* @ throws IllegalArgumentException if the sample size is not positive or l
* arger than the source population . */
public static < T > void randomSample ( Collection < T > source , Collection < T > dest , int samples , Random rand ) { } } | if ( samples > source . size ( ) ) throw new IllegalArgumentException ( "Can not obtain a number of samples larger than the source population" ) ; else if ( samples <= 0 ) throw new IllegalArgumentException ( "Sample size must be positive" ) ; // Use samples to keep track of how many more samples we need
int remainingPopulation = source . size ( ) ; for ( T member : source ) { if ( rand . nextInt ( remainingPopulation ) < samples ) { dest . add ( member ) ; samples -- ; } remainingPopulation -- ; } |
public class CustomMapperEto { /** * Initializes this class to be functional . */
@ PostConstruct public void initialize ( ) { } } | if ( this . pojoDescriptorBuilderFactory == null ) { this . pojoDescriptorBuilderFactory = PojoDescriptorBuilderFactoryImpl . getInstance ( ) ; } if ( this . pojoDescriptorBuilder == null ) { this . pojoDescriptorBuilder = this . pojoDescriptorBuilderFactory . createPrivateFieldDescriptorBuilder ( ) ; } this . descriptor = this . pojoDescriptorBuilder . getDescriptor ( EntityTo . class ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.