signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class SimpleNsStreamWriter { /** * Element copier method implementation suitable to be used with
* namespace - aware writers in non - repairing ( explicit namespaces ) mode .
* The trickiest thing is having to properly
* order calls to < code > setPrefix < / code > , < code > writeNamespace < / code >
* and < code > writeStartElement < / code > ; the order writers expect is
* bit different from the order in which element information is
* passed in . */
@ Override public final void copyStartElement ( InputElementStack elemStack , AttributeCollector attrCollector ) throws IOException , XMLStreamException { } } | // Any namespace declarations / bindings ?
int nsCount = elemStack . getCurrentNsCount ( ) ; if ( nsCount > 0 ) { // yup , got some . . .
/* First , need to ( or at least , should ? ) add prefix bindings :
* ( may not be 100 % required , but probably a good thing to do ,
* just so that app code has access to prefixes then ) */
for ( int i = 0 ; i < nsCount ; ++ i ) { String prefix = elemStack . getLocalNsPrefix ( i ) ; String uri = elemStack . getLocalNsURI ( i ) ; if ( prefix == null || prefix . length ( ) == 0 ) { // default NS
setDefaultNamespace ( uri ) ; } else { setPrefix ( prefix , uri ) ; } } } writeStartElement ( elemStack . getPrefix ( ) , elemStack . getLocalName ( ) , elemStack . getNsURI ( ) ) ; if ( nsCount > 0 ) { // And then output actual namespace declarations :
for ( int i = 0 ; i < nsCount ; ++ i ) { String prefix = elemStack . getLocalNsPrefix ( i ) ; String uri = elemStack . getLocalNsURI ( i ) ; if ( prefix == null || prefix . length ( ) == 0 ) { // default NS
writeDefaultNamespace ( uri ) ; } else { writeNamespace ( prefix , uri ) ; } } } /* And then let ' s just output attributes , if any ( whether to copy
* implicit , aka " default " attributes , is configurable ) */
int attrCount = mCfgCopyDefaultAttrs ? attrCollector . getCount ( ) : attrCollector . getSpecifiedCount ( ) ; if ( attrCount > 0 ) { for ( int i = 0 ; i < attrCount ; ++ i ) { attrCollector . writeAttribute ( i , mWriter , mValidator ) ; } } |
public class TregexMatcher { /** * Find the next match of the pattern on the tree
* @ return whether there is a match somewhere in the tree */
public boolean find ( ) { } } | if ( findIterator == null ) { findIterator = root . iterator ( ) ; } if ( findCurrent != null && matches ( ) ) { return true ; } while ( findIterator . hasNext ( ) ) { findCurrent = findIterator . next ( ) ; resetChildIter ( findCurrent ) ; if ( matches ( ) ) { return true ; } } return false ; |
public class CmsChnav { /** * Performs the navigation change . < p >
* @ throws JspException if including a JSP subelement is not successful */
public void actionChangeNav ( ) throws JspException { } } | // save initialized instance of this class in request attribute for included sub - elements
getJsp ( ) . getRequest ( ) . setAttribute ( SESSION_WORKPLACE_CLASS , this ) ; // get request parameters
String filename = getParamResource ( ) ; // do not use # getParamNavText since it is decoded , see CmsWorkplace # fillParamValues ( HttpServletRequest )
String newText = getJsp ( ) . getRequest ( ) . getParameter ( PARAM_NAVTEXT ) ; String selectedPosString = getParamNavpos ( ) ; try { // lock resource if autolock is enabled
checkLock ( getParamResource ( ) ) ; // save the new NavText if not null
if ( newText != null ) { CmsProperty newNavText = new CmsProperty ( ) ; newNavText . setName ( CmsPropertyDefinition . PROPERTY_NAVTEXT ) ; CmsProperty oldNavText = getCms ( ) . readPropertyObject ( filename , CmsPropertyDefinition . PROPERTY_NAVTEXT , false ) ; if ( oldNavText . isNullProperty ( ) ) { // property value was not already set
if ( OpenCms . getWorkplaceManager ( ) . isDefaultPropertiesOnStructure ( ) ) { newNavText . setStructureValue ( newText ) ; } else { newNavText . setResourceValue ( newText ) ; } } else { if ( oldNavText . getStructureValue ( ) != null ) { newNavText . setStructureValue ( newText ) ; newNavText . setResourceValue ( oldNavText . getResourceValue ( ) ) ; } else { newNavText . setResourceValue ( newText ) ; } } String oldStructureValue = oldNavText . getStructureValue ( ) ; String newStructureValue = newNavText . getStructureValue ( ) ; if ( CmsStringUtil . isEmpty ( oldStructureValue ) ) { oldStructureValue = CmsProperty . DELETE_VALUE ; } if ( CmsStringUtil . isEmpty ( newStructureValue ) ) { newStructureValue = CmsProperty . DELETE_VALUE ; } String oldResourceValue = oldNavText . getResourceValue ( ) ; String newResourceValue = newNavText . getResourceValue ( ) ; if ( CmsStringUtil . isEmpty ( oldResourceValue ) ) { oldResourceValue = CmsProperty . DELETE_VALUE ; } if ( CmsStringUtil . isEmpty ( newResourceValue ) ) { newResourceValue = CmsProperty . DELETE_VALUE ; } // change nav text only if it has been changed
if ( ! oldResourceValue . equals ( newResourceValue ) || ! oldStructureValue . equals ( newStructureValue ) ) { getCms ( ) . writePropertyObject ( getParamResource ( ) , newNavText ) ; } } // determine the selected position
float selectedPos = - 1 ; try { selectedPos = Float . parseFloat ( selectedPosString ) ; } catch ( Exception e ) { // can usually be ignored
if ( LOG . isInfoEnabled ( ) ) { LOG . info ( e . getLocalizedMessage ( ) ) ; } } // only update the position if a change is requested
if ( selectedPos != - 1 ) { CmsProperty newNavPos = new CmsProperty ( ) ; newNavPos . setName ( CmsPropertyDefinition . PROPERTY_NAVPOS ) ; CmsProperty oldNavPos = getCms ( ) . readPropertyObject ( filename , CmsPropertyDefinition . PROPERTY_NAVPOS , false ) ; if ( oldNavPos . isNullProperty ( ) ) { // property value was not already set
if ( OpenCms . getWorkplaceManager ( ) . isDefaultPropertiesOnStructure ( ) ) { newNavPos . setStructureValue ( selectedPosString ) ; } else { newNavPos . setResourceValue ( selectedPosString ) ; } } else { if ( oldNavPos . getStructureValue ( ) != null ) { newNavPos . setStructureValue ( selectedPosString ) ; newNavPos . setResourceValue ( oldNavPos . getResourceValue ( ) ) ; } else { newNavPos . setResourceValue ( selectedPosString ) ; } } getCms ( ) . writePropertyObject ( filename , newNavPos ) ; } } catch ( Throwable e ) { // error during chnav , show error dialog
includeErrorpage ( this , e ) ; } // chnav operation was successful , return to workplace
actionCloseDialog ( ) ; |
public class ServerImpl { /** * Removes a member from the server .
* @ param user The user to remove . */
public void removeMember ( User user ) { } } | long userId = user . getId ( ) ; members . remove ( userId ) ; nicknames . remove ( userId ) ; selfMuted . remove ( userId ) ; selfDeafened . remove ( userId ) ; muted . remove ( userId ) ; deafened . remove ( userId ) ; getRoles ( ) . forEach ( role -> ( ( RoleImpl ) role ) . removeUserFromCache ( user ) ) ; joinedAtTimestamps . remove ( userId ) ; |
public class TaskLogsMonitor { /** * Check if truncation of logs is needed for the given jvmInfo . If all the
* tasks that ran in a JVM are within the log - limits , then truncation is not
* needed . Otherwise it is needed .
* @ param lInfo
* @ param taskLogFileDetails
* @ param logName
* @ return true if truncation is needed , false otherwise */
private boolean isTruncationNeeded ( PerJVMInfo lInfo , Map < Task , Map < LogName , LogFileDetail > > taskLogFileDetails , LogName logName ) { } } | boolean truncationNeeded = false ; LogFileDetail logFileDetail = null ; for ( Task task : lInfo . allAttempts ) { long taskRetainSize = ( task . isMapTask ( ) ? mapRetainSize : reduceRetainSize ) ; Map < LogName , LogFileDetail > allLogsFileDetails = taskLogFileDetails . get ( task ) ; logFileDetail = allLogsFileDetails . get ( logName ) ; if ( taskRetainSize > MINIMUM_RETAIN_SIZE_FOR_TRUNCATION && logFileDetail . length > taskRetainSize ) { truncationNeeded = true ; break ; } } return truncationNeeded ; |
public class MtasCodecPostingsFormat { /** * Gets the token .
* @ param inObject the in object
* @ param inTerm the in term
* @ param ref the ref
* @ return the token
* @ throws IOException Signals that an I / O exception has occurred . */
public static MtasTokenString getToken ( IndexInput inObject , IndexInput inTerm , Long ref ) throws IOException { } } | MtasTokenString token = null ; try { inObject . seek ( ref ) ; token = new MtasTokenString ( null , "" ) ; token . setId ( inObject . readVInt ( ) ) ; token . setTokenRef ( ref ) ; int objectFlags = inObject . readVInt ( ) ; int [ ] positions = null ; if ( ( objectFlags & MTAS_OBJECT_HAS_PARENT ) == MTAS_OBJECT_HAS_PARENT ) { int parentId = inObject . readVInt ( ) ; token . setParentId ( parentId ) ; } if ( ( objectFlags & MTAS_OBJECT_HAS_POSITION_RANGE ) == MTAS_OBJECT_HAS_POSITION_RANGE ) { int positionStart = inObject . readVInt ( ) ; int positionEnd = positionStart + inObject . readVInt ( ) ; token . addPositionRange ( positionStart , positionEnd ) ; } else if ( ( objectFlags & MTAS_OBJECT_HAS_POSITION_SET ) == MTAS_OBJECT_HAS_POSITION_SET ) { int size = inObject . readVInt ( ) ; int tmpPrevious = 0 ; positions = new int [ size ] ; for ( int t = 0 ; t < size ; t ++ ) { int position = tmpPrevious + inObject . readVInt ( ) ; tmpPrevious = position ; positions [ t ] = position ; } token . addPositions ( positions ) ; } else { int position = inObject . readVInt ( ) ; token . addPosition ( position ) ; } if ( ( objectFlags & MTAS_OBJECT_HAS_OFFSET ) == MTAS_OBJECT_HAS_OFFSET ) { int offsetStart = inObject . readVInt ( ) ; int offsetEnd = offsetStart + inObject . readVInt ( ) ; token . setOffset ( offsetStart , offsetEnd ) ; } if ( ( objectFlags & MTAS_OBJECT_HAS_REALOFFSET ) == MTAS_OBJECT_HAS_REALOFFSET ) { int realOffsetStart = inObject . readVInt ( ) ; int realOffsetEnd = realOffsetStart + inObject . readVInt ( ) ; token . setRealOffset ( realOffsetStart , realOffsetEnd ) ; } if ( ( objectFlags & MTAS_OBJECT_HAS_PAYLOAD ) == MTAS_OBJECT_HAS_PAYLOAD ) { int length = inObject . readVInt ( ) ; byte [ ] mtasPayload = new byte [ length ] ; inObject . readBytes ( mtasPayload , 0 , length ) ; token . setPayload ( new BytesRef ( mtasPayload ) ) ; } Long termRef = inObject . readVLong ( ) ; inTerm . seek ( termRef ) ; token . setTermRef ( termRef ) ; token . setValue ( inTerm . readString ( ) ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } return token ; |
public class UserBroker { /** * Reads and populate a collection of { @ link User } from excel file available at dataFilePath .
* @ param dataFilePath
* @ return collection of users . */
static Set < User > brokeUserList ( final String dataFilePath ) { } } | Set < User > users = new HashSet < User > ( ) ; Workbook workBook = null ; File file = new File ( dataFilePath ) ; InputStream excelDocumentStream = null ; try { excelDocumentStream = new FileInputStream ( file ) ; POIFSFileSystem fsPOI = new POIFSFileSystem ( new BufferedInputStream ( excelDocumentStream ) ) ; workBook = new HSSFWorkbook ( fsPOI ) ; UserBroker parser = new UserBroker ( workBook . getSheetAt ( 0 ) ) ; User user ; while ( ( user = parser . addUser ( users ) ) != null ) { users . add ( user ) ; } excelDocumentStream . close ( ) ; } catch ( Exception e ) { throw new RuntimeException ( "Error while processing brokeUserList(), Caused by :" , e ) ; } return users ; |
public class DefaultBootstrapFormGroupRenderer { /** * Retrieve an optional CSS class that is provided to the final node . This
* method is only called if a non - < code > null < / code > and non - empty error list
* is present .
* @ param aErrorList
* The error list . May be < code > null < / code > .
* @ return May be < code > null < / code > to indicate no CSS class . */
@ Nullable @ OverrideOnDemand protected EBootstrapFormGroupState getFormGroupStateFromErrorList ( @ Nullable final IErrorList aErrorList ) { } } | if ( aErrorList != null && ! aErrorList . isEmpty ( ) ) { if ( aErrorList . containsAtLeastOneError ( ) ) return EBootstrapFormGroupState . ERROR ; if ( aErrorList . containsAtLeastOneFailure ( ) ) return EBootstrapFormGroupState . WARNING ; } return null ; |
public class TcpPacketTransport { /** * ( non - Javadoc )
* @ see net . timewalker . ffmq4 . remote . transport . PacketTransport # start ( ) */
@ Override public void start ( ) throws PacketTransportException { } } | try { NetworkInputChannel inputChannel = new NetworkInputChannel ( initialPacketBufferSize , new TcpBufferedInputStream ( socket . getInputStream ( ) , streamRecvBufferSize ) ) ; NetworkOutputChannel outputChannel = new NetworkOutputChannel ( initialPacketBufferSize , new TcpBufferedOutputStream ( socket . getOutputStream ( ) , streamSendBufferSize ) ) ; sender = new TcpPacketSender ( this , outputChannel , listener , client ? pingInterval : - 1 , sendQueueMaxSize ) ; receiver = new TcpPacketReceiver ( this , inputChannel , listener , pingInterval , client ? - 1 : maxPacketSize ) ; senderThread = new Thread ( sender , "TcpPacketSender[" + ( client ? "client" : "server" ) + "]" ) ; senderThread . start ( ) ; receiverThread = new Thread ( receiver , "TcpPacketReceiver[" + ( client ? "client" : "server" ) + "]" ) ; receiverThread . start ( ) ; } catch ( Exception e ) { log . error ( "#" + id + " cannot start TCP packet I/O handlers" , e ) ; throw new PacketTransportException ( "Cannot start TCP packet I/O handlers : " + e . toString ( ) ) ; } |
public class Chunk { /** * Gets the text displacement relative to the baseline .
* @ return a displacement in points */
public float getTextRise ( ) { } } | if ( attributes != null && attributes . containsKey ( SUBSUPSCRIPT ) ) { Float f = ( Float ) attributes . get ( SUBSUPSCRIPT ) ; return f . floatValue ( ) ; } return 0.0f ; |
public class Descriptor { /** * Add the given manual ACLs .
* If auto ACLs are configured , these will be added in addition to the auto ACLs .
* @ param acls The ACLs to add .
* @ return A copy of this descriptor . */
public Descriptor withServiceAcls ( ServiceAcl ... acls ) { } } | return replaceAllAcls ( this . acls . plusAll ( Arrays . asList ( acls ) ) ) ; |
public class TrackedTorrent { /** * Load a tracked torrent from the given torrent file .
* @ param torrent The abstract { @ link File } object representing the
* < tt > . torrent < / tt > file to load .
* @ throws IOException When the torrent file cannot be read . */
public static TrackedTorrent load ( File torrent ) throws IOException { } } | TorrentMetadata torrentMetadata = new TorrentParser ( ) . parseFromFile ( torrent ) ; return new TrackedTorrent ( torrentMetadata . getInfoHash ( ) ) ; |
public class ScatterChartPanel { /** * Paints a tick with the specified length and value with respect to the given dimension .
* @ param g Graphics context
* @ param dim Reference dimension for tick painting
* @ param tickValue Value for the tick
* @ param tickLength Length of the tick */
protected void paintTick ( Graphics g , ValueDimension dim , Number tickValue , int tickLength ) { } } | String str = String . format ( getTickInfo ( dim ) . getFormat ( ) , tickValue . doubleValue ( ) ) ; int xPosition ; int yPosition ; Point descPos ; switch ( dim ) { case X : xPosition = getXFor ( tickValue ) ; yPosition = getPaintingRegion ( ) . getBottomLeft ( ) . y ; g . drawLine ( xPosition , yPosition , xPosition , yPosition + tickLength ) ; descPos = getPaintingRegion ( ) . getDescriptionPos ( dim , str , xPosition ) ; g . drawString ( str , descPos . x , descPos . y + tickLength ) ; break ; case Y : xPosition = getPaintingRegion ( ) . getBottomLeft ( ) . x ; yPosition = getYFor ( tickValue ) ; g . drawLine ( xPosition , yPosition , xPosition - tickLength , yPosition ) ; descPos = getPaintingRegion ( ) . getDescriptionPos ( dim , str , yPosition ) ; g . drawString ( str , descPos . x - tickLength , descPos . y + tickLength ) ; break ; } |
public class UpdateCertificateRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( UpdateCertificateRequest updateCertificateRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( updateCertificateRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateCertificateRequest . getCertificateId ( ) , CERTIFICATEID_BINDING ) ; protocolMarshaller . marshall ( updateCertificateRequest . getNewStatus ( ) , NEWSTATUS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ConcurrentCache { /** * Removes the specified key only if the current value equals the specified value .
* If the value does not match the current value , the removal will not occur .
* @ param key the key to be removed
* @ param val the value that must be matched by the current value for this key */
public boolean remove ( Object key , Object val ) { } } | String k = key . toString ( ) ; // synchronized ( this ) {
V item ; if ( ! containsKey ( k ) ) { return false ; } item = get ( k ) ; if ( val == null && item == null ) { remove ( k ) ; return true ; } if ( val == null || item == null ) { return false ; } if ( val . equals ( item ) ) { remove ( k ) ; return true ; } return false ; |
public class AllureResultsUtils { /** * Generate attachment extension from mime type
* @ param type valid mime - type
* @ return extension if it ' s known for specified mime - type , or empty string
* otherwise */
public static String getExtensionByMimeType ( String type ) { } } | MimeTypes types = getDefaultMimeTypes ( ) ; try { return types . forName ( type ) . getExtension ( ) ; } catch ( Exception e ) { LOGGER . warn ( "Can't detect extension for MIME-type " + type , e ) ; return "" ; } |
public class Table { /** * Returns a new table containing the first { @ code nrows } of data in this table */
public Table first ( int nRows ) { } } | int newRowCount = Math . min ( nRows , rowCount ( ) ) ; return inRange ( 0 , newRowCount ) ; |
public class DescribeCasesResult { /** * The details for the cases that match the request .
* @ return The details for the cases that match the request . */
public java . util . List < CaseDetails > getCases ( ) { } } | if ( cases == null ) { cases = new com . amazonaws . internal . SdkInternalList < CaseDetails > ( ) ; } return cases ; |
public class ELParser { /** * @ return The next token in the EL expression buffer . */
private Token nextToken ( ) { } } | skipSpaces ( ) ; if ( hasNextChar ( ) ) { char ch = nextChar ( ) ; if ( Character . isJavaIdentifierStart ( ch ) ) { StringBuffer buf = new StringBuffer ( ) ; buf . append ( ch ) ; while ( ( ch = peekChar ( ) ) != - 1 && Character . isJavaIdentifierPart ( ch ) ) { buf . append ( ch ) ; nextChar ( ) ; } return new Id ( buf . toString ( ) ) ; } if ( ch == '\'' || ch == '"' ) { return parseQuotedChars ( ch ) ; } else { // For now . . .
return new Char ( ch ) ; } } return null ; |
public class Cells { /** * Returns the { @ code InetAddress } value of the { @ link Cell } ( associated to { @ code table } ) whose name iscellName , or
* null if this Cells object contains no cell whose name is cellName .
* @ param nameSpace the name of the owning table
* @ param cellName the name of the Cell we want to retrieve from this Cells object .
* @ return the { @ code InetAddress } value of the { @ link Cell } ( associated to { @ code table } ) whose name is cellName ,
* or null if this Cells object contains no cell whose name is cellName */
public InetAddress getInetAddress ( String nameSpace , String cellName ) { } } | return getValue ( nameSpace , cellName , InetAddress . class ) ; |
public class CommerceNotificationAttachmentPersistenceImpl { /** * Returns the first commerce notification attachment in the ordered set where uuid = & # 63 ; .
* @ param uuid the uuid
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching commerce notification attachment , or < code > null < / code > if a matching commerce notification attachment could not be found */
@ Override public CommerceNotificationAttachment fetchByUuid_First ( String uuid , OrderByComparator < CommerceNotificationAttachment > orderByComparator ) { } } | List < CommerceNotificationAttachment > list = findByUuid ( uuid , 0 , 1 , orderByComparator ) ; if ( ! list . isEmpty ( ) ) { return list . get ( 0 ) ; } return null ; |
public class AbstractCrawl { /** * Get hold of the default options .
* @ return the options that needs to run a crawl */
@ Override protected Options getOptions ( ) { } } | final Options options = super . getOptions ( ) ; final Option urlOption = new Option ( "u" , "the page that is the startpoint of the crawl, examle http://mydomain.com/mypage" ) ; urlOption . setLongOpt ( URL ) ; urlOption . setArgName ( "URL" ) ; urlOption . setRequired ( true ) ; urlOption . setArgs ( 1 ) ; options . addOption ( urlOption ) ; final Option levelOption = new Option ( "l" , "how deep the crawl should be done, default is " + CrawlerConfiguration . DEFAULT_CRAWL_LEVEL + " [optional]" ) ; levelOption . setArgName ( "LEVEL" ) ; levelOption . setLongOpt ( LEVEL ) ; levelOption . setRequired ( false ) ; levelOption . setArgs ( 1 ) ; options . addOption ( levelOption ) ; final Option followOption = new Option ( "p" , "stay on this path when crawling [optional]" ) ; followOption . setArgName ( "PATH" ) ; followOption . setLongOpt ( FOLLOW_PATH ) ; followOption . setRequired ( false ) ; followOption . setArgs ( 1 ) ; options . addOption ( followOption ) ; final Option noFollowOption = new Option ( "np" , "no url:s on this path will be crawled [optional]" ) ; noFollowOption . setArgName ( "NOPATH" ) ; noFollowOption . setLongOpt ( NO_FOLLOW_PATH ) ; noFollowOption . setRequired ( false ) ; noFollowOption . setArgs ( 1 ) ; options . addOption ( noFollowOption ) ; final Option verifyOption = new Option ( "v" , "verify that all links are returning 200, default is set to " + CrawlerConfiguration . DEFAULT_SHOULD_VERIFY_URLS + " [optional]" ) ; verifyOption . setArgName ( "VERIFY" ) ; verifyOption . setLongOpt ( VERIFY ) ; verifyOption . setRequired ( false ) ; verifyOption . setArgs ( 1 ) ; options . addOption ( verifyOption ) ; final Option requestHeadersOption = new Option ( "rh" , "the request headers by the form of header1:value1@header2:value2 [optional]" ) ; requestHeadersOption . setArgName ( "REQUEST-HEADERS" ) ; requestHeadersOption . setLongOpt ( REQUEST_HEADERS ) ; requestHeadersOption . setRequired ( false ) ; requestHeadersOption . setArgs ( 1 ) ; options . addOption ( requestHeadersOption ) ; return options ; |
public class AbstractSamlObjectBuilder { /** * Gets saml object QName .
* @ param objectType the object type
* @ return the saml object QName */
public QName getSamlObjectQName ( final Class objectType ) { } } | try { val f = objectType . getField ( DEFAULT_ELEMENT_NAME_FIELD ) ; return ( QName ) f . get ( null ) ; } catch ( final NoSuchFieldException e ) { throw new IllegalStateException ( "Cannot find field " + objectType . getName ( ) + '.' + DEFAULT_ELEMENT_NAME_FIELD , e ) ; } catch ( final IllegalAccessException e ) { throw new IllegalStateException ( "Cannot access field " + objectType . getName ( ) + '.' + DEFAULT_ELEMENT_NAME_FIELD , e ) ; } |
public class PojoSerializerSnapshotData { /** * Creates a { @ link PojoSerializerSnapshotData } from serialized data stream .
* < p > This factory method is meant to be used in regular read paths , i . e . when reading back a snapshot
* of the { @ link PojoSerializer } . POJO fields , registered subclass classes , and non - registered subclass
* classes may no longer be present anymore . */
static < T > PojoSerializerSnapshotData < T > createFrom ( DataInputView in , ClassLoader userCodeClassLoader ) throws IOException { } } | return PojoSerializerSnapshotData . readSnapshotData ( in , userCodeClassLoader ) ; |
public class HelpCommand { /** * Returns the command and description of all supplied commands as a formatted String
* @ param botCommands the Commands that should be included in the String
* @ return a formatted String containing command and description for all supplied commands */
public static String getHelpText ( IBotCommand ... botCommands ) { } } | StringBuilder reply = new StringBuilder ( ) ; for ( IBotCommand com : botCommands ) { reply . append ( com . toString ( ) ) . append ( System . lineSeparator ( ) ) . append ( System . lineSeparator ( ) ) ; } return reply . toString ( ) ; |
public class DependencyVisitor { public void addNameSpace ( Set < String > names ) { } } | for ( String name : names ) { this . nameSpace . add ( name . replace ( '.' , '/' ) ) ; } |
public class ExternalType { /** * { @ inheritDoc } */
@ Override public final void to ( ObjectOutput out , WriteCache cache ) throws IOException { } } | if ( cache == null ) { to ( out ) ; return ; } if ( out == null ) throw new NullPointerException ( ) ; // delegate to the equivalent internal method
_to ( out , cache ) ; |
public class CrsUtilities { /** * Get the code from a { @ link CoordinateReferenceSystem } .
* @ param crs the crs to get the code from .
* @ return the code , that can be used with { @ link CRS # decode ( String ) } to recreate the crs .
* @ throws Exception */
public static String getCodeFromCrs ( CoordinateReferenceSystem crs ) throws Exception { } } | String code = null ; try { Integer epsg = CRS . lookupEpsgCode ( crs , true ) ; code = "EPSG:" + epsg ; // $ NON - NLS - 1 $
} catch ( Exception e ) { // try non epsg
code = CRS . lookupIdentifier ( crs , true ) ; } return code ; |
public class IntegrationAccountsInner { /** * Updates an integration account .
* @ param resourceGroupName The resource group name .
* @ param integrationAccountName The integration account name .
* @ param integrationAccount The integration account .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the IntegrationAccountInner object */
public Observable < IntegrationAccountInner > updateAsync ( String resourceGroupName , String integrationAccountName , IntegrationAccountInner integrationAccount ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , integrationAccountName , integrationAccount ) . map ( new Func1 < ServiceResponse < IntegrationAccountInner > , IntegrationAccountInner > ( ) { @ Override public IntegrationAccountInner call ( ServiceResponse < IntegrationAccountInner > response ) { return response . body ( ) ; } } ) ; |
public class filterprebodyinjection { /** * Use this API to unset the properties of filterprebodyinjection resource .
* Properties that need to be unset are specified in args array . */
public static base_response unset ( nitro_service client , filterprebodyinjection resource , String [ ] args ) throws Exception { } } | filterprebodyinjection unsetresource = new filterprebodyinjection ( ) ; return unsetresource . unset_resource ( client , args ) ; |
public class CassandraJavaPairRDD { /** * Forces the rows within a selected Cassandra partition to be returned in ascending order ( if
* possible ) . */
@ SuppressWarnings ( "unchecked" ) public CassandraJavaPairRDD < K , V > withAscOrder ( ) { } } | CassandraRDD < Tuple2 < K , V > > newRDD = rdd ( ) . withAscOrder ( ) ; return wrap ( newRDD ) ; |
public class Partition { /** * The values of the partition .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setValues ( java . util . Collection ) } or { @ link # withValues ( java . util . Collection ) } if you want to override the
* existing values .
* @ param values
* The values of the partition .
* @ return Returns a reference to this object so that method calls can be chained together . */
public Partition withValues ( String ... values ) { } } | if ( this . values == null ) { setValues ( new java . util . ArrayList < String > ( values . length ) ) ; } for ( String ele : values ) { this . values . add ( ele ) ; } return this ; |
public class Messages { /** * Retrieves a message which takes several arguments .
* @ param msg
* String the key to look up .
* @ param args
* Object [ ] the objects to insert in the formatted output .
* @ return String the message for that key in the system message bundle . */
static public String getString ( String msg , Object [ ] args ) { } } | String format = msg ; if ( bundle != null ) { try { format = bundle . getString ( msg ) ; } catch ( MissingResourceException e ) { } } return format ( format , args ) ; |
public class GangliaXmlConfigurationService { /** * UDPAddressingMode to use for reporting
* @ return { @ link info . ganglia . gmetric4j . gmetric . UDPAddressingMode . UNICAST }
* or
* { @ link info . ganglia . gmetric4j . gmetric . UDPAddressingMode . MULTICAST } */
private UDPAddressingMode getAddressingMode ( ) { } } | String mode = getGangliaConfig ( args . getMode ( ) , ganglia , "mode" , DEFAULT_MODE ) ; if ( mode . toLowerCase ( ) . equals ( "unicast" ) ) { return UDPAddressingMode . UNICAST ; } else { return UDPAddressingMode . MULTICAST ; } |
public class hqlParser { /** * hql . g : 232:1 : queryRule : selectFrom ( whereClause ) ? ( groupByClause ) ? ( havingClause ) ? ( orderByClause ) ? ( skipClause ) ? ( takeClause ) ? ; */
public final hqlParser . queryRule_return queryRule ( ) throws RecognitionException { } } | hqlParser . queryRule_return retval = new hqlParser . queryRule_return ( ) ; retval . start = input . LT ( 1 ) ; CommonTree root_0 = null ; ParserRuleReturnScope selectFrom38 = null ; ParserRuleReturnScope whereClause39 = null ; ParserRuleReturnScope groupByClause40 = null ; ParserRuleReturnScope havingClause41 = null ; ParserRuleReturnScope orderByClause42 = null ; ParserRuleReturnScope skipClause43 = null ; ParserRuleReturnScope takeClause44 = null ; try { // hql . g : 233:2 : ( selectFrom ( whereClause ) ? ( groupByClause ) ? ( havingClause ) ? ( orderByClause ) ? ( skipClause ) ? ( takeClause ) ? )
// hql . g : 233:4 : selectFrom ( whereClause ) ? ( groupByClause ) ? ( havingClause ) ? ( orderByClause ) ? ( skipClause ) ? ( takeClause ) ?
{ root_0 = ( CommonTree ) adaptor . nil ( ) ; pushFollow ( FOLLOW_selectFrom_in_queryRule904 ) ; selectFrom38 = selectFrom ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , selectFrom38 . getTree ( ) ) ; // hql . g : 234:3 : ( whereClause ) ?
int alt9 = 2 ; int LA9_0 = input . LA ( 1 ) ; if ( ( LA9_0 == WHERE ) ) { alt9 = 1 ; } switch ( alt9 ) { case 1 : // hql . g : 234:4 : whereClause
{ pushFollow ( FOLLOW_whereClause_in_queryRule909 ) ; whereClause39 = whereClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , whereClause39 . getTree ( ) ) ; } break ; } // hql . g : 235:3 : ( groupByClause ) ?
int alt10 = 2 ; int LA10_0 = input . LA ( 1 ) ; if ( ( LA10_0 == GROUP ) ) { alt10 = 1 ; } switch ( alt10 ) { case 1 : // hql . g : 235:4 : groupByClause
{ pushFollow ( FOLLOW_groupByClause_in_queryRule916 ) ; groupByClause40 = groupByClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , groupByClause40 . getTree ( ) ) ; } break ; } // hql . g : 236:3 : ( havingClause ) ?
int alt11 = 2 ; int LA11_0 = input . LA ( 1 ) ; if ( ( LA11_0 == HAVING ) ) { alt11 = 1 ; } switch ( alt11 ) { case 1 : // hql . g : 236:4 : havingClause
{ pushFollow ( FOLLOW_havingClause_in_queryRule923 ) ; havingClause41 = havingClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , havingClause41 . getTree ( ) ) ; } break ; } // hql . g : 237:3 : ( orderByClause ) ?
int alt12 = 2 ; int LA12_0 = input . LA ( 1 ) ; if ( ( LA12_0 == ORDER ) ) { alt12 = 1 ; } switch ( alt12 ) { case 1 : // hql . g : 237:4 : orderByClause
{ pushFollow ( FOLLOW_orderByClause_in_queryRule930 ) ; orderByClause42 = orderByClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , orderByClause42 . getTree ( ) ) ; } break ; } // hql . g : 238:3 : ( skipClause ) ?
int alt13 = 2 ; int LA13_0 = input . LA ( 1 ) ; if ( ( LA13_0 == SKIP ) ) { alt13 = 1 ; } switch ( alt13 ) { case 1 : // hql . g : 238:4 : skipClause
{ pushFollow ( FOLLOW_skipClause_in_queryRule937 ) ; skipClause43 = skipClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , skipClause43 . getTree ( ) ) ; } break ; } // hql . g : 239:3 : ( takeClause ) ?
int alt14 = 2 ; int LA14_0 = input . LA ( 1 ) ; if ( ( LA14_0 == TAKE ) ) { alt14 = 1 ; } switch ( alt14 ) { case 1 : // hql . g : 239:4 : takeClause
{ pushFollow ( FOLLOW_takeClause_in_queryRule944 ) ; takeClause44 = takeClause ( ) ; state . _fsp -- ; adaptor . addChild ( root_0 , takeClause44 . getTree ( ) ) ; } break ; } } retval . stop = input . LT ( - 1 ) ; retval . tree = ( CommonTree ) adaptor . rulePostProcessing ( root_0 ) ; adaptor . setTokenBoundaries ( retval . tree , retval . start , retval . stop ) ; } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; retval . tree = ( CommonTree ) adaptor . errorNode ( input , retval . start , input . LT ( - 1 ) , re ) ; } finally { // do for sure before leaving
} return retval ; |
public class UnprocessableEntityException { /** * A collection of validation error responses .
* @ param validationErrors
* A collection of validation error responses . */
@ com . fasterxml . jackson . annotation . JsonProperty ( "validationErrors" ) public void setValidationErrors ( java . util . Collection < ValidationError > validationErrors ) { } } | if ( validationErrors == null ) { this . validationErrors = null ; return ; } this . validationErrors = new java . util . ArrayList < ValidationError > ( validationErrors ) ; |
public class AbstractExternalHighlightingFragment2 { /** * Concat the given iterables .
* @ param iterables the iterables .
* @ return the concat result . */
@ SafeVarargs protected static Set < String > sortedConcat ( Iterable < String > ... iterables ) { } } | final Set < String > set = new TreeSet < > ( ) ; for ( final Iterable < String > iterable : iterables ) { for ( final String obj : iterable ) { set . add ( obj ) ; } } return set ; |
public class File { /** * TODO : is this really necessary , or can it be replaced with getAbsolutePath ? */
private String getAbsoluteName ( ) { } } | File f = getAbsoluteFile ( ) ; String name = f . getPath ( ) ; if ( f . isDirectory ( ) && name . charAt ( name . length ( ) - 1 ) != separatorChar ) { // Directories must end with a slash
name = name + "/" ; } if ( separatorChar != '/' ) { // Must convert slashes .
name = name . replace ( separatorChar , '/' ) ; } return name ; |
public class UpstreamComitterRecipientProvider { /** * Adds a user to the recipients list based on a specific SCM change set
* @ param change The ChangeLogSet . Entry to get the user information from
* @ param to The list of to addresses to add to
* @ param cc The list of cc addresses to add to
* @ param bcc The list of bcc addresses to add to
* @ param env The build environment
* @ param listener The listener for logging */
private void addUserFromChangeSet ( ChangeLogSet . Entry change , Set < InternetAddress > to , Set < InternetAddress > cc , Set < InternetAddress > bcc , EnvVars env , final ExtendedEmailPublisherContext context , RecipientProviderUtilities . IDebug debug ) { } } | User user = change . getAuthor ( ) ; RecipientProviderUtilities . addUsers ( Collections . singleton ( user ) , context , env , to , cc , bcc , debug ) ; |
public class Transfers { /** * So far , only the route is supported . */
List < Transfer > getTransfersToStop ( String toStopId , String toRouteId ) { } } | final List < Transfer > allInboundTransfers = transfersToStop . getOrDefault ( toStopId , Collections . emptyList ( ) ) ; final Map < String , List < Transfer > > byFromStop = allInboundTransfers . stream ( ) . filter ( t -> t . transfer_type == 0 || t . transfer_type == 2 ) . filter ( t -> t . to_route_id == null || toRouteId . equals ( t . to_route_id ) ) . collect ( Collectors . groupingBy ( t -> t . from_stop_id ) ) ; final List < Transfer > result = new ArrayList < > ( ) ; byFromStop . forEach ( ( fromStop , transfers ) -> { routesByStop . getOrDefault ( fromStop , Collections . emptySet ( ) ) . forEach ( fromRoute -> { final Transfer mostSpecificRule = findMostSpecificRule ( transfers , fromRoute , toRouteId ) ; final Transfer myRule = new Transfer ( ) ; myRule . to_route_id = toRouteId ; myRule . from_route_id = fromRoute ; myRule . to_stop_id = mostSpecificRule . to_stop_id ; myRule . from_stop_id = mostSpecificRule . from_stop_id ; myRule . transfer_type = mostSpecificRule . transfer_type ; myRule . min_transfer_time = mostSpecificRule . min_transfer_time ; myRule . from_trip_id = mostSpecificRule . from_trip_id ; myRule . to_trip_id = mostSpecificRule . to_trip_id ; result . add ( myRule ) ; } ) ; } ) ; return result ; |
public class ClassUtils { /** * Same as { @ link # javaTypeToClass ( String ) } , but throws a RuntimeException
* ( FacesException ) instead of a ClassNotFoundException .
* @ return the corresponding Class
* @ throws NullPointerException if type is null
* @ throws FacesException if class not found */
public static Class simpleJavaTypeToClass ( String type ) { } } | try { return javaTypeToClass ( type ) ; } catch ( ClassNotFoundException e ) { log . log ( Level . SEVERE , "Class " + type + " not found" , e ) ; throw new FacesException ( e ) ; } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link MatrixType } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.w3.org/1998/Math/MathML" , name = "matrix" ) public JAXBElement < MatrixType > createMatrix ( MatrixType value ) { } } | return new JAXBElement < MatrixType > ( _Matrix_QNAME , MatrixType . class , null , value ) ; |
public class GLTextureView { /** * Install a config chooser which will choose a config
* with at least the specified depthSize and stencilSize ,
* and exactly the specified redSize , greenSize , blueSize and alphaSize .
* < p > If this method is
* called , it must be called before { @ link # setRenderer ( Renderer ) }
* is called .
* If no setEGLConfigChooser method is called , then by default the
* view will choose an RGB _ 888 surface with a depth buffer depth of
* at least 16 bits . */
public void setEGLConfigChooser ( int redSize , int greenSize , int blueSize , int alphaSize , int depthSize , int stencilSize ) { } } | setEGLConfigChooser ( new ComponentSizeChooser ( redSize , greenSize , blueSize , alphaSize , depthSize , stencilSize ) ) ; |
public class RefineDualQuadraticAlgebra { /** * Compuets the absolute dual quadratic from the first camera parameters and
* plane at infinity
* @ param p plane at infinity
* @ param Q ( Output ) ABQ */
void recomputeQ ( DMatrixRMaj p , DMatrix4x4 Q ) { } } | Equation eq = new Equation ( ) ; DMatrix3x3 K = new DMatrix3x3 ( ) ; encodeK ( K , 0 , 3 , param . data ) ; eq . alias ( p , "p" , K , "K" ) ; eq . process ( "w=K*K'" ) ; eq . process ( "Q=[w , -w*p;-p'*w , p'*w*p]" ) ; DMatrixRMaj _Q = eq . lookupDDRM ( "Q" ) ; CommonOps_DDRM . divide ( _Q , NormOps_DDRM . normF ( _Q ) ) ; ConvertDMatrixStruct . convert ( _Q , Q ) ; |
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public EClass getIfcTextFontName ( ) { } } | if ( ifcTextFontNameEClass == null ) { ifcTextFontNameEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 877 ) ; } return ifcTextFontNameEClass ; |
public class Pubsub { /** * Create a Pub / Sub subscription .
* @ param project The Google Cloud project .
* @ param subscriptionName The name of the subscription to create .
* @ param topic The name of the topic to subscribe to .
* @ return A future that is completed when this request is completed . */
public PubsubFuture < Subscription > createSubscription ( final String project , final String subscriptionName , final String topic ) { } } | return createSubscription ( canonicalSubscription ( project , subscriptionName ) , canonicalTopic ( project , topic ) ) ; |
public class NettyAssociationImpl { /** * ( non - Javadoc )
* @ see org . mobicents . protocols . api . Association # send ( org . mobicents . protocols . api . PayloadData ) */
@ Override public void send ( PayloadData payloadData ) throws Exception { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( String . format ( "Tx : Ass=%s %s" , this . getName ( ) , payloadData ) ) ; } NettySctpChannelInboundHandlerAdapter handler = checkSocketIsOpen ( ) ; final ByteBuf byteBuf = payloadData . getByteBuf ( ) ; if ( this . ipChannelType == IpChannelType . SCTP ) { SctpMessage sctpMessage = new SctpMessage ( payloadData . getPayloadProtocolId ( ) , payloadData . getStreamNumber ( ) , payloadData . isUnordered ( ) , byteBuf ) ; handler . writeAndFlush ( sctpMessage ) ; } else { handler . writeAndFlush ( byteBuf ) ; } |
public class JobCoordinator { /** * Updates the status of the job . When all the tasks are completed , run the join method in the
* definition . */
private void updateStatus ( ) { } } | int completed = 0 ; List < TaskInfo > taskInfoList = mJobInfo . getTaskInfoList ( ) ; for ( TaskInfo info : taskInfoList ) { switch ( info . getStatus ( ) ) { case FAILED : mJobInfo . setStatus ( Status . FAILED ) ; if ( mJobInfo . getErrorMessage ( ) . isEmpty ( ) ) { mJobInfo . setErrorMessage ( "Task execution failed: " + info . getErrorMessage ( ) ) ; } return ; case CANCELED : if ( mJobInfo . getStatus ( ) != Status . FAILED ) { mJobInfo . setStatus ( Status . CANCELED ) ; } return ; case RUNNING : if ( mJobInfo . getStatus ( ) != Status . FAILED && mJobInfo . getStatus ( ) != Status . CANCELED ) { mJobInfo . setStatus ( Status . RUNNING ) ; } break ; case COMPLETED : completed ++ ; break ; case CREATED : // do nothing
break ; default : throw new IllegalArgumentException ( "Unsupported status " + info . getStatus ( ) ) ; } } if ( completed == taskInfoList . size ( ) ) { if ( mJobInfo . getStatus ( ) == Status . COMPLETED ) { return ; } // all the tasks completed , run join
try { mJobInfo . setStatus ( Status . COMPLETED ) ; mJobInfo . setResult ( join ( taskInfoList ) ) ; } catch ( Exception e ) { mJobInfo . setStatus ( Status . FAILED ) ; mJobInfo . setErrorMessage ( e . getMessage ( ) ) ; } } |
public class Util { /** * Compute the bitwise ANDNOT between two long arrays and write the set bits in the container .
* @ param container where we write
* @ param bitmap1 first bitmap
* @ param bitmap2 second bitmap */
public static void fillArrayANDNOT ( final short [ ] container , final long [ ] bitmap1 , final long [ ] bitmap2 ) { } } | int pos = 0 ; if ( bitmap1 . length != bitmap2 . length ) { throw new IllegalArgumentException ( "not supported" ) ; } for ( int k = 0 ; k < bitmap1 . length ; ++ k ) { long bitset = bitmap1 [ k ] & ( ~ bitmap2 [ k ] ) ; while ( bitset != 0 ) { container [ pos ++ ] = ( short ) ( k * 64 + numberOfTrailingZeros ( bitset ) ) ; bitset &= ( bitset - 1 ) ; } } |
public class sent_sms { /** * < pre >
* Performs generic data validation for the operation to be performed
* < / pre > */
protected void validate ( String operationType ) throws Exception { } } | super . validate ( operationType ) ; MPSString id_validator = new MPSString ( ) ; id_validator . setConstraintIsReq ( MPSConstants . DELETE_CONSTRAINT , true ) ; id_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; id_validator . validate ( operationType , id , "\"id\"" ) ; MPSInternetHost server_name_validator = new MPSInternetHost ( ) ; server_name_validator . setConstraintIsReq ( MPSConstants . ADD_CONSTRAINT , true ) ; server_name_validator . validate ( operationType , server_name , "\"server_name\"" ) ; MPSString username_validator = new MPSString ( ) ; username_validator . setConstraintCharSetRegEx ( MPSConstants . GENERIC_CONSTRAINT , "[ a-zA-Z0-9_#.:@=-]+" ) ; username_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; username_validator . validate ( operationType , username , "\"username\"" ) ; MPSString profile_name_validator = new MPSString ( ) ; profile_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; profile_name_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; profile_name_validator . setConstraintIsReq ( MPSConstants . ADD_CONSTRAINT , true ) ; profile_name_validator . validate ( operationType , profile_name , "\"profile_name\"" ) ; MPSString to_list_validator = new MPSString ( ) ; to_list_validator . validate ( operationType , to_list , "\"to_list\"" ) ; MPSString url_validator = new MPSString ( ) ; url_validator . validate ( operationType , url , "\"url\"" ) ; MPSString message_validator = new MPSString ( ) ; message_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 20000 ) ; message_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; message_validator . validate ( operationType , message , "\"message\"" ) ; MPSBoolean is_sent_validator = new MPSBoolean ( ) ; is_sent_validator . validate ( operationType , is_sent , "\"is_sent\"" ) ; MPSLong timestamp_validator = new MPSLong ( ) ; timestamp_validator . validate ( operationType , timestamp , "\"timestamp\"" ) ; MPSString failed_message_validator = new MPSString ( ) ; failed_message_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 2000 ) ; failed_message_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; failed_message_validator . validate ( operationType , failed_message , "\"failed_message\"" ) ; MPSBoolean is_ssl_validator = new MPSBoolean ( ) ; is_ssl_validator . validate ( operationType , is_ssl , "\"is_ssl\"" ) ; |
public class ClassServiceUtility { /** * Doesn ' t need to be static since this is only created once */
public org . jbundle . util . osgi . ClassFinder getClassFinder ( Object context ) { } } | if ( ! classServiceAvailable ) return null ; try { if ( classFinder == null ) { Class . forName ( "org.osgi.framework.BundleActivator" ) ; // This tests to see if osgi exists
// classFinder = ( org . jbundle . util . osgi . ClassFinder ) org . jbundle . util . osgi . finder . ClassFinderActivator . getClassFinder ( context , - 1 ) ;
try { // Use reflection so the smart jvm ' s don ' t try to retrieve this class .
Class < ? > clazz = Class . forName ( "org.jbundle.util.osgi.finder.ClassFinderActivator" ) ; // This tests to see if osgi exists
if ( clazz != null ) { java . lang . reflect . Method method = clazz . getMethod ( "getClassFinder" , Object . class , int . class ) ; if ( method != null ) classFinder = ( org . jbundle . util . osgi . ClassFinder ) method . invoke ( null , context , - 1 ) ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } return classFinder ; } catch ( ClassNotFoundException ex ) { classServiceAvailable = false ; // Osgi is not installed , no need to keep trying
return null ; } catch ( Exception ex ) { ex . printStackTrace ( ) ; return null ; } |
public class Job { /** * Check the state of this running job . The state may
* remain the same , become SUCCESS or FAILED . */
private void checkRunningState ( ) { } } | RunningJob running = null ; try { running = jc . getJob ( this . mapredJobID ) ; if ( running . isComplete ( ) ) { if ( running . isSuccessful ( ) ) { this . state = Job . SUCCESS ; } else { this . state = Job . FAILED ; this . message = "Job failed!" ; try { running . killJob ( ) ; } catch ( IOException e1 ) { } try { this . jc . close ( ) ; } catch ( IOException e2 ) { } } } } catch ( IOException ioe ) { this . state = Job . FAILED ; this . message = StringUtils . stringifyException ( ioe ) ; try { if ( running != null ) running . killJob ( ) ; } catch ( IOException e1 ) { } try { this . jc . close ( ) ; } catch ( IOException e1 ) { } } |
public class ListT { /** * / * ( non - Javadoc )
* @ see cyclops2 . monads . transformers . values . ListT # scanRight ( cyclops2 . function . Monoid ) */
@ Override public ListT < W , T > scanRight ( final Monoid < T > monoid ) { } } | return ( ListT < W , T > ) FoldableTransformerSeq . super . scanRight ( monoid ) ; |
public class FileDirObjectStore { /** * Capture the ManagedObjects to write and delete as part of the checkpoint . */
synchronized void captureCheckpointManagedObjects ( ) { } } | if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . entry ( this , cclass , "captureCheckpointManagedObjectsremove" ) ; // Now that we are synchronized check that we have not captured the checkpoint sets already .
if ( checkpointManagedObjectsToWrite == null ) { // Take the tokens to write first , if we miss a delete we will catch it next time .
// The managedObjectsToWrite and tokensToDelete sets are volatile so users of the store will move to them
// promptly .
checkpointManagedObjectsToWrite = managedObjectsToWrite ; managedObjectsToWrite = new ConcurrentHashMap ( concurrency ) ; checkpointTokensToDelete = tokensToDelete ; tokensToDelete = new ConcurrentHashMap ( concurrency ) ; } if ( Tracing . isAnyTracingEnabled ( ) && trace . isEntryEnabled ( ) ) trace . exit ( this , cclass , "captureCheckpointManagedObjects" ) ; |
public class SmsClient { /** * Get the statistics about receiving message
* @ param request refer to < code > com . baidubce . services . sms . model . StatReceiverRequest < / code >
* @ return refer to < code > com . baidubce . services . sms . model . StatReceiverResponse < / code >
* @ see com . baidubce . services . sms . model . StatReceiverRequest
* @ see com . baidubce . services . sms . model . StatReceiverResponse */
public StatReceiverResponse statReceiver ( StatReceiverRequest request ) { } } | checkNotNull ( request , "object request should not be null." ) ; assertStringNotNullOrEmpty ( request . getPhoneNumber ( ) , "object phoneNumber should not be null or empty." ) ; InternalRequest internalRequest = this . createRequest ( "receiver" , request , HttpMethodName . GET , request . getPhoneNumber ( ) ) ; return this . invokeHttpClient ( internalRequest , StatReceiverResponse . class ) ; |
public class MessageReaction { /** * Removes this Reaction from the Message .
* < br > This will remove the reaction of the { @ link net . dv8tion . jda . core . entities . User User }
* provided .
* < p > If the provided User did not react with this Reaction this does nothing .
* < p > Possible ErrorResponses include :
* < ul >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ MESSAGE UNKNOWN _ MESSAGE }
* < br > If the message this reaction was attached to got deleted . < / li >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # UNKNOWN _ CHANNEL UNKNOWN _ CHANNEL }
* < br > If the channel this reaction was used in got deleted . < / li >
* < li > { @ link net . dv8tion . jda . core . requests . ErrorResponse # MISSING _ ACCESS MISSING _ ACCESS }
* < br > If we were removed from the channel / guild < / li >
* < / ul >
* @ param user
* The User of which to remove the reaction
* @ throws java . lang . IllegalArgumentException
* If the provided { @ code user } is null .
* @ throws net . dv8tion . jda . core . exceptions . InsufficientPermissionException
* if the provided User is not us and we do not have permission to
* { @ link net . dv8tion . jda . core . Permission # MESSAGE _ MANAGE manage messages }
* in the channel this reaction was used in
* @ return { @ link net . dv8tion . jda . core . requests . RestAction RestAction } - Type : Void
* Nothing is returned on success */
@ CheckReturnValue public RestAction < Void > removeReaction ( User user ) { } } | if ( user == null ) throw new IllegalArgumentException ( "Provided User was null!" ) ; if ( ! user . equals ( getJDA ( ) . getSelfUser ( ) ) ) { if ( channel . getType ( ) == ChannelType . TEXT ) { Channel channel = ( Channel ) this . channel ; if ( ! channel . getGuild ( ) . getSelfMember ( ) . hasPermission ( channel , Permission . MESSAGE_MANAGE ) ) throw new InsufficientPermissionException ( Permission . MESSAGE_MANAGE ) ; } else { throw new PermissionException ( "Unable to remove Reaction of other user in non-text channel!" ) ; } } String code = emote . isEmote ( ) ? emote . getName ( ) + ":" + emote . getId ( ) : MiscUtil . encodeUTF8 ( emote . getName ( ) ) ; Route . CompiledRoute route ; if ( user . equals ( getJDA ( ) . getSelfUser ( ) ) ) route = Route . Messages . REMOVE_OWN_REACTION . compile ( channel . getId ( ) , getMessageId ( ) , code ) ; else route = Route . Messages . REMOVE_REACTION . compile ( channel . getId ( ) , getMessageId ( ) , code , user . getId ( ) ) ; return new RestAction < Void > ( getJDA ( ) , route ) { @ Override protected void handleResponse ( Response response , Request < Void > request ) { if ( response . isOk ( ) ) request . onSuccess ( null ) ; else request . onFailure ( response ) ; } } ; |
public class AssemblyDescriptorTypeImpl { /** * Returns all < code > method - permission < / code > elements
* @ return list of < code > method - permission < / code > */
public List < MethodPermissionType < AssemblyDescriptorType < T > > > getAllMethodPermission ( ) { } } | List < MethodPermissionType < AssemblyDescriptorType < T > > > list = new ArrayList < MethodPermissionType < AssemblyDescriptorType < T > > > ( ) ; List < Node > nodeList = childNode . get ( "method-permission" ) ; for ( Node node : nodeList ) { MethodPermissionType < AssemblyDescriptorType < T > > type = new MethodPermissionTypeImpl < AssemblyDescriptorType < T > > ( this , "method-permission" , childNode , node ) ; list . add ( type ) ; } return list ; |
public class Predicates { /** * Negate an existing predicate ' s test result .
* @ param predicate An existing predicate .
* @ param < T > type of the predicate .
* @ return new predicate .
* @ since 1.5 */
public static < T > Predicate < T > negate ( final Predicate < ? super T > predicate ) { } } | return new Predicate < T > ( ) { @ Override public boolean test ( final T testValue ) { return ! predicate . test ( testValue ) ; } } ; |
public class Searcher { /** * Starts a search , with the given intent ' s query if it is a { @ link Intent # ACTION _ SEARCH search intent } .
* @ param intent an Intent that could contain a { @ link SearchManager # QUERY QUERY } .
* @ return this { @ link Searcher } for chaining . */
@ NonNull public Searcher search ( @ Nullable final Intent intent ) { } } | String query = null ; Object origin = null ; if ( intent != null ) { if ( Intent . ACTION_SEARCH . equals ( intent . getAction ( ) ) ) { query = intent . hasExtra ( SearchManager . QUERY ) ? intent . getStringExtra ( SearchManager . QUERY ) : intent . getDataString ( ) ; origin = intent ; } } return search ( query , origin ) ; |
public class EditDistance { /** * Berghel & Roach ' s extended Ukkonen ' s algorithm . */
private int br ( char [ ] x , char [ ] y ) { } } | if ( x . length > y . length ) { char [ ] swap = x ; x = y ; y = swap ; } final int m = x . length ; final int n = y . length ; int ZERO_K = n ; if ( n + 2 > FKP [ 0 ] . length ) FKP = new int [ 2 * n + 1 ] [ n + 2 ] ; for ( int k = - ZERO_K ; k < 0 ; k ++ ) { int p = - k - 1 ; FKP [ k + ZERO_K ] [ p + 1 ] = Math . abs ( k ) - 1 ; FKP [ k + ZERO_K ] [ p ] = - Integer . MAX_VALUE ; } FKP [ ZERO_K ] [ 0 ] = - 1 ; for ( int k = 1 ; k <= ZERO_K ; k ++ ) { int p = k - 1 ; FKP [ k + ZERO_K ] [ p + 1 ] = - 1 ; FKP [ k + ZERO_K ] [ p ] = - Integer . MAX_VALUE ; } int p = n - m - 1 ; do { p ++ ; for ( int i = ( p - ( n - m ) ) / 2 ; i >= 1 ; i -- ) { brf . f ( x , y , FKP , ZERO_K , n - m + i , p - i ) ; } for ( int i = ( n - m + p ) / 2 ; i >= 1 ; i -- ) { brf . f ( x , y , FKP , ZERO_K , n - m - i , p - i ) ; } brf . f ( x , y , FKP , ZERO_K , n - m , p ) ; } while ( FKP [ ( n - m ) + ZERO_K ] [ p ] != m ) ; return p - 1 ; |
public class IssueAssigner { /** * Author of the latest change on the lines involved by the issue .
* If no authors are set on the lines , then the author of the latest change on the file
* is returned . */
private Optional < String > guessScmAuthor ( DefaultIssue issue , Component component ) { } } | String author = null ; if ( scmChangesets != null ) { author = IssueLocations . allLinesFor ( issue , component . getUuid ( ) ) . filter ( scmChangesets :: hasChangesetForLine ) . mapToObj ( scmChangesets :: getChangesetForLine ) . filter ( c -> StringUtils . isNotEmpty ( c . getAuthor ( ) ) ) . max ( Comparator . comparingLong ( Changeset :: getDate ) ) . map ( Changeset :: getAuthor ) . orElse ( null ) ; } return Optional . ofNullable ( defaultIfEmpty ( author , lastCommitAuthor ) ) ; |
public class CassandraClientBase { /** * Populate entities from key slices .
* @ param m
* the m
* @ param isWrapReq
* the is wrap req
* @ param relations
* the relations
* @ param keys
* the keys
* @ param dataHandler
* the data handler
* @ return the list
* @ throws Exception
* the exception */
protected List populateEntitiesFromKeySlices ( EntityMetadata m , boolean isWrapReq , List < String > relations , List < KeySlice > keys , CassandraDataHandler dataHandler ) throws Exception { } } | List results ; MetamodelImpl metaModel = ( MetamodelImpl ) kunderaMetadata . getApplicationMetadata ( ) . getMetamodel ( m . getPersistenceUnit ( ) ) ; Set < String > superColumnAttribs = metaModel . getEmbeddables ( m . getEntityClazz ( ) ) . keySet ( ) ; results = new ArrayList ( keys . size ( ) ) ; ThriftDataResultHelper dataGenerator = new ThriftDataResultHelper ( ) ; for ( KeySlice key : keys ) { List < ColumnOrSuperColumn > columns = key . getColumns ( ) ; byte [ ] rowKey = key . getKey ( ) ; Object id = PropertyAccessorHelper . getObject ( m . getIdAttribute ( ) . getJavaType ( ) , rowKey ) ; Object e = null ; Map < ByteBuffer , List < ColumnOrSuperColumn > > data = new HashMap < ByteBuffer , List < ColumnOrSuperColumn > > ( 1 ) ; data . put ( ByteBuffer . wrap ( rowKey ) , columns ) ; ThriftRow tr = new ThriftRow ( ) ; tr . setId ( id ) ; tr . setColumnFamilyName ( m . getTableName ( ) ) ; tr = dataGenerator . translateToThriftRow ( data , m . isCounterColumnType ( ) , m . getType ( ) , tr ) ; e = dataHandler . populateEntity ( tr , m , KunderaCoreUtils . getEntity ( e ) , relations , isWrapReq ) ; if ( e != null ) { results . add ( e ) ; } } return results ; |
public class GBOXImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eSet ( int featureID , Object newValue ) { } } | switch ( featureID ) { case AfplibPackage . GBOX__RES : setRES ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__XPOS0 : setXPOS0 ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__YPOS0 : setYPOS0 ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__XPOS1 : setXPOS1 ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__YPOS1 : setYPOS1 ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__HAXIS : setHAXIS ( ( Integer ) newValue ) ; return ; case AfplibPackage . GBOX__VAXIS : setVAXIS ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ; |
public class Global { /** * The sync function creates a synchronized function ( in the sense
* of a Java synchronized method ) from an existing function . The
* new function synchronizes on the the second argument if it is
* defined , or otherwise the < code > this < / code > object of
* its invocation .
* js & gt ; var o = { f : sync ( function ( x ) {
* print ( " entry " ) ;
* Packages . java . lang . Thread . sleep ( x * 1000 ) ;
* print ( " exit " ) ;
* js & gt ; spawn ( function ( ) { o . f ( 5 ) ; } ) ;
* Thread [ Thread - 0,5 , main ]
* entry
* js & gt ; spawn ( function ( ) { o . f ( 5 ) ; } ) ;
* Thread [ Thread - 1,5 , main ]
* js & gt ;
* exit
* entry
* exit */
public static Object sync ( Context cx , Scriptable thisObj , Object [ ] args , Function funObj ) { } } | if ( args . length >= 1 && args . length <= 2 && args [ 0 ] instanceof Function ) { Object syncObject = null ; if ( args . length == 2 && args [ 1 ] != Undefined . instance ) { syncObject = args [ 1 ] ; } return new Synchronizer ( ( Function ) args [ 0 ] , syncObject ) ; } else { throw reportRuntimeError ( "msg.sync.args" ) ; } |
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public EClass getIfcReferencesValueDocument ( ) { } } | if ( ifcReferencesValueDocumentEClass == null ) { ifcReferencesValueDocumentEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 430 ) ; } return ifcReferencesValueDocumentEClass ; |
public class FairScheduler { /** * reinsert a set of jobs into the sorted jobs for a given type ( MAP / REDUCE )
* the re - insertion happens in place .
* we are exploiting the property that the jobs being inserted will most likely end
* up at the head of the sorted list and not require a lot comparisons */
private void mergeJobs ( LinkedList < JobInProgress > jobsToReinsert , TaskType taskType ) { } } | LinkedList < JobInProgress > sortedJobs = ( taskType == TaskType . MAP ) ? sortedJobsByMapNeed : sortedJobsByReduceNeed ; Comparator < JobInProgress > comparator = ( taskType == TaskType . MAP ) ? mapComparator : reduceComparator ; // for each job to be reinserted
for ( JobInProgress jobToReinsert : jobsToReinsert ) { // look at existing jobs in the sorted list starting with the head
boolean reinserted = false ; ListIterator < JobInProgress > iter = sortedJobs . listIterator ( 0 ) ; while ( iter . hasNext ( ) ) { JobInProgress job = iter . next ( ) ; if ( comparator . compare ( jobToReinsert , job ) < 0 ) { // found the point of insertion , move the iterator back one step
iter . previous ( ) ; // now we are positioned before the job we compared against
// insert it before this job
iter . add ( jobToReinsert ) ; reinserted = true ; break ; } } if ( ! reinserted ) { sortedJobs . add ( jobToReinsert ) ; } } |
public class DialogConverter { /** * Adds property mappings on a replacement node for Granite common attributes .
* @ param root the root node
* @ param node the replacement node
* @ throws JSONException */
private void addCommonAttrMappings ( JSONObject root , JSONObject node ) throws JSONException { } } | for ( String property : GRANITE_COMMON_ATTR_PROPERTIES ) { String [ ] mapping = { "${./" + property + "}" , "${\'./granite:" + property + "\'}" } ; mapProperty ( root , node , "granite:" + property , mapping ) ; } if ( root . has ( NN_GRANITE_DATA ) ) { // the root has granite : data defined , copy it before applying data - * properties
node . put ( NN_GRANITE_DATA , root . get ( NN_GRANITE_DATA ) ) ; } // map data - * prefixed properties to granite : data child
for ( Map . Entry < String , Object > entry : getProperties ( root ) . entrySet ( ) ) { if ( ! StringUtils . startsWith ( entry . getKey ( ) , DATA_PREFIX ) ) { continue ; } // add the granite : data child if necessary
JSONObject dataNode ; if ( ! node . has ( NN_GRANITE_DATA ) ) { dataNode = new JSONObject ( ) ; node . put ( NN_GRANITE_DATA , dataNode ) ; } else { dataNode = node . getJSONObject ( NN_GRANITE_DATA ) ; } // set up the property mapping
String nameWithoutPrefix = entry . getKey ( ) . substring ( DATA_PREFIX . length ( ) ) ; mapProperty ( root , dataNode , nameWithoutPrefix , "${./" + entry . getKey ( ) + "}" ) ; } |
public class CmsJspTagContainer { /** * Prints the closing tag for an element wrapper if in online mode . < p >
* @ param isGroupcontainer < code > true < / code > if element is a group - container
* @ throws IOException if the output fails */
protected void printElementWrapperTagEnd ( boolean isGroupcontainer ) throws IOException { } } | if ( m_editableRequest ) { String result ; if ( isGroupcontainer ) { result = "</div>" ; } else { result = "<div class=\"" + CmsContainerElement . CLASS_CONTAINER_ELEMENT_END_MARKER + "\" style=\"display:none\"></div>" ; } pageContext . getOut ( ) . print ( result ) ; } |
public class CmsWebdavServlet { /** * Copy the contents of the specified input stream to the specified
* output stream , and ensure that both streams are closed before returning
* ( even in the face of an exception ) . < p >
* @ param item the RepositoryItem
* @ param is the input stream to copy from
* @ param writer the writer to write to
* @ throws IOException if an input / output error occurs */
protected void copy ( I_CmsRepositoryItem item , InputStream is , PrintWriter writer ) throws IOException { } } | IOException exception = null ; InputStream resourceInputStream = null ; if ( ! item . isCollection ( ) ) { resourceInputStream = new ByteArrayInputStream ( item . getContent ( ) ) ; } else { resourceInputStream = is ; } Reader reader = new InputStreamReader ( resourceInputStream ) ; // Copy the input stream to the output stream
exception = copyRange ( reader , writer ) ; // Clean up the reader
try { reader . close ( ) ; } catch ( Exception e ) { if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_CLOSE_READER_0 ) , e ) ; } } // Rethrow any exception that has occurred
if ( exception != null ) { throw exception ; } |
public class XPathBuilder { /** * < p > < b > Used for finding element process ( to generate xpath address ) < / b > < / p >
* < p > Result Example : < / p >
* < pre >
* / / * [ @ placeholder = ' Search ' ]
* < / pre >
* @ param attribute eg . placeholder
* @ param value eg . Search
* @ param searchTypes accept only SearchType . EQUALS , SearchType . CONTAINS , SearchType . STARTS _ WITH , SearchType . TRIM
* @ param < T > the element which calls this method
* @ return this element */
@ SuppressWarnings ( "unchecked" ) public < T extends XPathBuilder > T setAttribute ( final String attribute , String value , final SearchType ... searchTypes ) { } } | if ( attribute != null ) { if ( value == null ) { this . attribute . remove ( attribute ) ; } else { this . attribute . put ( attribute , new SearchText ( value , searchTypes ) ) ; } } return ( T ) this ; |
public class ServiceAccount { /** * Returns an instance of ServiceAccount from the environment variables -
* GP _ URL , GP _ INSTANCE _ ID , GP _ USER _ ID and GP _ PASSWORD .
* If any of these are not defined , this method returns null .
* @ return An instance of ServiceAccount initialized by the environment
* variables , or null if any of these are not defined . */
private static ServiceAccount getInstanceByEnvVars ( ) { } } | Map < String , String > env = System . getenv ( ) ; String url = env . get ( GP_URL ) ; String instanceId = env . get ( GP_INSTANCE_ID ) ; String userId = env . get ( GP_USER_ID ) ; String password = env . get ( GP_PASSWORD ) ; String apiKey = env . get ( GP_IAM_API_KEY ) ; String iamBearerToken = env . get ( GP_IAM_BEARER_TOKEN ) ; String iamEndpoint = env . get ( GP_IAM_ENDPOINT ) ; return getInstance ( url , instanceId , userId , password , apiKey , iamBearerToken , iamEndpoint ) ; |
public class CFSA { /** * { @ inheritDoc } */
@ Override public byte getArcLabel ( int arc ) { } } | if ( isNextSet ( arc ) && isLabelCompressed ( arc ) ) { return this . labelMapping [ ( arcs [ arc ] >>> 3 ) & 0x1f ] ; } else { return arcs [ arc + 1 ] ; } |
public class ContextManager { /** * Returns the next URL after the specified URL .
* @ param currentURL Current URL
* @ return Next URL */
@ Trivial private String getNextURL ( String currentURL ) { } } | List < String > urlList = getEnvURLList ( ) ; int urlIndex = getURLIndex ( currentURL , urlList ) ; return urlList . get ( ( urlIndex + 1 ) % urlList . size ( ) ) ; |
public class Twilio { /** * Set the account sid .
* @ param accountSid account sid to use
* @ throws AuthenticationException if account sid is null */
public static void setAccountSid ( final String accountSid ) { } } | if ( accountSid == null ) { throw new AuthenticationException ( "AccountSid can not be null" ) ; } if ( ! accountSid . equals ( Twilio . accountSid ) ) { Twilio . invalidate ( ) ; } Twilio . accountSid = accountSid ; |
public class ClientExtension { /** * Set the set of scopes that this client application can request when
* < i > " Requestable Scopes per Client " < / i > is enabled ( = when { @ link
* # isRequestableScopesEnabled ( ) } returns { @ code true } ) .
* See the description of { @ link # isRequestableScopesEnabled ( ) } for details
* about < i > " Requestable Scopes per Client " < / i > .
* @ param scopes
* A set of scopes .
* @ return
* { @ code this } object .
* @ since 1.41 */
public ClientExtension setRequestableScopes ( Set < String > scopes ) { } } | if ( scopes == null ) { this . requestableScopes = null ; return this ; } int size = scopes . size ( ) ; this . requestableScopes = new String [ size ] ; if ( size != 0 ) { scopes . toArray ( this . requestableScopes ) ; } return this ; |
public class CDKAtomTypeMatcher { /** * Determines whether the bonds ( up to two spheres away ) are only to non
* hetroatoms . Currently used in N . planar3 perception of ( e . g . pyrrole ) .
* @ param atom an atom to test
* @ param container container of the atom
* @ return whether the atom ' s only bonds are to heteroatoms
* @ see # perceiveNitrogens ( IAtomContainer , IAtom , RingSearch , List ) */
private boolean isSingleHeteroAtom ( IAtom atom , IAtomContainer container ) { } } | List < IAtom > connected = container . getConnectedAtomsList ( atom ) ; for ( IAtom atom1 : connected ) { boolean aromatic = container . getBond ( atom , atom1 ) . isAromatic ( ) ; // ignoring non - aromatic bonds
if ( ! aromatic ) continue ; // found a hetroatom - we ' re not a single hetroatom
if ( ! "C" . equals ( atom1 . getSymbol ( ) ) ) return false ; // check the second sphere
for ( IAtom atom2 : container . getConnectedAtomsList ( atom1 ) ) { if ( ! atom2 . equals ( atom ) && container . getBond ( atom1 , atom2 ) . isAromatic ( ) && ! "C" . equals ( atom2 . getSymbol ( ) ) ) { return false ; } } } return true ; |
public class ImplementationFactory { /** * Creates an implementation of the interface .
* @ param implPackageName
* Name of the implementation package - Cannot be null .
* @ param implClassName
* Name of the implementation class - Cannot be null .
* @ param superClass
* Parent class or < code > null < / code > .
* @ param enclosingClass
* Outer class or < code > null < / code > .
* @ param listener
* Creates the bodies for all methods - Cannot be null .
* @ param intf
* One or more interfaces .
* @ return New object implementing the interface . */
public final SgClass create ( final String implPackageName , final String implClassName , final SgClass superClass , final SgClass enclosingClass , final ImplementationFactoryListener listener , final Class < ? > ... intf ) { } } | assureNotNull ( "implPackageName" , implPackageName ) ; assureNotNull ( "implClassName" , implClassName ) ; assureNotNull ( "listener" , listener ) ; assureNotNull ( "intf" , intf ) ; assureNotEmpty ( "intf" , intf ) ; assureAllInterfaces ( intf ) ; // Create class with all interfaces
final SgClass clasz = new SgClass ( "public" , implPackageName , implClassName , superClass , false , enclosingClass ) ; for ( int i = 0 ; i < intf . length ; i ++ ) { clasz . addInterface ( SgClass . create ( pool , intf [ i ] ) ) ; } listener . afterClassCreated ( clasz ) ; final Map < String , ImplementedMethod > implMethods = new HashMap < String , ImplementedMethod > ( ) ; // Iterate through interfaces and add methods
for ( int i = 0 ; i < intf . length ; i ++ ) { addInterfaceMethods ( implMethods , clasz , intf [ i ] , listener ) ; } // Iterate through methods and create body
final Iterator < String > it = implMethods . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { final ImplementedMethod implMethod = implMethods . get ( it . next ( ) ) ; final SgMethod method = implMethod . getMethod ( ) ; final Class < ? > [ ] interfaces = implMethod . getInterfaces ( ) ; final List < String > lines = listener . createBody ( method , interfaces ) ; for ( int k = 0 ; k < lines . size ( ) ; k ++ ) { implMethod . getMethod ( ) . addBodyLine ( lines . get ( k ) ) ; } } return clasz ; |
public class MixinParentNode { /** * Adds the given child .
* @ param child The child to add . */
public void addChild ( N child ) { } } | checkNotNull ( child ) ; tryRemoveFromOldParent ( child ) ; children . add ( child ) ; child . setParent ( master ) ; |
public class JspCompilationContext { /** * = = = = = Manipulating the class = = = = = */
public Class < ? > load ( ) throws JasperException { } } | try { getJspLoader ( ) ; String name = getFQCN ( ) ; servletClass = jspLoader . loadClass ( name ) ; } catch ( ClassNotFoundException cex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.unable.load" ) , cex ) ; } catch ( Exception ex ) { throw new JasperException ( Localizer . getMessage ( "jsp.error.unable.compile" ) , ex ) ; } removed = false ; return servletClass ; |
public class CollectionUtils { /** * 建立树形结构
* @ param list
* @ param keyMapper
* @ param parentKeyMapper
* @ param childMapper
* @ return */
public static < T , K > ArrayList < T > buildTree ( Collection < T > list , Function < T , K > keyMapper , Function < T , K > parentKeyMapper , Function < T , Collection < T > > childMapper ) { } } | HashMap < K , T > map = toHashMap ( list , keyMapper ) ; ArrayList < T > root = new ArrayList < T > ( ) ; for ( T t : list ) { K key = keyMapper . apply ( t ) ; K parentKey = parentKeyMapper . apply ( t ) ; if ( parentKey == null || key . equals ( parentKey ) ) root . add ( t ) ; else childMapper . apply ( map . get ( parentKey ) ) . add ( t ) ; } return root ; |
public class StandardBullhornData { /** * { @ inheritDoc } */
@ Override public FileWrapper addFile ( Class < ? extends FileEntity > type , Integer entityId , FileMeta fileMeta ) { } } | Map < String , String > uriVariables = restUriVariablesFactory . getUriVariablesForAddFile ( BullhornEntityInfo . getTypesRestEntityName ( type ) , entityId , fileMeta ) ; String url = restUrlFactory . assemblePutFileUrl ( ) ; String jsonString = restJsonConverter . convertEntityToJsonString ( ( BullhornEntity ) fileMeta ) ; StandardFileApiResponse fileApiResponse = this . performCustomRequest ( url , jsonString , StandardFileApiResponse . class , uriVariables , HttpMethod . PUT , null ) ; Integer fileId = fileApiResponse . getFileId ( ) ; return this . handleGetFileContentWithMetaData ( type , entityId , fileId ) ; |
public class ModelsImpl { /** * Get All Entity Roles for a given entity .
* @ param appId The application ID .
* @ param versionId The version ID .
* @ param entityId entity Id
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the List & lt ; EntityRole & gt ; object */
public Observable < List < EntityRole > > getCustomPrebuiltEntityRolesAsync ( UUID appId , String versionId , UUID entityId ) { } } | return getCustomPrebuiltEntityRolesWithServiceResponseAsync ( appId , versionId , entityId ) . map ( new Func1 < ServiceResponse < List < EntityRole > > , List < EntityRole > > ( ) { @ Override public List < EntityRole > call ( ServiceResponse < List < EntityRole > > response ) { return response . body ( ) ; } } ) ; |
public class Jenkins { /** * Checks if a top - level view with the given name exists and
* make sure that the name is good as a view name . */
public FormValidation doCheckViewName ( @ QueryParameter String value ) { } } | checkPermission ( View . CREATE ) ; String name = fixEmpty ( value ) ; if ( name == null ) return FormValidation . ok ( ) ; // already exists ?
if ( getView ( name ) != null ) return FormValidation . error ( Messages . Hudson_ViewAlreadyExists ( name ) ) ; // good view name ?
try { checkGoodName ( name ) ; } catch ( Failure e ) { return FormValidation . error ( e . getMessage ( ) ) ; } return FormValidation . ok ( ) ; |
public class AbstractTracer { /** * Prints the method signature on the { @ link de . christofreichardt . diagnosis . io . IndentablePrintStream } .
* @ param methodSignature the method signature to be printed */
private void printMethodEntry ( String methodSignature ) { } } | synchronized ( this . syncObject ) { out ( ) . printIndentln ( "ENTRY--" + methodSignature + "--" + Thread . currentThread ( ) . getName ( ) + "[" + Thread . currentThread ( ) . getId ( ) + "]" ) ; } |
public class CmsFloatDecoratedPanel { /** * Sets the left margin of the main panel to the width of the float panel . < p > */
public void updateLayout ( ) { } } | // TODO : we should not do this kind of things . . .
if ( ! isAttached ( ) ) { return ; } int floatBoxWidth = getFloatBoxWidth ( ) ; m_primary . getElement ( ) . getStyle ( ) . setMarginLeft ( floatBoxWidth , Unit . PX ) ; updateVerticalMargin ( ) ; |
public class AppServiceEnvironmentsInner { /** * Get metric definitions for a worker pool of an App Service Environment .
* Get metric definitions for a worker pool of an App Service Environment .
* @ param resourceGroupName Name of the resource group to which the resource belongs .
* @ param name Name of the App Service Environment .
* @ param workerPoolName Name of the worker pool .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; ResourceMetricDefinitionInner & gt ; object */
public Observable < Page < ResourceMetricDefinitionInner > > listWebWorkerMetricDefinitionsAsync ( final String resourceGroupName , final String name , final String workerPoolName ) { } } | return listWebWorkerMetricDefinitionsWithServiceResponseAsync ( resourceGroupName , name , workerPoolName ) . map ( new Func1 < ServiceResponse < Page < ResourceMetricDefinitionInner > > , Page < ResourceMetricDefinitionInner > > ( ) { @ Override public Page < ResourceMetricDefinitionInner > call ( ServiceResponse < Page < ResourceMetricDefinitionInner > > response ) { return response . body ( ) ; } } ) ; |
public class ArtifactCoordinates { /** * Create a relative repository path for the given artifact coordinates .
* @ param separator the separator character to use ( typically { @ code ' / ' } or { @ link File # separatorChar } )
* @ return the path string */
public String relativeArtifactPath ( char separator ) { } } | String artifactId1 = getArtifactId ( ) ; String version1 = getVersion ( ) ; StringBuilder builder = new StringBuilder ( getGroupId ( ) . replace ( '.' , separator ) ) ; builder . append ( separator ) . append ( artifactId1 ) . append ( separator ) ; String pathVersion ; final Matcher versionMatcher = snapshotPattern . matcher ( version1 ) ; if ( versionMatcher . find ( ) ) { // it ' s really a snapshot
pathVersion = version1 . substring ( 0 , versionMatcher . start ( ) ) + "-SNAPSHOT" ; } else { pathVersion = version1 ; } builder . append ( pathVersion ) . append ( separator ) . append ( artifactId1 ) . append ( '-' ) . append ( version1 ) ; return builder . toString ( ) ; |
public class DBCleaningScriptsFactory { /** * Prepare SQL scripts for cleaning workspace data from database .
* @ param wsEntry
* workspace configuration
* @ param dialect
* database dialect which is used , since { @ link JDBCWorkspaceDataContainer # DB _ DIALECT } parameter
* can contain { @ link DialectConstants # DB _ DIALECT _ AUTO } value it is necessary to resolve dialect
* before based on database connection . */
public static DBCleaningScripts prepareScripts ( String dialect , WorkspaceEntry wsEntry ) throws DBCleanException { } } | if ( dialect . startsWith ( DialectConstants . DB_DIALECT_MYSQL ) ) { return new MySQLCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_DB2 ) ) { return new DB2CleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_MSSQL ) ) { return new MSSQLCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_PGSQL ) ) { return new PgSQLCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_SYBASE ) ) { return new SybaseCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_HSQLDB ) ) { return new HSQLDBCleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_H2 ) ) { return new H2CleaningScipts ( dialect , wsEntry ) ; } else if ( dialect . startsWith ( DialectConstants . DB_DIALECT_ORACLE ) ) { return new OracleCleaningScipts ( dialect , wsEntry ) ; } else { throw new DBCleanException ( "Unsupported dialect " + dialect ) ; } |
public class BaseExpression { /** * Normalize an expression string , replace " nice names " with their coded values and spaces with " _ " .
* @ param expression an expression
* @ return a parsed expression */
public static String normalize ( Object expression ) { } } | if ( expression == null ) { return null ; } // If it ' s a number it ' s not an expression
if ( expression instanceof Number ) { return String . valueOf ( expression ) ; } String replacement ; String conditionStr = StringUtils . mergeToSingleUnderscore ( String . valueOf ( expression ) ) ; Matcher matcher = PATTERN . matcher ( conditionStr ) ; StringBuffer result = new StringBuffer ( conditionStr . length ( ) ) ; while ( matcher . find ( ) ) { if ( OPERATORS . containsKey ( matcher . group ( ) ) ) { replacement = ( String ) OPERATORS . get ( matcher . group ( ) ) ; } else if ( PREDEFINED_VARS . containsKey ( matcher . group ( ) ) ) { replacement = ( String ) PREDEFINED_VARS . get ( matcher . group ( ) ) ; } else { replacement = matcher . group ( ) ; } matcher . appendReplacement ( result , replacement ) ; } matcher . appendTail ( result ) ; return result . toString ( ) ; |
public class StateSaver { /** * Save the given { @ code target } in the passed in { @ link Bundle } .
* @ param target The object containing fields annotated with { @ link State } .
* @ param state The object is saved into this bundle . */
public static < T > void saveInstanceState ( @ NonNull T target , @ NonNull Bundle state ) { } } | IMPL . saveInstanceState ( target , state ) ; |
public class AbstractAdminObject { /** * The method gets all events for the given event type and executes them in
* the given order . If no events are defined , nothing is done .
* @ param _ eventtype type of event to execute
* @ param _ param Parameter to be passed to the esjp
* @ return List with Returns
* @ throws EFapsException on error */
public List < Return > executeEvents ( final EventType _eventtype , final Parameter _param ) throws EFapsException { } } | final List < Return > ret = new ArrayList < > ( ) ; if ( hasEvents ( _eventtype ) ) { if ( this instanceof AbstractUserInterfaceObject ) { // add ui object to parameter
_param . put ( ParameterValues . UIOBJECT , this ) ; } // execute all triggers
for ( final EventDefinition evenDef : this . events . get ( _eventtype ) ) { ret . add ( evenDef . execute ( _param ) ) ; } } return ret ; |
public class ConcurrentHashSet { /** * ( non - Javadoc )
* @ see java . util . Collection # remove ( java . lang . Object ) */
public final boolean remove ( Object key ) { } } | java . util . Set subSet = getSubSet ( key ) ; synchronized ( subSet ) { return subSet . remove ( key ) ; } // synchronized ( subSet ) . |
public class ApiOvhSms { /** * Get this object properties
* REST : GET / sms / { serviceName } / virtualNumbers / { number }
* @ param serviceName [ required ] The internal name of your SMS offer
* @ param number [ required ] The virtual number */
public OvhVirtualNumber serviceName_virtualNumbers_number_GET ( String serviceName , String number ) throws IOException { } } | String qPath = "/sms/{serviceName}/virtualNumbers/{number}" ; StringBuilder sb = path ( qPath , serviceName , number ) ; String resp = exec ( qPath , "GET" , sb . toString ( ) , null ) ; return convertTo ( resp , OvhVirtualNumber . class ) ; |
public class CacheControlBuilder { /** * Set the maximum age relative to the request time
* @ param eTimeUnit
* { @ link TimeUnit } to use
* @ param nDuration
* The duration in the passed unit
* @ return this */
@ Nonnull public CacheControlBuilder setMaxAge ( @ Nonnull final TimeUnit eTimeUnit , final long nDuration ) { } } | return setMaxAgeSeconds ( eTimeUnit . toSeconds ( nDuration ) ) ; |
public class PageFlowInitialization { /** * This method will initialize all of the PrefixHandlers registered in the netui config .
* The prefix handlers are registered with ProcessPopulate and are typically implemented as
* public inner classes in the tags that require prefix handlers . */
private static void initPrefixHandlers ( ) { } } | PrefixHandlerConfig [ ] prefixHandlers = ConfigUtil . getConfig ( ) . getPrefixHandlers ( ) ; if ( prefixHandlers == null ) { return ; } for ( int i = 0 ; i < prefixHandlers . length ; i ++ ) { try { Class prefixClass = Class . forName ( prefixHandlers [ i ] . getHandlerClass ( ) ) ; String name = prefixHandlers [ i ] . getName ( ) ; if ( name == null || name . equals ( "" ) ) { _log . warn ( "The name for the prefix handler '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' must not be null" ) ; continue ; } Object o = prefixClass . newInstance ( ) ; if ( ! ( o instanceof RequestParameterHandler ) ) { _log . warn ( "The class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' must be an instance of RequestParameterHandler" ) ; continue ; } ProcessPopulate . registerPrefixHandler ( name , ( RequestParameterHandler ) o ) ; } catch ( ClassNotFoundException e ) { _log . warn ( "Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "' not found" , e ) ; } catch ( IllegalAccessException e ) { _log . warn ( "Illegal access on Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "'" , e ) ; } catch ( InstantiationException e ) { _log . warn ( "InstantiationException on Class '" + prefixHandlers [ i ] . getHandlerClass ( ) + "'" , e . getCause ( ) ) ; } } |
public class CustomerArtifactPaths { /** * Comma - separated list of paths on the iOS device where the artifacts generated by the customer ' s tests will be
* pulled from .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setIosPaths ( java . util . Collection ) } or { @ link # withIosPaths ( java . util . Collection ) } if you want to override
* the existing values .
* @ param iosPaths
* Comma - separated list of paths on the iOS device where the artifacts generated by the customer ' s tests will
* be pulled from .
* @ return Returns a reference to this object so that method calls can be chained together . */
public CustomerArtifactPaths withIosPaths ( String ... iosPaths ) { } } | if ( this . iosPaths == null ) { setIosPaths ( new java . util . ArrayList < String > ( iosPaths . length ) ) ; } for ( String ele : iosPaths ) { this . iosPaths . add ( ele ) ; } return this ; |
public class DnsResponseCode { /** * Returns the { @ link DnsResponseCode } that corresponds with the given { @ code responseCode } .
* @ param responseCode the DNS RCODE
* @ return the corresponding { @ link DnsResponseCode } */
public static DnsResponseCode valueOf ( int responseCode ) { } } | switch ( responseCode ) { case 0 : return NOERROR ; case 1 : return FORMERR ; case 2 : return SERVFAIL ; case 3 : return NXDOMAIN ; case 4 : return NOTIMP ; case 5 : return REFUSED ; case 6 : return YXDOMAIN ; case 7 : return YXRRSET ; case 8 : return NXRRSET ; case 9 : return NOTAUTH ; case 10 : return NOTZONE ; case 16 : return BADVERS_OR_BADSIG ; case 17 : return BADKEY ; case 18 : return BADTIME ; case 19 : return BADMODE ; case 20 : return BADNAME ; case 21 : return BADALG ; default : return new DnsResponseCode ( responseCode ) ; } |
public class TaskManagerServices { /** * Validates that all the directories denoted by the strings do actually exist or can be created , are proper
* directories ( not files ) , and are writable .
* @ param tmpDirs The array of directory paths to check .
* @ throws IOException Thrown if any of the directories does not exist and cannot be created or is not writable
* or is a file , rather than a directory . */
private static void checkTempDirs ( String [ ] tmpDirs ) throws IOException { } } | for ( String dir : tmpDirs ) { if ( dir != null && ! dir . equals ( "" ) ) { File file = new File ( dir ) ; if ( ! file . exists ( ) ) { if ( ! file . mkdirs ( ) ) { throw new IOException ( "Temporary file directory " + file . getAbsolutePath ( ) + " does not exist and could not be created." ) ; } } if ( ! file . isDirectory ( ) ) { throw new IOException ( "Temporary file directory " + file . getAbsolutePath ( ) + " is not a directory." ) ; } if ( ! file . canWrite ( ) ) { throw new IOException ( "Temporary file directory " + file . getAbsolutePath ( ) + " is not writable." ) ; } if ( LOG . isInfoEnabled ( ) ) { long totalSpaceGb = file . getTotalSpace ( ) >> 30 ; long usableSpaceGb = file . getUsableSpace ( ) >> 30 ; double usablePercentage = ( double ) usableSpaceGb / totalSpaceGb * 100 ; String path = file . getAbsolutePath ( ) ; LOG . info ( String . format ( "Temporary file directory '%s': total %d GB, " + "usable %d GB (%.2f%% usable)" , path , totalSpaceGb , usableSpaceGb , usablePercentage ) ) ; } } else { throw new IllegalArgumentException ( "Temporary file directory #$id is null." ) ; } } |
public class DefaultFormatter { /** * Format a logging message
* @ param logRecord
* @ return */
@ Override public String format ( LogRecord logRecord ) { } } | StringBuilder resultBuilder = new StringBuilder ( ) ; String prefix = logRecord . getLevel ( ) . getName ( ) + "\t" ; resultBuilder . append ( prefix ) ; resultBuilder . append ( Thread . currentThread ( ) . getName ( ) ) . append ( " " ) . append ( sdf . format ( new java . util . Date ( logRecord . getMillis ( ) ) ) ) . append ( ": " ) . append ( logRecord . getSourceClassName ( ) ) . append ( ":" ) . append ( logRecord . getSourceMethodName ( ) ) . append ( ": " ) . append ( logRecord . getMessage ( ) ) ; Object [ ] params = logRecord . getParameters ( ) ; if ( params != null ) { resultBuilder . append ( "\nParameters:" ) ; if ( params . length < 1 ) { resultBuilder . append ( " (none)" ) ; } else { for ( int paramIndex = 0 ; paramIndex < params . length ; paramIndex ++ ) { Object param = params [ paramIndex ] ; if ( param != null ) { String paramString = param . toString ( ) ; resultBuilder . append ( "\nParameter " ) . append ( String . valueOf ( paramIndex ) ) . append ( " is a " ) . append ( param . getClass ( ) . getName ( ) ) . append ( ": >" ) . append ( paramString ) . append ( "<" ) ; } else { resultBuilder . append ( "\nParameter " ) . append ( String . valueOf ( paramIndex ) ) . append ( " is null." ) ; } } } } Throwable t = logRecord . getThrown ( ) ; if ( t != null ) { resultBuilder . append ( "\nThrowing:\n" ) . append ( getFullThrowableMsg ( t ) ) ; } String result = resultBuilder . toString ( ) . replaceAll ( "\n" , "\n" + prefix ) + "\n" ; return result ; |
public class AmazonS3URI { /** * Decodes the percent - encoded character at the given index in the string
* and appends the decoded value to the given { @ code StringBuilder } .
* @ param builder the string builder to append to
* @ param str the string being decoded
* @ param index the index of the ' % ' character in the string */
private static void appendDecoded ( final StringBuilder builder , final String str , final int index ) { } } | if ( index > str . length ( ) - 3 ) { throw new IllegalStateException ( "Invalid percent-encoded string:" + "\"" + str + "\"." ) ; } char first = str . charAt ( index + 1 ) ; char second = str . charAt ( index + 2 ) ; char decoded = ( char ) ( ( fromHex ( first ) << 4 ) | fromHex ( second ) ) ; builder . append ( decoded ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.