signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class AnnotationUtil { /** * 递归Class所有的Annotation , 一个最彻底的实现 . * 包括所有基类 , 所有接口的Annotation , 同时支持Spring风格的Annotation继承的父Annotation , */ public static Set < Annotation > getAllAnnotations ( final Class < ? > cls ) { } }
List < Class < ? > > allTypes = ClassUtil . getAllSuperclasses ( cls ) ; allTypes . addAll ( ClassUtil . getAllInterfaces ( cls ) ) ; allTypes . add ( cls ) ; Set < Annotation > anns = new HashSet < Annotation > ( ) ; for ( Class < ? > type : allTypes ) { anns . addAll ( Arrays . asList ( type . getDeclaredAnnotations ( ) ) ) ; } Set < Annotation > superAnnotations = new HashSet < Annotation > ( ) ; for ( Annotation ann : anns ) { getSuperAnnotations ( ann . annotationType ( ) , superAnnotations ) ; } anns . addAll ( superAnnotations ) ; return anns ;
public class vpnformssoaction { /** * Use this API to add vpnformssoaction . */ public static base_response add ( nitro_service client , vpnformssoaction resource ) throws Exception { } }
vpnformssoaction addresource = new vpnformssoaction ( ) ; addresource . name = resource . name ; addresource . actionurl = resource . actionurl ; addresource . userfield = resource . userfield ; addresource . passwdfield = resource . passwdfield ; addresource . ssosuccessrule = resource . ssosuccessrule ; addresource . namevaluepair = resource . namevaluepair ; addresource . responsesize = resource . responsesize ; addresource . nvtype = resource . nvtype ; addresource . submitmethod = resource . submitmethod ; return addresource . add_resource ( client ) ;
public class DescribeResourceServerRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DescribeResourceServerRequest describeResourceServerRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( describeResourceServerRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( describeResourceServerRequest . getUserPoolId ( ) , USERPOOLID_BINDING ) ; protocolMarshaller . marshall ( describeResourceServerRequest . getIdentifier ( ) , IDENTIFIER_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class MockSupplier { /** * This method is responsible for invoking the provided * factory / supplier / function with the provided parameters . * @ param aProvidedParams * The parameter array . May be < code > null < / code > or empty . * @ return The mocked value . May be < code > null < / code > but that would be a * relatively rare case . */ @ Nullable public Object getMockedValue ( @ Nullable final Object [ ] aProvidedParams ) { } }
IGetterDirectTrait [ ] aEffectiveParams = null ; if ( m_aParams != null && m_aParams . length > 0 ) { // Parameters are present - convert all to IConvertibleTrait final int nRequiredParams = m_aParams . length ; final int nProvidedParams = ArrayHelper . getSize ( aProvidedParams ) ; aEffectiveParams = new IGetterDirectTrait [ nRequiredParams ] ; for ( int i = 0 ; i < nRequiredParams ; ++ i ) { if ( i < nProvidedParams && aProvidedParams [ i ] != null ) { // Param provided and not null - > use provided final Object aVal = aProvidedParams [ i ] ; aEffectiveParams [ i ] = ( ) -> aVal ; } else { // Not provided or null - > use default aEffectiveParams [ i ] = m_aParams [ i ] . getDefaultValue ( ) ; } } } return m_aFct . apply ( aEffectiveParams ) ;
public class GDLLoader { /** * Initializes a new edge from the given edge body context . * @ param edgeBodyContext edge body context * @ param isIncoming true , if it ' s an incoming edge , false for outgoing edge * @ return new edge */ private Edge initNewEdge ( GDLParser . EdgeBodyContext edgeBodyContext , boolean isIncoming ) { } }
boolean hasBody = edgeBodyContext != null ; Edge e = new Edge ( ) ; e . setId ( getNewEdgeId ( ) ) ; e . setSourceVertexId ( getSourceVertexId ( isIncoming ) ) ; e . setTargetVertexId ( getTargetVertexId ( isIncoming ) ) ; if ( hasBody ) { List < String > labels = getLabels ( edgeBodyContext . header ( ) ) ; e . setLabels ( labels . isEmpty ( ) ? useDefaultEdgeLabel ? Collections . singletonList ( defaultEdgeLabel ) : Collections . emptyList ( ) : labels ) ; e . setProperties ( getProperties ( edgeBodyContext . properties ( ) ) ) ; int [ ] range = parseEdgeLengthContext ( edgeBodyContext . edgeLength ( ) ) ; e . setLowerBound ( range [ 0 ] ) ; e . setUpperBound ( range [ 1 ] ) ; } else { if ( useDefaultEdgeLabel ) { e . setLabel ( defaultEdgeLabel ) ; } else { e . setLabel ( null ) ; } } return e ;
public class CommerceAccountLocalServiceBaseImpl { /** * Performs a dynamic query on the database and returns the matching rows . * @ param dynamicQuery the dynamic query * @ return the matching rows */ @ Override public < T > List < T > dynamicQuery ( DynamicQuery dynamicQuery ) { } }
return commerceAccountPersistence . findWithDynamicQuery ( dynamicQuery ) ;
public class FunctorFactory { /** * Create a functor with parameter , wrapping a call to another method . * @ param instanceClass * class containing the method . * @ param methodName * Name of the method , it must exist . * @ return a Functor with parameter that call the specified method on the specified instance . * @ throws Exception if there is a problem to deal with . */ public static FunctorWithParameter instanciateFunctorWithParameterAsAClassMethodWrapper ( Class < ? > instanceClass , String methodName ) throws Exception { } }
if ( null == instanceClass ) { throw new NullPointerException ( "instanceClass is null" ) ; } Method _method = instanceClass . getMethod ( methodName , ( Class < ? > [ ] ) null ) ; return instanciateFunctorWithParameterAsAMethodWrapper ( null , _method ) ;
public class UtilFile { /** * Get the files list from directory . * @ param directory The directory reference ( must not be < code > null < / code > ) . * @ return The directory content . * @ throws LionEngineException If invalid argument or not a directory . */ public static List < File > getFiles ( File directory ) { } }
Check . notNull ( directory ) ; if ( directory . isDirectory ( ) ) { final File [ ] files = directory . listFiles ( ) ; if ( files != null ) { return Arrays . asList ( files ) ; } } throw new LionEngineException ( ERROR_DIRECTORY + directory . getPath ( ) ) ;
public class BaseMessageTransport { /** * Here is an incoming message . * Figure out what it is and process it . * Note : the caller should have logged this message since I have no way to serialize the raw data . * @ param messageReplyIn - The incoming message * @ param messageOut - The ( optional ) outgoing message that this is a reply to ( null if unknown ) . * @ return The converted reply message . */ public BaseMessage convertExternalReplyToInternal ( BaseMessage messageReplyIn , BaseMessage messageOut ) { } }
if ( messageReplyIn . getExternalMessage ( ) == null ) if ( messageReplyIn . getMessage ( ) != null ) return messageReplyIn ; // Probably an error reply message String strMessageProcessType = this . getMessageProcessType ( messageReplyIn ) ; String strMessageInfoType = this . getMessageInfoType ( messageReplyIn ) ; if ( MessageTypeModel . MESSAGE_IN . equals ( strMessageProcessType ) ) { // Process a normal message request . String strMessageCode = this . getMessageCode ( messageReplyIn ) ; String strMessageVersion = this . getMessageVersion ( messageReplyIn ) ; if ( strMessageVersion == null ) strMessageVersion = this . getTask ( ) . getProperty ( "version" ) ; Record recMessageProcessInfo = this . getRecord ( MessageProcessInfoModel . MESSAGE_PROCESS_INFO_FILE ) ; if ( recMessageProcessInfo == null ) recMessageProcessInfo = Record . makeRecordFromClassName ( MessageProcessInfoModel . THICK_CLASS , this ) ; this . addMessageTransportType ( messageReplyIn ) ; // This will insure I get the transport properties ( ( MessageProcessInfoModel ) recMessageProcessInfo ) . setupMessageHeaderFromCode ( messageReplyIn , strMessageCode , strMessageVersion ) ; messageReplyIn . createMessageDataDesc ( ) ; } // x this . createExternalMessage ( messageReplyIn , messageReplyIn . getExternalMessage ( ) . getRawData ( ) ) ; / / Convert the external format to the correct class ( if necessary ) // Step 3 - Unmarshall the message into the standard form . int iErrorCode = messageReplyIn . getExternalMessage ( ) . convertExternalToInternal ( this ) ; String strTrxID = this . logMessage ( null , messageReplyIn , strMessageInfoType , strMessageProcessType , MessageStatusModel . RECEIVED , null , null ) ; Utility . getLogger ( ) . info ( "processIncommingMessage type: in " + messageReplyIn ) ; if ( messageOut != null ) if ( messageReplyIn . getMessageDataDesc ( null ) instanceof MessageRecordDesc ) // Always ( ( MessageRecordDesc ) messageReplyIn . getMessageDataDesc ( null ) ) . moveRequestInfoToReply ( messageOut ) ; if ( ( iErrorCode != DBConstants . NORMAL_RETURN ) || ( messageReplyIn . getExternalMessage ( ) == null ) || ( messageReplyIn . getExternalMessage ( ) . getRawData ( ) == null ) ) { // Set error return message : message type unknown String strMessageError = this . getTask ( ) . getLastError ( iErrorCode ) ; if ( ( strMessageError == null ) || ( strMessageError . length ( ) == 0 ) ) strMessageError = "Error converting to internal format" ; if ( messageReplyIn . getMessageHeader ( ) instanceof TrxMessageHeader ) if ( ( ( TrxMessageHeader ) messageReplyIn . getMessageHeader ( ) ) . get ( TrxMessageHeader . MESSAGE_ERROR ) != null ) strMessageError = ( ( TrxMessageHeader ) messageReplyIn . getMessageHeader ( ) ) . get ( TrxMessageHeader . MESSAGE_ERROR ) . toString ( ) ; this . logMessage ( strTrxID , messageReplyIn , strMessageInfoType , strMessageProcessType , MessageStatusModel . ERROR , strMessageError , null ) ; return BaseMessageProcessor . processErrorMessage ( this , messageReplyIn , strMessageError ) ; } return messageReplyIn ;
public class SyncAgentsInner { /** * Creates or updates a sync agent . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server on which the sync agent is hosted . * @ param syncAgentName The name of the sync agent . * @ param syncDatabaseId ARM resource id of the sync database in the sync agent . * @ 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 < SyncAgentInner > createOrUpdateAsync ( String resourceGroupName , String serverName , String syncAgentName , String syncDatabaseId , final ServiceCallback < SyncAgentInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( createOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , syncAgentName , syncDatabaseId ) , serviceCallback ) ;
public class Altimeter { /** * < editor - fold defaultstate = " collapsed " desc = " Image related " > */ private BufferedImage create_TICKMARKS_Image ( final int WIDTH , final double FREE_AREA_ANGLE , final double OFFSET , final double MIN_VALUE , final double MAX_VALUE , final double ANGLE_STEP , final int TICK_LABEL_PERIOD , final int SCALE_DIVIDER_POWER , final boolean DRAW_TICKS , final boolean DRAW_TICK_LABELS , java . util . ArrayList < Section > tickmarkSections , BufferedImage image ) { } }
if ( WIDTH <= 0 ) { return null ; } if ( image == null ) { image = UTIL . createImage ( WIDTH , WIDTH , Transparency . TRANSLUCENT ) ; } final Graphics2D G2 = image . createGraphics ( ) ; G2 . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , RenderingHints . VALUE_ANTIALIAS_ON ) ; // G2 . setRenderingHint ( RenderingHints . KEY _ RENDERING , RenderingHints . VALUE _ RENDER _ QUALITY ) ; // G2 . setRenderingHint ( RenderingHints . KEY _ DITHERING , RenderingHints . VALUE _ DITHER _ ENABLE ) ; // G2 . setRenderingHint ( RenderingHints . KEY _ ALPHA _ INTERPOLATION , RenderingHints . VALUE _ ALPHA _ INTERPOLATION _ QUALITY ) ; // G2 . setRenderingHint ( RenderingHints . KEY _ COLOR _ RENDERING , RenderingHints . VALUE _ COLOR _ RENDER _ QUALITY ) ; G2 . setRenderingHint ( RenderingHints . KEY_STROKE_CONTROL , RenderingHints . VALUE_STROKE_NORMALIZE ) ; G2 . setRenderingHint ( RenderingHints . KEY_TEXT_ANTIALIASING , RenderingHints . VALUE_TEXT_ANTIALIAS_ON ) ; final int IMAGE_WIDTH = image . getWidth ( ) ; final int IMAGE_HEIGHT = image . getHeight ( ) ; final Font STD_FONT = new Font ( "Verdana" , 0 , ( int ) ( 0.09 * WIDTH ) ) ; final BasicStroke MEDIUM_STROKE = new BasicStroke ( 2.0f , BasicStroke . CAP_ROUND , BasicStroke . JOIN_BEVEL ) ; final BasicStroke THIN_STROKE = new BasicStroke ( 1.5f , BasicStroke . CAP_ROUND , BasicStroke . JOIN_BEVEL ) ; final int TEXT_DISTANCE = ( int ) ( 0.17 * WIDTH ) ; final int MED_LENGTH = ( int ) ( 0.05 * WIDTH ) ; final int MAX_LENGTH = ( int ) ( 0.07 * WIDTH ) ; final Color TEXT_COLOR = super . getBackgroundColor ( ) . LABEL_COLOR ; final Color TICK_COLOR = super . getBackgroundColor ( ) . LABEL_COLOR ; // Create the ticks itself final float RADIUS = IMAGE_WIDTH * 0.4f ; final Point2D ALTIMETER_CENTER = new Point2D . Double ( IMAGE_WIDTH / 2.0f , IMAGE_HEIGHT / 2.0f ) ; // Draw ticks Point2D innerPoint ; Point2D outerPoint ; Point2D textPoint = null ; Line2D tick ; int counter = 0 ; int tickCounter = 0 ; G2 . setFont ( STD_FONT ) ; double sinValue = 0 ; double cosValue = 0 ; double alpha ; // angle for the tickmarks final double ALPHA_START = - OFFSET - ( FREE_AREA_ANGLE / 2.0 ) ; float valueCounter ; // value for the tickmarks for ( alpha = ALPHA_START , valueCounter = 0 ; valueCounter <= 10 ; alpha -= ANGLE_STEP * 0.1 , valueCounter += 0.1 ) { G2 . setStroke ( THIN_STROKE ) ; sinValue = Math . sin ( alpha ) ; cosValue = Math . cos ( alpha ) ; // tickmark every 2 units if ( counter % 2 == 0 ) { G2 . setStroke ( THIN_STROKE ) ; innerPoint = new Point2D . Double ( ALTIMETER_CENTER . getX ( ) + ( RADIUS - MED_LENGTH ) * sinValue , ALTIMETER_CENTER . getY ( ) + ( RADIUS - MED_LENGTH ) * cosValue ) ; outerPoint = new Point2D . Double ( ALTIMETER_CENTER . getX ( ) + RADIUS * sinValue , ALTIMETER_CENTER . getY ( ) + RADIUS * cosValue ) ; // Draw ticks G2 . setColor ( TICK_COLOR ) ; tick = new Line2D . Double ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; G2 . draw ( tick ) ; } // Different tickmark every 10 units if ( counter == 10 || counter == 0 ) { G2 . setColor ( TEXT_COLOR ) ; G2 . setStroke ( MEDIUM_STROKE ) ; innerPoint = new Point2D . Double ( ALTIMETER_CENTER . getX ( ) + ( RADIUS - MAX_LENGTH ) * sinValue , ALTIMETER_CENTER . getY ( ) + ( RADIUS - MAX_LENGTH ) * cosValue ) ; outerPoint = new Point2D . Double ( ALTIMETER_CENTER . getX ( ) + RADIUS * sinValue , ALTIMETER_CENTER . getY ( ) + RADIUS * cosValue ) ; textPoint = new Point2D . Double ( ALTIMETER_CENTER . getX ( ) + ( RADIUS - TEXT_DISTANCE + STD_FONT . getSize ( ) / 2f ) * sinValue , ALTIMETER_CENTER . getY ( ) + ( RADIUS - TEXT_DISTANCE + STD_FONT . getSize ( ) / 2f ) * cosValue + TEXT_DISTANCE / 2.5f ) ; // Draw text final TextLayout TEXT_LAYOUT = new TextLayout ( String . valueOf ( Math . round ( valueCounter ) ) , G2 . getFont ( ) , RENDER_CONTEXT ) ; final Rectangle2D TEXT_BOUNDARY = TEXT_LAYOUT . getBounds ( ) ; // if gauge is full circle , avoid painting maxValue over minValue if ( FREE_AREA_ANGLE == 0 ) { if ( Float . compare ( valueCounter , 10 ) != 0 ) { G2 . drawString ( String . valueOf ( Math . round ( valueCounter ) ) , ( int ) ( textPoint . getX ( ) - TEXT_BOUNDARY . getWidth ( ) / 2.0 ) , ( int ) ( ( textPoint . getY ( ) - TEXT_BOUNDARY . getHeight ( ) / 2.0 ) ) ) ; } } else { G2 . drawString ( String . valueOf ( Math . round ( valueCounter ) ) , ( int ) ( textPoint . getX ( ) - TEXT_BOUNDARY . getWidth ( ) / 2.0 ) , ( int ) ( ( textPoint . getY ( ) - TEXT_BOUNDARY . getHeight ( ) / 2.0 ) ) ) ; } counter = 0 ; tickCounter ++ ; // Draw ticks G2 . setColor ( TICK_COLOR ) ; tick = new Line2D . Double ( innerPoint . getX ( ) , innerPoint . getY ( ) , outerPoint . getX ( ) , outerPoint . getY ( ) ) ; G2 . draw ( tick ) ; } counter ++ ; } G2 . dispose ( ) ; return image ;
public class Panel { /** * Fields contained in this panel . */ public List < Field > getFields ( Entity entity , String operationId , PMSecurityUser user ) { } }
final String [ ] fs = getFields ( ) . split ( "[ ]" ) ; final List < Field > result = new ArrayList < Field > ( ) ; for ( String string : fs ) { final Field field = entity . getFieldById ( string ) ; if ( field != null ) { if ( operationId == null || field . shouldDisplay ( operationId , user ) ) { result . add ( field ) ; } } } return result ;
public class Db { /** * Main database initialization . To be called only when _ ds is a valid DataSource . */ private void init ( boolean upgrade ) { } }
initAdapter ( ) ; initQueries ( ) ; if ( upgrade ) { dbUpgrade ( ) ; } // First contact with the DB is version checking ( if no connection opened by pool ) . // If DB is in wrong version or not available , just wait for it to be ready . boolean versionValid = false ; while ( ! versionValid ) { try { checkSchemaVersion ( ) ; versionValid = true ; } catch ( Exception e ) { String msg = e . getLocalizedMessage ( ) ; if ( e . getCause ( ) != null ) { msg += " - " + e . getCause ( ) . getLocalizedMessage ( ) ; } jqmlogger . error ( "Database not ready: " + msg + ". Waiting for database..." ) ; try { Thread . sleep ( 10000 ) ; } catch ( Exception e2 ) { } } }
public class MongoService { /** * Declarative Services method for unsetting the SSL Support service reference * @ param ref reference to the service */ protected void unsetSsl ( ServiceReference < Object > reference ) { } }
sslConfigurationRef . unsetReference ( reference ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( this , tc , "sslRef unset" ) ; }
public class JmsJcaActivationSpecImpl { /** * Set the MaxSequentialMessageFailure property * @ param maxSequentialMessageFailure The maximum number of failed messages */ @ Override public void setMaxSequentialMessageFailure ( final String maxSequentialMessageFailure ) { } }
_maxSequentialMessageFailure = ( maxSequentialMessageFailure == null ? null : Integer . valueOf ( maxSequentialMessageFailure ) ) ;
public class Metrics { /** * Measures the distribution of samples . * @ param name The base metric name * @ param tags MUST be an even number of arguments representing key / value pairs of tags . * @ return A new or existing distribution summary . */ public static DistributionSummary summary ( String name , String ... tags ) { } }
return globalRegistry . summary ( name , tags ) ;
public class ZipChemCompProvider { /** * Add an array of files to a zip archive . * Synchronized to prevent simultaneous reading / writing . * @ param zipFile is a destination zip archive * @ param files is an array of files to be added * @ param pathWithinArchive is the path within the archive to add files to * @ return true if successfully appended these files . */ private synchronized boolean addToZipFileSystem ( Path zipFile , File [ ] files , Path pathWithinArchive ) { } }
boolean ret = false ; /* URIs in Java 7 cannot have spaces , must use Path instead * and so , cannot use the properties map to describe need to create * a new zip archive . ZipChemCompProvider . initilizeZip to creates the * missing zip file */ /* / / convert the filename to a URI String uriString = " jar : file : " + zipFile . toUri ( ) . getPath ( ) ; final URI uri = URI . create ( uriString ) ; / / if filesystem doesn ' t exist , create one . final Map < String , String > env = new HashMap < > ( ) ; / / Create a new zip if one isn ' t present . if ( ! zipFile . toFile ( ) . exists ( ) ) { System . out . println ( " Need to create " + zipFile . toString ( ) ) ; env . put ( " create " , String . valueOf ( ! zipFile . toFile ( ) . exists ( ) ) ) ; / / Specify the encoding as UTF - 8 env . put ( " encoding " , " UTF - 8 " ) ; */ // Copy in each file . try ( FileSystem zipfs = FileSystems . newFileSystem ( zipFile , null ) ) { Files . createDirectories ( pathWithinArchive ) ; for ( File f : files ) { if ( ! f . isDirectory ( ) && f . exists ( ) ) { Path externalFile = f . toPath ( ) ; Path pathInZipFile = zipfs . getPath ( pathWithinArchive . resolve ( f . getName ( ) ) . toString ( ) ) ; Files . copy ( externalFile , pathInZipFile , StandardCopyOption . REPLACE_EXISTING ) ; } } ret = true ; } catch ( IOException ex ) { s_logger . error ( "Unable to add entries to Chemical Component zip archive : " + ex . getMessage ( ) ) ; ret = false ; } return ret ;
public class LogManager { /** * Returns a formatter Logger using the fully qualified name of the value ' s Class as the Logger name . * This logger let you use a { @ link java . util . Formatter } string in the message to format parameters . * Short - hand for { @ code getLogger ( value , StringFormatterMessageFactory . INSTANCE ) } * @ param value The value ' s whose class name should be used as the Logger name . * @ return The Logger , created with a { @ link StringFormatterMessageFactory } * @ throws UnsupportedOperationException if { @ code value } is { @ code null } and the calling class cannot be * determined . * @ see Logger # fatal ( Marker , String , Object . . . ) * @ see Logger # fatal ( String , Object . . . ) * @ see Logger # error ( Marker , String , Object . . . ) * @ see Logger # error ( String , Object . . . ) * @ see Logger # warn ( Marker , String , Object . . . ) * @ see Logger # warn ( String , Object . . . ) * @ see Logger # info ( Marker , String , Object . . . ) * @ see Logger # info ( String , Object . . . ) * @ see Logger # debug ( Marker , String , Object . . . ) * @ see Logger # debug ( String , Object . . . ) * @ see Logger # trace ( Marker , String , Object . . . ) * @ see Logger # trace ( String , Object . . . ) * @ see StringFormatterMessageFactory */ public static Logger getFormatterLogger ( final Object value ) { } }
return getLogger ( value != null ? value . getClass ( ) : StackLocatorUtil . getCallerClass ( 2 ) , StringFormatterMessageFactory . INSTANCE ) ;
public class PhotosApi { /** * Remove a tag from a photo . * < br > * This method requires authentication with ' write ' permission . * < br > * The tagId parameter must be the full tag id . Methods such as photos . getInfo will return the full tag id as the * " tagId " parameter ; other methods , such as addTags , will return the full tag id in the " fullTagId " parameter . If * this method does not seem to work , make sure you are passing the correct tag id . * @ param tagId tag to remove from the photo . This parameter should contain the full tag id . * @ return response object indicating the result of the requested operation . * @ throws JinxException if the parameter is null or empty , or if there are any errors . * @ see < a href = " https : / / www . flickr . com / services / api / flickr . photos . removeTag . html " > flickr . photos . removeTag < / a > */ public Response removeTag ( String tagId ) throws JinxException { } }
JinxUtils . validateParams ( tagId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.photos.removeTag" ) ; params . put ( "tag_id" , tagId ) ; return jinx . flickrPost ( params , Response . class ) ;
public class TimeUtils { /** * parseToSeconds duration string like ' nYnMnDnHnMnS ' to seconds * @ param timeStr duration string like ' nYnMnDnHnMnS ' * @ return duration in seconds */ public static int parseDurationString ( String timeStr ) { } }
int seconds = 0 ; Matcher matcher = timeStringPattern . matcher ( timeStr ) ; while ( matcher . find ( ) ) { String s = matcher . group ( ) ; String [ ] parts = s . split ( "(?<=[yMwdhms])(?=\\d)|(?<=\\d)(?=[yMwdhms])" ) ; int numb = Integer . parseInt ( parts [ 0 ] ) ; String type = parts [ 1 ] ; switch ( type ) { case "s" : seconds = seconds + ( numb ) ; break ; case "m" : seconds = seconds + ( numb * 60 ) ; break ; case "h" : seconds = seconds + ( numb * 60 * 60 ) ; break ; case "d" : seconds = seconds + ( numb * 60 * 60 * 24 ) ; break ; case "w" : seconds = seconds + ( numb * 60 * 60 * 24 * 7 ) ; break ; case "M" : seconds = seconds + ( numb * 60 * 60 * 24 * 30 ) ; break ; case "y" : seconds = seconds + ( numb * 60 * 60 * 24 * 365 ) ; break ; default : } } return seconds ;
public class NoResponseListener { /** * Returns the NoResponseListener instance registered with the Batcher . * @ param batcher the Batcher instance for which the registered * NoResponseListener is returned * @ return the NoResponseListener instance with the batcher or null if there * is no NoResponseListener registered * @ throws IllegalStateException if the passed Batcher is neither a * QueryBatcher nor a WriteBatcher */ public static NoResponseListener getInstance ( Batcher batcher ) { } }
if ( batcher instanceof WriteBatcher ) { WriteFailureListener [ ] writeFailureListeners = ( ( WriteBatcher ) batcher ) . getBatchFailureListeners ( ) ; for ( WriteFailureListener writeFailureListener : writeFailureListeners ) { if ( writeFailureListener instanceof NoResponseListener ) { return ( NoResponseListener ) writeFailureListener ; } } } else if ( batcher instanceof QueryBatcher ) { QueryFailureListener [ ] queryFailureListeners = ( ( QueryBatcher ) batcher ) . getQueryFailureListeners ( ) ; for ( QueryFailureListener queryFailureListener : queryFailureListeners ) { if ( queryFailureListener instanceof NoResponseListener ) { return ( NoResponseListener ) queryFailureListener ; } } } else { throw new IllegalStateException ( "The Batcher should be either a QueryBatcher instance or a WriteBatcher instance" ) ; } return null ;
public class ScrollBarButtonPainter { /** * DOCUMENT ME ! * @ param g DOCUMENT ME ! * @ param width DOCUMENT ME ! * @ param height DOCUMENT ME ! */ private void paintBackgroundCap ( Graphics2D g , int width , int height ) { } }
Shape s = shapeGenerator . createScrollCap ( 0 , 0 , width , height ) ; dropShadow . fill ( g , s ) ; fillScrollBarButtonInteriorColors ( g , s , isIncrease , buttonsTogether ) ;
public class JsonWebKey { /** * Verifies if the key is an RSA key . */ private void checkRSACompatible ( ) { } }
if ( ! JsonWebKeyType . RSA . equals ( kty ) && ! JsonWebKeyType . RSA_HSM . equals ( kty ) ) { throw new UnsupportedOperationException ( "Not an RSA key" ) ; }
public class DeleteConnectionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteConnectionRequest deleteConnectionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteConnectionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteConnectionRequest . getConnectionId ( ) , CONNECTIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class LanguageServiceClient { /** * Finds named entities ( currently proper names and common nouns ) in the text along with entity * types , salience , mentions for each entity , and other properties . * < p > Sample code : * < pre > < code > * try ( LanguageServiceClient languageServiceClient = LanguageServiceClient . create ( ) ) { * Document document = Document . newBuilder ( ) . build ( ) ; * EncodingType encodingType = EncodingType . NONE ; * AnalyzeEntitiesResponse response = languageServiceClient . analyzeEntities ( document , encodingType ) ; * < / code > < / pre > * @ param document Input document . * @ param encodingType The encoding type used by the API to calculate offsets . * @ throws com . google . api . gax . rpc . ApiException if the remote call fails */ public final AnalyzeEntitiesResponse analyzeEntities ( Document document , EncodingType encodingType ) { } }
AnalyzeEntitiesRequest request = AnalyzeEntitiesRequest . newBuilder ( ) . setDocument ( document ) . setEncodingType ( encodingType ) . build ( ) ; return analyzeEntities ( request ) ;
public class CompilingLoader { /** * Compile the Java source . Compile errors are encapsulated in a * ClassNotFound wrapper . * @ param javaSource path to the Java source */ void compileClass ( Source javaSource , Source javaClass , String sourcePath , boolean isMake ) throws ClassNotFoundException { } }
try { JavaCompilerUtil compiler = JavaCompilerUtil . create ( getClassLoader ( ) ) ; compiler . setClassDir ( _classDir ) ; compiler . setSourceDir ( _sourceDir ) ; if ( _encoding != null ) compiler . setEncoding ( _encoding ) ; compiler . setArgs ( _args ) ; compiler . setCompileParent ( ! isMake ) ; compiler . setSourceExtension ( _sourceExt ) ; if ( _compiler != null ) compiler . setCompiler ( _compiler ) ; // LineMap lineMap = new LineMap ( javaFile . getNativePath ( ) ) ; // The context path is obvious from the browser url // lineMap . add ( name . replace ( ' . ' , ' / ' ) + _ sourceExt , 1 , 1 ) ; // Force this into a relative path so different compilers will work String prefix = _sourceDir . getPath ( ) ; String full = javaSource . getPath ( ) ; String source ; if ( full . startsWith ( prefix ) ) { source = full . substring ( prefix . length ( ) ) ; if ( source . startsWith ( "/" ) ) source = source . substring ( 1 ) ; } else source = javaSource . getPath ( ) ; /* if ( javaSource . canRead ( ) & & javaClass . exists ( ) ) javaClass . remove ( ) ; */ compiler . compileIfModified ( source , null ) ; } catch ( Exception e ) { // getClassLoader ( ) . addDependency ( new Depend ( javaSource ) ) ; log . log ( Level . FINEST , e . toString ( ) , e ) ; // Compile errors are wrapped in a special ClassNotFound class // so the server can give a nice error message throw new CompileClassNotFound ( e ) ; }
public class AuditLogEntry { /** * Constructs a filtered , immutable list of options corresponding to * the provided { @ link net . dv8tion . jda . core . audit . AuditLogOption AuditLogOptions } . * < br > This will exclude options with { @ code null } values ! * @ param options * The not - null { @ link net . dv8tion . jda . core . audit . AuditLogOption AuditLogOptions } * which will be used to gather option values via { @ link # getOption ( AuditLogOption ) getOption ( AuditLogOption ) } ! * @ throws java . lang . IllegalArgumentException * If provided with null options * @ return Unmodifiable list of representative values */ public List < Object > getOptions ( AuditLogOption ... options ) { } }
Checks . notNull ( options , "Options" ) ; List < Object > items = new ArrayList < > ( options . length ) ; for ( AuditLogOption option : options ) { Object obj = getOption ( option ) ; if ( obj != null ) items . add ( obj ) ; } return Collections . unmodifiableList ( items ) ;
public class TxExecutionContextHandler { /** * Overridden in WAS */ protected JCATranWrapper createWrapper ( int timeout , Xid xid , JCARecoveryData jcard ) throws WorkCompletedException /* @512190C */ { } }
return new JCATranWrapperImpl ( timeout , xid , jcard ) ; // @ D240298C
public class XmlTarget { /** * { @ inheritDoc } */ @ SuppressWarnings ( { } }
"unchecked" } ) public void importItem ( Object item ) { try { XMLStreamWriter writer = m_xmlWriter ; Map < String , String > nsMap = m_namespaceMap ; boolean hasDecendants = ! m_elements . isEmpty ( ) ; if ( hasDecendants ) { writer . writeStartElement ( m_itemElementName ) ; } else { writer . writeEmptyElement ( m_itemElementName ) ; } Map < String , Object > convertedItem = ( Map < String , Object > ) item ; for ( Property property : m_attributes ) { String prefix = property . getNamespacePrefix ( ) ; if ( prefix == null ) { prefix = "" ; } String localName = property . getLocalName ( ) ; String namespace = nsMap . get ( prefix ) ; if ( namespace == null ) { namespace = "" ; } writer . writeAttribute ( prefix , namespace , localName , convertedItem . get ( localName ) . toString ( ) ) ; } for ( Property property : m_elements ) { String prefix = property . getNamespacePrefix ( ) == null ? "" : property . getNamespacePrefix ( ) ; String localName = property . getLocalName ( ) ; String namespace = nsMap . get ( prefix ) == null ? "" : nsMap . get ( prefix ) ; writer . writeStartElement ( prefix , localName , namespace ) ; writer . writeCharacters ( convertedItem . get ( localName ) . toString ( ) ) ; writer . writeEndElement ( ) ; } if ( hasDecendants ) { writer . writeEndElement ( ) ; } } catch ( XMLStreamException e ) { throw new RuntimeException ( e ) ; }
public class AnnotationUtils { /** * Returns true if any annotation in parameterAnnotations matches annotationClass . * @ param parameterAnnotations Annotations to inspect . * @ param annotationClass Annotation to find . * @ return true if any annotation in parameterAnnotations matches annotationClass , else false . */ private static boolean hasAnnotation ( Annotation [ ] parameterAnnotations , Class < ? extends Annotation > annotationClass ) { } }
for ( Annotation annotation : parameterAnnotations ) { if ( annotation . annotationType ( ) . equals ( annotationClass ) ) { return true ; } } return false ;
public class ActionNonTxAware { /** * Executes the action * @ param arg the argument to use to execute the action * @ return the result of the action * @ throws E if an error occurs while executing the action */ protected R execute ( A ... arg ) throws E { } }
if ( arg == null || arg . length == 0 ) { return execute ( ( A ) null ) ; } return execute ( arg [ 0 ] ) ;
public class VisitRegistry { /** * Get the list of unvisited positions . * @ return list of unvisited positions . */ public ArrayList < Integer > getUnvisited ( ) { } }
if ( 0 == this . unvisitedCount ) { return new ArrayList < Integer > ( ) ; } ArrayList < Integer > res = new ArrayList < Integer > ( this . unvisitedCount ) ; for ( int i = 0 ; i < this . registry . length ; i ++ ) { if ( ZERO == this . registry [ i ] ) { res . add ( i ) ; } } return res ;
public class ListVolumeRecoveryPointsResult { /** * An array of < a > VolumeRecoveryPointInfo < / a > objects . * @ param volumeRecoveryPointInfos * An array of < a > VolumeRecoveryPointInfo < / a > objects . */ public void setVolumeRecoveryPointInfos ( java . util . Collection < VolumeRecoveryPointInfo > volumeRecoveryPointInfos ) { } }
if ( volumeRecoveryPointInfos == null ) { this . volumeRecoveryPointInfos = null ; return ; } this . volumeRecoveryPointInfos = new com . amazonaws . internal . SdkInternalList < VolumeRecoveryPointInfo > ( volumeRecoveryPointInfos ) ;
public class EventDataDeserializer { /** * Deserializes the JSON payload contained in an event ' s { @ code data } attribute into an * { @ link EventData } instance . */ @ Override public EventData deserialize ( JsonElement json , Type typeOfT , JsonDeserializationContext context ) throws JsonParseException { } }
EventData eventData = new EventData ( ) ; JsonObject jsonObject = json . getAsJsonObject ( ) ; for ( Map . Entry < String , JsonElement > entry : jsonObject . entrySet ( ) ) { String key = entry . getKey ( ) ; JsonElement element = entry . getValue ( ) ; if ( "previous_attributes" . equals ( key ) ) { if ( element . isJsonNull ( ) ) { eventData . setPreviousAttributes ( null ) ; } else if ( element . isJsonObject ( ) ) { Map < String , Object > previousAttributes = UNTYPED_MAP_DESERIALIZER . deserialize ( element . getAsJsonObject ( ) ) ; eventData . setPreviousAttributes ( previousAttributes ) ; } } else if ( "object" . equals ( key ) ) { eventData . setObject ( entry . getValue ( ) . getAsJsonObject ( ) ) ; } } return eventData ;
public class Widget { /** * Sets the { @ linkplain GVRMaterial # setMainTexture ( GVRTexture ) main texture } * of the { @ link Widget } . * @ param bitmapId * Resource ID of the bitmap to create the texture from . */ public void setTexture ( final int bitmapId ) { } }
if ( bitmapId < 0 ) return ; final GVRAndroidResource resource = new GVRAndroidResource ( mContext . getContext ( ) , bitmapId ) ; setTexture ( mContext . getAssetLoader ( ) . loadTexture ( resource ) ) ;
public class ResourceReader { /** * Reset to the start by reconstructing the stream and readers . * We could also use mark ( ) and reset ( ) on the stream or reader , * but that would cause them to keep the stream data around in * memory . We don ' t want that because some of the resource files * are large , e . g . , 400k . */ private void _reset ( ) throws UnsupportedEncodingException { } }
try { close ( ) ; } catch ( IOException e ) { } if ( lineNo == 0 ) { return ; } InputStream is = ICUData . getStream ( root , resourceName ) ; if ( is == null ) { throw new IllegalArgumentException ( "Can't open " + resourceName ) ; } InputStreamReader isr = ( encoding == null ) ? new InputStreamReader ( is ) : new InputStreamReader ( is , encoding ) ; reader = new BufferedReader ( isr ) ; lineNo = 0 ;
public class SoyTemplateViewResolver { /** * Remove beginning and ending slashes , then replace all occurrences of / with . * @ param viewName * The Spring viewName * @ return The name of the view , dot separated . */ private String normalize ( final String viewName ) { } }
String normalized = viewName ; if ( normalized . startsWith ( "/" ) ) { normalized = normalized . substring ( 0 ) ; } if ( normalized . endsWith ( "/" ) ) { normalized = normalized . substring ( 0 , normalized . length ( ) - 1 ) ; } return normalized . replaceAll ( "/" , "." ) ;
public class QueryExprListener { /** * { @ inheritDoc } */ @ Override public void exitSourceElements ( QueryParser . SourceElementsContext ctx ) { } }
infoMap = null ; queryExprMeta = null ; queryExprMetaList = Collections . unmodifiableList ( queryExprMetaList ) ;
public class SpeechRecognitionResult { /** * Returns how many results have been recoginized . Usually there is only one result but if multiple rules in * the grammar match multiple results may be returned . * @ return the number of results recognized . */ public int getNumberOfResults ( ) { } }
final String numberOfResults = agiReply . getAttribute ( "results" ) ; return numberOfResults == null ? 0 : Integer . parseInt ( numberOfResults ) ;
public class RoboSputnik { /** * public PackageResourceLoader createResourceLoader ( ResourcePath resourcePath ) { */ protected ShadowMap createShadowMap ( ) { } }
synchronized ( RoboSputnik . class ) { if ( mainShadowMap != null ) return mainShadowMap ; mainShadowMap = new ShadowMap . Builder ( ) . build ( ) ; return mainShadowMap ; }
public class SpaceCharacters { /** * Write a number of whitespaces to a writer * @ param num * @ param out */ public static void indent ( int num , PrintWriter out ) { } }
if ( num <= SIXTY_FOUR ) { out . write ( SIXTY_FOUR_SPACES , 0 , num ) ; return ; } else if ( num <= 128 ) { out . write ( SIXTY_FOUR_SPACES , 0 , SIXTY_FOUR ) ; out . write ( SIXTY_FOUR_SPACES , 0 , num - SIXTY_FOUR ) ; } else { int times = num / SIXTY_FOUR ; int rem = num % SIXTY_FOUR ; for ( int i = 0 ; i < times ; i ++ ) { out . write ( SIXTY_FOUR_SPACES , 0 , SIXTY_FOUR ) ; } out . write ( SIXTY_FOUR_SPACES , 0 , rem ) ; return ; }
public class MessageCenterFragment { /** * / * Guarded */ public void savePendingComposingMessage ( ) { } }
Editable content = getPendingComposingContent ( ) ; SharedPreferences prefs = ApptentiveInternal . getInstance ( ) . getGlobalSharedPrefs ( ) ; SharedPreferences . Editor editor = prefs . edit ( ) ; ConversationProxy conversation = getConversation ( ) ; assertNotNull ( conversation ) ; if ( conversation == null ) { return ; } if ( content != null ) { conversation . setMessageCenterPendingMessage ( content . toString ( ) . trim ( ) ) ; } else { conversation . setMessageCenterPendingMessage ( null ) ; } JSONArray pendingAttachmentsJsonArray = new JSONArray ( ) ; // Save pending attachment for ( ImageItem pendingAttachment : pendingAttachments ) { pendingAttachmentsJsonArray . put ( pendingAttachment . toJSON ( ) ) ; } if ( pendingAttachmentsJsonArray . length ( ) > 0 ) { conversation . setMessageCenterPendingAttachments ( pendingAttachmentsJsonArray . toString ( ) ) ; } else { conversation . setMessageCenterPendingAttachments ( null ) ; } editor . apply ( ) ;
public class CaffeineCacheMetrics { /** * Record metrics on a Caffeine cache . You must call { @ link Caffeine # recordStats ( ) } prior to building the cache * for metrics to be recorded . * @ param registry The registry to bind metrics to . * @ param cache The cache to instrument . * @ param cacheName Will be used to tag metrics with " cache " . * @ param tags Tags to apply to all recorded metrics . Must be an even number of arguments representing key / value pairs of tags . * @ param < C > The cache type . * @ return The instrumented cache , unchanged . The original cache is not wrapped or proxied in any way . */ public static < C extends AsyncCache < ? , ? > > C monitor ( MeterRegistry registry , C cache , String cacheName , String ... tags ) { } }
return monitor ( registry , cache , cacheName , Tags . of ( tags ) ) ;
public class Configure { /** * 获取标签策略 * @ param tagName * 模板名称 * @ param sign * 语法 */ public RenderPolicy getPolicy ( String tagName , Character sign ) { } }
RenderPolicy policy = getCustomPolicy ( tagName ) ; return null == policy ? getDefaultPolicy ( sign ) : policy ;
public class DownloadProperties { /** * Builds a new DownloadProperties for downloading Galaxy from github using wget . * @ param branch The branch to download ( e . g . master , dev , release _ 15.03 ) . * @ param destination The destination directory to store Galaxy , null if a directory * should be chosen by default . * @ return A DownloadProperties for downloading Galaxy from github using wget . */ public static DownloadProperties wgetGithub ( final String branch , final File destination ) { } }
return new DownloadProperties ( new WgetGithubDownloader ( branch ) , destination ) ;
public class ScopeImpl { /** * Install the provider of the class { @ code clazz } and name { @ code bindingName } * in the current scope . * @ param clazz the class for which to install the scoped provider . * @ param bindingName the name , possibly { @ code null } , for which to install the scoped provider . * @ param internalProvider the internal provider to install . * @ param isTestProvider whether or not is a test provider , installed through a Test Module that should override * existing providers for the same class - bindingname . * @ param < T > the type of { @ code clazz } . */ private < T > InternalProviderImpl < ? extends T > installBoundProvider ( Class < T > clazz , String bindingName , InternalProviderImpl < ? extends T > internalProvider , boolean isTestProvider ) { } }
return installInternalProvider ( clazz , bindingName , internalProvider , true , isTestProvider ) ;
public class MSDelegatingXAResource { /** * Used at transaction recovery time to retrieve the list on indoubt XIDs known * to the MessageStore instance associated with this MSDelegatingXAResource . * @ param recoveryId The recovery id of the RM to return indoubt XIDs from * @ return The list of indoubt XIDs currently known by the MessageStore associated with this XAResource * @ exception XAException * Thrown if an unexpected error occurs . */ public Xid [ ] recover ( int recoveryId ) throws XAException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "recover" , "Recovery ID=" + recoveryId ) ; Xid [ ] list = _manager . recover ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "recover" , "return=" + Arrays . toString ( list ) ) ; return list ;
public class StandardBullhornData { /** * { @ inheritDoc } */ @ Override public < T extends SearchEntity , L extends ListWrapper < T > > L search ( Class < T > type , String query , Set < String > fieldSet , SearchParams params ) { } }
return this . handleSearchForEntities ( type , query , fieldSet , params ) ;
public class Tree { /** * Change the priority of the desired stream / node . * Reset all the sibling weighted priorities and re - sort the siblings , since once on priority changes , all priority ratios need to be updated and changed . * @ param streamID * @ param newPriority * @ return the Node that was changed , null if the node could not be found */ public synchronized boolean changeNodePriority ( int streamID , int newPriority ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "changeNodePriority entry: streamID to change: " + streamID + " new Priority: " + newPriority ) ; } Node nodeToChange = root . findNode ( streamID ) ; Node parentNode = nodeToChange . getParent ( ) ; if ( ( nodeToChange == null ) || ( parentNode == null ) ) { return false ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "node to change: " + nodeToChange + " has parent node of: " + parentNode ) ; } // change the priority , clear the write counts and sort the nodes at that level in the tree nodeToChange . setPriority ( newPriority ) ; parentNode . clearDependentsWriteCount ( ) ; parentNode . sortDependents ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "changeNodePriority exit: node changed: " + nodeToChange . toStringDetails ( ) ) ; } return true ;
public class DatabaseMetaData { /** * { @ inheritDoc } */ public ResultSet getFunctions ( final String catalog , final String schemaPattern , final String functionNamePattern ) throws SQLException { } }
return RowLists . rowList6 ( String . class , String . class , String . class , String . class , Short . class , String . class ) . withLabel ( 1 , "FUNCTION_CAT" ) . withLabel ( 2 , "FUNCTION_SCHEM" ) . withLabel ( 3 , "FUNCTION_NAME" ) . withLabel ( 4 , "REMARKS" ) . withLabel ( 5 , "FUNCTION_TYPE" ) . withLabel ( 6 , "SPECIFIC_NAME" ) . resultSet ( ) ;
public class FormatUtil { /** * Formats the boolean array b with ' , ' as separator . * @ param b the boolean array to be formatted * @ param sep separator between the single values of the array , e . g . ' , ' * @ return a String representing the boolean array b */ public static String format ( boolean [ ] b , final String sep ) { } }
return ( b == null ) ? "null" : ( b . length == 0 ) ? "" : formatTo ( new StringBuilder ( ) , b , ", " ) . toString ( ) ;
import java . util . * ; public class DecimalToBinaryRepr { /** * Converts the given number in decimal to binary number in string format . * The converted binary number string has ' db ' characters for formatting , at * the start and end of the string . * Args : * decimalNum : An integer in decimal form . * Returns : * binaryString : The binary format of the decimalNum as string . * Each character in the string represents a binary digit ( ' 0 ' or ' 1 ' ) , * with additional ' db ' characters at start and end for format . * Examples : * > > > decimalToBinaryRepr ( 15) * " db1111db " * > > > decimalToBinaryRepr ( 32) * " db100000db " */ public static String decimalToBinaryRepr ( int decimalNum ) { } }
String binaryString = "db" + Integer . toBinaryString ( decimalNum ) + "db" ; return binaryString ;
public class GivensRotation { /** * Applies the Givens rotation to two elements of a vector * @ param x * Vector to apply to * @ param i1 * Index of first element * @ param i2 * Index of second element */ public void apply ( Vector x , int i1 , int i2 ) { } }
double temp = c * x . get ( i1 ) + s * x . get ( i2 ) ; x . set ( i2 , - s * x . get ( i1 ) + c * x . get ( i2 ) ) ; x . set ( i1 , temp ) ;
public class CopyHelper { /** * Copy this object if needed . * @ param thing : this object that needs to be copied * @ return : a possibly copied instance * @ throws CopyNotSupportedException if thing needs to be copied but cannot be */ public static Object copy ( Object thing ) throws CopyNotSupportedException { } }
if ( ! isCopyable ( thing ) ) { throw new CopyNotSupportedException ( thing . getClass ( ) . getName ( ) + " cannot be copied. See Copyable" ) ; } if ( thing instanceof Copyable ) { return ( ( Copyable ) thing ) . copy ( ) ; } // Support for a few primitive types out of the box if ( thing instanceof byte [ ] ) { byte [ ] copy = new byte [ ( ( byte [ ] ) thing ) . length ] ; System . arraycopy ( thing , 0 , copy , 0 , ( ( byte [ ] ) thing ) . length ) ; return copy ; } // Assume that everything other type is immutable , not checking this again return thing ;
public class JMThread { /** * Build runnable with logging runnable . * @ param runnableName the runnable name * @ param runnable the runnable * @ param params the params * @ return the runnable */ public static Runnable buildRunnableWithLogging ( String runnableName , Runnable runnable , Object ... params ) { } }
return ( ) -> { JMLog . debug ( log , runnableName , System . currentTimeMillis ( ) , params ) ; runnable . run ( ) ; } ;
public class AbstractProject { /** * Helper method for getDownstreamRelationship . * For each given build , find the build number range of the given project and put that into the map . */ private void checkAndRecord ( AbstractProject that , TreeMap < Integer , RangeSet > r , Collection < R > builds ) { } }
for ( R build : builds ) { RangeSet rs = build . getDownstreamRelationship ( that ) ; if ( rs == null || rs . isEmpty ( ) ) continue ; int n = build . getNumber ( ) ; RangeSet value = r . get ( n ) ; if ( value == null ) r . put ( n , rs ) ; else value . add ( rs ) ; }
public class LcdsChampionTradeService { /** * Attempt to trade with the target player * @ param summonerInternalName The summoner ' s internal name , as sent by { @ link # getPotentialTraders ( ) } * @ param championId Unknown - id of sent champion ? id of trade ? * @ return unknown */ public Object attemptTrade ( String summonerInternalName , int championId ) { } }
return client . sendRpcAndWait ( SERVICE , "attemptTrade" , summonerInternalName , championId , false ) ;
public class Level { /** * < editor - fold defaultstate = " collapsed " desc = " Initialization " > */ @ Override public AbstractGauge init ( final int WIDTH , final int HEIGHT ) { } }
final int GAUGE_WIDTH = isFrameVisible ( ) ? WIDTH : getGaugeBounds ( ) . width ; final int GAUGE_HEIGHT = isFrameVisible ( ) ? HEIGHT : getGaugeBounds ( ) . height ; if ( isFrameVisible ( ) ) { setFramelessOffset ( 0 , 0 ) ; } else { setFramelessOffset ( getGaugeBounds ( ) . width * 0.0841121495 , getGaugeBounds ( ) . width * 0.0841121495 ) ; } if ( GAUGE_WIDTH <= 1 || GAUGE_HEIGHT <= 1 ) { return this ; } // Create Background Image if ( bImage != null ) { bImage . flush ( ) ; } bImage = UTIL . createImage ( GAUGE_WIDTH , GAUGE_WIDTH , java . awt . Transparency . TRANSLUCENT ) ; // Create Foreground Image if ( fImage != null ) { fImage . flush ( ) ; } fImage = UTIL . createImage ( GAUGE_WIDTH , GAUGE_WIDTH , java . awt . Transparency . TRANSLUCENT ) ; if ( isFrameVisible ( ) ) { switch ( getFrameType ( ) ) { case ROUND : FRAME_FACTORY . createRadialFrame ( GAUGE_WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; case SQUARE : FRAME_FACTORY . createLinearFrame ( GAUGE_WIDTH , GAUGE_WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; default : FRAME_FACTORY . createRadialFrame ( GAUGE_WIDTH , getFrameDesign ( ) , getCustomFrameDesign ( ) , getFrameEffect ( ) , bImage ) ; break ; } } if ( isBackgroundVisible ( ) ) { create_BACKGROUND_Image ( GAUGE_WIDTH , "" , "" , bImage ) ; } create_TICKMARKS_Image ( GAUGE_WIDTH , 0 , 0 , 0 , 0 , 0 , 0 , 0 , true , true , null , bImage ) ; if ( pointerImage != null ) { pointerImage . flush ( ) ; } pointerImage = create_POINTER_Image ( GAUGE_WIDTH ) ; if ( stepPointerImage != null ) { stepPointerImage . flush ( ) ; } stepPointerImage = create_STEPPOINTER_Image ( GAUGE_WIDTH ) ; if ( isForegroundVisible ( ) ) { switch ( getFrameType ( ) ) { case SQUARE : FOREGROUND_FACTORY . createLinearForeground ( GAUGE_WIDTH , GAUGE_WIDTH , false , bImage ) ; break ; case ROUND : default : FOREGROUND_FACTORY . createRadialForeground ( GAUGE_WIDTH , false , getForegroundType ( ) , fImage ) ; break ; } } if ( disabledImage != null ) { disabledImage . flush ( ) ; } disabledImage = create_DISABLED_Image ( GAUGE_WIDTH ) ; font = new java . awt . Font ( "Verdana" , 0 , ( int ) ( 0.15 * getWidth ( ) ) ) ; return this ;
public class BaseSecurityService { /** * Override to disconnect broker . */ @ Override public boolean logout ( boolean force , String target , String message ) { } }
boolean result = super . logout ( force , target , message ) ; if ( result ) { brokerSession . disconnect ( ) ; } return result ;
public class Messages { /** * Retrieves the configured message by property key * @ param key The key in the file * @ return The associated value in case the key is found in the message bundle file . If * no such key is defined , the returned value would be the key itself . */ public static String get ( MessageKey key ) { } }
return data . getProperty ( key . toString ( ) , key . toString ( ) ) ;
public class Cookies { /** * Removes a cookie by adding it with maxAge of zero . */ public static void removeCookie ( HttpServletRequest request , HttpServletResponse response , String cookieName , boolean secure , boolean contextOnlyPath ) { } }
addCookie ( request , response , cookieName , "Removed" , null , 0 , secure , contextOnlyPath ) ;
public class ListApiKeysResult { /** * The < code > ApiKey < / code > objects . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setApiKeys ( java . util . Collection ) } or { @ link # withApiKeys ( java . util . Collection ) } if you want to override * the existing values . * @ param apiKeys * The < code > ApiKey < / code > objects . * @ return Returns a reference to this object so that method calls can be chained together . */ public ListApiKeysResult withApiKeys ( ApiKey ... apiKeys ) { } }
if ( this . apiKeys == null ) { setApiKeys ( new java . util . ArrayList < ApiKey > ( apiKeys . length ) ) ; } for ( ApiKey ele : apiKeys ) { this . apiKeys . add ( ele ) ; } return this ;
public class StartRserve { /** * just a demo main method which starts Rserve and shuts it down again * @ param args . . . */ public static void main ( String [ ] args ) { } }
File dir = null ; System . out . println ( "checkLocalRserve: " + checkLocalRserve ( ) ) ; try { RConnection c = new RConnection ( ) ; // c . eval ( " cat ( ' 123 ' ) " ) ; dir = new File ( c . eval ( "getwd()" ) . asString ( ) ) ; System . err . println ( "wd: " + dir ) ; // c . eval ( " flush . console < - function ( . . . ) return ; " ) ; / / will crash without that . . . c . eval ( "download.file('https://www.r-project.org/',paste0(getwd(),'/log.txt'))" ) ; c . shutdown ( ) ; } catch ( Exception x ) { x . printStackTrace ( ) ; } if ( new File ( dir , "log.txt" ) . exists ( ) ) { System . err . println ( "OK: file exists" ) ; if ( new File ( dir , "log.txt" ) . length ( ) > 10 ) { System . err . println ( "OK: file not empty" ) ; } else { System . err . println ( "NO: file EMPTY" ) ; } } else { System . err . println ( "NO: file DOES NOT exist" ) ; }
public class CacheOnDisk { /** * Call this method to get the template ids based on the index and the length from the disk . * @ param index * If index = 0 , it starts the beginning . If index = 1 , it means " next " . If Index = - 1 , it means * " previous " . * @ param length * The max number of templates to be read . If length = - 1 , it reads all templates until the end . * @ return valueSet - the collection of templates . */ public ValueSet readTemplatesByRange ( int index , int length ) { } }
Result result = htod . readTemplatesByRange ( index , length ) ; if ( result . returnCode == HTODDynacache . DISK_EXCEPTION ) { stopOnError ( result . diskException ) ; this . htod . returnToResultPool ( result ) ; return HTODDynacache . EMPTY_VS ; } ValueSet valueSet = ( ValueSet ) result . data ; if ( valueSet == null ) { valueSet = HTODDynacache . EMPTY_VS ; } this . htod . returnToResultPool ( result ) ; return valueSet ;
public class JSRInlinerAdapter { /** * Performs a depth first search walking the normal byte code path starting * at < code > index < / code > , and adding each instruction encountered into the * subroutine < code > sub < / code > . After this walk is complete , iterates over * the exception handlers to ensure that we also include those byte codes * which are reachable through an exception that may be thrown during the * execution of the subroutine . Invoked from < code > markSubroutines ( ) < / code > . * @ param sub * the subroutine whose instructions must be computed . * @ param index * an instruction of this subroutine . * @ param anyvisited * indexes of the already visited instructions , i . e . marked as * part of this subroutine or any previously computed subroutine . */ private void markSubroutineWalk ( final BitSet sub , final int index , final BitSet anyvisited ) { } }
if ( LOGGING ) { log ( "markSubroutineWalk: sub=" + sub + " index=" + index ) ; } // First find those instructions reachable via normal execution markSubroutineWalkDFS ( sub , index , anyvisited ) ; // Now , make sure we also include any applicable exception handlers boolean loop = true ; while ( loop ) { loop = false ; for ( Iterator < TryCatchBlockNode > it = tryCatchBlocks . iterator ( ) ; it . hasNext ( ) ; ) { TryCatchBlockNode trycatch = it . next ( ) ; if ( LOGGING ) { // TODO use of default toString ( ) . log ( "Scanning try/catch " + trycatch ) ; } // If the handler has already been processed , skip it . int handlerindex = instructions . indexOf ( trycatch . handler ) ; if ( sub . get ( handlerindex ) ) { continue ; } int startindex = instructions . indexOf ( trycatch . start ) ; int endindex = instructions . indexOf ( trycatch . end ) ; int nextbit = sub . nextSetBit ( startindex ) ; if ( nextbit != - 1 && nextbit < endindex ) { if ( LOGGING ) { log ( "Adding exception handler: " + startindex + '-' + endindex + " due to " + nextbit + " handler " + handlerindex ) ; } markSubroutineWalkDFS ( sub , handlerindex , anyvisited ) ; loop = true ; } } }
public class UnsignedNumeric { /** * Reads a long stored in variable - length format . Reads between one and nine bytes . Smaller values take fewer * bytes . Negative numbers are not supported . */ public static long readUnsignedLong ( ObjectInput in ) throws IOException { } }
byte b = in . readByte ( ) ; long i = b & 0x7F ; for ( int shift = 7 ; ( b & 0x80 ) != 0 ; shift += 7 ) { b = in . readByte ( ) ; i |= ( b & 0x7FL ) << shift ; } return i ;
public class ReliabilityMatrixPrinter { /** * Print the reliability matrix for the given coding study . */ public void print ( final PrintStream out , final ICodingAnnotationStudy study ) { } }
// TODO : measure length of cats . maybe cut them . Map < Object , Integer > categories = new LinkedHashMap < Object , Integer > ( ) ; for ( Object cat : study . getCategories ( ) ) categories . put ( cat , categories . size ( ) ) ; final String DIVIDER = "\t" ; for ( int i = 0 ; i < study . getItemCount ( ) ; i ++ ) out . print ( DIVIDER + ( i + 1 ) ) ; out . print ( DIVIDER + "Σ" ) ; out . println ( ) ; for ( int r = 0 ; r < study . getRaterCount ( ) ; r ++ ) { out . print ( r + 1 ) ; for ( ICodingAnnotationItem item : study . getItems ( ) ) out . print ( DIVIDER + item . getUnit ( r ) . getCategory ( ) ) ; out . println ( ) ; } out . println ( ) ; for ( Object category : study . getCategories ( ) ) { out . print ( category ) ; int catSum = 0 ; for ( ICodingAnnotationItem item : study . getItems ( ) ) { int catCount = 0 ; for ( IAnnotationUnit unit : item . getUnits ( ) ) if ( category . equals ( unit . getCategory ( ) ) ) catCount ++ ; out . print ( DIVIDER + ( catCount > 0 ? catCount : "" ) ) ; catSum += catCount ; } out . println ( DIVIDER + catSum ) ; } /* for ( Object category : categories . keySet ( ) ) out . print ( DIVIDER + category ) ; out . print ( DIVIDER + " Σ " ) ; out . println ( ) ; int i = 0; int [ ] colSum = new int [ study . getCategoryCount ( ) ] ; for ( Object category1 : categories . keySet ( ) ) { out . print ( category1 ) ; int rowSum = 0; for ( int j = 0 ; j < categories . size ( ) ; j + + ) { out . printf ( DIVIDER + " % 3d " , frequencies [ i ] [ j ] ) ; rowSum + = frequencies [ i ] [ j ] ; colSum [ j ] + = frequencies [ i ] [ j ] ; out . printf ( DIVIDER + " % 3d " , rowSum ) ; out . println ( ) ; out . print ( " Σ " ) ; int rowSum = 0; for ( int j = 0 ; j < categories . size ( ) ; j + + ) { out . printf ( DIVIDER + " % 3d " , colSum [ j ] ) ; rowSum + = colSum [ j ] ; out . printf ( DIVIDER + " % 3d " , rowSum ) ; out . println ( ) ; */
public class AuditLog { /** * < pre > * The name of the API service performing the operation . For example , * ` " datastore . googleapis . com " ` . * < / pre > * < code > string service _ name = 7 ; < / code > */ public java . lang . String getServiceName ( ) { } }
java . lang . Object ref = serviceName_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; serviceName_ = s ; return s ; }
public class SamplesParser { /** * { @ inheritDoc } */ @ Override public SampleResourceWritable parseFileToResource ( File assetFile , File metadataFile , String contentUrl ) throws RepositoryException { } }
ArtifactMetadata artifactMetadata = explodeArtifact ( assetFile , metadataFile ) ; // Throw an exception if there is no metadata and properties , we get the name and readme from it if ( artifactMetadata == null ) { throw new RepositoryArchiveException ( "Unable to find sibling metadata zip for " + assetFile . getName ( ) + " so do not have the required information" , assetFile ) ; } // parse the jar manifest JarFile jar ; try { jar = new JarFile ( assetFile ) ; } catch ( IOException e ) { throw new RepositoryArchiveIOException ( e . getMessage ( ) , assetFile , e ) ; } ManifestInfo mi = ManifestInfo . parseManifest ( jar ) ; SampleResourceWritable resource = WritableResourceFactory . createSample ( null , mi . getType ( ) ) ; setCommonFieldsFromSideZip ( artifactMetadata , resource ) ; // set fields from manifest info resource . setProviderName ( mi . getProviderName ( ) ) ; resource . setAppliesTo ( mi . getAppliesTo ( ) ) ; resource . setRequireFeature ( mi . getRequiredFeature ( ) ) ; // upload the content locally or from DHE if there is a properties // file telling us where it lives addContent ( resource , assetFile , assetFile . getName ( ) , artifactMetadata , contentUrl ) ; /* * Find the short name from the JAR , it is based on the server name of the sample . The server * will be a directory in the wlp / usr / servers directory ( or another root usr dir defined by * archiveRoot ) and have a server . xml inside it . The server name is the directory name so do * a regex that effectively gets a group in the following form : * wlp / usr / server / { group } / server . xml */ String archiveRoot = mi . getArchiveRoot ( ) ; Pattern sampleShortNamePattern = Pattern . compile ( archiveRoot + "servers/([^/]*)/server.xml" ) ; try { ZipFile zip = new ZipFile ( assetFile ) ; @ SuppressWarnings ( "unchecked" ) Enumeration < ZipEntry > entries = ( Enumeration < ZipEntry > ) zip . entries ( ) ; while ( entries . hasMoreElements ( ) ) { String entryName = entries . nextElement ( ) . getName ( ) ; Matcher shortNameMatcher = sampleShortNamePattern . matcher ( entryName ) ; if ( shortNameMatcher . matches ( ) ) { resource . setShortName ( shortNameMatcher . group ( 1 ) ) ; break ; } } zip . close ( ) ; } catch ( IOException e ) { throw new RepositoryArchiveIOException ( e . getMessage ( ) , assetFile , e ) ; } if ( null != artifactMetadata && null != artifactMetadata . licenseFiles && ! artifactMetadata . licenseFiles . isEmpty ( ) ) { // for samples the " license " is really a list of files that will be // downloaded and should be in English only , if not something is // wrong so bomb out if ( artifactMetadata . licenseFiles . size ( ) > 1 ) { throw new RepositoryArchiveException ( "There were too many licenses associated with " + assetFile . getName ( ) + ". An English only license is expected but had: " + artifactMetadata . licenseFiles , assetFile ) ; } resource . setLicenseType ( LicenseType . UNSPECIFIED ) ; resource . addLicense ( artifactMetadata . licenseFiles . iterator ( ) . next ( ) , Locale . ENGLISH ) ; try { processLAandLI ( assetFile , resource , mi . getManifest ( ) ) ; } catch ( IOException e ) { throw new RepositoryArchiveIOException ( e . getMessage ( ) , assetFile , e ) ; } } return resource ;
public class SelectBenchmark { /** * Don ' t run this benchmark with a query that doesn ' t use { @ link Granularities # ALL } , * this pagination function probably doesn ' t work correctly in that case . */ private SelectQuery incrementQueryPagination ( SelectQuery query , SelectResultValue prevResult ) { } }
Map < String , Integer > pagingIdentifiers = prevResult . getPagingIdentifiers ( ) ; Map < String , Integer > newPagingIdentifers = new HashMap < > ( ) ; for ( String segmentId : pagingIdentifiers . keySet ( ) ) { int newOffset = pagingIdentifiers . get ( segmentId ) + 1 ; newPagingIdentifers . put ( segmentId , newOffset ) ; } return query . withPagingSpec ( new PagingSpec ( newPagingIdentifers , pagingThreshold ) ) ;
public class SegmentedLruPolicy { /** * Returns all variations of this policy based on the configuration parameters . */ public static Set < Policy > policies ( Config config ) { } }
BasicSettings settings = new BasicSettings ( config ) ; return settings . admission ( ) . stream ( ) . map ( admission -> new SegmentedLruPolicy ( admission , config ) ) . collect ( toSet ( ) ) ;
public class OrientationHistogramSift { /** * Finds local peaks in histogram and selects orientations . Location of peaks is interpolated . */ void findHistogramPeaks ( ) { } }
// reset data structures peaks . reset ( ) ; angles . reset ( ) ; peakAngle = 0 ; // identify peaks and find the highest peak double largest = 0 ; int largestIndex = - 1 ; double before = histogramMag [ histogramMag . length - 2 ] ; double current = histogramMag [ histogramMag . length - 1 ] ; for ( int i = 0 ; i < histogramMag . length ; i ++ ) { double after = histogramMag [ i ] ; if ( current > before && current > after ) { int currentIndex = CircularIndex . addOffset ( i , - 1 , histogramMag . length ) ; peaks . push ( currentIndex ) ; if ( current > largest ) { largest = current ; largestIndex = currentIndex ; } } before = current ; current = after ; } if ( largestIndex < 0 ) return ; // see if any of the other peaks are within 80 % of the max peak double threshold = largest * 0.8 ; for ( int i = 0 ; i < peaks . size ; i ++ ) { int index = peaks . data [ i ] ; current = histogramMag [ index ] ; if ( current >= threshold ) { double angle = computeAngle ( index ) ; angles . push ( angle ) ; if ( index == largestIndex ) peakAngle = angle ; } }
public class UpdateMethodResponseRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateMethodResponseRequest updateMethodResponseRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateMethodResponseRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateMethodResponseRequest . getRestApiId ( ) , RESTAPIID_BINDING ) ; protocolMarshaller . marshall ( updateMethodResponseRequest . getResourceId ( ) , RESOURCEID_BINDING ) ; protocolMarshaller . marshall ( updateMethodResponseRequest . getHttpMethod ( ) , HTTPMETHOD_BINDING ) ; protocolMarshaller . marshall ( updateMethodResponseRequest . getStatusCode ( ) , STATUSCODE_BINDING ) ; protocolMarshaller . marshall ( updateMethodResponseRequest . getPatchOperations ( ) , PATCHOPERATIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Vector3d { /** * / * ( non - Javadoc ) * @ see org . joml . Vector3dc # sub ( org . joml . Vector3fc , org . joml . Vector3d ) */ public Vector3d sub ( Vector3fc v , Vector3d dest ) { } }
dest . x = x - v . x ( ) ; dest . y = y - v . y ( ) ; dest . z = z - v . z ( ) ; return dest ;
public class JellyBuilder { /** * Generates HTML fragment from string . * The string representation of the object is assumed to produce proper HTML . * No further escaping is performed . * @ see # text ( Object ) */ public void raw ( Object o ) throws SAXException { } }
if ( o != null ) output . write ( o . toString ( ) ) ;
public class SerialFieldTagImpl { /** * The serialField tag is composed of three entities . * serialField serializableFieldName serisliableFieldType * description of field . * The fieldName and fieldType must be legal Java Identifiers . */ private void parseSerialFieldString ( ) { } }
int len = text . length ( ) ; if ( len == 0 ) { return ; } // if no white space found /* Skip white space . */ int inx = 0 ; int cp ; for ( ; inx < len ; inx += Character . charCount ( cp ) ) { cp = text . codePointAt ( inx ) ; if ( ! Character . isWhitespace ( cp ) ) { break ; } } /* find first word . */ int first = inx ; int last = inx ; cp = text . codePointAt ( inx ) ; if ( ! Character . isJavaIdentifierStart ( cp ) ) { docenv ( ) . warning ( holder , "tag.serialField.illegal_character" , new String ( Character . toChars ( cp ) ) , text ) ; return ; } for ( inx += Character . charCount ( cp ) ; inx < len ; inx += Character . charCount ( cp ) ) { cp = text . codePointAt ( inx ) ; if ( ! Character . isJavaIdentifierPart ( cp ) ) { break ; } } if ( inx < len && ! Character . isWhitespace ( cp = text . codePointAt ( inx ) ) ) { docenv ( ) . warning ( holder , "tag.serialField.illegal_character" , new String ( Character . toChars ( cp ) ) , text ) ; return ; } last = inx ; fieldName = text . substring ( first , last ) ; /* Skip white space . */ for ( ; inx < len ; inx += Character . charCount ( cp ) ) { cp = text . codePointAt ( inx ) ; if ( ! Character . isWhitespace ( cp ) ) { break ; } } /* find second word . */ first = inx ; last = inx ; for ( ; inx < len ; inx += Character . charCount ( cp ) ) { cp = text . codePointAt ( inx ) ; if ( Character . isWhitespace ( cp ) ) { break ; } } if ( inx < len && ! Character . isWhitespace ( cp = text . codePointAt ( inx ) ) ) { docenv ( ) . warning ( holder , "tag.serialField.illegal_character" , new String ( Character . toChars ( cp ) ) , text ) ; return ; } last = inx ; fieldType = text . substring ( first , last ) ; /* Skip leading white space . Rest of string is description for serialField . */ for ( ; inx < len ; inx += Character . charCount ( cp ) ) { cp = text . codePointAt ( inx ) ; if ( ! Character . isWhitespace ( cp ) ) { break ; } } description = text . substring ( inx ) ;
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcMaterialList ( ) { } }
if ( ifcMaterialListEClass == null ) { ifcMaterialListEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 312 ) ; } return ifcMaterialListEClass ;
public class PortFile { /** * Delete the port file . */ public void delete ( ) throws IOException , InterruptedException { } }
// Access to file must be closed before deleting . rwfile . close ( ) ; file . delete ( ) ; // Wait until file has been deleted ( deletes are asynchronous on Windows ! ) otherwise we // might shutdown the server and prevent another one from starting . for ( int i = 0 ; i < 10 && file . exists ( ) ; i ++ ) { Thread . sleep ( 1000 ) ; } if ( file . exists ( ) ) { throw new IOException ( "Failed to delete file." ) ; }
public class DefaultLoaderService { /** * Removes a resource managed . * @ param resourceId the resource id . */ public void unload ( String resourceId ) { } }
LoadableResource res = this . resources . get ( resourceId ) ; if ( res != null ) { res . unload ( ) ; }
public class Pof { /** * Does AES encryption of a YubiKey OTP byte sequence . * @ param key AES key . * @ param decoded YubiKey OTP byte sequence , * { @ link Modhex # decode ( String ) } is the typical producer of * this . * @ return Decrypted . * @ throws GeneralSecurityException If decryption fails . */ public static byte [ ] decrypt ( byte [ ] key , byte [ ] decoded ) throws GeneralSecurityException /* throws NoSuchPaddingException , IllegalBlockSizeException , NoSuchAlgorithmException , InvalidKeyException , BadPaddingException */ { } }
SecretKeySpec skeySpec = new SecretKeySpec ( key , "AES" ) ; Cipher cipher = Cipher . getInstance ( "AES/ECB/Nopadding" ) ; cipher . init ( Cipher . DECRYPT_MODE , skeySpec ) ; return cipher . doFinal ( decoded ) ;
public class NTLMUtilities { /** * Extracts the target name from the type 2 message . * @ param msg the type 2 message byte array * @ param msgFlags the flags if null then flags are extracted from the * type 2 message * @ return the target name * @ throws UnsupportedEncodingException if unable to use the * needed UTF - 16LE or ASCII charsets */ public static String extractTargetNameFromType2Message ( byte [ ] msg , Integer msgFlags ) throws UnsupportedEncodingException { } }
// Read the security buffer to determine where the target name // is stored and what it ' s length is byte [ ] targetName = readSecurityBufferTarget ( msg , 12 ) ; // now we convert it to a string int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ByteUtilities . isFlagSet ( flags , FLAG_NEGOTIATE_UNICODE ) ) { return new String ( targetName , "UTF-16LE" ) ; } return new String ( targetName , "ASCII" ) ;
public class Address { /** * Convert a string containing an IP address to an array of 4 or 16 bytes . * @ param s The address , in text format . * @ param family The address family . * @ return The address */ public static byte [ ] toByteArray ( String s , int family ) { } }
if ( family == IPv4 ) return parseV4 ( s ) ; else if ( family == IPv6 ) return parseV6 ( s ) ; else throw new IllegalArgumentException ( "unknown address family" ) ;
public class GraphDatabase { /** * Return a driver for a Neo4j instance with the default configuration settings * @ param uri the URL to a Neo4j instance * @ param authToken authentication to use , see { @ link AuthTokens } * @ return a new driver to the database instance specified by the URL */ public static Driver driver ( URI uri , AuthToken authToken ) { } }
return driver ( uri , authToken , Config . defaultConfig ( ) ) ;
public class AvatarNode { /** * Used only for testing . */ public void quiesceStandby ( long txId ) throws IOException { } }
if ( currentAvatar != Avatar . STANDBY ) { throw new IOException ( "This is not the standby avatar" ) ; } standby . quiesce ( txId ) ;
public class SideEffectsAnalysis { /** * Returns true if a node has a CALL or a NEW descendant . */ private static boolean nodeHasCall ( Node node ) { } }
return NodeUtil . has ( node , new Predicate < Node > ( ) { @ Override public boolean apply ( Node input ) { return input . isCall ( ) || input . isNew ( ) || input . isTaggedTemplateLit ( ) ; } } , NOT_FUNCTION_PREDICATE ) ;
public class TemplateGenerator { /** * For internal use only ! ! */ @ SuppressWarnings ( "UnusedDeclaration" ) public static void printContent ( String strContent , boolean escape ) { } }
try { RuntimeData pair = getRuntimeData ( ) ; Writer writer = pair . _writer ; if ( escape && pair . _esc != null ) { strContent = pair . _esc . escape ( strContent ) ; } else if ( pair . _esc instanceof IEscapesAllContent ) { strContent = ( ( IEscapesAllContent ) pair . _esc ) . escapeBody ( strContent ) ; } writer . write ( strContent == null ? "null" : strContent ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
public class ParserDQL { /** * | < nonparenthesized value expression primary > */ Expression XreadValueExpressionPrimary ( ) { } }
Expression e ; e = XreadSimpleValueExpressionPrimary ( ) ; if ( e != null ) { return e ; } if ( token . tokenType == Tokens . OPENBRACKET ) { read ( ) ; e = XreadValueExpression ( ) ; readThis ( Tokens . CLOSEBRACKET ) ; } else { return null ; } return e ;
public class NotificationHubsInner { /** * Patch a NotificationHub in a namespace . * @ param resourceGroupName The name of the resource group . * @ param namespaceName The namespace name . * @ param notificationHubName The notification hub name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the NotificationHubResourceInner object */ public Observable < NotificationHubResourceInner > patchAsync ( String resourceGroupName , String namespaceName , String notificationHubName ) { } }
return patchWithServiceResponseAsync ( resourceGroupName , namespaceName , notificationHubName ) . map ( new Func1 < ServiceResponse < NotificationHubResourceInner > , NotificationHubResourceInner > ( ) { @ Override public NotificationHubResourceInner call ( ServiceResponse < NotificationHubResourceInner > response ) { return response . body ( ) ; } } ) ;
public class SuspendableIoFilterAdapter { /** * on I / O thread . */ protected void resumeIncoming ( IoSession session ) throws Exception { } }
Runnable resumeTask = new ResumeRunnable ( session ) ; assert ( session instanceof IoSessionEx ) ; ( ( IoSessionEx ) session ) . getIoExecutor ( ) . execute ( resumeTask ) ;
public class IDEStructureImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } }
switch ( featureID ) { case AfplibPackage . IDE_STRUCTURE__FLAGS : return getFLAGS ( ) ; case AfplibPackage . IDE_STRUCTURE__FORMAT : return getFORMAT ( ) ; case AfplibPackage . IDE_STRUCTURE__SIZE1 : return getSIZE1 ( ) ; case AfplibPackage . IDE_STRUCTURE__SIZE2 : return getSIZE2 ( ) ; case AfplibPackage . IDE_STRUCTURE__SIZE3 : return getSIZE3 ( ) ; case AfplibPackage . IDE_STRUCTURE__SIZE4 : return getSIZE4 ( ) ; } return super . eGet ( featureID , resolve , coreType ) ;
public class GVRTransform { /** * Set absolute position . * Use { @ link # translate ( float , float , float ) } to < em > move < / em > the object . * @ param x * ' X ' component of the absolute position . * @ param y * ' Y ' component of the absolute position . * @ param z * ' Z ' component of the absolute position . */ public GVRTransform setPosition ( float x , float y , float z ) { } }
NativeTransform . setPosition ( getNative ( ) , x , y , z ) ; return this ;
public class CurveFactory { /** * Creates a monthly index curve with seasonality and past fixings . * This methods creates an index curve ( e . g . for a CPI index ) using provided < code > annualizedZeroRates < / code > * for the forwards ( expected future CPI values ) and < code > indexFixings < / code > for the past * fixings . * It may also " overlay " the future values with a seasonality adjustment . The seasonality adjustment * is either taken from adjustment factors provided in < code > seasonalityAdjustments < / code > or * ( if that argument is null ) estimated from the < code > indexFixings < / code > . The the latter case * use < code > seasonalAveragingNumerOfYears < / code > to specify the number of years which should be used * to estimate the seasonality adjustments . * @ param name The name of the curve . * @ param referenceDate The reference date of the curve . * @ param indexFixings A Map & lt ; LocalDate , Double & gt ; of past fixings . * @ param seasonalityAdjustments A Map & lt ; String , Double & gt ; of seasonality adjustments ( annualized continuously compounded rates for the given month , i . e . , the seasonality factor is exp ( seasonalityAdjustment / 12 ) ) , where the String keys are " january " , " february " , " march " , " april " , " may " , " june " , " july " , " august " , " september " , " october " , " november " , " december " . * @ param seasonalAveragingNumberOfYears If seasonalityAdjustments is null you may provide an integer representing a number of years to have the seasonality estimated from the past fixings in < code > indexFixings < / code > . * @ param annualizedZeroRates Map & lt ; LocalDate , Double & gt ; of annualized zero rates for given maturities . * @ param forwardsFixingLag The fixing lag ( e . g . " - 3M " for - 3 month ) * @ param forwardsFixingType The fixing type ( e . g . " endOfMonth " ) * @ return An index curve . */ public static CurveInterface createIndexCurveWithSeasonality ( String name , LocalDate referenceDate , Map < LocalDate , Double > indexFixings , Map < String , Double > seasonalityAdjustments , Integer seasonalAveragingNumberOfYears , Map < LocalDate , Double > annualizedZeroRates , String forwardsFixingLag , String forwardsFixingType ) { } }
/* * Create a curve containing past fixings ( using picewise constant interpolation ) */ double [ ] fixingTimes = new double [ indexFixings . size ( ) ] ; double [ ] fixingValue = new double [ indexFixings . size ( ) ] ; int i = 0 ; List < LocalDate > fixingDates = new ArrayList < LocalDate > ( indexFixings . keySet ( ) ) ; Collections . sort ( fixingDates ) ; for ( LocalDate fixingDate : fixingDates ) { fixingTimes [ i ] = modelDcc . getDaycountFraction ( referenceDate , fixingDate ) ; fixingValue [ i ] = indexFixings . get ( fixingDate ) . doubleValue ( ) ; i ++ ; } CurveInterface curveOfFixings = new Curve ( name , referenceDate , InterpolationMethod . PIECEWISE_CONSTANT_RIGHTPOINT , ExtrapolationMethod . CONSTANT , InterpolationEntity . VALUE , fixingTimes , fixingValue ) ; /* * Create a curve modeling the seasonality */ CurveInterface seasonCurve = null ; if ( seasonalityAdjustments != null && seasonalityAdjustments . size ( ) > 0 && seasonalAveragingNumberOfYears == null ) { String [ ] monthList = { "january" , "february" , "march" , "april" , "may" , "june" , "july" , "august" , "september" , "october" , "november" , "december" } ; double [ ] seasonTimes = new double [ 12 ] ; double [ ] seasonValue = new double [ 12 ] ; double seasonValueCummulated = 1.0 ; for ( int j = 0 ; j < 12 ; j ++ ) { seasonValueCummulated *= Math . exp ( seasonalityAdjustments . get ( monthList [ j ] ) ) ; seasonTimes [ j ] = j / 12.0 ; seasonValue [ j ] = seasonValueCummulated ; } seasonCurve = new SeasonalCurve ( name + "-seasonal" , referenceDate , new Curve ( name + "-seasonal-base" , referenceDate , InterpolationMethod . PIECEWISE_CONSTANT_LEFTPOINT , ExtrapolationMethod . CONSTANT , InterpolationEntity . VALUE , seasonTimes , seasonValue ) ) ; } else if ( seasonalAveragingNumberOfYears != null && seasonalityAdjustments == null ) { seasonCurve = new SeasonalCurve ( name + "-seasonal" , referenceDate , indexFixings , seasonalAveragingNumberOfYears ) ; } else if ( seasonalAveragingNumberOfYears != null && seasonalityAdjustments != null ) { throw new IllegalArgumentException ( "Specified seasonal factors and seasonal averaging at the same time." ) ; } /* * Create the index curve from annualized zero rates . */ double [ ] times = new double [ annualizedZeroRates . size ( ) ] ; double [ ] givenDiscountFactors = new double [ annualizedZeroRates . size ( ) ] ; int index = 0 ; List < LocalDate > dates = new ArrayList < LocalDate > ( annualizedZeroRates . keySet ( ) ) ; Collections . sort ( dates ) ; for ( LocalDate forwardDate : dates ) { LocalDate cpiDate = forwardDate ; if ( forwardsFixingType != null && forwardsFixingLag != null ) { if ( forwardsFixingType . equals ( "endOfMonth" ) ) { cpiDate = cpiDate . withDayOfMonth ( 1 ) ; if ( forwardsFixingLag . equals ( "-2M" ) ) { cpiDate = cpiDate . minusMonths ( 2 ) ; } else if ( forwardsFixingLag . equals ( "-3M" ) ) { cpiDate = cpiDate . minusMonths ( 3 ) ; } else if ( forwardsFixingLag . equals ( "-4M" ) ) { cpiDate = cpiDate . minusMonths ( 4 ) ; } else { throw new IllegalArgumentException ( "Unsupported fixing type for forward in curve " + name ) ; } cpiDate = cpiDate . withDayOfMonth ( cpiDate . lengthOfMonth ( ) ) ; } else { throw new IllegalArgumentException ( "Unsupported fixing type for forward in curve " + name ) ; } } times [ index ] = modelDcc . getDaycountFraction ( referenceDate , cpiDate ) ; double rate = annualizedZeroRates . get ( forwardDate ) . doubleValue ( ) ; givenDiscountFactors [ index ] = 1.0 / Math . pow ( 1 + rate , ( new DayCountConvention_30E_360 ( ) ) . getDaycountFraction ( referenceDate , forwardDate ) ) ; index ++ ; } DiscountCurveInterface discountCurve = DiscountCurve . createDiscountCurveFromDiscountFactors ( name , referenceDate , times , givenDiscountFactors , null , InterpolationMethod . LINEAR , ExtrapolationMethod . CONSTANT , InterpolationEntity . LOG_OF_VALUE ) ; LocalDate baseDate = referenceDate ; if ( forwardsFixingType != null && forwardsFixingType . equals ( "endOfMonth" ) && forwardsFixingLag != null ) { baseDate = baseDate . withDayOfMonth ( 1 ) ; if ( forwardsFixingLag . equals ( "-2M" ) ) { baseDate = baseDate . minusMonths ( 2 ) ; } else if ( forwardsFixingLag . equals ( "-3M" ) ) { baseDate = baseDate . minusMonths ( 3 ) ; } else if ( forwardsFixingLag . equals ( "-4M" ) ) { baseDate = baseDate . minusMonths ( 4 ) ; } else { throw new IllegalArgumentException ( "Unsupported fixing type for forward in curve " + name ) ; } baseDate = baseDate . withDayOfMonth ( baseDate . lengthOfMonth ( ) ) ; } /* * Index base value */ Double baseValue = indexFixings . get ( baseDate ) ; if ( baseValue == null ) { throw new IllegalArgumentException ( "Curve " + name + " has missing index value for base date " + baseDate ) ; } double baseTime = FloatingpointDate . getFloatingPointDateFromDate ( referenceDate , baseDate ) ; /* * Combine all three curves . */ double currentProjectedIndexValue = baseValue ; if ( seasonCurve != null ) { // Rescale initial value of with seasonality currentProjectedIndexValue /= seasonCurve . getValue ( baseTime ) ; CurveInterface indexCurve = new IndexCurveFromDiscountCurve ( name , currentProjectedIndexValue , discountCurve ) ; CurveInterface indexCurveWithSeason = new CurveFromProductOfCurves ( name , referenceDate , new CurveInterface [ ] { indexCurve , seasonCurve } ) ; PiecewiseCurve indexCurveWithFixing = new PiecewiseCurve ( indexCurveWithSeason , curveOfFixings , - Double . MAX_VALUE , fixingTimes [ fixingTimes . length - 1 ] + 1.0 / 365.0 ) ; return indexCurveWithFixing ; } else { CurveInterface indexCurve = new IndexCurveFromDiscountCurve ( name , currentProjectedIndexValue , discountCurve ) ; PiecewiseCurve indexCurveWithFixing = new PiecewiseCurve ( indexCurve , curveOfFixings , - Double . MAX_VALUE , fixingTimes [ fixingTimes . length - 1 ] ) ; return indexCurveWithFixing ; }
public class CmsElementWithAttrsParamConfigHelper { /** * Generates the XML configuration from the given configuration object . < p > * @ param parent the parent element * @ param config the configuration */ public void generateXml ( Element parent , I_CmsConfigurationParameterHandler config ) { } }
if ( config != null ) { Element elem = parent . addElement ( m_name ) ; for ( String attrName : m_attrs ) { String value = config . getConfiguration ( ) . get ( attrName ) ; if ( value != null ) { elem . addAttribute ( attrName , value ) ; } } }
public class AccountingDate { /** * Obtains the current { @ code AccountingDate } from the specified clock , * translated with the given AccountingChronology . * This will query the specified clock to obtain the current date - today . * Using this method allows the use of an alternate clock for testing . * The alternate clock may be introduced using { @ linkplain Clock dependency injection } . * @ param chronology the Accounting chronology to base the date on , not null * @ param clock the clock to use , not null * @ return the current date , not null * @ throws DateTimeException if the current date cannot be obtained , * NullPointerException if an AccountingChronology was not provided */ public static AccountingDate now ( AccountingChronology chronology , Clock clock ) { } }
LocalDate now = LocalDate . now ( clock ) ; return ofEpochDay ( chronology , now . toEpochDay ( ) ) ;
public class EntityUtils { /** * Gets the entity rotation based on where it ' s currently facing . * @ param entity the entity * @ param sixWays the six ways * @ return the entity rotation */ public static int getEntityRotation ( Entity entity , boolean sixWays ) { } }
if ( entity == null ) return 6 ; float pitch = entity . rotationPitch ; if ( sixWays && pitch < - 45 ) return 4 ; if ( sixWays && pitch > 45 ) return 5 ; return ( MathHelper . floor ( entity . rotationYaw * 4.0F / 360.0F + 0.5D ) + 2 ) & 3 ;
public class FileUtilities { /** * Utility method used to delete the profile directory when run as a stand - alone * application . * @ param file * The file to recursively delete . * @ throws IOException * is thrown in case of IO issues . */ public static void deleteFileOrDir ( File file ) throws IOException { } }
if ( file . isDirectory ( ) ) { File [ ] children = file . listFiles ( ) ; if ( children != null ) { for ( File child : children ) { deleteFileOrDir ( child ) ; } } } if ( ! file . delete ( ) ) { throw new IOException ( "Could not remove '" + file + "'!" ) ; }
public class TaskResult { /** * Inserts a String array value into the mapping of this Bundle , replacing any existing value for * the given key . Either key or value may be null . * @ param key a String , or null * @ param value a String array object , or null */ public TaskResult add ( String key , String [ ] value ) { } }
mBundle . putStringArray ( key , value ) ; return this ;
public class CommunicationChannelPurposeService { /** * Return the list of objects to act as a " purpose " for the { @ link CommunicationChannel } s , as per * { @ link CommunicationChannelPurposeRepository } , or a default name otherwise . * May return null if there are none ( in which case a default name will be used ) . */ @ Programmatic public Collection < String > purposesFor ( final CommunicationChannelType communicationChannelType , final Object communicationChannelOwner ) { } }
final Set < String > fallback = Collections . singleton ( DEFAULT_PURPOSE ) ; if ( communicationChannelPurposeRepository == null ) { return fallback ; } final Collection < String > purposes = communicationChannelPurposeRepository . purposesFor ( communicationChannelType , communicationChannelOwner ) ; return purposes != null ? purposes : fallback ;
public class DescribeTagsResult { /** * Information about the tags . * @ param tagDescriptions * Information about the tags . */ public void setTagDescriptions ( java . util . Collection < TagDescription > tagDescriptions ) { } }
if ( tagDescriptions == null ) { this . tagDescriptions = null ; return ; } this . tagDescriptions = new java . util . ArrayList < TagDescription > ( tagDescriptions ) ;
public class CmsCloneModuleThread { /** * Adjusts the module configuration file and the formatter configurations . < p > * @ param targetModule the target module * @ param resTypeMap the resource type mapping * @ throws CmsException if something goes wrong * @ throws UnsupportedEncodingException if the file content could not be read with the determined encoding */ private void adjustConfigs ( CmsModule targetModule , Map < I_CmsResourceType , I_CmsResourceType > resTypeMap ) throws CmsException , UnsupportedEncodingException { } }
String modPath = CmsWorkplace . VFS_PATH_MODULES + targetModule . getName ( ) + "/" ; CmsObject cms = getCms ( ) ; if ( ( ( m_cloneInfo . getSourceNamePrefix ( ) != null ) && ( m_cloneInfo . getTargetNamePrefix ( ) != null ) ) || ! m_cloneInfo . getSourceNamePrefix ( ) . equals ( m_cloneInfo . getTargetNamePrefix ( ) ) ) { // replace resource type names in formatter configurations List < CmsResource > resources = cms . readResources ( modPath , CmsResourceFilter . requireType ( OpenCms . getResourceManager ( ) . getResourceType ( CmsFormatterConfigurationCache . TYPE_FORMATTER_CONFIG ) ) ) ; String source = "<Type><!\\[CDATA\\[" + m_cloneInfo . getSourceNamePrefix ( ) ; String target = "<Type><!\\[CDATA\\[" + m_cloneInfo . getTargetNamePrefix ( ) ; Function < String , String > replaceType = new ReplaceAll ( source , target ) ; for ( CmsResource resource : resources ) { transformResource ( resource , replaceType ) ; } resources . clear ( ) ; } // replace resource type names in module configuration try { CmsResource config = cms . readResource ( modPath + CmsADEManager . CONFIG_FILE_NAME , CmsResourceFilter . requireType ( OpenCms . getResourceManager ( ) . getResourceType ( CmsADEManager . MODULE_CONFIG_TYPE ) ) ) ; Function < String , String > substitution = Functions . identity ( ) ; // compose the substitution functions from simple substitution functions for each type for ( Map . Entry < I_CmsResourceType , I_CmsResourceType > mapping : resTypeMap . entrySet ( ) ) { substitution = Functions . compose ( new ReplaceAll ( mapping . getKey ( ) . getTypeName ( ) , mapping . getValue ( ) . getTypeName ( ) ) , substitution ) ; } // Either replace prefix in or prepend it to the folder name value Function < String , String > replaceFolderName = new ReplaceAll ( "(<Folder>[ \n]*<Name><!\\[CDATA\\[)(" + m_cloneInfo . getSourceNamePrefix ( ) + ")?" , "$1" + m_cloneInfo . getTargetNamePrefix ( ) ) ; substitution = Functions . compose ( replaceFolderName , substitution ) ; transformResource ( config , substitution ) ; } catch ( CmsVfsResourceNotFoundException e ) { LOG . info ( e . getLocalizedMessage ( ) , e ) ; }