signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class JingleSession { /** * Return true if all of the media managers have finished . */ public boolean isFullyEstablished ( ) { } }
boolean result = true ; for ( ContentNegotiator contentNegotiator : contentNegotiators ) { if ( ! contentNegotiator . isFullyEstablished ( ) ) result = false ; } return result ;
public class LostExceptionStackTrace { /** * looks for methods that contain a catch block and an ATHROW opcode * @ param code * the context object of the current code block * @ param method * the context object of the current method * @ return if the class throws exceptions */ public boolean prescreen ( Code ...
if ( method . isSynthetic ( ) ) { return false ; } CodeException [ ] ce = code . getExceptionTable ( ) ; if ( CollectionUtils . isEmpty ( ce ) ) { return false ; } BitSet bytecodeSet = getClassContext ( ) . getBytecodeSet ( method ) ; return ( bytecodeSet != null ) && bytecodeSet . get ( Const . ATHROW ) ;
public class KeyringMonitorImpl { /** * Registers this KeyringMonitor to start monitoring the specified keyrings * by mbean notification . * @ param id of keyrings to monitor . * @ param trigger what trigger the keyring update notification mbean * @ return The < code > KeyringMonitor < / code > service registra...
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEventEnabled ( ) ) { Tr . event ( this , tc , "monitorKeyRing registration for" , ID ) ; } BundleContext bundleContext = actionable . getBundleContext ( ) ; final Hashtable < String , Object > keyRingMonitorProps = new Hashtable < String , Object > ( ) ; keyRingMo...
public class StrBuilder { /** * Checks the capacity and ensures that it is at least the size specified . * @ param capacity the capacity to ensure * @ return this , to enable chaining */ public StrBuilder ensureCapacity ( final int capacity ) { } }
if ( capacity > buffer . length ) { final char [ ] old = buffer ; buffer = new char [ capacity * 2 ] ; System . arraycopy ( old , 0 , buffer , 0 , size ) ; } return this ;
public class RealVoltDB { /** * This host can be a leader if partition 0 is on it or it is in the same partition group as a node which has * partition 0 . This is because the partition group with partition 0 can never be removed by elastic remove . * @ param partitions { @ link List } of partitions on this host *...
if ( partitions . contains ( Integer . valueOf ( 0 ) ) ) { return true ; } for ( Integer host : topology . getHostIdList ( 0 ) ) { if ( partitionGroupPeers . contains ( host ) ) { return true ; } } return false ;
public class PasswordUtil { /** * Encode the provided password by using the specified encoding algorithm . The encoded string consistes of the * algorithm of the encoding and the encoded value . * If the decoded _ string is already encoded , the string will be decoded and then encoded by using the specified crypto ...
return encode ( decoded_string , crypto_algorithm , ( String ) null ) ;
public class Admin { /** * @ throws PageException */ private void doGetDatasource ( ) throws PageException { } }
String name = getString ( "admin" , action , "name" ) ; Map ds = config . getDataSourcesAsMap ( ) ; Iterator it = ds . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; if ( key . equalsIgnoreCase ( name ) ) { DataSource d = ( DataSource ) ds . get ( key ) ; Struct sct = n...
public class WhitelistingApi { /** * Get the status of whitelist feature ( enabled / disabled ) of a device type . * Get the status of whitelist feature ( enabled / disabled ) of a device type . * @ param dtid Device Type ID . ( required ) * @ return WhitelistEnvelope * @ throws ApiException If fail to call the...
ApiResponse < WhitelistEnvelope > resp = getWhitelistStatusWithHttpInfo ( dtid ) ; return resp . getData ( ) ;
public class SystemUtil { /** * Returns a Properties , loaded from the given inputstream . If the given * inputstream is null , then an empty Properties object is returned . * @ param pInput the inputstream to read from * @ return a Properties object read from the given stream , or an empty * Properties mapping...
if ( pInput == null ) { throw new IllegalArgumentException ( "InputStream == null!" ) ; } Properties mapping = new Properties ( ) ; /* if ( pInput instanceof XMLPropertiesInputStream ) { mapping = new XMLProperties ( ) ; else { mapping = new Properties ( ) ; */ // Load the properties mapping . load ( pInput ) ; r...
public class QueryImpl { /** * Validated parameter ' s class with input paramClass . Returns back parameter * if it matches , else throws an { @ link IllegalArgumentException } . * @ param < T > * type of class . * @ param paramClass * expected class type . * @ param parameter * parameter * @ return par...
if ( parameter != null && parameter . getParameterType ( ) != null && parameter . getParameterType ( ) . equals ( paramClass ) ) { return parameter ; } throw new IllegalArgumentException ( "The parameter of the specified name does not exist or is not assignable to the type" ) ;
public class BeansImpl { /** * Returns all < code > decorators < / code > elements * @ return list of < code > decorators < / code > */ public List < Decorators < Beans < T > > > getAllDecorators ( ) { } }
List < Decorators < Beans < T > > > list = new ArrayList < Decorators < Beans < T > > > ( ) ; List < Node > nodeList = childNode . get ( "decorators" ) ; for ( Node node : nodeList ) { Decorators < Beans < T > > type = new DecoratorsImpl < Beans < T > > ( this , "decorators" , childNode , node ) ; list . add ( type ) ;...
public class Relation { /** * Returns a synchronized ( thread - safe ) relation wrapper backed by * the given relation < code > rel < / code > . Each operation * synchronizes on < code > rel < / code > . * < p > For operations that return a collection ( e . g . , { @ link * # keys ( ) } , { @ link # values ( ) ...
return new SynchronizedRelation < K , V > ( rel ) ;
public class CliFrontend { /** * Loads a class from the classpath that implements the CustomCommandLine interface . * @ param className The fully - qualified class name to load . * @ param params The constructor parameters */ private static CustomCommandLine < ? > loadCustomCommandLine ( String className , Object ....
Class < ? extends CustomCommandLine > customCliClass = Class . forName ( className ) . asSubclass ( CustomCommandLine . class ) ; // construct class types from the parameters Class < ? > [ ] types = new Class < ? > [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { Preconditions . checkNotNull ( par...
public class DescribeConfigurationSetResult { /** * A list of event destinations associated with the configuration set . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setEventDestinations ( java . util . Collection ) } or { @ link # withEventDestinations ( ...
if ( this . eventDestinations == null ) { setEventDestinations ( new com . amazonaws . internal . SdkInternalList < EventDestination > ( eventDestinations . length ) ) ; } for ( EventDestination ele : eventDestinations ) { this . eventDestinations . add ( ele ) ; } return this ;
public class SwingUtils { /** * Ensures the given runnable is executed into the event dispatcher thread . * @ param runnable * the runnable . * @ param wait * whether should wait until execution is completed . */ public static void runInEventDispatcherThread ( Runnable runnable , Boolean wait ) { } }
Assert . notNull ( runnable , "runnable" ) ; Assert . notNull ( wait , "wait" ) ; if ( EventQueue . isDispatchThread ( ) ) { runnable . run ( ) ; } else if ( wait ) { try { EventQueue . invokeAndWait ( runnable ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } catch ( InvocationTargetExcepti...
public class GroovyRunnerRegistry { /** * Registers a runner with the specified key . * @ param key to associate with the runner * @ param runner the runner to register * @ return the previously registered runner for the given key , * if no runner was previously registered for the key * then { @ code null } *...
if ( key == null || runner == null ) { return null ; } Map < String , GroovyRunner > map = getMap ( ) ; writeLock . lock ( ) ; try { cachedValues = null ; return map . put ( key , runner ) ; } finally { writeLock . unlock ( ) ; }
public class Version { /** * Check if this version is higher than the passed other version . Only taking major and minor version number in account . * @ param other { @ link Version } to compare */ @ Deprecated public boolean greaterMinor ( Version other ) { } }
return other . major < this . major || other . major == this . major && other . minor < this . minor ;
public class DataUtils { /** * Split a module Id to get the module name * @ param moduleId * @ return String */ public static String getModuleName ( final String moduleId ) { } }
final int splitter = moduleId . indexOf ( ':' ) ; if ( splitter == - 1 ) { return moduleId ; } return moduleId . substring ( 0 , splitter ) ;
public class WorkQueue { /** * Start a worker . Called by startWorkers ( ) , but should also be called by the main thread to do some of the work * on that thread , to prevent deadlock in the case that the ExecutorService doesn ' t have as many threads * available as numParallelTasks . When this method returns , eit...
// Get next work unit from queue for ( ; ; ) { // Check for interruption interruptionChecker . check ( ) ; // Get next work unit final WorkUnitWrapper < T > workUnitWrapper = workUnits . take ( ) ; if ( workUnitWrapper . workUnit == null ) { // Received poison pill break ; } // Process the work unit try { // Process th...
public class UserAgentManager { /** * normalize : normalize clients that contain @ sign in user e . g . maria @ xyz . com * @ param user * @ return */ private String normalize ( String user ) { } }
if ( user != null ) { if ( user . contains ( "@" ) ) user = user . replaceAll ( "@" , "%40" ) ; } if ( logger . isDebugEnabled ( ) ) logger . debug ( "Normalized User = " + user ) ; return user ;
public class Handling { /** * Throws exception ( convenience method for lambda expressions ) . Pretends that there might be a product - but it will never be returned . */ public static < T , X extends Throwable > T throwThe ( X e ) throws X { } }
if ( e == null ) { throw new ExceptionNotHandled ( "Cannot throw null exception." ) ; } throw e ;
public class QNameSort { /** * Sort lexicographically by qname local - name , then by qname uri * @ param ns1 * qname1 namespace * @ param ln1 * qname1 local - name * @ param ns2 * qname2 namespace * @ param ln2 * qname2 local - name * @ return a negative integer , zero , or a positive integer as the ...
if ( ns1 == null ) { ns1 = Constants . XML_NULL_NS_URI ; } if ( ns2 == null ) { ns2 = Constants . XML_NULL_NS_URI ; } int cLocalPart = ln1 . compareTo ( ln2 ) ; return ( cLocalPart == 0 ? ns1 . compareTo ( ns2 ) : cLocalPart ) ;
public class DdlTokenStream { /** * Returns the string content for characters bounded by the previous marked position and the position of the currentToken * ( inclusive ) . Method also marks ( ) the new position the the currentToken . * @ return the string content for characters bounded by the previous marked posit...
Position startPosition = new Position ( currentMarkedPosition . getIndexInContent ( ) , currentMarkedPosition . getLine ( ) , currentMarkedPosition . getColumn ( ) ) ; mark ( ) ; return getContentBetween ( startPosition , currentMarkedPosition ) ;
public class DeduceBondSystemTool { /** * Recovers a RingSet corresponding to a AtomContainer that has been * stored by storeRingSystem ( ) . * @ param mol The IAtomContainer for which to recover the IRingSet . */ private IRingSet recoverRingSystem ( IAtomContainer mol ) { } }
IRingSet ringSet = mol . getBuilder ( ) . newInstance ( IRingSet . class ) ; for ( Integer [ ] bondNumbers : listOfRings ) { IRing ring = mol . getBuilder ( ) . newInstance ( IRing . class , bondNumbers . length ) ; for ( int bondNumber : bondNumbers ) { IBond bond = mol . getBond ( bondNumber ) ; ring . addBond ( bond...
public class SenderWorker { /** * Sends the given < code > ProtocolDataUnit < / code > instance over the socket to the connected iSCSI Target . * @ param unit The < code > ProtocolDataUnit < / code > instances to send . * @ throws InternetSCSIException if any violation of the iSCSI - Standard emerge . * @ throws ...
final Session session = connection . getSession ( ) ; unit . getBasicHeaderSegment ( ) . setInitiatorTaskTag ( session . getInitiatorTaskTag ( ) ) ; final InitiatorMessageParser parser = ( InitiatorMessageParser ) unit . getBasicHeaderSegment ( ) . getParser ( ) ; parser . setCommandSequenceNumber ( session . getComman...
public class OmsShalstab { /** * Calculates the trasmissivity in every pixel of the map . */ private void qcrit ( RenderedImage slope , RenderedImage ab , RandomIter trasmissivityRI , RandomIter frictionRI , RandomIter cohesionRI , RandomIter hsIter , RandomIter effectiveRI , RandomIter densityRI ) { } }
HashMap < String , Double > regionMap = CoverageUtilities . getRegionParamsFromGridCoverage ( inSlope ) ; int cols = regionMap . get ( CoverageUtilities . COLS ) . intValue ( ) ; int rows = regionMap . get ( CoverageUtilities . ROWS ) . intValue ( ) ; RandomIter slopeRI = RandomIterFactory . create ( slope , null ) ; R...
public class TCPMemcachedNodeImpl { /** * ( non - Javadoc ) * @ see net . spy . memcached . MemcachedNode # destroyInputQueue ( ) */ public Collection < Operation > destroyInputQueue ( ) { } }
Collection < Operation > rv = new ArrayList < Operation > ( ) ; inputQueue . drainTo ( rv ) ; return rv ;
public class Client { /** * Get the current sequence numbers from all partitions . * @ return an { @ link Observable } of partition and sequence number . */ private Observable < PartitionAndSeqno > getSeqnos ( ) { } }
return conductor . getSeqnos ( ) . flatMap ( new Func1 < ByteBuf , Observable < PartitionAndSeqno > > ( ) { @ Override public Observable < PartitionAndSeqno > call ( ByteBuf buf ) { int numPairs = buf . readableBytes ( ) / 10 ; // 2 byte short + 8 byte long List < PartitionAndSeqno > pairs = new ArrayList < > ( numPair...
public class PageMetadata { /** * Generate query parameters for the backward page with the specified startkey . * Pages only have a reference to the start key , when paging backwards this is the * startkey of the following page ( i . e . the last element of the previous page ) so to * correctly present page resul...
// Get a copy of the parameters , using the forward pagination method ViewQueryParameters < K , V > reversedParameters = forwardPaginationQueryParameters ( initialQueryParameters , startkey , startkey_docid ) ; // Now reverse some of the parameters to page backwards . // Paging backward is descending from the original ...
public class BasicDeviceFactory { /** * Get a device according to his id * @ param id The device id * @ return The device * @ throws UnknownDeviceException * @ throws NullIdException */ public Device getDevice ( String id ) throws UnknownDeviceException , NullIdException { } }
if ( ( id == null ) || ( id . trim ( ) . equals ( "" ) ) ) { throw new NullIdException ( ) ; } else { if ( this . devices . containsKey ( id ) ) { return this . devices . get ( id ) ; } else { throw new UnknownDeviceException ( ) ; } }
public class ApplicationManifestUtils { /** * Write { @ link ApplicationManifest } s to an { @ link OutputStream } * @ param out the { @ link OutputStream } to write to * @ param applicationManifests the manifests to write */ public static void write ( OutputStream out , ApplicationManifest ... applicationManifests...
write ( out , Arrays . asList ( applicationManifests ) ) ;
public class XmlSlurper { /** * / * ( non - Javadoc ) * @ see org . xml . sax . ContentHandler # endElement ( java . lang . String , java . lang . String , java . lang . String ) */ public void endElement ( final String namespaceURI , final String localName , final String qName ) throws SAXException { } }
addCdata ( ) ; Node oldCurrentNode = stack . pop ( ) ; if ( oldCurrentNode != null ) { currentNode = oldCurrentNode ; }
public class FlowWatcher { /** * Called to fire events to the JobRunner listeners */ protected synchronized void handleJobStatusChange ( final String jobId , final Status status ) { } }
final BlockingStatus block = this . map . get ( jobId ) ; if ( block != null ) { block . changeStatus ( status ) ; }
public class AuthenticationInfo { /** * < pre > * The email address of the authenticated user making the request . * < / pre > * < code > string principal _ email = 1 ; < / code > */ public com . google . protobuf . ByteString getPrincipalEmailBytes ( ) { } }
java . lang . Object ref = principalEmail_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; principalEmail_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; }
public class Index { /** * Partially Override the content of several objects * @ param objects the array of objects to update ( each object must contains an objectID attribute ) * @ param requestOptions Options to pass to this request */ public JSONObject partialUpdateObjects ( JSONArray objects , RequestOptions re...
try { JSONArray array = new JSONArray ( ) ; for ( int n = 0 ; n < objects . length ( ) ; n ++ ) { array . put ( partialUpdateObject ( objects . getJSONObject ( n ) ) ) ; } return batch ( array , requestOptions ) ; } catch ( JSONException e ) { throw new AlgoliaException ( e . getMessage ( ) ) ; }
public class PortletTypeImpl { /** * If not already created , a new < code > portlet - info < / code > element with the given value will be created . * Otherwise , the existing < code > portlet - info < / code > element will be returned . * @ return a new or existing instance of < code > PortletInfoType < PortletTy...
Node node = childNode . getOrCreate ( "portlet-info" ) ; PortletInfoType < PortletType < T > > portletInfo = new PortletInfoTypeImpl < PortletType < T > > ( this , "portlet-info" , childNode , node ) ; return portletInfo ;
public class ModelsImpl { /** * Gets information about the application version ' s Pattern . Any model . * @ param appId The application ID . * @ param versionId The version ID . * @ param entityId The entity extractor ID . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ retur...
return getPatternAnyEntityInfoWithServiceResponseAsync ( appId , versionId , entityId ) . map ( new Func1 < ServiceResponse < PatternAnyEntityExtractor > , PatternAnyEntityExtractor > ( ) { @ Override public PatternAnyEntityExtractor call ( ServiceResponse < PatternAnyEntityExtractor > response ) { return response . bo...
public class MeasureUnitUtil { /** * Convert the given value expressed in the given unit to meters . * @ param value is the value to convert * @ param inputUnit is the unit of the { @ code value } * @ return the result of the convertion . */ @ Pure @ SuppressWarnings ( "checkstyle:returncount" ) public static dou...
switch ( inputUnit ) { case TERAMETER : return value * 1e12 ; case GIGAMETER : return value * 1e9 ; case MEGAMETER : return value * 1e6 ; case KILOMETER : return value * 1e3 ; case HECTOMETER : return value * 1e2 ; case DECAMETER : return value * 1e1 ; case METER : break ; case DECIMETER : return value * 1e-1 ; case CE...
public class NodeArbitrateEvent { /** * 销毁的node节点 * < pre > * 1 . 是个同步调用 * < / pre > */ public void destory ( Long nid ) { } }
String path = ManagePathUtils . getNode ( nid ) ; try { zookeeper . delete ( path ) ; // 删除节点 , 不关心版本 } catch ( ZkNoNodeException e ) { // 如果节点已经不存在 , 则不抛异常 // ignore } catch ( ZkException e ) { throw new ArbitrateException ( "Node_destory" , nid . toString ( ) , e ) ; }
public class Range { /** * Checks where the specified element occurs relative to this range . * Returns { @ code - 1 } if this range is before the specified element , * { @ code 1 } if the this range is after the specified element , otherwise { @ code 0 } if the specified element is contained in this range . * @ ...
if ( element == null ) { // Comparable API says throw NPE on null throw new NullPointerException ( "Element is null" ) ; } if ( isBefore ( element ) ) { return - 1 ; } else if ( isAfter ( element ) ) { return 1 ; } else { return 0 ; }
public class ActionButton { /** * Draws the main circle of the < b > Action Button < / b > and calls * { @ link # drawShadow ( ) } to draw the shadow if present * @ param canvas canvas , on which circle is to be drawn */ protected void drawCircle ( Canvas canvas ) { } }
resetPaint ( ) ; if ( hasShadow ( ) ) { if ( isShadowResponsiveEffectEnabled ( ) ) { shadowResponsiveDrawer . draw ( canvas ) ; } else { drawShadow ( ) ; } } getPaint ( ) . setStyle ( Paint . Style . FILL ) ; boolean rippleInProgress = isRippleEffectEnabled ( ) && ( ( RippleEffectDrawer ) rippleEffectDrawer ) . isDrawi...
public class DistortImageOps { /** * Applies a pixel transform to a single band image . More flexible but order to use function . * @ deprecated As of v0.19 . Use { @ link FDistort } instead * @ param input Input ( source ) image . * @ param output Where the result of transforming the image image is written to . ...
Class < Output > inputType = ( Class < Output > ) input . getClass ( ) ; ImageDistort < Input , Output > distorter = FactoryDistort . distortSB ( false , interp , inputType ) ; distorter . setRenderAll ( renderAll ) ; distorter . setModel ( transform ) ; distorter . apply ( input , output ) ;
public class ApplyPendingMaintenanceActionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ApplyPendingMaintenanceActionRequest applyPendingMaintenanceActionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( applyPendingMaintenanceActionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( applyPendingMaintenanceActionRequest . getReplicationInstanceArn ( ) , REPLICATIONINSTANCEARN_BINDING ) ; protocolMarshaller . marshall ( applyPendi...
public class RendererFactory { /** * Checks if a particular renderer ( descriptor ) is a good match for a * particular renderer . * @ param rendererDescriptor * the renderer ( descriptor ) to check . * @ param renderable * the renderable that needs rendering . * @ param bestMatchingDescriptor * the curren...
final Class < ? extends Renderable > renderableType = rendererDescriptor . getRenderableType ( ) ; final Class < ? extends Renderable > renderableClass = renderable . getClass ( ) ; if ( ReflectionUtils . is ( renderableClass , renderableType ) ) { if ( bestMatch == null ) { return isRendererCapable ( rendererDescripto...
public class BatchDetectEntitiesItemResultMarshaller { /** * Marshall the given parameter object . */ public void marshall ( BatchDetectEntitiesItemResult batchDetectEntitiesItemResult , ProtocolMarshaller protocolMarshaller ) { } }
if ( batchDetectEntitiesItemResult == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchDetectEntitiesItemResult . getIndex ( ) , INDEX_BINDING ) ; protocolMarshaller . marshall ( batchDetectEntitiesItemResult . getEntities ( ) , ENTITIES...
public class ClassWriterImpl { /** * { @ inheritDoc } */ public void addSubInterfacesInfo ( Content classInfoTree ) { } }
if ( classDoc . isInterface ( ) ) { List < ClassDoc > subInterfaces = classtree . allSubs ( classDoc , false ) ; if ( subInterfaces . size ( ) > 0 ) { Content label = getResource ( "doclet.Subinterfaces" ) ; Content dt = HtmlTree . DT ( label ) ; Content dl = HtmlTree . DL ( dt ) ; dl . addContent ( getClassLinks ( Lin...
public class LaplaceInterpolation { /** * Compute squared root of L2 norms for a vector . */ private static double snorm ( double [ ] sx ) { } }
int n = sx . length ; double ans = 0.0 ; for ( int i = 0 ; i < n ; i ++ ) { ans += sx [ i ] * sx [ i ] ; } return Math . sqrt ( ans ) ;
public class Doc { /** * Checks to see if the specified tag exists */ public boolean isTagPresent ( String tagName ) { } }
Tag [ ] tags = getTagMap ( ) . get ( tagName ) ; return ( tags != null && tags . length > 0 ) ;
public class SpringApplicationRunner { /** * Compile and run the application . * @ throws Exception on error */ public void compileAndRun ( ) throws Exception { } }
synchronized ( this . monitor ) { try { stop ( ) ; Class < ? > [ ] compiledSources = compile ( ) ; monitorForChanges ( ) ; // Run in new thread to ensure that the context classloader is setup this . runThread = new RunThread ( compiledSources ) ; this . runThread . start ( ) ; this . runThread . join ( ) ; } catch ( Ex...
public class Selector { /** * Find elements matching selector . * @ param evaluator CSS selector * @ param root root element to descend into * @ return matching elements , empty if none */ public static Elements select ( Evaluator evaluator , Element root ) { } }
Validate . notNull ( evaluator ) ; Validate . notNull ( root ) ; return Collector . collect ( evaluator , root ) ;
public class DumbDataFactory { /** * { @ inheritDoc } */ @ Override public IData deserializeData ( DataInput pSource ) throws TTIOException { } }
try { final long key = pSource . readLong ( ) ; byte [ ] data = new byte [ pSource . readInt ( ) ] ; pSource . readFully ( data ) ; return new DumbData ( key , data ) ; } catch ( final IOException exc ) { throw new TTIOException ( exc ) ; }
public class WebSockets { /** * Sends a complete binary message using blocking IO * Automatically frees the pooled byte buffer when done . * @ param pooledData The data to send , it will be freed when done * @ param wsChannel The web socket channel */ public static void sendBinaryBlocking ( final PooledByteBuffer...
sendBlockingInternal ( pooledData , WebSocketFrameType . BINARY , wsChannel ) ;
public class Facet { /** * Ensure the path that is passed is only the name of the file and not a path */ protected boolean isBasename ( String potentialPath ) { } }
if ( ALLOW_VIEW_NAME_PATH_TRAVERSAL ) { return true ; } else { if ( potentialPath . contains ( "\\" ) || potentialPath . contains ( "/" ) ) { // prevent absolute path and folder traversal to find scripts return false ; } return true ; }
public class PackageMemberAnnotation { /** * Format the annotation . Note that this version ( defined by * PackageMemberAnnotation ) only handles the " class " and " package " keys , and * calls formatPackageMember ( ) for all other keys . * @ param key * the key * @ return the formatted annotation */ @ Overr...
if ( "class.givenClass" . equals ( key ) ) { return shorten ( primaryClass . getPackageName ( ) , className ) ; } if ( "simpleClass" . equals ( key ) ) { return ClassName . extractSimpleName ( className ) ; } if ( "class" . equals ( key ) ) { return className ; } if ( "package" . equals ( key ) ) { return getPackageNam...
public class ProcessCache { /** * Find all definitions matching the specified version spec . Returns shallow processes . */ public static List < Process > getProcessesSmart ( AssetVersionSpec spec ) throws DataAccessException { } }
if ( spec . getPackageName ( ) == null ) throw new DataAccessException ( "Spec must be package-qualified: " + spec ) ; List < Process > matches = new ArrayList < > ( ) ; for ( Process process : getAllProcesses ( ) ) { if ( spec . getQualifiedName ( ) . equals ( process . getQualifiedName ( ) ) ) { if ( process . meetsV...
public class DB { /** * Updates the status for a post . * @ param postId The post id . * @ param status The new status . * @ throws SQLException on database error . */ public void updatePostStatus ( final long postId , final Post . Status status ) throws SQLException { } }
Connection conn = null ; PreparedStatement stmt = null ; try { conn = connectionSupplier . getConnection ( ) ; stmt = conn . prepareStatement ( updatePostStatusSQL ) ; stmt . setString ( 1 , status . toString ( ) . toLowerCase ( ) ) ; stmt . setLong ( 2 , postId ) ; stmt . executeUpdate ( ) ; } finally { SQLUtil . clos...
public class Cache { /** * skip checkstyle : OverloadMethodsDeclarationOrder */ @ Override public synchronized boolean free ( CachedData data ) { } }
@ SuppressWarnings ( "unchecked" ) Value value = ( ( Data < Value > ) data ) . value ; values . remove ( value ) ; Key key = null ; for ( Map . Entry < Key , Data < Value > > e : map . entrySet ( ) ) if ( e . getValue ( ) == data ) { key = e . getKey ( ) ; break ; } map . remove ( key ) ; if ( freer != null ) freer . f...
public class EvalT { /** * Flat Map the wrapped Eval * < pre > * { @ code * EvalWT . of ( AnyM . fromStream ( Arrays . asEvalW ( 10 ) ) * . flatMap ( t - > Eval . completedEval ( 20 ) ) ; * / / EvalWT < AnyMSeq < Stream < Eval [ 20 ] > > > * < / pre > * @ param f FlatMap function * @ return EvalWT that ...
return of ( run . map ( Eval -> Eval . flatMap ( a -> f . apply ( a ) . run . stream ( ) . toList ( ) . get ( 0 ) ) ) ) ;
public class Job { /** * Set the value class for the map output data . This allows the user to * specify the map output value class to be different than the final output * value class . * @ param theClass the map output value class . * @ throws IllegalStateException if the job is submitted */ public void setMap...
ensureState ( JobState . DEFINE ) ; conf . setMapOutputValueClass ( theClass ) ;
public class CmsInternalLinkValidationList { /** * Returns the link validator class . < p > * @ return the link validator class */ private CmsInternalLinksValidator getValidator ( ) { } }
if ( m_validator == null ) { // get the content check result object Map objects = ( Map ) getSettings ( ) . getDialogObject ( ) ; Object o = objects . get ( CmsInternalLinkValidationDialog . class . getName ( ) ) ; List resources = new ArrayList ( ) ; if ( ( o != null ) && ( o instanceof List ) ) { resources = ( List )...
public class PropertiesManager { /** * Set the given property using an object ' s string representation . This will not write * the new value to the file system . * @ see # saveProperty ( Object , Object ) * @ param property * the property whose value is being set * @ param value * the value to set * @ th...
if ( value == null ) { throw new IllegalArgumentException ( "Cannot set a null value, use reset instead" ) ; } setProperty ( property , value . toString ( ) ) ;
public class RuntimeCapability { /** * Gets the name of service provided by this capability . * @ param address the path from which dynamic portion of the capability name is calculated from . Cannot be { @ code null } * @ param serviceValueType the expected type of the service ' s value . Only used to provide valid...
return fromBaseCapability ( address ) . getCapabilityServiceName ( serviceValueType ) ;
public class AppenderatorDriverRealtimeIndexTask { /** * Is a firehose from this factory drainable by closing it ? If so , we should drain on stopGracefully rather than * abruptly stopping . * This is a hack to get around the fact that the Firehose and FirehoseFactory interfaces do not help us do this . * Protect...
return firehoseFactory instanceof EventReceiverFirehoseFactory || ( firehoseFactory instanceof TimedShutoffFirehoseFactory && isFirehoseDrainableByClosing ( ( ( TimedShutoffFirehoseFactory ) firehoseFactory ) . getDelegateFactory ( ) ) ) || ( firehoseFactory instanceof ClippedFirehoseFactory && isFirehoseDrainableByClo...
public class ConfusionMatrix { /** * The Matthews Correlation Coefficient , takes true negatives into account in contrast to F - Score * See < a href = " http : / / en . wikipedia . org / wiki / Matthews _ correlation _ coefficient " > MCC < / a > * MCC = Correlation between observed and predicted binary classifica...
if ( ! isBinary ( ) ) throw new UnsupportedOperationException ( "mcc is only implemented for 2 class problems." ) ; if ( tooLarge ( ) ) throw new UnsupportedOperationException ( "mcc cannot be computed: too many classes" ) ; double tn = _cm [ 0 ] [ 0 ] ; double fp = _cm [ 0 ] [ 1 ] ; double tp = _cm [ 1 ] [ 1 ] ; doubl...
public class UIManager { /** * Attempts to find the configured renderer for the given output format and component . * @ param component the component to find a manager for . * @ param rendererPackage the package containing the renderers . * @ return the Renderer for the component , or null if there is no renderer...
Renderer renderer = null ; // We loop for each WComponent in the class hierarchy , as the // Renderer may have been specified at a higher level . for ( Class < ? > c = component . getClass ( ) ; renderer == null && c != null && ! AbstractWComponent . class . equals ( c ) ; c = c . getSuperclass ( ) ) { String qualified...
public class JPAPersistenceManagerImpl { /** * DS deactivate */ @ Deactivate protected void deactivate ( ) { } }
if ( psu != null ) { try { psu . close ( ) ; } catch ( Exception e ) { // FFDC . } } logger . log ( Level . INFO , "persistence.service.status" , new Object [ ] { "JPA" , "deactivated" } ) ;
public class BitInputStream { /** * Read a Rice Signal Block . * @ param vals The values to be returned * @ param pos The starting position in the vals array * @ param nvals The number of values to return * @ param parameter The Rice parameter * @ throws IOException On read error */ public void readRiceSigned...
int j , valI = 0 ; int cbits = 0 , uval = 0 , msbs = 0 , lsbsLeft = 0 ; byte blurb , saveBlurb ; int state = 0 ; // 0 = getting unary MSBs , 1 = getting binary LSBs if ( nvals == 0 ) return ; int i = getByte ; long startBits = getByte * 8 + getBit ; // We unroll the main loop to take care of partially consumed blurbs h...
public class Database { public String [ ] get_class_property_list ( String classname , String wildcard ) throws DevFailed { } }
return databaseDAO . get_class_property_list ( this , classname , wildcard ) ;
public class BaseProfile { /** * generate MBean code * @ param def Definition */ void generateMBeanCode ( Definition def ) { } }
if ( def . isSupportOutbound ( ) ) { generateClassCode ( def , "MbeanInterface" , "mbean" ) ; generateClassCode ( def , "MbeanImpl" , "mbean" ) ; generatePackageInfo ( def , "main" , "mbean" ) ; }
public class XmlBean { /** * Configures the object by setting the value of its properties with the * values from the xml document . Each element of the xml document represents * a named property of the object . For example , if " setFirstName " is a property * of the object , then an element of " < firstName > Jo...
configure ( xml , obj , null ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger } * { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "skipCount" , scope = GetRenditions . class ) public JAXBElement < BigInteger > createGetR...
return new JAXBElement < BigInteger > ( _GetTypeChildrenSkipCount_QNAME , BigInteger . class , GetRenditions . class , value ) ;
public class MavenHelpers { /** * Returns true if the dependency was added or false if its already there */ public static boolean ensureMavenDependencyAdded ( Project project , DependencyInstaller dependencyInstaller , String groupId , String artifactId , String scope ) { } }
List < Dependency > dependencies = project . getFacet ( DependencyFacet . class ) . getEffectiveDependencies ( ) ; for ( Dependency d : dependencies ) { if ( groupId . equals ( d . getCoordinate ( ) . getGroupId ( ) ) && artifactId . equals ( d . getCoordinate ( ) . getArtifactId ( ) ) ) { getLOG ( ) . debug ( "Project...
public class JSONHelpers { /** * Checks the supplied { @ link JSONObject } for a value mapped by an enum ; if it does not exist , * or is not an object value , the specified default value will be mapped to the enum . If the * value does exist , but either ' x ' or ' y ' field is missing , the missing field ( s ) wi...
if ( json != null ) { JSONObject pointJson = optJSONObject ( json , e ) ; if ( pointJson != null ) { // Check both members ; default if missing try { if ( ! hasNumber ( pointJson , "x" , true ) ) { pointJson . put ( "x" , defPoint . x ) ; } if ( ! hasNumber ( pointJson , "y" , true ) ) { pointJson . put ( "y" , defPoin...
public class JSConsumerSet { /** * / * ( non - Javadoc ) * @ see com . ibm . wsspi . sib . extension . ConsumerSet # setConcurrencyLimit ( int ) */ public void setConcurrencyLimit ( int maxConcurrency ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "setConcurrencyLimit" , Integer . valueOf ( maxConcurrency ) ) ; boolean resumeConsumers = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepa...
public class Normal { /** * High - accuracy Normal cumulative distribution function . * @ param x Value . * @ return Result . */ public static double HighAccuracyFunction ( double x ) { } }
if ( x < - 8 || x > 8 ) return 0 ; double sum = x ; double term = 0 ; double nextTerm = x ; double pwr = x * x ; double i = 1 ; // Iterate until adding next terms doesn ' t produce // any change within the current numerical accuracy . while ( sum != term ) { term = sum ; // Next term nextTerm *= pwr / ( i += 2 ) ; sum ...
public class ProjectCalendar { /** * Utility method to retrieve the previous working date finish time , given * a date and time as a starting point . * @ param date date and time start point * @ return date and time of previous work finish */ public Date getPreviousWorkFinish ( Date date ) { } }
Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( date ) ; updateToPreviousWorkFinish ( cal ) ; return cal . getTime ( ) ;
public class DataUtil { /** * big - endian or motorola format . */ public static void writeIntegerBigEndian ( IO . WritableByteStream io , int value ) throws IOException { } }
io . write ( ( byte ) ( ( value >> 24 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 16 ) & 0xFF ) ) ; io . write ( ( byte ) ( ( value >> 8 ) & 0xFF ) ) ; io . write ( ( byte ) ( value & 0xFF ) ) ;
public class BeanComparator { /** * Add an order - by property to produce a more refined Comparator . If the * property does not return a { @ link Comparable } object when * { @ link # compare compare } is called on the returned comparator , the * property is ignored . Call { @ link # using using } on the returne...
int dot = propertyName . indexOf ( '.' ) ; String subName ; if ( dot < 0 ) { subName = null ; } else { subName = propertyName . substring ( dot + 1 ) ; propertyName = propertyName . substring ( 0 , dot ) ; } boolean reverse = false ; if ( propertyName . length ( ) > 0 ) { char prefix = propertyName . charAt ( 0 ) ; swi...
public class TypeVariableUtils { /** * Shortcut for { @ link # matchVariables ( Type , Type ) } which return map of variable names instaed of raw * variable objects . * @ param template type with variables * @ param real type to compare and resolve variables from * @ return map of resolved variables or empty ma...
final Map < TypeVariable , Type > match = matchVariables ( template , real ) ; if ( match . isEmpty ( ) ) { return Collections . emptyMap ( ) ; } final Map < String , Type > res = new HashMap < String , Type > ( ) ; for ( Map . Entry < TypeVariable , Type > entry : match . entrySet ( ) ) { res . put ( entry . getKey ( ...
public class Tuple { /** * Create new Triple ( Tuple with three elements ) . * @ param < T1 > * @ param < T2 > * @ param < T3 > * @ param e1 * @ param e2 * @ param e3 * @ return Triple */ public static < T1 , T2 , T3 > Triple < T1 , T2 , T3 > newTuple ( T1 e1 , T2 e2 , T3 e3 ) { } }
return new Triple < T1 , T2 , T3 > ( e1 , e2 , e3 ) ;
public class HtmlUnitRegExpProxy { /** * { @ inheritDoc } */ @ Override public Scriptable wrapRegExp ( final Context cx , final Scriptable scope , final Object compiled ) { } }
return wrapped_ . wrapRegExp ( cx , scope , compiled ) ;
public class ZipEntry { /** * Sets the optional comment string for the entry . * < p > ZIP entry comments have maximum length of 0xffff . If the length of the * specified comment string is greater than 0xFFFF bytes after encoding , only * the first 0xFFFF bytes are output to the ZIP file entry . * @ param comme...
// Android - changed : Explicitly allow null comments ( or allow comments to be // cleared ) . if ( comment == null ) { this . comment = null ; return ; } // Android - changed : Explicitly use UTF - 8. if ( comment . getBytes ( StandardCharsets . UTF_8 ) . length > 0xffff ) { throw new IllegalArgumentException ( commen...
public class HttpPostRequestEncoder { /** * Add a series of Files associated with one File parameter * @ param name * the name of the parameter * @ param file * the array of files * @ param contentType * the array of content Types associated with each file * @ param isText * the array of isText attribut...
if ( file . length != contentType . length && file . length != isText . length ) { throw new IllegalArgumentException ( "Different array length" ) ; } for ( int i = 0 ; i < file . length ; i ++ ) { addBodyFileUpload ( name , file [ i ] , contentType [ i ] , isText [ i ] ) ; }
public class MessageMgr { /** * Returns is the report level is enabled or not . * @ param type message type to check * @ return true if the message type is in the list of active message types of the manager and if the associated logger is enabled , false otherwise */ public boolean isEnabledFor ( E_MessageType type...
if ( ! this . messageHandlers . containsKey ( type ) ) { return false ; } return this . messageHandlers . get ( type ) . isEnabled ( ) ;
public class RouteFilterRulesInner { /** * Gets all RouteFilterRules in a route filter . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; RouteFil...
return listByRouteFilterNextSinglePageAsync ( nextPageLink ) . concatMap ( new Func1 < ServiceResponse < Page < RouteFilterRuleInner > > , Observable < ServiceResponse < Page < RouteFilterRuleInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < RouteFilterRuleInner > > > call ( ServiceResponse < ...
public class ReflectionUtil { /** * Transpiled code that directly acccess the serialVersionUID field when reflection is stripped * won ' t compile because this field is also stripped . * < p > Accessing it via reflection allows the non - stripped code to keep the same behavior and * allows the stripped code to co...
try { return clazz . getField ( "serialVersionUID" ) . getLong ( null ) ; } catch ( NoSuchFieldException | IllegalAccessException ex ) { // ignored . return 0 ; }
public class SQLite { /** * Get an aliased func ( column ) . * @ param alias * may be null for a default alias */ private static String func ( String func , String column , @ Nullable String alias ) { } }
if ( alias == null ) { alias = aliased ( column ) ; } return func + '(' + column + ") AS " + alias ;
public class EnumHelper { /** * Creates a lookup array based on the " value " associated with an MpxjEnum . * @ param < E > target enumeration * @ param c enumeration class * @ param arraySizeOffset offset to apply to the array size * @ return lookup array */ @ SuppressWarnings ( { } }
"unchecked" } ) public static final < E extends Enum < E > > E [ ] createTypeArray ( Class < E > c , int arraySizeOffset ) { EnumSet < E > set = EnumSet . allOf ( c ) ; E [ ] array = ( E [ ] ) Array . newInstance ( c , set . size ( ) + arraySizeOffset ) ; for ( E e : set ) { int index = ( ( MpxjEnum ) e ) . getValue ( ...
public class MpProcedureTask { /** * at the same time ( seems to only be an issue if the parameter to the procedure is a VoltTable ) */ public String toShortString ( ) { } }
StringBuilder sb = new StringBuilder ( ) ; taskToString ( sb ) ; if ( m_msg != null ) { sb . append ( "\n" ) ; m_msg . toShortString ( sb ) ; } return sb . toString ( ) ;
public class TemplateElement { /** * Sets the fields value for this TemplateElement . * @ param fields * List of fields to use for this template element . * These must be the same for all template ads in the * same template ad union . * < span class = " constraint Required " > This field is required * and sho...
this . fields = fields ;
public class JAXBHandle { /** * Returns the root object of the JAXB structure for the content * cast to a more specific class . * @ param asthe class of the object * @ param < T > the type to return * @ returnthe root JAXB object */ public < T > T get ( Class < T > as ) { } }
if ( content == null ) { return null ; } if ( as == null ) { throw new IllegalArgumentException ( "Cannot cast content to null class" ) ; } if ( ! as . isAssignableFrom ( content . getClass ( ) ) ) { throw new IllegalArgumentException ( "Cannot cast " + content . getClass ( ) . getName ( ) + " to " + as . getName ( ) )...
public class AbstractRegistry { /** * { @ inheritDoc } * @ param entries { @ inheritDoc } * @ return { @ inheritDoc } * @ throws MultiException { @ inheritDoc } * @ throws InvalidStateException { @ inheritDoc } */ @ Override public List < ENTRY > removeAll ( Collection < ENTRY > entries ) throws MultiException ...
final List < ENTRY > removedEntries = new ArrayList < > ( ) ; ExceptionStack exceptionStack = null ; registryLock . writeLock ( ) . lock ( ) ; try { for ( ENTRY entry : entries ) { // shutdown check is needed because this is not a atomic transaction . if ( shutdownInitiated ) { throw new InvalidStateException ( "Entry ...
public class MsgHtmlTagNode { /** * Returns the { @ code RawTextNode } of the given attribute and removes it from the tag if it * exists , otherwise returns { @ code null } . * @ param tagNode The owning tag * @ param name The attribute name * @ param errorReporter The error reporter */ @ Nullable private stati...
HtmlAttributeNode attribute = tagNode . getDirectAttributeNamed ( name ) ; if ( attribute == null ) { return null ; } RawTextNode value = getAttributeValue ( attribute , name , errorReporter ) ; // Remove it , we don ' t actually want to render it tagNode . removeChild ( attribute ) ; return value ;
public class MessengerFactory { /** * Returns engine URL for another server , using server specification as input . * Server specification can be one of the following forms * a ) URL of the form t3 : / / host : port , iiop : / / host : port , rmi : / / host : port , http : / / host : port / context _ and _ path *...
String url ; int at = serverSpec . indexOf ( '@' ) ; if ( at > 0 ) { url = serverSpec . substring ( at + 1 ) ; } else { int colonDashDash = serverSpec . indexOf ( "://" ) ; if ( colonDashDash > 0 ) { url = serverSpec ; } else { url = PropertyManager . getProperty ( PropertyNames . MDW_REMOTE_SERVER + "." + serverSpec )...
public class DecimalConvertor { /** * Produces decimal digits for non - zero , finite floating point values . * The sign of the value is discarded . Passing in Infinity or NaN produces * invalid digits . The maximum number of decimal digits that this * function will likely produce is 18. * @ param v value * @...
// NOTE : The value 144115188075855872 is converted to // 144115188075855870 , which is as correct as possible . Java ' s // Double . toString method doesn ' t round off the last digit . long bits = Double . doubleToLongBits ( v ) ; long f = bits & 0xfffffffffffffL ; int e = ( int ) ( ( bits >> 52 ) & 0x7ff ) ; if ( e ...
public class NativeArray { /** * / * Support for generic Array - ish objects . Most of the Array * functions try to be generic ; anything that has a length * property is assumed to be an array . * getLengthProperty returns 0 if obj does not have the length property * or its value is not convertible to a number ...
// These will both give numeric lengths within Uint32 range . if ( obj instanceof NativeString ) { return ( ( NativeString ) obj ) . getLength ( ) ; } if ( obj instanceof NativeArray ) { return ( ( NativeArray ) obj ) . getLength ( ) ; } Object len = ScriptableObject . getProperty ( obj , "length" ) ; if ( len == Scrip...
public class ViaCEPGWTClient { /** * Executa a consulta de endereços a partir da UF , localidade e logradouro * @ param uf Unidade Federativa . Precisa ter 2 caracteres . * @ param localidade Localidade ( p . e . município ) . Precisa ter ao menos 3 caracteres . * @ param logradouro Logradouro ( p . e . rua , a...
if ( uf == null || uf . length ( ) != 2 ) { callback . onFailure ( null , new IllegalArgumentException ( "UF inválida - deve conter 2 caracteres: " + uf ) ) ; return ; } if ( localidade == null || localidade . length ( ) < 3 ) { callback . onFailure ( null , new IllegalArgumentException ( "Localidade inválida - deve co...
public class ThreadPool { /** * Wait for a shutdown pool to fully terminate , or until the timeout * has expired . This method may only be called < em > after < / em > invoking * shutdownNow or * shutdownAfterProcessingCurrentlyQueuedTasks . * @ param maxWaitTime * the maximum time in milliseconds to wait *...
if ( ! shutdown_ ) throw new IllegalStateException ( ) ; if ( poolSize_ == 0 ) return true ; long waitTime = maxWaitTime ; if ( waitTime <= 0 ) return false ; long start = System . currentTimeMillis ( ) ; for ( ; ; ) { wait ( waitTime ) ; if ( poolSize_ == 0 ) return true ; waitTime = maxWaitTime - ( System . currentTi...
public class TransformationPerformer { /** * Performs a transformation based merge of the given source object with the given target object based on the given * TransformationDescription . */ public Object transformObject ( TransformationDescription description , Object source , Object target ) throws InstantiationExc...
checkNeededValues ( description ) ; Class < ? > sourceClass = modelRegistry . loadModel ( description . getSourceModel ( ) ) ; Class < ? > targetClass = modelRegistry . loadModel ( description . getTargetModel ( ) ) ; if ( ! sourceClass . isAssignableFrom ( source . getClass ( ) ) ) { throw new IllegalArgumentException...
public class StringUtils { /** * Return a string that is no longer than capSize , and pad with " . . . " if * returning a substring . * @ param str * The string to cap * @ param capSize * The maximum cap size * @ return The string capped at capSize . */ public static String cap ( String str , int capSize ) ...
if ( str . length ( ) <= capSize ) { return str ; } if ( capSize <= 3 ) { return str . substring ( 0 , capSize ) ; } return str . substring ( 0 , capSize - 3 ) + "..." ;