signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class DataOutputSerializer { @ Override public void write ( int b ) throws IOException { } }
|
if ( this . position >= this . buffer . length ) { resize ( 1 ) ; } this . buffer [ this . position ++ ] = ( byte ) ( b & 0xff ) ;
|
public class SharePrincipalMarshaller { /** * Marshall the given parameter object . */
public void marshall ( SharePrincipal sharePrincipal , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( sharePrincipal == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( sharePrincipal . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( sharePrincipal . getType ( ) , TYPE_BINDING ) ; protocolMarshaller . marshall ( sharePrincipal . getRole ( ) , ROLE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class TenantDataUrl { /** * Get Resource Url for GetDBValue
* @ param dbEntryQuery The database entry string to create .
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ return String Resource Url */
public static MozuUrl getDBValueUrl ( String dbEntryQuery , String responseFields ) { } }
|
UrlFormatter formatter = new UrlFormatter ( "/api/platform/tenantdata/{dbEntryQuery}?responseFields={responseFields}" ) ; formatter . formatUrl ( "dbEntryQuery" , dbEntryQuery ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
|
public class InstanceValidator { /** * implementation */
private void checkSampledData ( List < ValidationMessage > errors , String path , WrapperElement focus , SampledData fixed ) { } }
|
checkFixedValue ( errors , path + ".origin" , focus . getNamedChild ( "origin" ) , fixed . getOrigin ( ) , "origin" ) ; checkFixedValue ( errors , path + ".period" , focus . getNamedChild ( "period" ) , fixed . getPeriodElement ( ) , "period" ) ; checkFixedValue ( errors , path + ".factor" , focus . getNamedChild ( "factor" ) , fixed . getFactorElement ( ) , "factor" ) ; checkFixedValue ( errors , path + ".lowerLimit" , focus . getNamedChild ( "lowerLimit" ) , fixed . getLowerLimitElement ( ) , "lowerLimit" ) ; checkFixedValue ( errors , path + ".upperLimit" , focus . getNamedChild ( "upperLimit" ) , fixed . getUpperLimitElement ( ) , "upperLimit" ) ; checkFixedValue ( errors , path + ".dimensions" , focus . getNamedChild ( "dimensions" ) , fixed . getDimensionsElement ( ) , "dimensions" ) ; checkFixedValue ( errors , path + ".data" , focus . getNamedChild ( "data" ) , fixed . getDataElement ( ) , "data" ) ;
|
public class ZoteroItemDataProvider { /** * Generates a human - readable ID for an item
* @ param item the item
* @ param dateParser a date parser
* @ return the human - readable ID */
private static String makeId ( CSLItemData item , CSLDateParser dateParser ) { } }
|
if ( item . getAuthor ( ) == null || item . getAuthor ( ) . length == 0 ) { // there ' s no author information , return original ID
return item . getId ( ) ; } // get author ' s name
CSLName firstAuthor = item . getAuthor ( ) [ 0 ] ; String a = firstAuthor . getFamily ( ) ; if ( a == null || a . isEmpty ( ) ) { a = firstAuthor . getGiven ( ) ; if ( a == null || a . isEmpty ( ) ) { a = firstAuthor . getLiteral ( ) ; if ( a == null || a . isEmpty ( ) ) { // author could not be found , return original ID
return item . getId ( ) ; } } } a = StringHelper . sanitize ( a ) ; // try to get year
int year = getYear ( item . getIssued ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getContainer ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getOriginalDate ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getEventDate ( ) , dateParser ) ; if ( year < 0 ) { year = getYear ( item . getSubmitted ( ) , dateParser ) ; } } } } // append year to author
if ( year >= 0 ) { a = a + year ; } return a ;
|
public class Misc { /** * Convert a " hexa " - string to a byte array .
* @ param str Input string .
* @ return Corresponding array of bytes . */
static byte [ ] fromHexString ( String str ) { } }
|
if ( str . length ( ) % 2 != 0 ) { throw new InvalidOperationException ( "Hex-string has odd length!" ) ; } byte [ ] data = new byte [ str . length ( ) / 2 ] ; int spos = 0 ; for ( int dpos = 0 ; dpos < data . length ; dpos ++ ) { int d1 = Character . digit ( str . charAt ( spos ++ ) , 16 ) ; int d2 = Character . digit ( str . charAt ( spos ++ ) , 16 ) ; if ( d1 < 0 || d2 < 0 ) { throw new InvalidOperationException ( "Mal-formed hex-string!" ) ; } data [ dpos ] = ( byte ) ( ( d1 << 4 ) | d2 ) ; } return data ;
|
public class XMLPoiCategoryManager { /** * { @ inheritDoc } */
@ Override public PoiCategory getPoiCategoryByID ( int id ) { } }
|
PoiCategory ret = null ; for ( String key : this . titleMap . keySet ( ) ) { if ( ( ret = this . titleMap . get ( key ) ) . getID ( ) == id ) { break ; } } return ret ;
|
public class Type { /** * Returns a JVM instruction opcode adapted to this Java type .
* @ param opcode a JVM instruction opcode . This opcode must be one of ILOAD ,
* ISTORE , IALOAD , IASTORE , IADD , ISUB , IMUL , IDIV , IREM , INEG , ISHL ,
* ISHR , IUSHR , IAND , IOR , IXOR and IRETURN .
* @ return an opcode that is similar to the given opcode , but adapted to
* this Java type . For example , if this type is < tt > float < / tt > and
* < tt > opcode < / tt > is IRETURN , this method returns FRETURN . */
public int getOpcode ( final int opcode ) { } }
|
if ( opcode == Opcodes . IALOAD || opcode == Opcodes . IASTORE ) { switch ( sort ) { case BOOLEAN : case BYTE : return opcode + 5 ; case CHAR : return opcode + 6 ; case SHORT : return opcode + 7 ; case INT : return opcode ; case FLOAT : return opcode + 2 ; case LONG : return opcode + 1 ; case DOUBLE : return opcode + 3 ; // case ARRAY :
// case OBJECT :
default : return opcode + 4 ; } } else { switch ( sort ) { case VOID : return opcode + 5 ; case BOOLEAN : case CHAR : case BYTE : case SHORT : case INT : return opcode ; case FLOAT : return opcode + 2 ; case LONG : return opcode + 1 ; case DOUBLE : return opcode + 3 ; // case ARRAY :
// case OBJECT :
default : return opcode + 4 ; } }
|
public class CoronaJobInProgress { /** * Populate the data structures as a task is scheduled .
* Assuming { @ link JobTracker } is locked on entry .
* @ param tip The tip for which the task is added
* @ param id The attempt - id for the task
* @ param taskTracker task tracker name
* @ param hostName host name for the task tracker
* @ param isScheduled Whether this task is scheduled from the JT or has
* joined back upon restart */
@ SuppressWarnings ( "deprecation" ) private void addRunningTaskToTIPUnprotected ( TaskInProgress tip , TaskAttemptID id , String taskTracker , String hostName , boolean isScheduled ) { } }
|
// Make an entry in the tip if the attempt is not scheduled i . e externally
// added
if ( ! isScheduled ) { tip . addRunningTask ( id , taskTracker ) ; } // keeping the earlier ordering intact
String name ; String splits = "" ; Enum < Counter > counter = null ; if ( tip . isJobSetupTask ( ) ) { launchedSetup = true ; name = Values . SETUP . name ( ) ; } else if ( tip . isJobCleanupTask ( ) ) { launchedCleanup = true ; name = Values . CLEANUP . name ( ) ; } else if ( tip . isMapTask ( ) ) { ++ runningMapTasks ; name = Values . MAP . name ( ) ; counter = Counter . TOTAL_LAUNCHED_MAPS ; splits = tip . getSplitNodes ( ) ; if ( tip . getActiveTasks ( ) . size ( ) > 1 ) { speculativeMapTasks ++ ; jobStats . incNumSpeculativeMaps ( ) ; } jobStats . incNumMapTasksLaunched ( ) ; } else { ++ runningReduceTasks ; name = Values . REDUCE . name ( ) ; counter = Counter . TOTAL_LAUNCHED_REDUCES ; if ( tip . getActiveTasks ( ) . size ( ) > 1 ) { speculativeReduceTasks ++ ; jobStats . incNumSpeculativeReduces ( ) ; } jobStats . incNumReduceTasksLaunched ( ) ; } // Note that the logs are for the scheduled tasks only . Tasks that join on
// restart has already their logs in place .
if ( tip . isFirstAttempt ( id ) ) { jobHistory . logTaskStarted ( tip . getTIPId ( ) , name , tip . getExecStartTime ( ) , splits ) ; } if ( ! tip . isJobSetupTask ( ) && ! tip . isJobCleanupTask ( ) ) { jobCounters . incrCounter ( counter , 1 ) ; } if ( tip . isMapTask ( ) && ! tip . isJobSetupTask ( ) && ! tip . isJobCleanupTask ( ) ) { localityStats . record ( tip , hostName , - 1 ) ; }
|
public class Mapping { /** * Returns an Iterable to the two IChemObjects .
* Iterable . remove ( ) is not implemented .
* @ return An Iterable to two IChemObjects that define the mapping */
@ Override public Iterable < IChemObject > relatedChemObjects ( ) { } }
|
return new Iterable < IChemObject > ( ) { @ Override public Iterator < IChemObject > iterator ( ) { return new ChemObjectIterator ( ) ; } } ;
|
public class CovariantTypes { /** * GenericArrayType */
private static boolean isAssignableFrom ( GenericArrayType type1 , Class < ? > type2 ) { } }
|
return type2 . isArray ( ) && isAssignableFrom ( Reflections . getRawType ( type1 . getGenericComponentType ( ) ) , type2 . getComponentType ( ) ) ;
|
public class DocumentSubscriptions { /** * It opens a subscription and starts pulling documents since a last processed document for that subscription .
* The connection options determine client and server cooperation rules like document batch sizes or a timeout in a matter of which a client
* needs to acknowledge that batch has been processed . The acknowledgment is sent after all documents are processed by subscription ' s handlers .
* There can be only a single client that is connected to a subscription .
* @ param clazz Entity class
* @ param options Subscription options
* @ param database Target database
* @ param < T > Entity class
* @ return Subscription object that allows to add / remove subscription handlers . */
public < T > SubscriptionWorker < T > getSubscriptionWorker ( Class < T > clazz , SubscriptionWorkerOptions options , String database ) { } }
|
_store . assertInitialized ( ) ; if ( options == null ) { throw new IllegalStateException ( "Cannot open a subscription if options are null" ) ; } SubscriptionWorker < T > subscription = new SubscriptionWorker < > ( clazz , options , false , _store , database ) ; subscription . onClosed = sender -> _subscriptions . remove ( sender ) ; _subscriptions . put ( subscription , true ) ; return subscription ;
|
public class WSDirectorySocket { /** * Do the WebSocket connect . */
private void doConnect ( ) { } }
|
task = new SocketDeamonTask ( ) ; connectThread = new Thread ( task ) ; connectThread . setDaemon ( true ) ; connectThread . start ( ) ;
|
public class PrivacyListManager { /** * Send the { @ link Privacy } stanza to the server in order to know some privacy content and then
* waits for the answer .
* @ param requestPrivacy is the { @ link Privacy } stanza configured properly whose XML
* will be sent to the server .
* @ return a new { @ link Privacy } with the data received from the server .
* @ throws XMPPErrorException
* @ throws NoResponseException
* @ throws NotConnectedException
* @ throws InterruptedException */
private Privacy getRequest ( Privacy requestPrivacy ) throws NoResponseException , XMPPErrorException , NotConnectedException , InterruptedException { } }
|
// The request is a get iq type
requestPrivacy . setType ( Privacy . Type . get ) ; return connection ( ) . createStanzaCollectorAndSend ( requestPrivacy ) . nextResultOrThrow ( ) ;
|
public class Job { /** * Returns the image that shows the current buildCommand status . */
public void doBuildStatus ( StaplerRequest req , StaplerResponse rsp ) throws IOException { } }
|
rsp . sendRedirect2 ( req . getContextPath ( ) + "/images/48x48/" + getBuildStatusUrl ( ) ) ;
|
public class Jump { /** * Sets the jump descriptor to use .
* @ param jumpDescriptor the jump descriptor to set
* @ return this behavior for chaining . */
public Jump < T > setJumpDescriptor ( JumpDescriptor < T > jumpDescriptor ) { } }
|
this . jumpDescriptor = jumpDescriptor ; this . target = null ; this . isJumpAchievable = false ; return this ;
|
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EEnum getIfcTaskTypeEnum ( ) { } }
|
if ( ifcTaskTypeEnumEEnum == null ) { ifcTaskTypeEnumEEnum = ( EEnum ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 1084 ) ; } return ifcTaskTypeEnumEEnum ;
|
public class PipelineArbitrateEvent { /** * 初始化对应的pipeline节点 , 同步调用 */
public void init ( Long channelId , Long pipelineId ) { } }
|
String path = ManagePathUtils . getPipeline ( channelId , pipelineId ) ; String processRootPath = ManagePathUtils . getProcessRoot ( channelId , pipelineId ) ; String terminRootPath = ManagePathUtils . getTerminRoot ( channelId , pipelineId ) ; String remedyRootPath = ManagePathUtils . getRemedyRoot ( channelId , pipelineId ) ; String lockRootPath = ManagePathUtils . getLockRoot ( channelId , pipelineId ) ; String loadLockPath = lockRootPath + "/" + ArbitrateConstants . NODE_LOCK_LOAD ; try { zookeeper . createPersistent ( path , true ) ; // 创建父节点
zookeeper . create ( processRootPath , new byte [ 0 ] , CreateMode . PERSISTENT ) ; zookeeper . create ( terminRootPath , new byte [ 0 ] , CreateMode . PERSISTENT ) ; zookeeper . create ( remedyRootPath , new byte [ 0 ] , CreateMode . PERSISTENT ) ; zookeeper . create ( lockRootPath , new byte [ 0 ] , CreateMode . PERSISTENT ) ; zookeeper . create ( loadLockPath , new byte [ 0 ] , CreateMode . PERSISTENT ) ; } catch ( ZkNodeExistsException e ) { // 如果节点已经存在 , 则不抛异常
// ignore
} catch ( ZkException e ) { throw new ArbitrateException ( "Pipeline_init" , pipelineId . toString ( ) , e ) ; }
|
public class EventBusHookListener { /** * Starts the hook listener , registering a handler on the event bus .
* @ param doneHandler An asynchronous handler to be called once the listener
* handler has been registered on the event bus .
* @ return The hook listener . */
public EventBusHookListener start ( Handler < AsyncResult < Void > > doneHandler ) { } }
|
eventBus . registerHandler ( address , messageHandler , doneHandler ) ; return this ;
|
public class LocalFileSystemUploader { /** * Remove the uploaded topology package for cleaning up
* @ return true , if successful */
@ Override public boolean undo ( ) { } }
|
if ( destTopologyFile != null ) { LOG . info ( "Clean uploaded jar" ) ; File file = new File ( destTopologyFile ) ; return file . delete ( ) ; } return true ;
|
public class VasConversionService { /** * Converts the { @ code ConnectorType } s from { @ code ChargingStation } to { @ code io . motown . vas . v10 . soap . schema . ConnectorType } .
* @ param chargingStation charging station object that contains the connector types .
* @ return List of { @ code io . motown . vas . v10 . soap . schema . ConnectorType } . */
public List < io . motown . vas . v10 . soap . schema . ConnectorType > getConnectorTypes ( ChargingStation chargingStation ) { } }
|
List < io . motown . vas . v10 . soap . schema . ConnectorType > connectorTypes = new ArrayList < > ( ) ; for ( ConnectorType connectorType : chargingStation . getConnectorTypes ( ) ) { if ( connectorType . equals ( ConnectorType . TEPCO_CHA_DE_MO ) ) { connectorTypes . add ( io . motown . vas . v10 . soap . schema . ConnectorType . TEPCO_CHA_ME_DO ) ; } else { connectorTypes . add ( io . motown . vas . v10 . soap . schema . ConnectorType . fromValue ( connectorType . value ( ) ) ) ; } } return connectorTypes ;
|
public class UrlBeautifier { /** * < code >
* Convert a URI into a query object . Mappings will be converted to the
* correct search and refinement state .
* < / code >
* @ param url
* The URI to parse into a query object
* @ param defaultQuery
* The default query to use if this URL does not correctly parse .
* @ throws UrlBeautifier . UrlBeautificationException */
public Query fromUrl ( String url , Query defaultQuery ) throws UrlBeautifier . UrlBeautificationException { } }
|
URI uri ; try { uri = new URI ( url ) ; } catch ( URISyntaxException e ) { throw new UrlBeautifier . UrlBeautificationException ( "Unable to parse url" , e ) ; } String urlQueryString = uri . getQuery ( ) ; if ( StringUtils . isNotBlank ( urlQueryString ) && idPattern . matcher ( urlQueryString ) . matches ( ) ) { Matcher m = idPattern . matcher ( urlQueryString ) ; m . find ( ) ; return createQuery ( ) . addValueRefinement ( ID , m . group ( 1 ) ) ; } else { Query query = createQuery ( ) ; String replacementUrlQueryString = getReplacementQuery ( uri . getRawQuery ( ) ) ; List < String > pathSegments = new ArrayList < String > ( ) ; String uriPath = uri . getPath ( ) ; if ( StringUtils . isNotBlank ( append ) && uriPath . endsWith ( append ) ) { uriPath = uriPath . substring ( 0 , uriPath . length ( ) - append . length ( ) ) ; } pathSegments . addAll ( asList ( uriPath . split ( "/" ) ) ) ; String pathSegmentLookup = lastSegment ( pathSegments ) ; if ( pathSegments . size ( ) > pathSegmentLookup . length ( ) ) { removeUnusedPathSegments ( pathSegments , pathSegmentLookup ) ; } else if ( pathSegments . size ( ) < pathSegmentLookup . length ( ) ) { return defaultQuery ; } try { pathSegments = applyReplacementToPathSegment ( pathSegments , UrlReplacement . parseQueryString ( replacementUrlQueryString ) ) ; } catch ( ParserException e ) { throw new UrlBeautifier . UrlBeautificationException ( "Replacement Query is malformed, returning default query" , e ) ; } while ( pathSegments . size ( ) > 0 ) { addRefinement ( pathSegments , query , pathSegmentLookup ) ; } if ( StringUtils . isNotBlank ( urlQueryString ) ) { String [ ] queryParams = urlQueryString . split ( "\\&" ) ; if ( ArrayUtils . isNotEmpty ( queryParams ) ) { for ( String keyValue : queryParams ) { if ( keyValue . startsWith ( refinementsQueryParameterName + "=" ) ) { String v = keyValue . substring ( refinementsQueryParameterName . length ( ) ) ; query . addRefinementsByString ( v ) ; break ; } } } } return query ; }
|
public class JSONArray { /** * Convert a stream of JSONArray text into JSONArray form .
* @ param is The inputStream from which to read the JSON . It will assume the input stream is in UTF - 8 and read it as such .
* @ return The contructed JSONArray Object .
* @ throws IOEXception Thrown if an underlying IO error from the stream occurs , or if malformed JSON is read , */
static public JSONArray parse ( InputStream is ) throws IOException { } }
|
InputStreamReader isr = null ; try { isr = new InputStreamReader ( is , "UTF-8" ) ; } catch ( Exception ex ) { isr = new InputStreamReader ( is ) ; } return parse ( isr ) ;
|
public class ChildWorkflowExecutionTerminatedEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ChildWorkflowExecutionTerminatedEventAttributes childWorkflowExecutionTerminatedEventAttributes , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( childWorkflowExecutionTerminatedEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( childWorkflowExecutionTerminatedEventAttributes . getWorkflowExecution ( ) , WORKFLOWEXECUTION_BINDING ) ; protocolMarshaller . marshall ( childWorkflowExecutionTerminatedEventAttributes . getWorkflowType ( ) , WORKFLOWTYPE_BINDING ) ; protocolMarshaller . marshall ( childWorkflowExecutionTerminatedEventAttributes . getInitiatedEventId ( ) , INITIATEDEVENTID_BINDING ) ; protocolMarshaller . marshall ( childWorkflowExecutionTerminatedEventAttributes . getStartedEventId ( ) , STARTEDEVENTID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AbstractIoBufferEx { /** * { @ inheritDoc } */
@ Override public int compareTo ( IoBuffer that ) { } }
|
int n = this . position ( ) + Math . min ( this . remaining ( ) , that . remaining ( ) ) ; for ( int i = this . position ( ) , j = that . position ( ) ; i < n ; i ++ , j ++ ) { byte v1 = this . get ( i ) ; byte v2 = that . get ( j ) ; if ( v1 == v2 ) { continue ; } if ( v1 < v2 ) { return - 1 ; } return + 1 ; } return this . remaining ( ) - that . remaining ( ) ;
|
public class StringEscapeUtils { /** * Modified from the quote method in :
* https : / / github . com / codehaus / jettison / blob / master / src / main / java / org / codehaus / jettison / json / JSONObject . java
* @ param string The string to escape .
* @ return An escaped JSON string . */
public static String escapeJson ( @ Nullable String string ) { } }
|
if ( StringUtils . isEmpty ( string ) ) { return "" ; } int len = string . length ( ) ; StringBuilder sb = new StringBuilder ( len + 2 ) ; for ( int i = 0 ; i < len ; i += 1 ) { char c = string . charAt ( i ) ; switch ( c ) { case '\\' : case '"' : sb . append ( '\\' ) ; sb . append ( c ) ; break ; case '\b' : sb . append ( "\\b" ) ; break ; case '\t' : sb . append ( "\\t" ) ; break ; case '\n' : sb . append ( "\\n" ) ; break ; case '\f' : sb . append ( "\\f" ) ; break ; case '\r' : sb . append ( "\\r" ) ; break ; default : if ( c < ' ' ) { String t = "000" + Integer . toHexString ( c ) ; sb . append ( "\\u" ) . append ( t . substring ( t . length ( ) - 4 ) ) ; } else { sb . append ( c ) ; } } } return sb . toString ( ) ;
|
public class JavadocPopup { @ Override public void show ( final Component c , final int iX , final int iY ) { } }
|
super . show ( c , iX , iY ) ; EventQueue . invokeLater ( ( ) -> { if ( ! _bResizedWidth && _viewer . getWidth ( ) > MAX_WIDTH ) { // noinspection SuspiciousNameCombination
_scroller . setPreferredSize ( new Dimension ( MAX_WIDTH , MAX_WIDTH ) ) ; _bResizedWidth = true ; pack ( ) ; setVisible ( false ) ; show ( c , iX , iY ) ; return ; } if ( ! _bResizedHeight && isViewerLessThanHalfFull ( ) ) { _scroller . setPreferredSize ( new Dimension ( MAX_WIDTH , _scroller . getHeight ( ) / 2 ) ) ; _bResizedHeight = true ; pack ( ) ; setVisible ( false ) ; show ( c , iX , iY ) ; } } ) ;
|
public class DB { /** * Resolves a user by username , possibly with the internal cache .
* @ param username The username .
* @ return The user or { @ code null } , if not found .
* @ throws SQLException on database error . */
public User resolveUser ( final String username ) throws SQLException { } }
|
metrics . usernameCacheTries . mark ( ) ; User user = usernameCache . getIfPresent ( username ) ; if ( user != null ) { metrics . usernameCacheHits . mark ( ) ; return user ; } else { user = selectUser ( username ) ; if ( user != null ) { usernameCache . put ( username , user ) ; } return user ; }
|
public class TileUtil { /** * Compute some hash value for " randomizing " tileset picks
* based on x and y coordinates .
* @ return a positive , seemingly random number based on x and y . */
public static int getTileHash ( int x , int y ) { } }
|
long seed = ( ( ( x << 2 ) ^ y ) ^ MULTIPLIER ) & MASK ; long hash = ( seed * MULTIPLIER + ADDEND ) & MASK ; return ( int ) ( hash >>> 30 ) ;
|
public class ClasspathUtils { /** * Returns the classpath as a list of the names of archive files . Any
* classpath component that is not an archive will be ignored .
* @ return the classpath as a list of archive file names ; if no archives can
* be found then an empty list will be returned */
public static List getClasspathArchives ( ) { } }
|
List archives = new ArrayList ( ) ; List components = getClasspathComponents ( ) ; for ( Iterator i = components . iterator ( ) ; i . hasNext ( ) ; ) { String possibleDir = ( String ) i . next ( ) ; File file = new File ( possibleDir ) ; if ( file . isFile ( ) && ( file . getName ( ) . endsWith ( ".jar" ) || file . getName ( ) . endsWith ( ".zip" ) ) ) { archives . add ( possibleDir ) ; } } return archives ;
|
public class AeronNDArraySubscriber { /** * Returns the connection uri in the form of :
* host : port : streamId
* @ return */
public String connectionUrl ( ) { } }
|
String [ ] split = channel . replace ( "aeron:udp?endpoint=" , "" ) . split ( ":" ) ; String host = split [ 0 ] ; int port = Integer . parseInt ( split [ 1 ] ) ; return AeronConnectionInformation . of ( host , port , streamId ) . toString ( ) ;
|
public class MessageLogHeaderScreen { /** * Add all the screen listeners . */
public void addListeners ( ) { } }
|
super . addListeners ( ) ; this . setEditing ( true ) ; Record screenRecord = this . getScreenRecord ( ) ; ReferenceField fldMessageInfoType = ( ReferenceField ) screenRecord . getField ( MessageLogScreenRecord . MESSAGE_INFO_TYPE_ID ) ;
|
public class FakeClientBundleProvider { /** * Creates a fake resource class that returns its own name where possible . */
@ SuppressWarnings ( "unchecked" ) // safe since the proxy implements type
private < T > T createFakeResource ( Class < T > type , final String name ) { } }
|
return ( T ) Proxy . newProxyInstance ( FakeClientBundleProvider . class . getClassLoader ( ) , new Class < ? > [ ] { type } , new InvocationHandler ( ) { @ Override public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Exception { Class < ? > returnType = method . getReturnType ( ) ; if ( returnType == String . class ) { return name ; } else if ( returnType == SafeHtml . class ) { return SafeHtmlUtils . fromTrustedString ( name ) ; } else if ( returnType == SafeUri . class ) { return UriUtils . fromTrustedString ( name ) ; } else if ( returnType == boolean . class ) { return false ; } else if ( returnType == int . class ) { return 0 ; } else if ( method . getParameterTypes ( ) [ 0 ] == ResourceCallback . class ) { // Read the underlying resource type out of the generic parameter
// in the method ' s argument
Class < ? > resourceType = ( Class < ? > ) ( ( ParameterizedType ) args [ 0 ] . getClass ( ) . getGenericInterfaces ( ) [ 0 ] ) . getActualTypeArguments ( ) [ 0 ] ; ( ( ResourceCallback < ResourcePrototype > ) args [ 0 ] ) . onSuccess ( ( ResourcePrototype ) createFakeResource ( resourceType , name ) ) ; return null ; } else { throw new IllegalArgumentException ( "Unexpected return type for method " + method . getName ( ) ) ; } } } ) ;
|
public class SqlTileWriterExt { /** * gets all the tiles sources that we have tiles for in the cache database and their counts
* @ return */
public List < SourceCount > getSources ( ) { } }
|
final SQLiteDatabase db = getDb ( ) ; List < SourceCount > ret = new ArrayList < > ( ) ; if ( db == null ) { return ret ; } Cursor cur = null ; try { cur = db . rawQuery ( "select " + COLUMN_PROVIDER + ",count(*) " + ",min(length(" + COLUMN_TILE + ")) " + ",max(length(" + COLUMN_TILE + ")) " + ",sum(length(" + COLUMN_TILE + ")) " + "from " + TABLE + " " + "group by " + COLUMN_PROVIDER , null ) ; while ( cur . moveToNext ( ) ) { final SourceCount c = new SourceCount ( ) ; c . source = cur . getString ( 0 ) ; c . rowCount = cur . getLong ( 1 ) ; c . sizeMin = cur . getLong ( 2 ) ; c . sizeMax = cur . getLong ( 3 ) ; c . sizeTotal = cur . getLong ( 4 ) ; c . sizeAvg = c . sizeTotal / c . rowCount ; ret . add ( c ) ; } } catch ( Exception e ) { catchException ( e ) ; } finally { if ( cur != null ) { cur . close ( ) ; } } return ret ;
|
public class CommerceShippingFixedOptionPersistenceImpl { /** * Returns the first commerce shipping fixed option in the ordered set where commerceShippingMethodId = & # 63 ; .
* @ param commerceShippingMethodId the commerce shipping method ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce shipping fixed option , or < code > null < / code > if a matching commerce shipping fixed option could not be found */
@ Override public CommerceShippingFixedOption fetchByCommerceShippingMethodId_First ( long commerceShippingMethodId , OrderByComparator < CommerceShippingFixedOption > orderByComparator ) { } }
|
List < CommerceShippingFixedOption > list = findByCommerceShippingMethodId ( commerceShippingMethodId , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ;
|
public class PactDslJsonArray { /** * Root level array where each item must match the provided matcher
* @ param numberExamples Number of examples to generate */
public static PactDslJsonArray arrayEachLike ( Integer numberExamples , PactDslJsonRootValue value ) { } }
|
PactDslJsonArray parent = new PactDslJsonArray ( "" , "" , null , true ) ; parent . setNumberExamples ( numberExamples ) ; parent . matchers . addRule ( "" , parent . matchMin ( 0 ) ) ; parent . putObject ( value ) ; return parent ;
|
public class BceClientConfiguration { /** * Sets the User - Agent header value to use when sending requests to BCE services .
* If the specified value is null , DEFAULT _ USER _ AGENT is used . If the specified value does not end with
* DEFAULT _ USER _ AGENT , DEFAULT _ USER _ AGENT is appended .
* @ param userAgent the User - Agent header value to use when sending requests to BCE services . */
public void setUserAgent ( String userAgent ) { } }
|
if ( userAgent == null ) { this . userAgent = DEFAULT_USER_AGENT ; } else if ( userAgent . endsWith ( DEFAULT_USER_AGENT ) ) { this . userAgent = userAgent ; } else { this . userAgent = userAgent + ", " + DEFAULT_USER_AGENT ; }
|
public class EtcdClient { /** * Returns a representation of all members in the etcd cluster .
* @ return the members
* @ throws EtcdException
* in case etcd returned an error */
public EtcdMemberResponse listMembers ( ) throws EtcdException { } }
|
UriComponentsBuilder builder = UriComponentsBuilder . fromUriString ( MEMBERSPACE ) ; return execute ( builder , HttpMethod . GET , null , EtcdMemberResponse . class ) ;
|
public class AbstractSchemaScannerPlugin { /** * Create the foreign key descriptors .
* @ param allForeignKeys All collected foreign keys .
* @ param allColumns All collected columns .
* @ param store The store . */
private void createForeignKeys ( Set < ForeignKey > allForeignKeys , Map < Column , ColumnDescriptor > allColumns , Store store ) { } }
|
// Foreign keys
for ( ForeignKey foreignKey : allForeignKeys ) { ForeignKeyDescriptor foreignKeyDescriptor = store . create ( ForeignKeyDescriptor . class ) ; foreignKeyDescriptor . setName ( foreignKey . getName ( ) ) ; foreignKeyDescriptor . setDeferrability ( foreignKey . getDeferrability ( ) . name ( ) ) ; foreignKeyDescriptor . setDeleteRule ( foreignKey . getDeleteRule ( ) . name ( ) ) ; foreignKeyDescriptor . setUpdateRule ( foreignKey . getUpdateRule ( ) . name ( ) ) ; for ( ForeignKeyColumnReference columnReference : foreignKey . getColumnReferences ( ) ) { ForeignKeyReferenceDescriptor keyReferenceDescriptor = store . create ( ForeignKeyReferenceDescriptor . class ) ; // foreign key table and column
Column foreignKeyColumn = columnReference . getForeignKeyColumn ( ) ; ColumnDescriptor foreignKeyColumnDescriptor = allColumns . get ( foreignKeyColumn ) ; keyReferenceDescriptor . setForeignKeyColumn ( foreignKeyColumnDescriptor ) ; // primary key table and column
Column primaryKeyColumn = columnReference . getPrimaryKeyColumn ( ) ; ColumnDescriptor primaryKeyColumnDescriptor = allColumns . get ( primaryKeyColumn ) ; keyReferenceDescriptor . setPrimaryKeyColumn ( primaryKeyColumnDescriptor ) ; foreignKeyDescriptor . getForeignKeyReferences ( ) . add ( keyReferenceDescriptor ) ; } }
|
public class Collections { /** * Add elements to a collection and return the collection .
* This only differs from
* { @ link java . util . Collections # addAll ( Collection , Object [ ] ) }
* in that it returns the collection instead of a boolean .
* @ param c The collection to add to .
* @ param elements The elements to add .
* @ return c
* @ see java . util . Collections # addAll ( Collection , Object [ ] ) */
public static < T > Collection < ? super T > addAll ( Collection < ? super T > c , T ... elements ) { } }
|
java . util . Collections . addAll ( c , elements ) ; return c ;
|
public class cspolicylabel_cspolicy_binding { /** * Use this API to fetch cspolicylabel _ cspolicy _ binding resources of given name . */
public static cspolicylabel_cspolicy_binding [ ] get ( nitro_service service , String labelname ) throws Exception { } }
|
cspolicylabel_cspolicy_binding obj = new cspolicylabel_cspolicy_binding ( ) ; obj . set_labelname ( labelname ) ; cspolicylabel_cspolicy_binding response [ ] = ( cspolicylabel_cspolicy_binding [ ] ) obj . get_resources ( service ) ; return response ;
|
public class Library { /** * The shading prefix added to this class ' s full name .
* @ throws UnsatisfiedLinkError if the shader used something other than a prefix */
private static String calculatePackagePrefix ( ) { } }
|
String maybeShaded = Library . class . getName ( ) ; // Use ! instead of . to avoid shading utilities from modifying the string
String expected = "io!netty!internal!tcnative!Library" . replace ( '!' , '.' ) ; if ( ! maybeShaded . endsWith ( expected ) ) { throw new UnsatisfiedLinkError ( String . format ( "Could not find prefix added to %s to get %s. When shading, only adding a " + "package prefix is supported" , expected , maybeShaded ) ) ; } return maybeShaded . substring ( 0 , maybeShaded . length ( ) - expected . length ( ) ) ;
|
public class SGDNetworkTrainer { /** * Applies dropout to the given matrix
* @ param X the matrix to dropout values from
* @ param randThresh the threshold that a random integer must be less than to get dropped out
* @ param rand the source of randomness
* @ param ex the source of threads for parlallel computation , or { @ code null } */
private static void applyDropout ( final Matrix X , final int randThresh , final Random rand , ExecutorService ex ) { } }
|
if ( ex == null ) { for ( int i = 0 ; i < X . rows ( ) ; i ++ ) for ( int j = 0 ; j < X . cols ( ) ; j ++ ) if ( rand . nextInt ( ) < randThresh ) X . set ( i , j , 0.0 ) ; } else { final CountDownLatch latch = new CountDownLatch ( SystemInfo . LogicalCores ) ; for ( int id = 0 ; id < SystemInfo . LogicalCores ; id ++ ) { final int ID = id ; ex . submit ( new Runnable ( ) { @ Override public void run ( ) { for ( int i = ID ; i < X . rows ( ) ; i += SystemInfo . LogicalCores ) for ( int j = 0 ; j < X . cols ( ) ; j ++ ) if ( rand . nextInt ( ) < randThresh ) X . set ( i , j , 0.0 ) ; latch . countDown ( ) ; } } ) ; } try { latch . await ( ) ; } catch ( InterruptedException ex1 ) { Logger . getLogger ( SGDNetworkTrainer . class . getName ( ) ) . log ( Level . SEVERE , null , ex1 ) ; } }
|
public class HttpMethodBase { /** * Writes the request headers to the given { @ link HttpConnection connection } .
* This implementation invokes { @ link # addRequestHeaders ( HttpState , HttpConnection ) } ,
* and then writes each header to the request stream .
* Subclasses may want to override this method to to customize the
* processing .
* @ param state the { @ link HttpState state } information associated with this method
* @ param conn the { @ link HttpConnection connection } used to execute
* this HTTP method
* @ throws IOException if an I / O ( transport ) error occurs . Some transport exceptions
* can be recovered from .
* @ throws HttpException if a protocol exception occurs . Usually protocol exceptions
* cannot be recovered from .
* @ see # addRequestHeaders
* @ see # getRequestHeaders */
protected void writeRequestHeaders ( HttpState state , HttpConnection conn ) throws IOException , HttpException { } }
|
LOG . trace ( "enter HttpMethodBase.writeRequestHeaders(HttpState," + "HttpConnection)" ) ; addRequestHeaders ( state , conn ) ; String charset = getParams ( ) . getHttpElementCharset ( ) ; Header [ ] headers = getRequestHeaders ( ) ; for ( int i = 0 ; i < headers . length ; i ++ ) { String s = headers [ i ] . toExternalForm ( ) ; if ( Wire . HEADER_WIRE . enabled ( ) ) { Wire . HEADER_WIRE . output ( s ) ; } conn . print ( s , charset ) ; }
|
public class CsvExporter { /** * Write one csv field to the file , followed by a separator unless it is the
* last field on the line . Lead and trailing blanks will be removed .
* @ param p print stream
* @ param s The string to write . Any additional quotes or embedded quotes
* will be provided by put . Null means start a new line . */
private void put ( PrintStream p , String s ) { } }
|
if ( s == null ) { // nl ( ) ;
put ( p , " " ) ; return ; } if ( wasPreviousField ) { p . print ( separator ) ; } if ( trim ) { s = s . trim ( ) ; } if ( s . indexOf ( quote ) >= 0 ) { /* worst case , needs surrounding quotes and internal quotes doubled */
p . print ( quote ) ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == quote ) { p . print ( quote ) ; p . print ( quote ) ; } else { p . print ( c ) ; } } p . print ( quote ) ; } else if ( quoteLevel == 2 || quoteLevel == 1 && s . indexOf ( ' ' ) >= 0 || s . indexOf ( separator ) >= 0 ) { /* need surrounding quotes */
p . print ( quote ) ; p . print ( s ) ; p . print ( quote ) ; } else { /* ordinary case , no surrounding quotes needed */
p . print ( s ) ; } /* make a note to print trailing comma later */
wasPreviousField = true ;
|
public class ServerMappingController { /** * Adds a redirect URL to the specified profile ID
* @ param model
* @ param profileId
* @ param srcUrl
* @ param destUrl
* @ param hostHeader
* @ return
* @ throws Exception */
@ RequestMapping ( value = "api/edit/server" , method = RequestMethod . POST ) public @ ResponseBody ServerRedirect addRedirectToProfile ( Model model , @ RequestParam ( value = "profileId" , required = false ) Integer profileId , @ RequestParam ( value = "profileIdentifier" , required = false ) String profileIdentifier , @ RequestParam ( value = "srcUrl" , required = true ) String srcUrl , @ RequestParam ( value = "destUrl" , required = true ) String destUrl , @ RequestParam ( value = "clientUUID" , required = true ) String clientUUID , @ RequestParam ( value = "hostHeader" , required = false ) String hostHeader ) throws Exception { } }
|
if ( profileId == null && profileIdentifier == null ) { throw new Exception ( "profileId required" ) ; } if ( profileId == null ) { profileId = ProfileService . getInstance ( ) . getIdFromName ( profileIdentifier ) ; } int clientId = ClientService . getInstance ( ) . findClient ( clientUUID , profileId ) . getId ( ) ; int redirectId = ServerRedirectService . getInstance ( ) . addServerRedirectToProfile ( "" , srcUrl , destUrl , hostHeader , profileId , clientId ) ; return ServerRedirectService . getInstance ( ) . getRedirect ( redirectId ) ;
|
public class CloudTasksClient { /** * Purges a queue by deleting all of its tasks .
* < p > All tasks created before this method is called are permanently deleted .
* < p > Purge operations can take up to one minute to take effect . Tasks might be dispatched before
* the purge takes effect . A purge is irreversible .
* < p > Sample code :
* < pre > < code >
* try ( CloudTasksClient cloudTasksClient = CloudTasksClient . create ( ) ) {
* QueueName name = QueueName . of ( " [ PROJECT ] " , " [ LOCATION ] " , " [ QUEUE ] " ) ;
* Queue response = cloudTasksClient . purgeQueue ( name ) ;
* < / code > < / pre >
* @ param name Required .
* < p > The queue name . For example : ` projects / PROJECT _ ID / location / LOCATION _ ID / queues / QUEUE _ ID `
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Queue purgeQueue ( QueueName name ) { } }
|
PurgeQueueRequest request = PurgeQueueRequest . newBuilder ( ) . setName ( name == null ? null : name . toString ( ) ) . build ( ) ; return purgeQueue ( request ) ;
|
public class SoftTFIDFDictionary { /** * Simple main for testing and experimentation */
static public void main ( String [ ] argv ) throws IOException , FileNotFoundException , NumberFormatException , ClassNotFoundException { } }
|
if ( argv . length == 0 ) { System . out . println ( "usage 1: aliasfile threshold query1 query2 ... - run queries" ) ; System . out . println ( "usage 2: aliasfile threshold queryfile - run queries from a file" ) ; System . out . println ( "usage 3: aliasfile window1 window2 .... - explore different window sizes" ) ; System . out . println ( "usage 4: aliasfile savefile - convert to fast-loading savefile" ) ; System . out . println ( "usage 4: aliasfile - print some stats" ) ; System . exit ( 0 ) ; } SoftTFIDFDictionary dict = loadSomehow ( argv [ 0 ] ) ; if ( argv . length == 1 ) { System . out . println ( "inverted index sizes:" ) ; for ( int i = 0 ; i < dict . numTokens ; i ++ ) { Token toki = dict . allTokens [ i ] ; Set ii = dict . invertedIndex [ toki . getIndex ( ) ] ; System . out . println ( ii . size ( ) + " " + toki . getValue ( ) ) ; } } else if ( argv . length == 2 ) { // aliasfile savefile
System . out . println ( "saving..." ) ; dict . saveAs ( new File ( argv [ 1 ] ) ) ; } else { double d = Double . parseDouble ( argv [ 1 ] ) ; if ( d <= 1 ) { // aliasfile threshold . . . .
if ( argv . length == 3 && new File ( argv [ 2 ] ) . exists ( ) ) { // aliasfile threshold queryfile
LineNumberReader in = new LineNumberReader ( new FileReader ( new File ( argv [ 2 ] ) ) ) ; String line ; // store fast time , slow time , fast values , slow values , # times [ fastValues = slowValues ]
double [ ] stats = new double [ 5 ] ; int numQueries = 0 ; while ( ( line = in . readLine ( ) ) != null ) { doLookup ( dict , d , line , true , stats ) ; numQueries ++ ; } System . out . println ( "optimized time: " + stats [ 0 ] ) ; System . out . println ( "baseline time: " + stats [ 1 ] ) ; System . out . println ( "speedup: " + stats [ 1 ] / stats [ 0 ] ) ; System . out . println ( "optimized values: " + stats [ 2 ] ) ; System . out . println ( "baseline values: " + stats [ 3 ] ) ; System . out . println ( "percent complete: " + stats [ 4 ] / numQueries ) ; } else { // aliasfile threshold query1 query2 . . . .
for ( int i = 2 ; i < argv . length ; i ++ ) { doLookup ( dict , d , argv [ i ] , false , null ) ; } } } else { // aliasfile window1 window2 . . . .
dict . setWindowSize ( 2 ) ; // for a quick load
System . out . println ( "loading..." ) ; dict . loadAliases ( new File ( argv [ 0 ] ) ) ; System . out . println ( "loaded " + dict . numTokens + " tokens" ) ; System . out . println ( "window" + "\t" + "time" + "\t" + "#pairs" + "\t" + "pairs/token" ) ; java . text . DecimalFormat fmt = new java . text . DecimalFormat ( "0.000" ) ; for ( int i = 1 ; i < argv . length ; i ++ ) { int w = Integer . parseInt ( argv [ i ] ) ; dict . setWindowSize ( w ) ; long start = System . currentTimeMillis ( ) ; dict . refreeze ( ) ; double elapsedSec = ( System . currentTimeMillis ( ) - start ) / 1000.0 ; double tot = dict . getNumberOfSimilarTokenPairs ( ) ; System . out . println ( w + "\t" + fmt . format ( elapsedSec ) + "\t" + tot + "\t" + fmt . format ( tot / dict . numTokens ) ) ; } } }
|
public class Convert { /** * Converts any value to < code > Double < / code > .
* @ param value value to convert .
* @ return converted double . */
public static Double toDouble ( Object value ) { } }
|
if ( value == null ) { return null ; } else if ( value instanceof Double ) { return ( Double ) value ; } else if ( value instanceof Number ) { return ( ( Number ) value ) . doubleValue ( ) ; } else { try { return Double . valueOf ( value . toString ( ) . trim ( ) ) ; } catch ( NumberFormatException e ) { throw new ConversionException ( "failed to convert: '" + value + "' to Double" , e ) ; } }
|
public class ColumnText { /** * Converts a sequence of lines representing one of the column bounds into
* an internal format .
* Each array element will contain a < CODE > float [ 4 ] < / CODE > representing
* the line x = ax + b .
* @ param cLine the column array
* @ return the converted array */
protected ArrayList convertColumn ( float cLine [ ] ) { } }
|
if ( cLine . length < 4 ) throw new RuntimeException ( "No valid column line found." ) ; ArrayList cc = new ArrayList ( ) ; for ( int k = 0 ; k < cLine . length - 2 ; k += 2 ) { float x1 = cLine [ k ] ; float y1 = cLine [ k + 1 ] ; float x2 = cLine [ k + 2 ] ; float y2 = cLine [ k + 3 ] ; if ( y1 == y2 ) continue ; // x = ay + b
float a = ( x1 - x2 ) / ( y1 - y2 ) ; float b = x1 - a * y1 ; float r [ ] = new float [ 4 ] ; r [ 0 ] = Math . min ( y1 , y2 ) ; r [ 1 ] = Math . max ( y1 , y2 ) ; r [ 2 ] = a ; r [ 3 ] = b ; cc . add ( r ) ; maxY = Math . max ( maxY , r [ 1 ] ) ; minY = Math . min ( minY , r [ 0 ] ) ; } if ( cc . isEmpty ( ) ) throw new RuntimeException ( "No valid column line found." ) ; return cc ;
|
public class CmsSerialDateController { /** * Sets the whole day flag .
* @ param isWholeDay flag , indicating if the event lasts whole days . */
public void setWholeDay ( Boolean isWholeDay ) { } }
|
if ( m_model . isWholeDay ( ) ^ ( ( null != isWholeDay ) && isWholeDay . booleanValue ( ) ) ) { m_model . setWholeDay ( isWholeDay ) ; valueChanged ( ) ; }
|
public class UpdateWaitTimeForStation { /** * Calculate the current average wait time for each station and prune old wait time calculations .
* @ param ttl _ seconds Time - to - live for wait time calculations , results older than this will be deleted .
* @ return
* @ throws VoltAbortException */
public VoltTable [ ] run ( short station , long ttl_seconds ) throws VoltAbortException { } }
|
voltQueueSQL ( getLastDeparts , station ) ; // For each station , calculate the wait time between departures
final StationStats stats = getStationStats ( station , voltExecuteSQL ( ) ) ; voltQueueSQL ( updateWaitTime , stats . station , stats . lastDepartTime , stats . totalTime , stats . totalEntries ) ; // Prune old data
voltQueueSQL ( deleteOldData , - ttl_seconds ) ; return voltExecuteSQL ( true ) ;
|
public class UsbDeviceUtilities { /** * Return an integer vendor ID from a URI specifying a USB device .
* @ param uri the USB device URI
* @ throws DataSourceResourceException If the URI doesn ' t match the
* format usb : / / vendor _ id / device _ id */
public static int vendorFromUri ( URI uri ) throws DataSourceResourceException { } }
|
try { return Integer . parseInt ( uri . getAuthority ( ) , 16 ) ; } catch ( NumberFormatException e ) { throw new DataSourceResourceException ( "USB device must be of the format " + DEFAULT_USB_DEVICE_URI + " -- the given " + uri + " has a bad vendor ID" ) ; }
|
public class ImageResolutionImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } }
|
switch ( featureID ) { case AfplibPackage . IMAGE_RESOLUTION__XBASE : setXBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . IMAGE_RESOLUTION__YBASE : setYBase ( ( Integer ) newValue ) ; return ; case AfplibPackage . IMAGE_RESOLUTION__XRESOL : setXResol ( ( Integer ) newValue ) ; return ; case AfplibPackage . IMAGE_RESOLUTION__YRESOL : setYResol ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
|
public class AmazonRDSWaiters { /** * Builds a DBSnapshotAvailable waiter by using custom parameters waiterParameters and other parameters defined in
* the waiters specification , and then polls until it determines whether the resource entered the desired state or
* not , where polling criteria is bound by either default polling strategy or custom polling strategy . */
public Waiter < DescribeDBSnapshotsRequest > dBSnapshotAvailable ( ) { } }
|
return new WaiterBuilder < DescribeDBSnapshotsRequest , DescribeDBSnapshotsResult > ( ) . withSdkFunction ( new DescribeDBSnapshotsFunction ( client ) ) . withAcceptors ( new DBSnapshotAvailable . IsAvailableMatcher ( ) , new DBSnapshotAvailable . IsDeletedMatcher ( ) , new DBSnapshotAvailable . IsDeletingMatcher ( ) , new DBSnapshotAvailable . IsFailedMatcher ( ) , new DBSnapshotAvailable . IsIncompatiblerestoreMatcher ( ) , new DBSnapshotAvailable . IsIncompatibleparametersMatcher ( ) ) . withDefaultPollingStrategy ( new PollingStrategy ( new MaxAttemptsRetryStrategy ( 60 ) , new FixedDelayStrategy ( 30 ) ) ) . withExecutorService ( executorService ) . build ( ) ;
|
public class DBClosure { /** * Simplified function to execute under admin
* @ param func function to be executed
* @ param < R > type of returned value
* @ return result of a function */
public static < R > R sudo ( Function < ODatabaseDocument , R > func ) { } }
|
return new DBClosure < R > ( ) { @ Override protected R execute ( ODatabaseDocument db ) { return func . apply ( db ) ; } } . execute ( ) ;
|
public class SparkSequenceVectors { /** * This method builds shadow vocabulary and huffman tree
* @ param counter
* @ return */
protected VocabCache < ShallowSequenceElement > buildShallowVocabCache ( Counter < Long > counter ) { } }
|
// TODO : need simplified cache here , that will operate on Long instead of string labels
VocabCache < ShallowSequenceElement > vocabCache = new AbstractCache < > ( ) ; for ( Long id : counter . keySet ( ) ) { ShallowSequenceElement shallowElement = new ShallowSequenceElement ( counter . getCount ( id ) , id ) ; vocabCache . addToken ( shallowElement ) ; } // building huffman tree
Huffman huffman = new Huffman ( vocabCache . vocabWords ( ) ) ; huffman . build ( ) ; huffman . applyIndexes ( vocabCache ) ; return vocabCache ;
|
public class Reflections { /** * Searches for a declared method with a given name . If the class declares multiple methods with the given name ,
* there is no guarantee as of which methods is returned . Null is returned if the class does not declare a method
* with the given name .
* @ param clazz the given class
* @ param methodName the given method name
* @ return method method with the given name declared by the given class or null if no such method exists */
public static Method findDeclaredMethodByName ( Class < ? > clazz , String methodName ) { } }
|
for ( Method method : AccessController . doPrivileged ( new GetDeclaredMethodsAction ( clazz ) ) ) { if ( methodName . equals ( method . getName ( ) ) ) { return method ; } } return null ;
|
public class InterconnectAttachmentClient { /** * Deletes the specified interconnect attachment .
* < p > Sample code :
* < pre > < code >
* try ( InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient . create ( ) ) {
* ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName . of ( " [ PROJECT ] " , " [ REGION ] " , " [ INTERCONNECT _ ATTACHMENT ] " ) ;
* Operation response = interconnectAttachmentClient . deleteInterconnectAttachment ( interconnectAttachment . toString ( ) ) ;
* < / code > < / pre >
* @ param interconnectAttachment Name of the interconnect attachment to delete .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
@ BetaApi public final Operation deleteInterconnectAttachment ( String interconnectAttachment ) { } }
|
DeleteInterconnectAttachmentHttpRequest request = DeleteInterconnectAttachmentHttpRequest . newBuilder ( ) . setInterconnectAttachment ( interconnectAttachment ) . build ( ) ; return deleteInterconnectAttachment ( request ) ;
|
public class CPAttachmentFileEntryUtil { /** * Returns the first cp attachment file entry in the ordered set where uuid = & # 63 ; and companyId = & # 63 ; .
* @ param uuid the uuid
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp attachment file entry , or < code > null < / code > if a matching cp attachment file entry could not be found */
public static CPAttachmentFileEntry fetchByUuid_C_First ( String uuid , long companyId , OrderByComparator < CPAttachmentFileEntry > orderByComparator ) { } }
|
return getPersistence ( ) . fetchByUuid_C_First ( uuid , companyId , orderByComparator ) ;
|
public class Http { /** * Sends a POST request and returns the response .
* @ param endpoint The endpoint to send the request to .
* @ param responseClass The class to deserialise the Json response to . Can be null if no response message is expected .
* @ param headers Any additional headers to send with this request . You can use { @ link org . apache . http . HttpHeaders } constants for header names .
* @ param < T > The type to deserialise the response to .
* @ return A { @ link Response } containing the deserialised body , if any .
* @ throws IOException If an error occurs . */
public < T > Response < T > delete ( Endpoint endpoint , Class < T > responseClass , NameValuePair ... headers ) throws IOException { } }
|
// Create the request
HttpDelete delete = new HttpDelete ( endpoint . url ( ) ) ; delete . setHeaders ( combineHeaders ( headers ) ) ; // Send the request and process the response
try ( CloseableHttpResponse response = httpClient ( ) . execute ( delete ) ) { T body = deserialiseResponseMessage ( response , responseClass ) ; return new Response < > ( response . getStatusLine ( ) , body ) ; }
|
public class RowColumnOps { /** * Updates the values of row < tt > i < / tt > in the given matrix to be A [ i , : ] = A [ i , : ] / c
* @ param A the matrix to perform he update on
* @ param i the row to update
* @ param start the first index of the row to update from ( inclusive )
* @ param to the last index of the row to update ( exclusive )
* @ param c the constant to divide each element by */
public static void divRow ( Matrix A , int i , int start , int to , double c ) { } }
|
for ( int j = start ; j < to ; j ++ ) A . set ( i , j , A . get ( i , j ) / c ) ;
|
public class LinkedList { /** * Adds the element to the back of the list .
* @ param object Object being added .
* @ return The element it was placed inside of */
public Element < T > pushTail ( T object ) { } }
|
Element < T > e = requestNew ( ) ; e . object = object ; if ( last == null ) { first = last = e ; } else { e . previous = last ; last . next = e ; last = e ; } size ++ ; return e ;
|
public class KerasPReLU { /** * Set weights for layer .
* @ param weights Dense layer weights */
@ Override public void setWeights ( Map < String , INDArray > weights ) throws InvalidKerasConfigurationException { } }
|
this . weights = new HashMap < > ( ) ; if ( weights . containsKey ( ALPHA ) ) this . weights . put ( PReLUParamInitializer . WEIGHT_KEY , weights . get ( ALPHA ) ) ; else throw new InvalidKerasConfigurationException ( "Parameter " + ALPHA + " does not exist in weights" ) ; if ( weights . size ( ) > 1 ) { Set < String > paramNames = weights . keySet ( ) ; paramNames . remove ( ALPHA ) ; String unknownParamNames = paramNames . toString ( ) ; log . warn ( "Attemping to set weights for unknown parameters: " + unknownParamNames . substring ( 1 , unknownParamNames . length ( ) - 1 ) ) ; }
|
public class ModelRegistry { /** * Generate a { @ link Key } representing both the
* { @ link org . apache . sling . api . resource . Resource # getResourceType ( ) sling resource type } ,
* { @ link javax . jcr . Node # getPrimaryNodeType ( ) primary node type } and the { @ link Node # getMixinNodeTypes ( ) mixin types }
* of the resource , if any . Rationale : Resources may have the same < code > sling : resourceType < / code > , but different primary or mixin types ,
* thus potentially producing different results when mapped . The cache must thus use these
* types as a key for cached adaptation results . < br / >
* @ param resource must not be < code > null < / code > .
* @ param furtherKeyElements can be < code > null < / code >
* @ return never < code > null < / code > . */
private static Key key ( Resource resource , Object ... furtherKeyElements ) { } }
|
Key key ; final Key furtherElementsKey = furtherKeyElements == null ? null : new Key ( furtherKeyElements ) ; Node node = resource . adaptTo ( Node . class ) ; if ( node != null ) { try { key = new Key ( resource . getResourceType ( ) , resource . getResourceSuperType ( ) , getPrimaryType ( node ) , geMixinTypes ( node ) , furtherElementsKey ) ; } catch ( RepositoryException e ) { throw new RuntimeException ( "Unable to retrieve the primary type of " + resource + "." , e ) ; } } else { key = new Key ( resource . getResourceType ( ) , furtherElementsKey ) ; } return key ;
|
public class HTTaxinvoiceServiceImp { /** * ( non - Javadoc )
* @ see com . popbill . api . HTTaxinvoiceService # registDeptUser ( java . lang . String , java . lang . String , java . lang . String ) */
public Response registDeptUser ( String corpNum , String deptUserID , String deptUserPWD ) throws PopbillException { } }
|
if ( corpNum == null || corpNum . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "연동회원 사업자번호(corpNum)가 입력되지 않았습니다." ) ; if ( deptUserID == null || deptUserID . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "홈택스 부서사용자 계정 아이디(deptUserID)가 입력되지 않았습니다." ) ; if ( deptUserPWD == null || deptUserPWD . isEmpty ( ) ) throw new PopbillException ( - 99999999 , "홈택스 부서사용자 계정 비밀번호(deptUserPWD)가 입력되지 않았습니다." ) ; DeptRequest request = new DeptRequest ( ) ; request . id = deptUserID ; request . pwd = deptUserPWD ; String PostData = toJsonString ( request ) ; return httppost ( "/HomeTax/Taxinvoice/DeptUser" , corpNum , PostData , null , Response . class ) ;
|
public class ChangesItem { /** * Merges current changes with new one . */
public void merge ( ChangesItem changesItem ) { } }
|
workspaceChangedSize += changesItem . getWorkspaceChangedSize ( ) ; for ( Entry < String , Long > changesEntry : changesItem . calculatedChangedNodesSize . entrySet ( ) ) { String nodePath = changesEntry . getKey ( ) ; Long currentDelta = changesEntry . getValue ( ) ; Long oldDelta = calculatedChangedNodesSize . get ( nodePath ) ; Long newDelta = currentDelta + ( oldDelta == null ? 0 : oldDelta ) ; calculatedChangedNodesSize . put ( nodePath , newDelta ) ; } for ( String path : changesItem . unknownChangedNodesSize ) { unknownChangedNodesSize . add ( path ) ; } for ( String path : changesItem . asyncUpdate ) { asyncUpdate . add ( path ) ; }
|
public class AdminDevice { /** * Get device properties
* @ param className
* @ return device properties and descriptions */
@ Command ( name = "QueryWizardDevProperty" , inTypeDesc = "Class name" , outTypeDesc = "Device property list (name - description and default value)" ) public String [ ] queryDevProp ( final String className ) { } }
|
xlogger . entry ( ) ; final List < String > names = new ArrayList < String > ( ) ; for ( final DeviceClassBuilder deviceClass : classList ) { if ( deviceClass . getClassName ( ) . equalsIgnoreCase ( className ) ) { final List < DeviceImpl > devices = deviceClass . getDeviceImplList ( ) ; if ( devices . size ( ) > 0 ) { final DeviceImpl dev = devices . get ( 0 ) ; final List < DevicePropertyImpl > props = dev . getDevicePropertyList ( ) ; for ( final DevicePropertyImpl prop : props ) { names . add ( prop . getName ( ) ) ; names . add ( prop . getDescription ( ) ) ; // default value
if ( prop . getDefaultValue ( ) . length == 0 ) { names . add ( "" ) ; } else { names . add ( prop . getDefaultValue ( ) [ 0 ] ) ; } } } break ; } } xlogger . exit ( names ) ; return names . toArray ( new String [ names . size ( ) ] ) ;
|
public class Strs { /** * Returns a { @ code String } between matcher that matches any character in a given range
* @ param target
* @ param left
* @ param right
* @ return */
public static Betner betn ( String target , String left , String right ) { } }
|
return betn ( target ) . between ( left , right ) ;
|
public class Math { /** * Returns the floating - point number adjacent to the first
* argument in the direction of the second argument . If both
* arguments compare as equal a value equivalent to the second argument
* is returned .
* Special cases :
* < ul >
* < li > If either argument is a NaN , then NaN is returned .
* < li > If both arguments are signed zeros , a value equivalent
* to { @ code direction } is returned .
* < li > If { @ code start } is
* & plusmn ; { @ link Float # MIN _ VALUE } and { @ code direction }
* has a value such that the result should have a smaller
* magnitude , then a zero with the same sign as { @ code start }
* is returned .
* < li > If { @ code start } is infinite and
* { @ code direction } has a value such that the result should
* have a smaller magnitude , { @ link Float # MAX _ VALUE } with the
* same sign as { @ code start } is returned .
* < li > If { @ code start } is equal to & plusmn ;
* { @ link Float # MAX _ VALUE } and { @ code direction } has a
* value such that the result should have a larger magnitude , an
* infinity with same sign as { @ code start } is returned .
* < / ul >
* @ param start starting floating - point value
* @ param direction value indicating which of
* { @ code start } ' s neighbors or { @ code start } should
* be returned
* @ return The floating - point number adjacent to { @ code start } in the
* direction of { @ code direction } .
* @ since 1.6 */
public static float nextAfter ( float start , double direction ) { } }
|
/* * The cases :
* nextAfter ( + infinity , 0 ) = = MAX _ VALUE
* nextAfter ( + infinity , + infinity ) = = + infinity
* nextAfter ( - infinity , 0 ) = = - MAX _ VALUE
* nextAfter ( - infinity , - infinity ) = = - infinity
* are naturally handled without any additional testing */
// First check for NaN values
if ( Float . isNaN ( start ) || Double . isNaN ( direction ) ) { // return a NaN derived from the input NaN ( s )
return start + ( float ) direction ; } else if ( start == direction ) { return ( float ) direction ; } else { // start > direction or start < direction
// Add + 0.0 to get rid of a - 0.0 ( + 0.0 + - 0.0 = > + 0.0)
// then bitwise convert start to integer .
int transducer = Float . floatToRawIntBits ( start + 0.0f ) ; /* * IEEE 754 floating - point numbers are lexicographically
* ordered if treated as signed - magnitude integers .
* Since Java ' s integers are two ' s complement ,
* incrementing " the two ' s complement representation of a
* logically negative floating - point value * decrements *
* the signed - magnitude representation . Therefore , when
* the integer representation of a floating - point values
* is less than zero , the adjustment to the representation
* is in the opposite direction than would be expected at
* first . */
if ( direction > start ) { // Calculate next greater value
transducer = transducer + ( transducer >= 0 ? 1 : - 1 ) ; } else { // Calculate next lesser value
assert direction < start ; if ( transducer > 0 ) -- transducer ; else if ( transducer < 0 ) ++ transducer ; /* * transducer = = 0 , the result is - MIN _ VALUE
* The transition from zero ( implicitly
* positive ) to the smallest negative
* signed magnitude value must be done
* explicitly . */
else transducer = FloatConsts . SIGN_BIT_MASK | 1 ; } return Float . intBitsToFloat ( transducer ) ; }
|
public class Output { /** * Encode string .
* @ param string
* string to encode
* @ return encoded string */
protected static byte [ ] encodeString ( String string ) { } }
|
Element element = getStringCache ( ) . get ( string ) ; byte [ ] encoded = ( element == null ? null : ( byte [ ] ) element . getObjectValue ( ) ) ; if ( encoded == null ) { ByteBuffer buf = AMF . CHARSET . encode ( string ) ; encoded = new byte [ buf . limit ( ) ] ; buf . get ( encoded ) ; getStringCache ( ) . put ( new Element ( string , encoded ) ) ; } return encoded ;
|
public class GeneralTopologyContext { /** * Gets the declared output fields for the specified component / stream . */
public Fields getComponentOutputFields ( String componentId , String streamId ) { } }
|
return new Fields ( delegate . getComponentOutputFields ( componentId , streamId ) ) ;
|
public class Quaternionf { /** * / * ( non - Javadoc )
* @ see org . joml . Quaternionfc # rotateX ( float , org . joml . Quaternionf ) */
public Quaternionf rotateX ( float angle , Quaternionf dest ) { } }
|
float sin = ( float ) Math . sin ( angle * 0.5 ) ; float cos = ( float ) Math . cosFromSin ( sin , angle * 0.5 ) ; dest . set ( w * sin + x * cos , y * cos + z * sin , z * cos - y * sin , w * cos - x * sin ) ; return dest ;
|
public class DaVinci { /** * Start the loading of an image
* @ param path path of the bitmap Or url of the image
* @ param into element which will display the image
* @ return the image from cache */
private Bitmap loadImage ( final String path , final Object into , final Transformation transformation ) { } }
|
if ( into == null || mImagesCache == null || path == null || path . trim ( ) . isEmpty ( ) ) return null ; Log . d ( TAG , "load(" + path + ")" ) ; Bitmap bitmap = null ; if ( transformation == null ) { bitmap = loadFromLruCache ( path , true ) ; } else { final String pathTransformed = generatePathFromTransformation ( path , transformation ) ; bitmap = loadFromLruCache ( pathTransformed , true ) ; if ( bitmap == null ) { // if bitmap transformed not found in cache
bitmap = loadFromLruCache ( path , true ) ; // try to get the bitmap without transformation
if ( bitmap != null ) { new AsyncTask < Void , Void , Bitmap > ( ) { @ Override protected Bitmap doInBackground ( Void ... params ) { return transformAndSaveBitmap ( path , transformation ) ; } @ Override protected void onPostExecute ( Bitmap bitmap ) { super . onPostExecute ( bitmap ) ; if ( bitmap != null ) { // now its available on cache , can call again loadImage with same parameters
loadImage ( path , into , transformation ) ; } } } . execute ( ) ; return null ; } } } Log . d ( TAG , "bitmap from cache " + bitmap + " for " + path ) ; if ( bitmap != null ) { // load directly from cache
returnBitmapInto ( bitmap , path , into ) ; Log . d ( TAG , "image " + path + " available in the cache" ) ; } else { Log . d ( TAG , "image " + path + " not available in the cache, trying to download it" ) ; if ( isUrlPath ( path ) ) { Log . d ( TAG , "loadImage " + path + " send request to smartphone " + path . hashCode ( ) ) ; addIntoWaiting ( path , into , transformation ) ; } else { downloadBitmap ( path , into , transformation ) ; } } return bitmap ;
|
public class CommercePriceEntryUtil { /** * Returns the commerce price entries before and after the current commerce price entry in the ordered set where CPInstanceUuid = & # 63 ; .
* @ param commercePriceEntryId the primary key of the current commerce price entry
* @ param CPInstanceUuid the cp instance uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next commerce price entry
* @ throws NoSuchPriceEntryException if a commerce price entry with the primary key could not be found */
public static CommercePriceEntry [ ] findByCPInstanceUuid_PrevAndNext ( long commercePriceEntryId , String CPInstanceUuid , OrderByComparator < CommercePriceEntry > orderByComparator ) throws com . liferay . commerce . price . list . exception . NoSuchPriceEntryException { } }
|
return getPersistence ( ) . findByCPInstanceUuid_PrevAndNext ( commercePriceEntryId , CPInstanceUuid , orderByComparator ) ;
|
public class GraphScatter { /** * Paint a dot onto the panel .
* @ param g graphics object
* @ param i index of the varied parameter */
private void scatter ( Graphics g , int i ) { } }
|
int height = getHeight ( ) ; int width = getWidth ( ) ; int x = ( int ) ( ( ( this . variedParamValues [ i ] - this . lower_x_value ) / ( this . upper_x_value - this . lower_x_value ) ) * width ) ; double value = this . measures [ i ] . getLastValue ( this . measureSelected ) ; if ( Double . isNaN ( value ) ) { // no result for this budget yet
return ; } int y = ( int ) ( height - ( value / this . upper_y_value ) * height ) ; g . setColor ( this . colors [ i ] ) ; if ( this . isStandardDeviationPainted ) { int len = ( int ) ( ( this . measureStds [ i ] . getLastValue ( this . measureSelected ) / this . upper_y_value ) * height ) ; paintStandardDeviation ( g , len , x , y ) ; } g . fillOval ( x - DOT_SIZE / 2 , y - DOT_SIZE / 2 , DOT_SIZE , DOT_SIZE ) ;
|
public class TrainingsImpl { /** * Get tagged images for a given project iteration .
* This API supports batching and range selection . By default it will only return first 50 images matching images .
* Use the { take } and { skip } parameters to control how many images to return in a given batch .
* The filtering is on an and / or relationship . For example , if the provided tag ids are for the " Dog " and
* " Cat " tags , then only images tagged with Dog and / or Cat will be returned .
* @ param projectId The project id
* @ param getTaggedImagesOptionalParameter the object representing the optional parameters to be set before calling this API
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < List < Image > > getTaggedImagesAsync ( UUID projectId , GetTaggedImagesOptionalParameter getTaggedImagesOptionalParameter , final ServiceCallback < List < Image > > serviceCallback ) { } }
|
return ServiceFuture . fromResponse ( getTaggedImagesWithServiceResponseAsync ( projectId , getTaggedImagesOptionalParameter ) , serviceCallback ) ;
|
public class CQLSchemaManager { /** * Allow RF to be overridden with ReplicationFactor in the given options . */
@ SuppressWarnings ( "unchecked" ) private String keyspaceDefaultsToCQLString ( ) { } }
|
// Default defaults :
boolean durable_writes = true ; Map < String , Object > replication = new HashMap < String , Object > ( ) ; replication . put ( "class" , "SimpleStrategy" ) ; replication . put ( "replication_factor" , "1" ) ; // Legacy support : ReplicationFactor
if ( m_dbservice . getParam ( "ReplicationFactor" ) != null ) { replication . put ( "replication_factor" , m_dbservice . getParamString ( "ReplicationFactor" ) ) ; } // Override any options specified in ks _ defaults
Map < String , Object > ksDefs = m_dbservice . getParamMap ( "ks_defaults" ) ; if ( ksDefs != null ) { if ( ksDefs . containsKey ( "durable_writes" ) ) { durable_writes = Boolean . parseBoolean ( ksDefs . get ( "durable_writes" ) . toString ( ) ) ; } if ( ksDefs . containsKey ( "strategy_class" ) ) { replication . put ( "class" , ksDefs . get ( "strategy_class" ) . toString ( ) ) ; } if ( ksDefs . containsKey ( "strategy_options" ) ) { Object value = ksDefs . get ( "strategy_options" ) ; if ( value instanceof Map ) { Map < String , Object > replOpts = ( Map < String , Object > ) value ; if ( replOpts . containsKey ( "replication_factor" ) ) { replication . put ( "replication_factor" , replOpts . get ( "replication_factor" ) . toString ( ) ) ; } } } } StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( " WITH DURABLE_WRITES=" ) ; buffer . append ( durable_writes ) ; buffer . append ( " AND REPLICATION=" ) ; buffer . append ( mapToCQLString ( replication ) ) ; return buffer . toString ( ) ;
|
public class HString { /** * Checks if this HString encloses the given other .
* @ param other The other HString
* @ return True of this one encloses the given other . */
public final boolean encloses ( HString other ) { } }
|
if ( other == null ) { return false ; } return ( document ( ) != null && other . document ( ) != null ) && ( document ( ) == other . document ( ) ) && super . encloses ( other ) ;
|
public class CmsSerialDateValue { /** * Convert the information from the wrapper to a JSON object .
* @ return the serial date information as JSON . */
public JSONValue toJson ( ) { } }
|
JSONObject result = new JSONObject ( ) ; if ( null != getStart ( ) ) { result . put ( JsonKey . START , dateToJson ( getStart ( ) ) ) ; } if ( null != getEnd ( ) ) { result . put ( JsonKey . END , dateToJson ( getEnd ( ) ) ) ; } if ( isWholeDay ( ) ) { result . put ( JsonKey . WHOLE_DAY , JSONBoolean . getInstance ( true ) ) ; } JSONObject pattern = patternToJson ( ) ; result . put ( JsonKey . PATTERN , pattern ) ; SortedSet < Date > exceptions = getExceptions ( ) ; if ( exceptions . size ( ) > 0 ) { result . put ( JsonKey . EXCEPTIONS , datesToJsonArray ( exceptions ) ) ; } switch ( getEndType ( ) ) { case DATE : result . put ( JsonKey . SERIES_ENDDATE , dateToJson ( getSeriesEndDate ( ) ) ) ; break ; case TIMES : result . put ( JsonKey . SERIES_OCCURRENCES , new JSONString ( String . valueOf ( getOccurrences ( ) ) ) ) ; break ; case SINGLE : default : break ; } if ( ! isCurrentTillEnd ( ) ) { result . put ( JsonKey . CURRENT_TILL_END , JSONBoolean . getInstance ( false ) ) ; } if ( getParentSeriesId ( ) != null ) { result . put ( JsonKey . PARENT_SERIES , new JSONString ( getParentSeriesId ( ) . getStringValue ( ) ) ) ; } return result ;
|
public class IntBinaryTreeUsage { /** * START SNIPPET : max */
public Integer max ( IntBinaryTree tree ) { } }
|
return tree . match ( new IntBinaryTree . MatchBlock < Integer > ( ) { @ Override public Integer _case ( Node x ) { final Integer maxLeft = max ( x . left ) ; final int l = maxLeft == null ? Integer . MIN_VALUE : maxLeft ; final Integer maxRight = max ( x . right ) ; final int r = maxRight == null ? Integer . MIN_VALUE : maxRight ; return Math . max ( Math . max ( l , r ) , x . value ) ; } @ Override public Integer _case ( EmptyTree x ) { return null ; } } ) ;
|
public class JQLChecker { /** * Prepare parser .
* @ param jqlContext
* the jql context
* @ param jql
* the jql
* @ return the pair */
protected Pair < ParserRuleContext , CommonTokenStream > prepareParser ( final JQLContext jqlContext , final String jql ) { } }
|
JqlLexer lexer = new JqlLexer ( CharStreams . fromString ( jql ) ) ; CommonTokenStream tokens = new CommonTokenStream ( lexer ) ; JqlParser parser = new JqlParser ( tokens ) ; parser . removeErrorListeners ( ) ; parser . addErrorListener ( new JQLBaseErrorListener ( ) { @ Override public void syntaxError ( Recognizer < ? , ? > recognizer , Object offendingSymbol , int line , int charPositionInLine , String msg , RecognitionException e ) { AssertKripton . assertTrue ( false , jqlContext . getContextDescription ( ) + ": unespected char at pos %s of SQL '%s'" , charPositionInLine , jql ) ; } } ) ; ParserRuleContext context = parser . parse ( ) ; return new Pair < > ( context , tokens ) ;
|
public class Guid { /** * Generate a { @ link Guid } for an array of Strings .
* @ param strings array of Strings .
* @ return a single { @ link Guid } for the array .
* @ throws IOException */
public static Guid fromStrings ( String ... strings ) throws IOException { } }
|
if ( strings == null || strings . length == 0 ) { throw new IOException ( "Attempting to compute guid for an empty array." ) ; } return new Guid ( StringUtils . join ( strings ) . getBytes ( Charsets . UTF_8 ) ) ;
|
public class Slice { /** * Transfers portion of data from this slice into the specified destination starting at
* the specified absolute { @ code index } .
* @ param destinationIndex the first index of the destination
* @ param length the number of bytes to transfer
* @ throws IndexOutOfBoundsException if the specified { @ code index } is less than { @ code 0 } ,
* if the specified { @ code destinationIndex } is less than { @ code 0 } ,
* if { @ code index + length } is greater than
* { @ code this . length ( ) } , or
* if { @ code destinationIndex + length } is greater than
* { @ code destination . length } */
public void getBytes ( int index , byte [ ] destination , int destinationIndex , int length ) { } }
|
checkIndexLength ( index , length ) ; checkPositionIndexes ( destinationIndex , destinationIndex + length , destination . length ) ; copyMemory ( base , address + index , destination , ( long ) SizeOf . ARRAY_BYTE_BASE_OFFSET + destinationIndex , length ) ;
|
public class AppServiceCertificateOrdersInner { /** * Get certificate orders in a resource group .
* Get certificate orders in a resource group .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; AppServiceCertificateOrderInner & gt ; object */
public Observable < Page < AppServiceCertificateOrderInner > > listByResourceGroupAsync ( final String resourceGroupName ) { } }
|
return listByResourceGroupWithServiceResponseAsync ( resourceGroupName ) . map ( new Func1 < ServiceResponse < Page < AppServiceCertificateOrderInner > > , Page < AppServiceCertificateOrderInner > > ( ) { @ Override public Page < AppServiceCertificateOrderInner > call ( ServiceResponse < Page < AppServiceCertificateOrderInner > > response ) { return response . body ( ) ; } } ) ;
|
public class PreferenceFragment { /** * Initializes the preference , which allows to show a wizard dialog . */
private void initializeShowWizardDialogPreference ( ) { } }
|
Preference preference = findPreference ( getString ( R . string . show_wizard_dialog_preference_key ) ) ; preference . setOnPreferenceClickListener ( new OnPreferenceClickListener ( ) { @ Override public boolean onPreferenceClick ( final Preference preference ) { WizardDialog . Builder builder = new WizardDialog . Builder ( getActivity ( ) , shouldUseFullscreen ( ) ? R . style . DarkFullscreenDialogTheme : 0 ) ; configureHeaderDialogBuilder ( builder ) ; builder . enableTabLayout ( ! shouldHeaderBeShown ( ) ) ; if ( shouldButtonBarDividerBeShown ( ) ) { builder . showButtonBarDivider ( true ) ; } addFragment ( builder , 1 ) ; addFragment ( builder , 2 ) ; addFragment ( builder , 3 ) ; WizardDialog wizardDialog = builder . create ( ) ; if ( shouldUseAnimations ( ) ) { builder . setBackgroundColor ( getResources ( ) . getIntArray ( R . array . wizard_dialog_background_colors ) [ 0 ] ) ; builder . addOnPageChangeListener ( createWizardDialogPageChangeListener ( wizardDialog ) ) ; } wizardDialog . show ( getActivity ( ) . getSupportFragmentManager ( ) , null ) ; return true ; } } ) ;
|
public class AjaxScreenSession { /** * PrintScreen Method . */
public void printScreen ( BaseScreen screen , PrintWriter out ) { } }
|
try { ResourceBundle reg = ( ( BaseApplication ) this . getTask ( ) . getApplication ( ) ) . getResources ( HtmlConstants . XML_RESOURCE , false ) ; String string = XmlUtilities . XML_LEAD_LINE ; out . println ( string ) ; String strStylesheetPath = screen . getScreenFieldView ( ) . getStylesheetPath ( ) ; if ( strStylesheetPath != null ) { string = "<?xml-stylesheet type=\"text/xsl\" href=\"" + strStylesheetPath + "\" ?>" ; out . println ( string ) ; } out . println ( Utility . startTag ( XMLTags . CONTENT_AREA ) ) ; screen . printScreen ( out , reg ) ; out . println ( Utility . endTag ( XMLTags . CONTENT_AREA ) ) ; } catch ( DBException ex ) { ex . printStackTrace ( ) ; }
|
public class VEvent { /** * Sets the priority of the event .
* @ param priority the priority ( " 0 " is undefined , " 1 " is the highest , " 9"
* is the lowest ) or null to remove
* @ return the property that was created
* @ see < a href = " http : / / tools . ietf . org / html / rfc5545 # page - 89 " > RFC 5545
* p . 89-90 < / a >
* @ see < a href = " http : / / tools . ietf . org / html / rfc2445 # page - 85 " > RFC 2445
* p . 85-7 < / a >
* @ see < a href = " http : / / www . imc . org / pdi / vcal - 10 . doc " > vCal 1.0 p . 33 < / a > */
public Priority setPriority ( Integer priority ) { } }
|
Priority prop = ( priority == null ) ? null : new Priority ( priority ) ; setPriority ( prop ) ; return prop ;
|
public class FrameManager { /** * Tries to close all windows . Stops at first failed attempt .
* @ param navigationFrameView used as parent of question dialogs
* @ return true if all windows are closed */
private boolean closeAllWindows ( SwingFrame navigationFrameView ) { } }
|
// Die umgekehrte Reihenfolge fühlt sich beim Schliessen natürlicher an
for ( int i = navigationFrames . size ( ) - 1 ; i >= 0 ; i -- ) { SwingFrame frameView = navigationFrames . get ( i ) ; if ( ! frameView . tryToCloseWindow ( ) ) return false ; removeNavigationFrameView ( frameView ) ; } return true ;
|
public class Scheme { /** * Joins the given parts to recover the original secret .
* < p > < b > N . B . : < / b > There is no way to determine whether or not the returned value is actually the
* original secret . If the parts are incorrect , or are under the threshold value used to split the
* secret , a random value will be returned .
* @ param parts a map of part IDs to part values
* @ return the original secret
* @ throws IllegalArgumentException if { @ code parts } is empty or contains values of varying
* lengths */
public byte [ ] join ( Map < Integer , byte [ ] > parts ) { } }
|
checkArgument ( parts . size ( ) > 0 , "No parts provided" ) ; final int [ ] lengths = parts . values ( ) . stream ( ) . mapToInt ( v -> v . length ) . distinct ( ) . toArray ( ) ; checkArgument ( lengths . length == 1 , "Varying lengths of part values" ) ; final byte [ ] secret = new byte [ lengths [ 0 ] ] ; for ( int i = 0 ; i < secret . length ; i ++ ) { final byte [ ] [ ] points = new byte [ parts . size ( ) ] [ 2 ] ; int j = 0 ; for ( Map . Entry < Integer , byte [ ] > part : parts . entrySet ( ) ) { points [ j ] [ 0 ] = part . getKey ( ) . byteValue ( ) ; points [ j ] [ 1 ] = part . getValue ( ) [ i ] ; j ++ ; } secret [ i ] = GF256 . interpolate ( points ) ; } return secret ;
|
public class ShelXReader { /** * Read the ShelX from input . Each ShelX document is expected to contain
* one crystal structure .
* @ return a ChemFile with the coordinates , charges , vectors , etc . */
private IChemFile readChemFile ( IChemFile file ) throws IOException { } }
|
IChemSequence seq = file . getBuilder ( ) . newInstance ( IChemSequence . class ) ; IChemModel model = file . getBuilder ( ) . newInstance ( IChemModel . class ) ; ICrystal crystal = readCrystal ( file . getBuilder ( ) . newInstance ( ICrystal . class ) ) ; model . setCrystal ( crystal ) ; seq . addChemModel ( model ) ; file . addChemSequence ( seq ) ; return file ;
|
public class DateUtil { /** * 获取指定日期字段的最大值 , 例如分钟的最小值是59
* @ param calendar { @ link Calendar }
* @ param dateField { @ link DateField }
* @ return 字段最大值
* @ since 4.5.7
* @ see Calendar # getActualMaximum ( int ) */
public static int getEndValue ( Calendar calendar , int dateField ) { } }
|
if ( Calendar . DAY_OF_WEEK == dateField ) { return ( calendar . getFirstDayOfWeek ( ) + 6 ) % 7 ; } return calendar . getActualMaximum ( dateField ) ;
|
public class JsTopicInterceptor { /** * Get dynamic topicname from parameter annotated @ JsTopicName
* @ param method
* @ param parameters
* @ return */
String getDynamicTopic ( Method method , Object [ ] parameters ) { } }
|
int idx = 0 ; // synchronise the two arrays , array of parameter and array of annotations
Annotation [ ] [ ] parametersAnnotations = method . getParameterAnnotations ( ) ; for ( Annotation [ ] parameterAnnotations : parametersAnnotations ) { // for each parameter
JsTopicName jsTopicName = getJsTopicNameAnnotation ( parameterAnnotations ) ; if ( jsTopicName != null ) { return computeTopic ( jsTopicName , parameters [ idx ] . toString ( ) ) ; } idx ++ ; } return null ;
|
public class SetSupport { /** * Convert an object to an expected type of the method parameter according to the conversion
* rules of the Expression Language .
* @ param value the value to convert
* @ param m the setter method
* @ return value converted to an instance of the expected type ; will be null if value was null
* @ throws javax . el . ELException if there was a problem coercing the value */
private Object convertToExpectedType ( final Object value , Method m ) throws ELException { } }
|
if ( value == null ) { return null ; } Class < ? > expectedType = m . getParameterTypes ( ) [ 0 ] ; return getExpressionFactory ( ) . coerceToType ( value , expectedType ) ;
|
public class CmsJSONSearchConfigurationParser { /** * Returns a flag , indicating if search should be performed using a wildcard if the empty query is given .
* @ return A flag , indicating if search should be performed using a wildcard if the empty query is given . */
protected Boolean getSearchForEmptyQuery ( ) { } }
|
Boolean isSearchForEmptyQuery = parseOptionalBooleanValue ( m_configObject , JSON_KEY_SEARCH_FOR_EMPTY_QUERY ) ; return ( isSearchForEmptyQuery == null ) && ( null != m_baseConfig ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getSearchForEmptyQueryParam ( ) ) : isSearchForEmptyQuery ;
|
public class AWSElasticsearchClient { /** * List all supported Elasticsearch versions
* @ param listElasticsearchVersionsRequest
* Container for the parameters to the < code > < a > ListElasticsearchVersions < / a > < / code > operation .
* Use < code > < a > MaxResults < / a > < / code > to control the maximum number of results to retrieve in a single
* call .
* Use < code > < a > NextToken < / a > < / code > in response to retrieve more results . If the received response does
* not contain a NextToken , then there are no more results to retrieve .
* @ return Result of the ListElasticsearchVersions operation returned by the service .
* @ throws BaseException
* An error occurred while processing the request .
* @ throws InternalException
* The request processing has failed because of an unknown error , exception or failure ( the failure is
* internal to the service ) . Gives http status code of 500.
* @ throws ResourceNotFoundException
* An exception for accessing or deleting a resource that does not exist . Gives http status code of 400.
* @ throws ValidationException
* An exception for missing / invalid input fields . Gives http status code of 400.
* @ sample AWSElasticsearch . ListElasticsearchVersions */
@ Override public ListElasticsearchVersionsResult listElasticsearchVersions ( ListElasticsearchVersionsRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeListElasticsearchVersions ( request ) ;
|
public class NetworkProfilesInner { /** * Gets the specified network profile in a specified resource group .
* @ param resourceGroupName The name of the resource group .
* @ param networkProfileName The name of the PublicIPPrefx .
* @ param expand Expands referenced resources .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < NetworkProfileInner > getByResourceGroupAsync ( String resourceGroupName , String networkProfileName , String expand , final ServiceCallback < NetworkProfileInner > serviceCallback ) { } }
|
return ServiceFuture . fromResponse ( getByResourceGroupWithServiceResponseAsync ( resourceGroupName , networkProfileName , expand ) , serviceCallback ) ;
|
public class Bit { /** * Method to construct a Bit for a given String expression .
* @ param bit a String expression defining a Bit
* @ return a Bit as defined by the given String expression
* @ throws NumberFormatException if the given String expression does not fit
* the defined pattern . */
public static Bit valueOf ( String bit ) throws NumberFormatException { } }
|
final int i = ParseUtil . parseIntBase10 ( bit ) ; if ( i != 0 && i != 1 ) { throw new NumberFormatException ( "Input \"" + bit + "\" must be 0 or 1." ) ; } return ( i > 0 ) ? TRUE : FALSE ;
|
public class DbPipe { public String getStringValue ( int index ) { } }
|
String [ ] array = get ( index ) . extractStringArray ( ) ; String str = "" ; for ( int i = 0 ; i < array . length ; i ++ ) { str += array [ i ] ; if ( i < array . length - 1 ) str += "\n" ; } return str ;
|
public class MenuItem { /** * Recover from the service the location object and set it and the value to
* this item .
* @ param location The id to look into the conficuration file pm . locations . xml
* @ param value The location value */
public void parseLocation ( String location , String value ) { } }
|
setLocationValue ( value ) ; setLocation ( PresentationManager . getPm ( ) . getLocation ( location ) ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.