signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CacheControlHandlerInterceptor { /** * Returns an expires header value generated from the given * { @ link CacheControl } annotation . * @ param cacheControl the < code > CacheControl < / code > annotation from which to * create the returned expires header value * @ return the expires header value ...
final Calendar expires = new GregorianCalendar ( TimeZone . getTimeZone ( "GMT" ) ) ; if ( cacheControl . maxAge ( ) >= 0 ) { expires . add ( Calendar . SECOND , cacheControl . maxAge ( ) ) ; } return expires . getTime ( ) . getTime ( ) ;
public class XsdAsmElements { /** * Generates the methods in a given class for a given child that the class is allowed to have . * @ param classWriter The { @ link ClassWriter } where the method will be written . * @ param childName The child name that represents a method . * @ param classType The type of the cla...
childName = firstToLower ( getCleanName ( childName ) ) ; String childCamelName = firstToUpper ( childName ) ; String childType = getFullClassTypeName ( childCamelName , apiName ) ; String childTypeDesc = getFullClassTypeNameDesc ( childCamelName , apiName ) ; MethodVisitor mVisitor = classWriter . visitMethod ( ACC_PU...
public class GreenPepperXmlRpcClient { /** * { @ inheritDoc } */ @ SuppressWarnings ( "unchecked" ) public Set < Repository > getSpecificationRepositoriesOfAssociatedProject ( Repository repository , String identifier ) throws GreenPepperServerException { } }
Vector params = CollectionUtil . toVector ( repository . marshallize ( ) ) ; log . debug ( "Retrieving Specification repositories for Associated project. (Repo UID: " + repository . getUid ( ) + ")" ) ; Vector < Object > repositoriesParams = ( Vector < Object > ) execute ( XmlRpcMethodName . getSpecificationRepositorie...
public class Condition { /** * 获取符合Hibernate的条件 * @ return */ public Criterion getCriterion ( Class < ? > persistentClass ) { } }
Expression exp = Expression . valueOf ( expression ) ; // 表达式为 : in , between ( 输入值为多个值 ) List < Expression > multivalueExpres = Arrays . asList ( Expression . in , Expression . nin , Expression . between , Expression . nbetween ) ; if ( multivalueExpres . contains ( exp ) ) { Object [ ] vals = null ; Class < ? extends...
public class A_CmsXmlDocument { /** * Creates a partial deep element copy according to the set of element paths . < p > * Only elements contained in that set will be copied . * @ param parentPath the path of the parent element or < code > null < / code > , initially * @ param parent the parent element * @ param...
String elName = element . getName ( ) ; if ( parentPath != null ) { Element first = element . getParent ( ) . element ( elName ) ; int elIndex = ( element . getParent ( ) . indexOf ( element ) - first . getParent ( ) . indexOf ( first ) ) + 1 ; elName = parentPath + ( parentPath . length ( ) > 0 ? "/" : "" ) + elName ....
public class Triple { /** * Creates a triple with the specified values . */ public static < A , B , C > Triple < A , B , C > newTriple ( A a , B b , C c ) { } }
return new Triple < A , B , C > ( a , b , c ) ;
public class TrelloImpl { /** * / * Action */ @ Override public Action getAction ( String actionId , Argument ... args ) { } }
Action action = get ( createUrl ( GET_ACTION ) . params ( args ) . asString ( ) , Action . class , actionId ) ; action . setInternalTrello ( this ) ; return action ;
public class EventParser { /** * Parse fights of an old event */ private List < Fight > parseEventFights ( Elements trs , Event event ) { } }
SherdogBaseObject sEvent = new SherdogBaseObject ( ) ; sEvent . setName ( event . getName ( ) ) ; sEvent . setSherdogUrl ( event . getSherdogUrl ( ) ) ; List < Fight > fights = new ArrayList < > ( ) ; if ( trs . size ( ) > 0 ) { trs . remove ( 0 ) ; trs . forEach ( tr -> { Fight fight = new Fight ( ) ; fight . setEvent...
public class OntologyTagServiceImpl { /** * The attribute just got updated , but the entity does not know this yet . To reindex this document * in elasticsearch , update it . * @ param entity name of the entity * @ param attribute the name of the attribute that got changed * @ param attributeEntity the entity o...
EntityType entityEntity = dataService . getEntityType ( entity ) ; Iterable < Attribute > attributes = entityEntity . getOwnAllAttributes ( ) ; entityEntity . set ( ATTRIBUTES , stream ( attributes ) . map ( att -> att . getName ( ) . equals ( attribute ) ? attributeEntity : att ) . collect ( Collectors . toList ( ) ) ...
public class GetSigningProfileRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetSigningProfileRequest getSigningProfileRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getSigningProfileRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getSigningProfileRequest . getProfileName ( ) , PROFILENAME_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to ...
public class Coercions { /** * Returns true if the given class is of a floating point type */ public static boolean isFloatingPointType ( Class pClass ) { } }
return pClass == Float . class || pClass == Float . TYPE || pClass == Double . class || pClass == Double . TYPE ;
public class MemcachedClient { /** * Shut down this client gracefully . * @ param timeout the amount of time time for shutdown * @ param unit the TimeUnit for the timeout * @ return result of the shutdown request */ @ Override public boolean shutdown ( long timeout , TimeUnit unit ) { } }
// Guard against double shutdowns ( bug 8 ) . if ( shuttingDown ) { getLogger ( ) . info ( "Suppressing duplicate attempt to shut down" ) ; return false ; } shuttingDown = true ; String baseName = mconn . getName ( ) ; mconn . setName ( baseName + " - SHUTTING DOWN" ) ; boolean rv = true ; if ( connFactory . isDefaultE...
public class JDBCDriver { /** * Gets information about the possible properties for this driver . < p > * The getPropertyInfo method is intended to allow a generic GUI tool * to discover what properties it should prompt a human for in order to * get enough information to connect to a database . Note that depending...
if ( ! acceptsURL ( url ) ) { return new DriverPropertyInfo [ 0 ] ; } String [ ] choices = new String [ ] { "true" , "false" } ; DriverPropertyInfo [ ] pinfo = new DriverPropertyInfo [ 6 ] ; DriverPropertyInfo p ; if ( info == null ) { info = new Properties ( ) ; } p = new DriverPropertyInfo ( "user" , null ) ; p . val...
public class CustomApi { /** * ( asynchronously ) * @ param runmode ( required ) * @ param bundlesIgnored ( optional ) * @ param bundlesIgnoredTypeHint ( optional ) * @ param callback The callback to be executed when the API call finishes * @ return The request call * @ throws ApiException If fail to proces...
ProgressResponseBody . ProgressListener progressListener = null ; ProgressRequestBody . ProgressRequestListener progressRequestListener = null ; if ( callback != null ) { progressListener = new ProgressResponseBody . ProgressListener ( ) { @ Override public void update ( long bytesRead , long contentLength , boolean do...
public class SAXiTextHandler { /** * This method gets called when characters are encountered . * @ param ch * an array of characters * @ param start * the start position in the array * @ param length * the number of characters to read from the array */ public void characters ( char [ ] ch , int start , int ...
if ( ignore ) return ; String content = new String ( ch , start , length ) ; // System . err . println ( " ' " + content + " ' " ) ; if ( content . trim ( ) . length ( ) == 0 && content . indexOf ( ' ' ) < 0 ) { return ; } StringBuffer buf = new StringBuffer ( ) ; int len = content . length ( ) ; char character ; boole...
public class CallOptions { /** * Returns a new { @ code CallOptions } with the given absolute deadline . * < p > This is mostly used for propagating an existing deadline . { @ link # withDeadlineAfter } is the * recommended way of setting a new deadline , * @ param deadline the deadline or { @ code null } for uns...
CallOptions newOptions = new CallOptions ( this ) ; newOptions . deadline = deadline ; return newOptions ;
public class LogMetadata { /** * Updates the current version of the metadata . * @ param value The new metadata version . * @ return This instance . */ LogMetadata withUpdateVersion ( int value ) { } }
Preconditions . checkArgument ( value >= this . updateVersion . get ( ) , "versions must increase" ) ; this . updateVersion . set ( value ) ; return this ;
public class JsonReader { /** * Returns a < a href = " http : / / goessner . net / articles / JsonPath / " > JsonPath < / a > to * the current location in the JSON value . */ public String getPath ( ) { } }
StringBuilder result = new StringBuilder ( ) . append ( '$' ) ; for ( int i = 0 , size = stackSize ; i < size ; i ++ ) { switch ( stack [ i ] ) { case JsonScope . EMPTY_ARRAY : case JsonScope . NONEMPTY_ARRAY : result . append ( '[' ) . append ( pathIndices [ i ] ) . append ( ']' ) ; break ; case JsonScope . EMPTY_OBJE...
public class TriangleBatch { /** * Prepares to add primitives with the specified tint and transform . This configures * { @ link # stableAttrs } with all of the attributes that are the same for every vertex . */ public void prepare ( int tint , AffineTransform xf ) { } }
prepare ( tint , xf . m00 , xf . m01 , xf . m10 , xf . m11 , xf . tx , xf . ty ) ;
public class Graphite { /** * The graphite protocol is a " one - way " streaming protocol and as such there is no easy way * to check that we are sending the output to the wrong place . We can aim the graphite writer * at any listening socket and it will never care if the data is being correctly handled . By * lo...
final InputStream input = socket . getInputStream ( ) ; if ( input . available ( ) > 0 ) { final byte [ ] bytes = new byte [ 1000 ] ; final int toRead = Math . min ( input . available ( ) , bytes . length ) ; final int read = input . read ( bytes , 0 , toRead ) ; if ( read > 0 ) { final String msg = "Data returned by g...
public class InjectionConfiguration { /** * Define a class using a custom object factory . * @ param classDefinition The class to use . * @ param factory The object factory responsible for instantiating the given class . */ public < T > void define ( Class < T > classDefinition , ObjectFactory < T > factory ) { } }
injectorConfiguration = injectorConfiguration . withFactory ( classDefinition , factory ) ;
public class AXMLParser { /** * Closes parser : * * closes ( and nulls ) underlying stream * * nulls dynamic data * * moves object to ' closed ' state , where methods * return invalid values and next ( ) throws IOException . */ public final void close ( ) { } }
if ( m_stream == null ) { return ; } try { m_stream . close ( ) ; } catch ( IOException e ) { } if ( m_nextException == null ) { m_nextException = new IOException ( "Closed." ) ; } m_stream = null ; resetState ( ) ;
public class SupplementaryMaterial { /** * Gets the value of the altTextOrLongDescOrEmail property . * This accessor method returns a reference to the live list , * not a snapshot . Therefore any modification you make to the * returned list will be present inside the JAXB object . * This is why there is not a <...
if ( altTextOrLongDescOrEmail == null ) { altTextOrLongDescOrEmail = new ArrayList < Object > ( ) ; } return this . altTextOrLongDescOrEmail ;
public class Image { /** * Sets the color values to this Image . * @ param colors * < < < < < HEAD * The array of Color which size is width * height of this Image . * The array of Color which size is width * height of this Image . * > > > > > 16121fd9fe4eeaef3cb56619769a3119a9e6531a */ public final void setCo...
int [ ] pixels = ( ( DataBufferInt ) img . getRaster ( ) . getDataBuffer ( ) ) . getData ( ) ; for ( int y = 0 ; y < height ; ++ y ) { for ( int x = 0 ; x < width ; ++ x ) { int idx = x + y * width ; if ( colors . length <= idx ) break ; int red = ( int ) ( colors [ idx ] . getRed ( ) * 255.0 ) ; int green = ( int ) ( ...
public class Jenkins { /** * Called in response to { @ link Job # doDoDelete ( StaplerRequest , StaplerResponse ) } */ public void onDeleted ( TopLevelItem item ) throws IOException { } }
ItemListener . fireOnDeleted ( item ) ; items . remove ( item . getName ( ) ) ; // For compatibility with old views : for ( View v : views ) v . onJobRenamed ( item , item . getName ( ) , null ) ;
public class GeneratePluginConfigMBean { /** * Subcommand for creating the plugin - cfg . xml file at runtime using the * user provided Plugin install root and Plugin server name . * @ param root Plugin install root directory * @ param name The server name * @ param utilityRequest True if plugin config creation...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "generatePluginConfig" , "server is stopping = " + serverIsStopping ) ; } try { // Method is synchronized so only one generate can be in progress at a time . generateInProgress = true ; if ( ! serverIsStopping ) { PluginGener...
public class LibertyJaxWsCompatibleWSDLGetInterceptor { /** * Extend from the base class and just customize the response to 404 */ @ Override public void handleMessage ( Message message ) throws Fault { } }
String method = ( String ) message . get ( Message . HTTP_REQUEST_METHOD ) ; String query = ( String ) message . get ( Message . QUERY_STRING ) ; if ( ! "GET" . equals ( method ) || StringUtils . isEmpty ( query ) ) { return ; } String baseUri = ( String ) message . get ( Message . REQUEST_URL ) ; String ctx = ( String...
public class RouteBuilder { /** * Specifies that this route is mapped to HTTP OPTIONS method . * @ return instance of { @ link RouteBuilder } . */ public RouteBuilder options ( ) { } }
if ( ! methods . contains ( HttpMethod . OPTIONS ) ) { methods . add ( HttpMethod . OPTIONS ) ; } return this ;
public class AWSAppMeshClient { /** * Updates an existing virtual service in a specified service mesh . * @ param updateVirtualServiceRequest * @ return Result of the UpdateVirtualService operation returned by the service . * @ throws BadRequestException * The request syntax was malformed . Check your request s...
request = beforeClientExecution ( request ) ; return executeUpdateVirtualService ( request ) ;
public class RXTXPort { /** * Remove the serial port event listener */ public void removeEventListener ( ) { } }
logger . fine ( "RXTXPort:removeEventListener() called" ) ; waitForTheNativeCodeSilly ( ) ; // if ( monThread ! = null & & monThread . isAlive ( ) ) if ( monThreadisInterrupted == true ) { logger . fine ( " RXTXPort:removeEventListener() already interrupted" ) ; monThread = null ; SPEventListener = null ; return ; } el...
public class PageFlowController { /** * Called from { @ link FlowController # execute } . */ void savePreviousActionInfo ( ActionForm form , HttpServletRequest request , ActionMapping mapping , ServletContext servletContext ) { } }
// If previous - action is disabled ( unused in this pageflow ) , just return . if ( isPreviousActionInfoDisabled ( ) ) return ; String actionURI = InternalUtils . getDecodedServletPath ( request ) ; _previousActionInfo = new PreviousActionInfo ( form , actionURI , request . getQueryString ( ) ) ;
public class UploadOfflineData { /** * Hash a string using SHA - 256 hashing algorithm . * @ param str the string to hash . * @ return the SHA - 256 hash string representation . * @ throws UnsupportedEncodingException If UTF - 8 charset is not supported . */ private static String toSHA256String ( String str ) thr...
// Normalize the string before hashing . byte [ ] hash = digest . digest ( toNormalizedString ( str ) . getBytes ( "UTF-8" ) ) ; StringBuilder result = new StringBuilder ( ) ; for ( byte b : hash ) { result . append ( String . format ( "%02x" , b ) ) ; } return result . toString ( ) ;
public class DataFindRequest { /** * Use { @ link # select ( List , Integer , Integer ) } or * { @ link # select ( Projection [ ] , Integer , Integer ) } . * @ param begin - the ' from ' parameter to send to lightblue . * @ param end - the ' to ' parameter to send to lightblue . */ @ Deprecated public DataFindReq...
this . begin = begin ; if ( end != null ) { // ' maxResults ' should be 1 greater than a ' to ' value . maxResults = end - ( begin == null ? 0 : begin ) + 1 ; } return this ;
public class SparkLineTileSkin { /** * * * * * * Resizing * * * * * */ @ Override protected void resizeDynamicText ( ) { } }
double maxWidth = unitText . isVisible ( ) ? width - size * 0.275 : width - size * 0.1 ; double fontSize = size * 0.24 ; valueText . setFont ( Fonts . latoRegular ( fontSize ) ) ; if ( valueText . getLayoutBounds ( ) . getWidth ( ) > maxWidth ) { Helper . adjustTextSize ( valueText , maxWidth , fontSize ) ; } maxWidth ...
public class PresentsServer { /** * Inits and runs the PresentsServer bound in the given modules . This blocks until the server * is shut down . */ public static void runServer ( Module ... modules ) { } }
Injector injector = Guice . createInjector ( modules ) ; PresentsServer server = injector . getInstance ( PresentsServer . class ) ; try { // initialize the server server . init ( injector ) ; // check to see if we should load and invoke a test module before running the server String testmod = System . getProperty ( "t...
public class WaybackRequest { /** * create WaybackRequet for URL - Query request . * @ param url target URL * @ param start start timestamp ( 14 - digit ) * @ param end end timestamp ( 14 - digit ) * @ return WaybackRequest */ public static WaybackRequest createUrlQueryRequest ( String url , String start , Stri...
WaybackRequest r = new WaybackRequest ( ) ; r . setUrlQueryRequest ( ) ; r . setRequestUrl ( url ) ; r . setStartTimestamp ( start ) ; r . setEndTimestamp ( end ) ; return r ;
public class ResourceGroovyMethods { /** * Write the text to the File . * @ param file a File * @ param text the text to write to the File * @ throws IOException if an IOException occurs . * @ since 1.0 */ public static void write ( File file , String text ) throws IOException { } }
Writer writer = null ; try { writer = new FileWriter ( file ) ; writer . write ( text ) ; writer . flush ( ) ; Writer temp = writer ; writer = null ; temp . close ( ) ; } finally { closeWithWarning ( writer ) ; }
public class Rect { /** * If the rectangle specified by left , top , right , bottom intersects this * rectangle , return true and set this rectangle to that intersection , * otherwise return false and do not change this rectangle . No check is * performed to see if either rectangle is empty . Note : To just test ...
if ( this . left < right && left < this . right && this . top < bottom && top < this . bottom ) { if ( this . left < left ) { this . left = left ; } if ( this . top < top ) { this . top = top ; } if ( this . right > right ) { this . right = right ; } if ( this . bottom > bottom ) { this . bottom = bottom ; } return tru...
public class FileServersInner { /** * Gets a list of File Servers associated with the specified workspace . * @ 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 PagedL...
return listByWorkspaceNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < FileServerInner > > , Page < FileServerInner > > ( ) { @ Override public Page < FileServerInner > call ( ServiceResponse < Page < FileServerInner > > response ) { return response . body ( ) ; } } ) ;
public class ParaClient { /** * Search for { @ link com . erudika . para . core . Address } objects in a radius of X km from a given point . * @ param < P > type of the object * @ param type the type of object to search for . See { @ link com . erudika . para . core . ParaObject # getType ( ) } * @ param query th...
MultivaluedMap < String , String > params = new MultivaluedHashMap < > ( ) ; params . putSingle ( "latlng" , lat + "," + lng ) ; params . putSingle ( "radius" , Integer . toString ( radius ) ) ; params . putSingle ( "q" , query ) ; params . putSingle ( Config . _TYPE , type ) ; params . putAll ( pagerToParams ( pager )...
public class GetResourceShareInvitationsRequest { /** * The Amazon Resource Names ( ARN ) of the resource shares . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setResourceShareArns ( java . util . Collection ) } or { @ link # withResourceShareArns ( java ....
if ( this . resourceShareArns == null ) { setResourceShareArns ( new java . util . ArrayList < String > ( resourceShareArns . length ) ) ; } for ( String ele : resourceShareArns ) { this . resourceShareArns . add ( ele ) ; } return this ;
public class DockerRule { /** * Starts a docker container with the given configuration . * This method is particularly useful when you want to start a container dynamically . * @ param config * container configuration * @ param stopOthers * true to stop other running containers ; useful to limit the amount of...
Preconditions . checkArgument ( config != null , "config must be non-null" ) ; if ( stopOthers ) { getRegisteredContainers ( ) . stream ( ) . filter ( container -> { return container . isStarted ( ) && container . getRefCount ( ) == 0 && ! StringUtils . equals ( config . getName ( ) , container . getConfig ( ) . getNam...
public class MXBeanNotificationListenersCleanUp { /** * Unregister { @ link NotificationListener } s from subclass of { @ link NotificationBroadcasterSupport } , if listener , * filter or handback is loaded by the protected ClassLoader . */ protected void unregisterNotificationListeners ( ClassLoaderLeakPreventor pre...
final Field listenerListField = preventor . findField ( NotificationBroadcasterSupport . class , "listenerList" ) ; if ( listenerListField != null ) { final Class < ? > listenerInfoClass = preventor . findClass ( "javax.management.NotificationBroadcasterSupport$ListenerInfo" ) ; final List < ? /* javax . management . N...
public class ClientService { /** * This function updates the data of a client . To change only a specific attribute you can set this attribute in the update * request . All other attributes that should not be edited are not inserted . You can only edit the description , email and credit * card . The subscription ca...
RestfulUtils . update ( ClientService . PATH , client , Client . class , super . httpClient ) ;
public class GetLifecyclePoliciesResult { /** * Summary information about the lifecycle policies . * @ param policies * Summary information about the lifecycle policies . */ public void setPolicies ( java . util . Collection < LifecyclePolicySummary > policies ) { } }
if ( policies == null ) { this . policies = null ; return ; } this . policies = new java . util . ArrayList < LifecyclePolicySummary > ( policies ) ;
public class InternationalFixedChronology { /** * Obtains a International Fixed zoned date - time from another date - time object . * @ param temporal the date - time object to convert , not null * @ return the International Fixed zoned date - time , not null * @ throws DateTimeException if unable to create the d...
return ( ChronoZonedDateTime < InternationalFixedDate > ) super . zonedDateTime ( temporal ) ;
public class PropertyListSerialization { /** * Serialize an object using the best available element . * @ param obj * object to serialize . * @ param handler * destination of serialization events . * @ throws SAXException * if exception during serialization . */ private static void serializeObject ( final O...
if ( obj instanceof Map ) { serializeMap ( ( Map ) obj , handler ) ; } else if ( obj instanceof List ) { serializeList ( ( List ) obj , handler ) ; } else if ( obj instanceof Number ) { if ( obj instanceof Double || obj instanceof Float ) { serializeReal ( ( Number ) obj , handler ) ; } else { serializeInteger ( ( Numb...
public class UrlIO { /** * Evaluate XPath on the url document . * @ param xpath * @ return xpath evaluator * @ see org . xmlbeam . evaluation . CanEvaluate # evalXPath ( java . lang . String ) */ @ Override @ Scope ( DocScope . IO ) public XPathEvaluator evalXPath ( final String xpath ) { } }
return new DefaultXPathEvaluator ( projector , new DocumentResolver ( ) { @ Override public Document resolve ( final Class < ? > ... resourceAwareClasses ) throws IOException { return IOHelper . getDocumentFromURL ( projector . config ( ) . createDocumentBuilder ( ) , url , requestProperties , resourceAwareClasses ) ; ...
public class S3Discovery { /** * Do the set - up that ' s needed to access Amazon S3. */ private void init ( ) { } }
validatePreSignedUrls ( ) ; try { conn = new AWSAuthConnection ( access_key , secret_access_key ) ; // Determine the bucket name if prefix is set or if pre - signed URLs are being used if ( prefix != null && prefix . length ( ) > 0 ) { ListAllMyBucketsResponse bucket_list = conn . listAllMyBuckets ( null ) ; List bucke...
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link StringOrRefType } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link StringOrRefType } { @ code > } *...
return new JAXBElement < StringOrRefType > ( _LocationString_QNAME , StringOrRefType . class , null , value ) ;
public class CliqueTree { /** * This is a key step in message passing . When we are calculating a message , we want to marginalize out all variables * not relevant to the recipient of the message . This function does that . * @ param message the message to marginalize * @ param relevant the variables that are rel...
TableFactor result = message ; for ( int i : message . neighborIndices ) { boolean contains = false ; for ( int j : relevant ) { if ( i == j ) { contains = true ; break ; } } if ( ! contains ) { switch ( marginalize ) { case SUM : result = result . sumOut ( i ) ; break ; case MAX : result = result . maxOut ( i ) ; brea...
public class JobTracker { /** * A tracker wants to know if any of its Tasks have been * closed ( because the job completed , whether successfully or not ) */ synchronized List < TaskTrackerAction > getTasksToKill ( String taskTracker ) { } }
Set < TaskAttemptIDWithTip > taskset = trackerToTaskMap . get ( taskTracker ) ; List < TaskTrackerAction > killList = new ArrayList < TaskTrackerAction > ( ) ; if ( taskset != null ) { for ( TaskAttemptIDWithTip onetask : taskset ) { TaskAttemptID killTaskId = onetask . attemptId ; TaskInProgress tip = onetask . tip ; ...
public class Ring { /** * Draws this slice . * @ param context */ @ Override protected boolean prepare ( final Context2D context , final Attributes attr , final double alpha ) { } }
final double ord = attr . getOuterRadius ( ) ; final double ird = attr . getInnerRadius ( ) ; if ( ( ord > 0 ) && ( ird > 0 ) && ( ord > ird ) ) { context . beginPath ( ) ; context . arc ( 0 , 0 , ord , 0 , Math . PI * 2 , false ) ; context . arc ( 0 , 0 , ird , 0 , Math . PI * 2 , true ) ; context . closePath ( ) ; re...
public class RythmConfiguration { /** * Get { @ link RythmConfigurationKey # I18N _ MESSAGE _ SOURCES } without lookup */ public List < String > messageSources ( ) { } }
if ( null == _messageSources ) { _messageSources = Arrays . asList ( get ( I18N_MESSAGE_SOURCES ) . toString ( ) . split ( "[, \\t]+" ) ) ; } return _messageSources ;
public class AbstractConverter { /** * Determines whether the { @ link Type } is a generic , parameterized { @ link Converter } { @ link Class type } , such as * by implementing the { @ link Converter } interface or extending the { @ link AbstractConverter } base class . * @ param type { @ link Type } to evaluate ....
return Optional . ofNullable ( type ) . filter ( it -> it instanceof ParameterizedType ) . map ( it -> { Class < ? > rawType = safeGetValue ( ( ) -> ClassUtils . toRawType ( it ) , Object . class ) ; return isAssignableTo ( rawType , Converter . class , Function . class ) ; } ) . orElse ( false ) ;
public class RandomText { /** * Generates a random text that consists of random number of random words separated by spaces . * @ param min ( optional ) a minimum number of words . * @ param max a maximum number of words . * @ return a random text . */ public static String words ( int min , int max ) { } }
StringBuilder result = new StringBuilder ( ) ; int count = RandomInteger . nextInteger ( min , max ) ; for ( int i = 0 ; i < count ; i ++ ) result . append ( RandomString . pick ( _allWords ) ) ; return result . toString ( ) ;
public class SurtPrefixSet { /** * For SURT comparisons - - prefixes or candidates being checked against * those prefixes - - we treat https URIs as if they were http . * @ param u string to coerce if it has https scheme * @ return string converted to http scheme , or original if not necessary */ private static S...
if ( u . startsWith ( "https://" ) ) { u = "http" + u . substring ( "https" . length ( ) ) ; } return u ;
public class SimpleNodeListProvider { /** * Pass a System Property of format * < EVCACHE _ APP > - NODES = setname0 = instance01 : port , instance02 : port , * instance03 : port ; setname1 = instance11 : port , instance12 : port , instance13 : port ; * setname2 = instance21 : port , instance22 : port , instance23...
final String propertyName = appName + "-NODES" ; final String nodeListString = EVCacheConfig . getInstance ( ) . getDynamicStringProperty ( propertyName , "" ) . get ( ) ; if ( log . isDebugEnabled ( ) ) log . debug ( "List of Nodes = " + nodeListString ) ; if ( nodeListString != null && nodeListString . length ( ) > 0...
public class CpnlElFunctions { /** * Returns the escaped text of a rich text value ( reduced HTML escaping ) . * @ param value the rich text value to escape * @ return the escaped HTML code of the value */ public static String rich ( SlingHttpServletRequest request , String value ) { } }
if ( value != null ) { // ensure that a rich text value is always enclosed with a HTML paragraph tag if ( StringUtils . isNotBlank ( value ) && ! value . trim ( ) . startsWith ( "<p>" ) ) { value = "<p>" + value + "</p>" ; } // transform embedded resource links ( paths ) to mapped URLs value = map ( request , value ) ;...
public class InputMapTemplate { /** * Shorthand for { @ link # sequence ( InputMapTemplate [ ] ) } sequence ( this , that ) } */ public final InputMapTemplate < S , E > orElse ( InputMapTemplate < S , ? extends E > that ) { } }
return sequence ( this , that ) ;
public class CmsDefaultUsers { /** * Checks if a given user name is the name of the admin user . < p > * @ param userName the user name to check * @ return < code > true < / code > if a given user name is the name of the admin user */ public boolean isUserAdmin ( String userName ) { } }
if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( userName ) ) { return false ; } return m_userAdmin . equals ( userName ) ;
public class InstaLomoFilter { /** * NOTE : This is a PoC , and not good code . . . */ public BufferedImage filter ( BufferedImage src , BufferedImage dest ) { } }
if ( dest == null ) { dest = createCompatibleDestImage ( src , null ) ; } // Make image faded / washed out / red - ish // DARK WARM float [ ] scales = new float [ ] { 2.2f , 2.0f , 1.55f } ; float [ ] offsets = new float [ ] { - 20.0f , - 90.0f , - 110.0f } ; // BRIGHT NATURAL // float [ ] scales = new float [ ] { 1.1f...
public class JsonRpcServerHandler { /** * In charge of validating all the transport - related aspects of the incoming * HTTP request . * < p > The checks include : < / p > * < ul > * < li > that the request ' s path matches that of this handler ; < / li > * < li > that the request ' s method is { @ code POST ...
URI uri = new URI ( request . getUri ( ) ) ; JsonRpcError error = null ; if ( ! uri . getPath ( ) . equals ( rpcPath ) ) { error = new JsonRpcError ( HttpResponseStatus . NOT_FOUND , "Not Found" ) ; } if ( ! request . getMethod ( ) . equals ( HttpMethod . POST ) ) { error = new JsonRpcError ( HttpResponseStatus . METHO...
public class GraphqlController { /** * GET end point */ @ RequestMapping ( method = RequestMethod . GET ) @ Transactional public Callable < ResponseEntity < JsonNode > > get ( @ RequestParam String query , @ RequestParam ( required = false ) String variables , @ RequestParam ( required = false ) String operationName ) ...
return ( ) -> { // Parses the arguments Map < String , Object > arguments = decodeIntoMap ( variables ) ; // Runs the query return ResponseEntity . ok ( requestAsJson ( new Request ( query , arguments , operationName ) ) ) ; } ;
public class RPTree { /** * Build the tree with the given input data * @ param x */ public void buildTree ( INDArray x ) { } }
this . X = x ; for ( int i = 0 ; i < x . rows ( ) ; i ++ ) { root . getIndices ( ) . add ( i ) ; } RPUtils . buildTree ( this , root , rpHyperPlanes , x , maxSize , 0 , similarityFunction ) ;
public class HrefOperator { /** * Execute HREF operator . Uses property path to extract content value , convert it to string and set < em > href < / em > attribute . * @ param element context element , unused , * @ param scope scope object , * @ param propertyPath property path , * @ param arguments optional ar...
if ( ! propertyPath . equals ( "." ) && ConverterRegistry . hasType ( scope . getClass ( ) ) ) { throw new TemplateException ( "Operand is property path but scope is not an object." ) ; } Object value = content . getObject ( scope , propertyPath ) ; if ( value == null ) { return null ; } if ( value instanceof URL ) { v...
public class AbstractFormModel { /** * Remove a child FormModel . Dirty and committable listeners are removed . * When child was dirty , remove the formModel from the dirty list and update * the dirty state . * @ param child FormModel to remove from childlist . */ public void removeChild ( HierarchicalFormModel c...
Assert . notNull ( child , "child" ) ; child . removeParent ( ) ; children . remove ( child ) ; child . removePropertyChangeListener ( DIRTY_PROPERTY , childStateChangeHandler ) ; child . removePropertyChangeListener ( COMMITTABLE_PROPERTY , childStateChangeHandler ) ; // when dynamically adding / removing childModels ...
public class ConfigurationsInner { /** * Updates a configuration of a server . * @ 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 configuration...
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , serverName , configurationName , parameters ) . toBlocking ( ) . last ( ) . body ( ) ;
public class JarCacheStorage { /** * Get all of the { @ code jarcache . json } resources that exist on the * classpath * @ return A cached list of jarcache . json classpath resources as * { @ link URL } s * @ throws IOException * If there was an IO error while scanning the classpath */ private List < URL > ge...
final ClassLoader cl = getClassLoader ( ) ; // ConcurrentHashMap doesn ' t support null keys , so substitute a pseudo // key final Object key = cl == null ? NULL_CLASS_LOADER : cl ; // computeIfAbsent requires unchecked exceptions for the creation // process , so we // cannot easily use it directly , instead using get ...
public class JDBC4PreparedStatement { /** * Sets the designated parameter to the given java . sql . Timestamp value . */ @ Override public void setTimestamp ( int parameterIndex , Timestamp x ) throws SQLException { } }
checkParameterBounds ( parameterIndex ) ; this . parameters [ parameterIndex - 1 ] = x == null ? VoltType . NULL_TIMESTAMP : x ;
public class CloudantClient { /** * Provides access to Cloudant < tt > replication < / tt > APIs . * @ return Replication object for configuration and triggering * @ see com . cloudant . client . api . Replication * @ see < a target = " _ blank " * href = " https : / / console . bluemix . net / docs / services ...
Replication couchDbReplication = couchDbClient . replication ( ) ; com . cloudant . client . api . Replication replication = new com . cloudant . client . api . Replication ( couchDbReplication ) ; return replication ;
public class AppliedDiscountUrl { /** * Get Resource Url for RemoveCoupon * @ param checkoutId The unique identifier of the checkout . * @ param couponCode Code associated with the coupon to remove from the cart . * @ return String Resource Url */ public static MozuUrl removeCouponUrl ( String checkoutId , String...
UrlFormatter formatter = new UrlFormatter ( "/api/commerce/checkouts/{checkoutId}/coupons/{couponcode}" ) ; formatter . formatUrl ( "checkoutId" , checkoutId ) ; formatter . formatUrl ( "couponCode" , couponCode ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ;
public class Gram { /** * Submits a GramJob to specified gatekeeper as an * interactive job . Performs limited delegation . * @ throws GramException if an error occurs during submisson * @ param resourceManagerContact resource manager contact * @ param job gram job */ public static void request ( String resourc...
request ( resourceManagerContact , job , false ) ;
public class ErrorMessage { /** * < p > parseMessage . < / p > * @ param status a int . * @ return a { @ link java . lang . String } object . */ public static String parseMessage ( int status ) { } }
String msg = null ; if ( status < 500 ) { if ( status == 402 || ( status > 417 && status < 421 ) || status > 424 ) { msg = ErrorMessage . getLocaleMessage ( 400 ) ; } else { msg = ErrorMessage . getLocaleMessage ( status ) ; } } else { switch ( status ) { case 501 : msg = ErrorMessage . getLocaleMessage ( status ) ; br...
public class RequestTemplate { /** * Append the value to the template . * This method is poorly named and is used primarily to store the relative uri for the request . It * has been replaced by { @ link RequestTemplate # uri ( String ) } and will be removed in a future * release . * @ param value to append . ...
/* proxy to url */ if ( this . uriTemplate != null ) { return this . uri ( value . toString ( ) , true ) ; } return this . uri ( value . toString ( ) ) ;
public class QNMinimizer { /** * computeDir ( ) * This function will calculate an approximation of the inverse hessian based * off the seen s , y vector pairs . This particular approximation uses the BFGS * update . */ private void computeDir ( double [ ] dir , double [ ] fg , QNInfo qn ) throws SurpriseConvergen...
System . arraycopy ( fg , 0 , dir , 0 , fg . length ) ; int mmm = qn . size ( ) ; double [ ] as = new double [ mmm ] ; for ( int i = mmm - 1 ; i >= 0 ; i -- ) { as [ i ] = qn . getRho ( i ) * ArrayMath . innerProduct ( qn . getS ( i ) , dir ) ; plusAndConstMult ( dir , qn . getY ( i ) , - as [ i ] , dir ) ; } // multip...
public class RateLimitedLogger { /** * It is a very bad idea to use this when the message changes all the time . * It ' s also a cache and only makes a best effort to enforce the rate limit . */ public static void tryLogForMessage ( long now , final long maxLogInterval , final TimeUnit maxLogIntervalUnit , final Volt...
Callable < RateLimitedLogger > builder = new Callable < RateLimitedLogger > ( ) { @ Override public RateLimitedLogger call ( ) throws Exception { return new RateLimitedLogger ( maxLogIntervalUnit . toMillis ( maxLogInterval ) , logger , level ) ; } } ; final RateLimitedLogger rll ; try { rll = m_loggersCached . get ( f...
public class BlockReader { /** * Read the block length information from data stream * @ throws IOException */ private synchronized void readBlockSizeInfo ( ) throws IOException { } }
if ( ! transferBlockSize ) { return ; } blkLenInfoUpdated = true ; isBlockFinalized = in . readBoolean ( ) ; updatedBlockLength = in . readLong ( ) ; if ( dataTransferVersion >= DataTransferProtocol . READ_PROFILING_VERSION ) { readDataNodeProfilingData ( ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( "ifBlockCo...
public class ChainingParser { /** * Reads all iCalendar objects from the stream . * @ return the parsed iCalendar objects * @ throws IOException if there ' s an I / O problem */ public List < ICalendar > all ( ) throws IOException { } }
StreamReader reader = constructReader ( ) ; if ( index != null ) { reader . setScribeIndex ( index ) ; } try { List < ICalendar > icals = new ArrayList < ICalendar > ( ) ; ICalendar ical ; while ( ( ical = reader . readNext ( ) ) != null ) { if ( warnings != null ) { warnings . add ( reader . getWarnings ( ) ) ; } ical...
public class HttpObjectFactory { /** * Return a response object to the factory for pooling . * @ param response */ public void releaseResponse ( HttpResponseMessageImpl response ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "releaseResponse: " + response ) ; } this . respPool . put ( response ) ;
public class DiscreteCosineTransform { /** * 1 - D Forward Discrete Cosine Transform . * @ param data Data . */ public static void Forward ( double [ ] data ) { } }
double [ ] result = new double [ data . length ] ; double sum ; double scale = Math . sqrt ( 2.0 / data . length ) ; for ( int f = 0 ; f < data . length ; f ++ ) { sum = 0 ; for ( int t = 0 ; t < data . length ; t ++ ) { double cos = Math . cos ( ( ( 2.0 * t + 1.0 ) * f * Math . PI ) / ( 2.0 * data . length ) ) ; sum +...
public class CmsPreferences { /** * Sets the " workplace search result style " . < p > * @ param style the " workplace search result style " to set */ public void setParamTabExWorkplaceSearchResult ( String style ) { } }
if ( style == null ) { style = OpenCms . getWorkplaceManager ( ) . getDefaultUserSettings ( ) . getWorkplaceSearchViewStyle ( ) . getMode ( ) ; } m_userSettings . setWorkplaceSearchViewStyle ( CmsSearchResultStyle . valueOf ( style ) ) ;
public class AttributeProxy { public static void main ( String args [ ] ) { } }
String deviceName = "tango/admin/corvus/hoststate" ; try { AttributeProxy att = new AttributeProxy ( deviceName ) ; att . ping ( ) ; System . out . println ( att . name ( ) + " is alive" ) ; DbAttribute db_att = att . get_property ( ) ; for ( int i = 0 ; i < db_att . size ( ) ; i ++ ) { DbDatum datum = db_att . datum (...
public class SerializationUtil { /** * Writes a map to given { @ code ObjectDataOutput } . * @ param map the map to serialize , can be { @ code null } * @ param out the output to write the map to */ public static < K , V > void writeNullableMap ( Map < K , V > map , ObjectDataOutput out ) throws IOException { } }
// write true when the map is NOT null out . writeBoolean ( map != null ) ; if ( map == null ) { return ; } writeMap ( map , out ) ;
public class HessianProxyFactory { /** * Creates a new proxy with the specified URL . The returned object * is a proxy with the interface specified by api . * < pre > * String url = " http : / / localhost : 8080 / ejb / hello " ) ; * HelloHome hello = ( HelloHome ) factory . create ( HelloHome . class , url ) ;...
return create ( api , urlName , _loader ) ;
public class ClassLoaderHelper { /** * Get all URLs of the passed resource using the specified class loader only . * This is a sanity wrapper around * < code > classLoader . getResources ( sPath ) < / code > . * @ param aClassLoader * The class loader to be used . May not be < code > null < / code > . * @ par...
ValueEnforcer . notNull ( aClassLoader , "ClassLoader" ) ; ValueEnforcer . notEmpty ( sPath , "Path" ) ; // Ensure the path does NOT starts with a " / " final String sPathWithoutSlash = _getPathWithoutLeadingSlash ( sPath ) ; // returns null if not found return aClassLoader . getResources ( sPathWithoutSlash ) ;
public class Ray { /** * Sets this Ray from the given start and end points . * @ param start the starting point of this ray * @ param end the starting point of this ray * @ return this ray for chaining . */ public Ray < T > set ( T start , T end ) { } }
this . start . set ( start ) ; this . end . set ( end ) ; return this ;
public class JSONAssert { /** * Asserts that the JSONObject provided matches the expected JSONObject . If it isn ' t it throws an * { @ link AssertionError } . * @ param message Error message to be displayed in case of assertion failure * @ param expected Expected JSONObject * @ param actual JSONObject to compa...
JSONCompareResult result = JSONCompare . compareJSON ( expected , actual , compareMode ) ; if ( result . failed ( ) ) { throw new AssertionError ( getCombinedMessage ( message , result . getMessage ( ) ) ) ; }
public class CmsAvailabilityDialog { /** * Performs the notification operations on a single resource . < p > * @ param cms the CMS context * @ param resName the VFS path of the resource * @ param enableNotification if the notification is activated * @ param notificationInterval the notification interval in days...
List < CmsResource > resources = new ArrayList < CmsResource > ( ) ; if ( modifySiblings ) { // modify all siblings of a resource resources = cms . readSiblings ( resName , CmsResourceFilter . IGNORE_EXPIRATION ) ; } else { // modify only resource without siblings resources . add ( cms . readResource ( resName , CmsRes...
public class LinkPubSubTransmitMessageControl { /** * / * ( non - Javadoc ) * @ see com . ibm . ws . sib . processor . runtime . LinkTransmitMessageControl # getTargetBus ( ) */ public String getTargetBus ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "getTargetBus" ) ; String bus = null ; if ( parent instanceof LinkPublicationPointControl ) { LinkPublicationPointControl lppc = ( LinkPublicationPointControl ) parent ; bus = lppc . getTargetBusName ( ) ; } else { // parent...
public class NumericRangeValueExpression { /** * / * ( non - Javadoc ) * @ see com . github . mkolisnyk . aerial . expressions . ValueExpression # validate ( ) */ @ Override public void validate ( ) throws Exception { } }
super . validate ( ) ; this . parse ( ) ; Assert . assertTrue ( String . format ( "Lower bound %d should be less than upper bound %d" , lower , upper ) , lower <= upper ) ; Assert . assertFalse ( "The range is empty" , ! this . includeLower && ! this . includeUpper && ( this . upper - this . lower ) <= 1 ) ; Assert . a...
public class AdminDictMappingAction { private static OptionalEntity < CharMappingItem > getEntity ( final CreateForm form ) { } }
switch ( form . crudMode ) { case CrudMode . CREATE : final CharMappingItem entity = new CharMappingItem ( 0 , StringUtil . EMPTY_STRINGS , StringUtil . EMPTY ) ; return OptionalEntity . of ( entity ) ; case CrudMode . EDIT : if ( form instanceof EditForm ) { return ComponentUtil . getComponent ( CharMappingService . c...
public class Jdk8DateConverter { /** * 通过反射从字符串转java . time中的对象 * @ param value 字符串值 * @ return 日期对象 */ private Object parseFromCharSequence ( CharSequence value ) { } }
Method method ; if ( null != this . format ) { final Object dateTimeFormatter = getDateTimeFormatter ( ) ; method = ReflectUtil . getMethod ( this . targetType , "parse" , CharSequence . class , dateTimeFormatter . getClass ( ) ) ; return ReflectUtil . invokeStatic ( method , value , dateTimeFormatter ) ; } else { meth...
public class Sets { /** * Returns a set backed by the specified map . The resulting set displays * the same ordering , concurrency , and performance characteristics as the * backing map . In essence , this factory method provides a { @ link Set } * implementation corresponding to any { @ link Map } implementation...
return Platform . newSetFromMap ( map ) ;
public class StreamingBaseHtmlProvider { /** * Get a FedoraResource for the subject of the graph , if it exists . * @ param subjectUri the uri of the subject * @ return FedoraResource if exists or null */ private FedoraResource getResourceFromSubject ( final String subjectUri ) { } }
final UriTemplate uriTemplate = new UriTemplate ( uriInfo . getBaseUriBuilder ( ) . clone ( ) . path ( FedoraLdp . class ) . toTemplate ( ) ) ; final Map < String , String > values = new HashMap < > ( ) ; uriTemplate . match ( subjectUri , values ) ; if ( values . containsKey ( "path" ) ) { try { return translator ( ) ...
public class ContinuousDistributions { /** * Samples from Multinomial Normal Distribution . * @ param mean * @ param covariance * @ return A multinomialGaussianSample from the Multinomial Normal Distribution */ public static double [ ] multinomialGaussianSample ( double [ ] mean , double [ ] [ ] covariance ) { } ...
MultivariateNormalDistribution gaussian = new MultivariateNormalDistribution ( mean , covariance ) ; gaussian . reseedRandomGenerator ( RandomGenerator . getThreadLocalRandom ( ) . nextLong ( ) ) ; return gaussian . sample ( ) ;
public class Classes { /** * Do the actual reflexive method invocation . * @ param object object instance , * @ param method reflexive method , * @ param arguments variable number of arguments . * @ return value returned by method execution . * @ throws Exception if invocation fail for whatever reason includi...
Throwable cause = null ; try { method . setAccessible ( true ) ; return method . invoke ( object instanceof Class < ? > ? null : object , arguments ) ; } catch ( IllegalAccessException e ) { throw new BugError ( e ) ; } catch ( InvocationTargetException e ) { cause = e . getCause ( ) ; if ( cause instanceof Exception )...
public class GeometryExpression { /** * TODO maybe move out */ public NumberExpression < Double > distanceSphere ( Expression < ? extends Geometry > geometry ) { } }
return Expressions . numberOperation ( Double . class , SpatialOps . DISTANCE_SPHERE , mixin , geometry ) ;
public class CamelRouteActionBuilder { /** * Execute control bus Camel operations . * @ return */ public CamelControlBusActionBuilder controlBus ( ) { } }
CamelControlBusAction camelControlBusAction = new CamelControlBusAction ( ) ; camelControlBusAction . setCamelContext ( getCamelContext ( ) ) ; action . setDelegate ( camelControlBusAction ) ; return new CamelControlBusActionBuilder ( camelControlBusAction ) ;
public class RingBuffer { /** * Allows one user supplied argument . * @ param translator The user specified translation for each event * @ param batchStartsAt The first element of the array which is within the batch . * @ param batchSize The actual size of the batch * @ param arg0 An array of user supplied argu...
checkBounds ( arg0 , batchStartsAt , batchSize ) ; try { final long finalSequence = sequencer . tryNext ( batchSize ) ; translateAndPublishBatch ( translator , arg0 , batchStartsAt , batchSize , finalSequence ) ; return true ; } catch ( InsufficientCapacityException e ) { return false ; }