signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class Row { /** * View row as a simple map . */ public Map < String , Object > asMap ( ) { } }
Map < String , Object > map = new HashMap < > ( ) ; Set < String > keys = columnNameToIdxMap . keySet ( ) ; Iterator < String > iterator = keys . iterator ( ) ; while ( iterator . hasNext ( ) ) { String colum = iterator . next ( ) . toString ( ) ; int index = columnNameToIdxMap . get ( colum ) ; map . put ( colum , values [ index ] ) ; } return map ;
public class ScreenSizeExtensions { /** * Toggle full screen . * @ param frame * the frame */ public static void toggleFullScreen ( @ NonNull JFrame frame ) { } }
GraphicsDevice device = frame . getGraphicsConfiguration ( ) . getDevice ( ) ; frame . setExtendedState ( JFrame . MAXIMIZED_BOTH ) ; if ( frame . equals ( device . getFullScreenWindow ( ) ) ) { device . setFullScreenWindow ( null ) ; } else { frame . setVisible ( true ) ; device . setFullScreenWindow ( frame ) ; }
public class nsip6 { /** * Use this API to unset the properties of nsip6 resource . * Properties that need to be unset are specified in args array . */ public static base_response unset ( nitro_service client , nsip6 resource , String [ ] args ) throws Exception { } }
nsip6 unsetresource = new nsip6 ( ) ; unsetresource . ipv6address = resource . ipv6address ; unsetresource . td = resource . td ; return unsetresource . unset_resource ( client , args ) ;
public class Condition { /** * < p > Sample : < code > $ ( " h1 " ) . shouldHave ( exactText ( " Hello " ) ) < / code > < / p > * < p > Case insensitive < / p > * < p > NB ! Ignores multiple whitespaces between words < / p > * @ param text expected text of HTML element */ public static Condition exactText ( final String text ) { } }
return new Condition ( "exact text" ) { @ Override public boolean apply ( Driver driver , WebElement element ) { return Html . text . equals ( element . getText ( ) , text ) ; } @ Override public String toString ( ) { return name + " '" + text + '\'' ; } } ;
public class ApiOvhIpLoadbalancing { /** * Delete this description of a private network in the vRack . It must not be used by any farm server * REST : DELETE / ipLoadbalancing / { serviceName } / vrack / network / { vrackNetworkId } * @ param serviceName [ required ] The internal name of your IP load balancing * @ param vrackNetworkId [ required ] Internal Load Balancer identifier of the vRack private network description * API beta */ public void serviceName_vrack_network_vrackNetworkId_DELETE ( String serviceName , Long vrackNetworkId ) throws IOException { } }
String qPath = "/ipLoadbalancing/{serviceName}/vrack/network/{vrackNetworkId}" ; StringBuilder sb = path ( qPath , serviceName , vrackNetworkId ) ; exec ( qPath , "DELETE" , sb . toString ( ) , null ) ;
public class Main { /** * Main program of the batch compiler . * @ param args the command line arguments . */ public static void main ( String [ ] args ) { } }
final int retCode = createMainObject ( ) . runCompiler ( args ) ; System . exit ( retCode ) ;
public class ExecuteMethodValidatorChecker { protected void doCheckGenericBeanValidationMismatch ( Field field ) { } }
// # hope cannot check now : public List < ROOM > roomList ; final Class < ? > genericType = getFieldGenericType ( field ) ; // only first generic # for _ now if ( genericType == null ) { return ; } if ( mayBeNestedBeanType ( genericType ) ) { // e . g . LandBean < PiariBean > pathDeque . push ( "@generic" ) ; doCheckNestedValidationMismatch ( field , genericType ) ; pathDeque . pop ( ) ; } else if ( Collection . class . isAssignableFrom ( genericType ) ) { final Type fieldGenericType = field . getGenericType ( ) ; if ( fieldGenericType != null && fieldGenericType instanceof ParameterizedType ) { final Type [ ] typeArguments = ( ( ParameterizedType ) fieldGenericType ) . getActualTypeArguments ( ) ; if ( typeArguments != null && typeArguments . length > 0 ) { final Class < ? > elementType = DfReflectionUtil . getGenericFirstClass ( typeArguments [ 0 ] ) ; if ( elementType != null && mayBeNestedBeanType ( elementType ) ) { // e . g . public LandBean < List < PiariBean > > landBean ; pathDeque . push ( "@generic" ) ; doCheckNestedValidationMismatch ( field , elementType ) ; pathDeque . pop ( ) ; } } } }
public class ContainerMetadataUpdateTransaction { /** * Pre - processes the given Operation . See OperationMetadataUpdater . preProcessOperation for more details on behavior . * @ param operation The operation to pre - process . * @ throws ContainerException If the given operation was rejected given the current state of the container metadata . * @ throws StreamSegmentException If the given operation was incompatible with the current state of the Segment . * For example : StreamSegmentNotExistsException , StreamSegmentSealedException or * StreamSegmentMergedException . */ void preProcessOperation ( Operation operation ) throws ContainerException , StreamSegmentException { } }
checkNotSealed ( ) ; if ( operation instanceof SegmentOperation ) { val segmentMetadata = getSegmentUpdateTransaction ( ( ( SegmentOperation ) operation ) . getStreamSegmentId ( ) ) ; if ( segmentMetadata . isDeleted ( ) ) { throw new StreamSegmentNotExistsException ( segmentMetadata . getName ( ) ) ; } if ( operation instanceof StreamSegmentAppendOperation ) { segmentMetadata . preProcessOperation ( ( StreamSegmentAppendOperation ) operation ) ; } else if ( operation instanceof StreamSegmentSealOperation ) { segmentMetadata . preProcessOperation ( ( StreamSegmentSealOperation ) operation ) ; } else if ( operation instanceof MergeSegmentOperation ) { MergeSegmentOperation mbe = ( MergeSegmentOperation ) operation ; SegmentMetadataUpdateTransaction sourceMetadata = getSegmentUpdateTransaction ( mbe . getSourceSegmentId ( ) ) ; sourceMetadata . preProcessAsSourceSegment ( mbe ) ; segmentMetadata . preProcessAsTargetSegment ( mbe , sourceMetadata ) ; } else if ( operation instanceof UpdateAttributesOperation ) { segmentMetadata . preProcessOperation ( ( UpdateAttributesOperation ) operation ) ; } else if ( operation instanceof StreamSegmentTruncateOperation ) { segmentMetadata . preProcessOperation ( ( StreamSegmentTruncateOperation ) operation ) ; } else if ( operation instanceof DeleteSegmentOperation ) { segmentMetadata . preProcessOperation ( ( DeleteSegmentOperation ) operation ) ; } } if ( operation instanceof MetadataCheckpointOperation ) { // MetadataCheckpointOperations do not require preProcess and accept ; they can be handled in a single stage . processMetadataOperation ( ( MetadataCheckpointOperation ) operation ) ; } else if ( operation instanceof StorageMetadataCheckpointOperation ) { // StorageMetadataCheckpointOperation do not require preProcess and accept ; they can be handled in a single stage . processMetadataOperation ( ( StorageMetadataCheckpointOperation ) operation ) ; } else if ( operation instanceof StreamSegmentMapOperation ) { preProcessMetadataOperation ( ( StreamSegmentMapOperation ) operation ) ; }
public class Task { /** * Invokes the callable using the given executor , returning a Task to represent the operation . */ public static < TResult > Task < TResult > call ( final Callable < TResult > callable , Executor executor , final CancellationToken ct ) { } }
final bolts . TaskCompletionSource < TResult > tcs = new bolts . TaskCompletionSource < > ( ) ; try { executor . execute ( new Runnable ( ) { @ Override public void run ( ) { if ( ct != null && ct . isCancellationRequested ( ) ) { tcs . setCancelled ( ) ; return ; } try { tcs . setResult ( callable . call ( ) ) ; } catch ( CancellationException e ) { tcs . setCancelled ( ) ; } catch ( Exception e ) { tcs . setError ( e ) ; } } } ) ; } catch ( Exception e ) { tcs . setError ( new ExecutorException ( e ) ) ; } return tcs . getTask ( ) ;
public class UTF8Checker { /** * Check if the given ByteBuffer contains non UTF - 8 data . * @ param buf the ByteBuffer to check * @ param position the index in the { @ link ByteBuffer } to start from * @ param length the number of bytes to operate on * @ throws UnsupportedEncodingException is thrown if non UTF - 8 data is found */ private void checkUTF8 ( ByteBuffer buf , int position , int length ) throws UnsupportedEncodingException { } }
int limit = position + length ; for ( int i = position ; i < limit ; i ++ ) { checkUTF8 ( buf . get ( i ) ) ; }
public class CATBrowseConsumer { /** * Sends a message to the client in chunks . This is easier on the Java memory manager as it means * it can avoid allocating very large chunks of memory in one contiguous block . This may result * in multiple JFap sends for each message chunk . * @ param sibMessage * @ return Returns the amount of data sent across to the peer . * @ throws OperationFailedException */ private long sendChunkedMessage ( SIBusMessage sibMessage ) throws OperationFailedException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "sendChunkedMessage" , sibMessage ) ; long retValue = 0 ; // First of all we must encode the message ourselves CommsServerByteBuffer buffer = poolManager . allocate ( ) ; ConversationState convState = ( ConversationState ) getConversation ( ) . getAttachment ( ) ; try { List < DataSlice > messageSlices = buffer . encodeFast ( ( JsMessage ) sibMessage , convState . getCommsConnection ( ) , getConversation ( ) ) ; int msgLen = 0 ; // Do a check on the size of the message . If it is less than our threshold , forget the // chunking and simply send the message as one for ( DataSlice slice : messageSlices ) msgLen += slice . getLength ( ) ; if ( msgLen < CommsConstants . MINIMUM_MESSAGE_SIZE_FOR_CHUNKING ) { // The message is a tiddler , send it in one if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Message is smaller than " + CommsConstants . MINIMUM_MESSAGE_SIZE_FOR_CHUNKING ) ; retValue = sendEntireMessage ( sibMessage , messageSlices ) ; } else { short jfapPriority = JFapChannelConstants . getJFAPPriority ( sibMessage . getPriority ( ) ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Sending with JFAP priority of " + jfapPriority ) ; // Now we have the slices , send each one in turn . Each slice contains all the header // information so that the client code knows what to do with the message try { for ( int x = 0 ; x < messageSlices . size ( ) ; x ++ ) { DataSlice slice = messageSlices . get ( x ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Sending slice:" , slice ) ; boolean first = ( x == 0 ) ; boolean last = ( x == ( messageSlices . size ( ) - 1 ) ) ; byte flags = 0 ; // Work out the flags to send if ( first ) flags |= CommsConstants . CHUNKED_MESSAGE_FIRST ; if ( last ) flags |= CommsConstants . CHUNKED_MESSAGE_LAST ; else if ( ! first ) flags |= CommsConstants . CHUNKED_MESSAGE_MIDDLE ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( this , tc , "Flags: " + flags ) ; if ( ! first ) { // This isn ' t the first slice , grab a fresh buffer buffer = poolManager . allocate ( ) ; } // Now add all the header information buffer . putShort ( convState . getConnectionObjectId ( ) ) ; buffer . putShort ( mainConsumer . getClientSessionId ( ) ) ; buffer . putShort ( msgBatch ) ; // BIT16 Message batch buffer . put ( flags ) ; buffer . putDataSlice ( slice ) ; retValue = getConversation ( ) . send ( buffer , JFapChannelConstants . SEG_CHUNKED_BROWSE_MESSAGE , 0 , jfapPriority , false , ThrottlingPolicy . BLOCK_THREAD , null ) ; } messagesSent ++ ; } catch ( SIException e ) { FFDCFilter . processException ( e , CLASS_NAME + ".sendChunkedMessage" , CommsConstants . CATBROWSECONSUMER_SEND_CHUNKED_MSG_01 , this ) ; SibTr . error ( tc , "COMMUNICATION_ERROR_SICO2012" , e ) ; } } } catch ( Exception e ) { FFDCFilter . processException ( e , CLASS_NAME + ".sendChunkedMessage" , CommsConstants . CATBROWSECONSUMER_SEND_CHUNKED_MSG_02 , this ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) SibTr . exception ( this , tc , e ) ; // If the connection drops during the encode , don ' t try and send an exception to the client if ( e instanceof SIConnectionDroppedException ) { SibTr . error ( tc , "COMMUNICATION_ERROR_SICO2012" , e ) ; // No point trying to transmit this to the client , as it has already gone away . throw new OperationFailedException ( ) ; } SIResourceException coreException = new SIResourceException ( ) ; coreException . initCause ( e ) ; StaticCATHelper . sendAsyncExceptionToClient ( coreException , CommsConstants . CATBROWSECONSUMER_SEND_CHUNKED_MSG_02 , getClientSessionId ( ) , getConversation ( ) , 0 ) ; throw new OperationFailedException ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "sendChunkedMessage" , retValue ) ; return retValue ;
public class Compound { /** * deprecated methods starting here . */ @ Deprecated public void connect ( Object from , String from_out , Object to , String to_in ) { } }
controller . connect ( from , from_out , to , to_in ) ;
public class DiagnosticsInner { /** * Get site detector response . * Get site detector response . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param siteName Site Name * @ param detectorName Detector Resource Name * @ param slot Slot Name * @ param startTime Start Time * @ param endTime End Time * @ param timeGrain Time Grain * @ 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 < DetectorResponseInner > getSiteDetectorResponseSlotAsync ( String resourceGroupName , String siteName , String detectorName , String slot , DateTime startTime , DateTime endTime , String timeGrain , final ServiceCallback < DetectorResponseInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getSiteDetectorResponseSlotWithServiceResponseAsync ( resourceGroupName , siteName , detectorName , slot , startTime , endTime , timeGrain ) , serviceCallback ) ;
public class DateUtil { /** * Converts the specified < code > calendar < / code > with the specified { @ code format } to a new instance of XMLGregorianCalendar . * < code > null < / code > is returned if the specified < code > date < / code > is null or empty . * @ param calendar * @ param format * @ param timeZone * @ return */ public static XMLGregorianCalendar parseXMLGregorianCalendar ( final String calendar , final String format , final TimeZone timeZone ) { } }
if ( N . isNullOrEmpty ( calendar ) || ( calendar . length ( ) == 4 && "null" . equalsIgnoreCase ( calendar ) ) ) { return null ; } return createXMLGregorianCalendar ( parse ( calendar , format , timeZone ) ) ;
public class PPORGImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . PPORG__RG_LENGTH : setRGLength ( RG_LENGTH_EDEFAULT ) ; return ; case AfplibPackage . PPORG__OBJ_TYPE : setObjType ( OBJ_TYPE_EDEFAULT ) ; return ; case AfplibPackage . PPORG__PROC_FLGS : setProcFlgs ( PROC_FLGS_EDEFAULT ) ; return ; case AfplibPackage . PPORG__XOCA_OSET : setXocaOset ( XOCA_OSET_EDEFAULT ) ; return ; case AfplibPackage . PPORG__YOCA_OSET : setYocaOset ( YOCA_OSET_EDEFAULT ) ; return ; case AfplibPackage . PPORG__TRIPLETS : getTriplets ( ) . clear ( ) ; return ; } super . eUnset ( featureID ) ;
public class Viewport { /** * If the specified viewport intersects this viewport , return true and set this viewport to that intersection , * otherwise return false and do not change this viewport . No check is performed to see if either viewport is empty . * To just test for intersection , use intersects ( ) * @ param v The viewport being intersected with this viewport . * @ return true if the specified viewport and this viewport intersect ( and this viewport is then set to that * intersection ) else return false and do not change this viewport . */ public boolean intersect ( Viewport v ) { } }
return intersect ( v . left , v . top , v . right , v . bottom ) ;
public class BaseMessageEndpointFactory { /** * d450478 - added entire method */ @ Override public void applicationStarted ( String appName ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "MEF.applicationStarted for application " + appName ) ; } // Change state to the active state and notify all threads // that were blocked while we were activating this endpoint . synchronized ( ivStateLock ) { ivState = ACTIVE_STATE ; ivStateLock . notifyAll ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "MEF.applicationStarted for application " + appName ) ; }
public class HpsmCollectorTask { /** * Takes configurationItemNameList ( list of all APP / component names ) and List < Cmdb > from client and sets flag to false for old items in mongo * @ param configurationItemNameList * @ return return count of items invalidated */ private int cleanUpOldCmdbItems ( List < String > configurationItemNameList ) { } }
int inValidCount = 0 ; for ( Cmdb cmdb : cmdbRepository . findAllByValidConfigItem ( true ) ) { String configItem = cmdb . getConfigurationItem ( ) ; if ( configurationItemNameList != null && ! configurationItemNameList . contains ( configItem ) ) { cmdb . setValidConfigItem ( false ) ; cmdbRepository . save ( cmdb ) ; inValidCount ++ ; } } return inValidCount ;
public class EmulatedFields { /** * Finds and returns the int value of a given field named { @ code name } in the * receiver . If the field has not been assigned any value yet , the default * value { @ code defaultValue } is returned instead . * @ param name * the name of the field to find . * @ param defaultValue * return value in case the field has not been assigned to yet . * @ return the value of the given field if it has been assigned , the default * value otherwise . * @ throws IllegalArgumentException * if the corresponding field can not be found . */ public int get ( String name , int defaultValue ) throws IllegalArgumentException { } }
ObjectSlot slot = findMandatorySlot ( name , int . class ) ; return slot . defaulted ? defaultValue : ( ( Integer ) slot . fieldValue ) . intValue ( ) ;
public class L3ToSBGNPDConverter { /** * Gets the map of stoichiometry coefficients of participants . * @ param conv the conversion * @ return map from physical entities to their stoichiometry */ private Map < PhysicalEntity , Stoichiometry > getStoichiometry ( Conversion conv ) { } }
Map < PhysicalEntity , Stoichiometry > map = new HashMap < PhysicalEntity , Stoichiometry > ( ) ; for ( Stoichiometry stoc : conv . getParticipantStoichiometry ( ) ) map . put ( stoc . getPhysicalEntity ( ) , stoc ) ; return map ;
public class ReComputeTimeOffsetHandler { /** * Constructor . * @ param field The basefield owner of this listener ( usually null and set on setOwner ( ) ) . * @ param iTargetFieldSeq The date field sequence in this owner to use to calc the difference . * @ param fldOtherDate The other date field to use in calculating the date difference . If null , uses the current time . */ public void init ( BaseField field , String targetFieldName , DateTimeField fldOtherDate ) { } }
m_fldOtherDate = fldOtherDate ; super . init ( field , targetFieldName , null ) ;
public class SelectiveAccessHandler { /** * adds section handling for a specified relative level . . . */ public void addSectionHandling ( int level , EnumMap < SIT , EnumMap < CIT , Boolean > > sh ) { } }
sectionHandling . put ( SectionType . SECTION_LEVEL . toString ( ) + level , sh ) ;
public class BaseAPI { /** * 通用post请求 * @ param url 地址 , 其中token用 # 代替 * @ param json 参数 , json格式 * @ return 请求结果 */ protected BaseResponse executePost ( String url , String json ) { } }
return executePost ( url , json , null ) ;
public class TmsConfigurationService { /** * Transforms a TMS tile - set description object into a Geomajas { @ link ScaleInfo } object . * @ param tileSet * The tile set description . * @ return The default Geomajas scale object . */ public ScaleInfo asScaleInfo ( TileSet tileSet ) { } }
ScaleInfo scaleInfo = new ScaleInfo ( ) ; scaleInfo . setPixelPerUnit ( 1 / tileSet . getUnitsPerPixel ( ) ) ; return scaleInfo ;
public class AbstractCasView { /** * Gets error description from . * @ param model the model * @ return the error description from */ protected String getErrorDescriptionFrom ( final Map < String , Object > model ) { } }
return model . get ( CasViewConstants . MODEL_ATTRIBUTE_NAME_ERROR_DESCRIPTION ) . toString ( ) ;
public class WizardDialog { /** * create a peer for this * dialog , using the given * peer as a parent . * @ param parentPeer * @ return * @ throws java . lang . Exception */ public XWindowPeer createWindowPeer ( XWindowPeer _xWindowParentPeer ) throws com . sun . star . script . BasicErrorException { } }
try { if ( _xWindowParentPeer == null ) { XWindow xWindow = ( XWindow ) UnoRuntime . queryInterface ( XWindow . class , m_xDlgContainer ) ; xWindow . setVisible ( false ) ; Object tk = m_xMCF . createInstanceWithContext ( "com.sun.star.awt.Toolkit" , m_xContext ) ; XToolkit xToolkit = ( XToolkit ) UnoRuntime . queryInterface ( XToolkit . class , tk ) ; mxReschedule = ( XReschedule ) UnoRuntime . queryInterface ( XReschedule . class , xToolkit ) ; m_xDialogControl . createPeer ( xToolkit , _xWindowParentPeer ) ; m_xWindowPeer = m_xDialogControl . getPeer ( ) ; return m_xWindowPeer ; } } catch ( com . sun . star . uno . Exception exception ) { exception . printStackTrace ( System . out ) ; } return null ;
public class appflowaction { /** * Use this API to fetch filtered set of appflowaction resources . * filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */ public static appflowaction [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } }
appflowaction obj = new appflowaction ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; appflowaction [ ] response = ( appflowaction [ ] ) obj . getfiltered ( service , option ) ; return response ;
public class OrmDescriptorImpl { /** * If not already created , a new < code > sql - result - set - mapping < / code > element will be created and returned . * Otherwise , the first existing < code > sql - result - set - mapping < / code > element will be returned . * @ return the instance defined for the element < code > sql - result - set - mapping < / code > */ public SqlResultSetMapping < OrmDescriptor > getOrCreateSqlResultSetMapping ( ) { } }
List < Node > nodeList = model . get ( "sql-result-set-mapping" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new SqlResultSetMappingImpl < OrmDescriptor > ( this , "sql-result-set-mapping" , model , nodeList . get ( 0 ) ) ; } return createSqlResultSetMapping ( ) ;
public class AbstractSaml20ObjectBuilder { /** * New issuer . * @ param issuerValue the issuer * @ return the issuer */ public Issuer newIssuer ( final String issuerValue ) { } }
val issuer = newSamlObject ( Issuer . class ) ; issuer . setValue ( issuerValue ) ; return issuer ;
public class FlickrCrawler { /** * convert filename to clean filename */ public static String convertToFileSystemChar ( String name ) { } }
String erg = "" ; Matcher m = Pattern . compile ( "[a-z0-9 _#&@\\[\\(\\)\\]\\-\\.]" , Pattern . CASE_INSENSITIVE ) . matcher ( name ) ; while ( m . find ( ) ) { erg += name . substring ( m . start ( ) , m . end ( ) ) ; } if ( erg . length ( ) > 200 ) { erg = erg . substring ( 0 , 200 ) ; System . out . println ( "cut filename: " + erg ) ; } return erg ;
public class MenuDrawer { /** * Sets whether the drawer indicator should be enabled . { @ link # setupUpIndicator ( android . app . Activity ) } must be * called first . * @ param enabled Whether the drawer indicator should enabled . */ public void setDrawerIndicatorEnabled ( boolean enabled ) { } }
if ( mActionBarHelper == null ) { throw new IllegalStateException ( "setupUpIndicator(Activity) has not been called" ) ; } mDrawerIndicatorEnabled = enabled ; if ( enabled ) { mActionBarHelper . setActionBarUpIndicator ( mSlideDrawable , isMenuVisible ( ) ? mDrawerOpenContentDesc : mDrawerClosedContentDesc ) ; } else { mActionBarHelper . setActionBarUpIndicator ( mThemeUpIndicator , 0 ) ; }
public class ForRawType { /** * { @ inheritDoc } */ public Generic onTypeVariable ( Generic typeVariable ) { } }
return declaringType . isGenerified ( ) ? new Generic . OfNonGenericType . Latent ( typeVariable . asErasure ( ) , typeVariable ) : typeVariable ;
public class AcceptHash { /** * Concatenate the provided key with the Magic GUID and return the Base64 encoded form . * @ param key the key to hash * @ return the < code > Sec - WebSocket - Accept < / code > header response ( per opening handshake spec ) */ public static String hashKey ( String key ) { } }
try { MessageDigest md = MessageDigest . getInstance ( "SHA1" ) ; md . update ( key . getBytes ( StandardCharsets . UTF_8 ) ) ; md . update ( MAGIC ) ; return new String ( B64Code . encode ( md . digest ( ) ) ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class FaxServiceImp { /** * ( non - Javadoc ) * @ see com . popbill . api . FaxService # search ( java . lang . String , java . lang . String , java . lang . String , java . lang . String [ ] , java . lang . Boolean , java . lang . Boolean , int , int , java . lang . String , java . lang . String ) */ @ Override public FAXSearchResult search ( String corpNum , String sDate , String eDate , String [ ] state , Boolean reserveYN , Boolean senderOnly , int page , int perPage , String order , String qString ) throws PopbillException { } }
if ( sDate == null ) throw new PopbillException ( - 99999999 , "시작일자가 입력되지 않았습니다." ) ; if ( eDate == null ) throw new PopbillException ( - 99999999 , "종료일자가 입력되지 않았습니다." ) ; String uri = "/FAX/Search?SDate=" + sDate ; uri += "&EDate=" + eDate ; uri += "&State=" + Arrays . toString ( state ) . replaceAll ( "\\[|\\]|\\s" , "" ) ; if ( reserveYN ) { uri += "&ReserveYN=1" ; } else { uri += "&ReserveYN=0" ; } if ( senderOnly ) { uri += "&SenderOnly=1" ; } else { uri += "&SenderOnly=0" ; } uri += "&Page=" + Integer . toString ( page ) ; uri += "&PerPage=" + Integer . toString ( perPage ) ; uri += "&Order=" + order ; if ( qString != null ) uri += "&QString=" + qString ; return httpget ( uri , corpNum , null , FAXSearchResult . class ) ;
public class JCusolverSp { /** * < pre > * - - - - - GPU eigenvalue solver by shift inverse * solve A * x = lambda * x * where lambda is the eigenvalue nearest mu0. * [ eig ] stands for eigenvalue solver * [ si ] stands for shift - inverse * < / pre > */ public static int cusolverSpScsreigvsi ( cusolverSpHandle handle , int m , int nnz , cusparseMatDescr descrA , Pointer csrValA , Pointer csrRowPtrA , Pointer csrColIndA , float mu0 , Pointer x0 , int maxite , float eps , Pointer mu , Pointer x ) { } }
return checkResult ( cusolverSpScsreigvsiNative ( handle , m , nnz , descrA , csrValA , csrRowPtrA , csrColIndA , mu0 , x0 , maxite , eps , mu , x ) ) ;
public class IdGeneratorImpl { /** * Generates a number of random bytes . * < p > The chance of collisions of k IDs taken from a population of N possibilities is < code > * 1 - Math . exp ( - 0.5 * k * ( k - 1 ) / N ) < / code > * < p > A couple collision chances for 5 bytes < code > N = 256 ^ 5 < / code > : * < table > * < tr > < td > 1 < / td > < td > 0.0 < / td > < / tr > * < tr > < td > 10 < / td > < td > 4.092726157978177e - 11 < / td > < / tr > * < tr > < td > 100 < / td > < td > 4.501998773775995e - 09 < / td > < / tr > * < tr > < td > 1000 < / td > < td > 4.5429250039585867e - 07 < / td > < / tr > * < tr > < td > 10000 < / td > < td > 4.546915386183237e - 05 < / td > < / tr > * < tr > < td > 100000 < / td > < td > 0.004537104138253034 < / td > < / tr > * < tr > < td > 100000 < / td > < td > 0.36539143049797307 < / td > < / tr > * < / table > * @ see < a href = " http : / / preshing . com / 20110504 / hash - collision - probabilities / " > Hash collision * probabilities < / a > */ private byte [ ] generateRandomBytes ( int nBytes , Random random ) { } }
byte [ ] randomBytes = new byte [ nBytes ] ; random . nextBytes ( randomBytes ) ; return randomBytes ;
public class ReflectionUtils { /** * Returns true if an annotation for the specified type is found on the * getter method or its corresponding class field . */ static < T extends Annotation > boolean getterOrFieldHasAnnotation ( Method getter , Class < T > annotationClass ) { } }
return getAnnotationFromGetterOrField ( getter , annotationClass ) != null ;
public class BaseBuilder { /** * Adds a builder step for this builder , upon build these steps will be called in the same order they came in on . * @ param methodName cannot be < code > null < / code > or empty . * @ param args may be < code > null < / code > or empty . * @ param argTypes argument class types can be specified to ensure the right class types * are used when we try to find the specified method . This is needed for primitive types do to * autoboxing issues . May be < code > null < / code > or empty . * @ param builderMethod if < code > true < / code > then call the specified method on the builder and not * the component object instance . */ protected void addStep ( String methodName , Object [ ] args , Class < ? > [ ] argTypes , boolean builderMethod ) { } }
if ( StringUtils . isBlank ( methodName ) ) { throw new IllegalArgumentException ( "methodName cannot be null or empty." ) ; } steps . add ( new Step ( methodName , args , argTypes , builderMethod ) ) ;
public class ZipUtils { /** * Unzips a zip from an input stream into an output folder . * @ param inputStream the zip input stream * @ param outputFolder the output folder where the files * @ throws IOException */ public static void unZipFiles ( InputStream inputStream , File outputFolder ) throws IOException { } }
ZipInputStream zis = new ZipInputStream ( inputStream ) ; ZipEntry ze = zis . getNextEntry ( ) ; while ( ze != null ) { File file = new File ( outputFolder , ze . getName ( ) ) ; OutputStream os = new BufferedOutputStream ( FileUtils . openOutputStream ( file ) ) ; try { IOUtils . copy ( zis , os ) ; } finally { IOUtils . closeQuietly ( os ) ; } zis . closeEntry ( ) ; ze = zis . getNextEntry ( ) ; }
public class reportIssue { /** * This runs in UI when background thread finishes */ @ Override protected void onPostExecute ( String result ) { } }
super . onPostExecute ( result ) ; if ( result . equals ( "ok" ) ) { progress . dismiss ( ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . LOLLIPOP ) { mActivity . showDoneAnimation ( ) ; } else { ( ( Activity ) mContext ) . finish ( ) ; } } else if ( result . equals ( "org.eclipse.egit.github.core.client.RequestException: Bad credentials (401)" ) ) { progress . dismiss ( ) ; new AlertDialog . Builder ( mContext ) . setTitle ( "Unable to send report" ) . setMessage ( "Wrong username or password or invalid access token." ) . setPositiveButton ( "Try again" , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { // do nothing } } ) . setIcon ( R . drawable . gittyreporter_ic_mood_bad_black_24dp ) . show ( ) ; } else { progress . dismiss ( ) ; new AlertDialog . Builder ( mContext ) . setTitle ( "Unable to send report" ) . setMessage ( "An unexpected error occurred. If the problem persists, contact the app developer." ) . setPositiveButton ( android . R . string . ok , new DialogInterface . OnClickListener ( ) { public void onClick ( DialogInterface dialog , int which ) { ( ( Activity ) mContext ) . finish ( ) ; } } ) . setIcon ( R . drawable . gittyreporter_ic_mood_bad_black_24dp ) . show ( ) ; }
public class ConnectionSourceSkeleton { /** * Learn relevant information about this connection source . */ public void discoverConnnectionProperties ( ) { } }
Connection connection = null ; try { connection = getConnection ( ) ; if ( connection == null ) { getLogger ( ) . warn ( "Could not get a conneciton" ) ; return ; } DatabaseMetaData meta = connection . getMetaData ( ) ; Util util = new Util ( ) ; util . setLoggerRepository ( repository ) ; if ( overriddenSupportsGetGeneratedKeys != null ) { supportsGetGeneratedKeys = overriddenSupportsGetGeneratedKeys . booleanValue ( ) ; } else { supportsGetGeneratedKeys = util . supportsGetGeneratedKeys ( meta ) ; } supportsBatchUpdates = util . supportsBatchUpdates ( meta ) ; dialectCode = Util . discoverSQLDialect ( meta ) ; } catch ( SQLException se ) { getLogger ( ) . warn ( "Could not discover the dialect to use." , se ) ; } finally { DBHelper . closeConnection ( connection ) ; }
public class ChannelFrameworkImpl { /** * @ see * com . ibm . wsspi . channelfw . ChannelFramework # deregisterFactory ( java . lang . String */ @ Override public void deregisterFactory ( String name ) { } }
final boolean bTrace = TraceComponent . isAnyTracingEnabled ( ) ; if ( bTrace && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Removing factory registration: " + name ) ; } Class < ? > factory = null ; synchronized ( this . factories ) { factory = this . factories . remove ( name ) ; } if ( null != factory ) { final String factoryName = factory . getName ( ) ; final List < String > chains = new ArrayList < String > ( ) ; synchronized ( this ) { for ( ChainData chainData : this . chainDataMap . values ( ) ) { // Look at each channel associated with this chain . for ( ChannelData channel : chainData . getChannelList ( ) ) { if ( channel . getFactoryType ( ) . getName ( ) . equals ( factoryName ) ) { chains . add ( chainData . getName ( ) ) ; break ; // out of channel loop } } } } // create a post - action for cleaning up the chains whose factory has been removed . Runnable cleanup = new Runnable ( ) { @ Override public void run ( ) { for ( String chainName : chains ) { cleanupChain ( chainName ) ; } } } ; // Stop the chain . . the cleanup will happen once the quiesce is complete . ChannelUtils . stopChains ( chains , - 1L , cleanup ) ; }
public class DatabaseAccountsInner { /** * Online the specified region for the specified Azure Cosmos DB database account . * @ param resourceGroupName Name of an Azure resource group . * @ param accountName Cosmos DB database account name . * @ param region Cosmos DB region , with spaces between words and each word capitalized . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < Void > onlineRegionAsync ( String resourceGroupName , String accountName , String region ) { } }
return onlineRegionWithServiceResponseAsync ( resourceGroupName , accountName , region ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class SimulatorTaskTracker { /** * Stops running a task attempt on the task tracker . It also updates the * number of available slots accordingly . * @ param finalStatus the TaskStatus containing the task id and final * status of the task attempt . This rountine asserts a lot of the * finalStatus params , in case it is coming from a task attempt * completion event sent to ourselves . Only the run state , finish time , * and progress fields of the task attempt are updated . * @ param now Current simulation time , used for assert only */ private void finishRunningTask ( TaskStatus finalStatus , long now ) { } }
TaskAttemptID taskId = finalStatus . getTaskID ( ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Finishing running task id=" + taskId + ", now=" + now ) ; } SimulatorTaskInProgress tip = tasks . get ( taskId ) ; if ( tip == null ) { throw new IllegalArgumentException ( "Unknown task attempt " + taskId + " completed" ) ; } TaskStatus currentStatus = tip . getTaskStatus ( ) ; if ( currentStatus . getRunState ( ) != State . RUNNING ) { throw new IllegalArgumentException ( "Task attempt to finish is not running: " + tip ) ; } // Check that finalStatus describes a task attempt that has just been // completed State finalRunState = finalStatus . getRunState ( ) ; if ( finalRunState != State . SUCCEEDED && finalRunState != State . FAILED && finalRunState != State . KILLED ) { throw new IllegalArgumentException ( "Final run state for completed task can't be : " + finalRunState + " " + tip ) ; } if ( now != finalStatus . getFinishTime ( ) ) { throw new IllegalArgumentException ( "Current time does not match task finish time: now=" + now + ", finish=" + finalStatus . getFinishTime ( ) ) ; } if ( currentStatus . getIsMap ( ) != finalStatus . getIsMap ( ) || currentStatus . getNumSlots ( ) != finalStatus . getNumSlots ( ) || currentStatus . getPhase ( ) != finalStatus . getPhase ( ) || currentStatus . getStartTime ( ) != finalStatus . getStartTime ( ) ) { throw new IllegalArgumentException ( "Current status does not match final status" ) ; } // We can ' t assert getShuffleFinishTime ( ) and getSortFinishTime ( ) for // reduces as those were unknown when the task attempt completion event // was created . We have not called setMapFinishTime ( ) for maps either . // If we were really thorough we could update the progress of the task // and check if it is consistent with finalStatus . // If we ' ve got this far it is safe to update the task status currentStatus . setRunState ( finalStatus . getRunState ( ) ) ; currentStatus . setFinishTime ( finalStatus . getFinishTime ( ) ) ; currentStatus . setProgress ( finalStatus . getProgress ( ) ) ; // and update the free slots int numSlots = currentStatus . getNumSlots ( ) ; if ( tip . isMapTask ( ) ) { usedMapSlots -= numSlots ; if ( usedMapSlots < 0 ) { throw new IllegalStateException ( "TaskTracker reaches negative map slots: " + usedMapSlots ) ; } } else { usedReduceSlots -= numSlots ; if ( usedReduceSlots < 0 ) { throw new IllegalStateException ( "TaskTracker reaches negative reduce slots: " + usedReduceSlots ) ; } }
public class QueueContainer { /** * Rolls back the effects of the { @ link # txnPollReserve ( long , String ) } . * The { @ code backup } parameter defines whether this item was stored * on a backup queue or a primary queue . * It will return the item to the queue or backup map if it wasn ' t * offered as a part of the transaction . * Cancels the queue eviction if one is scheduled . * @ param itemId the ID of the item which was polled in a transaction * @ param backup if this is the primary or the backup replica for this queue * @ return if there was any polled item with the { @ code itemId } inside a transaction */ public boolean txnRollbackPoll ( long itemId , boolean backup ) { } }
TxQueueItem item = txMap . remove ( itemId ) ; if ( item == null ) { return false ; } if ( backup ) { getBackupMap ( ) . put ( itemId , item ) ; } else { addTxItemOrdered ( item ) ; } cancelEvictionIfExists ( ) ; return true ;
public class ThymeleafHtmlRenderer { @ Override public void render ( RequestManager requestManager , ActionRuntime runtime , NextJourney journey ) throws IOException , ServletException { } }
if ( isThymeleafJourney ( journey ) ) { showRendering ( journey ) ; final WebContext context = createTemplateContext ( requestManager ) ; exportErrorsToContext ( requestManager , context , runtime ) ; exportFormPropertyToContext ( requestManager , context , runtime ) ; final String html = createResponseBody ( templateEngine , context , runtime , journey ) ; write ( requestManager , html ) ; } else { // forward requestManager . getResponseManager ( ) . forward ( journey ) ; }
public class FilterDriver { /** * This method is to determine automatically join the Simple and Big . * @ param masterLabels label of master data * @ param masterColumn master column * @ param dataColumn data column * @ param masterSeparator separator * @ param regex master join is regex * @ param masterData master data */ protected void setJoin ( String [ ] masterLabels , String masterColumn , String dataColumn , String masterSeparator , boolean regex , List < String > masterData ) { } }
setSimpleJoin ( masterLabels , masterColumn , dataColumn , masterSeparator , regex , masterData ) ;
public class WithMavenStepExecution2 { /** * Sets the maven repo location according to the provided parameter on the agent * @ return path on the build agent to the repo or { @ code null } if not defined * @ throws InterruptedException when processing remote calls * @ throws IOException when reading files */ @ Nullable private String setupMavenLocalRepo ( ) throws IOException , InterruptedException { } }
String expandedMavenLocalRepo ; if ( StringUtils . isEmpty ( step . getMavenLocalRepo ( ) ) ) { expandedMavenLocalRepo = null ; } else { // resolve relative / absolute with workspace as base String expandedPath = envOverride . expand ( env . expand ( step . getMavenLocalRepo ( ) ) ) ; if ( FileUtils . isAbsolutePath ( expandedPath ) ) { expandedMavenLocalRepo = expandedPath ; } else { FilePath repoPath = new FilePath ( ws , expandedPath ) ; repoPath . mkdirs ( ) ; expandedMavenLocalRepo = repoPath . getRemote ( ) ; } } LOGGER . log ( Level . FINEST , "setupMavenLocalRepo({0}): {1}" , new Object [ ] { step . getMavenLocalRepo ( ) , expandedMavenLocalRepo } ) ; return expandedMavenLocalRepo ;
public class Main { /** * Prepare the command for execution from a bash script . The final command will have commands to * set up any needed environment variables needed by the child process . */ private static List < String > prepareBashCommand ( List < String > cmd , Map < String , String > childEnv ) { } }
if ( childEnv . isEmpty ( ) ) { return cmd ; } List < String > newCmd = new ArrayList < > ( ) ; newCmd . add ( "env" ) ; for ( Map . Entry < String , String > e : childEnv . entrySet ( ) ) { newCmd . add ( String . format ( "%s=%s" , e . getKey ( ) , e . getValue ( ) ) ) ; } newCmd . addAll ( cmd ) ; return newCmd ;
public class RBACRegistry { /** * If some combination of { @ link ObjectName } and MBean ' s class name is detected as < em > special < / em > , we may * cache the JSONified { @ link MBeanInfo } as well * @ param nameObject * @ param mBeanInfo * @ return */ private String isSpecialClass ( ObjectName nameObject , MBeanInfo mBeanInfo ) { } }
String domain = nameObject . getDomain ( ) ; if ( "org.apache.camel" . equals ( domain ) && mBeanInfo . getClassName ( ) != null ) { // some real data in env with 12 Camel contexts deployed // - components ( total : 102) // - consumers ( total : 511) // - context ( total : 12) // - endpoints ( total : 818) // - errorhandlers ( total : 12) // - eventnotifiers ( total : 24) // - processors ( total : 3600) // - producers ( total : 1764) // - routes ( total : 511) // - services ( total : 548) // - threadpools ( total : 66) // - tracer ( total : 24) return "camel::" + mBeanInfo . getClassName ( ) ; } return null ;
public class CmsClientStringUtil { /** * Generates a purely random uuid . < p > * @ return the generated uuid */ public static String randomUUID ( ) { } }
String base = CmsUUID . getNullUUID ( ) . toString ( ) ; String hexDigits = "0123456789abcdef" ; StringBuffer result = new StringBuffer ( ) ; for ( int i = 0 ; i < base . length ( ) ; i ++ ) { char ch = base . charAt ( i ) ; if ( ch == '-' ) { result . append ( ch ) ; } else if ( ch == '0' ) { result . append ( hexDigits . charAt ( Random . nextInt ( 16 ) ) ) ; } } return result . toString ( ) ;
public class DataModel { /** * < p > Return the set of { @ link DataModelListener } s interested in * notifications from this { @ link DataModel } . If there are no such * listeners , an empty array is returned . < / p > */ public DataModelListener [ ] getDataModelListeners ( ) { } }
if ( listeners == null ) { return EMPTY_DATA_MODEL_LISTENER ; } else { return listeners . toArray ( new DataModelListener [ listeners . size ( ) ] ) ; }
public class IOUtils { /** * Calculates GCG checksum for entire list of sequences * @ param sequences list of sequences * @ return GCG checksum */ public static < S extends Sequence < C > , C extends Compound > int getGCGChecksum ( List < S > sequences ) { } }
int check = 0 ; for ( S as : sequences ) { check += getGCGChecksum ( as ) ; } return check % 10000 ;
public class LangAlt { /** * Process a property . */ protected void process ( StringBuffer buf , Object lang ) { } }
buf . append ( "<rdf:li xml:lang=\"" ) ; buf . append ( lang ) ; buf . append ( "\" >" ) ; buf . append ( get ( lang ) ) ; buf . append ( "</rdf:li>" ) ;
public class WaitersGeneratorTasks { /** * Constructs the data model and submits tasks for every generating Acceptor for each waiter definition in the intermediate * model */ private List < GeneratorTask > createWaiterAcceptorClassTasks ( ) throws IOException { } }
List < GeneratorTask > generatorTasks = new ArrayList < > ( ) ; for ( Map . Entry < String , WaiterDefinitionModel > entry : model . getWaiters ( ) . entrySet ( ) ) { if ( containsAllStatusMatchers ( entry ) ) { continue ; } final String waiterName = entry . getKey ( ) ; final WaiterDefinitionModel waiterModel = entry . getValue ( ) ; Map < String , Object > dataModel = ImmutableMapParameter . of ( "fileHeader" , model . getFileHeader ( ) , "waiter" , waiterModel , "operation" , model . getOperation ( waiterModel . getOperationName ( ) ) , "metadata" , model . getMetadata ( ) ) ; generatorTasks . add ( new FreemarkerGeneratorTask ( waiterClassDir , waiterName , freemarker . getWaiterAcceptorTemplate ( ) , dataModel ) ) ; } return generatorTasks ;
public class Tuple16 { /** * Skip 6 degrees from this tuple . */ public final Tuple10 < T7 , T8 , T9 , T10 , T11 , T12 , T13 , T14 , T15 , T16 > skip6 ( ) { } }
return new Tuple10 < > ( v7 , v8 , v9 , v10 , v11 , v12 , v13 , v14 , v15 , v16 ) ;
public class VersionListener { /** * Get whatever is on the stack and make a version range out of it * @ see net . ossindex . version . parser . VersionBaseListener # exitRange ( net . ossindex . version . parser . VersionParser . RangeContext ) */ @ Override public void exitRange ( VersionParser . RangeContext ctx ) { } }
Object o = stack . pop ( ) ; if ( o instanceof IVersion ) { // range = new SemanticVersionRange ( ( SemanticVersion ) o ) ; range = new VersionSet ( ( IVersion ) o ) ; } else if ( o instanceof IVersionRange ) { range = ( IVersionRange ) o ; }
public class DateIntervalFormat { /** * Concat a single date pattern with a time interval pattern , * set it into the intervalPatterns , while field is time field . * This is used to handle time interval patterns on skeleton with * both time and date . Present the date followed by * the range expression for the time . * @ param dtfmt date and time format * @ param datePattern date pattern * @ param field time calendar field : AM _ PM , HOUR , MINUTE * @ param intervalPatterns interval patterns */ private void concatSingleDate2TimeInterval ( String dtfmt , String datePattern , int field , Map < String , PatternInfo > intervalPatterns ) { } }
PatternInfo timeItvPtnInfo = intervalPatterns . get ( DateIntervalInfo . CALENDAR_FIELD_TO_PATTERN_LETTER [ field ] ) ; if ( timeItvPtnInfo != null ) { String timeIntervalPattern = timeItvPtnInfo . getFirstPart ( ) + timeItvPtnInfo . getSecondPart ( ) ; String pattern = SimpleFormatterImpl . formatRawPattern ( dtfmt , 2 , 2 , timeIntervalPattern , datePattern ) ; timeItvPtnInfo = DateIntervalInfo . genPatternInfo ( pattern , timeItvPtnInfo . firstDateInPtnIsLaterDate ( ) ) ; intervalPatterns . put ( DateIntervalInfo . CALENDAR_FIELD_TO_PATTERN_LETTER [ field ] , timeItvPtnInfo ) ; } // else : fall back // it should not happen if the interval format defined is valid
public class CinchContext { /** * Create a new SpringFlapMapFunction , which implements Spark ' s FlatMapFunction interface . */ public < T , R > FlatMapFunction < T , R > flatMapFunction ( Class < ? extends FlatMapFunction < T , R > > springBeanClass ) { } }
return new SpringFlatMapFunction < > ( springConfigurationClass , springBeanClass ) ;
public class Introspector { /** * Gets the < code > BeanInfo < / code > object which contains the information of * the properties , events and methods of the specified bean class . * The < code > Introspector < / code > will cache the < code > BeanInfo < / code > * object . Subsequent calls to this method will be answered with the cached * data . * @ param < T > type Generic * @ param beanClass the specified bean class . * @ return the < code > BeanInfo < / code > of the bean class . */ @ SuppressWarnings ( "unchecked" ) static < T > BeanInfo < T > getBeanInfo ( Class < T > beanClass ) { } }
BeanInfo beanInfo = theCache . get ( beanClass ) ; if ( beanInfo == null ) { beanInfo = new SimpleBeanInfo ( beanClass ) ; theCache . put ( beanClass , beanInfo ) ; } return beanInfo ;
public class AmazonEC2Client { /** * Describes the connection notifications for VPC endpoints and VPC endpoint services . * @ param describeVpcEndpointConnectionNotificationsRequest * @ return Result of the DescribeVpcEndpointConnectionNotifications operation returned by the service . * @ sample AmazonEC2 . DescribeVpcEndpointConnectionNotifications * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / DescribeVpcEndpointConnectionNotifications " * target = " _ top " > AWS API Documentation < / a > */ @ Override public DescribeVpcEndpointConnectionNotificationsResult describeVpcEndpointConnectionNotifications ( DescribeVpcEndpointConnectionNotificationsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeVpcEndpointConnectionNotifications ( request ) ;
public class WebSocket { /** * Called by the reading thread as its last step . */ void onReadingThreadFinished ( WebSocketFrame closeFrame ) { } }
synchronized ( mThreadsLock ) { mReadingThreadFinished = true ; mServerCloseFrame = closeFrame ; if ( mWritingThreadFinished == false ) { // Wait for the writing thread to finish . return ; } } // Both the reading thread and the writing thread have finished . onThreadsFinished ( ) ;
public class ReflectUtils { /** * 从包中获取所有的类 * @ param packageName 包名 * @ return { @ link List } * @ throws IOException 异常 * @ throws ClassNotFoundException 异常 */ public static List < Class < ? > > getClasses ( String packageName ) throws IOException , ClassNotFoundException { } }
List < Class < ? > > classes = new ArrayList < > ( ) ; String packageDirName = packageName . replace ( '.' , '/' ) ; Enumeration < URL > dirs = Thread . currentThread ( ) . getContextClassLoader ( ) . getResources ( packageDirName ) ; while ( dirs . hasMoreElements ( ) ) { URL url = dirs . nextElement ( ) ; String protocol = url . getProtocol ( ) ; if ( "file" . equals ( protocol ) ) { String filePath = URLDecoder . decode ( url . getFile ( ) , "UTF-8" ) ; addClassesInPackageByFile ( packageName , filePath , classes ) ; } else if ( "jar" . equals ( protocol ) ) { JarFile jar = ( ( JarURLConnection ) url . openConnection ( ) ) . getJarFile ( ) ; Enumeration < JarEntry > entries = jar . entries ( ) ; while ( entries . hasMoreElements ( ) ) { JarEntry entry = entries . nextElement ( ) ; String name = entry . getName ( ) ; if ( name . charAt ( 0 ) == '/' ) { name = name . substring ( 1 ) ; } if ( name . startsWith ( packageDirName ) ) { int idx = name . lastIndexOf ( '/' ) ; if ( idx != - 1 ) { packageName = name . substring ( 0 , idx ) . replace ( '/' , '.' ) ; } if ( name . endsWith ( ".class" ) && ! entry . isDirectory ( ) ) { String className = name . substring ( packageName . length ( ) + 1 , name . length ( ) - 6 ) ; classes . add ( Class . forName ( packageName + '.' + className ) ) ; } } } } } return classes ;
public class Request { /** * 添加请求消息体 */ public Request setContent ( String content ) { } }
if ( body == null ) body = new RequestBody ( ) ; this . body . setContent ( content ) ; return this ;
public class Facets { /** * Returns a facet of the given subject if supported , throwing an * exception otherwise . * This does not attempt to cast the subject to the requested type , since * the { @ link Faceted } interface declares the intent to control the * conversion . * @ return not null . * @ throws UnsupportedFacetException if { @ code subject } is null or if the * subject doesn ' t support the requested facet type . */ public static < T > T assumeFacet ( Class < T > facetType , Faceted subject ) { } }
if ( subject != null ) { T facet = subject . asFacet ( facetType ) ; if ( facet != null ) return facet ; } throw new UnsupportedFacetException ( facetType , subject ) ;
public class QualitygatesService { /** * This is part of the internal API . * This is a POST request . * @ see < a href = " https : / / next . sonarqube . com / sonarqube / web _ api / api / qualitygates / deselect " > Further information about this action online ( including a response example ) < / a > * @ since 4.3 */ public void deselect ( DeselectRequest request ) { } }
call ( new PostRequest ( path ( "deselect" ) ) . setParam ( "organization" , request . getOrganization ( ) ) . setParam ( "projectId" , request . getProjectId ( ) ) . setParam ( "projectKey" , request . getProjectKey ( ) ) . setMediaType ( MediaTypes . JSON ) ) . content ( ) ;
public class CmsDetailPageDuplicateEliminatingSitemapGenerator { /** * Gets the path map containing the contents for the given type . < p > * @ param typeName the type name * @ return the path map with the content resources * @ throws CmsException if something goes wrong */ private CmsPathMap < CmsResource > getPathMapForType ( String typeName ) throws CmsException { } }
if ( ! m_pathMapsByType . containsKey ( typeName ) ) { CmsPathMap < CmsResource > pathMap = readPathMapForType ( OpenCms . getResourceManager ( ) . getResourceType ( typeName ) ) ; m_pathMapsByType . put ( typeName , pathMap ) ; } return m_pathMapsByType . get ( typeName ) ;
public class EntityType { /** * getIdClass . * @ return a { @ link java . lang . Class } object . */ @ SuppressWarnings ( "unchecked" ) public Class < ? extends Serializable > getIdType ( ) { } }
Type type = propertyTypes . get ( idName ) ; return ( Class < ? extends Serializable > ) ( null != type ? type . getReturnedClass ( ) : null ) ;
public class PlanAssembler { /** * Return true if tableList includes at least one matview . */ private boolean tableListIncludesReadOnlyView ( List < Table > tableList ) { } }
for ( Table table : tableList ) { if ( table . getMaterializer ( ) != null && ! TableType . isStream ( table . getMaterializer ( ) . getTabletype ( ) ) ) { return true ; } } return false ;
public class JulianDate { /** * Creates a { @ code JulianDate } validating the input . * @ param prolepticYear the Julian proleptic - year * @ param month the Julian month - of - year , from 1 to 12 * @ param dayOfMonth the Julian day - of - month , from 1 to 31 * @ return the date in Julian calendar system , not null * @ throws DateTimeException if the value of any field is out of range , * or if the day - of - year is invalid for the month - year */ static JulianDate create ( int prolepticYear , int month , int dayOfMonth ) { } }
JulianChronology . YEAR_RANGE . checkValidValue ( prolepticYear , YEAR ) ; MONTH_OF_YEAR . checkValidValue ( month ) ; DAY_OF_MONTH . checkValidValue ( dayOfMonth ) ; if ( dayOfMonth > 28 ) { int dom = 31 ; switch ( month ) { case 2 : dom = ( JulianChronology . INSTANCE . isLeapYear ( prolepticYear ) ? 29 : 28 ) ; break ; case 4 : case 6 : case 9 : case 11 : dom = 30 ; break ; default : break ; } if ( dayOfMonth > dom ) { if ( dayOfMonth == 29 ) { throw new DateTimeException ( "Invalid date 'February 29' as '" + prolepticYear + "' is not a leap year" ) ; } else { throw new DateTimeException ( "Invalid date '" + Month . of ( month ) . name ( ) + " " + dayOfMonth + "'" ) ; } } } return new JulianDate ( prolepticYear , month , dayOfMonth ) ;
public class SecWorkContextHandler { /** * This method is called by the WorkProxy class to associate the in - flown * SecurityContext with the work manager thread that will perform the work . * Note that this should support the case of nested work submission . * @ param credService The credentials service * @ param securityService The security service * @ param unauthSubjService The unauthenticated subject service * @ param authService The authentication service * @ param workCtx The WorkContext ( SecurityContext ) to associate * @ param providerId The id of the associated provider * @ return void * @ throws WorkCompletedException if there is an error during association of the * SecurityContext */ public void associate ( CredentialsService credService , WSSecurityService securityService , UnauthenticatedSubjectService unauthSubjService , AuthenticationService authService , WorkContext workCtx , String providerId ) throws WorkCompletedException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "associate" , new Object [ ] { J2CSecurityHelper . objectId ( workCtx ) , providerId } ) ; } // Check if application security is enabled and only in that case // do the security context association . if ( WSSecurityHelper . isServerSecurityEnabled ( ) ) { TraceNLS nls = J2CSecurityHelper . getNLS ( ) ; try { UserRegistry registry = securityService . getUserRegistry ( null ) ; final String appRealm = registry != null ? registry . getRealm ( ) : null ; // The code below extracts the security work context and invokes // setupSecurityContext on it passing in the callback handler and the // execution and server subjects . SecurityContext sc = ( SecurityContext ) workCtx ; final Subject executionSubject = new Subject ( ) ; J2CSecurityCallbackHandler handler = new J2CSecurityCallbackHandler ( executionSubject , appRealm , credService . getUnauthenticatedUserid ( ) ) ; // Change from twas - jms - Setting to null for now - / / cm . getUnauthenticatedString ( ) ) ; Subject serverSubject = null ; sc . setupSecurityContext ( handler , executionSubject , serverSubject ) ; SubjectHelper subjectHelper = new SubjectHelper ( ) ; WSCredential credential = subjectHelper . getWSCredential ( executionSubject ) ; // check if the Subject is already authenticated i . e it contains WebSphere credentials . if ( credential != null ) { if ( handler . getInvocations ( ) [ 0 ] == Invocation . CALLERPRINCIPALCALLBACK || // Begin 673415 handler . getInvocations ( ) [ 1 ] == Invocation . GROUPPRINCIPALCALLBACK || handler . getInvocations ( ) [ 2 ] == Invocation . PASSWORDVALIDATIONCALLBACK ) { String message = nls . getString ( "AUTHENTICATED_SUBJECT_AND_CALLBACK_NOT_SUPPORTED_J2CA0677" , "J2CA0677E: " + "An authenticated JAAS Subject and one or more JASPIC callbacks were passed to the application server " + "by the resource adapter." ) ; // End 673415 if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } throw new WSSecurityException ( message ) ; } else if ( appRealm . equals ( credential . getRealmName ( ) ) || RegistryHelper . isRealmInboundTrusted ( credential . getRealmName ( ) , appRealm ) ) { // Begin 673415 J2CSecurityHelper . setRunAsSubject ( executionSubject ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } return ; } else { String message = nls . getFormattedMessage ( "REALM_IS_NOT_TRUSTED_J2CA0685" , new Object [ ] { null } , "REALM_IS_NOT_TRUSTED_J2CA0685" ) ; // Change from twas - jms - TODO check on this - credential . getRealmName ( ) changed to null if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } throw new WSSecurityException ( message ) ; } } // After the invocation of the setupSecurityContext the execution subject will be // populated with the result of handling the callbacks that are passed in to the // handle method of the callback handler . The result is a custom hashtable that can // be used for security to do a hashtable login . The resource adapter can also modify // the execution subject by adding a principal . The code below checks for the result and // if the result is null or empty after the invocation of the callbacks throws an Exception // See JCA 1.6 Spec 16.4.1. Hashtable < String , Object > cred = J2CSecurityHelper . getCustomCredentials ( executionSubject , handler . getCacheKey ( ) ) ; Set < Principal > principals = executionSubject . getPrincipals ( ) ; // 675546 if ( handler . getInvocations ( ) [ 0 ] == Invocation . CALLERPRINCIPALCALLBACK ) { if ( cred == null || ! cred . containsKey ( AttributeNameConstants . WSCREDENTIAL_SECURITYNAME ) ) { String message = nls . getString ( "CUSTOM_CREDENTIALS_MISSING_J2CA0668" , "J2CA0668E: The WorkManager was unable to " + "populate the execution subject with the caller principal or credentials necessary to establish the security " + "context for this Work instance." ) ; throw new WSSecurityException ( message ) ; } } else if ( ( handler . getInvocations ( ) [ 1 ] == Invocation . GROUPPRINCIPALCALLBACK // Begin 673415 || handler . getInvocations ( ) [ 2 ] == Invocation . PASSWORDVALIDATIONCALLBACK ) && principals . size ( ) != 1 ) { // 675546 // If CallerPrincipalCallback was not provided but other callbacks were provided then do not // allow the security context to be setup . See next comment for the reason String message = nls . getString ( "CALLERPRINCIPAL_NOT_PROVIDED_J2CA0669" , "J2CA0669E: The resource adapter " + "did not provide a CallerPrincipalCallback, an execution subject containing a single principal, or an empty " + "execution subject." ) ; throw new WSSecurityException ( message ) ; } else { // End 673415 // As per the JCA 1.6 Spec ( 16.4.5 ) the CallerPrincipalCallback should always be called except if the // Resource Adapter wants to establish the UNAUTHENTICATED Identity by passing in an empty // subject or when it passes a single principal in the principal set of the subject in which // case we handle it like a CallerPrincipalCallback is passed with that principal . if ( principals . isEmpty ( ) ) { CallerPrincipalCallback cpCallback = new CallerPrincipalCallback ( executionSubject , ( String ) null ) ; handler . handle ( new Callback [ ] { cpCallback } ) ; } else if ( principals . size ( ) == 1 ) { CallerPrincipalCallback cpCallback = new CallerPrincipalCallback ( executionSubject , principals . iterator ( ) . next ( ) ) ; executionSubject . getPrincipals ( ) . clear ( ) ; // 673415 handler . handle ( new Callback [ ] { cpCallback } ) ; } else { String message = nls . getString ( "CALLERPRINCIPAL_NOT_PROVIDED_J2CA0669" , "J2CA0669E: The resource adapter " + "did not provide a CallerPrincipalCallback, an execution subject containing a single principal, or an empty " + "execution subject." ) ; throw new WSSecurityException ( message ) ; } // Refresh the cred variable since we are calling the handler here . cred = J2CSecurityHelper . getCustomCredentials ( executionSubject , handler . getCacheKey ( ) ) ; } // Do a custom hashtable login to get the runAs subject and set it on a ThreadLocal // so that we can retrieve it later in the WorkProxy to establish as the RunAs and Caller // subject . final String userName = ( String ) cred . get ( AttributeNameConstants . WSCREDENTIAL_SECURITYNAME ) ; Subject runAsSubject = null ; if ( userName . equals ( credService . getUnauthenticatedUserid ( ) ) ) { runAsSubject = unauthSubjService . getUnauthenticatedSubject ( ) ; } else { final AuthenticationService authServ = authService ; PrivilegedExceptionAction < Subject > loginAction = new PrivilegedExceptionAction < Subject > ( ) { @ Override public Subject run ( ) throws Exception { return authServ . authenticate ( JaasLoginConfigConstants . SYSTEM_DEFAULT , executionSubject ) ; } } ; runAsSubject = AccessController . doPrivileged ( loginAction ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "The RunAs subject is created after a successful login." ) ; } J2CSecurityHelper . setRunAsSubject ( runAsSubject ) ; } catch ( RuntimeException e ) { Tr . error ( tc , "SECURITY_CONTEXT_NOT_ASSOCIATED_J2CA0671" , e ) ; String message = nls . getString ( "SECURITY_CONTEXT_NOT_ASSOCIATED_J2CA0671" , "J2CA0671E: The WorkManager was unable to associate the inflown SecurityContext to the Work instance." ) ; WorkCompletedException workCompEx = new WorkCompletedException ( message , WorkException . INTERNAL ) ; workCompEx . initCause ( e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } throw workCompEx ; } catch ( Exception e ) { Tr . error ( tc , "SECURITY_CONTEXT_NOT_ASSOCIATED_J2CA0671" , e ) ; String message = nls . getString ( "SECURITY_CONTEXT_NOT_ASSOCIATED_J2CA0671" , "J2CA0671E: The WorkManager was unable to associate the inflown SecurityContext to the Work instance." ) ; WorkCompletedException workCompEx = new WorkCompletedException ( message , WorkException . INTERNAL ) ; workCompEx . initCause ( e ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } throw workCompEx ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "associate" , "Application security is not enabled for the application server." ) ; } }
public class ModMessageManager { /** * Registers a message handler . < br > * If no instance for the message handler is passed , only static methods will be registered to handle messages . * @ param mod the mod * @ param messageHandlerClass the message handler class * @ param messageHandler the message handler */ private static void register ( IMalisisMod mod , Class < ? > messageHandlerClass , Object messageHandler ) { } }
Method [ ] methods = messageHandlerClass . getMethods ( ) ; for ( Method method : methods ) { ModMessage ann = method . getAnnotation ( ModMessage . class ) ; if ( ann == null ) continue ; String name = ann . value ( ) . equals ( "" ) ? method . getName ( ) : ann . value ( ) ; boolean isStatic = Modifier . isStatic ( method . getModifiers ( ) ) ; // only register static methods if no instance is passed if ( isStatic || ( messageHandler != null ) ) messages . put ( mod . getModId ( ) + ":" + name , Pair . of ( isStatic ? null : messageHandler , method ) ) ; // MalisisCore . log . info ( " Registered mod message " + mod . getModId ( ) + " : " + name + " in " // + messageHandler . getClass ( ) . getSimpleName ( ) ) ; }
public class BatchDetectDominantLanguageResult { /** * A list of objects containing the results of the operation . The results are sorted in ascending order by the * < code > Index < / code > field and match the order of the documents in the input list . If all of the documents contain * an error , the < code > ResultList < / code > is empty . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setResultList ( java . util . Collection ) } or { @ link # withResultList ( java . util . Collection ) } if you want to * override the existing values . * @ param resultList * A list of objects containing the results of the operation . The results are sorted in ascending order by * the < code > Index < / code > field and match the order of the documents in the input list . If all of the * documents contain an error , the < code > ResultList < / code > is empty . * @ return Returns a reference to this object so that method calls can be chained together . */ public BatchDetectDominantLanguageResult withResultList ( BatchDetectDominantLanguageItemResult ... resultList ) { } }
if ( this . resultList == null ) { setResultList ( new java . util . ArrayList < BatchDetectDominantLanguageItemResult > ( resultList . length ) ) ; } for ( BatchDetectDominantLanguageItemResult ele : resultList ) { this . resultList . add ( ele ) ; } return this ;
public class FastByteArrayProvider { /** * Returns a byte array of the specified length . * Note that the returned array may have been used before and therefore the array ' s values are not guaranteed to be * < code > 0 < / code > . * The method consecutively checks { @ link # arrays } for an array of the correct length . If such an array exists , it * will be moved to one index position closer to the front of the array ( if possible ) , speeding up future retrievals * of the same array . * @ param length the length of the returned array * @ return a byte array of the specified length */ public byte [ ] getArray ( final int length ) { } }
for ( int i = 0 ; i < size ; ++ i ) { if ( length == arrays [ i ] . length ) { // swap ( if not already at the front ) and return if ( i > 0 ) { tmp = arrays [ i ] ; arrays [ i ] = arrays [ i - 1 ] ; arrays [ i - 1 ] = tmp ; return tmp ; } // no swapping , so element was and still is at the front of the // list return arrays [ 0 ] ; } } // requested array does not exist , add to tail of queue , tmp = new byte [ length ] ; if ( size == capacity ) -- size ; // replace last element arrays [ size ] = tmp ; ++ size ; return tmp ;
public class dnssrvrec { /** * Use this API to update dnssrvrec resources . */ public static base_responses update ( nitro_service client , dnssrvrec resources [ ] ) throws Exception { } }
base_responses result = null ; if ( resources != null && resources . length > 0 ) { dnssrvrec updateresources [ ] = new dnssrvrec [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new dnssrvrec ( ) ; updateresources [ i ] . domain = resources [ i ] . domain ; updateresources [ i ] . target = resources [ i ] . target ; updateresources [ i ] . priority = resources [ i ] . priority ; updateresources [ i ] . weight = resources [ i ] . weight ; updateresources [ i ] . port = resources [ i ] . port ; updateresources [ i ] . ttl = resources [ i ] . ttl ; } result = update_bulk_request ( client , updateresources ) ; } return result ;
public class PropertyDoc { /** * Trims off the first word of the specified string and capitalizes the * new first word */ private static final String trimFirstWord ( String s ) { } }
s = s . trim ( ) ; char [ ] chars = s . toCharArray ( ) ; int firstSpace = - 1 ; for ( int i = 0 ; i < chars . length ; i ++ ) { char c = chars [ i ] ; if ( Character . isWhitespace ( c ) ) { firstSpace = i ; break ; } } if ( firstSpace == - 1 ) { return s ; } s = s . substring ( firstSpace ) . trim ( ) ; s = capitalize ( s ) ; return s ;
public class FessMessages { /** * Add the created action message for the key ' success . delete _ doc _ from _ index ' with parameters . * < pre > * message : Started a process to delete the document from index . * < / pre > * @ param property The property name for the message . ( NotNull ) * @ return this . ( NotNull ) */ public FessMessages addSuccessDeleteDocFromIndex ( String property ) { } }
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( SUCCESS_delete_doc_from_index ) ) ; return this ;
public class XMLOutputter { /** * Sets the capacity for the stack of open elements . The new capacity must * at least allow the stack to contain the current open elements . * @ param newCapacity the new capacity , & gt ; = { @ link # getElementStackSize ( ) } . * @ throws IllegalArgumentException if < code > newCapacity & lt ; { @ link # getElementStackSize ( ) } < / code > . * @ throws OutOfMemoryError if a new array cannot be allocated ; this object will still be usable , * but the capacity will remain unchanged . */ public final void setElementStackCapacity ( int newCapacity ) throws IllegalArgumentException , OutOfMemoryError { } }
// Check argument if ( newCapacity < _elementStack . length ) { throw new IllegalArgumentException ( "newCapacity < getElementStackSize()" ) ; } int currentCapacity = _elementStack . length ; // Short - circuit if possible if ( currentCapacity == newCapacity ) { return ; } String [ ] newStack = new String [ newCapacity ] ; System . arraycopy ( _elementStack , 0 , newStack , 0 , _elementStackSize ) ; _elementStack = newStack ; // State has changed , check checkInvariants ( ) ;
public class CmsWebdavServlet { /** * Copy the contents of the specified input stream to the specified * output stream , and ensure that both streams are closed before returning * ( even in the face of an exception ) . < p > * @ param item the RepositoryItem * @ param ostream the output stream to write to * @ param ranges iterator of the ranges the client wants to retrieve * @ param contentType the content type of the resource * @ throws IOException if an input / output error occurs */ protected void copy ( I_CmsRepositoryItem item , ServletOutputStream ostream , Iterator < CmsWebdavRange > ranges , String contentType ) throws IOException { } }
IOException exception = null ; while ( ( exception == null ) && ( ranges . hasNext ( ) ) ) { InputStream resourceInputStream = new ByteArrayInputStream ( item . getContent ( ) ) ; InputStream istream = new BufferedInputStream ( resourceInputStream , m_input ) ; CmsWebdavRange currentRange = ranges . next ( ) ; // Writing MIME header . ostream . println ( ) ; ostream . println ( "--" + MIME_SEPARATION ) ; if ( contentType != null ) { ostream . println ( "Content-Type: " + contentType ) ; } ostream . println ( "Content-Range: bytes " + currentRange . getStart ( ) + "-" + currentRange . getEnd ( ) + "/" + currentRange . getLength ( ) ) ; ostream . println ( ) ; // Printing content exception = copyRange ( istream , ostream , currentRange . getStart ( ) , currentRange . getEnd ( ) ) ; try { istream . close ( ) ; } catch ( Exception e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_CLOSE_INPUT_STREAM_0 ) , e ) ; } } } ostream . println ( ) ; ostream . print ( "--" + MIME_SEPARATION + "--" ) ; // Rethrow any exception that has occurred if ( exception != null ) { throw exception ; }
public class AbstractSession { /** * Get a previously calculated output * @ param enforceExistence If true : throw an exception if the array does not exist */ public T get ( String variable , String frame , int iteration , FrameIter parentFrameIter , boolean enforceExistence ) { } }
// TODO eventually we ' ll cache and reuse VarId objects here to avoid garbage generation on lookup etc VarId varId = newVarId ( variable , frame , iteration , parentFrameIter ) ; T out = nodeOutputs . get ( varId ) ; if ( enforceExistence ) { Preconditions . checkNotNull ( out , "No output found for variable %s (frame %s, iteration %s)" , variable , frame , iteration ) ; } return out ;
public class BoyerMoore { /** * Makes the jump table based on the mismatched character information . */ private static int [ ] makeCharTable ( byte [ ] needle ) { } }
int [ ] table = new int [ ALPHABET_SIZE ] ; int l = needle . length ; for ( int i = 0 ; i < ALPHABET_SIZE ; ++ i ) { table [ i ] = l ; } l -- ; for ( int i = 0 ; i < l ; ++ i ) { table [ needle [ i ] & 0xff ] = l - i ; } return table ;
public class Matrix4f { /** * Set < code > this < / code > matrix to < code > T * R * S * M < / code > , where < code > T < / code > is a translation by the given < code > ( tx , ty , tz ) < / code > , * < code > R < / code > is a rotation - and possibly scaling - transformation specified by the quaternion < code > ( qx , qy , qz , qw ) < / code > , < code > S < / code > is a scaling transformation * which scales the three axes x , y and z by < code > ( sx , sy , sz ) < / code > and < code > M < / code > is an { @ link # isAffine ( ) affine } matrix . * When transforming a vector by the resulting matrix the transformation described by < code > M < / code > will be applied first , then the scaling , then rotation and * at last the translation . * When used with a right - handed coordinate system , the produced rotation will rotate a vector * counter - clockwise around the rotation axis , when viewing along the negative axis direction towards the origin . * When used with a left - handed coordinate system , the rotation is clockwise . * This method is equivalent to calling : < code > translation ( tx , ty , tz ) . rotate ( quat ) . scale ( sx , sy , sz ) . mulAffine ( m ) < / code > * @ see # translation ( float , float , float ) * @ see # rotate ( Quaternionfc ) * @ see # scale ( float , float , float ) * @ see # mulAffine ( Matrix4fc ) * @ param tx * the number of units by which to translate the x - component * @ param ty * the number of units by which to translate the y - component * @ param tz * the number of units by which to translate the z - component * @ param qx * the x - coordinate of the vector part of the quaternion * @ param qy * the y - coordinate of the vector part of the quaternion * @ param qz * the z - coordinate of the vector part of the quaternion * @ param qw * the scalar part of the quaternion * @ param sx * the scaling factor for the x - axis * @ param sy * the scaling factor for the y - axis * @ param sz * the scaling factor for the z - axis * @ param m * the { @ link # isAffine ( ) affine } matrix to multiply by * @ return this */ public Matrix4f translationRotateScaleMulAffine ( float tx , float ty , float tz , float qx , float qy , float qz , float qw , float sx , float sy , float sz , Matrix4f m ) { } }
float w2 = qw * qw ; float x2 = qx * qx ; float y2 = qy * qy ; float z2 = qz * qz ; float zw = qz * qw ; float xy = qx * qy ; float xz = qx * qz ; float yw = qy * qw ; float yz = qy * qz ; float xw = qx * qw ; float nm00 = w2 + x2 - z2 - y2 ; float nm01 = xy + zw + zw + xy ; float nm02 = xz - yw + xz - yw ; float nm10 = - zw + xy - zw + xy ; float nm11 = y2 - z2 + w2 - x2 ; float nm12 = yz + yz + xw + xw ; float nm20 = yw + xz + xz + yw ; float nm21 = yz + yz - xw - xw ; float nm22 = z2 - y2 - x2 + w2 ; float m00 = nm00 * m . m00 + nm10 * m . m01 + nm20 * m . m02 ; float m01 = nm01 * m . m00 + nm11 * m . m01 + nm21 * m . m02 ; this . _m02 ( nm02 * m . m00 + nm12 * m . m01 + nm22 * m . m02 ) ; this . _m00 ( m00 ) ; this . _m01 ( m01 ) ; this . _m03 ( 0.0f ) ; float m10 = nm00 * m . m10 + nm10 * m . m11 + nm20 * m . m12 ; float m11 = nm01 * m . m10 + nm11 * m . m11 + nm21 * m . m12 ; this . _m12 ( nm02 * m . m10 + nm12 * m . m11 + nm22 * m . m12 ) ; this . _m10 ( m10 ) ; this . _m11 ( m11 ) ; this . _m13 ( 0.0f ) ; float m20 = nm00 * m . m20 + nm10 * m . m21 + nm20 * m . m22 ; float m21 = nm01 * m . m20 + nm11 * m . m21 + nm21 * m . m22 ; this . _m22 ( nm02 * m . m20 + nm12 * m . m21 + nm22 * m . m22 ) ; this . _m20 ( m20 ) ; this . _m21 ( m21 ) ; this . _m23 ( 0.0f ) ; float m30 = nm00 * m . m30 + nm10 * m . m31 + nm20 * m . m32 + tx ; float m31 = nm01 * m . m30 + nm11 * m . m31 + nm21 * m . m32 + ty ; this . _m32 ( nm02 * m . m30 + nm12 * m . m31 + nm22 * m . m32 + tz ) ; this . _m30 ( m30 ) ; this . _m31 ( m31 ) ; this . _m33 ( 1.0f ) ; boolean one = Math . abs ( sx ) == 1.0f && Math . abs ( sy ) == 1.0f && Math . abs ( sz ) == 1.0f ; _properties ( PROPERTY_AFFINE | ( one && ( m . properties & PROPERTY_ORTHONORMAL ) != 0 ? PROPERTY_ORTHONORMAL : 0 ) ) ; return this ;
public class RESTService { /** * Attempt to match the given REST request to a registered command . If it does , return * the corresponding { @ link RegisteredCommand } and update the given variable map with * decoded URI variables . For example , if the matching command is defined as : * < pre > * GET / { application } / { table } / _ query ? { query } * < / pre > * And the actual request passed is : * < pre > * GET / Magellan / Stars / _ query ? q = Tarantula + Nebula % 2A * < pre > * The variable map will be returned with the follow key / value pairs : * < pre > * application = Magellan * table = Stars * query = Tarantula + Nebula % 2A * < / pre > * Note that URI - encoded parameter values remain encoded in the variable map . * @ param appDef { @ link ApplicationDefinition } of application that provides * context for command , if any . Null for system commands . * @ param method { @ link HttpMethod } of the request . * @ param uri Request URI ( case - sensitive : " / Magellan / Stars / _ query " ) * @ param query Optional query parameter ( case - sensitive : " q = Tarantula + Nebula % 2A " ) . * @ param variableMap Variable parameters defined in the REST command substituted with * the actual values passed , not decoded ( see above ) . * @ return The { @ link RegisteredCommand } if a match was found , otherwise null . */ public RegisteredCommand findCommand ( ApplicationDefinition appDef , HttpMethod method , String uri , String query , Map < String , String > variableMap ) { } }
String cmdOwner = null ; if ( appDef != null ) { StorageService ss = SchemaService . instance ( ) . getStorageService ( appDef ) ; cmdOwner = ss . getClass ( ) . getSimpleName ( ) ; } return m_cmdRegistry . findCommand ( cmdOwner , method , uri , query , variableMap ) ;
public class PID { /** * Command - line interactive tester . If one arg given , prints normalized form * of that PID and exits . If no args , enters interactive mode . */ public static void main ( String [ ] args ) throws Exception { } }
if ( args . length > 0 ) { PID p = new PID ( args [ 0 ] ) ; System . out . println ( "Normalized : " + p . toString ( ) ) ; System . out . println ( "To filename : " + p . toFilename ( ) ) ; System . out . println ( "From filename : " + PID . fromFilename ( p . toFilename ( ) ) . toString ( ) ) ; } else { System . out . println ( "--------------------------------------" ) ; System . out . println ( "PID Syntax Checker - Interactive mode" ) ; System . out . println ( "--------------------------------------" ) ; boolean done = false ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( System . in ) ) ; while ( ! done ) { try { System . out . print ( "Enter a PID (ENTER to exit): " ) ; String line = reader . readLine ( ) ; if ( line . isEmpty ( ) ) { done = true ; } else { PID p = new PID ( line ) ; System . out . println ( "Normalized : " + p . toString ( ) ) ; System . out . println ( "To filename : " + p . toFilename ( ) ) ; System . out . println ( "From filename : " + PID . fromFilename ( p . toFilename ( ) ) . toString ( ) ) ; } } catch ( MalformedPIDException e ) { System . out . println ( "ERROR: " + e . getMessage ( ) ) ; } } }
public class LoopInfo { /** * set all fields of the loop info * @ param currentIndex current index * @ param effectiveIndex the times ' last loop value ' has been modified * @ param lastRes last loop result * @ return < code > this < / code > */ public LoopInfo < R > setValues ( int currentIndex , int effectiveIndex , R lastRes ) { } }
this . currentIndex = currentIndex ; this . effectiveIndex = effectiveIndex ; this . lastRes = lastRes ; return this ;
public class FnInteger { /** * It returns the { @ link String } representation of the target as a currency in the * default { @ link Locale } * @ return the { @ link String } representation of the input as a currency */ public static final Function < Integer , String > toCurrencyStr ( ) { } }
return ( Function < Integer , String > ) ( ( Function ) FnNumber . toCurrencyStr ( ) ) ;
public class ConfigurationItem { /** * A mapping of key value tags associated with the resource . * @ param tags * A mapping of key value tags associated with the resource . * @ return Returns a reference to this object so that method calls can be chained together . */ public ConfigurationItem withTags ( java . util . Map < String , String > tags ) { } }
setTags ( tags ) ; return this ;
public class ResourceAssignment { /** * Set a cost value . * @ param index cost index ( 1-10) * @ param value cost value */ public void setCost ( int index , Number value ) { } }
set ( selectField ( AssignmentFieldLists . CUSTOM_COST , index ) , value ) ;
public class StreamletImpl { /** * Set the id of the stream to be used by the children nodes . * Usage ( assuming source is a Streamlet object with two output streams : stream1 and stream2 ) : * source . withStream ( " stream1 " ) . filter ( . . . ) . log ( ) ; * source . withStream ( " stream2 " ) . filter ( . . . ) . log ( ) ; * @ param streamId The specified stream id * @ return Returns back the Streamlet with changed stream id */ @ SuppressWarnings ( "HiddenField" ) @ Override public Streamlet < R > withStream ( String streamId ) { } }
checkNotBlank ( streamId , "streamId can't be empty" ) ; Set < String > availableIds = getAvailableStreamIds ( ) ; if ( availableIds . contains ( streamId ) ) { return new StreamletShadow < R > ( this ) { @ Override public String getStreamId ( ) { return streamId ; } } ; } else { throw new RuntimeException ( String . format ( "Stream id %s is not available in %s. Available ids are: %s." , streamId , getName ( ) , availableIds . toString ( ) ) ) ; }
public class Lockable { /** * Accessors for locking state . Minimal self - checking ; primitive results */ private boolean is_locked ( Key < Job > job_key ) { } }
if ( _lockers == null ) return false ; for ( int i = ( _lockers . length == 1 ? 0 : 1 ) ; i < _lockers . length ; i ++ ) { Key k = _lockers [ i ] ; if ( job_key == k || ( job_key != null && k != null && job_key . equals ( k ) ) ) return true ; } return false ;
public class WSJdbcResultSet { /** * Gets the name of the SQL cursor used by this ResultSet . * In SQL , a result table is retrieved through a cursor that is named . The current row of a result can be updated or * deleted using a positioned update / delete statement that references the cursor name . To insure that the cursor has the * proper isolation level to support update , the cursor ' s select statement should be of the form ' select for update ' . If the * ' for update ' clause is omitted the positioned updates may fail . * JDBC supports this SQL feature by providing the name of the SQL cursor used by a ResultSet . The current row of a * ResultSet is also the current row of this SQL cursor . * Note : If positioned update is not supported a SQLException is thrown * @ return * the ResultSet ' s SQL cursor name * @ throws SQLException if a database access error occurs . */ public String getCursorName ( ) throws SQLException { } }
try { return rsetImpl . getCursorName ( ) ; } catch ( SQLException ex ) { FFDCFilter . processException ( ex , "com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getCursorName" , "1129" , this ) ; throw WSJdbcUtil . mapException ( this , ex ) ; } catch ( NullPointerException nullX ) { // No FFDC code needed ; we might be closed . throw runtimeXIfNotClosed ( nullX ) ; }
public class FeatureGenerators { /** * Applies { @ code featureGenerator } to each data point and * returns the sum of the resulting feature vectors . * @ param featureGenerator * @ param data * @ return */ public static < A , B > CountAccumulator < B > getFeatureCounts ( FeatureGenerator < A , B > featureGenerator , Collection < ? extends A > data ) { } }
MapReduceExecutor executor = MapReduceConfiguration . getMapReduceExecutor ( ) ; Mapper < A , Map < B , Double > > mapper = new FeatureCountMapper < A , B > ( featureGenerator ) ; Reducer < Map < B , Double > , CountAccumulator < B > > reducer = new FeatureCountReducer < B > ( ) ; return executor . mapReduce ( data , mapper , reducer ) ;
public class WTree { /** * { @ inheritDoc } */ @ Override protected void initialiseComponentModel ( ) { } }
super . initialiseComponentModel ( ) ; // Copy the custom tree ( if set ) to allow the nodes to be updated per user TreeItemIdNode custom = getCustomTree ( ) ; if ( custom != null ) { TreeItemIdNode copy = TreeItemUtil . copyTreeNode ( custom ) ; setCustomTree ( copy ) ; }
public class ObjectUtils { /** * This method tries to map the values of the given object on the valueModels of the formModel . Instead of * setting the object as a backing object , all valueModels are processed one by one and the corresponding * property value is fetched from the objectToMap and set on that valueModel . This triggers the usual * buffering etc . just as if the user entered the values . * @ param formModel * @ param objectToMap */ public static void mapObjectOnFormModel ( FormModel formModel , Object objectToMap ) { } }
BeanWrapper beanWrapper = new BeanWrapperImpl ( objectToMap ) ; for ( String fieldName : ( Set < String > ) formModel . getFieldNames ( ) ) { try { formModel . getValueModel ( fieldName ) . setValue ( beanWrapper . getPropertyValue ( fieldName ) ) ; } catch ( BeansException be ) { // silently ignoring , just mapping values , so if there ' s one missing , don ' t bother } }
public class GradleDependencyResolutionHelper { /** * Get the collection of Gradle projects along with their GAV definitions . This collection is used for determining if an * artifact specification represents a Gradle project or not . * @ param project the Gradle project that is being analyzed . * @ return a map of GAV coordinates for each of the available projects ( returned as keys ) . */ private static Map < String , Project > getAllProjects ( final Project project ) { } }
return getCachedReference ( project , "thorntail_project_gav_collection" , ( ) -> { Map < String , Project > gavMap = new HashMap < > ( ) ; project . getRootProject ( ) . getAllprojects ( ) . forEach ( p -> { gavMap . put ( p . getGroup ( ) + ":" + p . getName ( ) + ":" + p . getVersion ( ) , p ) ; } ) ; return gavMap ; } ) ;
public class StringUtil { /** * Tests a string array , to see if all items are null or an empty string . * @ param pStringArray The string array to check . * @ return true if the string array is null or only contains string items * that are null or contain only whitespace , otherwise false . */ public static boolean isEmpty ( String [ ] pStringArray ) { } }
// No elements to test if ( pStringArray == null ) { return true ; } // Test all the elements for ( String string : pStringArray ) { if ( ! isEmpty ( string ) ) { return false ; } } // All elements are empty return true ;
public class TaskClient { /** * Ack for the task poll . * @ param taskId Id of the task to be polled * @ param workerId user identified worker . * @ return true if the task was found with the given ID and acknowledged . False otherwise . If the server returns false , the client should NOT attempt to ack again . */ public Boolean ack ( String taskId , String workerId ) { } }
Preconditions . checkArgument ( StringUtils . isNotBlank ( taskId ) , "Task id cannot be blank" ) ; String response = postForEntity ( "tasks/{taskId}/ack" , null , new Object [ ] { "workerid" , workerId } , String . class , taskId ) ; return Boolean . valueOf ( response ) ;
public class TranslationsResource { /** * Update translation for the given locale . * @ param keyName key name * @ param representation translation representation * @ return status code 204 ( no content ) or 404 ( not found ) if key or target translation is null . */ @ PUT @ Path ( "/{key}" ) @ Consumes ( MediaType . APPLICATION_JSON ) @ Produces ( MediaType . APPLICATION_JSON ) @ RequiresPermissions ( I18nPermissions . TRANSLATION_WRITE ) public Response updateTranslation ( @ PathParam ( "key" ) String keyName , TranslationRepresentation representation ) { } }
WebAssertions . assertNotNull ( representation , "The translation should not be null" ) ; TranslationValueRepresentation translationToUpdate = representation . getTarget ( ) ; WebAssertions . assertNotNull ( translationToUpdate , "The translation target should not be null" ) ; Key key = keyRepository . get ( keyName ) . orElseThrow ( ( ) -> new NotFoundException ( "The key is not found" ) ) ; key . addTranslation ( locale , translationToUpdate . getTranslation ( ) , translationToUpdate . isApprox ( ) ) ; keyRepository . update ( key ) ; return Response . noContent ( ) . build ( ) ;
public class Matrices { /** * Creates a 2D orthographic projection matrix . This method is analogous to the now * deprecated { @ code gluOrtho2D } method . * @ param left left vertical clipping plane * @ param right right vertical clipping plane * @ param bottom bottom horizontal clipping plane * @ param top top horizontal clipping plane * @ return */ public static final Mat4 ortho2d ( final float left , final float right , final float bottom , final float top ) { } }
final float m00 = 2f / ( right - left ) ; final float m11 = 2f / ( top - bottom ) ; final float m22 = - 1f ; final float m30 = - ( right + left ) / ( right - left ) ; final float m31 = - ( top + bottom ) / ( top - bottom ) ; return new Mat4 ( m00 , 0f , 0f , 0f , 0f , m11 , 0f , 0f , 0f , 0f , m22 , 0f , m30 , m31 , 0f , 1f ) ;
public class LoggerFactory { /** * Gets an { @ link XMLResourceBundle } wrapped SLF4J { @ link org . slf4j . Logger } . * @ param aClass A class to use for the logger name * @ param aBundleName The name of the resource bundle to use * @ return A resource bundle aware logger */ public static Logger getLogger ( final Class < ? > aClass , final String aBundleName ) { } }
return getLogger ( aClass . getName ( ) , aBundleName ) ;