signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class CachingMappingDiscoverer { /** * ( non - Javadoc ) * @ see org . springframework . hateoas . core . MappingDiscoverer # getRequestMethod ( java . lang . Class , java . lang . reflect . Method ) */ @ Override public Collection < HttpMethod > getRequestMethod ( Class < ? > type , Method method ) { } }
return METHODS . computeIfAbsent ( key ( type , method ) , __ -> delegate . getRequestMethod ( type , method ) ) ;
public class FctBnCnvIbnToColumnValues { /** * < p > Get CnvIbnVersionToCv ( create and put into map ) . < / p > * @ return requested CnvIbnVersionToCv * @ throws Exception - an exception */ protected final CnvIbnVersionToCv createPutCnvIbnVersionToCv ( ) throws Exception { } }
CnvIbnVersionToCv convrt = new CnvIbnVersionToCv ( ) ; this . convertersMap . put ( CnvIbnVersionToCv . class . getSimpleName ( ) , convrt ) ; return convrt ;
public class LanguageProfileBuilder { /** * If the builder already has this ngram , the given frequency is added to the current count . */ public LanguageProfileBuilder addGram ( String ngram , int frequency ) { } }
Map < String , Integer > map = ngrams . get ( ngram . length ( ) ) ; if ( map == null ) { map = new HashMap < > ( ) ; ngrams . put ( ngram . length ( ) , map ) ; } Integer total = map . get ( ngram ) ; if ( total == null ) total = 0 ; total += frequency ; map . put ( ngram , total ) ; return this ;
public class JSONParser { /** * Parses and returns Integer , Long or Double type . * < pre > * Number ← Minus ? IntegralPart FractionalPart ? ExponentPart ? * Minus ← " - " * IntegralPart ← " 0 " / [ 1-9 ] [ 0-9 ] * * FractionalPart ← " . " [ 0-9 ] + * ExponentPart ← ( " e " / " E " ) ( " + " / " - " ) ? [ ...
final int startIdx = getPosition ( ) ; if ( peekMatches ( "Infinity" ) ) { advance ( 8 ) ; return Double . POSITIVE_INFINITY ; } else if ( peekMatches ( "-Infinity" ) ) { advance ( 9 ) ; return Double . NEGATIVE_INFINITY ; } else if ( peekMatches ( "NaN" ) ) { advance ( 3 ) ; return Double . NaN ; } if ( peek ( ) == '-...
public class FrameAndRootPainter { /** * Create the gradient to paint the frame interior . * @ param s the interior shape . * @ param titleHeight the height of the title bar , or 0 if none . * @ param defColors the color set to construct the gradient from . * @ return the gradient . */ private Paint createTitle...
Rectangle2D bounds = s . getBounds2D ( ) ; float midX = ( float ) bounds . getCenterX ( ) ; float y = ( float ) bounds . getY ( ) ; float h = ( float ) bounds . getHeight ( ) ; return createGradient ( midX , y , midX , y + h , new float [ ] { 0.0f , 1.0f } , new Color [ ] { defColors . top , defColors . upperMid } ) ;
public class CmsXmlHtmlValue { /** * JTidy sometimes erroneouslsy produces HTML containing ' null ' characters ( Unicode code point 0 ) , which are * invalid in an XML document . Until we find a way to prevent JTidy doing that , we remove the null characters * from the HTML , and log a warning . < p > * @ param j...
String outputWithoutNullChars = jtidyOutput . replaceAll ( "\u0000" , "" ) ; if ( jtidyOutput . length ( ) != outputWithoutNullChars . length ( ) ) { String context = "" ; if ( m_document . getFile ( ) != null ) { context = "(file=" + m_document . getFile ( ) . getRootPath ( ) + ")" ; } LOG . warn ( "HTML cleanup produ...
public class ZoomableGraphicsContext { /** * Adds path elements to the current path to make a rectangle . * The coordinates are transformed by the current transform as they are * added to the path and unaffected by subsequent changes to the transform . * The current path is a path attribute * used for any of th...
this . gc . rect ( doc2fxX ( x ) , doc2fxY ( y ) , doc2fxSize ( width ) , doc2fxSize ( height ) ) ;
public class TypeDefinitionMap { /** * note : special case takes into account that only one modifier is present on each type modifier vertex */ public void isValidTypeModifierDefinition ( Set < TypeDefinitionCategory > legalTypes ) { } }
Preconditions . checkArgument ( 1 == this . size ( ) , "exactly one type modifier is expected" ) ; for ( TypeDefinitionCategory type : this . keySet ( ) ) { Preconditions . checkArgument ( legalTypes . contains ( type ) , "%s not legal here" ) ; }
public class ClassInspector { /** * TODO : breadth first depth first . I guess depth first because of raw type rule selecting first bound . */ private static void addSuperAndInterfaces ( Set < Class < ? > > classes , Class < ? > clazz ) { } }
if ( clazz != null ) { classes . add ( clazz ) ; addSuperAndInterfaces ( classes , clazz . getSuperclass ( ) ) ; for ( Class < ? > aClass : clazz . getInterfaces ( ) ) { addSuperAndInterfaces ( classes , aClass ) ; } }
public class CmsUploadDialogFormDataImpl { /** * Returns the content length . < p > * @ return the content length */ protected long calculateContentLength ( ) { } }
int result = 0 ; for ( CmsFileInfo file : getFilesToUpload ( ) . values ( ) ) { result += file . getFileSize ( ) ; } return new Long ( result ) . longValue ( ) ;
public class ClassNodeUtils { /** * Add a method that is marked as @ Generated . * @ see ClassNode # addConstructor ( ConstructorNode ) */ public static void addGeneratedConstructor ( ClassNode classNode , ConstructorNode consNode ) { } }
classNode . addConstructor ( consNode ) ; markAsGenerated ( classNode , consNode ) ;
public class Gradient { /** * Mutate the gradient . * @ param amount the amount in the range zero to one */ public void mutate ( float amount ) { } }
for ( int i = 0 ; i < numKnots ; i ++ ) { int rgb = yKnots [ i ] ; int r = ( ( rgb >> 16 ) & 0xff ) ; int g = ( ( rgb >> 8 ) & 0xff ) ; int b = ( rgb & 0xff ) ; r = PixelUtils . clamp ( ( int ) ( r + amount * 255 * ( Math . random ( ) - 0.5 ) ) ) ; g = PixelUtils . clamp ( ( int ) ( g + amount * 255 * ( Math . random (...
public class SecurityUtils { /** * Check if a user can modify an object . If there ' s no user principal found , this returns true . * @ param app app in context * @ param object some object * @ return true if user is the owner / creator of the object . */ public static boolean checkIfUserCanModifyObject ( App ap...
User user = SecurityUtils . getAuthenticatedUser ( ) ; if ( user != null && app != null && object != null ) { if ( app . permissionsContainOwnKeyword ( user , object ) ) { return user . canModify ( object ) ; } } return true ; // skip
public class Whitebox { /** * Get all fields annotated with a particular annotation . This method * traverses the class hierarchy when checking for the annotation . * @ param object * The object to look for annotations . Note that if ' re you ' re * passing an object only instance fields are checked , passing a...
return WhiteboxImpl . getFieldsAnnotatedWith ( object , annotation , additionalAnnotations ) ;
public class MinorCompactionTask { /** * Compacts entries from the given segment , rewriting them to the compact segment . * @ param segment The segment to compact . * @ param compactSegment The compact segment . */ private void compactEntries ( Segment segment , Segment compactSegment ) { } }
for ( long i = segment . firstIndex ( ) ; i <= segment . lastIndex ( ) ; i ++ ) { checkEntry ( i , segment , compactSegment ) ; }
public class PriorityUtils { /** * Sort classes by < strong > descending < / strong > order of their priority , meaning the class with * the higher priority will * be the first element of the sorted list . The priority is determined according to the * provided priority extractor . * @ param someClasses the list...
someClasses . sort ( Collections . reverseOrder ( Comparator . comparingInt ( priorityExtractor ) ) ) ;
public class ProcessDefinitionDeployerImpl { /** * remove bundle protocol specific part , so that resource can be accessed by * path relative to bundle root */ private String getPath ( URL url ) { } }
String path = url . toExternalForm ( ) ; return path . replaceAll ( "bundle://[^/]*/" , "" ) ;
public class HttpHeaderOperation { /** * Parse { @ code Range } header field value . * Only { @ code bytes } unit is supported . * @ param rangeValue { @ code Range } header field value . * @ return an array of long [ 2 ] , or { @ code null } if invalid . */ public static long [ ] [ ] parseRanges ( String rangeVa...
if ( ! rangeValue . startsWith ( "bytes=" ) ) return null ; int s = "bytes=" . length ( ) ; int pcomma = rangeValue . indexOf ( ',' , s ) ; if ( pcomma < 0 ) { long [ ] range = parseRange ( rangeValue . substring ( s ) ) ; return range != null ? new long [ ] [ ] { range } : null ; } int e = rangeValue . length ( ) ; Li...
public class TargetTable { /** * Toggles { @ link TargetTag } assignment to given target ids by means that if * some ( or all ) of the targets in the list have the { @ link Tag } not yet * assigned , they will be . If all of theme have the tag already assigned * they will be removed instead . Additionally a succe...
final List < String > controllerIds = targetManagement . get ( targetIds ) . stream ( ) . map ( Target :: getControllerId ) . collect ( Collectors . toList ( ) ) ; if ( controllerIds . isEmpty ( ) ) { getNotification ( ) . displayWarning ( getI18n ( ) . getMessage ( "targets.not.exists" ) ) ; return new TargetTagAssign...
public class BufferUtils { /** * Reads an unsigned Medium Int from the in buffer * @ param in * Source * @ return int Integer value */ public static int readUnsignedMediumInt ( IoBuffer in ) { } }
byte [ ] bytes = new byte [ 3 ] ; in . get ( bytes ) ; int val = 0 ; val += ( bytes [ 0 ] & 0xFF ) * 256 * 256 ; val += ( bytes [ 1 ] & 0xFF ) * 256 ; val += ( bytes [ 2 ] & 0xFF ) ; return val ;
public class Strman { /** * Transform to StudlyCaps . * @ param value The input String * @ return String in StudlyCaps . */ public static String toStudlyCase ( final String value ) { } }
validate ( value , NULL_STRING_PREDICATE , NULL_STRING_MSG_SUPPLIER ) ; String [ ] words = collapseWhitespace ( value . trim ( ) ) . split ( "\\s*(_|-|\\s)\\s*" ) ; return Arrays . stream ( words ) . filter ( w -> ! w . trim ( ) . isEmpty ( ) ) . map ( Strman :: upperFirst ) . collect ( joining ( ) ) ;
public class ApnsSigningKey { /** * Loads a signing key from the given PKCS # 8 file . * @ param pkcs8File the file from which to load the key * @ param teamId the ten - character , Apple - issued identifier for the team to which the key belongs * @ param keyId the ten - character , Apple - issued identitifier fo...
try ( final FileInputStream fileInputStream = new FileInputStream ( pkcs8File ) ) { return ApnsSigningKey . loadFromInputStream ( fileInputStream , teamId , keyId ) ; }
public class Gauge { /** * Defines the value that represents the space between major * tickmarks . This value will be automatically set by the * autoscale property . Be careful when changing it manually . * @ param SPACE */ public void setMinorTickSpace ( final double SPACE ) { } }
if ( null == minorTickSpace ) { _minorTickSpace = SPACE ; fireUpdateEvent ( RECALC_EVENT ) ; } else { minorTickSpace . set ( SPACE ) ; }
public class TagletWriterImpl { /** * { @ inheritDoc } */ public Content commentTagsToOutput ( Tag holderTag , Tag [ ] tags ) { } }
return commentTagsToOutput ( holderTag , null , tags , false ) ;
public class RCD { /** * Searches for the classifier best suited for actual data . All statistical * tests are performed in parallel . * @ param classifier Classifier to be added * @ param instances Instances used to build the classifier * @ return */ private ClassifierKS getPreviousClassifier ( Classifier clas...
ExecutorService threadPool = Executors . newFixedThreadPool ( this . threadSizeOption . getValue ( ) ) ; int SIZE = this . classifiers . size ( ) ; Map < Integer , Future < Double > > futures = new HashMap < > ( ) ; for ( int i = 0 ; i < SIZE ; i ++ ) { ClassifierKS cs = this . classifiers . get ( i ) ; if ( cs != null...
public class RestService { /** * Closes the Netty Channel and releases all resources */ @ Override protected void stopInner ( ) { } }
/* * TODO REST - Server Need to handle inflight operations . What happens to * the existing async operations when a channel . close ( ) is issued in * Netty ? */ if ( this . nettyServerChannel != null ) { this . nettyServerChannel . close ( ) ; } if ( allChannels != null ) { allChannels . close ( ) . awaitUninterru...
public class HiveMetaStoreEventHelper { /** * Alter Table */ protected static void submitSuccessfulTableAlter ( EventSubmitter eventSubmitter , HiveTable table ) { } }
eventSubmitter . submit ( TABLE_ALTER + SUCCESS_POSTFIX , getAdditionalMetadata ( table , Optional . < HivePartition > absent ( ) , Optional . < Exception > absent ( ) ) ) ;
public class MountTable { /** * Unmounts the given Alluxio path . The path should match an existing mount point . * @ param journalContext journal context * @ param uri an Alluxio path URI * @ return whether the operation succeeded or not */ public boolean delete ( Supplier < JournalContext > journalContext , All...
String path = uri . getPath ( ) ; LOG . info ( "Unmounting {}" , path ) ; if ( path . equals ( ROOT ) ) { LOG . warn ( "Cannot unmount the root mount point." ) ; return false ; } try ( LockResource r = new LockResource ( mWriteLock ) ) { if ( mState . getMountTable ( ) . containsKey ( path ) ) { // check if the path co...
public class SARLCodeMiningProvider { /** * Replies the inferred type for the given expression . * @ param expr the expression . * @ return the type of the expression . */ protected LightweightTypeReference getLightweightType ( XExpression expr ) { } }
final IResolvedTypes resolvedTypes = getResolvedTypes ( expr ) ; final LightweightTypeReference expressionType = resolvedTypes . getActualType ( expr ) ; if ( expr instanceof AnonymousClass ) { final List < LightweightTypeReference > superTypes = expressionType . getSuperTypes ( ) ; if ( superTypes . size ( ) == 1 ) { ...
public class Chart { /** * calls { @ link ChartBuilder # ChartBuilder ( com . vectorprint . report . jfree . ChartBuilder . CHARTTYPE , org . jfree . data . general . Dataset , java . lang . String , java . lang . String , java . lang . String , com . vectorprint . report . jfree . ChartThemeBuilder , com . vectorprint...
ChartBuilder cb = new ChartBuilder ( getType ( ) , data , getTitle ( ) , getTitle ( ) , getValLabel ( ) , isVertical ( ) , isLegend ( ) , getValue ( THEMEBUILDER , ChartThemeBuilder . class ) , getSettings ( ) ) ; Image img = ItextChartHelper . getChartImage ( cb . getChart ( ) , canvas , getWidth ( ) , getHeight ( ) ,...
public class PropertyRequest { /** * Add another property to the list of requested properties . * @ param property * The property to request from the server . * @ return This instance . */ public PropertyRequest addProperty ( ElementDescriptor < ? > property ) { } }
if ( mProp == null ) { mProp = new HashMap < ElementDescriptor < ? > , Object > ( 16 ) ; } mProp . put ( property , null ) ; return this ;
public class CassQuery { /** * On condition . * @ param m * the m * @ param metaModel * the meta model * @ param keyObj * the compound key * @ param idColumn * the id column * @ param builder * the builder * @ param isPresent * the is present * @ param translator * the translator * @ param...
String partitionKey = null ; boolean allowFiltering = false ; for ( Object o : getKunderaQuery ( ) . getFilterClauseQueue ( ) ) { if ( o instanceof FilterClause ) { FilterClause clause = ( ( FilterClause ) o ) ; String fieldName = clause . getProperty ( ) ; String condition = clause . getCondition ( ) ; List < Object >...
public class SQLException { /** * Returns an iterator over the chained SQLExceptions . The iterator will * be used to iterate over each SQLException and its underlying cause * ( if any ) . * @ return an iterator over the chained SQLExceptions and causes in the proper * order * @ since 1.6 */ public Iterator <...
return new Iterator < Throwable > ( ) { SQLException firstException = SQLException . this ; SQLException nextException = firstException . getNextException ( ) ; Throwable cause = firstException . getCause ( ) ; public boolean hasNext ( ) { if ( firstException != null || nextException != null || cause != null ) return t...
public class ExpressionEvaluator { /** * Expression evaluator for isIRI ( ) and isURI ( ) function */ private Term evalIsIri ( Function term ) { } }
Term teval = eval ( term . getTerm ( 0 ) ) ; if ( teval instanceof Function ) { Function function = ( Function ) teval ; Predicate predicate = function . getFunctionSymbol ( ) ; return termFactory . getBooleanConstant ( predicate instanceof URITemplatePredicate ) ; } return term ;
public class DocumentLine { /** * indexed setter for beginnings - sets an indexed value - * @ generated * @ param i index in the array to set * @ param v value to set into the array */ public void setBeginnings ( int i , float v ) { } }
if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_beginnings == null ) jcasType . jcas . throwFeatMissing ( "beginnings" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casF...
public class FessMessages { /** * Add the created action message for the key ' errors . crud _ failed _ to _ delete _ crud _ table ' with parameters . * < pre > * message : Failed to delete the data . ( { 0 } ) * < / pre > * @ param property The property name for the message . ( NotNull ) * @ param arg0 The p...
assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_crud_failed_to_delete_crud_table , arg0 ) ) ; return this ;
public class CmsSearchManager { /** * Returns an analyzer for the given class name . < p > * @ param className the class name of the analyzer * @ return the appropriate lucene analyzer * @ throws Exception if something goes wrong */ public static Analyzer getAnalyzer ( String className ) throws Exception { } }
Analyzer analyzer = null ; Class < ? > analyzerClass ; try { analyzerClass = Class . forName ( className ) ; } catch ( ClassNotFoundException e ) { // allow Lucene standard classes to be written in a short form analyzerClass = Class . forName ( LUCENE_ANALYZER + className ) ; } // since Lucene 3.0 most analyzers need a...
public class HttpInboundServiceContextImpl { /** * Skip whitespace found in the input data starting at the given index . It * will return an index value that points to the first non - space byte found * or end of data if it ran out . * @ param data * @ param start * @ return int */ private int skipWhiteSpace ...
int index = start ; while ( index < data . length && ( ' ' == data [ index ] || '\t' == data [ index ] ) ) { index ++ ; } return index ;
public class TitlePaneIconifyButtonPainter { /** * Paint the foreground minimized button enabled state . * @ param g the Graphics2D context to paint with . * @ param c the component . * @ param width the width of the component . * @ param height the height of the component . */ private void paintMinimizeEnabled...
iconifyPainter . paintEnabled ( g , c , width , height ) ;
public class SpringBeanProxyTargetLocator { /** * { @ inheritDoc } */ @ Override protected BeanReactor < ApplicationContext > createStrategy ( ) { } }
if ( getBeanName ( ) . isEmpty ( ) ) { return new AbstractProxyTargetLocator . BeanReactor < ApplicationContext > ( ) { public boolean containsBean ( ApplicationContext applicationContext ) { try { applicationContext . getBean ( beanType ) ; } catch ( NoSuchBeanDefinitionException e ) { return false ; } return true ; }...
public class Sql { /** * Useful helper method which handles resource management when executing a * query which returns a result set . * Derived classes of Sql can override " createQueryCommand " and then call * this method to access the ResultSet returned from the provided query * or alternatively can use the h...
AbstractQueryCommand command = createQueryCommand ( sql ) ; ResultSet rs = null ; try { rs = command . execute ( ) ; } finally { command . closeResources ( ) ; } return rs ;
public class PropertyMappingPanel { /** * GEN - LAST : event _ lstPropertiesMouseReleased */ private void lstPropertiesKeyPressed ( java . awt . event . KeyEvent evt ) { } }
// GEN - FIRST : event _ lstPropertiesKeyPressed int code = evt . getKeyCode ( ) ; if ( code == KeyEvent . VK_DELETE ) { deleteMappingItem ( ) ; }
public class Iobeam { /** * ( Re - ) initializes the iobeam client . * @ param path Directory where the device ID file , iobeam - device - id , should be written . * If null , the device ID is < b > not < / b > persisted . * @ param projectId The numeric project ID to associate with . * @ param projectToken The...
this . path = path ; this . projectId = projectId ; this . projectToken = projectToken ; if ( deviceId == null && path != null ) { deviceId = localDeviceIdCheck ( ) ; } setDeviceId ( deviceId ) ; client = new RestClient ( backendUrl , Executors . newSingleThreadExecutor ( ) ) ; File dir = path != null ? new File ( path...
public class CharacterJsonDeserializer { /** * { @ inheritDoc } */ @ Override public Character doDeserialize ( JsonReader reader , JsonDeserializationContext ctx , JsonDeserializerParameters params ) { } }
if ( JsonToken . NUMBER . equals ( reader . peek ( ) ) ) { return ( char ) reader . nextInt ( ) ; } else { String value = reader . nextString ( ) ; if ( value . isEmpty ( ) ) { return null ; } return value . charAt ( 0 ) ; }
public class DefaultAgenda { /** * ( non - Javadoc ) * @ see org . kie . common . AgendaI # agendaSize ( ) */ public int agendaSize ( ) { } }
int size = 0 ; for ( InternalAgendaGroup internalAgendaGroup : this . agendaGroups . values ( ) ) { size += internalAgendaGroup . size ( ) ; } return size ;
public class VaadinConfirmDialog { /** * Show confirm dialog . * @ param ui the UI in which the dialog should be shown * @ param listener the listener to be notified * @ param modal true if the dialog should be modal */ public final void show ( final UI ui , final Listener listener , final boolean modal ) { } }
confirmListener = listener ; center ( ) ; setModal ( modal ) ; ui . addWindow ( this ) ;
public class NotebookInstanceLifecycleHookMarshaller { /** * Marshall the given parameter object . */ public void marshall ( NotebookInstanceLifecycleHook notebookInstanceLifecycleHook , ProtocolMarshaller protocolMarshaller ) { } }
if ( notebookInstanceLifecycleHook == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( notebookInstanceLifecycleHook . getContent ( ) , CONTENT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request t...
public class ClassFactory { /** * Constructs type via static method fromString ( String value ) or valueOf ( String value ) * @ param type to be constructed * @ param fromValue value to take * @ param < T > class type * @ return Object of type or null if failed to construct */ static < T > Pair < Boolean , T > ...
// Try to usse fromString before valueOf ( enums have valueOf already defined ) - in case we override fromString ( ) List < Method > methods = getMethods ( type , "fromString" , "valueOf" ) ; if ( methods != null && methods . size ( ) > 0 ) { for ( Method method : methods ) { try { Object value = method . invoke ( null...
public class WRadioButtonSelectExample { /** * Examples of disabled state . You should use { @ link WSubordinateControl } to set and manage the disabled state * unless there is no facility for the user to enable a control . * If you want to prevent the user enabling and interacting with a WRadioButtonSeelct then yo...
add ( new WHeading ( HeadingLevel . H2 , "Disabled WRadioButtonSelect examples" ) ) ; WFieldLayout layout = new WFieldLayout ( ) ; add ( layout ) ; WRadioButtonSelect select = new WRadioButtonSelect ( "australian_state" ) ; select . setDisabled ( true ) ; layout . addField ( "Disabled with no selection" , select ) ; se...
public class Registry { /** * Get the value node at the end of this name / value chain . * @ param header The message header that contains the name / value tree . * @ oaram bAddIfNotFound Add the value if it is not found . * @ return The node at the end of the name / value tree . */ public NameValue getNameValueL...
Object [ ] [ ] mxString = header . getNameValueTree ( ) ; NameValue node = this ; if ( mxString != null ) { for ( int i = 0 ; i < mxString . length ; i ++ ) { node = node . getNameValueNode ( ( String ) mxString [ i ] [ MessageConstants . NAME ] , mxString [ i ] [ MessageConstants . VALUE ] , bAddIfNotFound ) ; if ( no...
public class IOUtils { /** * converts input stream to string value * @ param is * @ return * @ throws IOException */ public static String getInputStreamAsString ( InputStream is ) throws IOException { } }
ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; ReadableByteChannel rbch = Channels . newChannel ( is ) ; WritableByteChannel wbch = Channels . newChannel ( baos ) ; fastChannelCopy ( rbch , wbch ) ; rbch . close ( ) ; wbch . close ( ) ; return new String ( baos . toByteArray ( ) , Charset . forName ( "UTF...
public class FineUploaderBasic { /** * These parameters are sent with the request to the endpoint specified in the * action option . * @ param aParams * New parameters to be added . * @ return this */ @ Nonnull public FineUploaderBasic addParams ( @ Nullable final Map < String , String > aParams ) { } }
m_aRequestParams . addAll ( aParams ) ; return this ;
public class StringUtils { /** * 按逗号或者分号分隔的数组 , 排除空字符 < br > * 例如 " 1,2 , , 3 , " 返回 [ 1,2,3 ] 3个值 < br > * " 1;2 ; ; 3 ; " 返回 [ 1,2,3 ] 3个值 < br > * @ param src 原始值 * @ return 字符串数组 */ public static String [ ] splitWithCommaOrSemicolon ( String src ) { } }
if ( isEmpty ( src ) ) { return StringUtils . EMPTY_STRING_ARRAY ; } String [ ] ss = split ( src . replace ( ',' , ';' ) , ";" ) ; List < String > list = new ArrayList < String > ( ) ; for ( String s : ss ) { if ( ! isBlank ( s ) ) { list . add ( s . trim ( ) ) ; } } return list . toArray ( new String [ list . size ( )...
public class UIComponent { /** * Gets the { @ link UIComponent } at the specified coordinates . < br > * Will return a { @ link IControlComponent } if any . Checks if inside bounds , visible and not disabled . * @ param x the x * @ param y the y * @ return this { @ link UIComponent } or null if outside its boun...
// control components take precedence over regular components for ( IControlComponent c : controlComponents ) { UIComponent component = c . getComponentAt ( x , y ) ; if ( component != null ) return component ; } return isInsideBounds ( x , y ) ? this : null ;
public class Gaussian { /** * 2 - D Gaussian kernel . * @ param size Kernel size ( should be odd ) , [ 3 , 101 ] . * @ return Returns 2 - D Gaussian kernel of specified size . */ public double [ ] [ ] Kernel2D ( int size ) { } }
if ( ( ( size % 2 ) == 0 ) || ( size < 3 ) || ( size > 101 ) ) { try { throw new Exception ( "Wrong size" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } int r = size / 2 ; double [ ] [ ] kernel = new double [ size ] [ size ] ; // compute kernel double sum = 0 ; for ( int y = - r , i = 0 ; i < size ; y ++ ,...
public class CircuitsExtractorImpl { /** * Get map tile circuits . * @ param map The map reference . * @ return The circuits found with their associated tiles . */ private static Map < Circuit , Collection < TileRef > > getCircuits ( MapTile map ) { } }
final MapTileGroup mapGroup = map . getFeature ( MapTileGroup . class ) ; final Map < Circuit , Collection < TileRef > > circuits = new HashMap < > ( ) ; final MapCircuitExtractor extractor = new MapCircuitExtractor ( map ) ; for ( int ty = 1 ; ty < map . getInTileHeight ( ) - 1 ; ty ++ ) { for ( int tx = 1 ; tx < map ...
public class TargetVpnGatewayClient { /** * Creates a target VPN gateway in the specified project and region using the data included in the * request . * < p > Sample code : * < pre > < code > * try ( TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient . create ( ) ) { * ProjectRegionName r...
InsertTargetVpnGatewayHttpRequest request = InsertTargetVpnGatewayHttpRequest . newBuilder ( ) . setRegion ( region == null ? null : region . toString ( ) ) . setTargetVpnGatewayResource ( targetVpnGatewayResource ) . build ( ) ; return insertTargetVpnGateway ( request ) ;
public class AWSElasticBeanstalkClient { /** * Deletes and recreates all of the AWS resources ( for example : the Auto Scaling group , load balancer , etc . ) for a * specified environment and forces a restart . * @ param rebuildEnvironmentRequest * @ return Result of the RebuildEnvironment operation returned by ...
request = beforeClientExecution ( request ) ; return executeRebuildEnvironment ( request ) ;
public class KieServicesFactory { /** * Creates a new configuration object for JMS based service * @ param connectionFactory a JMS connection factory * @ param requestQueue a reference to the requests queue * @ param responseQueue a reference to the responses queue * @ return configuration instance */ public st...
return new KieServicesConfigurationImpl ( connectionFactory , requestQueue , responseQueue ) ;
public class Base64Utils { /** * Decode a base64 string into a long value . */ public static long longFromBase64 ( String value ) { } }
int pos = 0 ; long longVal = base64Values [ value . charAt ( pos ++ ) ] ; int len = value . length ( ) ; while ( pos < len ) { longVal <<= 6 ; longVal |= base64Values [ value . charAt ( pos ++ ) ] ; } return longVal ;
public class Checksum { /** * Calculates the SH256 checksum of a specified file . * @ param file the file to generate the MD5 checksum * @ return the hex representation of the SHA1 hash * @ throws java . io . IOException when the file passed in does not exist * @ throws java . security . NoSuchAlgorithmExceptio...
final byte [ ] b = getChecksum ( SHA256 , file ) ; return getHex ( b ) ;
public class AcpService { /** * 多密钥验签 ( 通过传入密钥签名 ) < br > * @ param resData 返回报文数据 < br > * @ param encoding 上送请求报文域encoding字段的值 < br > * @ return true 通过 false 未通过 < br > */ public static boolean validateBySecureKey ( Map < String , String > rspData , String secureKey , String encoding ) { } }
return SDKUtil . validateBySecureKey ( rspData , secureKey , encoding ) ;
public class Bootstrapper { /** * Command - line invocation . * @ param argscommand - line arguments specifying the configuration and REST server * @ throws IOException if a communication error occurs */ public static void main ( String [ ] args ) throws IOException { } }
Properties properties = new Properties ( ) ; for ( int i = 0 ; i < args . length ; i ++ ) { String name = args [ i ] ; if ( name . startsWith ( "-" ) && name . length ( ) > 1 && ++ i < args . length ) { name = name . substring ( 1 ) ; if ( "properties" . equals ( name ) ) { try ( InputStream propsStream = Bootstrapper ...
public class PngLayerer { private PngChunk processTailChunks ( PngImage result , Iterator < PngChunk > itBaseChunks , PngChunk lastBaseChunk ) throws IOException { } }
while ( lastBaseChunk != null ) { if ( lastBaseChunk . isCritical ( ) ) { final ByteArrayOutputStream bytes = new ByteArrayOutputStream ( lastBaseChunk . getLength ( ) ) ; final DataOutputStream data = new DataOutputStream ( bytes ) ; data . write ( lastBaseChunk . getData ( ) ) ; data . close ( ) ; final PngChunk newC...
public class FileHeaderPage { /** * Closes the header manager , by unpinning the block . */ public void close ( ) { } }
if ( blk != null ) { tx . bufferMgr ( ) . unpin ( currentBuff ) ; blk = null ; currentBuff = null ; }
public class AnimaQuery { /** * generate order by statement with lambda * @ param function column name with lambda * @ param orderBy order by @ see OrderBy * @ param < R > * @ return AnimaQuery */ public < R > AnimaQuery < T > order ( TypeFunction < T , R > function , OrderBy orderBy ) { } }
String columnName = AnimaUtils . getLambdaColumnName ( function ) ; return order ( columnName , orderBy ) ;
public class I18nExtension { /** * Gets the keys contained in the bundle . * @ return the keys . At least one key is returned as empty bundle * was rejected . */ public Set < String > keys ( ) { } }
Set < String > list = new LinkedHashSet < > ( ) ; Enumeration < String > keys = bundle . getKeys ( ) ; while ( keys . hasMoreElements ( ) ) { list . add ( keys . nextElement ( ) ) ; } return list ;
public class HelpDoclet { /** * Return the Java class described by the ClassDoc doc * @ param doc * @ return */ private Class < ? extends Object > getClassForClassDoc ( final ClassDoc doc ) { } }
try { return DocletUtils . getClassForDoc ( doc ) ; } catch ( ClassNotFoundException e ) { // we got a classdoc for a class we can ' t find . Maybe in a library or something return null ; } catch ( NoClassDefFoundError e ) { return null ; } catch ( UnsatisfiedLinkError e ) { return null ; // naughty BWA bindings }
public class EntryStream { /** * Returns an { @ code EntryStream } consisting of the entries whose keys are * modified by applying the given function and values are left unchanged . * This is an < a href = " package - summary . html # StreamOps " > intermediate < / a > * operation . * @ param < KK > The type of...
return new EntryStream < > ( stream ( ) . map ( e -> new SimpleImmutableEntry < > ( keyMapper . apply ( e . getKey ( ) ) , e . getValue ( ) ) ) , context ) ;
public class IndexCleanHelper { /** * Remove all file of workspace index . * @ param wsConfig - workspace configuration . * @ param isSystem - ' true ' to clean system workspace . * @ throws RepositoryConfigurationException - exception on parsing workspace configuration * @ throws IOException - exception on rem...
String indexDirName = wsConfig . getQueryHandler ( ) . getParameterValue ( QueryHandlerParams . PARAM_INDEX_DIR ) ; File indexDir = new File ( indexDirName ) ; if ( PrivilegedFileHelper . exists ( indexDir ) ) { removeFolder ( indexDir ) ; } if ( isSystem ) { File systemIndexDir = new File ( indexDirName + "_" + System...
public class VelocityUtil { /** * 生成文件 * @ param template 模板 * @ param context 模板上下文 * @ param destPath 目标路径 ( 绝对 ) */ public static void toFile ( Template template , VelocityContext context , String destPath ) { } }
PrintWriter writer = null ; try { writer = FileUtil . getPrintWriter ( destPath , Velocity . getProperty ( Velocity . INPUT_ENCODING ) . toString ( ) , false ) ; merge ( template , context , writer ) ; } catch ( IORuntimeException e ) { throw new UtilException ( e , "Write Velocity content to [{}] error!" , destPath ) ...
public class CastUtil { /** * Returns a new character descriptor populated with a random set of components . */ public static CharacterDescriptor getRandomDescriptor ( ComponentRepository crepo , String gender , String [ ] COMP_CLASSES , ColorPository cpos , String [ ] COLOR_CLASSES ) { } }
// get all available classes ArrayList < ComponentClass > classes = Lists . newArrayList ( ) ; for ( String element : COMP_CLASSES ) { String cname = gender + "/" + element ; ComponentClass cclass = crepo . getComponentClass ( cname ) ; // make sure the component class exists if ( cclass == null ) { log . warning ( "Mi...
public class CreateDeploymentJobResult { /** * The list of all tags added to the deployment job . * @ param tags * The list of all tags added to the deployment job . * @ return Returns a reference to this object so that method calls can be chained together . */ public CreateDeploymentJobResult withTags ( java . u...
setTags ( tags ) ; return this ;
public class ClientSocketFactory { /** * Closes the read / write pair for reuse . Called only * from ClusterStream . close ( ) . */ void close ( ClientSocket stream ) { } }
if ( log . isLoggable ( Level . FINER ) ) log . finer ( "close " + stream ) ; _activeCount . decrementAndGet ( ) ;
public class TurboProjectReader { /** * Read leaf tasks attached to the WBS . * @ param id initial WBS ID */ private void readTasks ( Integer id ) { } }
Integer currentID = id ; Table table = getTable ( "WBSTAB" ) ; while ( currentID . intValue ( ) != 0 ) { MapRow row = table . find ( currentID ) ; Task task = m_projectFile . getTaskByUniqueID ( row . getInteger ( "TASK_ID" ) ) ; readLeafTasks ( task , row . getInteger ( "FIRST_CHILD_TASK_ID" ) ) ; Integer childID = ro...
public class AppServicePlansInner { /** * Delete a Hybrid Connection in use in an App Service plan . * Delete a Hybrid Connection in use in an App Service plan . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of the App Service plan . * @ param namespa...
deleteHybridConnectionWithServiceResponseAsync ( resourceGroupName , name , namespaceName , relayName ) . toBlocking ( ) . single ( ) . body ( ) ;
public class AttributeFormFieldRegistry { /** * Register a new type of { @ link FormItem } and { @ link DataSourceField } for a certain kind of attribute or key . If * there already was a definition registered for the given key , than it will be replaced by the new one . For all * known attribute types ( integer , ...
if ( key == null || fieldType == null || editorType == null ) { throw new IllegalArgumentException ( "Cannot provide null values when registering new form items." ) ; } DATA_SOURCE_FIELDS . put ( key , fieldType ) ; FORM_ITEMS . put ( key , editorType ) ; FIELD_VALIDATORS . put ( key , null == validators ? new ArrayLis...
public class CholeskyDecompositionCommon_ZDRM { /** * { @ inheritDoc } */ @ Override public boolean decompose ( ZMatrixRMaj mat ) { } }
if ( mat . numRows != mat . numCols ) { throw new IllegalArgumentException ( "Must be a square matrix." ) ; } n = mat . numRows ; T = mat ; t = T . data ; if ( lower ) { return decomposeLower ( ) ; } else { return decomposeUpper ( ) ; }
public class CmsAvailability { /** * Builds a String with HTML code to display the responsibles of a resource . < p > * @ return HTML code for the responsibles of the current resource */ public String buildResponsibleList ( ) { } }
if ( isMultiOperation ( ) ) { // show no responsibles list for multi operation return "" ; } else { // single resource operation , create list of responsibles StringBuffer result = new StringBuffer ( 512 ) ; result . append ( "<tr><td colspan=\"3\">" ) ; List < CmsResource > parentResources = new ArrayList < CmsResourc...
public class Schema { /** * Returns the { @ link ColumnType } * for the column at the specified index * @ param column the index of the column to get the type for * @ return the type of the column to at the specified inde */ public ColumnType getType ( int column ) { } }
if ( column < 0 || column >= columnMetaData . size ( ) ) throw new IllegalArgumentException ( "Invalid column number. " + column + "only " + columnMetaData . size ( ) + "present." ) ; return columnMetaData . get ( column ) . getColumnType ( ) ;
public class EJSWrapperCommon { /** * d195605 */ public boolean inCache ( ) { } }
boolean inCache = false ; synchronized ( ivBucket ) { // Non - negative pin value indicates the object is in the cache . if ( pinned >= 0 ) { ( ( WrapperBucket ) ivBucket ) . ivWrapperCache . touch ( this ) ; inCache = true ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc...
public class Util { /** * Returns the InputStream for the resource represented by the specified path , supporting scheme * prefixes that direct how to acquire the input stream * ( { @ link # CLASSPATH _ PREFIX CLASSPATH _ PREFIX } , * { @ link # URL _ PREFIX URL _ PREFIX } , or { @ link # FILE _ PREFIX FILE _ PRE...
InputStream is ; if ( resourcePath . startsWith ( CLASSPATH_PREFIX ) ) { is = loadFromClassPath ( stripPrefix ( resourcePath ) ) ; } else if ( resourcePath . startsWith ( URL_PREFIX ) ) { is = loadFromUrl ( stripPrefix ( resourcePath ) ) ; } else if ( resourcePath . startsWith ( FILE_PREFIX ) ) { is = loadFromFile ( st...
public class ExcelCell { /** * Add a hyperlink * @ param url URL * @ param label Label for the cell * @ return the cell */ public ExcelCell newCell ( String url , String label ) { } }
return row . newCell ( ) . link ( url , label ) ;
public class DataUtil { /** * big - endian or motorola format . */ public static short readShortBigEndian ( InputStream io ) throws IOException { } }
int value = io . read ( ) ; if ( value < 0 ) throw new EOFException ( ) ; int i = io . read ( ) ; if ( i < 0 ) throw new EOFException ( ) ; return ( short ) ( i | ( value << 8 ) ) ;
public class gslbdomain_stats { /** * Use this API to fetch the statistics of all gslbdomain _ stats resources that are configured on netscaler . */ public static gslbdomain_stats [ ] get ( nitro_service service ) throws Exception { } }
gslbdomain_stats obj = new gslbdomain_stats ( ) ; gslbdomain_stats [ ] response = ( gslbdomain_stats [ ] ) obj . stat_resources ( service ) ; return response ;
public class TurfClassification { /** * Takes a reference point and a list of { @ link Point } geometries and returns the point from the * set point list closest to the reference . This calculation is geodesic . * @ param targetPoint the reference point * @ param points set list of points to run against the input...
if ( points . isEmpty ( ) ) { return targetPoint ; } Point nearestPoint = points . get ( 0 ) ; double minDist = Double . POSITIVE_INFINITY ; for ( Point point : points ) { double distanceToPoint = TurfMeasurement . distance ( targetPoint , point ) ; if ( distanceToPoint < minDist ) { nearestPoint = point ; minDist = di...
public class FunctionDeferred { /** * This function is called when the previous promise in the pipe * is resolved . */ public final Object f ( Object ... args ) { } }
return dfd != null && ( cache == CacheType . ALL || cache == CacheType . RESOLVED && dfd . promise ( ) . isResolved ( ) || cache == CacheType . REJECTED && dfd . promise ( ) . isRejected ( ) ) ? dfd . promise ( ) : new PromiseFunction ( ) { public void f ( Deferred dfd ) { FunctionDeferred . this . resolve = resolve ; ...
public class IoUtils { /** * Counts the number of columns in a file delimited by { @ code delimiter } . * Assumes that the first line of the file is representative of the file as a * whole . * @ param filename * @ param delimiter * @ return */ public static int getNumberOfColumnsInFile ( String filename , Str...
try { BufferedReader in = new BufferedReader ( new FileReader ( filename ) ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { String [ ] parts = line . split ( delimiter ) ; in . close ( ) ; return parts . length ; } in . close ( ) ; // File is empty . return 0 ; } catch ( IOException e ) { throw new Ru...
public class LogUtils { /** * Returns the parameters to a test from its log document */ public static XdmNode getParamsFromLog ( net . sf . saxon . s9api . DocumentBuilder builder , Document log ) throws Exception { } }
Element starttest = ( Element ) log . getElementsByTagName ( "starttest" ) . item ( 0 ) ; NodeList nl = starttest . getElementsByTagName ( "params" ) ; if ( nl == null || nl . getLength ( ) == 0 ) { return null ; } else { Document doc = DomUtils . createDocument ( nl . item ( 0 ) ) ; return builder . build ( new DOMSou...
public class VersionsImpl { /** * Creates a new version using the current snapshot of the selected application version . * @ param appId The application ID . * @ param versionId The version ID . * @ param version The new version for the cloned model . * @ throws IllegalArgumentException thrown if parameters fai...
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgu...
public class OidList { /** * Returns true if the specified oid is in the list , false if not . */ public boolean contains ( int oid ) { } }
for ( int ii = 0 ; ii < _size ; ii ++ ) { if ( _oids [ ii ] == oid ) { return true ; } } return false ;
public class AbstractWMultiSelectList { /** * { @ inheritDoc } */ @ Override public List < ? > getRequestValue ( final Request request ) { } }
if ( isPresent ( request ) ) { return getNewSelections ( request ) ; } else { return getValue ( ) ; }
public class InternalSARLParser { /** * InternalSARL . g : 1588:1 : entryRuleEventMember returns [ EObject current = null ] : iv _ ruleEventMember = ruleEventMember EOF ; */ public final EObject entryRuleEventMember ( ) throws RecognitionException { } }
EObject current = null ; EObject iv_ruleEventMember = null ; try { // InternalSARL . g : 1588:52 : ( iv _ ruleEventMember = ruleEventMember EOF ) // InternalSARL . g : 1589:2 : iv _ ruleEventMember = ruleEventMember EOF { if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getEventMemberRule ( ) ) ; }...
public class OpenTracingManager { /** * This method calls the ' finish ( ) ' method on the current span . */ public void finishSpan ( ) { } }
TraceState ts = traceState . get ( ) ; if ( ts != null ) { Span span = ts . popSpan ( ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Finish span = " + span + " trace state = " + ts ) ; } span . finish ( ) ; if ( ts . isFinished ( ) ) { if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Remov...
public class PathUtil { /** * Replaces the final component in the supplied path with the * specified new component . For example , if < code > / foo / bar / baz < / code > * was provided as the source path , < code > baz < / code > would be replaced * with the supplied new path component . If no slashes occur in ...
int sidx = source . lastIndexOf ( "/" ) ; if ( sidx != - 1 ) { return source . substring ( 0 , sidx + 1 ) + newComponent ; } else { return newComponent ; }
public class Tools { /** * Determine the minimum value in a slice of an array . */ static int min ( int [ ] input , int start , int length ) { } }
assert length >= 1 ; int min = input [ start ] ; for ( int i = length - 2 , index = start + 1 ; i >= 0 ; i -- , index ++ ) { final int v = input [ index ] ; if ( v < min ) { min = v ; } } return min ;
public class CmsFavoriteDialog { /** * Saves the list of currently displayed favorites . */ protected void doSave ( ) { } }
List < CmsFavoriteEntry > entries = getEntries ( ) ; try { m_favDao . saveFavorites ( entries ) ; } catch ( Exception e ) { CmsErrorDialog . showErrorDialog ( e ) ; }
public class ReferenceStream { /** * Find the reference that has been known to the stream for longest . The reference returned * may be in any of the states defined in the state model . The caller should not * assume that the reference can be used for any particular purpose . * @ return Item , may be null . * @...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findOldestReference" ) ; ReferenceCollection ic = ( ( ReferenceCollection ) _getMembership ( ) ) ; if ( null == ic ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , ...
public class Destination { /** * An array that contains the email addresses of the " BCC " ( blind carbon copy ) recipients for the email . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setBccAddresses ( java . util . Collection ) } or { @ link # withBccAdd...
if ( this . bccAddresses == null ) { setBccAddresses ( new java . util . ArrayList < String > ( bccAddresses . length ) ) ; } for ( String ele : bccAddresses ) { this . bccAddresses . add ( ele ) ; } return this ;
public class ExpressRouteCrossConnectionsInner { /** * Gets the route table summary associated with the express route cross connection in a resource group . * @ param resourceGroupName The name of the resource group . * @ param crossConnectionName The name of the ExpressRouteCrossConnection . * @ param peeringNam...
return listRoutesTableSummaryWithServiceResponseAsync ( resourceGroupName , crossConnectionName , peeringName , devicePath ) . toBlocking ( ) . last ( ) . body ( ) ;