signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class KamImpl { /** * { @ inheritDoc } */ @ Override public Set < KamNode > getAdjacentNodes ( KamNode kamNode , EdgeDirectionType edgeDirection , EdgeFilter edgeFilter , NodeFilter nodeFilter ) { } }
Set < KamNode > adjacentNodes = new LinkedHashSet < KamNode > ( ) ; KamNode node = null ; if ( EdgeDirectionType . FORWARD == edgeDirection || EdgeDirectionType . BOTH == edgeDirection ) { final Set < KamEdge > sources = nodeSourceMap . get ( kamNode ) ; if ( hasItems ( sources ) ) { for ( KamEdge kamEdge : sources ) { // Check for an edge filter if ( null != edgeFilter ) { if ( ! edgeFilter . accept ( kamEdge ) ) { continue ; } } node = kamEdge . getTargetNode ( ) ; // Check for a node filter if ( null != nodeFilter ) { if ( ! nodeFilter . accept ( node ) ) { continue ; } } adjacentNodes . add ( node ) ; } } } if ( EdgeDirectionType . REVERSE == edgeDirection || EdgeDirectionType . BOTH == edgeDirection ) { final Set < KamEdge > targets = nodeTargetMap . get ( kamNode ) ; if ( hasItems ( targets ) ) { for ( KamEdge kamEdge : targets ) { // Check for an edge filter if ( null != edgeFilter ) { if ( ! edgeFilter . accept ( kamEdge ) ) { continue ; } } node = kamEdge . getSourceNode ( ) ; // Check for a node filter if ( null != nodeFilter ) { if ( ! nodeFilter . accept ( node ) ) { continue ; } } adjacentNodes . add ( node ) ; } } } return adjacentNodes ;
public class JMElasticsearchIndex { /** * Upsert data with object mapper update response . * @ param sourceObject the source object * @ param index the index * @ param type the type * @ param id the id * @ return the update response */ public UpdateResponse upsertDataWithObjectMapper ( Object sourceObject , String index , String type , String id ) { } }
return upsertData ( JMElasticsearchUtil . buildSourceByJsonMapper ( sourceObject ) , index , type , id ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } * { @ link EnumIncludeRelationships } { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "includeRelationships" , scope = GetDescendants . class ) public JAXBElement < EnumIncludeRelationships > createGetDescendantsIncludeRelationships ( EnumIncludeRelationships value ) { } }
return new JAXBElement < EnumIncludeRelationships > ( _GetObjectOfLatestVersionIncludeRelationships_QNAME , EnumIncludeRelationships . class , GetDescendants . class , value ) ;
public class LOCI { /** * Run the algorithm * @ param database Database to process * @ param relation Relation to process * @ return Outlier result */ public OutlierResult run ( Database database , Relation < O > relation ) { } }
DistanceQuery < O > distFunc = database . getDistanceQuery ( relation , getDistanceFunction ( ) ) ; RangeQuery < O > rangeQuery = database . getRangeQuery ( distFunc ) ; DBIDs ids = relation . getDBIDs ( ) ; // LOCI preprocessing step WritableDataStore < DoubleIntArrayList > interestingDistances = DataStoreUtil . makeStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_TEMP | DataStoreFactory . HINT_SORTED , DoubleIntArrayList . class ) ; precomputeInterestingRadii ( ids , rangeQuery , interestingDistances ) ; // LOCI main step FiniteProgress progressLOCI = LOG . isVerbose ( ) ? new FiniteProgress ( "LOCI scores" , relation . size ( ) , LOG ) : null ; WritableDoubleDataStore mdef_norm = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_STATIC ) ; WritableDoubleDataStore mdef_radius = DataStoreUtil . makeDoubleStorage ( relation . getDBIDs ( ) , DataStoreFactory . HINT_STATIC ) ; DoubleMinMax minmax = new DoubleMinMax ( ) ; // Shared instance , to save allocations . MeanVariance mv_n_r_alpha = new MeanVariance ( ) ; for ( DBIDIter iditer = ids . iter ( ) ; iditer . valid ( ) ; iditer . advance ( ) ) { final DoubleIntArrayList cdist = interestingDistances . get ( iditer ) ; final double maxdist = cdist . getDouble ( cdist . size ( ) - 1 ) ; final int maxneig = cdist . getInt ( cdist . size ( ) - 1 ) ; double maxmdefnorm = 0.0 ; double maxnormr = 0 ; if ( maxneig >= nmin ) { // Compute the largest neighborhood we will need . DoubleDBIDList maxneighbors = rangeQuery . getRangeForDBID ( iditer , maxdist ) ; // TODO : Ensure the result is sorted . This is currently implied . // For any critical distance , compute the normalized MDEF score . for ( int i = 0 , size = cdist . size ( ) ; i < size ; i ++ ) { // Only start when minimum size is fulfilled if ( cdist . getInt ( i ) < nmin ) { continue ; } final double r = cdist . getDouble ( i ) ; final double alpha_r = alpha * r ; // compute n ( p _ i , \ alpha * r ) from list ( note : alpha _ r is not cdist ! ) final int n_alphar = cdist . getInt ( cdist . find ( alpha_r ) ) ; // compute \ hat { n } ( p _ i , r , \ alpha ) and the corresponding \ simga _ { MDEF } mv_n_r_alpha . reset ( ) ; for ( DoubleDBIDListIter neighbor = maxneighbors . iter ( ) ; neighbor . valid ( ) ; neighbor . advance ( ) ) { // Stop at radius r if ( neighbor . doubleValue ( ) > r ) { break ; } DoubleIntArrayList cdist2 = interestingDistances . get ( neighbor ) ; int rn_alphar = cdist2 . getInt ( cdist2 . find ( alpha_r ) ) ; mv_n_r_alpha . put ( rn_alphar ) ; } // We only use the average and standard deviation final double nhat_r_alpha = mv_n_r_alpha . getMean ( ) ; final double sigma_nhat_r_alpha = mv_n_r_alpha . getNaiveStddev ( ) ; // Redundant divisions by nhat _ r _ alpha removed . final double mdef = nhat_r_alpha - n_alphar ; final double sigmamdef = sigma_nhat_r_alpha ; final double mdefnorm = mdef / sigmamdef ; if ( mdefnorm > maxmdefnorm ) { maxmdefnorm = mdefnorm ; maxnormr = r ; } } } else { // FIXME : when nmin was not fulfilled - what is the proper value then ? maxmdefnorm = Double . POSITIVE_INFINITY ; maxnormr = maxdist ; } mdef_norm . putDouble ( iditer , maxmdefnorm ) ; mdef_radius . putDouble ( iditer , maxnormr ) ; minmax . put ( maxmdefnorm ) ; LOG . incrementProcessed ( progressLOCI ) ; } LOG . ensureCompleted ( progressLOCI ) ; DoubleRelation scoreResult = new MaterializedDoubleRelation ( "LOCI normalized MDEF" , "loci-mdef-outlier" , mdef_norm , relation . getDBIDs ( ) ) ; OutlierScoreMeta scoreMeta = new QuotientOutlierScoreMeta ( minmax . getMin ( ) , minmax . getMax ( ) , 0.0 , Double . POSITIVE_INFINITY , 0.0 ) ; OutlierResult result = new OutlierResult ( scoreMeta , scoreResult ) ; result . addChildResult ( new MaterializedDoubleRelation ( "LOCI MDEF Radius" , "loci-critical-radius" , mdef_radius , relation . getDBIDs ( ) ) ) ; return result ;
public class SimulatorTaskTracker { /** * Creates a signal for itself marking the completion of a task attempt . * It assumes that the task attempt hasn ' t made any progress in the user * space code so far , i . e . it is called right at launch for map tasks and * immediately after all maps completed for reduce tasks . * @ param tip the simulator task in progress * @ param now the current simulation time * @ return the TaskAttemptCompletionEvent we are sending to ourselves */ private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent ( SimulatorTaskInProgress tip , long now ) { } }
// We need to clone ( ) status as we modify and it goes into an Event TaskStatus status = ( TaskStatus ) tip . getTaskStatus ( ) . clone ( ) ; long delta = tip . getUserSpaceRunTime ( ) ; assert delta >= 0 : "TaskAttempt " + tip . getTaskStatus ( ) . getTaskID ( ) + " has negative UserSpaceRunTime = " + delta ; long finishTime = now + delta ; status . setFinishTime ( finishTime ) ; status . setProgress ( 1.0f ) ; status . setRunState ( tip . getFinalRunState ( ) ) ; TaskAttemptCompletionEvent event = new TaskAttemptCompletionEvent ( this , status ) ; if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "Created task attempt completion event " + event ) ; } return event ;
public class ThingAttributeMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ThingAttribute thingAttribute , ProtocolMarshaller protocolMarshaller ) { } }
if ( thingAttribute == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( thingAttribute . getThingName ( ) , THINGNAME_BINDING ) ; protocolMarshaller . marshall ( thingAttribute . getThingTypeName ( ) , THINGTYPENAME_BINDING ) ; protocolMarshaller . marshall ( thingAttribute . getThingArn ( ) , THINGARN_BINDING ) ; protocolMarshaller . marshall ( thingAttribute . getAttributes ( ) , ATTRIBUTES_BINDING ) ; protocolMarshaller . marshall ( thingAttribute . getVersion ( ) , VERSION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AbstractRectangularShape1dfx { /** * Replies the property that is the height of the box . * @ return the height property . */ @ Pure public DoubleProperty heightProperty ( ) { } }
if ( this . height == null ) { this . height = new SimpleDoubleProperty ( this , MathFXAttributeNames . HEIGHT ) ; this . height . bind ( Bindings . subtract ( maxYProperty ( ) , minYProperty ( ) ) ) ; } return this . height ;
public class CreateVoiceConnectorRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( CreateVoiceConnectorRequest createVoiceConnectorRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( createVoiceConnectorRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( createVoiceConnectorRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( createVoiceConnectorRequest . getRequireEncryption ( ) , REQUIREENCRYPTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ComponentExposedTypeGenerator { /** * Process Vue Props from the { @ link IsVueComponent } Class . */ private void processProps ( ) { } }
ElementFilter . fieldsIn ( component . getEnclosedElements ( ) ) . stream ( ) . filter ( field -> hasAnnotation ( field , Prop . class ) ) . forEach ( field -> { String propName = field . getSimpleName ( ) . toString ( ) ; Prop prop = field . getAnnotation ( Prop . class ) ; collectionFieldsValidator . validateComponentPropField ( field ) ; fieldsWithNameExposed . add ( new ExposedField ( propName , field . asType ( ) ) ) ; optionsBuilder . addStatement ( "options.addJavaProp($S, $T.getFieldName(this, () -> this.$L = $L), $L, $S)" , propName , VueGWTTools . class , propName , getFieldMarkingValueForType ( field . asType ( ) ) , prop . required ( ) , prop . checkType ( ) ? getNativeNameForJavaType ( field . asType ( ) ) : null ) ; } ) ;
public class DataJoinReducerBase { /** * join the list of the value lists , and collect the results . * @ param tags * a list of input tags * @ param values * a list of value lists , each corresponding to one input source * @ param key * @ param output * @ throws IOException */ private void joinAndCollect ( Object [ ] tags , ResetableIterator [ ] values , Object key , OutputCollector output , Reporter reporter ) throws IOException { } }
if ( values . length < 1 ) { return ; } Object [ ] partialList = new Object [ values . length ] ; joinAndCollect ( tags , values , 0 , partialList , key , output , reporter ) ;
public class CPadawan { /** * Return an instance of the padawan * @ return may the force be with you ! */ public static final CPadawan getInstance ( ) { } }
try { mutex . acquire ( ) ; CPadawan toReturn = ( handle == null ) ? ( handle = new CPadawan ( ) ) : handle ; toReturn . init ( ) ; return toReturn ; } finally { try { mutex . release ( ) ; } catch ( Exception ignore ) { } }
public class CommonUtils { /** * String Long turn number . * @ param num The number of strings . * @ param defaultLong The default value * @ return long */ public static long parseLong ( String num , long defaultLong ) { } }
if ( num == null ) { return defaultLong ; } else { try { return Long . parseLong ( num ) ; } catch ( Exception e ) { return defaultLong ; } }
public class ParameterBuilder { /** * Builds the parameter definition . * @ return Parameter definition */ public Parameter < T > build ( ) { } }
if ( this . name == null ) { throw new IllegalArgumentException ( "Name is missing." ) ; } if ( this . type == null ) { throw new IllegalArgumentException ( "Type is missing." ) ; } return new Parameter < T > ( this . name , this . type , this . applicationId , this . defaultOsgiConfigProperty , this . defaultValue , new ValueMapDecorator ( ImmutableMap . < String , Object > copyOf ( this . properties ) ) ) ;
public class DeploymentUtils { /** * Get all resource roots for a { @ link DeploymentUnit } * @ param deploymentUnit The deployment unit * @ return The deployment root and any additional resource roots */ public static List < ResourceRoot > allResourceRoots ( DeploymentUnit deploymentUnit ) { } }
List < ResourceRoot > roots = new ArrayList < ResourceRoot > ( ) ; // not all deployment units have a deployment root final ResourceRoot deploymentRoot = deploymentUnit . getAttachment ( Attachments . DEPLOYMENT_ROOT ) ; if ( deploymentRoot != null ) roots . add ( deploymentRoot ) ; roots . addAll ( deploymentUnit . getAttachmentList ( Attachments . RESOURCE_ROOTS ) ) ; return roots ;
public class WVideoRenderer { /** * Paints the given WVideo . * @ param component the WVideo to paint . * @ param renderContext the RenderContext to paint to . */ @ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } }
WVideo videoComponent = ( WVideo ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; Video [ ] video = videoComponent . getVideo ( ) ; if ( video == null || video . length == 0 ) { return ; } Track [ ] tracks = videoComponent . getTracks ( ) ; WVideo . Controls controls = videoComponent . getControls ( ) ; int width = videoComponent . getWidth ( ) ; int height = videoComponent . getHeight ( ) ; int duration = video [ 0 ] . getDuration ( ) ; // Check for alternative text String alternativeText = videoComponent . getAltText ( ) ; if ( alternativeText == null ) { LOG . warn ( "Video should have a description." ) ; alternativeText = null ; } else { alternativeText = I18nUtilities . format ( null , alternativeText ) ; } xml . appendTagOpen ( "ui:video" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalUrlAttribute ( "poster" , videoComponent . getPosterUrl ( ) ) ; xml . appendOptionalAttribute ( "alt" , alternativeText ) ; xml . appendOptionalAttribute ( "autoplay" , videoComponent . isAutoplay ( ) , "true" ) ; xml . appendOptionalAttribute ( "mediagroup" , videoComponent . getMediaGroup ( ) ) ; xml . appendOptionalAttribute ( "loop" , videoComponent . isLoop ( ) , "true" ) ; xml . appendOptionalAttribute ( "muted" , videoComponent . isMuted ( ) , "true" ) ; xml . appendOptionalAttribute ( "hidden" , videoComponent . isHidden ( ) , "true" ) ; xml . appendOptionalAttribute ( "disabled" , videoComponent . isDisabled ( ) , "true" ) ; xml . appendOptionalAttribute ( "toolTip" , videoComponent . getToolTip ( ) ) ; xml . appendOptionalAttribute ( "width" , width > 0 , width ) ; xml . appendOptionalAttribute ( "height" , height > 0 , height ) ; xml . appendOptionalAttribute ( "duration" , duration > 0 , duration ) ; switch ( videoComponent . getPreload ( ) ) { case NONE : xml . appendAttribute ( "preload" , "none" ) ; break ; case META_DATA : xml . appendAttribute ( "preload" , "metadata" ) ; break ; case AUTO : default : break ; } if ( controls != null && ! WVideo . Controls . NATIVE . equals ( controls ) ) { switch ( controls ) { case NONE : xml . appendAttribute ( "controls" , "none" ) ; break ; case ALL : xml . appendAttribute ( "controls" , "all" ) ; break ; case PLAY_PAUSE : xml . appendAttribute ( "controls" , "play" ) ; break ; case DEFAULT : xml . appendAttribute ( "controls" , "default" ) ; break ; default : LOG . error ( "Unknown control type: " + controls ) ; } } xml . appendClose ( ) ; String [ ] urls = videoComponent . getVideoUrls ( ) ; for ( int i = 0 ; i < urls . length ; i ++ ) { xml . appendTagOpen ( "ui:src" ) ; xml . appendUrlAttribute ( "uri" , urls [ i ] ) ; xml . appendOptionalAttribute ( "type" , video [ i ] . getMimeType ( ) ) ; if ( video [ i ] . getSize ( ) != null ) { xml . appendOptionalAttribute ( "width" , video [ i ] . getSize ( ) . width > 0 , video [ i ] . getSize ( ) . width ) ; xml . appendOptionalAttribute ( "height" , video [ i ] . getSize ( ) . height > 0 , video [ i ] . getSize ( ) . height ) ; } xml . appendEnd ( ) ; } if ( tracks != null && tracks . length > 0 ) { String [ ] trackUrls = videoComponent . getTrackUrls ( ) ; for ( int i = 0 ; i < tracks . length ; i ++ ) { xml . appendTagOpen ( "ui:track" ) ; xml . appendUrlAttribute ( "src" , trackUrls [ i ] ) ; xml . appendOptionalAttribute ( "lang" , tracks [ i ] . getLanguage ( ) ) ; xml . appendOptionalAttribute ( "desc" , tracks [ i ] . getDescription ( ) ) ; xml . appendOptionalAttribute ( "kind" , trackKindToString ( tracks [ i ] . getKind ( ) ) ) ; xml . appendEnd ( ) ; } } xml . appendEndTag ( "ui:video" ) ;
public class StackTraceSampleCoordinator { /** * Shuts down the coordinator . * < p > After shut down , no further operations are executed . */ public void shutDown ( ) { } }
synchronized ( lock ) { if ( ! isShutDown ) { LOG . info ( "Shutting down stack trace sample coordinator." ) ; for ( PendingStackTraceSample pending : pendingSamples . values ( ) ) { pending . discard ( new RuntimeException ( "Shut down" ) ) ; } pendingSamples . clear ( ) ; isShutDown = true ; } }
public class BirthDateFromAncestorsEstimator { /** * Try recursing through the ancestors to find a marriage date . * @ param localDate if not null we already have a better estimate * @ return an estimate based on some ancestor ' s marriage date */ public LocalDate estimateFromMarriage ( final LocalDate localDate ) { } }
if ( localDate != null ) { return localDate ; } final PersonNavigator navigator = new PersonNavigator ( person ) ; final List < Family > families = navigator . getFamiliesC ( ) ; LocalDate date = null ; for ( final Family family : families ) { date = processMarriageDate ( date , family ) ; date = childAdjustment ( date ) ; date = estimateFromFatherMarriage ( date , family ) ; date = estimateFromMotherMarriage ( date , family ) ; if ( date != null ) { break ; } } return date ;
public class FileFormatDataSchemaParser { /** * Append source files that were resolved through { @ link DataSchemaResolver } to the provided list . * @ param result to append the files that were resolved through { @ link DataSchemaResolver } . */ private void appendSourceFilesFromSchemaResolver ( ParseResult result ) { } }
for ( Map . Entry < String , DataSchemaLocation > entry : _schemaResolver . nameToDataSchemaLocations ( ) . entrySet ( ) ) { final File sourceFile = entry . getValue ( ) . getSourceFile ( ) ; if ( sourceFile != null ) { result . getSourceFiles ( ) . add ( sourceFile ) ; } }
public class HttpUtils { /** * Execute post http response . * @ param url the url * @ param entity the json entity * @ param parameters the parameters * @ return the http response */ public static HttpResponse executePost ( final String url , final String entity , final Map < String , Object > parameters ) { } }
return executePost ( url , null , null , entity , parameters ) ;
public class ConditionalRowMutation { /** * Creates a new instance of the mutation builder . */ public static ConditionalRowMutation create ( String tableId , String rowKey ) { } }
return create ( tableId , ByteString . copyFromUtf8 ( rowKey ) ) ;
public class URIBuilder { /** * Builds a dataset URI from the given repository URI string , namespace , and * dataset name . * @ param repoUri a repository URI string * @ param namespace a String namespace * @ param dataset a String dataset name * @ return a dataset URI for the namespace and dataset name in the repository * @ since 0.17.0 */ public static URI build ( String repoUri , String namespace , String dataset ) { } }
return build ( URI . create ( repoUri ) , namespace , dataset ) ;
public class UtlProperties { /** * < p > Evaluate string array ( include non - unique ) properties * from string with comma delimeter * and removed new lines and trailing spaces . < / p > * @ param pSource string * @ return String [ ] array */ public final String [ ] evalPropsStringsArray ( final String pSource ) { } }
List < String > resultList = evalPropsStringsList ( pSource ) ; return resultList . toArray ( new String [ resultList . size ( ) ] ) ;
public class AmazonLexModelBuildingClient { /** * Creates an alias for the specified version of the bot or replaces an alias for the specified bot . To change the * version of the bot that the alias points to , replace the alias . For more information about aliases , see * < a > versioning - aliases < / a > . * This operation requires permissions for the < code > lex : PutBotAlias < / code > action . * @ param putBotAliasRequest * @ return Result of the PutBotAlias operation returned by the service . * @ throws ConflictException * There was a conflict processing the request . Try your request again . * @ throws LimitExceededException * The request exceeded a limit . Try your request again . * @ throws InternalFailureException * An internal Amazon Lex error occurred . Try your request again . * @ throws BadRequestException * The request is not well formed . For example , a value is invalid or a required field is missing . Check the * field values , and try again . * @ throws PreconditionFailedException * The checksum of the resource that you are trying to change does not match the checksum in the request . * Check the resource ' s checksum and try again . * @ sample AmazonLexModelBuilding . PutBotAlias * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / lex - models - 2017-04-19 / PutBotAlias " target = " _ top " > AWS API * Documentation < / a > */ @ Override public PutBotAliasResult putBotAlias ( PutBotAliasRequest request ) { } }
request = beforeClientExecution ( request ) ; return executePutBotAlias ( request ) ;
public class ThunderExporterService { /** * / * public String sendDataHTTP ( String uri , Object message ) { * Gson gson = new Gson ( ) ; * String data = gson . toJson ( message ) ; * String urlServer = CoreEngine . getInstance ( ) . getConfig ( ) . getUrlH2hWeb ( ) + uri ; * System . out . println ( " Send Request to Server with uri " + urlServer + " and data " + data ) ; * HttpClient client = HttpClientBuilder . create ( ) . build ( ) ; * HttpPost httpPost = new HttpPost ( urlServer ) ; * if ( data ! = null ) { * httpPost . setEntity ( new StringEntity ( data , " UTF8 " ) ) ; * httpPost . setHeader ( " Content - type " , " application / json " ) ; * String result = null ; * try { * HttpResponse response = client . execute ( httpPost ) ; * if ( response ! = null ) { * int statusCode = response . getStatusLine ( ) . getStatusCode ( ) ; * if ( statusCode = = HttpURLConnection . HTTP _ CREATED * | | statusCode = = HttpURLConnection . HTTP _ OK * | | statusCode = = HttpURLConnection . HTTP _ ACCEPTED * | | statusCode = = HttpURLConnection . HTTP _ NO _ CONTENT ) { * result = EntityUtils . toString ( response . getEntity ( ) ) ; * System . out . println ( " Message from H2H server " + result ) ; * } else { * System . err . println ( " Failed : HTTP error code : " * + statusCode * + " for urlServer " + urlServer + " msg " * + EntityUtils . toString ( response . getEntity ( ) ) ) ; * } else { * System . err . println ( " Failed : Response Null from urlServer : " + urlServer ) ; * } catch ( IOException e ) { * System . err . println ( " Error while sending dataHttp to " + urlServer + " : " + e ) ; * return result ; */ private void getCpuInformation ( MessageMetrics mb ) { } }
OperatingSystemMXBean operatingSystemMXBean = ( OperatingSystemMXBean ) ManagementFactory . getOperatingSystemMXBean ( ) ; Double cpuLoadProcess = Double . valueOf ( operatingSystemMXBean . getProcessCpuLoad ( ) * 100 ) ; Double cpuLoadSystem = Double . valueOf ( operatingSystemMXBean . getSystemCpuLoad ( ) * 100 ) ; mb . setCpuLoadProcess ( cpuLoadProcess ) ; mb . setCpuLoadSystem ( cpuLoadSystem ) ;
public class Filter { /** * Set the value for this filter . Note , in the default implementation , the < code > value < / code > * must implement { @ link java . io . Serializable } . * @ param value the value */ public void setValue ( Object value ) { } }
if ( LOGGER . isInfoEnabled ( ) && ! ( value instanceof java . io . Serializable ) ) LOGGER . info ( "Warning: setting a filter value tiat is not serializable. The Filter object is serializable and should contain only serializable state" ) ; _value = value ;
public class ThriftCodecByteCodeGenerator { /** * Defines the generics bridge method with untyped args to the type specific read method . */ private void defineReadBridgeMethod ( ) { } }
classDefinition . addMethod ( new MethodDefinition ( a ( PUBLIC , BRIDGE , SYNTHETIC ) , "read" , type ( Object . class ) , arg ( "protocol" , TProtocol . class ) ) . addException ( Exception . class ) . loadThis ( ) . loadVariable ( "protocol" ) . invokeVirtual ( codecType , "read" , structType , type ( TProtocol . class ) ) . retObject ( ) ) ;
public class FP64 { /** * Extends this fingerprint by the characters * < code > chars [ start ] . . chars [ start + length - 1 ] < / code > . * @ return * the resulting fingerprint . */ public FP64 extend ( char [ ] chars , int start , int len ) { } }
int end = start + len ; for ( int i = start ; i < end ; i ++ ) { extend ( chars [ i ] ) ; } return this ;
public class GreenPepperXmlRpcServerDelegator { /** * { @ inheritDoc } */ public Vector < ? > getListOfSpecificationLocations ( String repositoryUID , String systemUnderTestName ) { } }
return serviceDelegator . getListOfSpecificationLocations ( repositoryUID , systemUnderTestName ) ;
public class Hyaline { /** * It lets you create a new DTO starting from the annotation - based * configuration of your entity . This means that any annotation - based * configuration for JAXB , Jackson or whatever serialization framework you * are using on your entity T will be kept . However , if you insert an * annotation on a field that exists also in your class , this annotation * will override the one in your class . * @ param < T > * the generic type * @ param entity * the entity you are going proxy . * @ param dtoTemplate * the DTO template passed as an anonymous class . * @ return a proxy that extends the type of entity , holding the same * instance variables values as entity and configured according to * dtoTemplate * @ throws HyalineException * if the dynamic type could be created . */ public static < T > T dtoFromClass ( T entity , DTO dtoTemplate ) throws HyalineException { } }
return dtoFromClass ( entity , dtoTemplate , "Hyaline$Proxy$" + System . currentTimeMillis ( ) ) ;
public class CameraManager { /** * Allows third party apps to specify the scanning rectangle dimensions , rather than determine * them automatically based on screen resolution . * @ param width The width in pixels to scan . * @ param height The height in pixels to scan . */ public synchronized void setManualFramingRect ( int width , int height ) { } }
if ( initialized ) { Point screenResolution = configManager . getScreenResolution ( ) ; if ( width > screenResolution . x ) { width = screenResolution . x ; } if ( height > screenResolution . y ) { height = screenResolution . y ; } int leftOffset = ( screenResolution . x - width ) / 2 ; int topOffset = ( screenResolution . y - height ) / 2 ; framingRect = new Rect ( leftOffset , topOffset , leftOffset + width , topOffset + height ) ; Log . d ( TAG , "Calculated manual framing rect: " + framingRect ) ; framingRectInPreview = null ; } else { requestedFramingRectWidth = width ; requestedFramingRectHeight = height ; }
public class XPathException { /** * Find the most contained message . * @ return The error message of the originating exception . */ public String getMessage ( ) { } }
String lastMessage = super . getMessage ( ) ; Throwable exception = m_exception ; while ( null != exception ) { String nextMessage = exception . getMessage ( ) ; if ( null != nextMessage ) lastMessage = nextMessage ; if ( exception instanceof TransformerException ) { TransformerException se = ( TransformerException ) exception ; Throwable prev = exception ; exception = se . getException ( ) ; if ( prev == exception ) break ; } else { exception = null ; } } return ( null != lastMessage ) ? lastMessage : "" ;
public class FileBlockStore { /** * Close file */ public void close ( ) { } }
mmaps . clear ( false ) ; try { unlock ( ) ; } catch ( Exception ign ) { } try { fileChannel . close ( ) ; } catch ( Exception ign ) { } try { raf . close ( ) ; } catch ( Exception ign ) { } fileChannel = null ; raf = null ; validState = false ;
public class CmsSqlManager { /** * Replaces patterns $ { XXX } by another property value , if XXX is a property key with a value . < p > */ protected synchronized void replaceQuerySearchPatterns ( ) { } }
String currentKey = null ; String currentValue = null ; int startIndex = 0 ; int endIndex = 0 ; int lastIndex = 0 ; Iterator < String > allKeys = m_queries . keySet ( ) . iterator ( ) ; while ( allKeys . hasNext ( ) ) { currentKey = allKeys . next ( ) ; currentValue = m_queries . get ( currentKey ) ; startIndex = 0 ; endIndex = 0 ; lastIndex = 0 ; while ( ( startIndex = currentValue . indexOf ( "${" , lastIndex ) ) != - 1 ) { endIndex = currentValue . indexOf ( '}' , startIndex ) ; if ( ( endIndex != - 1 ) && ! currentValue . startsWith ( QUERY_PROJECT_SEARCH_PATTERN , startIndex - 1 ) ) { String replaceKey = currentValue . substring ( startIndex + 2 , endIndex ) ; String searchPattern = currentValue . substring ( startIndex , endIndex + 1 ) ; String replacePattern = this . readQuery ( replaceKey ) ; if ( replacePattern != null ) { currentValue = CmsStringUtil . substitute ( currentValue , searchPattern , replacePattern ) ; } } lastIndex = endIndex + 2 ; } m_queries . put ( currentKey , currentValue ) ; }
public class AppServiceCertificateOrdersInner { /** * Verify domain ownership for this certificate order . * Verify domain ownership for this certificate order . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param certificateOrderName Name of the certificate order . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */ public void verifyDomainOwnership ( String resourceGroupName , String certificateOrderName ) { } }
verifyDomainOwnershipWithServiceResponseAsync ( resourceGroupName , certificateOrderName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class UpdateAppRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateAppRequest updateAppRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateAppRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateAppRequest . getAppId ( ) , APPID_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getPlatform ( ) , PLATFORM_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getIamServiceRoleArn ( ) , IAMSERVICEROLEARN_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getEnvironmentVariables ( ) , ENVIRONMENTVARIABLES_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getEnableBranchAutoBuild ( ) , ENABLEBRANCHAUTOBUILD_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getEnableBasicAuth ( ) , ENABLEBASICAUTH_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getBasicAuthCredentials ( ) , BASICAUTHCREDENTIALS_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getCustomRules ( ) , CUSTOMRULES_BINDING ) ; protocolMarshaller . marshall ( updateAppRequest . getBuildSpec ( ) , BUILDSPEC_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class StorageHandlerImpl { /** * asciidoctor Documentation - tag : : storageHandlerSave [ ] */ public void saveObject ( String breadcrumb , Object object ) { } }
preferences . put ( hash ( breadcrumb ) , gson . toJson ( object ) ) ;
public class JmsManagedConnectionFactoryImpl { /** * default bus name is " DEFAULT " , null bus name is not valid . */ @ Override public String getBusName ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "getBusName" ) ; String busName = jcaConnectionFactory . getBusName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "getBusName" , busName ) ; return busName ;
public class CleverTapAPI { /** * Use this method to opt the current user out of all event / profile tracking . * You must call this method separately for each active user profile ( e . g . when switching user profiles using onUserLogin ) . * Once enabled , no events will be saved remotely or locally for the current user . To re - enable tracking call this method with enabled set to false . * @ param userOptOut boolean Whether tracking opt out should be enabled / disabled . */ @ SuppressWarnings ( { } }
"unused" , "WeakerAccess" } ) public void setOptOut ( boolean userOptOut ) { final boolean enable = userOptOut ; postAsyncSafely ( "setOptOut" , new Runnable ( ) { @ Override public void run ( ) { // generate the data for a profile push to alert the server to the optOut state change HashMap < String , Object > optOutMap = new HashMap < > ( ) ; optOutMap . put ( Constants . CLEVERTAP_OPTOUT , enable ) ; // determine order of operations depending on enabled / disabled if ( enable ) { // if opting out first push profile event then set the flag pushProfile ( optOutMap ) ; setCurrentUserOptedOut ( true ) ; } else { // if opting back in first reset the flag to false then push the profile event setCurrentUserOptedOut ( false ) ; pushProfile ( optOutMap ) ; } // persist the new optOut state String key = optOutKey ( ) ; if ( key == null ) { getConfigLogger ( ) . verbose ( getAccountId ( ) , "Unable to persist user OptOut state, storage key is null" ) ; return ; } StorageHelper . putBoolean ( context , storageKeyWithSuffix ( key ) , enable ) ; getConfigLogger ( ) . verbose ( getAccountId ( ) , "Set current user OptOut state to: " + enable ) ; } } ) ;
public class ListDeviceEventsRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ListDeviceEventsRequest listDeviceEventsRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( listDeviceEventsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listDeviceEventsRequest . getDeviceId ( ) , DEVICEID_BINDING ) ; protocolMarshaller . marshall ( listDeviceEventsRequest . getFromTimeStamp ( ) , FROMTIMESTAMP_BINDING ) ; protocolMarshaller . marshall ( listDeviceEventsRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( listDeviceEventsRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listDeviceEventsRequest . getToTimeStamp ( ) , TOTIMESTAMP_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class NameService { /** * This method will create a unique name for an INameable object . The name * will be unque within the session . This will throw an IllegalStateException * if INameable . setObjectName has previously been called on object . * @ param namePrefix The prefix of the generated name . * @ param object the INameable object . * @ throws IllegalStateException if this method is called more than once for an object */ public synchronized void nameObject ( String namePrefix , INameable object ) { } }
String name = namePrefix + Integer . toString ( _nextValue ++ ) ; object . setObjectName ( name ) ;
public class AbstractNucleotideCompoundSet { /** * Loops through all known nucleotides and attempts to find which are * equivalent to each other . Also takes into account lower casing * nucleotides as well as upper - cased ones . */ @ SuppressWarnings ( "unchecked" ) protected void calculateIndirectAmbiguities ( ) { } }
Map < NucleotideCompound , List < NucleotideCompound > > equivalentsMap = new HashMap < NucleotideCompound , List < NucleotideCompound > > ( ) ; List < NucleotideCompound > ambiguousCompounds = new ArrayList < NucleotideCompound > ( ) ; for ( NucleotideCompound compound : getAllCompounds ( ) ) { if ( ! compound . isAmbiguous ( ) ) { continue ; } ambiguousCompounds . add ( compound ) ; } for ( NucleotideCompound sourceCompound : ambiguousCompounds ) { Set < NucleotideCompound > compoundConstituents = sourceCompound . getConstituents ( ) ; for ( NucleotideCompound targetCompound : ambiguousCompounds ) { Set < NucleotideCompound > targetConstituents = targetCompound . getConstituents ( ) ; if ( targetConstituents . containsAll ( compoundConstituents ) ) { NucleotideCompound lcSourceCompound = toLowerCase ( sourceCompound ) ; NucleotideCompound lcTargetCompound = toLowerCase ( targetCompound ) ; // equivalentsMap . put ( sourceCompound , targetCompound ) ; // equivalentsMap . put ( sourceCompound , lcTargetCompound ) ; checkAdd ( equivalentsMap , sourceCompound , targetCompound ) ; checkAdd ( equivalentsMap , sourceCompound , lcTargetCompound ) ; checkAdd ( equivalentsMap , targetCompound , sourceCompound ) ; checkAdd ( equivalentsMap , lcTargetCompound , sourceCompound ) ; checkAdd ( equivalentsMap , lcSourceCompound , targetCompound ) ; checkAdd ( equivalentsMap , lcSourceCompound , lcTargetCompound ) ; } } } // And once it ' s all done start adding them to the equivalents map for ( NucleotideCompound key : equivalentsMap . keySet ( ) ) { List < NucleotideCompound > vals = equivalentsMap . get ( key ) ; for ( NucleotideCompound value : vals ) { addEquivalent ( ( C ) key , ( C ) value ) ; addEquivalent ( ( C ) value , ( C ) key ) ; } }
public class JAXRSInvoker { /** * Liberty change start - CXF - 7860 */ private List < Object > reprocessFormParams ( Method method , List < Object > origParams , Message m ) { } }
Form form = null ; boolean hasFormParamAnnotations = false ; Object [ ] newValues = new Object [ origParams . size ( ) ] ; java . lang . reflect . Parameter [ ] methodParams = method . getParameters ( ) ; for ( int i = 0 ; i < methodParams . length ; i ++ ) { if ( Form . class . equals ( methodParams [ i ] . getType ( ) ) ) { form = ( Form ) origParams . get ( i ) ; } if ( methodParams [ i ] . getAnnotation ( FormParam . class ) != null ) { hasFormParamAnnotations = true ; } else { newValues [ i ] = origParams . get ( i ) ; } } if ( ! hasFormParamAnnotations || form == null ) { return origParams ; } for ( int i = 0 ; i < newValues . length ; i ++ ) { if ( newValues [ i ] == null ) { String formFieldName = methodParams [ i ] . getAnnotation ( FormParam . class ) . value ( ) ; List < String > values = form . asMap ( ) . get ( formFieldName ) ; newValues [ i ] = InjectionUtils . createParameterObject ( values , methodParams [ i ] . getType ( ) , methodParams [ i ] . getParameterizedType ( ) , methodParams [ i ] . getAnnotations ( ) , ( String ) origParams . get ( i ) , false , ParameterType . FORM , m ) ; if ( LOG . isLoggable ( Level . FINEST ) ) { LOG . log ( Level . FINEST , "replacing @FormParam value of {0} with {1}" , new Object [ ] { origParams . get ( i ) , newValues [ i ] } ) ; } } } return Arrays . asList ( newValues ) ;
public class MessageBuilder { /** * Creates a COMMIT message . * @ param zxid the id of the committed transaction . * @ return a protobuf message . */ public static Message buildCommit ( Zxid zxid ) { } }
ZabMessage . Zxid cZxid = toProtoZxid ( zxid ) ; Commit commit = Commit . newBuilder ( ) . setZxid ( cZxid ) . build ( ) ; return Message . newBuilder ( ) . setType ( MessageType . COMMIT ) . setCommit ( commit ) . build ( ) ;
public class Node { /** * Provides lookup of attributes by key . * @ param key the key of interest * @ return the attribute matching the key or < code > null < / code > if no match exists */ public Object attribute ( Object key ) { } }
return ( attributes != null ) ? attributes . get ( key ) : null ;
public class ConnectionFactoryService { /** * Indicates the level of transaction support . * @ return constant indicating the transaction support of the resource adapter . */ @ Override public TransactionSupportLevel getTransactionSupport ( ) { } }
// If ManagedConnectionFactory implements TransactionSupport , that takes priority TransactionSupportLevel transactionSupport = mcf instanceof TransactionSupport ? ( ( TransactionSupport ) mcf ) . getTransactionSupport ( ) : null ; // Otherwise get the value from the deployment descriptor String prop = ( String ) bootstrapContextRef . getReference ( ) . getProperty ( TRANSACTION_SUPPORT ) ; if ( prop != null ) { TransactionSupportLevel ddTransactionSupport = TransactionSupportLevel . valueOf ( prop ) ; if ( transactionSupport == null ) transactionSupport = ddTransactionSupport ; else if ( transactionSupport . ordinal ( ) > ddTransactionSupport . ordinal ( ) ) throw new IllegalArgumentException ( ManagedConnectionFactory . class . getName ( ) + ':' + transactionSupport + ", " + Connector . class . getName ( ) + ':' + ddTransactionSupport ) ; } if ( connectionFactoryTransactionSupport != null ) { if ( connectionFactoryTransactionSupport . ordinal ( ) > transactionSupport . ordinal ( ) ) throw new IllegalArgumentException ( ManagedConnectionFactory . class . getName ( ) + ':' + transactionSupport + ", " + Connector . class . getName ( ) + ':' + connectionFactoryTransactionSupport ) ; else transactionSupport = connectionFactoryTransactionSupport ; } // Otherwise choose NoTransaction return transactionSupport == null ? TransactionSupportLevel . NoTransaction : transactionSupport ;
public class RedirectFilter { /** * ( non - Javadoc ) * @ see * com . microsoft . windowsazure . services . core . IdempotentClientFilter # doHandle * ( com . sun . jersey . api . client . ClientRequest ) */ @ Override public ClientResponse doHandle ( ClientRequest request ) { } }
if ( request == null ) { throw new IllegalArgumentException ( "Request should not be null" ) ; } URI originalURI = request . getURI ( ) ; request . setURI ( locationManager . getRedirectedURI ( originalURI ) ) ; ClientResponse response = getNext ( ) . handle ( request ) ; while ( response . getClientResponseStatus ( ) == ClientResponse . Status . MOVED_PERMANENTLY ) { try { locationManager . setRedirectedURI ( response . getHeaders ( ) . getFirst ( "Location" ) ) ; } catch ( NullPointerException e ) { throw new ClientHandlerException ( "HTTP Redirect did not include Location header" ) ; } catch ( URISyntaxException e ) { throw new ClientHandlerException ( "HTTP Redirect location is not a valid URI" ) ; } request . setURI ( locationManager . getRedirectedURI ( originalURI ) ) ; response = getNext ( ) . handle ( request ) ; } return response ;
public class AdaBoost { /** * Trims the tree model set to a smaller size in case of over - fitting . * Or if extra decision trees in the model don ' t improve the performance , * we may remove them to reduce the model size and also improve the speed of * prediction . * @ param ntrees the new ( smaller ) size of tree model set . */ public void trim ( int ntrees ) { } }
if ( ntrees > trees . length ) { throw new IllegalArgumentException ( "The new model size is larger than the current size." ) ; } if ( ntrees <= 0 ) { throw new IllegalArgumentException ( "Invalid new model size: " + ntrees ) ; } if ( ntrees < trees . length ) { trees = Arrays . copyOf ( trees , ntrees ) ; alpha = Arrays . copyOf ( alpha , ntrees ) ; error = Arrays . copyOf ( error , ntrees ) ; }
public class VarTensor { /** * Gets the tensor dimensions : dimension i corresponds to the i ' th variable , and the size of * that dimension is the number of states for the variable . */ private static int [ ] getDims ( VarSet vars ) { } }
int [ ] dims = new int [ vars . size ( ) ] ; for ( int i = 0 ; i < vars . size ( ) ; i ++ ) { dims [ i ] = vars . get ( i ) . getNumStates ( ) ; } return dims ;
public class SimpleLibContext { /** * this is the amazing functionality provided by simple - lib */ public void printSetting ( String path ) { } }
System . out . println ( "The setting '" + path + "' is: " + config . getString ( path ) ) ;
public class Bogosort { /** * Sort the list in descending order using this algorithm . * @ param < E > the type of elements in this list . * @ param list the list that we want to sort */ public static < E extends Comparable < E > > void sortDescending ( List < E > list ) { } }
while ( ! Sort . isReverseSorted ( list ) ) { FYShuffle . shuffle ( list ) ; }
public class ModelsEngine { /** * Evaluate the shadow map calling the shadow method . * @ param h * the height of the raster . * @ param w * the width of the raster . * @ param sunVector * @ param inverseSunVector * @ param normalSunVector * @ param demWR * the elevation map . * @ param dx * the resolution of the elevation map . * @ return the shadow map . */ public static WritableRaster calculateFactor ( int h , int w , double [ ] sunVector , double [ ] inverseSunVector , double [ ] normalSunVector , WritableRaster demWR , double dx ) { } }
double casx = 1e6 * sunVector [ 0 ] ; double casy = 1e6 * sunVector [ 1 ] ; int f_i = 0 ; int f_j = 0 ; if ( casx <= 0 ) { f_i = 0 ; } else { f_i = w - 1 ; } if ( casy <= 0 ) { f_j = 0 ; } else { f_j = h - 1 ; } WritableRaster sOmbraWR = CoverageUtilities . createWritableRaster ( w , h , null , null , 1.0 ) ; int j = f_j ; for ( int i = 0 ; i < sOmbraWR . getWidth ( ) ; i ++ ) { shadow ( i , j , sOmbraWR , demWR , dx , normalSunVector , inverseSunVector ) ; } int i = f_i ; for ( int k = 0 ; k < sOmbraWR . getHeight ( ) ; k ++ ) { shadow ( i , k , sOmbraWR , demWR , dx , normalSunVector , inverseSunVector ) ; } return sOmbraWR ;
public class Word { /** * Realizes the concatenation of this word with several other words . * @ param words * the words to concatenate * @ return the results of the concatenation */ @ SuppressWarnings ( "unchecked" ) @ Nonnull protected Word < I > concatInternal ( Word < ? extends I > ... words ) { } }
if ( words . length == 0 ) { return this ; } int len = length ( ) ; int totalSize = len ; for ( Word < ? extends I > word : words ) { totalSize += word . length ( ) ; } Object [ ] array = new Object [ totalSize ] ; writeToArray ( 0 , array , 0 , len ) ; int currOfs = len ; for ( Word < ? extends I > w : words ) { int wLen = w . length ( ) ; w . writeToArray ( 0 , array , currOfs , wLen ) ; currOfs += wLen ; } return new SharedWord < > ( array ) ;
public class Classfile { /** * Link classes . Not threadsafe , should be run in a single - threaded context . * @ param classNameToClassInfo * map from class name to class info * @ param packageNameToPackageInfo * map from package name to package info * @ param moduleNameToModuleInfo * map from module name to module info */ void link ( final Map < String , ClassInfo > classNameToClassInfo , final Map < String , PackageInfo > packageNameToPackageInfo , final Map < String , ModuleInfo > moduleNameToModuleInfo ) { } }
boolean isModuleDescriptor = false ; boolean isPackageDescriptor = false ; ClassInfo classInfo = null ; if ( className . equals ( "module-info" ) ) { isModuleDescriptor = true ; } else if ( className . equals ( "package-info" ) || className . endsWith ( ".package-info" ) ) { isPackageDescriptor = true ; } else { // Handle regular classfile classInfo = ClassInfo . addScannedClass ( className , classModifiers , isExternalClass , classNameToClassInfo , classpathElement , classfileResource ) ; classInfo . setModifiers ( classModifiers ) ; classInfo . setIsInterface ( isInterface ) ; classInfo . setIsAnnotation ( isAnnotation ) ; if ( superclassName != null ) { classInfo . addSuperclass ( superclassName , classNameToClassInfo ) ; } if ( implementedInterfaces != null ) { for ( final String interfaceName : implementedInterfaces ) { classInfo . addImplementedInterface ( interfaceName , classNameToClassInfo ) ; } } if ( classAnnotations != null ) { for ( final AnnotationInfo classAnnotation : classAnnotations ) { classInfo . addClassAnnotation ( classAnnotation , classNameToClassInfo ) ; } } if ( classContainmentEntries != null ) { ClassInfo . addClassContainment ( classContainmentEntries , classNameToClassInfo ) ; } if ( annotationParamDefaultValues != null ) { classInfo . addAnnotationParamDefaultValues ( annotationParamDefaultValues ) ; } if ( fullyQualifiedDefiningMethodName != null ) { classInfo . addFullyQualifiedDefiningMethodName ( fullyQualifiedDefiningMethodName ) ; } if ( fieldInfoList != null ) { classInfo . addFieldInfo ( fieldInfoList , classNameToClassInfo ) ; } if ( methodInfoList != null ) { classInfo . addMethodInfo ( methodInfoList , classNameToClassInfo ) ; } if ( typeSignature != null ) { classInfo . setTypeSignature ( typeSignature ) ; } if ( refdClassNames != null ) { classInfo . addReferencedClassNames ( refdClassNames ) ; } } // Get or create PackageInfo , if this is not a module descriptor ( the module descriptor ' s package is " " ) PackageInfo packageInfo = null ; if ( ! isModuleDescriptor ) { // Get package for this class or package descriptor packageInfo = PackageInfo . getOrCreatePackage ( PackageInfo . getParentPackageName ( className ) , packageNameToPackageInfo ) ; if ( isPackageDescriptor ) { // Add any class annotations on the package - info . class file to the ModuleInfo packageInfo . addAnnotations ( classAnnotations ) ; } else if ( classInfo != null ) { // Add ClassInfo to PackageInfo , and vice versa packageInfo . addClassInfo ( classInfo ) ; classInfo . packageInfo = packageInfo ; } } // Get or create ModuleInfo , if there is a module name final String moduleName = classpathElement . getModuleName ( ) ; if ( moduleName != null ) { // Get or create a ModuleInfo object for this module ModuleInfo moduleInfo = moduleNameToModuleInfo . get ( moduleName ) ; if ( moduleInfo == null ) { moduleNameToModuleInfo . put ( moduleName , moduleInfo = new ModuleInfo ( classfileResource . getModuleRef ( ) , classpathElement ) ) ; } if ( isModuleDescriptor ) { // Add any class annotations on the module - info . class file to the ModuleInfo moduleInfo . addAnnotations ( classAnnotations ) ; } if ( classInfo != null ) { // Add ClassInfo to ModuleInfo , and vice versa moduleInfo . addClassInfo ( classInfo ) ; classInfo . moduleInfo = moduleInfo ; } if ( packageInfo != null ) { // Add PackageInfo to ModuleInfo moduleInfo . addPackageInfo ( packageInfo ) ; } }
public class AWSSdkClient { /** * Get list of { @ link AutoScalingGroup } s for a given tag * @ param tag Tag to filter the auto scaling groups * @ return List of { @ link AutoScalingGroup } s qualifying the filter tag */ public List < AutoScalingGroup > getAutoScalingGroupsWithTag ( Tag tag ) { } }
final AmazonAutoScaling autoScaling = getAmazonAutoScalingClient ( ) ; final DescribeAutoScalingGroupsRequest describeAutoScalingGroupsRequest = new DescribeAutoScalingGroupsRequest ( ) ; final List < AutoScalingGroup > allAutoScalingGroups = autoScaling . describeAutoScalingGroups ( describeAutoScalingGroupsRequest ) . getAutoScalingGroups ( ) ; final List < AutoScalingGroup > filteredAutoScalingGroups = Lists . newArrayList ( ) ; for ( AutoScalingGroup autoScalingGroup : allAutoScalingGroups ) { for ( TagDescription tagDescription : autoScalingGroup . getTags ( ) ) { if ( tagDescription . getKey ( ) . equalsIgnoreCase ( tag . getKey ( ) ) && tagDescription . getValue ( ) . equalsIgnoreCase ( tag . getValue ( ) ) ) { filteredAutoScalingGroups . add ( autoScalingGroup ) ; } } } return filteredAutoScalingGroups ;
public class JvmFallbackShutdown { /** * Spawn a background thread which will wait for the specified time , then print out any * remaining threads and forcibly kill the JVM . Intended to be used before an action that < i > should < / i > * shut down the JVM but is not guaranteed to - will scream for help if anything goes wrong with shutdown . * @ param waitTime how long to wait */ public static void fallbackTerminate ( Duration waitTime ) { } }
Throwable source = new Throwable ( ) ; source . fillInStackTrace ( ) ; if ( inTests ( source ) ) { LOG . warn ( "Asked to register in a test environment. You probably don't want this." ) ; return ; } Thread fallbackTerminateThread = new Thread ( ( ) -> fallbackKill ( waitTime , source ) ) ; fallbackTerminateThread . setName ( "T-1000" ) ; fallbackTerminateThread . setDaemon ( true ) ; fallbackTerminateThread . start ( ) ;
public class IOUtils { /** * Returns all the text in the given File . * @ return The text in the file . May be an empty string if the file is empty . * If the file cannot be read ( non - existent , etc . ) , then and only then * the method returns < code > null < / code > . */ public static String slurpFileNoExceptions ( File file ) { } }
try { return IOUtils . slurpReader ( new FileReader ( file ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; return null ; }
public class ApiOvhDbaaslogs { /** * Returns details of specified input engine * REST : GET / dbaas / logs / input / engine / { engineId } * @ param engineId [ required ] Engine ID */ public OvhEngine input_engine_engineId_GET ( String engineId ) throws IOException { } }
String qPath = "/dbaas/logs/input/engine/{engineId}" ; StringBuilder sb = path ( qPath , engineId ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhEngine . class ) ;
public class IoUtil { /** * String 转为流 * @ param content 内容 * @ param charset 编码 * @ return 字节流 */ public static ByteArrayInputStream toStream ( String content , Charset charset ) { } }
if ( content == null ) { return null ; } return toStream ( StrUtil . bytes ( content , charset ) ) ;
public class DBClusterSnapshotAttribute { /** * The values for the manual DB cluster snapshot attribute . * If the < code > AttributeName < / code > field is set to < code > restore < / code > , then this element returns a list of IDs * of the AWS accounts that are authorized to copy or restore the manual DB cluster snapshot . If a value of * < code > all < / code > is in the list , then the manual DB cluster snapshot is public and available for any AWS account * to copy or restore . * @ param attributeValues * The values for the manual DB cluster snapshot attribute . < / p > * If the < code > AttributeName < / code > field is set to < code > restore < / code > , then this element returns a list * of IDs of the AWS accounts that are authorized to copy or restore the manual DB cluster snapshot . If a * value of < code > all < / code > is in the list , then the manual DB cluster snapshot is public and available for * any AWS account to copy or restore . */ public void setAttributeValues ( java . util . Collection < String > attributeValues ) { } }
if ( attributeValues == null ) { this . attributeValues = null ; return ; } this . attributeValues = new java . util . ArrayList < String > ( attributeValues ) ;
public class IPAddress { /** * Returns the smallest set of prefix blocks that spans both this and the supplied address or subnet . * @ param other * @ return */ protected static < T extends IPAddress > T [ ] getSpanningPrefixBlocks ( T first , T other , UnaryOperator < T > getLower , UnaryOperator < T > getUpper , Comparator < T > comparator , UnaryOperator < T > prefixAdder , UnaryOperator < T > prefixRemover , IntFunction < T [ ] > arrayProducer ) { } }
T [ ] result = checkPrefixBlockContainment ( first , other , prefixAdder , arrayProducer ) ; if ( result != null ) { return result ; } List < IPAddressSegmentSeries > blocks = IPAddressSection . getSpanningBlocks ( first , other , getLower , getUpper , comparator , prefixRemover , IPAddressSection :: splitIntoPrefixBlocks ) ; return blocks . toArray ( arrayProducer . apply ( blocks . size ( ) ) ) ;
public class S3ClientCache { /** * Returns a new client with region configured to * region . * Also updates the clientsByRegion map by associating the * new client with region . * @ param region * The region the returned { @ link AmazonS3 } will be * configured to use . * @ return A new { @ link AmazonS3 } client with region set to region . */ private AmazonS3 cacheClient ( String region ) { } }
if ( awscredentialsProvider == null ) { throw new IllegalArgumentException ( "No credentials provider found to connect to S3" ) ; } AmazonS3 client = new AmazonS3Client ( awscredentialsProvider ) ; client . setRegion ( RegionUtils . getRegion ( region ) ) ; clientsByRegion . put ( region , client ) ; return client ;
public class MapConstraints { /** * Returns a constrained view of the specified list multimap , using the * specified constraint . Any operations that add new mappings will call the * provided constraint . However , this method does not verify that existing * mappings satisfy the constraint . * < p > Note that the generated multimap ' s { @ link Multimap # removeAll } and * { @ link Multimap # replaceValues } methods return collections that are not * constrained . * < p > The returned multimap is not serializable . * @ param multimap the multimap to constrain * @ param constraint the constraint that validates added entries * @ return a constrained view of the specified multimap */ public static < K , V > ListMultimap < K , V > constrainedListMultimap ( ListMultimap < K , V > multimap , MapConstraint < ? super K , ? super V > constraint ) { } }
return new ConstrainedListMultimap < K , V > ( multimap , constraint ) ;
public class Strings { /** * JavaScript - unescapes the specified text . * @ param target the text to be unescaped * @ return the unescaped text . * @ since 2.0.11 */ public String unescapeJavaScript ( final Object target ) { } }
if ( target == null ) { return null ; } return StringUtils . unescapeJavaScript ( target ) ;
public class DateUtil { /** * Determines if string is an integer of the radix base number system * provided . * @ param s * String to be evaluated for integer type * @ param radix * Base number system ( e . g . , 10 = base 10 number system ) * @ return boolean */ private boolean isInteger ( String s , int radix ) { } }
Scanner sc = new Scanner ( s . trim ( ) ) ; if ( ! sc . hasNextInt ( radix ) ) return false ; // we know it starts with a valid int , now make sure // there ' s nothing left ! sc . nextInt ( radix ) ; return ! sc . hasNext ( ) ;
public class PropertyChangeListeners { /** * Attaches a deep property change listener to the given object , that * generates logging information about the property change events , * and prints them to the standard output . * @ param object The object */ public static void addDeepConsoleLogger ( Object object ) { } }
addDeepLogger ( object , m -> System . out . println ( m ) ) ;
public class ClassUtil { /** * 执行方法 < br > * 可执行Private方法 , 也可执行static方法 < br > * 执行非static方法时 , 必须满足对象有默认构造方法 < br > * @ param < T > 对象类型 * @ param classNameWithMethodName 类名和方法名表达式 , 例如 : com . xiaoleilu . hutool . StrUtil # isEmpty或com . xiaoleilu . hutool . StrUtil . isEmpty * @ param isSingleton 是否为单例对象 , 如果此参数为false , 每次执行方法时创建一个新对象 * @ param args 参数 , 必须严格对应指定方法的参数类型和数量 * @ return 返回结果 */ public static < T > T invoke ( String classNameWithMethodName , boolean isSingleton , Object ... args ) { } }
if ( StrUtil . isBlank ( classNameWithMethodName ) ) { throw new UtilException ( "Blank classNameDotMethodName!" ) ; } int splitIndex = classNameWithMethodName . lastIndexOf ( '#' ) ; if ( splitIndex <= 0 ) { splitIndex = classNameWithMethodName . lastIndexOf ( '.' ) ; } if ( splitIndex <= 0 ) { throw new UtilException ( "Invalid classNameWithMethodName [{}]!" , classNameWithMethodName ) ; } final String className = classNameWithMethodName . substring ( 0 , splitIndex ) ; final String methodName = classNameWithMethodName . substring ( splitIndex + 1 ) ; return invoke ( className , methodName , isSingleton , args ) ;
public class CheckpointManager { /** * Returns a { @ link StoredBlock } representing the last checkpoint before the given time , for example , normally * you would want to know the checkpoint before the earliest wallet birthday . */ public StoredBlock getCheckpointBefore ( long time ) { } }
try { checkArgument ( time > params . getGenesisBlock ( ) . getTimeSeconds ( ) ) ; // This is thread safe because the map never changes after creation . Map . Entry < Long , StoredBlock > entry = checkpoints . floorEntry ( time ) ; if ( entry != null ) return entry . getValue ( ) ; Block genesis = params . getGenesisBlock ( ) . cloneAsHeader ( ) ; return new StoredBlock ( genesis , genesis . getWork ( ) , 0 ) ; } catch ( VerificationException e ) { throw new RuntimeException ( e ) ; // Cannot happen . }
public class BaseDependencyCheckMojo { /** * Collect dependencies from the dependency management section . * @ param buildingRequest the Maven project building request * @ param project the project being analyzed * @ param nodes the list of dependency nodes * @ param aggregate whether or not this is an aggregate analysis * @ return a collection of exceptions if any occurred ; otherwise * < code > null < / code > */ private ExceptionCollection collectDependencyManagementDependencies ( ProjectBuildingRequest buildingRequest , MavenProject project , List < DependencyNode > nodes , boolean aggregate ) { } }
if ( skipDependencyManagement || project . getDependencyManagement ( ) == null ) { return null ; } ExceptionCollection exCol = null ; for ( org . apache . maven . model . Dependency dependency : project . getDependencyManagement ( ) . getDependencies ( ) ) { try { nodes . add ( toDependencyNode ( buildingRequest , null , dependency ) ) ; } catch ( ArtifactResolverException ex ) { getLog ( ) . debug ( String . format ( "Aggregate : %s" , aggregate ) ) ; if ( exCol == null ) { exCol = new ExceptionCollection ( ) ; } exCol . addException ( ex ) ; } } return exCol ;
public class ClassUtil { /** * Returns the classloader for the speficied < code > clazz < / code > . Unlike * { @ link Class # getClassLoader ( ) } this will never return null . */ public static ClassLoader getClassLoader ( Class clazz ) { } }
ClassLoader classLoader = clazz . getClassLoader ( ) ; return classLoader == null ? ClassLoader . getSystemClassLoader ( ) : classLoader ;
public class ChannelMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Channel channel , ProtocolMarshaller protocolMarshaller ) { } }
if ( channel == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( channel . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( channel . getArn ( ) , ARN_BINDING ) ; protocolMarshaller . marshall ( channel . getStatus ( ) , STATUS_BINDING ) ; protocolMarshaller . marshall ( channel . getRetentionPeriod ( ) , RETENTIONPERIOD_BINDING ) ; protocolMarshaller . marshall ( channel . getCreationTime ( ) , CREATIONTIME_BINDING ) ; protocolMarshaller . marshall ( channel . getLastUpdateTime ( ) , LASTUPDATETIME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class ProcessRunnerTask { /** * Get the name of this process and run it . */ public void runTask ( ) { } }
String strProcess = this . getProperty ( DBParams . PROCESS ) ; BaseProcess job = ( BaseProcess ) ClassServiceUtility . getClassService ( ) . makeObjectFromClassName ( strProcess ) ; if ( job != null ) { this . runProcess ( job , m_properties ) ; } else { // NOTE : It is not recommended to start a standalone process , since they can wreak havoc with this jvm // ( since standalones assume complete control and often will exit ( 0 ) ) String strClass = this . getProperty ( "standalone" ) ; // Applets are also run as tasks if ( ( strClass != null ) && ( strClass . length ( ) > 0 ) ) { try { if ( strClass . indexOf ( '.' ) == 0 ) strClass = Constants . ROOT_PACKAGE + strClass . substring ( 1 ) ; Class < ? > c = Class . forName ( strClass ) ; // Don ' t instatiate the class , since I ' m calling static main if ( c != null ) { Class < ? > [ ] parameterTypes = { String [ ] . class } ; Method method = c . getMethod ( "main" , parameterTypes ) ; Object [ ] args = new Object [ 1 ] ; Map < String , Object > properties = m_properties ; // Only passed in properties String [ ] rgArgs = Utility . propertiesToArgs ( properties ) ; args [ 0 ] = rgArgs ; method . invoke ( null , args ) ; } } catch ( Exception ex ) { ex . printStackTrace ( ) ; } } }
public class AbstractIoSessionConfig { /** * { @ inheritDoc } */ public final void setAll ( IoSessionConfig config ) { } }
if ( config == null ) { throw new NullPointerException ( "config" ) ; } if ( ENABLE_BUFFER_SIZE ) { System . out . println ( "AbstractIoSessionConfig.setAll()" ) ; setReadBufferSize ( config . getReadBufferSize ( ) ) ; setMinReadBufferSize ( config . getMinReadBufferSize ( ) ) ; setMaxReadBufferSize ( config . getMaxReadBufferSize ( ) ) ; } setIdleTime ( IdleStatus . BOTH_IDLE , config . getIdleTime ( IdleStatus . BOTH_IDLE ) ) ; setIdleTime ( IdleStatus . READER_IDLE , config . getIdleTime ( IdleStatus . READER_IDLE ) ) ; setIdleTime ( IdleStatus . WRITER_IDLE , config . getIdleTime ( IdleStatus . WRITER_IDLE ) ) ; setWriteTimeout ( config . getWriteTimeout ( ) ) ; setUseReadOperation ( config . isUseReadOperation ( ) ) ; setThroughputCalculationInterval ( config . getThroughputCalculationInterval ( ) ) ; doSetAll ( config ) ;
public class JumblrClient { /** * Get the posts for a given blog * @ param blogName the name of the blog * @ param options the options for this call ( or null ) * @ return a List of posts */ public List < Post > blogPosts ( String blogName , Map < String , ? > options ) { } }
if ( options == null ) { options = Collections . emptyMap ( ) ; } Map < String , Object > soptions = JumblrClient . safeOptionMap ( options ) ; soptions . put ( "api_key" , apiKey ) ; String path = "/posts" ; if ( soptions . containsKey ( "type" ) ) { path += "/" + soptions . get ( "type" ) . toString ( ) ; soptions . remove ( "type" ) ; } return requestBuilder . get ( JumblrClient . blogPath ( blogName , path ) , soptions ) . getPosts ( ) ;
public class JAXBUtil { /** * Unmarshals any class model object . * @ param source Input source containing a complete PMML schema version 4.3 document or any fragment of it . */ static public Object unmarshal ( Source source ) throws JAXBException { } }
Unmarshaller unmarshaller = createUnmarshaller ( ) ; return unmarshaller . unmarshal ( source ) ;
public class DistributionUtils { /** * Two stage distribution , dry run and actual promotion to verify correctness . * @ param distributionBuilder * @ param client * @ param listener * @ param buildName * @ param buildNumber * @ throws IOException */ public static boolean distributeAndCheckResponse ( DistributionBuilder distributionBuilder , ArtifactoryBuildInfoClient client , TaskListener listener , String buildName , String buildNumber , boolean dryRun ) throws IOException { } }
// do a dry run first listener . getLogger ( ) . println ( "Performing dry run distribution (no changes are made during dry run) ..." ) ; if ( ! distribute ( distributionBuilder , client , listener , buildName , buildNumber , true ) ) { return false ; } listener . getLogger ( ) . println ( "Dry run finished successfully" ) ; if ( ! dryRun ) { listener . getLogger ( ) . println ( "Performing distribution ..." ) ; if ( ! distribute ( distributionBuilder , client , listener , buildName , buildNumber , false ) ) { return false ; } listener . getLogger ( ) . println ( "Distribution completed successfully!" ) ; } return true ;
public class ParseContext { /** * Consumes the given token . If the current residual text to be parsed * starts with the parsing index is increased by { @ code token . size ( ) } . * @ param token The token expected . * @ return true , if the token could be consumed and the index was increased * by { @ code token . size ( ) } . */ public boolean consume ( String token ) { } }
if ( getInput ( ) . toString ( ) . startsWith ( token ) ) { index += token . length ( ) ; return true ; } return false ;
public class ConstructorUtils { /** * < p > Returns a new instance of the specified class inferring the right constructor * from the types of the arguments . < / p > * < p > This locates and calls a constructor . * The constructor signature must match the argument types exactly . < / p > * @ param < T > the type to be constructed * @ param cls the class to be constructed , not { @ code null } * @ param args the array of arguments , { @ code null } treated as empty * @ return new instance of { @ code cls } , not { @ code null } * @ throws NullPointerException if { @ code cls } is { @ code null } * @ throws NoSuchMethodException if a matching constructor cannot be found * @ throws IllegalAccessException if invocation is not permitted by security * @ throws InvocationTargetException if an error occurs on invocation * @ throws InstantiationException if an error occurs on instantiation * @ see # invokeExactConstructor ( java . lang . Class , java . lang . Object [ ] , java . lang . Class [ ] ) */ public static < T > T invokeExactConstructor ( final Class < T > cls , Object ... args ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException , InstantiationException { } }
args = ArrayUtils . nullToEmpty ( args ) ; final Class < ? > parameterTypes [ ] = ClassUtils . toClass ( args ) ; return invokeExactConstructor ( cls , args , parameterTypes ) ;
public class ConcurrentNodeMemories { /** * The implementation tries to delay locking as much as possible , by running * some potentially unsafe operations out of the critical session . In case it * fails the checks , it will move into the critical sessions and re - check everything * before effectively doing any change on data structures . */ public Memory getNodeMemory ( MemoryFactory node , InternalWorkingMemory wm ) { } }
if ( node . getMemoryId ( ) >= this . memories . length ( ) ) { resize ( node ) ; } Memory memory = this . memories . get ( node . getMemoryId ( ) ) ; if ( memory == null ) { memory = createNodeMemory ( node , wm ) ; } return memory ;
public class DateTimeUtils { /** * Parse a string ( optionally containing a zone ) as a value of TIMESTAMP type . * If the string specifies a zone , the zone is discarded . * For example : { @ code " 2000-01-01 01:23:00 " } is parsed to TIMESTAMP { @ code 2000-01-01T01:23:00} * and { @ code " 2000-01-01 01:23:00 + 01:23 " } is also parsed to TIMESTAMP { @ code 2000-01-01T01:23:00.000 } . * @ return stack representation of TIMESTAMP type */ public static long parseTimestampWithoutTimeZone ( String value ) { } }
LocalDateTime localDateTime = TIMESTAMP_WITH_OR_WITHOUT_TIME_ZONE_FORMATTER . parseLocalDateTime ( value ) ; try { return ( long ) getLocalMillis . invokeExact ( localDateTime ) ; } catch ( Throwable e ) { throw new RuntimeException ( e ) ; }
public class CPInstanceLocalServiceWrapper { /** * Adds the cp instance to the database . Also notifies the appropriate model listeners . * @ param cpInstance the cp instance * @ return the cp instance that was added */ @ Override public com . liferay . commerce . product . model . CPInstance addCPInstance ( com . liferay . commerce . product . model . CPInstance cpInstance ) { } }
return _cpInstanceLocalService . addCPInstance ( cpInstance ) ;
public class CoreRepositorySetupService { /** * ACL */ protected void addAcl ( @ Nonnull final Session session , @ Nonnull final String path , @ Nonnull final String principalName , boolean allow , @ Nonnull final String [ ] privilegeKeys , @ Nonnull final Map restrictionKeys ) throws RepositoryException { } }
try { final AccessControlManager acManager = session . getAccessControlManager ( ) ; final PrincipalManager principalManager = ( ( JackrabbitSession ) session ) . getPrincipalManager ( ) ; final JackrabbitAccessControlList policies = AccessControlUtils . getAccessControlList ( acManager , path ) ; final Principal principal = principalManager . getPrincipal ( principalName ) ; final Privilege [ ] privileges = AccessControlUtils . privilegesFromNames ( acManager , privilegeKeys ) ; final Map < String , Value > restrictions = new HashMap < > ( ) ; for ( final Object key : restrictionKeys . keySet ( ) ) { restrictions . put ( ( String ) key , new StringValue ( ( String ) restrictionKeys . get ( key ) ) ) ; } policies . addEntry ( principal , privileges , allow , restrictions ) ; LOG . info ( "addAcl({},{})" , principalName , Arrays . toString ( privilegeKeys ) ) ; acManager . setPolicy ( path , policies ) ; } catch ( RepositoryException e ) { LOG . error ( "Error in addAcl({},{},{},{}, {}) : {}" , new Object [ ] { path , principalName , allow , Arrays . asList ( privilegeKeys ) , restrictionKeys , e . toString ( ) } ) ; throw e ; }
public class QuerySpec { /** * Convenient method to specify expressions ( and the associated name map and * value map ) via { @ link QueryExpressionSpec } . */ @ Beta public QuerySpec withExpressionSpec ( QueryExpressionSpec xspec ) { } }
return withKeyConditionExpression ( xspec . getKeyConditionExpression ( ) ) . withFilterExpression ( xspec . getFilterExpression ( ) ) . withProjectionExpression ( xspec . getProjectionExpression ( ) ) . withNameMap ( xspec . getNameMap ( ) ) . withValueMap ( xspec . getValueMap ( ) ) ;
public class InboundTransferTask { /** * Cancels all the segments and marks them as finished , sends a cancel command , then completes the task . */ public void cancel ( ) { } }
if ( ! isCancelled ) { isCancelled = true ; IntSet segmentsCopy = getUnfinishedSegments ( ) ; synchronized ( segments ) { unfinishedSegments . clear ( ) ; } if ( trace ) { log . tracef ( "Cancelling inbound state transfer from %s with unfinished segments %s" , source , segmentsCopy ) ; } sendCancelCommand ( segmentsCopy ) ; notifyCompletion ( false ) ; }
public class Status { /** * Method to get a StatusGroup from the cache . * @ param _ uuid UUID of the StatusGroup wanted . * @ return StatusGroup * @ throws CacheReloadException on error */ public static StatusGroup get ( final UUID _uuid ) throws CacheReloadException { } }
final Cache < UUID , StatusGroup > cache = InfinispanCache . get ( ) . < UUID , StatusGroup > getCache ( Status . UUIDCACHE4GRP ) ; if ( ! cache . containsKey ( _uuid ) ) { Status . getStatusGroupFromDB ( Status . SQL_UUID4GRP , String . valueOf ( _uuid ) ) ; } return cache . get ( _uuid ) ;
public class EngagementCreator { /** * Add the requested post parameters to the Request . * @ param request Request to add post params to */ private void addPostParams ( final Request request ) { } }
if ( to != null ) { request . addPostParam ( "To" , to . toString ( ) ) ; } if ( from != null ) { request . addPostParam ( "From" , from . toString ( ) ) ; } if ( parameters != null ) { request . addPostParam ( "Parameters" , Converter . mapToJson ( parameters ) ) ; }
public class IntColumn { /** * Returns a new numeric column initialized with the given name and size . The values in the column are * integers beginning at startsWith and continuing through size ( exclusive ) , monotonically increasing by 1 * TODO consider a generic fill function including steps or random samples from various distributions */ public static IntColumn indexColumn ( final String columnName , final int size , final int startsWith ) { } }
final IntColumn indexColumn = IntColumn . create ( columnName , size ) ; for ( int i = 0 ; i < size ; i ++ ) { indexColumn . set ( i , i + startsWith ) ; } return indexColumn ;
public class LockSet { /** * Return whether or not this lock set is empty , meaning that no locks have * a positive lock count . * @ return true if no locks are held , false if at least one lock is held */ public boolean isEmpty ( ) { } }
for ( int i = 0 ; i + 1 < array . length ; i += 2 ) { int valueNumber = array [ i ] ; if ( valueNumber < 0 ) { return true ; } int myLockCount = array [ i + 1 ] ; if ( myLockCount > 0 ) { return false ; } } return true ;
public class ResourceGroovyMethods { /** * Helper method to create a buffered writer for a file . If the given * charset is " UTF - 16BE " or " UTF - 16LE " ( or an equivalent alias ) , the * requisite byte order mark is written to the stream before the writer * is returned . * @ param file a File * @ param charset the name of the encoding used to write in this file * @ param append true if in append mode * @ param writeBom whether to write a BOM * @ return a BufferedWriter * @ throws IOException if an IOException occurs . * @ since 2.5.0 */ public static BufferedWriter newWriter ( File file , String charset , boolean append , boolean writeBom ) throws IOException { } }
boolean shouldWriteBom = writeBom && ! file . exists ( ) ; if ( append ) { FileOutputStream stream = new FileOutputStream ( file , append ) ; if ( shouldWriteBom ) { IOGroovyMethods . writeUTF16BomIfRequired ( stream , charset ) ; } return new EncodingAwareBufferedWriter ( new OutputStreamWriter ( stream , charset ) ) ; } else { FileOutputStream stream = new FileOutputStream ( file ) ; if ( shouldWriteBom ) { IOGroovyMethods . writeUTF16BomIfRequired ( stream , charset ) ; } return new EncodingAwareBufferedWriter ( new OutputStreamWriter ( stream , charset ) ) ; }
public class ComplianceConfig { /** * check for isEnabled */ public boolean isIndexImmutable ( Object request ) { } }
if ( ! this . enabled ) { return false ; } if ( immutableIndicesPatterns . isEmpty ( ) ) { return false ; } final Resolved resolved = irr . resolveRequest ( request ) ; final Set < String > allIndices = resolved . getAllIndices ( ) ; // assert allIndices . size ( ) = = 1 : " only one index here , not " + allIndices ; // assert allIndices . contains ( " _ all " ) : " no _ all in " + allIndices ; // assert allIndices . contains ( " * " ) : " no * in " + allIndices ; // assert allIndices . contains ( " " ) : " no EMPTY in " + allIndices ; return WildcardMatcher . matchAny ( immutableIndicesPatterns , allIndices ) ;
public class DataSinkNode { @ Override public void accept ( Visitor < OptimizerNode > visitor ) { } }
if ( visitor . preVisit ( this ) ) { if ( getPredecessorNode ( ) != null ) { getPredecessorNode ( ) . accept ( visitor ) ; } else { throw new CompilerException ( ) ; } visitor . postVisit ( this ) ; }
public class KTypeArrayList { /** * { @ inheritDoc } */ @ Override public < T extends KTypeProcedure < ? super KType > > T forEach ( T procedure ) { } }
return forEach ( procedure , 0 , size ( ) ) ;
public class HBaseClient { /** * Add records to data wrapper . * @ param columnWrapper * column wrapper * @ param embeddableData * embeddable data * @ param dataSet * data collection set */ private void addRecords ( HBaseDataWrapper columnWrapper , List < HBaseDataWrapper > embeddableData , List < HBaseDataWrapper > dataSet ) { } }
dataSet . add ( columnWrapper ) ; if ( ! embeddableData . isEmpty ( ) ) { dataSet . addAll ( embeddableData ) ; }
public class MapUtil { /** * 新建TreeMap , Key有序的Map * @ param map Map * @ param comparator Key比较器 * @ return TreeMap * @ since 3.2.3 */ public static < K , V > TreeMap < K , V > newTreeMap ( Map < K , V > map , Comparator < ? super K > comparator ) { } }
final TreeMap < K , V > treeMap = new TreeMap < > ( comparator ) ; if ( false == isEmpty ( map ) ) { treeMap . putAll ( map ) ; } return treeMap ;
public class DefaultDisseminatorImpl { /** * Returns an HTML rendering of the object profile which contains key * metadata from the object , plus URLs for the object ' s Dissemination Index * and Item Index . The data is returned as HTML in a presentation - oriented * format . This is accomplished by doing an XSLT transform on the XML that * is obtained from getObjectProfile in API - A . * @ return html packaged as a MIMETypedStream * @ throws ServerException */ public MIMETypedStream viewObjectProfile ( ) throws ServerException { } }
try { ObjectProfile profile = m_access . getObjectProfile ( context , reader . GetObjectPID ( ) , asOfDateTime ) ; Reader in = null ; try { ReadableCharArrayWriter out = new ReadableCharArrayWriter ( 1024 ) ; DefaultSerializer . objectProfileToXML ( profile , asOfDateTime , out ) ; out . close ( ) ; in = out . toReader ( ) ; } catch ( IOException ioe ) { throw new GeneralException ( "[DefaultDisseminatorImpl] An error has occurred. " + "The error was a \"" + ioe . getClass ( ) . getName ( ) + "\" . The " + "Reason was \"" + ioe . getMessage ( ) + "\" ." ) ; } // InputStream in = getObjectProfile ( ) . getStream ( ) ; ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream ( 4096 ) ; PrintWriter out = new PrintWriter ( new OutputStreamWriter ( bytes , Charset . forName ( "UTF-8" ) ) ) ; File xslFile = new File ( reposHomeDir , "access/viewObjectProfile.xslt" ) ; Templates template = XmlTransformUtility . getTemplates ( xslFile ) ; Transformer transformer = template . newTransformer ( ) ; transformer . setParameter ( "fedora" , context . getEnvironmentValue ( Constants . FEDORA_APP_CONTEXT_NAME ) ) ; transformer . transform ( new StreamSource ( in ) , new StreamResult ( out ) ) ; out . close ( ) ; return new MIMETypedStream ( "text/html" , bytes . toInputStream ( ) , null , bytes . length ( ) ) ; } catch ( Exception e ) { throw new DisseminationException ( "[DefaultDisseminatorImpl] had an error " + "in transforming xml for viewObjectProfile. " + "Underlying exception was: " + e . getMessage ( ) ) ; }
public class Position { /** * From http : / / williams . best . vwh . net / avform . htm ( Latitude of point on GC ) . * @ param position * @ param longitudeDegrees * @ return */ public Double getLatitudeOnGreatCircle ( Position position , double longitudeDegrees ) { } }
double lonR = toRadians ( longitudeDegrees ) ; double lat1R = toRadians ( lat ) ; double lon1R = toRadians ( lon ) ; double lat2R = toRadians ( position . getLat ( ) ) ; double lon2R = toRadians ( position . getLon ( ) ) ; double sinDiffLon1RLon2R = sin ( lon1R - lon2R ) ; if ( abs ( sinDiffLon1RLon2R ) < 0.00000001 ) { return null ; } else { double cosLat1R = cos ( lat1R ) ; double cosLat2R = cos ( lat2R ) ; double numerator = sin ( lat1R ) * cosLat2R * sin ( lonR - lon2R ) - sin ( lat2R ) * cosLat1R * sin ( lonR - lon1R ) ; double denominator = cosLat1R * cosLat2R * sinDiffLon1RLon2R ; double radians = atan ( numerator / denominator ) ; return FastMath . toDegrees ( radians ) ; }
public class RetrievalToolConfigParser { /** * Parses command line configuration into an object structure , validates * correct values along the way . * Prints a help message and exits the JVM on parse failure . * @ param args command line configuration values * @ return populated RetrievalToolConfig */ public RetrievalToolConfig processCommandLine ( String [ ] args ) { } }
RetrievalToolConfig config = null ; try { config = processOptions ( args ) ; } catch ( ParseException e ) { printHelp ( e . getMessage ( ) ) ; } // Make sure work dir is set RetrievalConfig . setWorkDir ( config . getWorkDir ( ) ) ; config . setWorkDir ( RetrievalConfig . getWorkDir ( ) ) ; return config ;
public class CommerceShipmentUtil { /** * Returns the last commerce shipment in the ordered set where groupId = & # 63 ; . * @ param groupId the group ID * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching commerce shipment , or < code > null < / code > if a matching commerce shipment could not be found */ public static CommerceShipment fetchByGroupId_Last ( long groupId , OrderByComparator < CommerceShipment > orderByComparator ) { } }
return getPersistence ( ) . fetchByGroupId_Last ( groupId , orderByComparator ) ;
public class SVGImageView { /** * Attempt to set a picture from a Uri . Return true if it worked . */ private boolean internalSetImageURI ( Uri uri ) { } }
try { InputStream is = getContext ( ) . getContentResolver ( ) . openInputStream ( uri ) ; new LoadURITask ( ) . execute ( is ) ; return true ; } catch ( FileNotFoundException e ) { return false ; }
public class TimeSeries { /** * Destroy the TimeSeries associated with a Key */ public void destroy ( ) { } }
clear ( ) ; this . client . operate ( null , key , Operation . put ( Bin . asNull ( binName ) ) ) ;
public class PackageDescriptor { /** * Get a reasonable unique ID for the package . * @ return The package ID */ public String getPackageId ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; if ( group != null ) sb . append ( group ) ; sb . append ( ":" ) ; if ( name != null ) sb . append ( name ) ; sb . append ( ":" ) ; if ( version != null ) sb . append ( version ) ; sb . append ( ":" ) ; return sb . toString ( ) ;