signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class FedoraBaseResource { /** * Produce a baseURL for JMS events using the system property fcrepo . jms . baseUrl of the form http [ s ] : / / host [ : port ] ,
* if it exists .
* @ param uriInfo used to build the base url
* @ return String the base Url */
private String getBaseUrlProperty ( final UriInfo uriInfo ) { } } | final String propBaseURL = System . getProperty ( JMS_BASEURL_PROP , "" ) ; if ( propBaseURL . length ( ) > 0 && propBaseURL . startsWith ( "http" ) ) { final URI propBaseUri = URI . create ( propBaseURL ) ; if ( propBaseUri . getPort ( ) < 0 ) { return uriInfo . getBaseUriBuilder ( ) . port ( - 1 ) . uri ( propBaseUri ) . toString ( ) ; } return uriInfo . getBaseUriBuilder ( ) . uri ( propBaseUri ) . toString ( ) ; } return "" ; |
public class SecurityDefinition { /** * < p > Try to fill the name property of some authentication definition , if no user defined value was set . < / p >
* < p > If the current value of the name property is empty , this will fill it to be the same as the name of the
* security definition . < / br >
* If no { @ link Field } named " name " is found inside the given SecuritySchemeDefinition , no action will be taken .
* @ param ssd security scheme
* @ param value value to set the name to */
private void tryFillNameField ( SecuritySchemeDefinition ssd , String value ) { } } | if ( ssd == null ) { return ; } Field nameField = FieldUtils . getField ( ssd . getClass ( ) , "name" , true ) ; try { if ( nameField != null && nameField . get ( ssd ) == null ) { nameField . set ( ssd , value ) ; } } catch ( IllegalAccessException e ) { // ignored
} |
public class AmazonSageMakerClient { /** * Gets a list of < a > HyperParameterTuningJobSummary < / a > objects that describe the hyperparameter tuning jobs
* launched in your account .
* @ param listHyperParameterTuningJobsRequest
* @ return Result of the ListHyperParameterTuningJobs operation returned by the service .
* @ sample AmazonSageMaker . ListHyperParameterTuningJobs
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / sagemaker - 2017-07-24 / ListHyperParameterTuningJobs "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListHyperParameterTuningJobsResult listHyperParameterTuningJobs ( ListHyperParameterTuningJobsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListHyperParameterTuningJobs ( request ) ; |
public class Bootstrap { /** * Start the game as an application
* @ param game The game to be started
* @ param width The width of the window
* @ param height The height of the window
* @ param fullscreen True if the window should be fullscreen */
public static void runAsApplication ( Game game , int width , int height , boolean fullscreen ) { } } | try { AppGameContainer container = new AppGameContainer ( game , width , height , fullscreen ) ; container . start ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } |
public class DefaultOrthologize { /** * { @ inheritDoc } */
@ Override public Map < KamNode , KamNode > orthologousNodes ( Kam kam , KAMStore kAMStore , SpeciesDialect dialect ) { } } | // create resource location set for species namespaces
final List < org . openbel . framework . common . model . Namespace > spl = dialect . getSpeciesNamespaces ( ) ; final Set < String > rlocs = constrainedHashSet ( spl . size ( ) ) ; for ( final org . openbel . framework . common . model . Namespace n : spl ) { rlocs . add ( n . getResourceLocation ( ) ) ; } final Collection < KamEdge > edges = kam . getEdges ( ) ; final Map < Integer , Set < Integer > > oedges = new LinkedHashMap < Integer , Set < Integer > > ( ) ; Map < KamNode , KamNode > onodes = new HashMap < KamNode , KamNode > ( ) ; for ( final KamEdge e : edges ) { // only evaluate orthologous edges
if ( ORTHOLOGOUS . equals ( e . getRelationshipType ( ) ) ) { final KamNode edgeSource = e . getSourceNode ( ) ; final KamNode edgeTarget = e . getTargetNode ( ) ; // invalid ; skip orthologous self edges
if ( edgeSource == edgeTarget ) { continue ; } TermParameter speciesParam = findParameter ( kam , kAMStore , edgeSource , rlocs ) ; if ( speciesParam != null ) { // source node matches target species
Integer id = edgeSource . getId ( ) ; Set < Integer > adjacentEdges = oedges . get ( id ) ; if ( adjacentEdges == null ) { adjacentEdges = new LinkedHashSet < Integer > ( ) ; oedges . put ( id , adjacentEdges ) ; } // collect adjacent edges ( except this edge ) for the
// orthologous target node
final Set < KamEdge > orthoEdges = kam . getAdjacentEdges ( edgeTarget ) ; for ( final KamEdge orthoEdge : orthoEdges ) { if ( orthoEdge != e ) { adjacentEdges . add ( orthoEdge . getId ( ) ) ; } } onodes . put ( edgeTarget , edgeSource ) ; continue ; } speciesParam = findParameter ( kam , kAMStore , edgeTarget , rlocs ) ; if ( speciesParam != null ) { // target node matches target species
Integer id = edgeTarget . getId ( ) ; Set < Integer > adjacentEdges = oedges . get ( id ) ; if ( adjacentEdges == null ) { adjacentEdges = new LinkedHashSet < Integer > ( ) ; oedges . put ( id , adjacentEdges ) ; } // collect adjacent edges ( except this edge ) for the
// orthologous source node
final Set < KamEdge > orthoEdges = kam . getAdjacentEdges ( edgeSource ) ; for ( final KamEdge orthoEdge : orthoEdges ) { if ( orthoEdge != e ) { adjacentEdges . add ( orthoEdge . getId ( ) ) ; } } onodes . put ( edgeSource , edgeTarget ) ; } } } return onodes ; |
public class Evaluator { /** * Resolves an expression block found in the template , e . g . @ ( . . . ) . If an evaluation error occurs , expression is
* returned as is . */
protected String resolveExpressionBlock ( String expression , EvaluationContext context , boolean urlEncode , EvaluationStrategy strategy , List < String > errors ) { } } | try { String body = expression . substring ( 1 ) ; // strip prefix
// if expression doesn ' t start with ( then check it ' s an allowed top level context reference
if ( ! body . startsWith ( "(" ) ) { String topLevel = StringUtils . split ( body , '.' ) [ 0 ] . toLowerCase ( ) ; if ( ! m_allowedTopLevels . contains ( topLevel ) ) { return expression ; } } Object evaluated = evaluateExpression ( body , context , strategy ) ; String rendered = Conversions . toString ( evaluated , context ) ; // render result as string
return urlEncode ? ExpressionUtils . urlquote ( rendered ) : rendered ; } catch ( EvaluationError ex ) { logger . debug ( "Unable to evaluate expression" , ex ) ; errors . add ( ex . getMessage ( ) ) ; return expression ; // if we can ' t evaluate expression , include it as is in the output
} |
public class RegistriesInner { /** * Copies an image to this container registry from the specified container registry .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param parameters The parameters specifying the image to copy and the source container registry .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void beginImportImage ( String resourceGroupName , String registryName , ImportImageParameters parameters ) { } } | beginImportImageWithServiceResponseAsync ( resourceGroupName , registryName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class GIS { /** * Train a model using the GIS algorithm .
* @ param eventStream The EventStream holding the data on which this model
* will be trained .
* @ param iterations The number of GIS iterations to perform .
* @ param cutoff The number of times a feature must be seen in order
* to be relevant for training .
* @ param smoothing Defines whether the created trainer will use smoothing
* while training the model .
* @ param printMessagesWhileTraining Determines whether training status messages are written to STDOUT .
* @ return The newly trained model , which can be used immediately or saved
* to disk using an opennlp . maxent . io . GISModelWriter object . */
public static GISModel trainModel ( EventStream eventStream , int iterations , int cutoff , boolean smoothing , boolean printMessagesWhileTraining ) { } } | GISTrainer trainer = new GISTrainer ( printMessagesWhileTraining ) ; trainer . setSmoothing ( smoothing ) ; trainer . setSmoothingObservation ( SMOOTHING_OBSERVATION ) ; return trainer . trainModel ( eventStream , iterations , cutoff ) ; |
public class ServiceWrapper { /** * Execute a runnable within some context . Other objects could call popContextData
* and resetContextData on their own , but this ensures that they are called in the right order .
* @ param runnable */
void wrapAndRun ( Runnable runnable ) { } } | // PM90834 added method
if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . entering ( CLASS_NAME , "wrapAndRun" , runnable ) ; } try { this . popContextData ( ) ; if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . logp ( Level . FINEST , CLASS_NAME , "wrapAndRun" , "run with context class loader: " + Thread . currentThread ( ) . getContextClassLoader ( ) ) ; } runnable . run ( ) ; } finally { try { this . resetContextData ( ) ; } finally { if ( runnable instanceof CompleteRunnable ) { asyncContext . notifyITransferContextCompleteState ( ) ; } if ( com . ibm . ejs . ras . TraceComponent . isAnyTracingEnabled ( ) && logger . isLoggable ( Level . FINEST ) ) { logger . exiting ( CLASS_NAME , "wrapAndRun" , runnable ) ; } } } |
public class ns_conf { /** * < pre >
* Converts API response of bulk operation into object and returns the object array in case of get request .
* < / pre > */
protected base_resource [ ] get_nitro_bulk_response ( nitro_service service , String response ) throws Exception { } } | ns_conf_responses result = ( ns_conf_responses ) service . get_payload_formatter ( ) . string_to_resource ( ns_conf_responses . class , response ) ; if ( result . errorcode != 0 ) { if ( result . errorcode == SESSION_NOT_EXISTS ) service . clear_session ( ) ; throw new nitro_exception ( result . message , result . errorcode , ( base_response [ ] ) result . ns_conf_response_array ) ; } ns_conf [ ] result_ns_conf = new ns_conf [ result . ns_conf_response_array . length ] ; for ( int i = 0 ; i < result . ns_conf_response_array . length ; i ++ ) { result_ns_conf [ i ] = result . ns_conf_response_array [ i ] . ns_conf [ 0 ] ; } return result_ns_conf ; |
public class Spliterators { /** * Creates a { @ code Spliterator . OfInt } using a given
* { @ code IntStream . IntIterator } as the source of elements , with no initial
* size estimate .
* < p > The spliterator is not
* < em > < a href = " Spliterator . html # binding " > late - binding < / a > < / em > , inherits
* the < em > fail - fast < / em > properties of the iterator , and implements
* { @ code trySplit } to permit limited parallelism .
* < p > Traversal of elements should be accomplished through the spliterator .
* The behaviour of splitting and traversal is undefined if the iterator is
* operated on after the spliterator is returned .
* @ param iterator The iterator for the source
* @ param characteristics Characteristics of this spliterator ' s source
* or elements ( { @ code SIZED } and { @ code SUBSIZED } , if supplied , are
* ignored and are not reported . )
* @ return A spliterator from an iterator
* @ throws NullPointerException if the given iterator is { @ code null } */
public static Spliterator . OfInt spliteratorUnknownSize ( PrimitiveIterator . OfInt iterator , int characteristics ) { } } | return new IntIteratorSpliterator ( Objects . requireNonNull ( iterator ) , characteristics ) ; |
public class CoherentManagerConnection { /** * Sends an Asterisk action and waits for a ManagerRespose .
* @ param action
* @ param timeout timeout in milliseconds
* @ return
* @ throws IllegalArgumentException
* @ throws IllegalStateException
* @ throws IOException
* @ throws TimeoutException
* @ throws OperationNotSupportedException */
public static ManagerResponse sendAction ( final ManagerAction action , final int timeout ) throws IllegalArgumentException , IllegalStateException , IOException , TimeoutException { } } | if ( logger . isDebugEnabled ( ) ) CoherentManagerConnection . logger . debug ( "Sending Action: " + action . toString ( ) ) ; // $ NON - NLS - 1 $
CoherentManagerConnection . getInstance ( ) ; if ( ( CoherentManagerConnection . managerConnection != null ) && ( CoherentManagerConnection . managerConnection . getState ( ) == ManagerConnectionState . CONNECTED ) ) { final org . asteriskjava . manager . action . ManagerAction ajAction = action . getAJAction ( ) ; org . asteriskjava . manager . response . ManagerResponse response = CoherentManagerConnection . managerConnection . sendAction ( ajAction , timeout ) ; ManagerResponse convertedResponse = null ; // UserEventActions always return a null
if ( response != null ) convertedResponse = CoherentEventFactory . build ( response ) ; if ( ( convertedResponse != null ) && ( convertedResponse . getResponse ( ) . compareToIgnoreCase ( "Error" ) == 0 ) ) // $ NON - NLS - 1 $
{ CoherentManagerConnection . logger . warn ( "Action '" + ajAction + "' failed, Response: " // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $
+ convertedResponse . getResponse ( ) + " Message: " + convertedResponse . getMessage ( ) ) ; // $ NON - NLS - 1 $
} return convertedResponse ; } throw new IllegalStateException ( "not connected." ) ; // $ NON - NLS - 1 $ |
public class AccessSet { /** * Returns for given identifier in < i > _ id < / i > the cached instance of class
* AccessSet .
* @ param _ id id the AccessSet is wanted for
* @ return instance of class AccessSet
* @ throws CacheReloadException on error */
public static AccessSet get ( final long _id ) throws CacheReloadException { } } | final Cache < Long , AccessSet > cache = InfinispanCache . get ( ) . < Long , AccessSet > getCache ( AccessSet . IDCACHE ) ; if ( ! cache . containsKey ( _id ) ) { AccessSet . getAccessSetFromDB ( AccessSet . SQL_ID , _id ) ; } return cache . get ( _id ) ; |
public class DetectedObject { /** * Get the index of the predicted class ( based on maximum predicted probability )
* @ return Index of the predicted class ( 0 to nClasses - 1) */
public int getPredictedClass ( ) { } } | if ( predictedClass == - 1 ) { if ( classPredictions . rank ( ) == 1 ) { predictedClass = classPredictions . argMax ( ) . getInt ( 0 ) ; } else { // ravel in case we get a column vector , or rank 2 row vector , etc
predictedClass = classPredictions . ravel ( ) . argMax ( ) . getInt ( 0 ) ; } } return predictedClass ; |
public class MatrixTileSkin { /** * * * * * * Initialization * * * * * */
@ Override protected void initGraphics ( ) { } } | super . initGraphics ( ) ; matrix = PixelMatrixBuilder . create ( ) . pixelShape ( PixelShape . SQUARE ) . useSpacer ( true ) . squarePixels ( false ) . colsAndRows ( tile . getMatrixSize ( ) ) . pixelOnColor ( tile . getBarColor ( ) ) . pixelOffColor ( Helper . isDark ( tile . getBackgroundColor ( ) ) ? tile . getBackgroundColor ( ) . brighter ( ) : tile . getBackgroundColor ( ) . darker ( ) ) . build ( ) ; if ( ! tile . getChartData ( ) . isEmpty ( ) && tile . getChartData ( ) . size ( ) > 2 ) { matrix . setColsAndRows ( tile . getChartData ( ) . size ( ) , matrix . getRows ( ) ) ; } chartEventListener = e -> updateMatrixWithChartData ( ) ; tile . getChartData ( ) . forEach ( chartData -> chartData . addChartDataEventListener ( chartEventListener ) ) ; chartDataListener = c -> { while ( c . next ( ) ) { if ( c . wasAdded ( ) ) { c . getAddedSubList ( ) . forEach ( addedItem -> addedItem . addChartDataEventListener ( chartEventListener ) ) ; if ( ! tile . getChartData ( ) . isEmpty ( ) && tile . getChartData ( ) . size ( ) > 2 ) { matrix . setColsAndRows ( tile . getChartData ( ) . size ( ) , matrix . getRows ( ) ) ; } } else if ( c . wasRemoved ( ) ) { c . getRemoved ( ) . forEach ( removedItem -> removedItem . removeChartDataEventListener ( chartEventListener ) ) ; if ( ! tile . getChartData ( ) . isEmpty ( ) && tile . getChartData ( ) . size ( ) > 2 ) { matrix . setColsAndRows ( tile . getChartData ( ) . size ( ) , matrix . getRows ( ) ) ; } } } updateMatrixWithChartData ( ) ; } ; matrixListener = e -> { if ( tile . getChartData ( ) . isEmpty ( ) ) { return ; } int column = e . getX ( ) ; ChartData data = tile . getChartData ( ) . get ( column ) ; String tooltipText = new StringBuilder ( data . getName ( ) ) . append ( "\n" ) . append ( String . format ( locale , formatString , data . getValue ( ) ) ) . toString ( ) ; Point2D popupLocation = new Point2D ( e . getMouseScreenX ( ) - selectionTooltip . getWidth ( ) * 0.5 , e . getMouseScreenY ( ) - size * 0.025 - selectionTooltip . getHeight ( ) ) ; selectionTooltip . setText ( tooltipText ) ; selectionTooltip . setX ( popupLocation . getX ( ) ) ; selectionTooltip . setY ( popupLocation . getY ( ) ) ; selectionTooltip . show ( tile . getScene ( ) . getWindow ( ) ) ; tile . fireTileEvent ( new TileEvent ( EventType . SELECTED_CHART_DATA , data ) ) ; } ; mouseHandler = e -> { final javafx . event . EventType < ? extends MouseEvent > TYPE = e . getEventType ( ) ; if ( MouseEvent . MOUSE_CLICKED . equals ( TYPE ) ) { matrix . checkForClick ( e ) ; } else if ( MouseEvent . MOUSE_MOVED . equals ( TYPE ) ) { selectionTooltip . hide ( ) ; } else if ( MouseEvent . MOUSE_EXITED . equals ( TYPE ) ) { selectionTooltip . hide ( ) ; } } ; titleText = new Text ( ) ; titleText . setFill ( tile . getTitleColor ( ) ) ; Helper . enableNode ( titleText , ! tile . getTitle ( ) . isEmpty ( ) ) ; text = new Text ( tile . getText ( ) ) ; text . setFill ( tile . getTextColor ( ) ) ; Helper . enableNode ( text , tile . isTextVisible ( ) ) ; selectionTooltip = new Tooltip ( "" ) ; selectionTooltip . setWidth ( 60 ) ; selectionTooltip . setHeight ( 48 ) ; Tooltip . install ( matrix , selectionTooltip ) ; getPane ( ) . getChildren ( ) . addAll ( titleText , matrix , text ) ; |
public class Message { /** * add single { @ code QuickReply } to the list of QuickReplies
* @ param quickReply
* the QuickReply you like to add
* @ return */
public boolean addQuickReply ( QuickReply quickReply ) { } } | if ( quickReplies == null ) { quickReplies = new ArrayList < > ( ) ; } checkPrecondition ( 1 ) ; return quickReplies . add ( quickReply ) ; |
public class JsonSurfer { /** * Create resumable parser
* @ param json Json source
* @ param configuration SurfingConfiguration
* @ return Resumable parser
* @ deprecated use { @ link # createResumableParser ( InputStream , SurfingConfiguration ) } instead */
@ Deprecated public ResumableParser createResumableParser ( Reader json , SurfingConfiguration configuration ) { } } | ensureSetting ( configuration ) ; return jsonParserAdapter . createResumableParser ( json , new SurfingContext ( configuration ) ) ; |
public class ArrayImplNS { /** * adds a value and return this array
* @ param o
* @ return this Array */
@ Override public boolean add ( Object o ) { } } | if ( offset + size + 1 > arr . length ) enlargeCapacity ( size + 1 ) ; arr [ offset + size ] = o ; size ++ ; return true ; |
public class VoltTable { /** * Append a { @ link VoltTableRow row } from another < tt > VoltTable < / tt >
* to this VoltTable instance . Technically , it could be from the same
* table , but this isn ' t the common usage .
* @ param row { @ link VoltTableRow Row } to add . */
public final void add ( VoltTableRow row ) { } } | assert ( verifyTableInvariants ( ) ) ; if ( m_readOnly ) { throw new IllegalStateException ( "Table is read-only. Make a copy before changing." ) ; } if ( m_colCount == 0 ) { throw new IllegalStateException ( "Table has no columns defined" ) ; } if ( row . getColumnCount ( ) != m_colCount ) { throw new IllegalArgumentException ( row . getColumnCount ( ) + " arguments but table has " + m_colCount + " columns" ) ; } // memoize the start of this row in case we roll back
final int pos = m_buffer . position ( ) ; try { // Allow the buffer to grow to max capacity
m_buffer . limit ( m_buffer . capacity ( ) ) ; byte [ ] inboundSchemaString = row . getSchemaString ( ) ; byte [ ] mySchemaString = getSchemaString ( ) ; // The way this works is that when two schema strings are found to have
// the same value , the target table ' s reference is pointed at the source
// table ' s reference . This allows the copying of multiple rows from one
// table to another to only do a deep comparison once , and to do reference
// equivalence checks for subsequent rows .
boolean canDoRawCopy = ( inboundSchemaString == mySchemaString ) || Arrays . equals ( inboundSchemaString , mySchemaString ) ; if ( canDoRawCopy ) { // make them the same object if equal for faster comparison next time
m_schemaString = inboundSchemaString ; // raw blit the row ( assume the row is valid with proper length )
ByteBuffer rawRow = row . getRawRow ( ) ; m_buffer . put ( rawRow ) ; } else { // advance the row size value
m_buffer . position ( pos + 4 ) ; for ( int i = 0 ; i < m_colCount ; i ++ ) { VoltType inboundType = row . getColumnType ( i ) ; VoltType outboundType = getColumnType ( i ) ; if ( inboundType == outboundType ) { byte [ ] raw = row . getRaw ( i ) ; m_buffer . put ( raw ) ; } else { Object inboundValue = row . get ( i , inboundType ) ; addColumnValue ( inboundValue , outboundType , i ) ; } } final int rowsize = m_buffer . position ( ) - pos - 4 ; assert ( rowsize >= 0 ) ; // check for too big rows
if ( rowsize > VoltTableRow . MAX_TUPLE_LENGTH ) { throw new VoltOverflowException ( "Table row total length larger than allowed max " + VoltTableRow . MAX_TUPLE_LENGTH_STR ) ; } // buffer overflow is caught and handled below .
m_buffer . putInt ( pos , rowsize ) ; } // constrain buffer limit back to the new position
m_buffer . limit ( m_buffer . position ( ) ) ; // increment the rowcount in the member var and in the buffer
m_rowCount ++ ; m_buffer . putInt ( m_rowStart , m_rowCount ) ; } catch ( VoltTypeException vte ) { // revert the row size advance and any other
// buffer additions
m_buffer . position ( pos ) ; throw vte ; } catch ( BufferOverflowException e ) { m_buffer . position ( pos ) ; expandBuffer ( ) ; add ( row ) ; } // row was too big , reset and rethrow
catch ( VoltOverflowException e ) { m_buffer . position ( pos ) ; throw e ; } catch ( IllegalArgumentException e ) { // if this was thrown because of a lack of space
// then grow the buffer
// the number 32 was picked out of a hat ( maybe a bug if str > 32 )
if ( m_buffer . limit ( ) - m_buffer . position ( ) < 32 ) { m_buffer . position ( pos ) ; expandBuffer ( ) ; add ( row ) ; } else { throw e ; } } assert ( verifyTableInvariants ( ) ) ; |
public class MemcachedClient { /** * Prepend to an existing value in the cache .
* Note that the return will be false any time a mutation has not occurred .
* @ param key the key to whose value will be prepended
* @ param val the value to append
* @ return a future indicating success
* @ throws IllegalStateException in the rare circumstance where queue is too
* full to accept any more requests */
@ Override public OperationFuture < Boolean > prepend ( String key , Object val ) { } } | return prepend ( 0 , key , val , transcoder ) ; |
public class JspHelper { /** * return a random node from the replicas of this block */
public static DatanodeInfo bestNode ( LocatedBlock blk ) throws IOException { } } | DatanodeInfo [ ] nodes = blk . getLocations ( ) ; return bestNode ( nodes , true ) . get ( 0 ) ; |
public class CmsTreeItem { /** * Positions the drag and drop placeholder as a sibling or descendant of this element . < p >
* @ param x the cursor client x position
* @ param y the cursor client y position
* @ param placeholder the placeholder
* @ param orientation the drag and drop orientation
* @ return the placeholder index */
public int repositionPlaceholder ( int x , int y , Element placeholder , Orientation orientation ) { } } | I_CmsDraggable draggable = null ; if ( getTree ( ) . getDnDHandler ( ) != null ) { draggable = getTree ( ) . getDnDHandler ( ) . getDraggable ( ) ; } Element itemElement = getListItemWidget ( ) . getElement ( ) ; // check if the mouse pointer is within the height of the element
int top = CmsDomUtil . getRelativeY ( y , itemElement ) ; int height = itemElement . getOffsetHeight ( ) ; int index ; String parentPath ; boolean isParentDndEnabled ; CmsTreeItem parentItem = getParentItem ( ) ; if ( parentItem == null ) { index = getTree ( ) . getItemPosition ( this ) ; parentPath = "/" ; isParentDndEnabled = getTree ( ) . isRootDropEnabled ( ) ; } else { index = parentItem . getItemPosition ( this ) ; parentPath = getParentItem ( ) . getPath ( ) ; isParentDndEnabled = getParentItem ( ) . isDropEnabled ( ) ; } if ( top < height ) { // the mouse pointer is within the widget
int diff = x - getListItemWidget ( ) . getAbsoluteLeft ( ) ; if ( ( draggable != this ) && isDropEnabled ( ) && ( diff > 0 ) && ( diff < 32 ) ) { // over icon
getTree ( ) . setOpenTimer ( this ) ; m_children . getElement ( ) . insertBefore ( placeholder , m_children . getElement ( ) . getFirstChild ( ) ) ; getTree ( ) . setPlaceholderPath ( getPath ( ) ) ; return 0 ; } getTree ( ) . cancelOpenTimer ( ) ; // In this case try to drop on the parent
if ( ! isParentDndEnabled ) { // we are not allowed to drop here
// keeping old position
return getTree ( ) . getPlaceholderIndex ( ) ; } int originalPathLevel = - 1 ; if ( draggable instanceof CmsTreeItem ) { originalPathLevel = getPathLevel ( ( ( CmsTreeItem ) draggable ) . getPath ( ) ) - 1 ; } if ( shouldInsertIntoSiblingList ( originalPathLevel , parentItem , index ) ) { @ SuppressWarnings ( "null" ) CmsTreeItem previousSibling = parentItem . getChild ( index - 1 ) ; if ( previousSibling . isOpen ( ) ) { // insert as last into the last opened of the siblings tree fragment
return CmsTreeItem . getLastOpenedItem ( previousSibling , originalPathLevel , true ) . insertPlaceholderAsLastChild ( placeholder ) ; } } // insert place holder at the parent before the current item
getElement ( ) . getParentElement ( ) . insertBefore ( placeholder , getElement ( ) ) ; getTree ( ) . setPlaceholderPath ( parentPath ) ; return index ; } else if ( ( draggable != this ) && isOpen ( ) ) { getTree ( ) . cancelOpenTimer ( ) ; // the mouse pointer is on children
for ( int childIndex = 0 ; childIndex < getChildCount ( ) ; childIndex ++ ) { CmsTreeItem child = getChild ( childIndex ) ; Element childElement = child . getElement ( ) ; boolean over = false ; switch ( orientation ) { case HORIZONTAL : over = CmsDomUtil . checkPositionInside ( childElement , x , - 1 ) ; break ; case VERTICAL : over = CmsDomUtil . checkPositionInside ( childElement , - 1 , y ) ; break ; case ALL : default : over = CmsDomUtil . checkPositionInside ( childElement , x , y ) ; } if ( over ) { return child . repositionPlaceholder ( x , y , placeholder , orientation ) ; } } } getTree ( ) . cancelOpenTimer ( ) ; // keeping old position
return getTree ( ) . getPlaceholderIndex ( ) ; |
public class CommonOps_DSCC { /** * Computes the inner product of A times A and stores the results in B . The inner product is symmetric and this
* function will only store the lower triangle . If the full matrix is needed then . If you need the full
* matrix use { @ link # symmLowerToFull } .
* < p > B = A < sup > T < / sup > * A < / sup >
* @ param A ( Input ) Matrix
* @ param B ( Output ) Storage for output .
* @ param gw ( Optional ) Workspace
* @ param gx ( Optional ) Workspace */
public static void innerProductLower ( DMatrixSparseCSC A , DMatrixSparseCSC B , @ Nullable IGrowArray gw , @ Nullable DGrowArray gx ) { } } | ImplSparseSparseMult_DSCC . innerProductLower ( A , B , gw , gx ) ; |
public class AbstractFormSerializer { /** * Append an integer field to the form .
* @ param builder The StringBuilder to use .
* @ param key The form key , which must be URLEncoded before calling this method .
* @ param value The value associated with the key . */
protected void appendField ( final StringBuilder builder , final String key , final int value ) { } } | if ( builder . length ( ) > 0 ) { builder . append ( "&" ) ; } builder . append ( key ) . append ( "=" ) . append ( value ) ; |
public class CountedCompleter { /** * Equivalent to { @ link # tryComplete } but does not invoke { @ link # onCompletion ( CountedCompleter ) }
* along the completion path : If the pending count is nonzero , decrements the count ; otherwise ,
* similarly tries to complete this task ' s completer , if one exists , else marks this task as
* complete . This method may be useful in cases where { @ code onCompletion } should not , or need
* not , be invoked for each completer in a computation . */
public final void propagateCompletion ( ) { } } | CountedCompleter < ? > a = this , s ; for ( int c ; ; ) { if ( ( c = a . pending ) == 0 ) { if ( ( a = ( s = a ) . completer ) == null ) { s . quietlyComplete ( ) ; return ; } } else if ( U . compareAndSwapInt ( a , PENDING , c , c - 1 ) ) return ; } |
public class InstanceAdminExample { /** * Demonstrates how to delete an instance . */
public void deleteInstance ( ) { } } | System . out . println ( "\nDeleting Instance" ) ; // [ START bigtable _ delete _ instance ]
try { adminClient . deleteInstance ( instanceId ) ; System . out . println ( "Instance deleted: " + instanceId ) ; } catch ( NotFoundException e ) { System . err . println ( "Failed to delete non-existent instance: " + e . getMessage ( ) ) ; } // [ END bigtable _ delete _ instance ] |
public class MeasureOverview { /** * Updates the parameter combo box . If there is no varied parameter , empty
* and disable the box . Otherwise display the available parameters . */
private void updateParamBox ( ) { } } | if ( this . variedParamValues == null || this . variedParamValues . length == 0 ) { // no varied parameter - > set to empty box
this . paramBox . removeAllItems ( ) ; this . paramBox . setEnabled ( false ) ; } else if ( this . paramBox . getItemCount ( ) != this . variedParamValues . length ) { // varied parameter changed - > set the paramBox new
this . paramBox . removeAllItems ( ) ; for ( int i = 0 ; i < variedParamValues . length ; i ++ ) { this . paramBox . addItem ( String . format ( "%s: %s" , this . variedParamName , this . variedParamValues [ i ] ) ) ; } this . paramBox . setEnabled ( true ) ; } |
public class EJBInjectionBinding { /** * Extract the fields from the EjbRef , and verify they match the values in the current
* binding object and / or annotation exactly . If they do indeed match , add all the
* InjectionTargets on the EjbRef parameter to the current binding . The code takes into
* account the possibility of duplicates InjectionTargets and will only use one in case
* where they duplicated between the two ref definitions .
* @ param ejbRef
* @ throws InjectionException */
public void merge ( EJBRef ejbRef ) throws InjectionException { } } | final boolean isTraceOn = TraceComponent . isAnyTracingEnabled ( ) ; if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . entry ( tc , "merge : " + ejbRef ) ; EJBImpl curAnnotation = ( EJBImpl ) this . getAnnotation ( ) ; String jndiName = ejbRef . getName ( ) ; String curJndiName = curAnnotation . name ( ) ; int beanType = ejbRef . getTypeValue ( ) ; int curBeanType = this . ivBeanType ; String homeInterfaceName = ejbRef . getHome ( ) ; String beanInterfaceName = ejbRef . getInterface ( ) ; String beanName = ejbRef . getLink ( ) ; String curBeanName = ivBeanName ; // 649980
String lookup = ejbRef . getLookupName ( ) ; // F743-21028.4
if ( lookup != null ) { lookup = lookup . trim ( ) ; } String mappedName = ( ejbRef . getMappedName ( ) == null ) ? "" : ejbRef . getMappedName ( ) ; String curMappedName = curAnnotation . mappedName ( ) ; int kind = ejbRef . getKindValue ( ) ; boolean ejbLocalRef = kind == EJBRef . KIND_LOCAL ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "new=" + jndiName + ":" + beanType + ":" + homeInterfaceName + "/" + beanInterfaceName + ":" + beanName + ":" + mappedName + ":" + lookup ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "cur=" + curJndiName + ":" + curBeanType + ":" + getInjectionClassTypeName ( ) + "," + ivHomeInterface + ":" + curBeanName + ":" + curMappedName + ":" + ivLookup ) ; // If there are 2 EJB Refs , but one is local , and the other remote ,
// then this is an incompatibility . . . and thus an error . d479669
if ( ( ivEjbRef && ejbLocalRef ) || ( ivEjbLocalRef && kind == EJBRef . KIND_REMOTE ) ) { Tr . error ( tc , "CONFLICTING_XML_TYPES_CWNEN0051E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , "ejb-ref-name" , jndiName , "ejb-ref" , "ejb-local-ref" } ) ; String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting element types exist with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting element types are " + "ejb-ref" + " and " + "ejb-local-ref" + "." ; throw new InjectionConfigurationException ( exMsg ) ; } // The type parameter is " optional "
if ( beanType != EJBRef . TYPE_UNSPECIFIED && curBeanType != EJBRef . TYPE_UNSPECIFIED ) { // check that value from xml is a subclasss , if not throw an error
if ( beanType != curBeanType ) { String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; String curBeanTypeName = curBeanType == EJBRef . TYPE_SESSION ? "Session" : "Entity" ; String beanTypeName = beanType == EJBRef . TYPE_SESSION ? "Session" : "Entity" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , "ejb-ref-type" , elementType , "ejb-ref-name" , jndiName , curBeanTypeName , beanTypeName } ) ; // d479669
String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "ejb-ref-type" + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + "ejb-ref-type" + " element values are " + curBeanTypeName + " and " + beanTypeName + "." ; throw new InjectionConfigurationException ( exMsg ) ; } } else if ( beanType != EJBRef . TYPE_UNSPECIFIED && curBeanType == EJBRef . TYPE_UNSPECIFIED ) { this . ivBeanType = beanType ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivBeanType = " + this . ivBeanType ) ; } // The homeInterface parameter is " optional "
if ( homeInterfaceName != null && homeInterfaceName . length ( ) != 0 ) // d668376
{ if ( ivClassLoader == null ) // F743-32443
{ setInjectionClassTypeName ( homeInterfaceName ) ; ivHomeInterface = true ; } else { Class < ? > homeInterface = loadClass ( homeInterfaceName , false ) ; if ( ivHomeInterface ) { Class < ? > curHomeInterface = getInjectionClassType ( ) ; Class < ? > mostSpecific = mostSpecificClass ( homeInterface , curHomeInterface ) ; if ( mostSpecific == null ) { String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; String elementAttr = ejbLocalRef ? "local-home" : "home" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , elementAttr , elementType , "ejb-ref-name" , jndiName , curHomeInterface . getName ( ) , homeInterface . getName ( ) } ) ; // d479669
String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + elementAttr + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + elementAttr + " element values are " + curHomeInterface . getName ( ) + " and " + homeInterface . getName ( ) + "." ; throw new InjectionConfigurationException ( exMsg ) ; } setInjectionClassType ( mostSpecific ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivHomeInterface = " + this . ivHomeInterface ) ; } else { setInjectionClassType ( homeInterface ) ; ivHomeInterface = true ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivHomeInterface = " + this . ivHomeInterface ) ; } } } // The beanInterface parameter is " optional "
else if ( beanInterfaceName != null && beanInterfaceName . length ( ) != 0 ) // d668376
{ ivBeanInterface = true ; if ( ivClassLoader == null ) // F743-32443
{ setInjectionClassTypeName ( beanInterfaceName ) ; } else if ( ! ivHomeInterface ) { Class < ? > beanInterface = loadClass ( beanInterfaceName , false ) ; Class < ? > curBeanInterface = getInjectionClassType ( ) ; Class < ? > mostSpecific = mostSpecificClass ( beanInterface , curBeanInterface ) ; if ( mostSpecific == null ) { String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; String elementAttr = ejbLocalRef ? "local" : "remote" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , elementAttr , elementType , "ejb-ref-name" , jndiName , curBeanInterface . getName ( ) , beanInterface . getName ( ) } ) ; // d479669
String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + elementAttr + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + elementAttr + " element values are " + curBeanInterface . getName ( ) + " and " + beanInterface . getName ( ) + "." ; throw new InjectionConfigurationException ( exMsg ) ; } setInjectionClassType ( beanInterface ) ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivBeanInterface = " + beanInterface ) ; } } // The mappedName parameter is " optional "
if ( curAnnotation . ivIsSetMappedName && mappedName != null ) { if ( ! curMappedName . equals ( mappedName ) ) { String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , "mapped-name" , elementType , "ejb-ref-name" , jndiName , curMappedName , mappedName } ) ; // d479669
String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "mapped-name" + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + "mapped-name" + " element values are " + curMappedName + " and " + mappedName + "." ; throw new InjectionConfigurationException ( exMsg ) ; } } else if ( mappedName != null && ! curAnnotation . ivIsSetMappedName ) { curAnnotation . ivMappedName = mappedName ; curAnnotation . ivIsSetMappedName = true ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivMappedName = " + mappedName ) ; } // The beanName parameter is " optional "
if ( beanName != null && curAnnotation . ivIsSetBeanName ) { if ( ! curBeanName . equals ( beanName ) ) { String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { ivNameSpaceConfig . getDisplayName ( ) , ivNameSpaceConfig . getModuleName ( ) , ivNameSpaceConfig . getApplicationName ( ) , "ejb-link" , elementType , "ejb-ref-name" , jndiName , curBeanName , beanName } ) ; // d479669
String exMsg = "The " + ivNameSpaceConfig . getDisplayName ( ) + " bean in the " + ivNameSpaceConfig . getModuleName ( ) + " module of the " + ivNameSpaceConfig . getApplicationName ( ) + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "ejb-link" + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + "ejb-link" + " element values are " + curBeanName + " and " + beanName + "." ; throw new InjectionConfigurationException ( exMsg ) ; } } else if ( beanName != null && curBeanName == null ) { curAnnotation . ivBeanName = beanName ; curAnnotation . ivIsSetBeanName = true ; ivBeanName = beanName ; ivBeanNameOrLookupInXml = true ; // F743-21028.4
if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivBeanName = " + this . ivBeanName ) ; } // Merge : lookup - " optional parameter F743-21028.4
// If present in XML , even if the empty string ( " " ) , it will override
// any setting via annotations . An empty string would effectively turn
// off this setting , so auto - link would be used instead .
// When an ejb - ref appears multiple times in XML , an empty string is
// considered to be a conflict with a non - empty string , since both
// were explicitly specified .
if ( lookup != null ) { if ( ivLookup != null ) { if ( ! lookup . equals ( ivLookup ) ) { String component = ivNameSpaceConfig . getDisplayName ( ) ; String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { component , ivModule , ivApplication , "lookup-name" , elementType , "ejb-ref-name" , jndiName , ivLookup , lookup } ) ; String exMsg = "The " + component + " bean in the " + ivModule + " module of the " + ivApplication + " application has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "lookup-name" + " element values exist for multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + jndiName + ". The conflicting " + "lookup-name" + " element values are \"" + ivLookup + "\" and \"" + lookup + "\"." ; throw new InjectionConfigurationException ( exMsg ) ; } } else { ivLookup = lookup ; ivBeanNameOrLookupInXml = true ; curAnnotation . ivLookup = lookup ; if ( isTraceOn && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "ivLookup = " + ivLookup ) ; } } // It is an error to specify both ' ejb - link ' and ' lookup - name ' . F743-21028.4
if ( ivBeanName != null && ivLookup != null ) { // Error - conflicting ejb - link / lookup - name values
String component = ivNameSpaceConfig . getDisplayName ( ) ; String elementType = ejbLocalRef ? "ejb-local-ref" : "ejb-ref" ; Tr . error ( tc , "CONFLICTING_XML_VALUES_CWNEN0052E" , new Object [ ] { component , ivModule , ivApplication , "ejb-link/lookup-name" , elementType , "ejb-ref-name" , getJndiName ( ) , ivBeanName , ivLookup } ) ; String exMsg = "The " + component + " bean in the " + ivModule + " module of the " + ivApplication + " application" + " has conflicting configuration data in the XML" + " deployment descriptor. Conflicting " + "ejb-link/lookup-name" + " element values exist for" + " multiple " + elementType + " elements with the same " + "ejb-ref-name" + " element value : " + getJndiName ( ) + ". The conflicting " + "ejb-link/lookup-name" + " element values are \"" + ivBeanName + "\" and \"" + ivLookup + "\"." ; throw new InjectionConfigurationException ( exMsg ) ; } // Loop through the InjectionTargets and call addInjectionTarget . . . . which
// already accounts for duplicates ( in case they duplicated some between the two ref definitions .
List < InjectionTarget > targets = ejbRef . getInjectionTargets ( ) ; if ( ! targets . isEmpty ( ) ) { for ( InjectionTarget target : targets ) { Class < ? > injectionType = this . getInjectionClassType ( ) ; String injectionName = target . getInjectionTargetName ( ) ; String injectionClassName = target . getInjectionTargetClassName ( ) ; this . addInjectionTarget ( injectionType , // d446474
injectionName , injectionClassName ) ; } } if ( isTraceOn && tc . isEntryEnabled ( ) ) Tr . exit ( tc , "merge" , this ) ; |
public class AiffData { /** * Creates a AiffData container from the specified inputstream
* @ param is InputStream to read from
* @ return AiffData containing data , or null if a failure occured */
public static AiffData create ( InputStream is ) { } } | try { return create ( AudioSystem . getAudioInputStream ( is ) ) ; } catch ( Exception e ) { org . lwjgl . LWJGLUtil . log ( "Unable to create from inputstream" ) ; e . printStackTrace ( ) ; return null ; } |
public class GBSTree { /** * Create and return an Iterator positioned on the beginning of the tree .
* < p > The Iterator is not actually positioned on the beginning of the
* tree . It has no position at all . The first time Iterator . next ( ) is
* invoked it will position itself on the beginning of the tree . < / p > */
public Iterator iterator ( ) { } } | GBSIterator x = new GBSIterator ( this ) ; Iterator q = ( Iterator ) x ; return q ; |
public class ReferenceCountedOpenSslContext { /** * producing a segfault . */
private void destroy ( ) { } } | Lock writerLock = ctxLock . writeLock ( ) ; writerLock . lock ( ) ; try { if ( ctx != 0 ) { if ( enableOcsp ) { SSLContext . disableOcsp ( ctx ) ; } SSLContext . free ( ctx ) ; ctx = 0 ; OpenSslSessionContext context = sessionContext ( ) ; if ( context != null ) { context . destroy ( ) ; } } } finally { writerLock . unlock ( ) ; } |
public class PreparedStatement { /** * Creates bytes array from input stream .
* @ param stream Input stream
* @ param length */
private byte [ ] createBytes ( InputStream stream , long length ) throws SQLException { } } | ByteArrayOutputStream buff = null ; try { buff = new ByteArrayOutputStream ( ) ; if ( length > 0 ) IOUtils . copyLarge ( stream , buff , 0 , length ) ; else IOUtils . copy ( stream , buff ) ; return buff . toByteArray ( ) ; } catch ( IOException e ) { throw new SQLException ( "Fails to create BLOB" , e ) ; } finally { IOUtils . closeQuietly ( buff ) ; } // end of finally |
public class CmsJspTagInclude { /** * Includes the selected target . < p >
* @ param context the current JSP page context
* @ param target the target for the include , might be < code > null < / code >
* @ param element the element to select form the target , might be < code > null < / code >
* @ param locale the locale to use for the selected element , might be < code > null < / code >
* @ param editable flag to indicate if the target is editable
* @ param cacheable flag to indicate if the target should be cacheable in the Flex cache
* @ param paramMap a map of parameters for the include , will be merged with the request
* parameters , might be < code > null < / code >
* @ param attrMap a map of attributes for the include , will be merged with the request
* attributes , might be < code > null < / code >
* @ param req the current request
* @ param res the current response
* @ throws JspException in case something goes wrong */
public static void includeTagAction ( PageContext context , String target , String element , Locale locale , boolean editable , boolean cacheable , Map < String , String [ ] > paramMap , Map < String , Object > attrMap , ServletRequest req , ServletResponse res ) throws JspException { } } | // the Flex controller provides access to the internal OpenCms structures
CmsFlexController controller = CmsFlexController . getController ( req ) ; if ( target == null ) { // set target to default
target = controller . getCmsObject ( ) . getRequestContext ( ) . getUri ( ) ; } // resolve possible relative URI
target = CmsLinkManager . getAbsoluteUri ( target , controller . getCurrentRequest ( ) . getElementUri ( ) ) ; try { // check if the target actually exists in the OpenCms VFS
controller . getCmsObject ( ) . readResource ( target ) ; } catch ( CmsException e ) { // store exception in controller and discontinue
controller . setThrowable ( e , target ) ; throw new JspException ( e ) ; } // include direct edit " start " element ( if enabled )
boolean directEditOpen = editable && CmsJspTagEditable . startDirectEdit ( context , new CmsDirectEditParams ( target , element ) ) ; // save old parameters from request
Map < String , String [ ] > oldParameterMap = CmsCollectionsGenericWrapper . map ( req . getParameterMap ( ) ) ; try { // each include will have it ' s unique map of parameters
Map < String , String [ ] > parameterMap = ( paramMap == null ) ? new HashMap < String , String [ ] > ( ) : new HashMap < String , String [ ] > ( paramMap ) ; if ( cacheable && ( element != null ) ) { // add template element selector for JSP templates ( only required if cacheable )
addParameter ( parameterMap , I_CmsResourceLoader . PARAMETER_ELEMENT , element , true ) ; } // add parameters to set the correct element
controller . getCurrentRequest ( ) . addParameterMap ( parameterMap ) ; // each include will have it ' s unique map of attributes
Map < String , Object > attributeMap = ( attrMap == null ) ? new HashMap < String , Object > ( ) : new HashMap < String , Object > ( attrMap ) ; // add attributes to set the correct element
controller . getCurrentRequest ( ) . addAttributeMap ( attributeMap ) ; Set < String > dynamicParams = controller . getCurrentRequest ( ) . getDynamicParameters ( ) ; Map < String , String [ ] > extendedParameterMap = null ; if ( ! dynamicParams . isEmpty ( ) ) { // We want to store the parameters from the request with keys in dynamicParams in the flex response ' s include list , but only if they ' re set
extendedParameterMap = Maps . newHashMap ( ) ; extendedParameterMap . putAll ( parameterMap ) ; for ( String dynamicParam : dynamicParams ) { String [ ] val = req . getParameterMap ( ) . get ( dynamicParam ) ; if ( val != null ) { extendedParameterMap . put ( dynamicParam , val ) ; } } } if ( cacheable ) { // use include with cache
includeActionWithCache ( controller , context , target , extendedParameterMap != null ? extendedParameterMap : parameterMap , attributeMap , req , res ) ; } else { // no cache required
includeActionNoCache ( controller , context , target , element , locale , req , res ) ; } } finally { // restore old parameter map ( if required )
if ( oldParameterMap != null ) { controller . getCurrentRequest ( ) . setParameterMap ( oldParameterMap ) ; } } // include direct edit " end " element ( if required )
if ( directEditOpen ) { CmsJspTagEditable . endDirectEdit ( context ) ; } |
public class ListManagementImagesImpl { /** * Add an image to the list with list Id equal to list Id passed .
* @ param listId List Id of the image list .
* @ param imageStream The image file .
* @ param addImageFileInputOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the Image object */
public Observable < Image > addImageFileInputAsync ( String listId , byte [ ] imageStream , AddImageFileInputOptionalParameter addImageFileInputOptionalParameter ) { } } | return addImageFileInputWithServiceResponseAsync ( listId , imageStream , addImageFileInputOptionalParameter ) . map ( new Func1 < ServiceResponse < Image > , Image > ( ) { @ Override public Image call ( ServiceResponse < Image > response ) { return response . body ( ) ; } } ) ; |
public class TableFactor { /** * Gets a { @ code TableFactor } over { @ code vars } which assigns weight 1 to all
* assignments .
* @ param vars
* @ return */
public static TableFactor unity ( VariableNumMap vars ) { } } | return new TableFactor ( vars , DenseTensor . constant ( vars . getVariableNumsArray ( ) , vars . getVariableSizes ( ) , 1.0 ) ) ; |
public class CaptionLanguageMappingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( CaptionLanguageMapping captionLanguageMapping , ProtocolMarshaller protocolMarshaller ) { } } | if ( captionLanguageMapping == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( captionLanguageMapping . getCaptionChannel ( ) , CAPTIONCHANNEL_BINDING ) ; protocolMarshaller . marshall ( captionLanguageMapping . getLanguageCode ( ) , LANGUAGECODE_BINDING ) ; protocolMarshaller . marshall ( captionLanguageMapping . getLanguageDescription ( ) , LANGUAGEDESCRIPTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class Servlet { /** * Called by the servlet engine to process get requests :
* a ) to set the Last - Modified header in the response
* b ) to check if 304 can be redurned if the " if - modified - since " request header is present
* @ return - 1 for when unknown */
@ Override public long getLastModified ( HttpServletRequest request ) { } } | String path ; int idx ; long result ; result = - 1 ; try { path = request . getPathInfo ( ) ; if ( path != null && path . startsWith ( "/get/" ) ) { lazyInit ( request ) ; path = path . substring ( 5 ) ; idx = path . indexOf ( '/' ) ; if ( idx != - 1 ) { path = path . substring ( idx + 1 ) ; result = engine . getLastModified ( path ) ; } } } catch ( IOException e ) { error ( request , "getLastModified" , e ) ; // fall - through
} catch ( RuntimeException | Error e ) { error ( request , "getLastModified" , e ) ; throw e ; } LOG . debug ( "getLastModified(" + request . getPathInfo ( ) + ") -> " + result ) ; return result ; |
public class BusStop { /** * Replies the distance between the given point and this bus stop .
* @ param x x coordinate .
* @ param y y coordinate .
* @ return the distance to this bus stop */
@ Pure public double distance ( double x , double y ) { } } | if ( isValidPrimitive ( ) ) { final GeoLocationPoint p = getGeoPosition ( ) ; return Point2D . getDistancePointPoint ( p . getX ( ) , p . getY ( ) , x , y ) ; } return Double . NaN ; |
public class JobExecutionStateListeners { /** * { @ inheritDoc } */
@ Override public void onStageTransition ( JobExecutionState state , String previousStage , String newStage ) { } } | try { _dispatcher . execCallbacks ( new StageTransitionCallback ( state , previousStage , newStage ) ) ; } catch ( InterruptedException e ) { _dispatcher . getLog ( ) . warn ( "onStageTransition interrupted." ) ; } |
public class DDM { /** * Sets the multiplier on the standard deviation that must be exceeded to
* initiate a warning state . Once in the warning state , DDM will begin to
* collect a history of the inputs < br >
* Increasing the warning threshold makes it take longer to start detecting
* a change , but reduces false positives . < br >
* If the warning threshold is set above the
* { @ link # setDriftThreshold ( double ) } , the drift state will not occur until
* the warning state is reached , and the warning state will be skipped .
* @ param warningThreshold the positive multiplier threshold for starting a
* warning state */
public void setWarningThreshold ( double warningThreshold ) { } } | if ( warningThreshold <= 0 || Double . isNaN ( warningThreshold ) || Double . isInfinite ( warningThreshold ) ) throw new IllegalArgumentException ( "warning threshold must be positive, not " + warningThreshold ) ; this . warningThreshold = warningThreshold ; |
public class TemplateSignatureRequest { /** * Add the template ID to be used at the specified index .
* @ param id String
* @ param index Integer
* @ throws HelloSignException thrown if therer is a problem adding the given
* template ID . */
public void addTemplateId ( String id , Integer index ) throws HelloSignException { } } | List < String > currentList = getList ( String . class , TEMPLATE_IDS ) ; if ( index == null ) { index = currentList . size ( ) ; } else if ( index < 0 ) { throw new HelloSignException ( "index cannot be negative" ) ; } else if ( index > currentList . size ( ) ) { throw new HelloSignException ( "index is greater than template ID list size: " + currentList . size ( ) ) ; } if ( index == currentList . size ( ) ) { add ( TEMPLATE_IDS , id ) ; // Just append the item
} else { // Insert the item at the given index
clearList ( TEMPLATE_IDS ) ; int limit = currentList . size ( ) ; // We ' ll be adding one
for ( int i = 0 ; i < limit + 1 ; i ++ ) { if ( i == index ) { add ( TEMPLATE_IDS , id ) ; } if ( i < limit ) { add ( TEMPLATE_IDS , currentList . get ( i ) ) ; } } } |
public class ApplicationReader { /** * Make the request to the Twilio API to perform the read .
* @ param client TwilioRestClient with which to make the request
* @ return Application ResourceSet */
@ Override public ResourceSet < Application > read ( final TwilioRestClient client ) { } } | return new ResourceSet < > ( this , client , firstPage ( client ) ) ; |
public class SerializationUtilities { /** * Deserialize a byte array to a given object .
* @ param bytes
* the byte array .
* @ param adaptee
* the class to adapt to .
* @ return the object .
* @ throws Exception */
public static < T > T deSerialize ( byte [ ] bytes , Class < T > adaptee ) throws Exception { } } | ObjectInputStream in = new ObjectInputStream ( new ByteArrayInputStream ( bytes ) ) ; Object readObject = in . readObject ( ) ; return adaptee . cast ( readObject ) ; |
public class PrometheusController { /** * prints a long metric value , including HELP and TYPE rows */
private void printLong ( MetricType metricType , String name , String description , long value ) { } } | printHeader ( metricType , name , description ) ; printLongWithFields ( name , null , value ) ; |
public class MetadataBuilder { /** * add specified file in torrent with custom path . The file will be stored in . torrent
* by specified path . Path can be separated with any slash . In case of single - file torrent
* this path will be used as name of source file */
public MetadataBuilder addFile ( @ NotNull File source , @ NotNull String path ) { } } | if ( ! source . isFile ( ) ) { throw new IllegalArgumentException ( source + " is not exist" ) ; } checkHashingResultIsNotSet ( ) ; filesPaths . add ( path ) ; dataSources . add ( new FileSourceHolder ( source ) ) ; return this ; |
public class AbstractJSON { /** * Fires a warning event .
* @ param warning the warning message */
protected static void fireWarnEvent ( String warning , JsonConfig jsonConfig ) { } } | if ( jsonConfig . isEventTriggeringEnabled ( ) ) { for ( Iterator listeners = jsonConfig . getJsonEventListeners ( ) . iterator ( ) ; listeners . hasNext ( ) ; ) { JsonEventListener listener = ( JsonEventListener ) listeners . next ( ) ; try { listener . onWarning ( warning ) ; } catch ( RuntimeException e ) { log . warn ( e ) ; } } } |
public class ValuePoolHashMap { /** * In rare circumstances resetCapacity may not succeed , in which case
* capacity remains unchanged but purge policy is set to newPolicy */
public void resetCapacity ( int newCapacity , int newPolicy ) throws IllegalArgumentException { } } | if ( newCapacity != 0 && hashIndex . elementCount > newCapacity ) { int surplus = hashIndex . elementCount - newCapacity ; surplus += ( surplus >> 5 ) ; if ( surplus > hashIndex . elementCount ) { surplus = hashIndex . elementCount ; } clear ( surplus , ( surplus >> 6 ) ) ; } if ( newCapacity != 0 && newCapacity < threshold ) { rehash ( newCapacity ) ; if ( newCapacity < hashIndex . elementCount ) { newCapacity = maxCapacity ; } } this . maxCapacity = newCapacity ; this . purgePolicy = newPolicy ; |
public class A_CmsPropertyEditor { /** * Helper method for creating the template selection widget . < p >
* @ return the template selector widget */
private I_CmsFormWidget createTemplateSelector ( ) { } } | if ( m_handler . useAdeTemplates ( ) ) { CmsSelectBox selectBox = null ; Map < String , String > values = new LinkedHashMap < String , String > ( ) ; for ( Map . Entry < String , CmsClientTemplateBean > templateEntry : m_handler . getPossibleTemplates ( ) . entrySet ( ) ) { CmsClientTemplateBean template = templateEntry . getValue ( ) ; String title = template . getTitle ( ) ; if ( ( title == null ) || ( title . length ( ) == 0 ) ) { title = template . getSitePath ( ) ; } values . put ( template . getSitePath ( ) , title ) ; } selectBox = new CmsPropertySelectBox ( values ) ; return selectBox ; } else { CmsTextBox textbox = new CmsTextBox ( ) ; return textbox ; } |
public class Currency { /** * Set the exchange rate between 2 currency
* @ param otherCurrency The other currency
* @ param amount THe exchange rate . */
public void setExchangeRate ( Currency otherCurrency , double amount ) { } } | Common . getInstance ( ) . getStorageHandler ( ) . getStorageEngine ( ) . setExchangeRate ( this , otherCurrency , amount ) ; |
public class GeometryFactoryImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EObject create ( EClass eClass ) { } } | switch ( eClass . getClassifierID ( ) ) { case GeometryPackage . GEOMETRY_INFO : return ( EObject ) createGeometryInfo ( ) ; case GeometryPackage . VECTOR3F : return ( EObject ) createVector3f ( ) ; case GeometryPackage . BOUNDS : return ( EObject ) createBounds ( ) ; case GeometryPackage . BUFFER : return ( EObject ) createBuffer ( ) ; case GeometryPackage . GEOMETRY_DATA : return ( EObject ) createGeometryData ( ) ; case GeometryPackage . VECTOR4F : return ( EObject ) createVector4f ( ) ; case GeometryPackage . COLOR_PACK : return ( EObject ) createColorPack ( ) ; default : throw new IllegalArgumentException ( "The class '" + eClass . getName ( ) + "' is not a valid classifier" ) ; } |
public class DMatrix { /** * to be invoked from R expression */
public static Frame mmul ( Frame x , Frame y ) { } } | MatrixMulJob mmj = new MatrixMulJob ( Key . make ( "mmul" + ++ cnt ) , Key . make ( "mmulProgress" ) , x , y ) ; mmj . fork ( ) . _fjtask . join ( ) ; DKV . remove ( mmj . _dstKey ) ; // do not leave garbage in KV
mmj . _z . reloadVecs ( ) ; return mmj . _z ; |
public class AuthResources { /** * Authenticates a user principal .
* @ param uriInfo URI info
* @ param creds The credentials with which to authenticate .
* @ return Response containing the required information .
* @ throws WebApplicationException If the user is not authenticated . */
@ POST @ Produces ( MediaType . APPLICATION_JSON ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Description ( "Authenticates a user principal." ) @ Path ( "/login" ) public Response login ( @ Context UriInfo uriInfo , final CredentialsDto creds ) { } } | Response response = Response . temporaryRedirect ( UriBuilder . fromUri ( uriInfo . getBaseUri ( ) + "v2/auth/login" ) . build ( ) ) . build ( ) ; return response ; |
public class LoadBalancerOutboundRulesInner { /** * Gets all the outbound rules in a load balancer .
* @ param resourceGroupName The name of the resource group .
* @ param loadBalancerName The name of the load balancer .
* @ 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 < OutboundRuleInner > > listAsync ( final String resourceGroupName , final String loadBalancerName , final ListOperationCallback < OutboundRuleInner > serviceCallback ) { } } | return AzureServiceFuture . fromPageResponse ( listSinglePageAsync ( resourceGroupName , loadBalancerName ) , new Func1 < String , Observable < ServiceResponse < Page < OutboundRuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < OutboundRuleInner > > > call ( String nextPageLink ) { return listNextSinglePageAsync ( nextPageLink ) ; } } , serviceCallback ) ; |
public class FuncSystemProperty { /** * Execute the function . The function must return
* a valid object .
* @ param xctxt The current execution context .
* @ return A valid XObject .
* @ throws javax . xml . transform . TransformerException */
public XObject execute ( XPathContext xctxt ) throws javax . xml . transform . TransformerException { } } | String fullName = m_arg0 . execute ( xctxt ) . str ( ) ; int indexOfNSSep = fullName . indexOf ( ':' ) ; String result = null ; String propName = "" ; // List of properties where the name of the
// property argument is to be looked for .
Properties xsltInfo = new Properties ( ) ; loadPropertyFile ( XSLT_PROPERTIES , xsltInfo ) ; if ( indexOfNSSep > 0 ) { String prefix = ( indexOfNSSep >= 0 ) ? fullName . substring ( 0 , indexOfNSSep ) : "" ; String namespace ; namespace = xctxt . getNamespaceContext ( ) . getNamespaceForPrefix ( prefix ) ; propName = ( indexOfNSSep < 0 ) ? fullName : fullName . substring ( indexOfNSSep + 1 ) ; if ( namespace . startsWith ( "http://www.w3.org/XSL/Transform" ) || namespace . equals ( "http://www.w3.org/1999/XSL/Transform" ) ) { result = xsltInfo . getProperty ( propName ) ; if ( null == result ) { warn ( xctxt , XPATHErrorResources . WG_PROPERTY_NOT_SUPPORTED , new Object [ ] { fullName } ) ; // " XSL Property not supported : " + fullName ) ;
return XString . EMPTYSTRING ; } } else { warn ( xctxt , XPATHErrorResources . WG_DONT_DO_ANYTHING_WITH_NS , new Object [ ] { namespace , fullName } ) ; // " Don ' t currently do anything with namespace " + namespace + " in property : " + fullName ) ;
try { // if secure procession is enabled only handle required properties do not not map any valid system property
if ( ! xctxt . isSecureProcessing ( ) ) { result = System . getProperty ( propName ) ; } else { warn ( xctxt , XPATHErrorResources . WG_SECURITY_EXCEPTION , new Object [ ] { fullName } ) ; // " SecurityException when trying to access XSL system property : " + fullName ) ;
} if ( null == result ) { return XString . EMPTYSTRING ; } } catch ( SecurityException se ) { warn ( xctxt , XPATHErrorResources . WG_SECURITY_EXCEPTION , new Object [ ] { fullName } ) ; // " SecurityException when trying to access XSL system property : " + fullName ) ;
return XString . EMPTYSTRING ; } } } else { try { // if secure procession is enabled only handle required properties do not not map any valid system property
if ( ! xctxt . isSecureProcessing ( ) ) { result = System . getProperty ( fullName ) ; } else { warn ( xctxt , XPATHErrorResources . WG_SECURITY_EXCEPTION , new Object [ ] { fullName } ) ; // " SecurityException when trying to access XSL system property : " + fullName ) ;
} if ( null == result ) { return XString . EMPTYSTRING ; } } catch ( SecurityException se ) { warn ( xctxt , XPATHErrorResources . WG_SECURITY_EXCEPTION , new Object [ ] { fullName } ) ; // " SecurityException when trying to access XSL system property : " + fullName ) ;
return XString . EMPTYSTRING ; } } if ( propName . equals ( "version" ) && result . length ( ) > 0 ) { try { // Needs to return the version number of the spec we conform to .
return new XString ( "1.0" ) ; } catch ( Exception ex ) { return new XString ( result ) ; } } else return new XString ( result ) ; |
public class BaseMojo { /** * Creates the archive from data in the staging directory .
* @ return The archive file .
* @ throws Exception Unspecified exception . */
private File createArchive ( ) throws Exception { } } | getLog ( ) . info ( "Creating archive." ) ; Artifact artifact = mavenProject . getArtifact ( ) ; String clsfr = noclassifier ? "" : ( "-" + classifier ) ; String archiveName = artifact . getArtifactId ( ) + "-" + artifact . getVersion ( ) + clsfr + ".jar" ; File jarFile = new File ( mavenProject . getBuild ( ) . getDirectory ( ) , archiveName ) ; MavenArchiver archiver = new MavenArchiver ( ) ; jarArchiver . addDirectory ( stagingDirectory ) ; archiver . setArchiver ( jarArchiver ) ; archiver . setOutputFile ( jarFile ) ; archiver . createArchive ( mavenSession , mavenProject , archiveConfig ) ; if ( noclassifier ) { artifact . setFile ( jarFile ) ; } else { projectHelper . attachArtifact ( mavenProject , jarFile , classifier ) ; } FileUtils . deleteDirectory ( stagingDirectory ) ; return jarFile ; |
public class Try { /** * flatMap recovery
* @ param fn Recovery FlatMap function . Map from a failure to a Success
* @ return Success from recovery function */
public Try < T , X > recoverFlatMap ( Function < ? super X , ? extends Try < T , X > > fn ) { } } | return new Try < > ( xor . flatMapLeftToRight ( fn . andThen ( t -> t . xor ) ) , classes ) ; |
public class NodeTopologyViews { /** * Return cluster node URI ' s using the topology query sources and partitions .
* @ return */
public Set < RedisURI > getClusterNodes ( ) { } } | Set < RedisURI > result = new HashSet < > ( ) ; Map < String , RedisURI > knownUris = new HashMap < > ( ) ; for ( NodeTopologyView view : views ) { knownUris . put ( view . getNodeId ( ) , view . getRedisURI ( ) ) ; } for ( NodeTopologyView view : views ) { for ( RedisClusterNode redisClusterNode : view . getPartitions ( ) ) { if ( knownUris . containsKey ( redisClusterNode . getNodeId ( ) ) ) { result . add ( knownUris . get ( redisClusterNode . getNodeId ( ) ) ) ; } else { result . add ( redisClusterNode . getUri ( ) ) ; } } } return result ; |
public class OrderedComparator { /** * Compares two Ordered objects to determine their relative order by index .
* @ param ordered1 the first Ordered object in the order comparison .
* @ param ordered2 the second Ordered object in the order comparison .
* @ return an integer value indicating one Ordered object ' s order relative to another Ordered object . */
@ Override public int compare ( final Ordered ordered1 , final Ordered ordered2 ) { } } | return ( ordered1 . getIndex ( ) < ordered2 . getIndex ( ) ? - 1 : ( ordered1 . getIndex ( ) > ordered2 . getIndex ( ) ? 1 : 0 ) ) ; |
public class ReportingApi { /** * Subscribe to a group of statistics . The values are returned when you request them using ` peek ( ) ` .
* @ param statistics The collection of statistics you want to include in your subscription .
* @ return SubscribeData
* @ throws WorkspaceApiException */
public SubscribeData subscribe ( Collection < Statistic > statistics ) throws WorkspaceApiException { } } | try { StatisticsSubscribeData subscribeData = new StatisticsSubscribeData ( ) ; StatisticsSubscribeDataData data = new StatisticsSubscribeDataData ( ) ; data . setStatistics ( new ArrayList < > ( statistics ) ) ; subscribeData . setData ( data ) ; InlineResponse2002 resp = api . subscribe ( subscribeData ) ; Util . throwIfNotOk ( resp . getStatus ( ) ) ; InlineResponse2002Data respData = resp . getData ( ) ; if ( respData == null ) { throw new WorkspaceApiException ( "Response data is empty" ) ; } SubscribeData result = new SubscribeData ( ) ; result . setSubscriptionId ( respData . getSubscriptionId ( ) ) ; result . setStatistics ( respData . getStatistics ( ) ) ; return result ; } catch ( ApiException ex ) { throw new WorkspaceApiException ( "Cannot subscribe" , ex ) ; } |
public class FXBindableASTTransformation { /** * Adds a JavaFX property to the class in place of the original Groovy property . A pair of synthetic
* getter / setter methods is generated to provide pseudo - access to the original property .
* @ param source The SourceUnit in which the annotation was found
* @ param node The node that was annotated
* @ param declaringClass The class in which the annotation was found
* @ param field The field upon which the annotation was placed */
private void addJavaFXProperty ( SourceUnit source , AnnotationNode node , ClassNode declaringClass , FieldNode field ) { } } | String fieldName = field . getName ( ) ; for ( PropertyNode propertyNode : declaringClass . getProperties ( ) ) { if ( propertyNode . getName ( ) . equals ( fieldName ) ) { if ( field . isStatic ( ) ) { String message = "@griffon.transform.FXBindable cannot annotate a static property." ; generateSyntaxErrorMessage ( source , node , message ) ; } else { createPropertyGetterSetter ( declaringClass , propertyNode ) ; } return ; } } String message = "@griffon.transform.FXBindable must be on a property, not a field. Try removing the private, " + "protected, or public modifier." ; generateSyntaxErrorMessage ( source , node , message ) ; |
public class ObjectFactory { /** * Create an instance of { @ link Project . Layouts . Layout . NetworkLines . NetworkActivity } */
public Project . Layouts . Layout . NetworkLines . NetworkActivity createProjectLayoutsLayoutNetworkLinesNetworkActivity ( ) { } } | return new Project . Layouts . Layout . NetworkLines . NetworkActivity ( ) ; |
public class CounterMap { /** * This method will increment counts for a given first / second pair
* @ param first
* @ param second
* @ param inc */
public void incrementCount ( F first , S second , double inc ) { } } | Counter < S > counter = maps . get ( first ) ; if ( counter == null ) { counter = new Counter < S > ( ) ; maps . put ( first , counter ) ; } counter . incrementCount ( second , inc ) ; |
public class StripeReader { /** * Given a block in the file and specific codec , return the LocationPair
* object which contains id of the stripe it belongs to and its
* location in the stripe */
public static LocationPair getBlockLocation ( Codec codec , FileSystem srcFs , Path srcFile , int blockIdxInFile , Configuration conf , List < FileStatus > lfs ) throws IOException { } } | int stripeIdx = 0 ; int blockIdxInStripe = 0 ; int blockIdx = blockIdxInFile ; if ( codec . isDirRaid ) { Path parentPath = srcFile . getParent ( ) ; if ( lfs == null ) { lfs = RaidNode . listDirectoryRaidFileStatus ( conf , srcFs , parentPath ) ; } if ( lfs == null ) { throw new IOException ( "Couldn't list files under " + parentPath ) ; } int blockNum = 0 ; Path qSrcFile = srcFs . makeQualified ( srcFile ) ; for ( FileStatus fsStat : lfs ) { if ( ! fsStat . getPath ( ) . equals ( qSrcFile ) ) { blockNum += RaidNode . getNumBlocks ( fsStat ) ; } else { blockNum += blockIdxInFile ; break ; } } blockIdx = blockNum ; } stripeIdx = blockIdx / codec . stripeLength ; blockIdxInStripe = blockIdx % codec . stripeLength ; return new LocationPair ( stripeIdx , blockIdxInStripe , lfs ) ; |
public class MsgHtmlTagNode { /** * This method calculates a string that can be used to tell if two tags that were turned into
* placeholders are equivalent and thus could be turned into identical placeholders .
* < p > In theory we should use something like { @ link ExprEquivalence } to see if two nodes would
* render the same thing . However , for backwards compatibility we need to use a different
* heuristic . The old code would simply detect if the node had a single child and use the { @ link
* SoyNode # toSourceString ( ) } of it for the tag text . Due to how the children were constructed ,
* this would only happen if the tag was a single { @ link RawTextNode } , e . g . { @ code < foo
* class = bar > } . Now that we are actually parsing the html tags the rules are more complex . We
* should instead only use the { @ link SoyNode # toSourceString ( ) } if the only ( transitive ) children
* are { @ link RawTextNode } , { @ link HtmlAttributeNode } or { @ link HtmlAttributeValueNode } . */
@ Nullable private static String getFullTagText ( HtmlTagNode openTagNode ) { } } | class Visitor implements NodeVisitor < Node , VisitDirective > { boolean isConstantContent = true ; @ Override public VisitDirective exec ( Node node ) { if ( node instanceof RawTextNode || node instanceof HtmlAttributeNode || node instanceof HtmlAttributeValueNode || node instanceof HtmlOpenTagNode || node instanceof HtmlCloseTagNode ) { return VisitDirective . CONTINUE ; } isConstantContent = false ; return VisitDirective . ABORT ; } } Visitor visitor = new Visitor ( ) ; SoyTreeUtils . visitAllNodes ( openTagNode , visitor ) ; if ( visitor . isConstantContent ) { // toSourceString is lame , but how this worked before
return openTagNode . toSourceString ( ) ; } return null ; |
public class RAExpression { /** * ( relational expression ) AS A
* @ param re a { @ link RAExpression }
* @ param alias a { @ link QuotedID }
* @ return a { @ link RAExpression } */
public static RAExpression alias ( RAExpression re , RelationID alias , TermFactory termFactory ) { } } | return new RAExpression ( re . dataAtoms , re . filterAtoms , RAExpressionAttributes . alias ( re . attributes , alias ) , termFactory ) ; |
public class AddCampaigns { /** * Runs the example .
* @ param adWordsServices the services factory .
* @ param session the session .
* @ throws ApiException if the API request failed with one or more service errors .
* @ throws RemoteException if the API request failed due to other errors . */
public static void runExample ( AdWordsServicesInterface adWordsServices , AdWordsSession session ) throws RemoteException { } } | // Get the BudgetService .
BudgetServiceInterface budgetService = adWordsServices . get ( session , BudgetServiceInterface . class ) ; // Create a budget , which can be shared by multiple campaigns .
Budget sharedBudget = new Budget ( ) ; sharedBudget . setName ( "Interplanetary Cruise #" + System . currentTimeMillis ( ) ) ; Money budgetAmount = new Money ( ) ; budgetAmount . setMicroAmount ( 50_000_000L ) ; sharedBudget . setAmount ( budgetAmount ) ; sharedBudget . setDeliveryMethod ( BudgetBudgetDeliveryMethod . STANDARD ) ; BudgetOperation budgetOperation = new BudgetOperation ( ) ; budgetOperation . setOperand ( sharedBudget ) ; budgetOperation . setOperator ( Operator . ADD ) ; // Add the budget
Long budgetId = budgetService . mutate ( new BudgetOperation [ ] { budgetOperation } ) . getValue ( 0 ) . getBudgetId ( ) ; // Get the CampaignService .
CampaignServiceInterface campaignService = adWordsServices . get ( session , CampaignServiceInterface . class ) ; // Create campaign .
Campaign campaign = new Campaign ( ) ; campaign . setName ( "Interplanetary Cruise #" + System . currentTimeMillis ( ) ) ; // Recommendation : Set the campaign to PAUSED when creating it to prevent
// the ads from immediately serving . Set to ENABLED once you ' ve added
// targeting and the ads are ready to serve .
campaign . setStatus ( CampaignStatus . PAUSED ) ; BiddingStrategyConfiguration biddingStrategyConfiguration = new BiddingStrategyConfiguration ( ) ; biddingStrategyConfiguration . setBiddingStrategyType ( BiddingStrategyType . MANUAL_CPC ) ; // You can optionally provide a bidding scheme in place of the type .
ManualCpcBiddingScheme cpcBiddingScheme = new ManualCpcBiddingScheme ( ) ; biddingStrategyConfiguration . setBiddingScheme ( cpcBiddingScheme ) ; campaign . setBiddingStrategyConfiguration ( biddingStrategyConfiguration ) ; // You can optionally provide these field ( s ) .
campaign . setStartDate ( new DateTime ( ) . plusDays ( 1 ) . toString ( "yyyyMMdd" ) ) ; campaign . setEndDate ( new DateTime ( ) . plusDays ( 30 ) . toString ( "yyyyMMdd" ) ) ; campaign . setFrequencyCap ( new FrequencyCap ( 5L , TimeUnit . DAY , Level . ADGROUP ) ) ; // Only the budgetId should be sent , all other fields will be ignored by CampaignService .
Budget budget = new Budget ( ) ; budget . setBudgetId ( budgetId ) ; campaign . setBudget ( budget ) ; campaign . setAdvertisingChannelType ( AdvertisingChannelType . SEARCH ) ; // Set the campaign network options to Search and Search Network .
NetworkSetting networkSetting = new NetworkSetting ( ) ; networkSetting . setTargetGoogleSearch ( true ) ; networkSetting . setTargetSearchNetwork ( true ) ; networkSetting . setTargetContentNetwork ( false ) ; networkSetting . setTargetPartnerSearchNetwork ( false ) ; campaign . setNetworkSetting ( networkSetting ) ; // Set options that are not required .
GeoTargetTypeSetting geoTarget = new GeoTargetTypeSetting ( ) ; geoTarget . setPositiveGeoTargetType ( GeoTargetTypeSettingPositiveGeoTargetType . DONT_CARE ) ; campaign . setSettings ( new Setting [ ] { geoTarget } ) ; // You can create multiple campaigns in a single request .
Campaign campaign2 = new Campaign ( ) ; campaign2 . setName ( "Interplanetary Cruise banner #" + System . currentTimeMillis ( ) ) ; campaign2 . setStatus ( CampaignStatus . PAUSED ) ; BiddingStrategyConfiguration biddingStrategyConfiguration2 = new BiddingStrategyConfiguration ( ) ; biddingStrategyConfiguration2 . setBiddingStrategyType ( BiddingStrategyType . MANUAL_CPC ) ; campaign2 . setBiddingStrategyConfiguration ( biddingStrategyConfiguration2 ) ; Budget budget2 = new Budget ( ) ; budget2 . setBudgetId ( budgetId ) ; campaign2 . setBudget ( budget2 ) ; campaign2 . setAdvertisingChannelType ( AdvertisingChannelType . DISPLAY ) ; // Create operations .
CampaignOperation operation = new CampaignOperation ( ) ; operation . setOperand ( campaign ) ; operation . setOperator ( Operator . ADD ) ; CampaignOperation operation2 = new CampaignOperation ( ) ; operation2 . setOperand ( campaign2 ) ; operation2 . setOperator ( Operator . ADD ) ; CampaignOperation [ ] operations = new CampaignOperation [ ] { operation , operation2 } ; // Add campaigns .
CampaignReturnValue result = campaignService . mutate ( operations ) ; // Display campaigns .
for ( Campaign campaignResult : result . getValue ( ) ) { System . out . printf ( "Campaign with name '%s' and ID %d was added.%n" , campaignResult . getName ( ) , campaignResult . getId ( ) ) ; } |
public class Task { /** * Reports the next executing record range to TaskTracker .
* @ param umbilical
* @ param nextRecIndex the record index which would be fed next .
* @ throws IOException */
protected void reportNextRecordRange ( final TaskUmbilicalProtocol umbilical , long nextRecIndex ) throws IOException { } } | // currentRecStartIndex is the start index which has not yet been finished
// and is still in task ' s stomach .
long len = nextRecIndex - currentRecStartIndex + 1 ; SortedRanges . Range range = new SortedRanges . Range ( currentRecStartIndex , len ) ; taskStatus . setNextRecordRange ( range ) ; LOG . debug ( "sending reportNextRecordRange " + range ) ; umbilical . reportNextRecordRange ( taskId , range ) ; |
public class DropMenuRenderer { /** * Renders the Drop Menu .
* @ param c
* @ param rw
* @ param l
* @ throws IOException */
public static void encodeDropMenuStart ( DropMenu c , ResponseWriter rw , String l ) throws IOException { } } | rw . startElement ( "ul" , c ) ; if ( c . getContentClass ( ) != null ) rw . writeAttribute ( "class" , "dropdown-menu " + c . getContentClass ( ) , "class" ) ; else rw . writeAttribute ( "class" , "dropdown-menu" , "class" ) ; if ( null != c . getContentStyle ( ) ) rw . writeAttribute ( "style" , c . getContentStyle ( ) , "style" ) ; rw . writeAttribute ( "role" , "menu" , null ) ; rw . writeAttribute ( "aria-labelledby" , l , null ) ; |
public class MPXWriter { /** * This method returns the string representation of an object . In most
* cases this will simply involve calling the normal toString method
* on the object , but a couple of exceptions are handled here .
* @ param o the object to formatted
* @ return formatted string representing input Object */
private String format ( Object o ) { } } | String result ; if ( o == null ) { result = "" ; } else { if ( o instanceof Boolean == true ) { result = LocaleData . getString ( m_locale , ( ( ( Boolean ) o ) . booleanValue ( ) == true ? LocaleData . YES : LocaleData . NO ) ) ; } else { if ( o instanceof Float == true || o instanceof Double == true ) { result = ( m_formats . getDecimalFormat ( ) . format ( ( ( Number ) o ) . doubleValue ( ) ) ) ; } else { if ( o instanceof Day ) { result = Integer . toString ( ( ( Day ) o ) . getValue ( ) ) ; } else { result = o . toString ( ) ; } } } // At this point there should be no line break characters in
// the file . If we find any , replace them with spaces
result = stripLineBreaks ( result , MPXConstants . EOL_PLACEHOLDER_STRING ) ; // Finally we check to ensure that there are no embedded
// quotes or separator characters in the value . If there are , then
// we quote the value and escape any existing quote characters .
if ( result . indexOf ( '"' ) != - 1 ) { result = escapeQuotes ( result ) ; } else { if ( result . indexOf ( m_delimiter ) != - 1 ) { result = '"' + result + '"' ; } } } return ( result ) ; |
public class JsonParser { /** * 将JSONPath的路径简单地转换为JsonParser支持的key
* @ param path 路径
* @ return key */
private String pathToKey ( String path ) { } } | if ( path . startsWith ( ValueConsts . DOLLAR_SIGN ) ) { path = path . substring ( 1 ) ; } if ( ! path . startsWith ( ValueConsts . DOT_SIGN ) ) { path = ValueConsts . DOT_SIGN + path ; } if ( ! path . endsWith ( ValueConsts . DOT_SIGN ) ) { path += ValueConsts . DOT_SIGN ; } return path ; |
public class ConcurrentLinkedList { /** * ( non - Javadoc )
* @ see ws . sib . objectManager . List # iterator ( ) */
public Iterator iterator ( ) throws ObjectManagerException { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "iterator" ) ; Iterator iterator = subList ( null , null ) . iterator ( ) ; if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "iterator" , new Object [ ] { iterator } ) ; return iterator ; |
public class Solve { /** * Computes the pseudo - inverse .
* Note , this function uses the solveLeastSquares and might produce different numerical
* solutions for the underdetermined case than matlab .
* @ param A rectangular matrix
* @ return matrix P such that A * P * A = A and P * A * P = P . */
public static FloatMatrix pinv ( FloatMatrix A ) { } } | return solveLeastSquares ( A , FloatMatrix . eye ( A . rows ) ) ; |
public class GaiException { /** * Converts the stashed function name and error value to a human - readable string .
* We do this here rather than in the constructor so that callers only pay for
* this if they need it . */
@ Override public String getMessage ( ) { } } | String gaiName = OsConstants . gaiName ( error ) ; if ( gaiName == null ) { gaiName = "GAI_ error " + error ; } String description = NetworkOs . gai_strerror ( error ) ; return functionName + " failed: " + gaiName + " (" + description + ")" ; |
public class WorkflowServiceImpl { /** * Search for workflows based on payload and given parameters . Use sort options as sort ASCor DESC
* e . g . sort = name or sort = workflowId : DESC . If order is not specified , defaults to ASC .
* @ param start Start index of pagination
* @ param size Number of entries
* @ param sort Sorting type ASC | DESC
* @ param freeText Text you want to search
* @ param query Query you want to search
* @ return instance of { @ link SearchResult } */
@ Service public SearchResult < WorkflowSummary > searchWorkflows ( int start , int size , String sort , String freeText , String query ) { } } | return executionService . search ( query , freeText , start , size , ServiceUtils . convertStringToList ( sort ) ) ; |
public class CharacterSprite { /** * Updates the sprite animation frame to reflect the cessation of movement and disables any
* further animation . */
protected void halt ( ) { } } | // only do something if we ' re actually animating
if ( _animMode != NO_ANIMATION ) { // disable animation
setAnimationMode ( NO_ANIMATION ) ; // come to a halt looking settled and at peace
String rest = getRestingAction ( ) ; if ( rest != null ) { setActionSequence ( rest ) ; } } |
public class StylesheetRoot { /** * Get information about whether or not an element should strip whitespace .
* @ see < a href = " http : / / www . w3 . org / TR / xslt # strip " > strip in XSLT Specification < / a >
* @ param support The XPath runtime state .
* @ param targetElement Element to check
* @ return WhiteSpaceInfo for the given element
* @ throws TransformerException */
public WhiteSpaceInfo getWhiteSpaceInfo ( XPathContext support , int targetElement , DTM dtm ) throws TransformerException { } } | if ( null != m_whiteSpaceInfoList ) return ( WhiteSpaceInfo ) m_whiteSpaceInfoList . getTemplate ( support , targetElement , null , false , dtm ) ; else return null ; |
public class IndexingStrategy { /** * Combines the results .
* @ param singleEntityChanges { @ link Impact } s for changes made to specific Entity instances
* @ param wholeRepoActions { @ link Impact } s for changes made to entire repositories
* @ param dependentEntityIds { @ link Impact } s for entitytypes that are dependent on one or more of
* the changes
* @ return Set with the { @ link Impact } s */
private Set < Impact > collectResult ( List < Impact > singleEntityChanges , List < Impact > wholeRepoActions , Set < String > dependentEntityIds ) { } } | Set < String > wholeRepoIds = union ( wholeRepoActions . stream ( ) . map ( Impact :: getEntityTypeId ) . collect ( toImmutableSet ( ) ) , dependentEntityIds ) ; ImmutableSet . Builder < Impact > result = ImmutableSet . builder ( ) ; result . addAll ( wholeRepoActions ) ; dependentEntityIds . stream ( ) . map ( Impact :: createWholeRepositoryImpact ) . forEach ( result :: add ) ; singleEntityChanges . stream ( ) . filter ( action -> ! wholeRepoIds . contains ( action . getEntityTypeId ( ) ) ) . forEach ( result :: add ) ; return result . build ( ) ; |
public class Zxid { /** * Serialize this Zxid into a fixed size ( 8 bytes ) byte array .
* The resulting byte array can be deserialized with fromByteArray .
* @ return an array of bytes .
* @ throws IOException in case of an IO failure */
public byte [ ] toByteArray ( ) throws IOException { } } | ByteArrayOutputStream bout = new ByteArrayOutputStream ( ) ; DataOutputStream out = new DataOutputStream ( new BufferedOutputStream ( bout ) ) ; out . writeLong ( this . epoch ) ; out . writeLong ( this . xid ) ; out . flush ( ) ; return bout . toByteArray ( ) ; |
public class ScopeHandler { /** * Returns whether { @ code type } is visible in , or can be imported into , a compilation unit in
* { @ code pkg } . */
ScopeState visibilityIn ( String pkg , QualifiedName type ) { } } | if ( pkg == null ) { return visibilityIn ( UNIVERSALLY_VISIBLE_PACKAGE , type ) ; } else if ( isTopLevelType ( pkg , type . getSimpleName ( ) ) ) { if ( type . isTopLevel ( ) && type . getPackage ( ) . equals ( pkg ) ) { return ScopeState . IN_SCOPE ; } else { return ScopeState . HIDDEN ; } } else if ( ! pkg . equals ( UNIVERSALLY_VISIBLE_PACKAGE ) ) { return visibilityIn ( UNIVERSALLY_VISIBLE_PACKAGE , type ) ; } else { return ScopeState . IMPORTABLE ; } |
public class DogmaApi { /** * Get effect information Get information on a dogma effect - - - This route
* expires daily at 11:05
* @ param effectId
* A dogma effect ID ( required )
* @ param datasource
* The server name you would like data from ( optional , default to
* tranquility )
* @ param ifNoneMatch
* ETag from a previous request . A 304 will be returned if this
* matches the current ETag ( optional )
* @ return ApiResponse & lt ; DogmaEffectResponse & gt ;
* @ throws ApiException
* If fail to call the API , e . g . server error or cannot
* deserialize the response body */
public ApiResponse < DogmaEffectResponse > getDogmaEffectsEffectIdWithHttpInfo ( Integer effectId , String datasource , String ifNoneMatch ) throws ApiException { } } | com . squareup . okhttp . Call call = getDogmaEffectsEffectIdValidateBeforeCall ( effectId , datasource , ifNoneMatch , null ) ; Type localVarReturnType = new TypeToken < DogmaEffectResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ; |
public class CmsSetupStep05ServerSettings { /** * Proceed to next step . */
private void forward ( ) { } } | try { String macAddress = m_macAddress . getValue ( ) ; String serverId = m_serverId . getValue ( ) ; String serverUrl = m_serverUrl . getValue ( ) ; CmsSetupBean setupBean = m_context . getSetupBean ( ) ; setupBean . setEthernetAddress ( macAddress ) ; setupBean . setServerName ( serverId ) ; setupBean . setWorkplaceSite ( serverUrl ) ; setupBean . prepareStep8 ( ) ; m_context . stepForward ( ) ; } catch ( Exception e ) { CmsSetupErrorDialog . showErrorDialog ( e ) ; } |
public class FileExecutor { /** * 重命名文件 , 自动创建不存在的文件夹
* @ param sourceFile 源文件
* @ param destFile 目的文件 */
public static void renameTo ( String sourceFile , String destFile ) { } } | renameTo ( new File ( sourceFile ) , new File ( destFile ) ) ; |
public class ByteBuddy { /** * Creates a new configuration where any { @ link MethodDescription } that matches the provided method matcher is excluded
* from instrumentation . Any previous matcher for ignored methods is replaced . By default , Byte Buddy ignores any
* synthetic method ( bridge methods are handled automatically ) and the { @ link Object # finalize ( ) } method .
* @ param ignoredMethods A matcher for identifying methods to be excluded from instrumentation .
* @ return A new Byte Buddy instance that excludes any method from instrumentation if it is matched by the supplied matcher . */
public ByteBuddy ignore ( ElementMatcher < ? super MethodDescription > ignoredMethods ) { } } | return ignore ( new LatentMatcher . Resolved < MethodDescription > ( ignoredMethods ) ) ; |
public class ContextFromVertx { /** * Like { @ link # parameter ( String ) } , but returns given defaultValue
* instead of null in case parameter cannot be found .
* The parameter is decoded by default .
* @ param name The name of the parameter
* @ param defaultValue A default value if parameter not found .
* @ return The value of the parameter of the defaultValue if not found . */
@ Override public String parameter ( String name , String defaultValue ) { } } | return request . parameter ( name , defaultValue ) ; |
public class AWSCognitoIdentityProviderClient { /** * Lists information about all identity providers for a user pool .
* @ param listIdentityProvidersRequest
* @ return Result of the ListIdentityProviders operation returned by the service .
* @ throws InvalidParameterException
* This exception is thrown when the Amazon Cognito service encounters an invalid parameter .
* @ throws ResourceNotFoundException
* This exception is thrown when the Amazon Cognito service cannot find the requested resource .
* @ throws NotAuthorizedException
* This exception is thrown when a user is not authorized .
* @ throws TooManyRequestsException
* This exception is thrown when the user has made too many requests for a given operation .
* @ throws InternalErrorException
* This exception is thrown when Amazon Cognito encounters an internal error .
* @ sample AWSCognitoIdentityProvider . ListIdentityProviders
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / cognito - idp - 2016-04-18 / ListIdentityProviders "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListIdentityProvidersResult listIdentityProviders ( ListIdentityProvidersRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListIdentityProviders ( request ) ; |
public class DMatrixRMaj { /** * todo move to commonops */
public void add ( int row , int col , double value ) { } } | if ( col < 0 || col >= numCols || row < 0 || row >= numRows ) { throw new IllegalArgumentException ( "Specified element is out of bounds" ) ; } data [ row * numCols + col ] += value ; |
public class TopologyContextImpl { /** * Task hook called in bolt every time a tuple gets acked */
public void invokeHookBoltAck ( Tuple tuple , Duration processLatency ) { } } | if ( taskHooks . size ( ) != 0 ) { BoltAckInfo ackInfo = new BoltAckInfo ( tuple , getThisTaskId ( ) , processLatency ) ; for ( ITaskHook taskHook : taskHooks ) { taskHook . boltAck ( ackInfo ) ; } } |
public class PageInBrowserStats { /** * Returns the average web page load time for given interval and { @ link TimeUnit } .
* @ param intervalName name of the interval
* @ param unit { @ link TimeUnit }
* @ return average web page load time */
public double getAverageWindowLoadTime ( final String intervalName , final TimeUnit unit ) { } } | return unit . transformMillis ( totalWindowLoadTime . getValueAsLong ( intervalName ) ) / numberOfLoads . getValueAsDouble ( intervalName ) ; |
public class DBaseFileReader { /** * Move the reading head at the specified record index .
* < p > If the index is negative , the next record to read is assumed to be
* the first record .
* If the index is greater or equals to the count of records , the exception
* { @ link EOFException } will be thrown .
* @ param recordIndex is the index of record to reply at the next read .
* @ throws IOException in case of error . */
public void seek ( int recordIndex ) throws IOException { } } | if ( ! this . stream . markSupported ( ) ) { throw new UnsupportedSeekOperationException ( ) ; } if ( this . recordCount == - 1 ) { throw new MustCallReadHeaderFunctionException ( ) ; } int ri = recordIndex ; if ( ri < 0 ) { ri = 0 ; } if ( ri >= this . recordCount ) { throw new EOFException ( ) ; } this . readingPosition = ri ; // Goto the first record
this . stream . reset ( ) ; // Skip until the next record to read
if ( ri > 0 ) { // use skipBytes because it force to skip the specified amount , instead of skip ( )
this . stream . skipBytes ( this . recordSize * ri ) ; } |
public class StreamUtil { /** * the real work - horse behind most of these methods
* @ param source the source InputStream from which to read the data ( not closed when done )
* @ param target the target OutputStream to which to write the data ( not closed when done )
* @ param bufferSize the size of the transfer buffer to use
* @ param readToEOF if we should read to end - of - file of the source ( true ) or just 1 buffer ' s worth ( false )
* @ throws IOException */
public static long copyContentIntoOutputStream ( InputStream source , OutputStream target , int bufferSize , boolean readToEOF ) throws IOException { } } | byte [ ] tempBuf = new byte [ Math . max ( ONE_KB , bufferSize ) ] ; // at least a 1k buffer
long bytesWritten = 0 ; while ( true ) { int bytesRead = source . read ( tempBuf ) ; if ( bytesRead < 0 ) { break ; } target . write ( tempBuf , 0 , bytesRead ) ; bytesWritten += bytesRead ; if ( ! readToEOF ) { // prevents us from reading more than 1 buffer worth
break ; } } return bytesWritten ; |
public class KeyGroupPartitioner { /** * This method creates a histogram from the counts per key - group in { @ link # counterHistogram } . */
private int buildHistogramByAccumulatingCounts ( ) { } } | int sum = 0 ; for ( int i = 0 ; i < counterHistogram . length ; ++ i ) { int currentSlotValue = counterHistogram [ i ] ; counterHistogram [ i ] = sum ; sum += currentSlotValue ; } return sum ; |
public class APIKeysInner { /** * Get the API Key for this key id .
* @ param resourceGroupName The name of the resource group .
* @ param resourceName The name of the Application Insights component resource .
* @ param keyId The API Key ID . This is unique within a Application Insights component .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the ApplicationInsightsComponentAPIKeyInner object if successful . */
public ApplicationInsightsComponentAPIKeyInner get ( String resourceGroupName , String resourceName , String keyId ) { } } | return getWithServiceResponseAsync ( resourceGroupName , resourceName , keyId ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Util { /** * Reads a byte array prefixed by its length encoded using vByte .
* @ param s the stream from which the array should be read .
* @ return the array . */
public final static byte [ ] readByteArray ( final ObjectInputStream s ) throws IOException { } } | final byte [ ] a = new byte [ readVByte ( s ) ] ; s . readFully ( a ) ; return a ; |
public class SnifferSocketImplFactory { /** * Restores previously saved { @ link SocketImplFactory } and sets it as a default
* @ see # install ( )
* @ throws IOException if failed to install { @ link SnifferSocketImplFactory }
* @ since 3.1 */
public static void uninstall ( ) throws IOException { } } | try { Field factoryField = Socket . class . getDeclaredField ( "factory" ) ; factoryField . setAccessible ( true ) ; factoryField . set ( null , previousSocketImplFactory ) ; } catch ( IllegalAccessException e ) { throw new IOException ( "Failed to initialize SnifferSocketImplFactory" , e ) ; } catch ( NoSuchFieldException e ) { throw new IOException ( "Failed to initialize SnifferSocketImplFactory" , e ) ; } |
public class AddScopedDependenciesTask { /** * ( non - Javadoc )
* @ see
* org . jboss . shrinkwrap . resolver . impl . maven . task . MavenWorkingSessionTask # execute ( org . jboss . shrinkwrap . resolver . impl . maven
* . MavenWorkingSession ) */
@ Override public MavenWorkingSession execute ( MavenWorkingSession session ) { } } | // Get all declared dependencies
final List < MavenDependency > dependencies = new ArrayList < MavenDependency > ( session . getDeclaredDependencies ( ) ) ; // Filter by scope
final MavenResolutionFilter preResolutionFilter = new ScopeFilter ( scopes ) ; // For all declared dependencies which pass the filter , add ' em to the Set of dependencies to be resolved for
// this request
for ( final MavenDependency candidate : dependencies ) { if ( preResolutionFilter . accepts ( candidate , EMPTY_LIST , EMPTY_LIST ) ) { session . getDependenciesForResolution ( ) . add ( candidate ) ; } } return session ; |
public class AddBookmark { /** * Get query parameters
* @ return Values of query parameters ( name of parameter : value of the parameter ) */
@ Override public Map < String , Object > getQueryParameters ( ) { } } | HashMap < String , Object > params = new HashMap < String , Object > ( ) ; return params ; |
public class Bits { /** * Test Bits . nextBit ( int ) . */
public static void main ( String [ ] args ) { } } | java . util . Random r = new java . util . Random ( ) ; Bits bits = new Bits ( ) ; for ( int i = 0 ; i < 125 ; i ++ ) { int k ; do { k = r . nextInt ( 250 ) ; } while ( bits . isMember ( k ) ) ; System . out . println ( "adding " + k ) ; bits . incl ( k ) ; } int count = 0 ; for ( int i = bits . nextBit ( 0 ) ; i >= 0 ; i = bits . nextBit ( i + 1 ) ) { System . out . println ( "found " + i ) ; count ++ ; } if ( count != 125 ) { throw new Error ( ) ; } |
public class WorkflowExecutionTimedOutEventAttributesMarshaller { /** * Marshall the given parameter object . */
public void marshall ( WorkflowExecutionTimedOutEventAttributes workflowExecutionTimedOutEventAttributes , ProtocolMarshaller protocolMarshaller ) { } } | if ( workflowExecutionTimedOutEventAttributes == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( workflowExecutionTimedOutEventAttributes . getTimeoutType ( ) , TIMEOUTTYPE_BINDING ) ; protocolMarshaller . marshall ( workflowExecutionTimedOutEventAttributes . getChildPolicy ( ) , CHILDPOLICY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CmsXMLSearchConfigurationParser { /** * Returns the configured page size , or the default page size if it is not configured .
* @ return The configured page size , or the default page size if it is not configured . */
private List < Integer > getPageSizes ( ) { } } | final String pageSizes = parseOptionalStringValue ( XML_ELEMENT_PAGESIZE ) ; if ( pageSizes != null ) { String [ ] pageSizesArray = pageSizes . split ( "-" ) ; if ( pageSizesArray . length > 0 ) { try { List < Integer > result = new ArrayList < > ( pageSizesArray . length ) ; for ( int i = 0 ; i < pageSizesArray . length ; i ++ ) { result . add ( Integer . valueOf ( pageSizesArray [ i ] ) ) ; } return result ; } catch ( NumberFormatException e ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_PARSING_PAGE_SIZES_FAILED_1 , pageSizes ) , e ) ; } } } return null ; |
public class CollationFastLatin { /** * Computes the options value for the compare functions
* and writes the precomputed primary weights .
* Returns - 1 if the Latin fastpath is not supported for the data and settings .
* The capacity must be LATIN _ LIMIT . */
public static int getOptions ( CollationData data , CollationSettings settings , char [ ] primaries ) { } } | char [ ] header = data . fastLatinTableHeader ; if ( header == null ) { return - 1 ; } assert ( ( header [ 0 ] >> 8 ) == VERSION ) ; if ( primaries . length != LATIN_LIMIT ) { assert false ; return - 1 ; } int miniVarTop ; if ( ( settings . options & CollationSettings . ALTERNATE_MASK ) == 0 ) { // No mini primaries are variable , set a variableTop just below the
// lowest long mini primary .
miniVarTop = MIN_LONG - 1 ; } else { int headerLength = header [ 0 ] & 0xff ; int i = 1 + settings . getMaxVariable ( ) ; if ( i >= headerLength ) { return - 1 ; // variableTop > = digits , should not occur
} miniVarTop = header [ i ] ; } boolean digitsAreReordered = false ; if ( settings . hasReordering ( ) ) { long prevStart = 0 ; long beforeDigitStart = 0 ; long digitStart = 0 ; long afterDigitStart = 0 ; for ( int group = Collator . ReorderCodes . FIRST ; group < Collator . ReorderCodes . FIRST + CollationData . MAX_NUM_SPECIAL_REORDER_CODES ; ++ group ) { long start = data . getFirstPrimaryForGroup ( group ) ; start = settings . reorder ( start ) ; if ( group == Collator . ReorderCodes . DIGIT ) { beforeDigitStart = prevStart ; digitStart = start ; } else if ( start != 0 ) { if ( start < prevStart ) { // The permutation affects the groups up to Latin .
return - 1 ; } // In the future , there might be a special group between digits & Latin .
if ( digitStart != 0 && afterDigitStart == 0 && prevStart == beforeDigitStart ) { afterDigitStart = start ; } prevStart = start ; } } long latinStart = data . getFirstPrimaryForGroup ( UScript . LATIN ) ; latinStart = settings . reorder ( latinStart ) ; if ( latinStart < prevStart ) { return - 1 ; } if ( afterDigitStart == 0 ) { afterDigitStart = latinStart ; } if ( ! ( beforeDigitStart < digitStart && digitStart < afterDigitStart ) ) { digitsAreReordered = true ; } } char [ ] table = data . fastLatinTable ; // skip the header
for ( int c = 0 ; c < LATIN_LIMIT ; ++ c ) { int p = table [ c ] ; if ( p >= MIN_SHORT ) { p &= SHORT_PRIMARY_MASK ; } else if ( p > miniVarTop ) { p &= LONG_PRIMARY_MASK ; } else { p = 0 ; } primaries [ c ] = ( char ) p ; } if ( digitsAreReordered || ( settings . options & CollationSettings . NUMERIC ) != 0 ) { // Bail out for digits .
for ( int c = 0x30 ; c <= 0x39 ; ++ c ) { primaries [ c ] = 0 ; } } // Shift the miniVarTop above other options .
return ( miniVarTop << 16 ) | settings . options ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.