signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class MapTileCircuitModel { /** * Update neighbor . * @ param tile The tile reference . * @ param neighbor The neighbor reference . */ private void updateNeigbor ( Tile tile , Tile neighbor ) { } }
final String group = mapGroup . getGroup ( tile ) ; final String neighborGroup = mapGroup . getGroup ( neighbor ) ; final Circuit circuit = getCircuitOverTransition ( extractor . getCircuit ( neighbor ) , neighbor ) ; if ( group . equals ( neighborGroup ) ) { updateTile ( tile , neighbor , circuit ) ; } else if ( neighborGroup . equals ( circuit . getIn ( ) ) ) { updateTile ( neighbor , neighbor , circuit ) ; }
public class NodeUtil { /** * Given the first sibling , this returns the nth * sibling or null if no such sibling exists . * This is like " getChildAtIndex " but returns null for non - existent indexes . */ private static Node getNthSibling ( Node first , int index ) { } }
Node sibling = first ; while ( index != 0 && sibling != null ) { sibling = sibling . getNext ( ) ; index -- ; } return sibling ;
public class PolylineSplitMerge { /** * Increase the number of sides in the polyline . This is done greedily selecting the side which would improve the * score by the most of it was split . * @ param contour Contour * @ return true if a split was selected and false if not */ boolean increaseNumberOfSidesByOne ( List < Point2D_I32 > contour , boolean loops ) { } }
// System . out . println ( " increase number of sides by one . list = " + list . size ( ) ) ; Element < Corner > selected = selectCornerToSplit ( loops ) ; // No side can be split if ( selected == null ) return false ; // Update the corner who ' s side was just split selected . object . sideError = selected . object . splitError0 ; // split the selected side and add a new corner Corner c = corners . grow ( ) ; c . reset ( ) ; c . index = selected . object . splitLocation ; c . sideError = selected . object . splitError1 ; Element < Corner > cornerE = list . insertAfter ( selected , c ) ; // see if the new side could be convex if ( convex && ! isSideConvex ( contour , selected ) ) return false ; else { // compute the score for sides which just changed computePotentialSplitScore ( contour , cornerE , list . size ( ) < minSides ) ; computePotentialSplitScore ( contour , selected , list . size ( ) < minSides ) ; // Save the results // printCurrent ( contour ) ; savePolyline ( ) ; return true ; }
public class BsUserCA { public void filter ( String name , EsAbstractConditionQuery . OperatorCall < BsUserCQ > queryLambda , ConditionOptionCall < FilterAggregationBuilder > opLambda , OperatorCall < BsUserCA > aggsLambda ) { } }
UserCQ cq = new UserCQ ( ) ; if ( queryLambda != null ) { queryLambda . callback ( cq ) ; } FilterAggregationBuilder builder = regFilterA ( name , cq . getQuery ( ) ) ; if ( opLambda != null ) { opLambda . callback ( builder ) ; } if ( aggsLambda != null ) { UserCA ca = new UserCA ( ) ; aggsLambda . callback ( ca ) ; ca . getAggregationBuilderList ( ) . forEach ( builder :: subAggregation ) ; }
public class GitlabAPI { /** * Gets email - on - push service setup for a projectId . * @ param projectId The ID of the project containing the variable . * @ throws IOException on gitlab api call error */ public GitlabServiceEmailOnPush getEmailsOnPush ( Integer projectId ) throws IOException { } }
String tailUrl = GitlabProject . URL + "/" + projectId + GitlabServiceEmailOnPush . URL ; return retrieve ( ) . to ( tailUrl , GitlabServiceEmailOnPush . class ) ;
public class BoxStoragePolicyAssignment { /** * Returns a BoxStoragePolicyAssignment information . * @ param api the API connection to be used by the resource . * @ param resolvedForType the assigned entity type for the storage policy . * @ param resolvedForID the assigned entity id for the storage policy . * @ return information about this { @ link BoxStoragePolicyAssignment } . */ public static BoxStoragePolicyAssignment . Info getAssignmentForTarget ( final BoxAPIConnection api , String resolvedForType , String resolvedForID ) { } }
QueryStringBuilder builder = new QueryStringBuilder ( ) ; builder . appendParam ( "resolved_for_type" , resolvedForType ) . appendParam ( "resolved_for_id" , resolvedForID ) ; URL url = STORAGE_POLICY_ASSIGNMENT_URL_TEMPLATE . buildWithQuery ( api . getBaseURL ( ) , builder . toString ( ) ) ; BoxAPIRequest request = new BoxAPIRequest ( api , url , HttpMethod . GET ) ; BoxJSONResponse response = ( BoxJSONResponse ) request . send ( ) ; BoxStoragePolicyAssignment storagePolicyAssignment = new BoxStoragePolicyAssignment ( api , response . getJsonObject ( ) . get ( "entries" ) . asArray ( ) . get ( 0 ) . asObject ( ) . get ( "id" ) . asString ( ) ) ; BoxStoragePolicyAssignment . Info info = storagePolicyAssignment . new Info ( response . getJsonObject ( ) . get ( "entries" ) . asArray ( ) . get ( 0 ) . asObject ( ) ) ; return info ;
public class CLIContext { /** * Get the string value , or the defaultValue if not found . * @ param key The key to search for . * @ return The value , or defaultValue if not found . */ public String getString ( String key , String defaultValue ) { } }
Object o = getObject ( key ) ; if ( o == null ) { return defaultValue ; } if ( ! ( o instanceof String ) ) { throw new IllegalArgumentException ( "Object [" + o + "] associated with key [" + key + "] is not of type String." ) ; } return ( String ) o ;
public class JSONBuilder { /** * Delivers the correct JSON Object for the stencilId * @ param stencilId * @ throws org . json . JSONException */ private static JSONObject parseStencil ( String stencilId ) throws JSONException { } }
JSONObject stencilObject = new JSONObject ( ) ; stencilObject . put ( "id" , stencilId . toString ( ) ) ; return stencilObject ;
public class ReplicationLinksInner { /** * Sets which replica database is primary by failing over from the current primary replica database . This operation might result in data loss . * @ 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 . * @ param databaseName The name of the database that has the replication link to be failed over . * @ param linkId The ID of the replication link to be failed over . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < Void > failoverAllowDataLossAsync ( String resourceGroupName , String serverName , String databaseName , String linkId ) { } }
return failoverAllowDataLossWithServiceResponseAsync ( resourceGroupName , serverName , databaseName , linkId ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class DevicesInner { /** * Scans for updates on a data box edge / gateway device . * @ param deviceName The device name . * @ param resourceGroupName The resource group name . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceResponse } object if successful . */ public Observable < Void > beginScanForUpdatesAsync ( String deviceName , String resourceGroupName ) { } }
return beginScanForUpdatesWithServiceResponseAsync ( deviceName , resourceGroupName ) . map ( new Func1 < ServiceResponse < Void > , Void > ( ) { @ Override public Void call ( ServiceResponse < Void > response ) { return response . body ( ) ; } } ) ;
public class ParticipantReader { /** * Add the requested query string arguments to the Request . * @ param request Request to add query string arguments to */ private void addQueryParams ( final Request request ) { } }
if ( status != null ) { request . addQueryParam ( "Status" , status . toString ( ) ) ; } if ( identity != null ) { request . addQueryParam ( "Identity" , identity ) ; } if ( dateCreatedAfter != null ) { request . addQueryParam ( "DateCreatedAfter" , dateCreatedAfter . toString ( ) ) ; } if ( dateCreatedBefore != null ) { request . addQueryParam ( "DateCreatedBefore" , dateCreatedBefore . toString ( ) ) ; } if ( getPageSize ( ) != null ) { request . addQueryParam ( "PageSize" , Integer . toString ( getPageSize ( ) ) ) ; }
public class CpaBid { /** * Gets the bidSource value for this CpaBid . * @ return bidSource * The level ( ad group , ad group strategy , or campaign strategy ) * at which the bid was set . * This is applicable only at the ad group level . * < span class = " constraint ReadOnly " > This field is read only and will * be ignored when sent to the API . < / span > */ public com . google . api . ads . adwords . axis . v201809 . cm . BidSource getBidSource ( ) { } }
return bidSource ;
public class WildcardImport { /** * Creates a { @ link Fix } that replaces wildcard imports . */ static Fix createFix ( ImmutableList < ImportTree > wildcardImports , Set < TypeToImport > typesToImport , VisitorState state ) { } }
Map < Symbol , List < TypeToImport > > toFix = typesToImport . stream ( ) . collect ( Collectors . groupingBy ( TypeToImport :: owner ) ) ; final SuggestedFix . Builder fix = SuggestedFix . builder ( ) ; for ( ImportTree importToDelete : wildcardImports ) { String importSpecification = importToDelete . getQualifiedIdentifier ( ) . toString ( ) ; if ( importToDelete . isStatic ( ) ) { fix . removeStaticImport ( importSpecification ) ; } else { fix . removeImport ( importSpecification ) ; } } for ( Map . Entry < Symbol , List < TypeToImport > > entry : toFix . entrySet ( ) ) { final Symbol owner = entry . getKey ( ) ; if ( entry . getKey ( ) . getKind ( ) != ElementKind . PACKAGE && entry . getValue ( ) . size ( ) > MAX_MEMBER_IMPORTS ) { qualifiedNameFix ( fix , owner , state ) ; } else { for ( TypeToImport toImport : entry . getValue ( ) ) { toImport . addFix ( fix ) ; } } } return fix . build ( ) ;
public class ServerListenerBuilder { /** * Add { @ link Runnable } invoked when the { @ link Server } is starting . * ( see : { @ link ServerListener # serverStarting ( Server ) } ) */ public ServerListenerBuilder addStartingCallback ( Runnable runnable ) { } }
requireNonNull ( runnable , "runnable" ) ; serverStartingCallbacks . add ( unused -> runnable . run ( ) ) ; return this ;
public class ClassicCounter { /** * { @ inheritDoc } */ public Collection < Double > values ( ) { } }
return new AbstractCollection < Double > ( ) { @ Override public Iterator < Double > iterator ( ) { return new Iterator < Double > ( ) { Iterator < MutableDouble > inner = map . values ( ) . iterator ( ) ; public boolean hasNext ( ) { return inner . hasNext ( ) ; } public Double next ( ) { // copy so as to give safety to mutable internal representation return Double . valueOf ( inner . next ( ) . doubleValue ( ) ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; } @ Override public int size ( ) { return map . size ( ) ; } @ Override public boolean contains ( Object v ) { return v instanceof Double && map . values ( ) . contains ( new MutableDouble ( ( Double ) v ) ) ; } } ;
public class Numeraire { /** * This method returns the value random variable of the product within the specified model , evaluated at a given evalutationTime . * Note : For a lattice this is often the value conditional to evalutationTime , for a Monte - Carlo simulation this is the ( sum of ) value discounted to evaluation time . * cash - flows prior evaluationTime are not considered . * @ param evaluationTime The time on which this products value should be observed . * @ param model The model used to price the product . * @ return The random variable representing the value of the product discounted to evaluation time * @ throws net . finmath . exception . CalculationException Thrown if the valuation fails , specific cause may be available via the < code > cause ( ) < / code > method . */ @ Override public RandomVariable getValue ( double evaluationTime , LIBORModelMonteCarloSimulationModel model ) throws CalculationException { } }
return model . getNumeraire ( evaluationTime ) ;
public class AbstractConnection { /** * used by the other message types */ protected synchronized void do_send ( final OtpOutputStream header ) throws IOException { } }
try { if ( traceLevel >= ctrlThreshold ) { try { final OtpErlangObject h = header . getOtpInputStream ( 5 ) . read_any ( ) ; System . out . println ( "-> " + headerType ( h ) + " " + h ) ; } catch ( final OtpErlangDecodeException e ) { System . out . println ( " " + "can't decode output buffer: " + e ) ; } } header . writeToAndFlush ( socket . getOutputStream ( ) ) ; } catch ( final IOException e ) { close ( ) ; throw e ; }
public class InterfacesXml { /** * Creates the appropriate AbstractInterfaceCriteriaElement for simple criterion . * Note ! changes / additions made here will likely need to be added to the corresponding write method that handles the write * of the element . Failure to do so will result in a configuration that can be read , but not written out . * @ throws javax . xml . stream . XMLStreamException if an error occurs * @ see { @ link # writeInterfaceCriteria ( org . jboss . staxmapper . XMLExtendedStreamWriter , org . jboss . dmr . ModelNode , boolean ) } */ private void parseSimpleInterfaceCriterion ( final XMLExtendedStreamReader reader , final ModelNode subModel , boolean nested ) throws XMLStreamException { } }
final Element element = Element . forName ( reader . getLocalName ( ) ) ; final String localName = element . getLocalName ( ) ; switch ( element ) { case INET_ADDRESS : { requireSingleAttribute ( reader , Attribute . VALUE . getLocalName ( ) ) ; final String value = reader . getAttributeValue ( 0 ) ; ModelNode valueNode = parsePossibleExpression ( value ) ; requireNoContent ( reader ) ; // todo : validate IP address if ( nested ) { subModel . get ( localName ) . add ( valueNode ) ; } else { subModel . get ( localName ) . set ( valueNode ) ; } break ; } case LOOPBACK_ADDRESS : { requireSingleAttribute ( reader , Attribute . VALUE . getLocalName ( ) ) ; final String value = reader . getAttributeValue ( 0 ) ; ModelNode valueNode = parsePossibleExpression ( value ) ; requireNoContent ( reader ) ; // todo : validate IP address subModel . get ( localName ) . set ( valueNode ) ; break ; } case LINK_LOCAL_ADDRESS : case LOOPBACK : case MULTICAST : case POINT_TO_POINT : case PUBLIC_ADDRESS : case SITE_LOCAL_ADDRESS : case UP : case VIRTUAL : { requireNoAttributes ( reader ) ; requireNoContent ( reader ) ; subModel . get ( localName ) . set ( true ) ; break ; } case NIC : { requireSingleAttribute ( reader , Attribute . NAME . getLocalName ( ) ) ; final String value = reader . getAttributeValue ( 0 ) ; requireNoContent ( reader ) ; // todo : validate NIC name if ( nested ) { subModel . get ( localName ) . add ( value ) ; } else { subModel . get ( localName ) . set ( value ) ; } break ; } case NIC_MATCH : { requireSingleAttribute ( reader , Attribute . PATTERN . getLocalName ( ) ) ; final String value = reader . getAttributeValue ( 0 ) ; requireNoContent ( reader ) ; // todo : validate pattern if ( nested ) { subModel . get ( localName ) . add ( value ) ; } else { subModel . get ( localName ) . set ( value ) ; } break ; } case SUBNET_MATCH : { requireSingleAttribute ( reader , Attribute . VALUE . getLocalName ( ) ) ; final String value = reader . getAttributeValue ( 0 ) ; requireNoContent ( reader ) ; if ( nested ) { subModel . get ( localName ) . add ( value ) ; } else { subModel . get ( localName ) . set ( value ) ; } break ; } default : throw unexpectedElement ( reader ) ; }
public class RandomUtils { /** * Returns a index of a specified probability , e . g . the string is " 100:1:32:200:16:30 " . * If it returns 0 that probability is 100 / ( 100 + 1 + 32 + 200 + 16 + 30) * @ param conf Configures specified probability * @ return The index of a specified probability */ public static int randomSegment ( String conf ) { } }
String [ ] tmp = StringUtils . split ( conf , ":" ) ; int [ ] probability = new int [ tmp . length ] ; for ( int i = 0 ; i < probability . length ; i ++ ) probability [ i ] = Integer . parseInt ( tmp [ i ] . trim ( ) ) ; return randomSegment ( probability ) ;
public class DelayedMBeanActivatorHelper { /** * DS method to activate this component . * @ param compContext */ protected void activate ( ComponentContext compContext ) { } }
BundleContext ctx = compContext . getBundleContext ( ) ; mDelayedMBeanActivator = new DelayedMBeanActivator ( ctx ) ; pipeline . insert ( mDelayedMBeanActivator ) ; try { mbeanTracker = new ServiceTracker < Object , ServiceReference < ? > > ( ctx , ctx . createFilter ( "(jmx.objectname=*)" ) , this ) ; mbeanTracker . open ( true ) ; } catch ( InvalidSyntaxException ise ) { }
public class Factories { /** * Creates a new instance of a class whose full qualified name is specified under the given key , loading * the class with the given class loader . * < br / > * If the given settings is null , or it does not contain the specified key , the default value of the key * is taken from the { @ link Defaults defaults } . * @ param settings the configuration settings that may specify the full qualified name of the class to create , * overriding the default value * @ param key the key under which the full qualified name of the class is specified * @ param classLoader the class loader to use to load the full qualified name of the class * @ return a new instance of the class specified by the given key * @ throws ServiceLocationException if the instance cannot be created * @ see # newInstance ( Settings , Key ) */ public static < T > T newInstance ( Settings settings , Key < String > key , ClassLoader classLoader ) throws ServiceLocationException { } }
Class < ? > klass = loadClass ( settings , key , classLoader ) ; // Workaround for compiler bug ( # 6302954) return Factories . < T > newInstance ( klass ) ;
public class PBBaseBeanImpl { /** * Delete an object . */ public void deleteObject ( Object object ) { } }
PersistenceBroker broker = null ; try { broker = getBroker ( ) ; broker . delete ( object ) ; } finally { if ( broker != null ) broker . close ( ) ; }
public class OutputManager { /** * gets the Event and sends it to the right outputPlugin for further processing * passDataToOutputPlugins is the main method of OutputManger . It is called whenever the output process has to be started * @ param event an Instance of Event */ public void passDataToOutputPlugins ( EventModel event ) { } }
IdentificationManagerM identificationManager = IdentificationManager . getInstance ( ) ; List < Identification > allIds = outputPlugins . stream ( ) . map ( identificationManager :: getIdentification ) . filter ( Optional :: isPresent ) . map ( Optional :: get ) . collect ( Collectors . toList ( ) ) ; HashMap < Integer , List < Identification > > outputPluginBehaviour = event . getEventBehaviourController ( ) . getOutputPluginBehaviour ( allIds ) ; @ SuppressWarnings ( "unchecked" ) Set < OutputPluginModel > outputPluginsCopy = ( Set < OutputPluginModel > ) this . outputPlugins . clone ( ) ; Function < List < Identification > , List < OutputPluginModel > > getOutputPlugin = ids -> ids . stream ( ) . map ( id -> outputPluginsCopy . stream ( ) . filter ( outputPlugin -> outputPlugin . isOwner ( id ) ) . findFirst ( ) . orElseGet ( null ) ) . filter ( Objects :: nonNull ) . peek ( outputPluginsCopy :: remove ) . collect ( Collectors . toList ( ) ) ; outputPluginBehaviour . entrySet ( ) . stream ( ) . sorted ( Comparator . comparingInt ( ( Map . Entry < Integer , List < Identification > > x ) -> x . getKey ( ) ) . reversed ( ) ) . flatMap ( entry -> getOutputPlugin . apply ( entry . getValue ( ) ) . stream ( ) ) . distinct ( ) . forEach ( op -> processOutputPlugin ( event , op ) ) ; outputPluginsCopy . forEach ( op -> processOutputPlugin ( event , op ) ) ;
public class ChangesetsDao { /** * Get map data changes associated with the given changeset . * @ throws OsmAuthorizationException if not logged in * @ throws OsmNotFoundException if changeset with the given id does not exist */ public void getData ( long id , MapDataChangesHandler handler , MapDataFactory factory ) { } }
osm . makeAuthenticatedRequest ( CHANGESET + "/" + id + "/download" , null , new MapDataChangesParser ( handler , factory ) ) ;
public class SingleTabUrlNodeSyntaxHelper { /** * Get the index of the default tab for the user */ protected String getDefaultTabIndex ( HttpServletRequest httpServletRequest ) { } }
final String stylesheetParameter = this . stylesheetUserPreferencesService . getStylesheetParameter ( httpServletRequest , PreferencesScope . STRUCTURE , this . defaultTabParameter ) ; if ( stylesheetParameter != null ) { return stylesheetParameter ; } final IStylesheetDescriptor stylesheetDescriptor = this . stylesheetUserPreferencesService . getStylesheetDescriptor ( httpServletRequest , PreferencesScope . STRUCTURE ) ; final IStylesheetParameterDescriptor stylesheetParameterDescriptor = stylesheetDescriptor . getStylesheetParameterDescriptor ( this . defaultTabParameter ) ; if ( stylesheetParameterDescriptor != null ) { return stylesheetParameterDescriptor . getDefaultValue ( ) ; } return null ;
public class CompiledFEELSupport { /** * Generates a compilable class that reports a ( compile - time ) error at runtime */ public static CompiledFEELExpression compiledError ( String expression , String msg ) { } }
return new CompilerBytecodeLoader ( ) . makeFromJPExpression ( expression , compiledErrorExpression ( msg ) , Collections . emptySet ( ) ) ;
public class MasterWorkerInfo { /** * Sets the capacity of the worker in bytes . * @ param capacityBytesOnTiers used bytes on each storage tier */ public void updateCapacityBytes ( Map < String , Long > capacityBytesOnTiers ) { } }
mCapacityBytes = 0 ; mTotalBytesOnTiers = capacityBytesOnTiers ; for ( long t : mTotalBytesOnTiers . values ( ) ) { mCapacityBytes += t ; }
public class Link { /** * Create new { @ link Link } with additional { @ link Affordance } s . * @ param affordances must not be { @ literal null } . * @ return */ public Link andAffordances ( List < Affordance > affordances ) { } }
List < Affordance > newAffordances = new ArrayList < > ( ) ; newAffordances . addAll ( this . affordances ) ; newAffordances . addAll ( affordances ) ; return withAffordances ( newAffordances ) ;
public class GrassLegacyUtilities { /** * Return the row and column of the active region matrix for a give coordinate * * NOTE : basically the inverse of * { @ link GrassLegacyUtilities # rowColToCenterCoordinates ( Window , int , int ) } * @ param active the active region * @ param coord * @ return and int array containing row and col */ public static int [ ] coordinateToNearestRowCol ( Window active , Coordinate coord ) { } }
double easting = coord . x ; double northing = coord . y ; int [ ] rowcol = new int [ 2 ] ; if ( easting > active . getEast ( ) || easting < active . getWest ( ) || northing > active . getNorth ( ) || northing < active . getSouth ( ) ) { return null ; } double minx = active . getWest ( ) ; double ewres = active . getWEResolution ( ) ; for ( int i = 0 ; i < active . getCols ( ) ; i ++ ) { minx = minx + ewres ; if ( easting < minx ) { rowcol [ 1 ] = i ; break ; } } double maxy = active . getNorth ( ) ; double nsres = active . getNSResolution ( ) ; for ( int i = 0 ; i < active . getRows ( ) ; i ++ ) { maxy = maxy - nsres ; if ( northing > maxy ) { rowcol [ 0 ] = i ; break ; } } return rowcol ;
public class SignalServiceAccountManager { /** * Register / Unregister a Google Cloud Messaging registration ID . * @ param gcmRegistrationId The GCM id to register . A call with an absent value will unregister . * @ throws IOException */ public void setGcmId ( Optional < String > gcmRegistrationId ) throws IOException { } }
if ( gcmRegistrationId . isPresent ( ) ) { this . pushServiceSocket . registerGcmId ( gcmRegistrationId . get ( ) ) ; } else { this . pushServiceSocket . unregisterGcmId ( ) ; }
public class ContentSpecUtilities { /** * Fixes a failed Content Spec so that the ID and CHECKSUM are included . This is primarily an issue when creating new content specs * and they are initially invalid . * @ param id The id of the content spec tha tis being fixed . * @ param failedContentSpec The failed content spec to fix . * @ param validText The content specs latest valid text . * @ param includeChecksum If the checksum should be included in the output . * @ return The fixed failed content spec string . */ public static String fixFailedContentSpec ( final Integer id , final String failedContentSpec , final String validText , final boolean includeChecksum ) { } }
if ( failedContentSpec == null || failedContentSpec . isEmpty ( ) ) { return null ; } else if ( includeChecksum ) { if ( id == null || getContentSpecChecksum ( failedContentSpec ) != null ) { return failedContentSpec ; } else { final String cleanContentSpec = removeChecksumAndId ( failedContentSpec ) ; final String checksum = getContentSpecChecksum ( validText ) ; return CommonConstants . CS_CHECKSUM_TITLE + " = " + checksum + "\n" + CommonConstants . CS_ID_TITLE + " = " + id + "\n" + cleanContentSpec ; } } else { final String cleanContentSpec = removeChecksum ( failedContentSpec ) ; if ( id == null || getContentSpecID ( cleanContentSpec ) != null ) { return cleanContentSpec ; } else { return CommonConstants . CS_ID_TITLE + " = " + id + "\n" + cleanContentSpec ; } }
public class ServicesInner { /** * Get services in resource group . * The Services resource is the top - level resource that represents the Data Migration Service . This method returns a list of service resources in a resource group . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; DataMigrationServiceInner & gt ; object */ public Observable < Page < DataMigrationServiceInner > > listByResourceGroupNextAsync ( final String nextPageLink ) { } }
return listByResourceGroupNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DataMigrationServiceInner > > , Page < DataMigrationServiceInner > > ( ) { @ Override public Page < DataMigrationServiceInner > call ( ServiceResponse < Page < DataMigrationServiceInner > > response ) { return response . body ( ) ; } } ) ;
public class SAXEncoder { public void startElement ( String uri , String local , String raw , Attributes attributes ) throws SAXException { } }
try { // no prefix this . startElementPfx ( uri , local , null , attributes ) ; } catch ( Exception e ) { throw new SAXException ( "startElement: " + raw , e ) ; }
public class Interval { /** * Checks if the current interval contains the entirety of another interval . More formally , * this method returns { @ code true } , if for every point { @ code x } from the interval { @ code another } * this point { @ code x } also belongs to the current interval . * @ param another Another interval . * @ return { @ code true } , if the interval { @ code another } is contained in the current interval in * its entirety , or { @ code false } otherwise . */ public boolean contains ( Interval < T > another ) { } }
if ( another == null || isEmpty ( ) || another . isEmpty ( ) ) { return false ; } Interval < T > intersection = getIntersection ( another ) ; return intersection != null && intersection . equals ( another ) ;
public class Annotate { /** * Read already tokenized text ( one sentence per line ) and builds a NAF * document . * @ param breader * the reader * @ param kaf * the naf document * @ throws IOException * if io problems */ public static void tokensToKAF ( final Reader breader , final KAFDocument kaf ) throws IOException { } }
int noSents = 0 ; int noParas = 1 ; final List < String > sentences = CharStreams . readLines ( breader ) ; for ( final String sentence : sentences ) { noSents = noSents + 1 ; final String [ ] tokens = sentence . split ( DELIMITER ) ; for ( final String token : tokens ) { if ( token . equals ( RuleBasedSegmenter . PARAGRAPH ) ) { ++ noParas ; // TODO sentences without end markers ; // crap rule while ( noParas > noSents ) { ++ noSents ; } } else { // TODO add offset final WF wf = kaf . newWF ( 0 , token , noSents ) ; wf . setPara ( noParas ) ; // wf . setSent ( noSents ) ; } } }
public class ManagementClientImpl { /** * min + max ASDU len are * not * including any field that contains ACPI */ private byte [ ] waitForResponse ( final IndividualAddress from , final int minAsduLen , final int maxAsduLen , final long timeout , final Optional < List < IndividualAddress > > responders ) throws KNXInvalidResponseException , KNXTimeoutException , InterruptedException { } }
long remaining = timeout ; final long end = System . currentTimeMillis ( ) + remaining ; synchronized ( indications ) { while ( remaining > 0 ) { while ( indications . size ( ) > 0 ) { final CEMI frame = indications . remove ( ) . getFrame ( ) ; final byte [ ] apdu = frame . getPayload ( ) ; if ( svcResponse != DataUnitBuilder . getAPDUService ( apdu ) ) continue ; // broadcasts set parameter from to null ; we then accept every sender address if ( from != null ) { if ( ! ( ( CEMILData ) frame ) . getSource ( ) . equals ( from ) ) continue ; } if ( apdu . length < minAsduLen + 2 || apdu . length > maxAsduLen + 2 ) { final String s = "invalid ASDU response length " + ( apdu . length - 2 ) + " bytes, expected " + minAsduLen + " to " + maxAsduLen ; logger . error ( "received response with " + s ) ; throw new KNXInvalidResponseException ( s ) ; } if ( svcResponse == IND_ADDR_RESPONSE || svcResponse == IND_ADDR_SN_RESPONSE ) return ( ( CEMILData ) frame ) . getSource ( ) . toByteArray ( ) ; indications . clear ( ) ; responders . ifPresent ( ( l ) -> l . add ( ( ( CEMILData ) frame ) . getSource ( ) ) ) ; return apdu ; } indications . wait ( remaining ) ; remaining = end - System . currentTimeMillis ( ) ; } } throw new KNXTimeoutException ( "timeout occurred while waiting for data response" ) ;
public class VoldemortServer { /** * - - LGao */ private void checkHostName ( ) { } }
try { HashSet < String > ipAddrList = new HashSet < String > ( ) ; InetAddress localhost = InetAddress . getLocalHost ( ) ; InetAddress [ ] serverAddrs = InetAddress . getAllByName ( localhost . getCanonicalHostName ( ) ) ; ipAddrList . add ( "localhost" ) ; if ( serverAddrs != null && serverAddrs . length > 0 ) { for ( InetAddress addr : serverAddrs ) { if ( addr . getHostName ( ) != null ) ipAddrList . add ( addr . getHostName ( ) ) ; if ( addr . getHostAddress ( ) != null ) ipAddrList . add ( addr . getHostAddress ( ) ) ; if ( addr . getCanonicalHostName ( ) != null ) ipAddrList . add ( addr . getCanonicalHostName ( ) ) ; } } if ( ! ipAddrList . contains ( this . identityNode . getHost ( ) ) ) { logger . info ( "List of all IPs & Hostnames for the current node:" + ipAddrList ) ; logger . info ( "Configured hostname [" + this . identityNode . getHost ( ) + "] does not seem to match current node." ) ; } } catch ( UnknownHostException uhe ) { logger . warn ( "Unable to obtain IP information for current node" , uhe ) ; } catch ( SecurityException se ) { logger . warn ( "Security Manager does not permit obtaining IP Information" , se ) ; }
public class StreamScanner { /** * Method that will try to read one or more characters from currently * open input sources ; closing input sources if necessary . * @ return true if reading succeeded ( or may succeed ) , false if * we reached EOF . */ protected boolean loadMore ( ) throws XMLStreamException { } }
WstxInputSource input = mInput ; do { /* Need to make sure offsets are properly updated for error * reporting purposes , and do this now while previous amounts * are still known . */ mCurrInputProcessed += mInputEnd ; verifyLimit ( "Maximum document characters" , mConfig . getMaxCharacters ( ) , mCurrInputProcessed ) ; mCurrInputRowStart -= mInputEnd ; int count ; try { count = input . readInto ( this ) ; if ( count > 0 ) { return true ; } input . close ( ) ; } catch ( IOException ioe ) { throw constructFromIOE ( ioe ) ; } if ( input == mRootInput ) { /* Note : no need to check entity / input nesting in this * particular case , since it will be handled by higher level * parsing code ( results in an unexpected EOF ) */ return false ; } WstxInputSource parent = input . getParent ( ) ; if ( parent == null ) { // sanity check ! throwNullParent ( input ) ; } /* 13 - Feb - 2006 , TSa : Ok , do we violate a proper nesting constraints * with this input block closure ? */ if ( mCurrDepth != input . getScopeId ( ) ) { handleIncompleteEntityProblem ( input ) ; } mInput = input = parent ; input . restoreContext ( this ) ; mInputTopDepth = input . getScopeId ( ) ; /* 21 - Feb - 2006 , TSa : Since linefeed normalization needs to be * suppressed for internal entity expansion , we may need to * change the state . . . */ if ( ! mNormalizeLFs ) { mNormalizeLFs = ! input . fromInternalEntity ( ) ; } // Maybe there are leftovers from that input in buffer now ? } while ( mInputPtr >= mInputEnd ) ; return true ;
public class Certificate { /** * Replace the Certificate to be serialized . * @ return the alternate Certificate object to be serialized * @ throws java . io . ObjectStreamException if a new object representing * this Certificate could not be created * @ since 1.3 */ protected Object writeReplace ( ) throws java . io . ObjectStreamException { } }
try { return new CertificateRep ( type , getEncoded ( ) ) ; } catch ( CertificateException e ) { throw new java . io . NotSerializableException ( "java.security.cert.Certificate: " + type + ": " + e . getMessage ( ) ) ; }
public class ExtensionFactory { /** * Relax visibility to ease the tests . */ static boolean canBeLoaded ( Map < Class < ? extends Extension > , Extension > extensions , Extension extension ) { } }
return canBeLoaded ( extensions , extension , new ArrayList < > ( ) ) ;
public class RePairGrammar { /** * Global method : iterates over all rules expanding them . */ public void expandRules ( ) { } }
// iterate over all SAX containers for ( int currentPositionIndex = 1 ; currentPositionIndex <= this . theRules . size ( ) ; currentPositionIndex ++ ) { RePairRule rr = this . theRules . get ( currentPositionIndex ) ; String resultString = rr . toRuleString ( ) ; int currentSearchStart = resultString . indexOf ( THE_R ) ; while ( currentSearchStart >= 0 ) { int spaceIdx = resultString . indexOf ( SPACE , currentSearchStart ) ; String ruleName = resultString . substring ( currentSearchStart , spaceIdx + 1 ) ; Integer ruleId = Integer . valueOf ( ruleName . substring ( 1 , ruleName . length ( ) - 1 ) ) ; RePairRule rule = this . theRules . get ( ruleId ) ; if ( rule != null ) { if ( rule . expandedRuleString . charAt ( rule . expandedRuleString . length ( ) - 1 ) == ' ' ) { resultString = resultString . replaceAll ( ruleName , rule . expandedRuleString ) ; } else { resultString = resultString . replaceAll ( ruleName , rule . expandedRuleString + SPACE ) ; } } currentSearchStart = resultString . indexOf ( "R" , spaceIdx ) ; } rr . setExpandedRule ( resultString . trim ( ) ) ; } // and the r0 , String is immutable in Java String resultString = this . r0String ; int currentSearchStart = resultString . indexOf ( THE_R ) ; while ( currentSearchStart >= 0 ) { int spaceIdx = resultString . indexOf ( SPACE , currentSearchStart ) ; String ruleName = resultString . substring ( currentSearchStart , spaceIdx + 1 ) ; Integer ruleId = Integer . valueOf ( ruleName . substring ( 1 , ruleName . length ( ) - 1 ) ) ; RePairRule rule = this . theRules . get ( ruleId ) ; if ( rule != null ) { if ( rule . expandedRuleString . charAt ( rule . expandedRuleString . length ( ) - 1 ) == ' ' ) { resultString = resultString . replaceAll ( ruleName , rule . expandedRuleString ) ; } else { resultString = resultString . replaceAll ( ruleName , rule . expandedRuleString + SPACE ) ; } } currentSearchStart = resultString . indexOf ( "R" , spaceIdx ) ; } this . r0ExpandedString = resultString ;
public class AllConnectConnectionHolder { /** * 销毁全部连接 * @ param destroyHook 销毁钩子 */ @ Override public void closeAllClientTransports ( DestroyHook destroyHook ) { } }
// 清空所有列表 , 不让再调了 Map < ProviderInfo , ClientTransport > all = clearProviders ( ) ; if ( destroyHook != null ) { try { destroyHook . preDestroy ( ) ; } catch ( Exception e ) { if ( LOGGER . isWarnEnabled ( consumerConfig . getAppName ( ) ) ) { LOGGER . warnWithApp ( consumerConfig . getAppName ( ) , e . getMessage ( ) , e ) ; } } } // 多线程销毁已经建立的连接 int providerSize = all . size ( ) ; if ( providerSize > 0 ) { int timeout = consumerConfig . getDisconnectTimeout ( ) ; int threads = Math . min ( 10 , providerSize ) ; // 最大10个 final CountDownLatch latch = new CountDownLatch ( providerSize ) ; ThreadPoolExecutor closePool = new ThreadPoolExecutor ( threads , threads , 0L , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( providerSize ) , new NamedThreadFactory ( "CLI-DISCONN-" + consumerConfig . getInterfaceId ( ) , true ) ) ; for ( Map . Entry < ProviderInfo , ClientTransport > entry : all . entrySet ( ) ) { final ProviderInfo providerInfo = entry . getKey ( ) ; final ClientTransport transport = entry . getValue ( ) ; closePool . execute ( new Runnable ( ) { @ Override public void run ( ) { try { ClientTransportFactory . releaseTransport ( transport , 0 ) ; } catch ( Exception e ) { if ( LOGGER . isWarnEnabled ( consumerConfig . getAppName ( ) ) ) { LOGGER . warnWithApp ( consumerConfig . getAppName ( ) , "catch exception but ignore it when close alive client : {}" , providerInfo ) ; } } finally { latch . countDown ( ) ; } } } ) ; } try { int totalTimeout = ( ( providerSize % threads == 0 ) ? ( providerSize / threads ) : ( ( providerSize / threads ) + 1 ) ) * timeout + 500 ; latch . await ( totalTimeout , TimeUnit . MILLISECONDS ) ; // 一直等到 } catch ( InterruptedException e ) { LOGGER . errorWithApp ( consumerConfig . getAppName ( ) , "Exception when close transport" , e ) ; } finally { closePool . shutdown ( ) ; } }
public class TransactionContext { /** * Asynchronously rollback the transaction . * @ return a CompletableFuture for the rollback operation */ public CompletableFuture < Void > rollbackAsync ( ) { } }
if ( this . messagingFactory == null ) { CompletableFuture < Void > exceptionCompletion = new CompletableFuture < > ( ) ; exceptionCompletion . completeExceptionally ( new ServiceBusException ( false , "MessagingFactory should not be null" ) ) ; return exceptionCompletion ; } return this . messagingFactory . endTransactionAsync ( this , false ) ;
public class FixedIntHashMap { /** * Returns the value of the mapping with the specified key . * @ param key the key . * @ return the value of the mapping with the specified key , or { @ code - 1 } if no mapping for the specified * key is found . */ public T get ( final int key ) { } }
int index = ( ( key & 0x7FFFFFFF ) % elementKeys . length ) ; long m = elementKeys [ index ] ; if ( key == m ) { return elementValues [ index ] ; } return null ;
public class TransitionRepository { /** * Note in the database that a particular transition has been applied . * @ return true if the transition was noted , false if it could not be noted because another * process noted it first . */ public boolean noteTransition ( Class < ? > clazz , final String name ) throws PersistenceException { } }
final String cname = clazz . getName ( ) ; return executeUpdate ( new Operation < Boolean > ( ) { public Boolean invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { PreparedStatement stmt = null ; try { stmt = conn . prepareStatement ( "insert into " + liaison . tableSQL ( "TRANSITIONS" ) + " (" + liaison . columnSQL ( "CLASS" ) + ", " + liaison . columnSQL ( "NAME" ) + ", " + liaison . columnSQL ( "APPLIED" ) + ") values (?, ?, ?)" ) ; stmt . setString ( 1 , cname ) ; stmt . setString ( 2 , name ) ; stmt . setTimestamp ( 3 , new Timestamp ( System . currentTimeMillis ( ) ) ) ; JDBCUtil . checkedUpdate ( stmt , 1 ) ; return true ; } catch ( SQLException sqe ) { if ( liaison . isDuplicateRowException ( sqe ) ) { return false ; } else { throw sqe ; } } finally { JDBCUtil . close ( stmt ) ; } } } ) ;
public class StorePackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getDensity ( ) { } }
if ( densityEClass == null ) { densityEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( StorePackage . eNS_URI ) . getEClassifiers ( ) . get ( 121 ) ; } return densityEClass ;
public class IdpMetadataGenerator { /** * Generates extended metadata . Default extendedMetadata object is cloned if present and used for defaults . The * following properties are always overriden from the properties of this bean : discoveryUrl , discoveryResponseUrl , * signingKey , encryptionKey , entityAlias and tlsKey . Property local of the generated metadata is always set to * true . * @ return generated extended metadata */ public IdpExtendedMetadata generateExtendedMetadata ( ) { } }
IdpExtendedMetadata metadata ; if ( extendedMetadata != null ) { metadata = extendedMetadata . clone ( ) ; } else { metadata = new IdpExtendedMetadata ( ) ; } String entityBaseURL = getEntityBaseURL ( ) ; String entityAlias = getEntityAlias ( ) ; if ( isIncludeDiscovery ( ) ) { metadata . setIdpDiscoveryURL ( getDiscoveryURL ( entityBaseURL , entityAlias ) ) ; metadata . setIdpDiscoveryResponseURL ( getDiscoveryResponseURL ( entityBaseURL , entityAlias ) ) ; } else { metadata . setIdpDiscoveryURL ( null ) ; metadata . setIdpDiscoveryResponseURL ( null ) ; } metadata . setLocal ( true ) ; metadata . setAssertionTimeToLiveSeconds ( getAssertionTimeToLiveSeconds ( ) ) ; metadata . setAssertionsSigned ( isAssertionsSigned ( ) ) ; return metadata ;
public class FixedFatJarExportPage { /** * Returns the label of a path . * @ param path the path * @ param isOSPath if < code > true < / code > , the path represents an OS path , if < code > false < / code > it is a workspace path . * @ return the label of the path to be used in the UI . */ protected static String getPathLabel ( IPath path , boolean isOSPath ) { } }
String label ; if ( isOSPath ) { label = path . toOSString ( ) ; } else { label = path . makeRelative ( ) . toString ( ) ; } return label ;
public class CmsSiteManagerImpl { /** * Returns true if this request goes to a secure site . < p > * @ param req the request to check * @ return true if the request goes to a secure site */ public boolean usesSecureSite ( HttpServletRequest req ) { } }
CmsSite site = matchRequest ( req ) ; if ( site == null ) { return false ; } CmsSiteMatcher secureMatcher = site . getSecureServerMatcher ( ) ; boolean result = false ; if ( secureMatcher != null ) { result = secureMatcher . equals ( getRequestMatcher ( req ) ) ; } return result ;
public class FileUtil { /** * 按照给定的readerHandler读取文件中的数据 * @ param < T > 集合类型 * @ param readerHandler Reader处理类 * @ param path 文件的绝对路径 * @ return 从文件中load出的数据 * @ throws IORuntimeException IO异常 * @ since 3.1.1 */ public static < T > T loadUtf8 ( String path , ReaderHandler < T > readerHandler ) throws IORuntimeException { } }
return load ( path , CharsetUtil . CHARSET_UTF_8 , readerHandler ) ;
public class CommercePriceListUserSegmentEntryRelPersistenceImpl { /** * Caches the commerce price list user segment entry rel in the entity cache if it is enabled . * @ param commercePriceListUserSegmentEntryRel the commerce price list user segment entry rel */ @ Override public void cacheResult ( CommercePriceListUserSegmentEntryRel commercePriceListUserSegmentEntryRel ) { } }
entityCache . putResult ( CommercePriceListUserSegmentEntryRelModelImpl . ENTITY_CACHE_ENABLED , CommercePriceListUserSegmentEntryRelImpl . class , commercePriceListUserSegmentEntryRel . getPrimaryKey ( ) , commercePriceListUserSegmentEntryRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_UUID_G , new Object [ ] { commercePriceListUserSegmentEntryRel . getUuid ( ) , commercePriceListUserSegmentEntryRel . getGroupId ( ) } , commercePriceListUserSegmentEntryRel ) ; finderCache . putResult ( FINDER_PATH_FETCH_BY_C_C , new Object [ ] { commercePriceListUserSegmentEntryRel . getCommercePriceListId ( ) , commercePriceListUserSegmentEntryRel . getCommerceUserSegmentEntryId ( ) } , commercePriceListUserSegmentEntryRel ) ; commercePriceListUserSegmentEntryRel . resetOriginalValues ( ) ;
public class NodeUtil { /** * Returns true if the current node ' s type implies side effects . * < p > This is a non - recursive version of the may have side effects * check ; used to check wherever the current node ' s type is one of * the reasons why a subtree has side effects . */ static boolean nodeTypeMayHaveSideEffects ( Node n , AbstractCompiler compiler ) { } }
if ( isAssignmentOp ( n ) ) { return true ; } switch ( n . getToken ( ) ) { case DELPROP : case DEC : case INC : case YIELD : case THROW : case AWAIT : case FOR_IN : // assigns to a loop LHS case FOR_OF : // assigns to a loop LHS , runs an iterator case FOR_AWAIT_OF : // assigns to a loop LHS , runs an iterator , async operations . return true ; case CALL : case TAGGED_TEMPLATELIT : return NodeUtil . functionCallHasSideEffects ( n , compiler ) ; case NEW : return NodeUtil . constructorCallHasSideEffects ( n ) ; case NAME : // A variable definition . // TODO ( b / 129564961 ) : Consider EXPORT declarations . return n . hasChildren ( ) ; case REST : case SPREAD : return NodeUtil . iteratesImpureIterable ( n ) ; default : break ; } return false ;
public class Code { /** * Compare longs . This stores - 1 in { @ code target } if { @ code * a < b } , 0 in { @ code target } if { @ code a = = b } and 1 in target if { @ code * a > b } . */ public void compareLongs ( Local < Integer > target , Local < Long > a , Local < Long > b ) { } }
addInstruction ( new PlainInsn ( Rops . CMPL_LONG , sourcePosition , target . spec ( ) , RegisterSpecList . make ( a . spec ( ) , b . spec ( ) ) ) ) ;
public class FileLock { /** * checks if lockFile is older than ' olderThan ' UTC time by examining the modification time * on file and ( if necessary ) the timestamp in last log entry in the file . If its stale , then * returns the last log entry , else returns null . * @ param fs * @ param lockFile * @ param olderThan time ( millis ) in UTC . * @ return the last entry in the file if its too old . null if last entry is not too old * @ throws IOException */ public static LogEntry getLastEntryIfStale ( FileSystem fs , Path lockFile , long olderThan ) throws IOException { } }
long modifiedTime = fs . getFileStatus ( lockFile ) . getModificationTime ( ) ; if ( modifiedTime <= olderThan ) { // look // Impt : HDFS timestamp may not reflect recent appends , so we double check the // timestamp in last line of file to see when the last update was made LogEntry lastEntry = getLastEntry ( fs , lockFile ) ; if ( lastEntry == null ) { LOG . warn ( "Empty lock file found. Deleting it. {}" , lockFile ) ; try { if ( ! fs . delete ( lockFile , false ) ) throw new IOException ( "Empty lock file deletion failed" ) ; } catch ( Exception e ) { LOG . error ( "Unable to delete empty lock file " + lockFile , e ) ; } } if ( lastEntry . eventTime <= olderThan ) return lastEntry ; } return null ;
public class SystemEntityTypePersister { /** * Package - private for testability */ void removeNonExistingSystemEntityTypes ( ) { } }
// get all system entities List < EntityType > removedSystemEntityMetas = dataService . findAll ( ENTITY_TYPE_META_DATA , EntityType . class ) . filter ( EntityTypeUtils :: isSystemEntity ) . filter ( this :: isNotExists ) . collect ( toList ( ) ) ; dataService . getMeta ( ) . deleteEntityType ( removedSystemEntityMetas ) ; removedSystemEntityMetas . forEach ( entityType -> mutableAclClassService . deleteAclClass ( EntityIdentityUtils . toType ( entityType ) ) ) ;
public class CmsStringUtil { /** * Escapes a String so it may be used as a Perl5 regular expression . < p > * This method replaces the following characters in a String : < br > * < code > { } [ ] ( ) \ $ ^ . * + / < / code > < p > * < b > Directly exposed for JSP EL < / b > , not through { @ link org . opencms . jsp . util . CmsJspElFunctions } . < p > * @ param source the string to escape * @ return the escaped string */ public static String escapePattern ( String source ) { } }
if ( source == null ) { return null ; } StringBuffer result = new StringBuffer ( source . length ( ) * 2 ) ; for ( int i = 0 ; i < source . length ( ) ; ++ i ) { char ch = source . charAt ( i ) ; switch ( ch ) { case '\\' : result . append ( "\\\\" ) ; break ; case '/' : result . append ( "\\/" ) ; break ; case '$' : result . append ( "\\$" ) ; break ; case '^' : result . append ( "\\^" ) ; break ; case '.' : result . append ( "\\." ) ; break ; case '*' : result . append ( "\\*" ) ; break ; case '+' : result . append ( "\\+" ) ; break ; case '|' : result . append ( "\\|" ) ; break ; case '?' : result . append ( "\\?" ) ; break ; case '{' : result . append ( "\\{" ) ; break ; case '}' : result . append ( "\\}" ) ; break ; case '[' : result . append ( "\\[" ) ; break ; case ']' : result . append ( "\\]" ) ; break ; case '(' : result . append ( "\\(" ) ; break ; case ')' : result . append ( "\\)" ) ; break ; default : result . append ( ch ) ; } } return new String ( result ) ;
public class MarkLogicRepositoryConnection { /** * returns number of triples in supplied context * @ param contexts * @ return long * @ throws RepositoryException */ @ Override public long size ( Resource ... contexts ) throws RepositoryException { } }
if ( contexts == null ) { contexts = new Resource [ ] { null } ; } try { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "SELECT (count(?s) as ?ct) where { GRAPH ?g { ?s ?p ?o }" ) ; boolean first = true ; // with no args , measure the whole triple store . if ( contexts != null && contexts . length > 0 ) { sb . append ( "filter (?g = (" ) ; for ( Resource context : contexts ) { if ( first ) { first = ! first ; } else { sb . append ( "," ) ; } if ( context == null ) { sb . append ( "IRI(\"" + DEFAULT_GRAPH_URI + "\")" ) ; } else { sb . append ( "IRI(\"" + context . toString ( ) + "\")" ) ; } } sb . append ( ") )" ) ; } else { sb . append ( "filter (?g = (IRI(\"" + DEFAULT_GRAPH_URI + "\")))" ) ; } sb . append ( "}" ) ; logger . debug ( sb . toString ( ) ) ; MarkLogicTupleQuery tupleQuery = prepareTupleQuery ( sb . toString ( ) ) ; tupleQuery . setIncludeInferred ( false ) ; tupleQuery . setRulesets ( ( SPARQLRuleset ) null ) ; tupleQuery . setConstrainingQueryDefinition ( ( QueryDefinition ) null ) ; TupleQueryResult qRes = tupleQuery . evaluate ( ) ; // just one answer BindingSet result = qRes . next ( ) ; qRes . close ( ) ; // if ' null ' was one or more of the arguments , then totalSize will be non - zero . return ( ( Literal ) result . getBinding ( "ct" ) . getValue ( ) ) . longValue ( ) ; } catch ( QueryEvaluationException | MalformedQueryException e ) { throw new RepositoryException ( e ) ; }
public class DateTimeExtensions { /** * Returns the name of this zone formatted according to the { @ link java . time . format . TextStyle # FULL } text style * for the provided { @ link java . util . Locale } . * @ param self a ZoneId * @ param locale a Locale * @ return the full display name of the ZoneId * @ since 2.5.0 */ public static String getFullName ( final ZoneId self , Locale locale ) { } }
return self . getDisplayName ( TextStyle . FULL , locale ) ;
public class CrxApi { /** * ( asynchronously ) * @ param path ( required ) * @ param cmd ( required ) * @ param groupName ( optional ) * @ param packageName ( optional ) * @ param packageVersion ( optional ) * @ param charset _ ( optional ) * @ param force ( optional ) * @ param recursive ( optional ) * @ param _ package ( optional ) * @ param callback The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException If fail to process the API call , e . g . serializing the request body object */ public com . squareup . okhttp . Call postPackageServiceJsonAsync ( String path , String cmd , String groupName , String packageName , String packageVersion , String charset_ , Boolean force , Boolean recursive , File _package , final ApiCallback < String > callback ) throws ApiException { } }
ProgressResponseBody . ProgressListener progressListener = null ; ProgressRequestBody . ProgressRequestListener progressRequestListener = null ; if ( callback != null ) { progressListener = new ProgressResponseBody . ProgressListener ( ) { @ Override public void update ( long bytesRead , long contentLength , boolean done ) { callback . onDownloadProgress ( bytesRead , contentLength , done ) ; } } ; progressRequestListener = new ProgressRequestBody . ProgressRequestListener ( ) { @ Override public void onRequestProgress ( long bytesWritten , long contentLength , boolean done ) { callback . onUploadProgress ( bytesWritten , contentLength , done ) ; } } ; } com . squareup . okhttp . Call call = postPackageServiceJsonValidateBeforeCall ( path , cmd , groupName , packageName , packageVersion , charset_ , force , recursive , _package , progressListener , progressRequestListener ) ; Type localVarReturnType = new TypeToken < String > ( ) { } . getType ( ) ; apiClient . executeAsync ( call , localVarReturnType , callback ) ; return call ;
public class RuntimeCommandFactory { /** * Create { @ link RunnableCommand } from the given parameters . * @ param description an informative description of the command * @ param path the path to the command executable * @ param arguments arguments to pass to the command * @ param environment environment variables to add to the command ' s execution environment * @ return the constructed runnable command */ @ Override public RunnableCommand command ( String description , String path , List < String > arguments , Map < String , String > environment ) { } }
return new RuntimeCommand ( description , path , arguments , environment ) ;
public class CoreSyncMongoIterableImpl { /** * Iterates over all the documents , adding each to the given target . * @ param target the collection to insert into * @ param < A > the collection type * @ return the target */ public < A extends Collection < ? super ResultT > > A into ( final A target ) { } }
forEach ( new Block < ResultT > ( ) { @ Override public void apply ( @ Nonnull final ResultT t ) { target . add ( t ) ; } } ) ; return target ;
public class DebugKelp { /** * Trace through a segment , displaying its sequence , table , and extent . */ private void debugSegment ( WriteStream out , SegmentServiceImpl segmentService , SegmentExtent extent , byte [ ] debugTableKey ) throws IOException { } }
int length = extent . length ( ) ; try ( InSegment in = segmentService . openRead ( extent ) ) { ReadStream is = new ReadStream ( in ) ; is . position ( length - BLOCK_SIZE ) ; long seq = BitsUtil . readLong ( is ) ; if ( seq <= 0 ) { return ; } byte [ ] tableKey = new byte [ 32 ] ; is . readAll ( tableKey , 0 , tableKey . length ) ; TableEntry table = segmentService . findTable ( tableKey ) ; if ( table == null ) { return ; } if ( debugTableKey != null && ! Arrays . equals ( debugTableKey , tableKey ) ) { return ; } out . println ( ) ; StringBuilder sb = new StringBuilder ( ) ; Base64Util . encode ( sb , seq ) ; long time = _idGen . time ( seq ) ; out . println ( "Segment: " + extent . getId ( ) + " (seq: " + sb + ", table: " + Hex . toShortHex ( tableKey ) + ", addr: 0x" + Long . toHexString ( extent . address ( ) ) + ", len: 0x" + Integer . toHexString ( length ) + ", time: " + LocalDateTime . ofEpochSecond ( time / 1000 , 0 , ZoneOffset . UTC ) + ")" ) ; debugSegmentEntries ( out , is , extent , table ) ; }
public class OrientGraphFactory { /** * Closes all pooled databases and clear the pool . */ public void close ( ) { } }
if ( pool != null ) pool . close ( ) ; pool = null ; if ( shouldCloseOrientDB ) { factory . close ( ) ; }
public class Vector2f { /** * / * ( non - Javadoc ) * @ see org . joml . Vector2fc # add ( float , float , org . joml . Vector2f ) */ public Vector2f add ( float x , float y , Vector2f dest ) { } }
dest . x = this . x + x ; dest . y = this . y + y ; return dest ;
public class TimePicker { /** * initComponents , This initializes the components of the JFormDesigner panel . This function is * automatically generated by JFormDesigner from the JFD form design file , and should not be * modified by hand . This function can be modified , if needed , by using JFormDesigner . */ private void initComponents ( ) { } }
// JFormDesigner - Component initialization - DO NOT MODIFY / / GEN - BEGIN : initComponents timeTextField = new JTextField ( ) ; toggleTimeMenuButton = new JButton ( ) ; spinnerPanel = new JPanel ( ) ; increaseButton = new JButton ( ) ; decreaseButton = new JButton ( ) ; // = = = = = this = = = = = setLayout ( new FormLayout ( "pref:grow, 3*(pref)" , "fill:pref:grow" ) ) ; // - - - - timeTextField - - - - timeTextField . setMargin ( new Insets ( 1 , 3 , 2 , 2 ) ) ; timeTextField . setBorder ( new CompoundBorder ( new MatteBorder ( 1 , 1 , 1 , 1 , new Color ( 122 , 138 , 153 ) ) , new EmptyBorder ( 1 , 3 , 2 , 2 ) ) ) ; timeTextField . addFocusListener ( new FocusAdapter ( ) { @ Override public void focusLost ( FocusEvent e ) { setTextFieldToValidStateIfNeeded ( ) ; } } ) ; add ( timeTextField , CC . xy ( 1 , 1 ) ) ; // - - - - toggleTimeMenuButton - - - - toggleTimeMenuButton . setText ( "v" ) ; toggleTimeMenuButton . setFocusPainted ( false ) ; toggleTimeMenuButton . setFocusable ( false ) ; toggleTimeMenuButton . setFont ( new Font ( "Segoe UI" , Font . PLAIN , 8 ) ) ; toggleTimeMenuButton . addMouseListener ( new MouseAdapter ( ) { @ Override public void mousePressed ( MouseEvent e ) { zEventToggleTimeMenuButtonMousePressed ( e ) ; } } ) ; add ( toggleTimeMenuButton , CC . xy ( 3 , 1 ) ) ; // = = = = = spinnerPanel = = = = = { spinnerPanel . setLayout ( new FormLayout ( "default" , "fill:pref:grow, fill:default:grow" ) ) ; ( ( FormLayout ) spinnerPanel . getLayout ( ) ) . setRowGroups ( new int [ ] [ ] { { 1 , 2 } } ) ; // - - - - increaseButton - - - - increaseButton . setFocusPainted ( false ) ; increaseButton . setFocusable ( false ) ; increaseButton . setFont ( new Font ( "Arial" , Font . PLAIN , 8 ) ) ; increaseButton . setText ( "+" ) ; spinnerPanel . add ( increaseButton , CC . xy ( 1 , 1 ) ) ; // - - - - decreaseButton - - - - decreaseButton . setFocusPainted ( false ) ; decreaseButton . setFocusable ( false ) ; decreaseButton . setFont ( new Font ( "Arial" , Font . PLAIN , 8 ) ) ; decreaseButton . setText ( "-" ) ; spinnerPanel . add ( decreaseButton , CC . xy ( 1 , 2 ) ) ; } add ( spinnerPanel , CC . xy ( 4 , 1 ) ) ; // JFormDesigner - End of component initialization / / GEN - END : initComponents
public class DateTimeFormatterBuilder { /** * Constructs a DateTimeFormatter using all the appended elements . * This is the main method used by applications at the end of the build * process to create a usable formatter . * Subsequent changes to this builder do not affect the returned formatter . * The returned formatter may not support both printing and parsing . * The methods { @ link DateTimeFormatter # isPrinter ( ) } and * { @ link DateTimeFormatter # isParser ( ) } will help you determine the state * of the formatter . * @ throws UnsupportedOperationException if neither printing nor parsing is supported */ public DateTimeFormatter toFormatter ( ) { } }
Object f = getFormatter ( ) ; InternalPrinter printer = null ; if ( isPrinter ( f ) ) { printer = ( InternalPrinter ) f ; } InternalParser parser = null ; if ( isParser ( f ) ) { parser = ( InternalParser ) f ; } if ( printer != null || parser != null ) { return new DateTimeFormatter ( printer , parser ) ; } throw new UnsupportedOperationException ( "Both printing and parsing not supported" ) ;
public class WebhookManager { /** * Resets all fields for this manager . * @ return WebhookManager for chaining convenience */ @ Override @ CheckReturnValue public WebhookManager reset ( ) { } }
super . reset ( ) ; this . name = null ; this . channel = null ; this . avatar = null ; return this ;
public class ResourceReader { /** * 将文件读出为输出流 * @ param filename 需要读取的文件名称 * @ return 文件内容输出流 * @ throws NoSuchPathException 无法找到对应的文件或者路径 */ public InputStreamReader getFileStream ( String filename ) throws NoSuchPathException { } }
try { return new InputStreamReader ( new FileInputStream ( filename ) ) ; } catch ( FileNotFoundException e ) { throw new NoSuchPathException ( e ) ; }
public class RDBMSEntityReader { /** * Populate relations . * @ param relations * the relations * @ param o * the o * @ return the map */ private Map < String , Object > populateRelations ( List < String > relations , Object [ ] o ) { } }
Map < String , Object > relationVal = new HashMap < String , Object > ( relations . size ( ) ) ; int counter = 1 ; for ( String r : relations ) { relationVal . put ( r , o [ counter ++ ] ) ; } return relationVal ;
public class ESClient { /** * ( non - Javadoc ) * @ see com . impetus . kundera . persistence . api . Batcher # executeBatch ( ) */ @ Override public int executeBatch ( ) { } }
BulkRequestBuilder bulkRequest = txClient . prepareBulk ( ) . setRefresh ( isRefreshIndexes ( ) ) ; try { for ( Node node : nodes ) { if ( node . isDirty ( ) ) { node . handlePreEvent ( ) ; Object entity = node . getData ( ) ; Object id = node . getEntityId ( ) ; EntityMetadata metadata = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , node . getDataClass ( ) ) ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( metadata . getPersistenceUnit ( ) ) ; EntityType entityType = metaModel . entity ( metadata . getEntityClazz ( ) ) ; String key = getKeyAsString ( id , metadata , metaModel ) ; if ( node . isInState ( RemovedState . class ) ) { // create a delete request . DeleteRequest request = new DeleteRequest ( metadata . getSchema ( ) . toLowerCase ( ) , metadata . getTableName ( ) , key ) ; bulkRequest . add ( request ) ; } else if ( node . isUpdate ( ) ) { Map < String , Object > values = new HashMap < String , Object > ( ) ; List < RelationHolder > relationHolders = getRelationHolders ( node ) ; addSource ( entity , values , entityType ) ; addRelations ( relationHolders , values ) ; UpdateRequest request = new UpdateRequest ( metadata . getSchema ( ) . toLowerCase ( ) , metadata . getTableName ( ) , key ) . doc ( values ) ; bulkRequest . add ( request ) ; } else { // create an insert request . Map < String , Object > values = new HashMap < String , Object > ( ) ; List < RelationHolder > relationHolders = getRelationHolders ( node ) ; addSource ( entity , values , entityType ) ; addRelations ( relationHolders , values ) ; IndexRequest request = new IndexRequest ( metadata . getSchema ( ) . toLowerCase ( ) , metadata . getTableName ( ) , key ) . source ( values ) ; bulkRequest . add ( request ) ; } } } BulkResponse response = null ; if ( nodes != null && ! nodes . isEmpty ( ) ) { // bulkRequest . setRefresh ( true ) ; response = bulkRequest . execute ( ) . actionGet ( ) ; } return response != null ? response . getItems ( ) . length : 0 ; } finally { clear ( ) ; }
public class DataSetLookupEditor { /** * DataSetGroupDateEditor events */ void onDateGroupChanged ( @ Observes DataSetGroupDateChanged event ) { } }
ColumnGroup columnGroup = event . getColumnGroup ( ) ; DataSetGroup groupOp = getFirstGroupOp ( ) ; if ( groupOp != null ) { groupOp . setColumnGroup ( columnGroup ) ; changeEvent . fire ( new DataSetLookupChangedEvent ( dataSetLookup ) ) ; }
public class UpdateResolverRuleRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateResolverRuleRequest updateResolverRuleRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateResolverRuleRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateResolverRuleRequest . getResolverRuleId ( ) , RESOLVERRULEID_BINDING ) ; protocolMarshaller . marshall ( updateResolverRuleRequest . getConfig ( ) , CONFIG_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Headers { /** * Returns the current values of the headers in natural sort order or null if none . */ public String [ ] get ( final String name ) { } }
if ( has ( name ) ) { List < String > values = headers . get ( name ) . getValues ( ) ; return values . toArray ( new String [ values . size ( ) ] ) ; } else return null ;
public class RowVector { /** * Print the vector values . */ public void print ( ) { } }
for ( int c = 0 ; c < nCols ; ++ c ) { System . out . print ( " " + values [ 0 ] [ c ] ) ; } System . out . println ( ) ;
public class UIUtils { /** * helper method to activate or deactivate a specific flag * @ param bits * @ param on */ public static void setFlag ( Activity activity , final int bits , boolean on ) { } }
Window win = activity . getWindow ( ) ; WindowManager . LayoutParams winParams = win . getAttributes ( ) ; if ( on ) { winParams . flags |= bits ; } else { winParams . flags &= ~ bits ; } win . setAttributes ( winParams ) ;
public class SelectBase { /** * Checks to see which has more room , above or below . * If the drop - up has enough room to fully open normally , * but there is more room above , the drop - up still opens * normally . Otherwise , it becomes a drop - up . * If dropupAuto is set to < code > false < / code > , drop - ups * must be called manually . < br > * < br > * Defaults to < code > true < / code > . * @ param dropupAuto */ public void setDropupAuto ( final boolean dropupAuto ) { } }
if ( ! dropupAuto ) attrMixin . setAttribute ( DROPUP_AUTO , Boolean . toString ( false ) ) ; else attrMixin . removeAttribute ( DROPUP_AUTO ) ;
public class InnerClassCompletionVisitor { /** * Adds a compilation error if a { @ link MethodNode } with the given < tt > methodName < / tt > and * < tt > parameters < / tt > exists in the { @ link InnerClassNode } . */ private void addCompilationErrorOnCustomMethodNode ( InnerClassNode node , String methodName , Parameter [ ] parameters ) { } }
MethodNode existingMethodNode = node . getMethod ( methodName , parameters ) ; // if there is a user - defined methodNode , add compiler error msg and continue if ( existingMethodNode != null && ! isSynthetic ( existingMethodNode ) ) { addError ( "\"" + methodName + "\" implementations are not supported on static inner classes as " + "a synthetic version of \"" + methodName + "\" is added during compilation for the purpose " + "of outer class delegation." , existingMethodNode ) ; }
public class RDBMEntityGroupStore { /** * Answers if < code > IGroupMember < / code > member is a member of < code > group < / code > . * @ return boolean * @ param group IEntityGroup * @ param member IGroupMember */ @ Override public boolean contains ( IEntityGroup group , IGroupMember member ) throws GroupsException { } }
return ( member . isGroup ( ) ) ? containsGroup ( group , ( IEntityGroup ) member ) : containsEntity ( group , member ) ;
public class UpdateSkillGroupRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateSkillGroupRequest updateSkillGroupRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateSkillGroupRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateSkillGroupRequest . getSkillGroupArn ( ) , SKILLGROUPARN_BINDING ) ; protocolMarshaller . marshall ( updateSkillGroupRequest . getSkillGroupName ( ) , SKILLGROUPNAME_BINDING ) ; protocolMarshaller . marshall ( updateSkillGroupRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BitmapUtil { /** * Creates and returns a bitmap from a specific drawable . * @ param drawable * The drawable , which should be converted , as an instance of the class { @ link * Drawable } . The drawable may not be null * @ return The bitmap , which has been created , as an instance of the class { @ link Bitmap } */ public static Bitmap drawableToBitmap ( @ NonNull final Drawable drawable ) { } }
Condition . INSTANCE . ensureNotNull ( drawable , "The drawable may not be null" ) ; if ( drawable instanceof BitmapDrawable ) { BitmapDrawable bitmapDrawable = ( BitmapDrawable ) drawable ; if ( bitmapDrawable . getBitmap ( ) != null ) { return bitmapDrawable . getBitmap ( ) ; } } Bitmap bitmap ; if ( drawable . getIntrinsicWidth ( ) <= 0 || drawable . getIntrinsicHeight ( ) <= 0 ) { bitmap = Bitmap . createBitmap ( 1 , 1 , Bitmap . Config . ARGB_8888 ) ; } else { bitmap = Bitmap . createBitmap ( drawable . getIntrinsicWidth ( ) , drawable . getIntrinsicHeight ( ) , Bitmap . Config . ARGB_8888 ) ; } Canvas canvas = new Canvas ( bitmap ) ; drawable . setBounds ( 0 , 0 , canvas . getWidth ( ) , canvas . getHeight ( ) ) ; drawable . draw ( canvas ) ; return bitmap ;
public class XPathContext { /** * Create a new < code > DTMIterator < / code > based on an XPath * < a href = " http : / / www . w3 . org / TR / xpath # NT - LocationPath > LocationPath < / a > or * a < a href = " http : / / www . w3 . org / TR / xpath # NT - UnionExpr " > UnionExpr < / a > . * @ param xpathString Must be a valid string expressing a * < a href = " http : / / www . w3 . org / TR / xpath # NT - LocationPath > LocationPath < / a > or * a < a href = " http : / / www . w3 . org / TR / xpath # NT - UnionExpr " > UnionExpr < / a > . * @ param presolver An object that can resolve prefixes to namespace URLs . * @ return The newly created < code > DTMIterator < / code > . */ public DTMIterator createDTMIterator ( String xpathString , PrefixResolver presolver ) { } }
return m_dtmManager . createDTMIterator ( xpathString , presolver ) ;
public class NumberVectorRandomFeatureSelectionFilter { /** * Initialize random attributes . * Invoke this from { @ link # convertedType } ! * @ param in Type information . */ void initializeRandomAttributes ( SimpleTypeInformation < V > in ) { } }
int d = ( ( VectorFieldTypeInformation < V > ) in ) . getDimensionality ( ) ; selectedAttributes = BitsUtil . random ( k , d , rnd . getSingleThreadedRandom ( ) ) ;
public class PasswordManagementWebflowUtils { /** * Gets password reset questions . * @ param requestContext the request context * @ return the password reset questions */ public static List < String > getPasswordResetQuestions ( final RequestContext requestContext ) { } }
val flowScope = requestContext . getFlowScope ( ) ; return flowScope . get ( "questions" , List . class ) ;
public class NessEventSender { /** * Enqueue an event into the messaging system . */ public void enqueue ( @ Nonnull NessEvent event ) { } }
for ( NessEventTransmitter transport : eventTransmitters ) { transport . transmit ( event ) ; }
public class SourceInfoMap { /** * Expect a particular token string to be returned by the given * StringTokenizer . * @ param tokenizer * the StringTokenizer * @ param token * the expectedToken * @ return true if the expected token was returned , false if not */ private static boolean expect ( StringTokenizer tokenizer , String token ) { } }
if ( ! tokenizer . hasMoreTokens ( ) ) { return false ; } String s = tokenizer . nextToken ( ) ; if ( DEBUG ) { System . out . println ( "token=" + s ) ; } return s . equals ( token ) ;
public class PluginClassLoader { /** * Indexes the content of the plugin artifact . This includes discovering all of the * dependency JARs as well as any configuration resources such as plugin definitions . * @ throws IOException if an I / O error has occurred */ private void indexPluginArtifact ( ) throws IOException { } }
dependencyZips = new ArrayList < > ( ) ; Enumeration < ? extends ZipEntry > entries = this . pluginArtifactZip . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry zipEntry = entries . nextElement ( ) ; if ( zipEntry . getName ( ) . startsWith ( "WEB-INF/lib/" ) && zipEntry . getName ( ) . toLowerCase ( ) . endsWith ( ".jar" ) ) { ZipFile dependencyZipFile = extractDependency ( zipEntry ) ; if ( dependencyZipFile != null ) { dependencyZips . add ( dependencyZipFile ) ; } } }
public class CharacterEscapingReader { /** * Reads characters into a portion of an array . * @ param cbuf * - Destination buffer * @ param off * - Offset at which to start writing characters * @ param len * - Maximum number of characters to read * @ return The character read , or - 1 if the end of the stream has been * reached * @ throws IOException * if an I / O error occurs */ @ Override public int read ( char [ ] cbuf , int off , int len ) throws IOException { } }
int bytesread = 0 ; while ( len -- > 0 ) { int ch = read ( ) ; if ( ch == - 1 ) { return ( bytesread > 0 ) ? bytesread : - 1 ; } cbuf [ off ++ ] = ( char ) ch ; bytesread ++ ; } return bytesread ;
public class JsonSerializer { /** * Deserialize from byte array , it always used in the generic type object . * @ param input * the JSON String byte array . * @ param typeRef * the target Object TypeReference . * @ return * the target Object instance . * @ throws JsonParseException * @ throws JsonMappingException * @ throws IOException */ public Object deserialize ( byte [ ] input , TypeReference < ? > typeRef ) throws JsonParseException , JsonMappingException , IOException { } }
return mapper . readValue ( input , typeRef ) ;
public class DoubleTuples { /** * Normalize the elements of the given tuple , so that each element * will be linearly rescaled to the interval defined by the corresponding * elements of the given minimum and maximum tuple . * Each element that is equal to the corresponding minimum element will * be 0.0 in the resulting tuple . * Each element that is equal to the corresponding maximum element will * be 1.0 in the resulting tuple . * Other values will be interpolated accordingly . * @ param t The input tuple * @ param min The minimum value * @ param max The maximum value * @ param result The tuple that will store the result * @ return The result tuple * @ throws IllegalArgumentException If the given tuples do not * have the same { @ link Tuple # getSize ( ) size } */ public static MutableDoubleTuple normalizeElements ( DoubleTuple t , DoubleTuple min , DoubleTuple max , MutableDoubleTuple result ) { } }
result = validate ( t , result ) ; for ( int i = 0 ; i < result . getSize ( ) ; i ++ ) { double value = t . get ( i ) ; double minValue = min . get ( i ) ; double maxValue = max . get ( i ) ; double alpha = ( value - minValue ) / ( maxValue - minValue ) ; double newValue = alpha ; result . set ( i , newValue ) ; } return result ;
public class Batch { /** * Helper method to create batch from list of aggregates , for cases when list of aggregates is higher then batchLimit * @ param list * @ param < U > * @ return */ public static < U extends Aggregate > List < Batch < U > > getBatches ( List < U > list ) { } }
return getBatches ( list , batchLimit ) ;
public class GitlabAPI { /** * Creates a Group * @ param name The name of the group * @ param path The path for the group * @ param ldapCn LDAP Group Name to sync with , null otherwise * @ param ldapAccess Access level for LDAP group members , null otherwise * @ param sudoUser The user to create the group on behalf of * @ param parentId The id of a parent group ; the new group will be its subgroup * @ return The GitLab Group * @ throws IOException on gitlab api call error */ public GitlabGroup createGroup ( String name , String path , String ldapCn , GitlabAccessLevel ldapAccess , GitlabUser sudoUser , Integer parentId ) throws IOException { } }
Query query = new Query ( ) . append ( "name" , name ) . append ( "path" , path ) . appendIf ( "ldap_cn" , ldapCn ) . appendIf ( "ldap_access" , ldapAccess ) . appendIf ( PARAM_SUDO , sudoUser != null ? sudoUser . getId ( ) : null ) . appendIf ( "parent_id" , parentId ) ; String tailUrl = GitlabGroup . URL + query . toString ( ) ; return dispatch ( ) . to ( tailUrl , GitlabGroup . class ) ;
public class ProtoUtils { /** * Returns the { @ link FieldRef } for the generated { @ link Extension } field . */ private static FieldRef getExtensionField ( FieldDescriptor descriptor ) { } }
Preconditions . checkArgument ( descriptor . isExtension ( ) , "%s is not an extension" , descriptor ) ; String extensionFieldName = getFieldName ( descriptor , false ) ; if ( descriptor . getExtensionScope ( ) != null ) { TypeInfo owner = messageRuntimeType ( descriptor . getExtensionScope ( ) ) ; return FieldRef . createPublicStaticField ( owner , extensionFieldName , EXTENSION_TYPE ) ; } // else we have a ' top level extension ' String containingClass = JavaQualifiedNames . getPackage ( descriptor . getFile ( ) ) + "." + JavaQualifiedNames . getOuterClassname ( descriptor . getFile ( ) ) ; return FieldRef . createPublicStaticField ( TypeInfo . create ( containingClass ) , extensionFieldName , EXTENSION_TYPE ) ;
public class TaskScheduler { /** * Add a job to the queue . * @ param objJobDef Can be a AutoTask object or a string describing the job to run ( in the overriding class ) . */ public void addTask ( Object objJobDef ) { } }
synchronized ( this ) { gvJobs . addElement ( objJobDef ) ; // Vector is thread safe . if ( giCurrentThreads >= giMaxThreads ) return ; // The max threads are running . . . let the scheduler process them in order giCurrentThreads ++ ; // I ' m going to start another thread } TaskScheduler js = this . makeNewTaskScheduler ( 0 ) ; // This should be done more efficiently . . . having the threads waiting in a pool to be awakened when needed . Thread thread = new Thread ( js , "TaskSchedulerThread" ) ; thread . start ( ) ;
public class AbstractCodeGen { /** * generate code * @ param def Definition * @ param out Writer * @ throws IOException ioException */ public void generate ( Definition def , Writer out ) throws IOException { } }
writeHeader ( def , out ) ; writeImport ( def , out ) ; writeClassComment ( def , out ) ; writeClassBody ( def , out ) ;
public class ConditionalCheck { /** * Ensures that a passed boolean is not equal to another boolean . The comparison is made using * < code > expected = = check < / code > . * We recommend to use the overloaded method { @ link ConditionalCheck # notEquals ( condition , boolean , boolean , String ) } * and pass as second argument the name of the parameter to enhance the exception message . * @ param condition * condition must be { @ code true } ^ so that the check will be performed * @ param expected * Expected value * @ param check * boolean to be checked * @ throws IllegalEqualException * if both argument values are not equal */ @ Throws ( IllegalEqualException . class ) public static void notEquals ( final boolean condition , final boolean expected , final boolean check ) { } }
if ( condition ) { Check . notEquals ( expected , check ) ; }
public class AbstractSQLServerQuery { /** * Set the table hints * @ param tableHints table hints * @ return the current object */ @ WithBridgeMethods ( value = SQLServerQuery . class , castRequired = true ) public C tableHints ( SQLServerTableHints ... tableHints ) { } }
if ( tableHints . length > 0 ) { String hints = SQLServerGrammar . tableHints ( tableHints ) ; addJoinFlag ( hints , JoinFlag . Position . END ) ; } return ( C ) this ;
public class SourceMapConsumerV3 { /** * Compare an array entry ' s column value to the target column value . */ private static int compareEntry ( ArrayList < Entry > entries , int entry , int target ) { } }
return entries . get ( entry ) . getGeneratedColumn ( ) - target ;
public class TwoDScrollView { /** * Like { @ link View # scrollBy } , but scroll smoothly instead of immediately . * @ param dx the number of pixels to scroll by on the X axis * @ param dy the number of pixels to scroll by on the Y axis */ public final void smoothScrollBy ( int dx , int dy ) { } }
long duration = AnimationUtils . currentAnimationTimeMillis ( ) - mLastScroll ; if ( duration > ANIMATED_SCROLL_GAP ) { mScroller . startScroll ( getScrollX ( ) , getScrollY ( ) , dx , dy ) ; awakenScrollBars ( mScroller . getDuration ( ) ) ; invalidate ( ) ; } else { if ( ! mScroller . isFinished ( ) ) { mScroller . abortAnimation ( ) ; } scrollBy ( dx , dy ) ; } mLastScroll = AnimationUtils . currentAnimationTimeMillis ( ) ;
public class PHPMethods { /** * Rounds a number to a specified precision . * @ param d * @ param i * @ return */ public static double round ( double d , int i ) { } }
double multiplier = Math . pow ( 10 , i ) ; return Math . round ( d * multiplier ) / multiplier ;
public class DynamicFactory { /** * Construct an implementation using the default constructor . This provides * some speed boost over invoking { @ link # ofClass ( Class , Object . . . ) } . * @ param intf the interface to construct an instance of * @ param < T > the type of the class * @ return an implementation of provided interface constructed using the * default constructor . * @ throws IllegalArgumentException thrown if the implementation can not be * constructed * @ throws IllegalArgumentException thrown if the provided class is not an * interface */ public < T extends ICDKObject > T ofClass ( Class < T > intf ) { } }
try { if ( ! intf . isInterface ( ) ) throw new IllegalArgumentException ( "expected interface, got " + intf . getClass ( ) ) ; Creator < T > creator = get ( new ClassBasedKey ( intf , EMPTY_CLASS_ARRAY ) ) ; return creator . create ( null ) ; // throws an exception if no impl was found } catch ( InstantiationException e ) { throw new IllegalArgumentException ( "unable to instantiate chem object: " , e ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( "constructor is not accessible: " , e ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( "invocation target exception: " , e ) ; }