signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class SubjectHelper { /** * Check whether the subject is un - authenticated or not . * @ param subject { @ code null } is supported . * @ return Returns { @ code true } if the Subject is either null * or the UNAUTHENTICATED Subject . { @ code false } otherwise . */ public boolean isUnauthenticated ( Subject subject ) { } }
if ( subject == null ) { return true ; } WSCredential wsCred = getWSCredential ( subject ) ; if ( wsCred == null ) { return true ; } else { return wsCred . isUnauthenticated ( ) ; }
public class NetworkInterface { /** * The private IPv4 addresses associated with the network interface . * @ param privateIpAddresses * The private IPv4 addresses associated with the network interface . */ public void setPrivateIpAddresses ( java . util . Collection < NetworkInterfacePrivateIpAddress > privateIpAddresses ) { } }
if ( privateIpAddresses == null ) { this . privateIpAddresses = null ; return ; } this . privateIpAddresses = new com . amazonaws . internal . SdkInternalList < NetworkInterfacePrivateIpAddress > ( privateIpAddresses ) ;
public class PerspectiveOps { /** * Takes a list of { @ link AssociatedPair } as input and breaks it up into two lists for each view . * @ param pairs Input : List of associated pairs . * @ param view1 Output : List of observations from view 1 * @ param view2 Output : List of observations from view 2 */ public static void splitAssociated ( List < AssociatedPair > pairs , List < Point2D_F64 > view1 , List < Point2D_F64 > view2 ) { } }
for ( AssociatedPair p : pairs ) { view1 . add ( p . p1 ) ; view2 . add ( p . p2 ) ; }
public class ResultHandler { /** * Like { @ link # launchIntent ( Intent ) } but will tell you if it is not handle - able * via { @ link ActivityNotFoundException } . * @ throws ActivityNotFoundException if Intent can ' t be handled */ final void rawLaunchIntent ( Intent intent ) { } }
if ( intent != null ) { intent . addFlags ( Intents . FLAG_NEW_DOC ) ; activity . startActivity ( intent ) ; }
public class BlockMetadataManager { /** * Gets the list of { @ link StorageTier } below the tier with the given tierAlias . Throws an * { @ link IllegalArgumentException } if the tierAlias is not found . * @ param tierAlias the alias of a tier * @ return the list of { @ link StorageTier } */ public List < StorageTier > getTiersBelow ( String tierAlias ) { } }
int ordinal = getTier ( tierAlias ) . getTierOrdinal ( ) ; return mTiers . subList ( ordinal + 1 , mTiers . size ( ) ) ;
public class StreamPersistedValueData { /** * { @ inheritDoc } */ @ Override public byte [ ] getAsByteArray ( ) throws IllegalStateException , IOException { } }
if ( url != null ) { if ( tempFile != null ) { return fileToByteArray ( tempFile ) ; } else if ( spoolContent ) { spoolContent ( ) ; return fileToByteArray ( tempFile ) ; } ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; InputStream is = url . openStream ( ) ; try { byte [ ] bytes = new byte [ 1024 ] ; int length ; while ( ( length = is . read ( bytes ) ) != - 1 ) { baos . write ( bytes , 0 , length ) ; } return baos . toByteArray ( ) ; } finally { is . close ( ) ; } } return super . getAsByteArray ( ) ;
public class IndexedSliceReader { /** * Sets the seek position to the start of the row for column scanning . */ private void setToRowStart ( RowIndexEntry rowEntry , FileDataInput in ) throws IOException { } }
if ( in == null ) { this . file = sstable . getFileDataInput ( rowEntry . position ) ; } else { this . file = in ; in . seek ( rowEntry . position ) ; } sstable . partitioner . decorateKey ( ByteBufferUtil . readWithShortLength ( file ) ) ;
public class InventoryIdUtil { /** * Generates an ID for an { @ link MetricInstance } . * @ param resource the resource that owns the MetricInstance * @ param metricType the type of the MetricInstance whose ID is being generated * @ return the ID */ public static ID generateMetricInstanceId ( String feedId , ID resourceId , MetricType < ? > metricType ) { } }
ID id = new ID ( String . format ( "MI~R~[%s/%s]~MT~%s" , feedId , resourceId , metricType . getID ( ) ) ) ; return id ;
public class HtmlBuilder { /** * Build a String containing a HTML opening tag with given CSS style attribute ( s ) , content and closing tag . * Content should contain no HTML , because it is prepared with { @ link # htmlEncode ( String ) } . * @ param tag String name of HTML tag * @ param style style for tag ( plain CSS ) * @ param content content string * @ return HTML tag element as string */ public static String tagStyle ( String tag , String style , String ... content ) { } }
return openTagStyle ( tag , style , content ) + closeTag ( tag ) ;
public class JvmTypesBuilder { /** * Creates a deep copy of the given object and associates each copied instance with the * clone . Does not resolve any proxies . * @ param original the root element to be cloned . * @ return a clone of tree rooted in original associated with the original , < code > null < / code > if original is < code > null < / code > . */ protected < T extends JvmTypeReference > T cloneAndAssociate ( T original ) { } }
final boolean canAssociate = languageInfo . isLanguage ( original . eResource ( ) ) ; EcoreUtil . Copier copier = new EcoreUtil . Copier ( false ) { private static final long serialVersionUID = 1L ; @ Override /* @ Nullable */ protected EObject createCopy ( /* @ Nullable */ EObject eObject ) { EObject result = super . createCopy ( eObject ) ; if ( result != null && eObject != null && ! eObject . eIsProxy ( ) ) { if ( canAssociate ) associator . associate ( eObject , result ) ; } return result ; } @ Override public EObject copy ( /* @ Nullable */ EObject eObject ) { EObject result = super . copy ( eObject ) ; if ( result instanceof JvmWildcardTypeReference ) { boolean upperBoundSeen = false ; for ( JvmTypeConstraint constraint : ( ( JvmWildcardTypeReference ) result ) . getConstraints ( ) ) { if ( constraint instanceof JvmUpperBound ) { upperBoundSeen = true ; break ; } } if ( ! upperBoundSeen ) { // no upper bound found - seems to be an invalid - assume object as upper bound JvmTypeReference object = newObjectReference ( ) ; JvmUpperBound upperBound = typesFactory . createJvmUpperBound ( ) ; upperBound . setTypeReference ( object ) ; ( ( JvmWildcardTypeReference ) result ) . getConstraints ( ) . add ( 0 , upperBound ) ; } } return result ; } } ; @ SuppressWarnings ( "unchecked" ) T copy = ( T ) copier . copy ( original ) ; copier . copyReferences ( ) ; return copy ;
public class Graph { /** * 添加力导向图的顶点数据 * @ param values * @ return */ public Graph nodes ( Node ... values ) { } }
if ( values == null || values . length == 0 ) { return this ; } this . nodes ( ) . addAll ( Arrays . asList ( values ) ) ; return this ;
public class SoapPayloadIO { /** * Parse the given input stream and return a { @ link SOAPEnvelope } . * @ param input * @ throws Exception */ public SOAPEnvelope parse ( InputStream input ) throws Exception { } }
DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; factory . setNamespaceAware ( true ) ; factory . setValidating ( false ) ; DocumentBuilder builder = factory . newDocumentBuilder ( ) ; Document doc = builder . parse ( input ) ; SOAPElement soapElement = SOAPFactory . newInstance ( ) . createElement ( doc . getDocumentElement ( ) ) ; SOAPEnvelope envelope = ( SOAPEnvelope ) soapElement ; return envelope ;
public class JfifUtil { /** * Positions the given input stream to the beginning of the EXIF data in the JPEG APP1 block . * @ param is the input stream of jpeg image * @ return length of EXIF data */ private static int moveToAPP1EXIF ( InputStream is ) throws IOException { } }
if ( moveToMarker ( is , MARKER_APP1 ) ) { // read block length // subtract 2 as length contain SIZE field we just read int length = StreamProcessor . readPackedInt ( is , 2 , false ) - 2 ; if ( length > 6 ) { int magic = StreamProcessor . readPackedInt ( is , 4 , false ) ; length -= 4 ; int zero = StreamProcessor . readPackedInt ( is , 2 , false ) ; length -= 2 ; if ( magic == APP1_EXIF_MAGIC && zero == 0 ) { // JEITA CP - 3451 Exif Version 2.2 return length ; } } } return 0 ;
public class LineScreenCapture { /** * check if stack line for this instance matches targetStackLines */ public boolean matchesStackLines ( List < StackLine > targetStackLines ) { } }
if ( targetStackLines . size ( ) != getStackLines ( ) . size ( ) ) { return false ; } for ( int i = 0 ; i < targetStackLines . size ( ) ; i ++ ) { StackLine targetLine = targetStackLines . get ( i ) ; StackLine line = getStackLines ( ) . get ( i ) ; if ( ! targetLine . getMethod ( ) . getKey ( ) . equals ( line . getMethod ( ) . getKey ( ) ) ) { return false ; } if ( targetLine . getCodeBodyIndex ( ) != line . getCodeBodyIndex ( ) ) { return false ; } } return true ;
public class FilterMenuLayout { /** * calculate the point a ' s angle of rectangle consist of point a , point b , point c ; * @ param vertex * @ param A * @ param B * @ return */ private static double threePointsAngle ( Point vertex , Point A , Point B ) { } }
double b = pointsDistance ( vertex , A ) ; double c = pointsDistance ( A , B ) ; double a = pointsDistance ( B , vertex ) ; return Math . toDegrees ( Math . acos ( ( a * a + b * b - c * c ) / ( 2 * a * b ) ) ) ;
public class Rollbar { /** * Report a message to Rollbar , specifying the level . * @ param message the message to send . * @ param level the severity level . */ @ Deprecated public static void reportMessage ( final String message , final String level ) { } }
reportMessage ( message , level , null ) ;
public class FieldSet { /** * Verifies that the given object is of the correct type to be a valid * value for the given field . ( For repeated fields , this checks if the * object is the right type to be one element of the field . ) * @ throws IllegalArgumentException The value is not of the right type . */ private static void verifyType ( final WireFormat . FieldType type , final Object value ) { } }
if ( value == null ) { throw new NullPointerException ( ) ; } boolean isValid = false ; switch ( type . getJavaType ( ) ) { case INT : isValid = value instanceof Integer ; break ; case LONG : isValid = value instanceof Long ; break ; case FLOAT : isValid = value instanceof Float ; break ; case DOUBLE : isValid = value instanceof Double ; break ; case BOOLEAN : isValid = value instanceof Boolean ; break ; case STRING : isValid = value instanceof String ; break ; case BYTE_STRING : isValid = value instanceof ByteString ; break ; case ENUM : // TODO ( kenton ) : Caller must do type checking here , I guess . isValid = value instanceof Internal . EnumLite ; break ; case MESSAGE : // TODO ( kenton ) : Caller must do type checking here , I guess . isValid = ( value instanceof MessageLite ) || ( value instanceof LazyField ) ; break ; } if ( ! isValid ) { // TODO ( kenton ) : When chaining calls to setField ( ) , it can be hard to // tell from the stack trace which exact call failed , since the whole // chain is considered one line of code . It would be nice to print // more information here , e . g . naming the field . We used to do that . // But we can ' t now that FieldSet doesn ' t use descriptors . Maybe this // isn ' t a big deal , though , since it would only really apply when using // reflection and generally people don ' t chain reflection setters . throw new IllegalArgumentException ( "Wrong object type used with protocol message reflection." ) ; }
public class SimpleCircularMSTLayout3DPC { /** * Recursively assign node weights . * @ param node Node to start with . */ private void computeWeights ( Node node ) { } }
int wsum = 0 ; for ( Node child : node . children ) { computeWeights ( child ) ; wsum += child . weight ; } node . weight = Math . max ( 1 , wsum ) ;
public class RaftNodeImpl { /** * Sends an append - entries request to the follower member . * Log entries between follower ' s known nextIndex and latest appended entry index are sent in a batch . * Batch size can be { @ link RaftAlgorithmConfig # getAppendRequestMaxEntryCount ( ) } at most . * If follower ' s nextIndex is behind the latest snapshot index , then { @ link InstallSnapshot } request is sent . * If leader doesn ' t know follower ' s matchIndex ( if { @ code matchIndex = = 0 } ) , then an empty append - entries is sent * to save bandwidth until leader learns the matchIndex of the follower . * If log entries contains multiple membership change entries , then entries batch is split to send only a single * membership change in single append - entries request . */ @ SuppressWarnings ( { } }
"checkstyle:npathcomplexity" , "checkstyle:cyclomaticcomplexity" , "checkstyle:methodlength" } ) public void sendAppendRequest ( Endpoint follower ) { if ( ! raftIntegration . isReachable ( follower ) ) { return ; } RaftLog raftLog = state . log ( ) ; LeaderState leaderState = state . leaderState ( ) ; FollowerState followerState = leaderState . getFollowerState ( follower ) ; if ( followerState . isAppendRequestBackoffSet ( ) ) { // The follower still has not sent a response for the last append request . // We will send a new append request either when the follower sends a response // or a back - off timeout occurs . return ; } long nextIndex = followerState . nextIndex ( ) ; // if the first log entry to be sent is put into the snapshot , check if we still keep it in the log // if we still keep that log entry and its previous entry , we don ' t need to send a snapshot if ( nextIndex <= raftLog . snapshotIndex ( ) && ( ! raftLog . containsLogEntry ( nextIndex ) || ( nextIndex > 1 && ! raftLog . containsLogEntry ( nextIndex - 1 ) ) ) ) { InstallSnapshot installSnapshot = new InstallSnapshot ( localMember , state . term ( ) , raftLog . snapshot ( ) ) ; if ( logger . isFineEnabled ( ) ) { logger . fine ( "Sending " + installSnapshot + " to " + follower + " since next index: " + nextIndex + " <= snapshot index: " + raftLog . snapshotIndex ( ) ) ; } followerState . setMaxAppendRequestBackoff ( ) ; scheduleAppendAckResetTask ( ) ; raftIntegration . send ( installSnapshot , follower ) ; return ; } int prevEntryTerm = 0 ; long prevEntryIndex = 0 ; LogEntry [ ] entries ; boolean setAppendRequestBackoff = true ; if ( nextIndex > 1 ) { prevEntryIndex = nextIndex - 1 ; LogEntry prevEntry = ( raftLog . snapshotIndex ( ) == prevEntryIndex ) ? raftLog . snapshot ( ) : raftLog . getLogEntry ( prevEntryIndex ) ; assert prevEntry != null : "Prev entry index: " + prevEntryIndex + ", snapshot: " + raftLog . snapshotIndex ( ) ; prevEntryTerm = prevEntry . term ( ) ; long matchIndex = followerState . matchIndex ( ) ; if ( matchIndex == 0 ) { // Until the leader has discovered where it and the follower ' s logs match , // the leader can send AppendEntries with no entries ( like heartbeats ) to save bandwidth . // We still need to enable append request backoff here because we do not want to bombard // the follower before we learn its match index entries = new LogEntry [ 0 ] ; } else if ( nextIndex <= raftLog . lastLogOrSnapshotIndex ( ) ) { // Then , once the matchIndex immediately precedes the nextIndex , // the leader should begin to send the actual entries long end = min ( nextIndex + appendRequestMaxEntryCount , raftLog . lastLogOrSnapshotIndex ( ) ) ; entries = raftLog . getEntriesBetween ( nextIndex , end ) ; } else { // The follower has caught up with the leader . Sending an empty append request as a heartbeat . . . entries = new LogEntry [ 0 ] ; setAppendRequestBackoff = false ; } } else if ( nextIndex == 1 && raftLog . lastLogOrSnapshotIndex ( ) > 0 ) { // Entries will be sent to the follower for the first time . . . long end = min ( nextIndex + appendRequestMaxEntryCount , raftLog . lastLogOrSnapshotIndex ( ) ) ; entries = raftLog . getEntriesBetween ( nextIndex , end ) ; } else { // There is no entry in the Raft log . Sending an empty append request as a heartbeat . . . entries = new LogEntry [ 0 ] ; setAppendRequestBackoff = false ; } AppendRequest request = new AppendRequest ( getLocalMember ( ) , state . term ( ) , prevEntryTerm , prevEntryIndex , state . commitIndex ( ) , entries ) ; if ( logger . isFineEnabled ( ) ) { logger . fine ( "Sending " + request + " to " + follower + " with next index: " + nextIndex ) ; } if ( setAppendRequestBackoff ) { followerState . setAppendRequestBackoff ( ) ; scheduleAppendAckResetTask ( ) ; } send ( request , follower ) ;
public class RevisionInternal { /** * in CBL _ Revision . m * - ( id ) objectForKeyedSubscript : ( id ) key */ public Object getObject ( String key ) { } }
return body != null ? body . getObject ( key ) : null ;
public class ConnectorProperty { /** * should be identical to version 1.3 , except newValue is of type Object . */ private void setValue ( Object newValue ) { } }
try { if ( this . type == null ) value = newValue ; else if ( this . type . equals ( "java.lang.String" ) ) value = newValue ; else if ( this . type . equals ( "java.lang.Boolean" ) ) value = Boolean . valueOf ( ( String ) newValue ) ; else if ( this . type . equals ( "java.lang.Integer" ) ) value = new Integer ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Double" ) ) value = new Double ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Byte" ) ) value = new Byte ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Short" ) ) value = new Short ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Long" ) ) value = new Long ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Float" ) ) value = new Float ( ( ( String ) newValue ) ) ; else if ( this . type . equals ( "java.lang.Character" ) ) value = Character . valueOf ( ( ( String ) newValue ) . charAt ( 0 ) ) ; else value = newValue ; } catch ( NumberFormatException nfe ) { Tr . warning ( tc , "INCOMPATIBLE_PROPERTY_TYPE_J2CA0207" , new Object [ ] { name , type , newValue } ) ; }
public class CloudhopperBuilder { /** * Set the SMPP protocol version . * You can specify a direct value . For example : * < pre > * . interfaceVersion ( " 3.4 " ) ; * < / pre > * You can also specify one or several property keys . For example : * < pre > * . interfaceVersion ( " $ { custom . property . high - priority } " , " $ { custom . property . low - priority } " ) ; * < / pre > * The properties are not immediately evaluated . The evaluation will be done * when the { @ link # build ( ) } method is called . * If you provide several property keys , evaluation will be done on the * first key and if the property exists ( see { @ link EnvironmentBuilder } ) , * its value is used . If the first property doesn ' t exist in properties , * then it tries with the second one and so on . * @ param version * one value , or one or several property keys * @ return this instance for fluent chaining */ public CloudhopperBuilder interfaceVersion ( String ... version ) { } }
for ( String v : version ) { if ( v != null ) { interfaceVersions . add ( v ) ; } } return this ;
public class GridSyncRecordMessageFilterHandler { /** * Update the listener to listen for changes to no records . * @ param strKeyName The ( optional ) key area the query is being of . * @ param objKeyData The ( optional ) reference value of the key area . */ public void clearBookmarkFilters ( String strKeyName , Object objKeyData ) { } }
Map < String , Object > properties = new Hashtable < String , Object > ( ) ; properties . put ( GridRecordMessageFilter . ADD_BOOKMARK , GridRecordMessageFilter . CLEAR_BOOKMARKS ) ; if ( objKeyData != null ) { properties . put ( GridRecordMessageFilter . SECOND_KEY_HINT , strKeyName ) ; properties . put ( strKeyName , objKeyData ) ; } m_recordMessageFilter . updateFilterMap ( properties ) ;
public class JenkinsHash { /** * Compute the hash of the specified file * @ param args name of file to compute hash of . * @ throws IOException */ public static void main ( String [ ] args ) throws IOException { } }
if ( args . length != 1 ) { System . err . println ( "Usage: JenkinsHash filename" ) ; System . exit ( - 1 ) ; } FileInputStream in = new FileInputStream ( args [ 0 ] ) ; byte [ ] bytes = new byte [ 512 ] ; int value = 0 ; JenkinsHash hash = new JenkinsHash ( ) ; for ( int length = in . read ( bytes ) ; length > 0 ; length = in . read ( bytes ) ) { value = hash . hash ( bytes , length , value ) ; } System . out . println ( Math . abs ( value ) ) ;
public class AnnotatedHttpServiceFactory { /** * Returns a decorator chain which is specified by { @ link Decorator } annotations and user - defined * decorator annotations . */ private static Function < Service < HttpRequest , HttpResponse > , ? extends Service < HttpRequest , HttpResponse > > decorator ( Method method , Class < ? > clazz , Function < Service < HttpRequest , HttpResponse > , ? extends Service < HttpRequest , HttpResponse > > initialDecorator ) { } }
final List < DecoratorAndOrder > decorators = collectDecorators ( clazz , method ) ; Function < Service < HttpRequest , HttpResponse > , ? extends Service < HttpRequest , HttpResponse > > decorator = initialDecorator ; for ( int i = decorators . size ( ) - 1 ; i >= 0 ; i -- ) { final DecoratorAndOrder d = decorators . get ( i ) ; decorator = decorator . andThen ( d . decorator ( ) ) ; } return decorator ;
public class BaseDependencyCheckMojo { /** * Determines if the groupId , artifactId , and version of the Maven * dependency and artifact match . * @ param d the Maven dependency * @ param a the Maven artifact * @ return true if the groupId , artifactId , and version match */ private static boolean artifactsMatch ( org . apache . maven . model . Dependency d , Artifact a ) { } }
return isEqualOrNull ( a . getArtifactId ( ) , d . getArtifactId ( ) ) && isEqualOrNull ( a . getGroupId ( ) , d . getGroupId ( ) ) && isEqualOrNull ( a . getVersion ( ) , d . getVersion ( ) ) ;
public class ModifyTransitGatewayVpcAttachmentRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional * parameters to enable operation dry - run . */ @ Override public Request < ModifyTransitGatewayVpcAttachmentRequest > getDryRunRequest ( ) { } }
Request < ModifyTransitGatewayVpcAttachmentRequest > request = new ModifyTransitGatewayVpcAttachmentRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ;
public class GatewayManagementBeanImpl { /** * Notify the management listeners on a sessionCreated . * NOTE : this starts on the IO thread , but runs a task OFF the thread . */ @ Override public void doSessionCreatedListeners ( final long sessionId , final ManagementSessionType managementSessionType ) { } }
runManagementTask ( new Runnable ( ) { @ Override public void run ( ) { try { // The particular management listeners change on strategy , so get them here . for ( final GatewayManagementListener listener : getManagementListeners ( ) ) { listener . doSessionCreated ( GatewayManagementBeanImpl . this , sessionId ) ; } markChanged ( ) ; // mark ourselves as changed , possibly tell listeners } catch ( Exception ex ) { logger . warn ( "Error during sessionCreated gateway listener notifications:" , ex ) ; } } } ) ;
public class EventToString { /** * package - private for testing */ EventToString escapeSpecialChars ( String arg ) { } }
for ( int i = 0 ; i < arg . length ( ) ; i ++ ) { escapeSpecialChar ( arg . charAt ( i ) ) ; } return this ;
public class ModelUpdateBehavior { /** * Factory method to create a new { @ link ModelUpdateBehavior } object . * @ param < T > * the generic type of the model * @ param model * the model * @ return the new { @ link ModelUpdateBehavior } object */ public static < T extends Serializable > ModelUpdateBehavior < T > of ( final IModel < T > model ) { } }
return new ModelUpdateBehavior < > ( model ) ;
public class NatsTransporter { /** * - - - PUBLISH - - - */ @ Override public void publish ( String channel , Tree message ) { } }
if ( client != null ) { try { if ( debug && ( debugHeartbeats || ! channel . endsWith ( heartbeatChannel ) ) ) { logger . info ( "Submitting message to channel \"" + channel + "\":\r\n" + message . toString ( ) ) ; } client . publish ( channel , serializer . write ( message ) ) ; } catch ( Exception cause ) { logger . warn ( "Unable to send message to NATS server!" , cause ) ; reconnect ( ) ; } }
public class Choice4 { /** * Static factory method for wrapping a value of type < code > A < / code > in a { @ link Choice4 } . * @ param a the value * @ param < A > the first possible type * @ param < B > the second possible type * @ param < C > the third possible type * @ param < D > the fourth possible type * @ return the wrapped value as a { @ link Choice4 } & lt ; A , B , C , D & gt ; */ public static < A , B , C , D > Choice4 < A , B , C , D > a ( A a ) { } }
return new _A < > ( a ) ;
public class QueryExecutorImpl { /** * Sends given query to BE to start , initialize and lock connection for a CopyOperation . * @ param sql COPY FROM STDIN / COPY TO STDOUT statement * @ return CopyIn or CopyOut operation object * @ throws SQLException on failure */ public synchronized CopyOperation startCopy ( String sql , boolean suppressBegin ) throws SQLException { } }
waitOnLock ( ) ; if ( ! suppressBegin ) { doSubprotocolBegin ( ) ; } byte [ ] buf = Utils . encodeUTF8 ( sql ) ; try { LOGGER . log ( Level . FINEST , " FE=> Query(CopyStart)" ) ; pgStream . sendChar ( 'Q' ) ; pgStream . sendInteger4 ( buf . length + 4 + 1 ) ; pgStream . send ( buf ) ; pgStream . sendChar ( 0 ) ; pgStream . flush ( ) ; return processCopyResults ( null , true ) ; // expect a CopyInResponse or CopyOutResponse to our query above } catch ( IOException ioe ) { throw new PSQLException ( GT . tr ( "Database connection failed when starting copy" ) , PSQLState . CONNECTION_FAILURE , ioe ) ; }
public class ExecutionEngineJNI { /** * Extract the per - fragment stats from the buffer . */ @ Override public int extractPerFragmentStats ( int batchSize , long [ ] executionTimesOut ) { } }
m_perFragmentStatsBuffer . clear ( ) ; // Discard the first byte since it is the timing on / off switch . m_perFragmentStatsBuffer . get ( ) ; int succeededFragmentsCount = m_perFragmentStatsBuffer . getInt ( ) ; if ( executionTimesOut != null ) { assert ( executionTimesOut . length >= succeededFragmentsCount ) ; for ( int i = 0 ; i < succeededFragmentsCount ; i ++ ) { executionTimesOut [ i ] = m_perFragmentStatsBuffer . getLong ( ) ; } // This is the time for the failed fragment . if ( succeededFragmentsCount < executionTimesOut . length ) { executionTimesOut [ succeededFragmentsCount ] = m_perFragmentStatsBuffer . getLong ( ) ; } } return succeededFragmentsCount ;
public class ResponseMessage { /** * @ see javax . servlet . http . HttpServletResponse # addDateHeader ( java . lang . String , long ) */ @ Override public void addDateHeader ( String hdr , long value ) { } }
this . response . addHeader ( hdr , connection . getDateFormatter ( ) . getRFC1123Time ( new Date ( value ) ) ) ;
public class AppServicePlansInner { /** * Gets server farm usage information . * Gets server farm usage information . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of App Service Plan * @ param filter Return only usages / metrics specified in the filter . Filter conforms to odata syntax . Example : $ filter = ( name . value eq ' Metric1 ' or name . value eq ' Metric2 ' ) . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; CsmUsageQuotaInner & gt ; object */ public Observable < Page < CsmUsageQuotaInner > > listUsagesAsync ( final String resourceGroupName , final String name , final String filter ) { } }
return listUsagesWithServiceResponseAsync ( resourceGroupName , name , filter ) . map ( new Func1 < ServiceResponse < Page < CsmUsageQuotaInner > > , Page < CsmUsageQuotaInner > > ( ) { @ Override public Page < CsmUsageQuotaInner > call ( ServiceResponse < Page < CsmUsageQuotaInner > > response ) { return response . body ( ) ; } } ) ;
public class CharsetHelper { /** * Get the number of bytes necessary to represent the passed char array as an * UTF - 8 string . * @ param aChars * The characters to count the length . May be < code > null < / code > or * empty . * @ return A non - negative value . */ @ Nonnegative public static int getUTF8ByteCount ( @ Nullable final char [ ] aChars ) { } }
int nCount = 0 ; if ( aChars != null ) for ( final char c : aChars ) nCount += getUTF8ByteCount ( c ) ; return nCount ;
public class GpioInterrupt { /** * This method is provided as the callback handler for the Pi4J native library to invoke when a * GPIO interrupt is detected . This method should not be called from any Java consumers . ( Thus * is is marked as a private method . ) * @ param pin GPIO pin number ( not header pin number ; not wiringPi pin number ) * @ param state New GPIO pin state . */ @ SuppressWarnings ( "unchecked" ) private static void pinStateChangeCallback ( int pin , boolean state ) { } }
Vector < GpioInterruptListener > listenersClone ; listenersClone = ( Vector < GpioInterruptListener > ) listeners . clone ( ) ; for ( int i = 0 ; i < listenersClone . size ( ) ; i ++ ) { GpioInterruptListener listener = listenersClone . elementAt ( i ) ; if ( listener != null ) { GpioInterruptEvent event = new GpioInterruptEvent ( listener , pin , state ) ; listener . pinStateChange ( event ) ; } } // System . out . println ( " GPIO PIN [ " + pin + " ] = " + state ) ;
public class BigFloat { /** * Returns the { @ link BigFloat } that is < code > - this < / code > . * @ param x the value to negate * @ return the resulting { @ link BigFloat } * @ see BigDecimal # negate ( MathContext ) */ public static BigFloat negate ( BigFloat x ) { } }
if ( x . isSpecial ( ) ) if ( x . isInfinity ( ) ) return x == POSITIVE_INFINITY ? NEGATIVE_INFINITY : POSITIVE_INFINITY ; else return NaN ; return x . context . valueOf ( x . value . negate ( ) ) ;
public class DumpURLs { /** * Do not include this in the search results . */ @ Override public void search ( String [ ] words , WebSiteRequest req , HttpServletResponse response , List < SearchResult > results , AoByteArrayOutputStream bytes , List < WebPage > finishedPages ) { } }
public class DeploymentReader { /** * Make the request to the Twilio API to perform the read . * @ param client TwilioRestClient with which to make the request * @ return Deployment ResourceSet */ @ Override public ResourceSet < Deployment > read ( final TwilioRestClient client ) { } }
return new ResourceSet < > ( this , client , firstPage ( client ) ) ;
public class AbstractBenchmark { /** * Shutdown all the client channels and then shutdown the server . */ protected void teardown ( ) throws Exception { } }
logger . fine ( "shutting down channels" ) ; for ( ManagedChannel channel : channels ) { channel . shutdown ( ) ; } logger . fine ( "shutting down server" ) ; server . shutdown ( ) ; if ( ! server . awaitTermination ( 5 , TimeUnit . SECONDS ) ) { logger . warning ( "Failed to shutdown server" ) ; } logger . fine ( "server shut down" ) ; for ( ManagedChannel channel : channels ) { if ( ! channel . awaitTermination ( 1 , TimeUnit . SECONDS ) ) { logger . warning ( "Failed to shutdown client" ) ; } } logger . fine ( "channels shut down" ) ;
public class dnsview { /** * Use this API to fetch dnsview resources of given names . */ public static dnsview [ ] get ( nitro_service service , String viewname [ ] ) throws Exception { } }
if ( viewname != null && viewname . length > 0 ) { dnsview response [ ] = new dnsview [ viewname . length ] ; dnsview obj [ ] = new dnsview [ viewname . length ] ; for ( int i = 0 ; i < viewname . length ; i ++ ) { obj [ i ] = new dnsview ( ) ; obj [ i ] . set_viewname ( viewname [ i ] ) ; response [ i ] = ( dnsview ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ;
public class ALU { public static Object bitAnd ( final Object o1 , final Object o2 ) { } }
switch ( getTypeMark ( o1 , o2 ) ) { case CHAR : return bitAnd ( charToInt ( o1 ) , charToInt ( o2 ) ) ; case BYTE : return ( ( Number ) o1 ) . byteValue ( ) & ( ( Number ) o2 ) . byteValue ( ) ; case SHORT : return ( ( Number ) o1 ) . shortValue ( ) & ( ( Number ) o2 ) . shortValue ( ) ; case INTEGER : return ( ( Number ) o1 ) . intValue ( ) & ( ( Number ) o2 ) . intValue ( ) ; case LONG : return ( ( Number ) o1 ) . longValue ( ) & ( ( Number ) o2 ) . longValue ( ) ; case BIG_INTEGER : if ( notDoubleOrFloat ( o1 , o2 ) ) { return toBigInteger ( o1 ) . and ( toBigInteger ( o2 ) ) ; } // Note : else unsupported default : } throw unsupportedTypeException ( o1 , o2 ) ;
public class Rect { /** * Returns true iff the two specified rectangles intersect . In no event are * either of the rectangles modified . To record the intersection , * use { @ link # intersect ( Rect ) } or { @ link # setIntersect ( Rect , Rect ) } . * @ param a The first rectangle being tested for intersection * @ param b The second rectangle being tested for intersection * @ return true iff the two specified rectangles intersect . In no event are * either of the rectangles modified . */ public static boolean intersects ( Rect a , Rect b ) { } }
return a . left < b . right && b . left < a . right && a . top < b . bottom && b . top < a . bottom ;
public class PhaseOneApplication { /** * Stage three symbol verification of the document . * @ param document BEL common document * @ return boolean true if success , false otherwise */ private boolean stage3 ( final Document document ) { } }
beginStage ( PHASE1_STAGE3_HDR , "3" , NUM_PHASES ) ; final StringBuilder bldr = new StringBuilder ( ) ; if ( hasOption ( NO_SYNTAX_CHECK ) ) { bldr . append ( SYMBOL_CHECKS_DISABLED ) ; markEndStage ( bldr ) ; stageOutput ( bldr . toString ( ) ) ; return true ; } bldr . append ( "Verifying symbols in " ) ; bldr . append ( document . getName ( ) ) ; stageOutput ( bldr . toString ( ) ) ; boolean warnings = false ; long t1 = currentTimeMillis ( ) ; try { p1 . stage3SymbolVerification ( document ) ; } catch ( SymbolWarning e ) { warnings = true ; String resname = e . getName ( ) ; if ( resname == null ) { e . setName ( document . getName ( ) ) ; } else { e . setName ( resname + " (" + document . getName ( ) + ")" ) ; } stageWarning ( e . getUserFacingMessage ( ) ) ; } catch ( IndexingFailure e ) { stageError ( "Failed to open namespace index file for symbol " + "verification." ) ; } catch ( ResourceDownloadError e ) { stageError ( "Failed to resolve namespace during symbol " + "verification." ) ; } long t2 = currentTimeMillis ( ) ; bldr . setLength ( 0 ) ; if ( warnings ) { bldr . append ( "Symbol verification resulted in warnings in " ) ; bldr . append ( document . getName ( ) ) ; bldr . append ( "\n" ) ; } markTime ( bldr , t1 , t2 ) ; markEndStage ( bldr ) ; stageOutput ( bldr . toString ( ) ) ; if ( warnings ) { return false ; } return true ;
public class DocBookBuilder { /** * Creates a dummy translated topic from an existing translated topic so that a book can be built using the same relationships as a * normal build . * @ param translatedTopic The translated topic to create the dummy translated topic from . * @ param locale The locale to build the dummy translations for . * @ return The dummy translated topic . */ private TranslatedTopicWrapper createDummyTranslatedTopicFromExisting ( final TranslatedTopicWrapper translatedTopic , final LocaleWrapper locale ) { } }
// Make sure some collections are loaded , so the clone works properly translatedTopic . getTags ( ) ; translatedTopic . getProperties ( ) ; // Clone the existing version final TranslatedTopicWrapper defaultLocaleTranslatedTopic = translatedTopic . clone ( false ) ; // Negate the ID to show it isn ' t a proper translated topic defaultLocaleTranslatedTopic . setId ( translatedTopic . getTopicId ( ) * - 1 ) ; // Change the locale since the default locale translation is being transformed into a dummy translation defaultLocaleTranslatedTopic . setLocale ( locale ) ; return defaultLocaleTranslatedTopic ;
public class PoolsImpl { /** * Lists all of the pools in the specified account . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ param serviceFuture the ServiceFuture object tracking the Retrofit calls * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < CloudPool > > listNextAsync ( final String nextPageLink , final ServiceFuture < List < CloudPool > > serviceFuture , final ListOperationCallback < CloudPool > serviceCallback ) { } }
return AzureServiceFuture . fromHeaderPageResponse ( listNextSinglePageAsync ( nextPageLink ) , new Func1 < String , Observable < ServiceResponseWithHeaders < Page < CloudPool > , PoolListHeaders > > > ( ) { @ Override public Observable < ServiceResponseWithHeaders < Page < CloudPool > , PoolListHeaders > > call ( String nextPageLink ) { return listNextSinglePageAsync ( nextPageLink , null ) ; } } , serviceCallback ) ;
public class Name { /** * Returns last occurrence of byte b in this name , - 1 if not found . */ public int lastIndexOf ( byte b ) { } }
byte [ ] bytes = getByteArray ( ) ; int offset = getByteOffset ( ) ; int i = getByteLength ( ) - 1 ; while ( i >= 0 && bytes [ offset + i ] != b ) i -- ; return i ;
public class StreamEx { /** * Returns a stream where the first element is the replaced with the result * of applying the given function while the other elements are left intact . * This is a < a href = " package - summary . html # StreamOps " > quasi - intermediate * operation < / a > with < a href = " package - summary . html # TSO " > tail - stream * optimization < / a > . * @ param mapper a < a * href = " package - summary . html # NonInterference " > non - interfering < / a > , * < a href = " package - summary . html # Statelessness " > stateless < / a > * function to apply to the first element * @ return the new stream * @ since 0.4.1 */ public StreamEx < T > mapFirst ( Function < ? super T , ? extends T > mapper ) { } }
return supply ( new PairSpliterator . PSOfRef < > ( mapper , spliterator ( ) , true ) ) ;
public class MultiChangeBuilder { /** * Removes a range of text . * It must hold { @ code 0 < = start < = end < = getLength ( ) } where * { @ code start = getAbsolutePosition ( startParagraph , startColumn ) ; } and is < b > inclusive < / b > , and * { @ code int end = getAbsolutePosition ( endParagraph , endColumn ) ; } and is < b > exclusive < / b > . * < p > < b > Caution : < / b > see { @ link StyledDocument # getAbsolutePosition ( int , int ) } to know how the column index argument * can affect the returned position . < / p > */ public MultiChangeBuilder < PS , SEG , S > deleteText ( int startParagraph , int startColumn , int endParagraph , int endColumn ) { } }
int start = area . getAbsolutePosition ( startParagraph , startColumn ) ; int end = area . getAbsolutePosition ( endParagraph , endColumn ) ; return replaceText ( start , end , "" ) ;
public class TurnArray { /** * Remove the given instance . */ public synchronized boolean removeInstance ( T element ) { } }
if ( end == start ) return false ; if ( end == - 1 ) { for ( int i = array . length - 1 ; i >= 0 ; -- i ) if ( array [ i ] == element ) { removeAt ( i ) ; return true ; } return false ; } if ( end < start ) { for ( int i = array . length - 1 ; i >= start ; -- i ) if ( array [ i ] == element ) { removeAt ( i ) ; return true ; } for ( int i = 0 ; i < end ; ++ i ) if ( array [ i ] == element ) { removeAt ( i ) ; return true ; } return false ; } for ( int i = start ; i < end ; ++ i ) if ( array [ i ] == element ) { removeAt ( i ) ; return true ; } return false ;
public class WorkdayCalendar { /** * 对于工作日的判断与节假日正好相反 , 只需要简单判断当前给定日期是否是工作日即可 , 如果是工作日 , 那么就直接返回true , 否则返回false */ @ Override public boolean isTimeIncluded ( long timeStamp ) { } }
Date lookFor = getStartOfDayJavaCalendar ( timeStamp ) . getTime ( ) ; boolean include = workdays . contains ( lookFor ) ; return include ;
public class ObjectReaderWriterStd { /** * < p > Read object ' s field . < / p > * @ param pAddParam additional param * @ param pObject Object to fill * @ param pFieldName Field name * @ return object ' s field value * @ throws Exception - an exception */ @ Override public final Object read ( final Map < String , Object > pAddParam , final T pObject , final String pFieldName ) throws Exception { } }
Method fldGetter = this . gettersMap . get ( pFieldName ) ; return fldGetter . invoke ( pObject ) ;
public class Util { /** * Returns the simplified name of the type of the specified object . */ public static String simpleTypeName ( Object obj ) { } }
if ( obj == null ) { return "null" ; } return simpleTypeName ( obj . getClass ( ) , false ) ;
public class IpUtil { /** * 通过IP获取IP信息 * @ param url url * @ return 服务器响应字符串 * @ throws IOException IO异常 */ private static String getIpInfoByIp ( String url ) throws IOException { } }
OkHttpClient okHttpClient = new OkHttpClient ( ) ; Request request = new Request . Builder ( ) . url ( url ) . get ( ) . removeHeader ( USER_AGENT_KEY ) . addHeader ( USER_AGENT_KEY , USER_AGENT_VALUE ) . build ( ) ; Call call = okHttpClient . newCall ( request ) ; Response response = call . execute ( ) ; return response . body ( ) == null ? "" : response . body ( ) . string ( ) ;
public class Applications { /** * Populates the provided instance count map . The instance count map is used * as part of the general app list synchronization mechanism . * @ param instanceCountMap * the map to populate */ public void populateInstanceCountMap ( Map < String , AtomicInteger > instanceCountMap ) { } }
for ( Application app : this . getRegisteredApplications ( ) ) { for ( InstanceInfo info : app . getInstancesAsIsFromEureka ( ) ) { AtomicInteger instanceCount = instanceCountMap . computeIfAbsent ( info . getStatus ( ) . name ( ) , k -> new AtomicInteger ( 0 ) ) ; instanceCount . incrementAndGet ( ) ; } }
public class LoadBalancerFrontendIPConfigurationsInner { /** * Gets load balancer frontend IP configuration . * @ param resourceGroupName The name of the resource group . * @ param loadBalancerName The name of the load balancer . * @ param frontendIPConfigurationName The name of the frontend IP configuration . * @ 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 < FrontendIPConfigurationInner > getAsync ( String resourceGroupName , String loadBalancerName , String frontendIPConfigurationName , final ServiceCallback < FrontendIPConfigurationInner > serviceCallback ) { } }
return ServiceFuture . fromResponse ( getWithServiceResponseAsync ( resourceGroupName , loadBalancerName , frontendIPConfigurationName ) , serviceCallback ) ;
public class CityModelType { /** * Gets the value of the genericApplicationPropertyOfCityModel property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a < CODE > set < / CODE > method for the genericApplicationPropertyOfCityModel property . * For example , to add a new item , do as follows : * < pre > * get _ GenericApplicationPropertyOfCityModel ( ) . add ( newItem ) ; * < / pre > * Objects of the following type ( s ) are allowed in the list * { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } * { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */ public List < JAXBElement < Object > > get_GenericApplicationPropertyOfCityModel ( ) { } }
if ( _GenericApplicationPropertyOfCityModel == null ) { _GenericApplicationPropertyOfCityModel = new ArrayList < JAXBElement < Object > > ( ) ; } return this . _GenericApplicationPropertyOfCityModel ;
public class VarSet { /** * this is the " no - allocation " version of the non - void method of the same name . */ public void getVarConfigAsArray ( int configIndex , int [ ] putInto ) { } }
if ( putInto . length != this . size ( ) ) throw new IllegalArgumentException ( ) ; int i = putInto . length - 1 ; for ( int v = this . size ( ) - 1 ; v >= 0 ; v -- ) { Var var = this . get ( v ) ; putInto [ i -- ] = configIndex % var . getNumStates ( ) ; configIndex /= var . getNumStates ( ) ; }
public class UserApi { /** * Creates custom attribute for the given user * @ param userIdOrUsername the user in the form of an Integer ( ID ) , String ( username ) , or User instance * @ param key for the customAttribute * @ param value or the customAttribute * @ return the created CustomAttribute * @ throws GitLabApiException on failure while setting customAttributes */ public CustomAttribute createCustomAttribute ( final Object userIdOrUsername , final String key , final String value ) throws GitLabApiException { } }
if ( Objects . isNull ( key ) || key . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Key can't be null or empty" ) ; } if ( Objects . isNull ( value ) || value . trim ( ) . isEmpty ( ) ) { throw new IllegalArgumentException ( "Value can't be null or empty" ) ; } GitLabApiForm formData = new GitLabApiForm ( ) . withParam ( "value" , value ) ; Response response = put ( Response . Status . OK , formData . asMap ( ) , "users" , getUserIdOrUsername ( userIdOrUsername ) , "custom_attributes" , key ) ; return ( response . readEntity ( CustomAttribute . class ) ) ;
public class ProxyServlet { /** * / * ( non - Javadoc ) * @ see javax . servlet . Servlet # service ( javax . servlet . ServletRequest , javax . servlet . ServletResponse ) */ public void service ( ServletRequest req , ServletResponse res ) throws ServletException , IOException { } }
HttpServletRequest request = ( HttpServletRequest ) req ; HttpServletResponse response = ( HttpServletResponse ) res ; if ( "CONNECT" . equalsIgnoreCase ( request . getMethod ( ) ) ) { handleConnect ( request , response ) ; } else { String uri = request . getRequestURI ( ) ; if ( request . getQueryString ( ) != null ) uri += "?" + request . getQueryString ( ) ; URL url = new URL ( request . getScheme ( ) , request . getServerName ( ) , request . getServerPort ( ) , uri ) ; context . log ( "URL=" + url ) ; URLConnection connection = url . openConnection ( ) ; connection . setAllowUserInteraction ( false ) ; // Set method HttpURLConnection http = null ; if ( connection instanceof HttpURLConnection ) { http = ( HttpURLConnection ) connection ; http . setRequestMethod ( request . getMethod ( ) ) ; http . setInstanceFollowRedirects ( false ) ; } // check connection header String connectionHdr = request . getHeader ( "Connection" ) ; if ( connectionHdr != null ) { connectionHdr = connectionHdr . toLowerCase ( ) ; if ( connectionHdr . equals ( "keep-alive" ) || connectionHdr . equals ( "close" ) ) connectionHdr = null ; } // copy headers boolean xForwardedFor = false ; boolean hasContent = false ; Enumeration enm = request . getHeaderNames ( ) ; while ( enm . hasMoreElements ( ) ) { // TODO could be better than this ! String hdr = ( String ) enm . nextElement ( ) ; String lhdr = hdr . toLowerCase ( ) ; if ( _DontProxyHeaders . contains ( lhdr ) ) continue ; if ( connectionHdr != null && connectionHdr . indexOf ( lhdr ) >= 0 ) continue ; if ( "content-type" . equals ( lhdr ) ) hasContent = true ; Enumeration vals = request . getHeaders ( hdr ) ; while ( vals . hasMoreElements ( ) ) { String val = ( String ) vals . nextElement ( ) ; if ( val != null ) { connection . addRequestProperty ( hdr , val ) ; context . log ( "req " + hdr + ": " + val ) ; xForwardedFor |= "X-Forwarded-For" . equalsIgnoreCase ( hdr ) ; } } } // Proxy headers connection . setRequestProperty ( "Via" , "1.1 (jetty)" ) ; if ( ! xForwardedFor ) connection . addRequestProperty ( "X-Forwarded-For" , request . getRemoteAddr ( ) ) ; // a little bit of cache control String cache_control = request . getHeader ( "Cache-Control" ) ; if ( cache_control != null && ( cache_control . indexOf ( "no-cache" ) >= 0 || cache_control . indexOf ( "no-store" ) >= 0 ) ) connection . setUseCaches ( false ) ; // customize Connection try { connection . setDoInput ( true ) ; // do input thang ! InputStream in = request . getInputStream ( ) ; if ( hasContent ) { connection . setDoOutput ( true ) ; IO . copy ( in , connection . getOutputStream ( ) ) ; } // Connect connection . connect ( ) ; } catch ( Exception e ) { context . log ( "proxy" , e ) ; } InputStream proxy_in = null ; // handler status codes etc . int code = 500 ; if ( http != null ) { proxy_in = http . getErrorStream ( ) ; code = http . getResponseCode ( ) ; response . setStatus ( code , http . getResponseMessage ( ) ) ; context . log ( "response = " + http . getResponseCode ( ) ) ; } if ( proxy_in == null ) { try { proxy_in = connection . getInputStream ( ) ; } catch ( Exception e ) { context . log ( "stream" , e ) ; proxy_in = http . getErrorStream ( ) ; } } // clear response defaults . response . setHeader ( "Date" , null ) ; response . setHeader ( "Server" , null ) ; // set response headers int h = 0 ; String hdr = connection . getHeaderFieldKey ( h ) ; String val = connection . getHeaderField ( h ) ; while ( hdr != null || val != null ) { String lhdr = hdr != null ? hdr . toLowerCase ( ) : null ; if ( hdr != null && val != null && ! _DontProxyHeaders . contains ( lhdr ) ) response . addHeader ( hdr , val ) ; context . log ( "res " + hdr + ": " + val ) ; h ++ ; hdr = connection . getHeaderFieldKey ( h ) ; val = connection . getHeaderField ( h ) ; } response . addHeader ( "Via" , "1.1 (jetty)" ) ; // Handle if ( proxy_in != null ) IO . copy ( proxy_in , response . getOutputStream ( ) ) ; }
public class ShowConfigurationTask { /** * Extract the generic type information < . . . > , recursively including any nested generic type info . */ private static String getGenericTypeData ( Type genericType ) { } }
List < String > types = Lists . newArrayList ( ) ; if ( genericType != null && genericType instanceof ParameterizedType ) { for ( Type t : ( ( ParameterizedType ) genericType ) . getActualTypeArguments ( ) ) { if ( t instanceof ParameterizedType ) { String nestedGeneric = ( ( Class < ? > ) ( ( ParameterizedType ) t ) . getRawType ( ) ) . getSimpleName ( ) ; nestedGeneric += getGenericTypeData ( t ) ; types . add ( nestedGeneric ) ; } else { types . add ( ( ( Class < ? > ) t ) . getSimpleName ( ) ) ; } } } return ( types . size ( ) > 0 ) ? "<" + Joiner . on ( ", " ) . join ( types ) + ">" : "" ;
public class Client { /** * Broadcasts a UDP message on the LAN to discover any running servers . * @ param udpPort The UDP port of the server . * @ param timeoutMillis The number of milliseconds to wait for a response . */ public List < InetAddress > discoverHosts ( int udpPort , int timeoutMillis ) { } }
List < InetAddress > hosts = new ArrayList < InetAddress > ( ) ; DatagramSocket socket = null ; try { socket = new DatagramSocket ( ) ; broadcast ( udpPort , socket ) ; socket . setSoTimeout ( timeoutMillis ) ; while ( true ) { DatagramPacket packet = discoveryHandler . onRequestNewDatagramPacket ( ) ; try { socket . receive ( packet ) ; } catch ( SocketTimeoutException ex ) { if ( INFO ) info ( "kryonet" , "Host discovery timed out." ) ; return hosts ; } if ( INFO ) info ( "kryonet" , "Discovered server: " + packet . getAddress ( ) ) ; discoveryHandler . onDiscoveredHost ( packet , getKryo ( ) ) ; hosts . add ( packet . getAddress ( ) ) ; } } catch ( IOException ex ) { if ( ERROR ) error ( "kryonet" , "Host discovery failed." , ex ) ; return hosts ; } finally { if ( socket != null ) socket . close ( ) ; discoveryHandler . onFinally ( ) ; }
public class AfplibFactoryImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public String convertResourceObjectTypeObjTypeToString ( EDataType eDataType , Object instanceValue ) { } }
return instanceValue == null ? null : instanceValue . toString ( ) ;
public class EditText { /** * Get the character offset closest to the specified absolute position . A typical use case is to * pass the result of { @ link android . view . MotionEvent # getX ( ) } and { @ link android . view . MotionEvent # getY ( ) } to this method . * @ param x The horizontal absolute position of a point on screen * @ param y The vertical absolute position of a point on screen * @ return the character offset for the character whose position is closest to the specified * position . Returns - 1 if there is no layout . */ @ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public int getOffsetForPosition ( float x , float y ) { } }
if ( getLayout ( ) == null ) return - 1 ; final int line = getLineAtCoordinate ( y ) ; final int offset = getOffsetAtCoordinate ( line , x ) ; return offset ;
public class ArrayUtils { /** * 堆排序 * @ param arrays 数组 */ public static void heapSort ( int [ ] arrays ) { } }
// 将待排序的序列构建成一个大顶堆 for ( int i = arrays . length / ValueConsts . TWO_INT ; i >= 0 ; i -- ) { heapAdjust ( arrays , i , arrays . length ) ; } // 逐步将每个最大值的根节点与末尾元素交换 , 并且再调整二叉树 , 使其成为大顶堆 for ( int i = arrays . length - 1 ; i > 0 ; i -- ) { // 将堆顶记录和当前未经排序子序列的最后一个记录交换 switchNumber ( arrays , 0 , i ) ; // 交换之后 , 需要重新检查堆是否符合大顶堆 , 不符合则要调整 heapAdjust ( arrays , 0 , i ) ; }
public class FieldData { /** * Get the table name . */ public String getTableNames ( boolean bAddQuotes ) { } }
return ( m_tableName == null ) ? Record . formatTableNames ( FIELD_DATA_FILE , bAddQuotes ) : super . getTableNames ( bAddQuotes ) ;
public class WImage { /** * Sets the image to an external URL . * @ param imageUrl the image URL . */ public void setImageUrl ( final String imageUrl ) { } }
ImageModel model = getOrCreateComponentModel ( ) ; model . imageUrl = imageUrl ; model . image = null ;
public class WindowsProcess { /** * { @ inheritDoc } */ @ Override public synchronized void writeStdin ( ByteBuffer buffer ) { } }
if ( hStdinWidow != null && ! NuWinNT . INVALID_HANDLE_VALUE . getPointer ( ) . equals ( hStdinWidow . getPointer ( ) ) ) { pendingWrites . add ( buffer ) ; if ( ! writePending ) { myProcessor . wantWrite ( this ) ; } } else { throw new IllegalStateException ( "closeStdin() method has already been called." ) ; }
public class DatabaseSpec { /** * @ param tableName * checks the result from select */ @ Then ( "^I check that result is:$" ) public void comparetable ( DataTable dataTable ) throws Exception { } }
// from Cucumber Datatable , the pattern to verify List < String > tablePattern = new ArrayList < String > ( ) ; tablePattern = dataTable . asList ( String . class ) ; // the result from select List < String > sqlTable = new ArrayList < String > ( ) ; // the result is taken from previous step for ( int i = 0 ; ThreadProperty . get ( "queryresponse" + i ) != null ; i ++ ) { String ip_value = ThreadProperty . get ( "queryresponse" + i ) ; sqlTable . add ( i , ip_value ) ; } for ( int i = 0 ; ThreadProperty . get ( "queryresponse" + i ) != null ; i ++ ) { ThreadProperty . remove ( "queryresponse" + i ) ; } assertThat ( tablePattern ) . as ( "response is not equal to the expected" ) . isEqualTo ( sqlTable ) ;
public class UBench { /** * Include a named task in to the benchmark . * @ param < T > * The type of the return value from the task . It is ignored . * @ param name * The name of the task . Only one task with any one name is * allowed . * @ param task * The task to perform * @ return The same object , for chaining calls . */ public < T > UBench addTask ( String name , Supplier < T > task ) { } }
return addTask ( name , task , null ) ;
public class ApiOvhOrder { /** * Create order * REST : POST / order / hosting / web / { serviceName } / changeMainDomain / { duration } * @ param domain [ required ] New domain for change the main domain * @ param mxplan [ required ] MX plan linked to the odl main domain * @ param serviceName [ required ] The internal name of your hosting * @ param duration [ required ] Duration */ public OvhOrder hosting_web_serviceName_changeMainDomain_duration_POST ( String serviceName , String duration , String domain , OvhMxPlanEnum mxplan ) throws IOException { } }
String qPath = "/order/hosting/web/{serviceName}/changeMainDomain/{duration}" ; StringBuilder sb = path ( qPath , serviceName , duration ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "domain" , domain ) ; addBody ( o , "mxplan" , mxplan ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhOrder . class ) ;
public class Strings { /** * A helper to make a URL from a filespec . */ private static URL makeURLFromFilespec ( final String filespec , final String relativePrefix ) throws IOException { } }
// make sure the file is absolute & canonical file url File file = new File ( decode ( filespec ) ) ; // if we have a prefix and the file is not abs then prepend if ( relativePrefix != null && ! file . isAbsolute ( ) ) { file = new File ( relativePrefix , filespec ) ; } // make sure it is canonical ( no . . / and such ) file = file . getCanonicalFile ( ) ; return file . toURI ( ) . toURL ( ) ;
public class CoreDataStyle { /** * Append locale and volatile attributes * @ param util an util * @ param appendable the destination * @ throws IOException if an error occurs */ public void appendLVAttributes ( final XMLUtil util , final Appendable appendable ) throws IOException { } }
this . appendLocaleAttributes ( util , appendable ) ; this . appendVolatileAttribute ( util , appendable ) ;
public class TransformerHandlerImpl { /** * Filter an end element event . * @ param uri The element ' s Namespace URI , or the empty string . * @ param localName The element ' s local name , or the empty string . * @ param qName The element ' s qualified ( prefixed ) name , or the empty * string . * @ throws SAXException The client may throw * an exception during processing . * @ see org . xml . sax . ContentHandler # endElement */ public void endElement ( String uri , String localName , String qName ) throws SAXException { } }
if ( DEBUG ) System . out . println ( "TransformerHandlerImpl#endElement: " + qName ) ; if ( m_contentHandler != null ) { m_contentHandler . endElement ( uri , localName , qName ) ; }
public class Symtab { /** * Enter a unary operation into symbol table . * @ param name The name of the operator . * @ param arg The type of the operand . * @ param res The operation ' s result type . * @ param opcode The operation ' s bytecode instruction . */ private OperatorSymbol enterUnop ( String name , Type arg , Type res , int opcode ) { } }
OperatorSymbol sym = new OperatorSymbol ( makeOperatorName ( name ) , new MethodType ( List . of ( arg ) , res , List . < Type > nil ( ) , methodClass ) , opcode , predefClass ) ; predefClass . members ( ) . enter ( sym ) ; return sym ;
public class MtasDataItemFull { /** * ( non - Javadoc ) * @ see mtas . codec . util . DataCollector . MtasDataItem # rewrite ( ) */ @ Override public Map < String , Object > rewrite ( boolean showDebugInfo ) throws IOException { } }
createStats ( ) ; Map < String , Object > response = new HashMap < > ( ) ; for ( String statsItem : getStatsItems ( ) ) { if ( statsItem . equals ( CodecUtil . STATS_TYPE_SUM ) ) { response . put ( statsItem , stats . getSum ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_N ) ) { response . put ( statsItem , stats . getN ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_MAX ) ) { response . put ( statsItem , stats . getMax ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_MIN ) ) { response . put ( statsItem , stats . getMin ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_SUMSQ ) ) { response . put ( statsItem , stats . getSumsq ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_SUMOFLOGS ) ) { response . put ( statsItem , stats . getN ( ) * Math . log ( stats . getGeometricMean ( ) ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_MEAN ) ) { response . put ( statsItem , stats . getMean ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_GEOMETRICMEAN ) ) { response . put ( statsItem , stats . getGeometricMean ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_STANDARDDEVIATION ) ) { response . put ( statsItem , stats . getStandardDeviation ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_VARIANCE ) ) { response . put ( statsItem , stats . getVariance ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_POPULATIONVARIANCE ) ) { response . put ( statsItem , stats . getPopulationVariance ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_QUADRATICMEAN ) ) { response . put ( statsItem , Math . sqrt ( stats . getSumsq ( ) / stats . getN ( ) ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_KURTOSIS ) ) { response . put ( statsItem , stats . getKurtosis ( ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_MEDIAN ) ) { response . put ( statsItem , stats . getPercentile ( 50 ) ) ; } else if ( statsItem . equals ( CodecUtil . STATS_TYPE_SKEWNESS ) ) { response . put ( statsItem , stats . getSkewness ( ) ) ; } else { Matcher m = fpStatsFunctionItems . matcher ( statsItem ) ; if ( m . find ( ) ) { String function = m . group ( 2 ) . trim ( ) ; if ( function . equals ( CodecUtil . STATS_FUNCTION_DISTRIBUTION ) ) { response . put ( statsItem , getDistribution ( m . group ( 4 ) ) ) ; } } } } if ( errorNumber > 0 ) { Map < String , Object > errorResponse = new HashMap < > ( ) ; for ( Entry < String , Integer > entry : getErrorList ( ) . entrySet ( ) ) { errorResponse . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } response . put ( "errorNumber" , errorNumber ) ; response . put ( "errorList" , errorResponse ) ; } if ( showDebugInfo ) { response . put ( "sourceNumber" , sourceNumber ) ; response . put ( "stats" , "full" ) ; } return response ;
public class Datapoint { /** * Add datapoint of long type value . * @ param time datapoint ' s timestamp * @ param value datapoint ' s value * @ return Datapoint */ public Datapoint addLongValue ( long time , long value ) { } }
initialValues ( ) ; checkType ( TsdbConstants . TYPE_LONG ) ; values . add ( Lists . < JsonNode > newArrayList ( new LongNode ( time ) , new LongNode ( value ) ) ) ; return this ;
public class PluginBase { /** * Override this method if you don ' t use the new threshold syntax . Here you * must tell the threshold evaluator all the threshold it must be able to * evaluate . Give a look at the source of the CheckOracle plugin for an * example of a plugin that supports both old and new syntax . * @ param thrb * The { @ link ThresholdsEvaluatorBuilder } object to be configured * @ param cl * The command line * @ throws BadThresholdException */ protected void configureThresholdEvaluatorBuilder ( final ThresholdsEvaluatorBuilder thrb , final ICommandLine cl ) throws BadThresholdException { } }
if ( cl . hasOption ( "th" ) ) { for ( Object obj : cl . getOptionValues ( "th" ) ) { thrb . withThreshold ( obj . toString ( ) ) ; } }
public class PICTUtil { /** * Reads a 32 byte fixed length Pascal string from the given input . * The input stream must be positioned at the length byte of the text , * the text will be no longer than 31 characters long . * @ param pStream the input stream * @ return the text read * @ throws IOException if an I / O exception occurs during reading */ public static String readStr31 ( final DataInput pStream ) throws IOException { } }
String text = readPascalString ( pStream ) ; int length = 31 - text . length ( ) ; if ( length < 0 ) { throw new IOException ( "String length exceeds maximum (31): " + text . length ( ) ) ; } pStream . skipBytes ( length ) ; return text ;
public class CoreSynonymDictionaryEx { /** * 获取语义标签 * @ return */ public static long [ ] getLexemeArray ( List < CommonSynonymDictionary . SynonymItem > synonymItemList ) { } }
long [ ] array = new long [ synonymItemList . size ( ) ] ; int i = 0 ; for ( CommonSynonymDictionary . SynonymItem item : synonymItemList ) { array [ i ++ ] = item . entry . id ; } return array ;
public class KeyUsageExtension { /** * Get the attribute value . */ public Boolean get ( String name ) throws IOException { } }
if ( name . equalsIgnoreCase ( DIGITAL_SIGNATURE ) ) { return Boolean . valueOf ( isSet ( 0 ) ) ; } else if ( name . equalsIgnoreCase ( NON_REPUDIATION ) ) { return Boolean . valueOf ( isSet ( 1 ) ) ; } else if ( name . equalsIgnoreCase ( KEY_ENCIPHERMENT ) ) { return Boolean . valueOf ( isSet ( 2 ) ) ; } else if ( name . equalsIgnoreCase ( DATA_ENCIPHERMENT ) ) { return Boolean . valueOf ( isSet ( 3 ) ) ; } else if ( name . equalsIgnoreCase ( KEY_AGREEMENT ) ) { return Boolean . valueOf ( isSet ( 4 ) ) ; } else if ( name . equalsIgnoreCase ( KEY_CERTSIGN ) ) { return Boolean . valueOf ( isSet ( 5 ) ) ; } else if ( name . equalsIgnoreCase ( CRL_SIGN ) ) { return Boolean . valueOf ( isSet ( 6 ) ) ; } else if ( name . equalsIgnoreCase ( ENCIPHER_ONLY ) ) { return Boolean . valueOf ( isSet ( 7 ) ) ; } else if ( name . equalsIgnoreCase ( DECIPHER_ONLY ) ) { return Boolean . valueOf ( isSet ( 8 ) ) ; } else { throw new IOException ( "Attribute name not recognized by" + " CertAttrSet:KeyUsage." ) ; }
public class NumberBindings { /** * An number binding of a division that won ' t throw an { @ link java . lang . ArithmeticException } * when a division by zero happens . See { @ link # divideSafe ( javafx . beans . value . ObservableIntegerValue , * javafx . beans . value . ObservableIntegerValue ) } * for more informations . * @ param dividend the observable value used as dividend * @ param divisor the observable value used as divisor * @ param defaultValue the observable value that is used as default value . The binding will have this value when a * division by zero happens . * @ return the resulting number binding */ public static NumberBinding divideSafe ( ObservableValue < Number > dividend , ObservableValue < Number > divisor , ObservableValue < Number > defaultValue ) { } }
return Bindings . createDoubleBinding ( ( ) -> { if ( divisor . getValue ( ) . doubleValue ( ) == 0 ) { return defaultValue . getValue ( ) . doubleValue ( ) ; } else { return dividend . getValue ( ) . doubleValue ( ) / divisor . getValue ( ) . doubleValue ( ) ; } } , dividend , divisor ) ;
public class SubsystemFeatureDefinitionImpl { /** * Set the provisioning details : used when preparing existing subsystem definition * for provisioning operation * @ param details reconstituted provisioning details */ @ Trivial synchronized void setProvisioningDetails ( ProvisioningDetails details ) { } }
// In general , we want to allow the provisioning details to be completely cleaned up // when the provisioning operation is completed . // If LibertyFeature service has requested provisioning details , then we need to keep // them around until that reference is cleaned up if ( details == null ) { if ( detailUsers . decrementAndGet ( ) <= 0 ) { // we are free to clear the details so they can be garbage collected . featureBundles . set ( null ) ; mfDetails = null ; } } else { // Refresh the reference with whatever is the latest ( previous would be garbage collected ) mfDetails = details ; detailUsers . incrementAndGet ( ) ; }
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 342:1 : normalInterfaceDeclaration : ' interface ' Identifier ( typeParameters ) ? ( ' extends ' typeList ) ? interfaceBody ; */ public final void normalInterfaceDeclaration ( ) throws RecognitionException { } }
int normalInterfaceDeclaration_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 17 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:5 : ( ' interface ' Identifier ( typeParameters ) ? ( ' extends ' typeList ) ? interfaceBody ) // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:7 : ' interface ' Identifier ( typeParameters ) ? ( ' extends ' typeList ) ? interfaceBody { match ( input , 93 , FOLLOW_93_in_normalInterfaceDeclaration572 ) ; if ( state . failed ) return ; match ( input , Identifier , FOLLOW_Identifier_in_normalInterfaceDeclaration574 ) ; if ( state . failed ) return ; // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:30 : ( typeParameters ) ? int alt28 = 2 ; int LA28_0 = input . LA ( 1 ) ; if ( ( LA28_0 == 53 ) ) { alt28 = 1 ; } switch ( alt28 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:30 : typeParameters { pushFollow ( FOLLOW_typeParameters_in_normalInterfaceDeclaration576 ) ; typeParameters ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:46 : ( ' extends ' typeList ) ? int alt29 = 2 ; int LA29_0 = input . LA ( 1 ) ; if ( ( LA29_0 == 81 ) ) { alt29 = 1 ; } switch ( alt29 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 343:47 : ' extends ' typeList { match ( input , 81 , FOLLOW_81_in_normalInterfaceDeclaration580 ) ; if ( state . failed ) return ; pushFollow ( FOLLOW_typeList_in_normalInterfaceDeclaration582 ) ; typeList ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } pushFollow ( FOLLOW_interfaceBody_in_normalInterfaceDeclaration586 ) ; interfaceBody ( ) ; state . _fsp -- ; if ( state . failed ) return ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving if ( state . backtracking > 0 ) { memoize ( input , 17 , normalInterfaceDeclaration_StartIndex ) ; } }
public class CheckedDatastoreReaderWriter { /** * Only use this method if the results are small enough that gathering them in list is acceptable . * Otherwise use { @ link # get ( Iterable , IOConsumer ) } . * @ see DatastoreReaderWriter # get ( Key . . . ) * @ throws IOException if the underlying client throws { @ link DatastoreException } */ List < Entity > get ( Iterable < Key > keys ) throws IOException { } }
return call ( ( ) -> ImmutableList . copyOf ( rw . get ( toArray ( keys , Key . class ) ) ) ) ;
public class UpdateFindingsFeedbackRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateFindingsFeedbackRequest updateFindingsFeedbackRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateFindingsFeedbackRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateFindingsFeedbackRequest . getComments ( ) , COMMENTS_BINDING ) ; protocolMarshaller . marshall ( updateFindingsFeedbackRequest . getDetectorId ( ) , DETECTORID_BINDING ) ; protocolMarshaller . marshall ( updateFindingsFeedbackRequest . getFeedback ( ) , FEEDBACK_BINDING ) ; protocolMarshaller . marshall ( updateFindingsFeedbackRequest . getFindingIds ( ) , FINDINGIDS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class URIMatcher { /** * Returns a list of all targets that match the specified uri in the * increasing order of specificity */ public List matchAll ( String uri ) { } }
ClauseNode currentNode = root ; ArrayList < Object > returnList = new ArrayList < Object > ( ) ; // extension matching done first in the matchAll case // since it is most generic int dot = uri . lastIndexOf ( "." ) ; if ( dot != - 1 ) { Object tar = extensions . get ( uri . substring ( dot + 1 ) ) ; if ( tar != null ) { returnList . add ( tar ) ; } } // add the default node if it exists if ( defaultNode != null ) { returnList . add ( defaultNode . getStarTarget ( ) ) ; } // walk the nodes adding star targets only boolean exact = true ; int startIdx = 1 ; int slashIdx ; boolean done = false ; while ( ! done ) { slashIdx = uri . indexOf ( '/' , startIdx ) ; String segment ; if ( slashIdx == - 1 ) { // last segment done = true ; slashIdx = uri . length ( ) ; segment = ( startIdx < slashIdx ) ? uri . substring ( startIdx , slashIdx ) : null ; } else { segment = uri . substring ( startIdx , slashIdx ) ; } if ( segment != null ) { currentNode = currentNode . traverse ( segment ) ; // PM06111 if ( currentNode == null ) { // no exact match , matches star node if it exists exact = false ; done = true ; } else if ( currentNode . getStarTarget ( ) != null ) { returnList . add ( currentNode . getStarTarget ( ) ) ; } startIdx = slashIdx + 1 ; } } if ( exact ) { // add exact only nodes since star nodes were added already Object target = currentNode . getTarget ( ) ; if ( target != null && currentNode . getStarTarget ( ) == null ) { returnList . add ( target ) ; } } return returnList ;
public class VersionInfo { /** * Returns an instance of VersionInfo with the argument version . * @ param major major version , non - negative number & lt ; = 255. * @ param minor minor version , non - negative number & lt ; = 255. * @ param milli milli version , non - negative number & lt ; = 255. * @ param micro micro version , non - negative number & lt ; = 255. * @ exception IllegalArgumentException when either arguments are negative or & gt ; 255 */ public static VersionInfo getInstance ( int major , int minor , int milli , int micro ) { } }
// checks if it is in the hashmap // else if ( major < 0 || major > 255 || minor < 0 || minor > 255 || milli < 0 || milli > 255 || micro < 0 || micro > 255 ) { throw new IllegalArgumentException ( INVALID_VERSION_NUMBER_ ) ; } int version = getInt ( major , minor , milli , micro ) ; Integer key = Integer . valueOf ( version ) ; VersionInfo result = MAP_ . get ( key ) ; if ( result == null ) { result = new VersionInfo ( version ) ; VersionInfo tmpvi = MAP_ . putIfAbsent ( key , result ) ; if ( tmpvi != null ) { result = tmpvi ; } } return result ;
public class TheMovieDbApi { /** * This method lets users delete a list that they created . A valid session * id is required . * @ param sessionId sessionId * @ param listId listId * @ return * @ throws MovieDbException exception */ public StatusCode deleteList ( String sessionId , String listId ) throws MovieDbException { } }
return tmdbList . deleteList ( sessionId , listId ) ;
public class Elements { /** * Looks up a automation - library - specific implementation for that element type , assuming an * implementation is registered for that class . */ @ SuppressWarnings ( "unchecked" ) public static < T extends Element > List < T > elements ( Class < T > type , Locator locator ) { } }
if ( ! type . isInterface ( ) ) { throw new IllegalArgumentException ( "Element type must be an interface, was: " + type ) ; } InvocationHandler invocationHandler = new ElementListHandler ( type , locator ) ; return ( List < T > ) Proxy . newProxyInstance ( Elements . class . getClassLoader ( ) , new Class [ ] { List . class , HasElementContext . class } , invocationHandler ) ;
public class Hierarchy { /** * Return whether or not the given method is concrete . * @ param xmethod * the method * @ return true if the method is concrete , false otherwise */ @ Deprecated public static boolean isConcrete ( XMethod xmethod ) { } }
int accessFlags = xmethod . getAccessFlags ( ) ; return ( accessFlags & Const . ACC_ABSTRACT ) == 0 && ( accessFlags & Const . ACC_NATIVE ) == 0 ;
public class Common { /** * Initialize the { @ link WorldGroupsManager } */ public void initializeWorldGroup ( ) { } }
if ( worldGroupManager == null ) { worldGroupManager = new WorldGroupsManager ( ) ; sendConsoleMessage ( Level . INFO , getLanguageManager ( ) . getString ( "world_group_manager_loaded" ) ) ; }
public class OSchemaHelper { /** * Set attr value for { @ link OProperty } * @ param attr attribute to set * @ param value value to set * @ return this helper */ public OSchemaHelper set ( OProperty . ATTRIBUTES attr , Object value ) { } }
checkOProperty ( ) ; lastProperty . set ( attr , value ) ; return this ;
public class JPAFieldOperationsImpl { /** * Checks if the types are the same , removing the " . java " in the end of the string in case it exists * @ param from * @ param to * @ return */ private boolean areTypesSame ( String from , String to ) { } }
String fromCompare = from . endsWith ( ".java" ) ? from . substring ( 0 , from . length ( ) - 5 ) : from ; String toCompare = to . endsWith ( ".java" ) ? to . substring ( 0 , to . length ( ) - 5 ) : to ; return fromCompare . equals ( toCompare ) ;
public class PersistentAtomicReference { /** * Set the reference to { @ code newValue } , and wraps { @ link IOException } s in * { @ link RuntimeException } s . * @ param newValue The value to set . * @ throws InterruptedException If the thread is interrupted . */ public void setUnchecked ( T newValue ) throws InterruptedException { } }
try { set ( newValue ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
public class Rollbar { /** * Record an error or message with extra data at the level specified . At least ene of ` error ` or * ` description ` must be non - null . If error is null , ` description ` will be sent as a message . If * error is non - null , description will be sent as the description of the error . Custom data will * be attached to message if the error is null . Custom data will extend whatever { @ link * Config # custom } returns . * @ param error the error ( if any ) . * @ param custom the custom data ( if any ) . * @ param description the description of the error , or the message to send . * @ param level the level to send it at . * @ param isUncaught whether or not this data comes from an uncaught exception . */ public void log ( ThrowableWrapper error , Map < String , Object > custom , String description , Level level , boolean isUncaught ) { } }
try { process ( error , custom , description , level , isUncaught ) ; } catch ( Exception e ) { LOGGER . error ( "Error while processing payload to send to Rollbar: {}" , e ) ; }
public class ParseUtils { /** * Parses out an int value from the provided string , equivalent to Integer . parseInt ( s . substring ( start , end ) ) , * but has significantly less overhead , no object creation and later garbage collection required . * @ throws { @ link NumberFormatException } if it encounters any character that is not [ - 0-9 ] . */ public static int parseSignedInt ( CharSequence s , final int start , final int end ) throws NumberFormatException { } }
if ( s . charAt ( start ) == '-' ) { // negative ! return - parseUnsignedInt ( s , start + 1 , end ) ; } else { return parseUnsignedInt ( s , start , end ) ; }
public class BaseLogger { /** * Logs a ' DEBUG ' message * @ param id the unique id of this log message * @ param messageTemplate the message template to use * @ param parameters a list of optional parameters */ protected void logDebug ( String id , String messageTemplate , Object ... parameters ) { } }
if ( delegateLogger . isDebugEnabled ( ) ) { String msg = formatMessageTemplate ( id , messageTemplate ) ; delegateLogger . debug ( msg , parameters ) ; }