signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LByteToDblFunctionBuilder { /** * One of ways of creating builder . This is possibly the least verbose way where compiler should be able to guess the generic parameters . */
@ Nonnull public static LByteToDblFunction byteToDblFunctionFrom ( Consumer < LByteToDblFunctionBuilder > buildingFunction ) { } } | LByteToDblFunctionBuilder builder = new LByteToDblFunctionBuilder ( ) ; buildingFunction . accept ( builder ) ; return builder . build ( ) ; |
public class FbBotMillBean { /** * Gets the video message .
* @ param envelope the envelope
* @ return the video message */
protected Attachment getVideoMessage ( MessageEnvelope envelope ) { } } | if ( envelope != null && envelope . getMessage ( ) != null && envelope . getMessage ( ) . getAttachments ( ) != null && envelope . getMessage ( ) . getAttachments ( ) . get ( 0 ) != null && envelope . getMessage ( ) . getAttachments ( ) . get ( 0 ) . getType ( ) == AttachmentType . VIDEO ) { return envelope . getMessage ( ) . getAttachments ( ) . get ( 0 ) ; } return null ; |
public class JobExecutionEventSubmitter { /** * Submits an event for a given { @ link TaskState } . It will include all metadata specified in the jobMetadata parameter . */
private void submitTaskStateEvent ( TaskState taskState , Map < String , String > jobMetadata ) { } } | ImmutableMap . Builder < String , String > taskMetadataBuilder = new ImmutableMap . Builder < > ( ) ; taskMetadataBuilder . putAll ( jobMetadata ) ; taskMetadataBuilder . put ( METADATA_TASK_ID , taskState . getTaskId ( ) ) ; taskMetadataBuilder . put ( METADATA_TASK_START_TIME , Long . toString ( taskState . getStartTime ( ) ) ) ; taskMetadataBuilder . put ( METADATA_TASK_END_TIME , Long . toString ( taskState . getEndTime ( ) ) ) ; taskMetadataBuilder . put ( METADATA_TASK_WORKING_STATE , taskState . getWorkingState ( ) . toString ( ) ) ; taskMetadataBuilder . put ( METADATA_TASK_FAILURE_CONTEXT , taskState . getTaskFailureException ( ) . or ( UNKNOWN_VALUE ) ) ; taskMetadataBuilder . put ( EventSubmitter . EVENT_TYPE , TASK_STATE ) ; this . eventSubmitter . submit ( TASK_STATE , taskMetadataBuilder . build ( ) ) ; |
public class RadioButtonGroup { /** * Does the specified value match one of those we are looking for ?
* @ param value Value to be compared */
public boolean isMatched ( String value , Boolean defaultValue ) { } } | // @ todo : there isn ' t a defaultValue for radio button , what should we do here ?
if ( value == null ) return false ; if ( _match != null ) return value . equals ( _match ) ; if ( _defaultRadio != null ) return value . equals ( _defaultRadio ) ; return false ; |
public class RebalanceUtils { /** * Confirms that both clusters have the same set of zones defined .
* @ param lhs
* @ param rhs */
public static void validateClusterZonesSame ( final Cluster lhs , final Cluster rhs ) { } } | Set < Zone > lhsSet = new HashSet < Zone > ( lhs . getZones ( ) ) ; Set < Zone > rhsSet = new HashSet < Zone > ( rhs . getZones ( ) ) ; if ( ! lhsSet . equals ( rhsSet ) ) throw new VoldemortException ( "Zones are not the same [ lhs cluster zones (" + lhs . getZones ( ) + ") not equal to rhs cluster zones (" + rhs . getZones ( ) + ") ]" ) ; |
public class CommerceShippingMethodLocalServiceBaseImpl { /** * Returns a range of all the commerce shipping methods .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceShippingMethodModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce shipping methods
* @ param end the upper bound of the range of commerce shipping methods ( not inclusive )
* @ return the range of commerce shipping methods */
@ Override public List < CommerceShippingMethod > getCommerceShippingMethods ( int start , int end ) { } } | return commerceShippingMethodPersistence . findAll ( start , end ) ; |
public class JSONObject { /** * Creates a bean from a JSONObject , with the specific configuration . */
public static Object toBean ( JSONObject jsonObject , JsonConfig jsonConfig ) { } } | if ( jsonObject == null || jsonObject . isNullObject ( ) ) { return null ; } Class beanClass = jsonConfig . getRootClass ( ) ; Map classMap = jsonConfig . getClassMap ( ) ; if ( beanClass == null ) { return toBean ( jsonObject ) ; } if ( classMap == null ) { classMap = Collections . EMPTY_MAP ; } Object bean = null ; try { if ( beanClass . isInterface ( ) ) { if ( ! Map . class . isAssignableFrom ( beanClass ) ) { throw new JSONException ( "beanClass is an interface. " + beanClass ) ; } else { bean = new HashMap ( ) ; } } else { bean = jsonConfig . getNewBeanInstanceStrategy ( ) . newInstance ( beanClass , jsonObject ) ; } } catch ( JSONException jsone ) { throw jsone ; } catch ( Exception e ) { throw new JSONException ( e ) ; } Map props = JSONUtils . getProperties ( jsonObject ) ; PropertyFilter javaPropertyFilter = jsonConfig . getJavaPropertyFilter ( ) ; for ( Iterator entries = jsonObject . names ( jsonConfig ) . iterator ( ) ; entries . hasNext ( ) ; ) { String name = ( String ) entries . next ( ) ; Class type = ( Class ) props . get ( name ) ; Object value = jsonObject . get ( name ) ; if ( javaPropertyFilter != null && javaPropertyFilter . apply ( bean , name , value ) ) { continue ; } String key = Map . class . isAssignableFrom ( beanClass ) && jsonConfig . isSkipJavaIdentifierTransformationInMapKeys ( ) ? name : JSONUtils . convertToJavaIdentifier ( name , jsonConfig ) ; PropertyNameProcessor propertyNameProcessor = jsonConfig . findJavaPropertyNameProcessor ( beanClass ) ; if ( propertyNameProcessor != null ) { key = propertyNameProcessor . processPropertyName ( beanClass , key ) ; } try { if ( Map . class . isAssignableFrom ( beanClass ) ) { // no type info available for conversion
if ( JSONUtils . isNull ( value ) ) { setProperty ( bean , key , value , jsonConfig ) ; } else if ( value instanceof JSONArray ) { setProperty ( bean , key , convertPropertyValueToCollection ( key , value , jsonConfig , name , classMap , List . class ) , jsonConfig ) ; } else if ( String . class . isAssignableFrom ( type ) || JSONUtils . isBoolean ( type ) || JSONUtils . isNumber ( type ) || JSONUtils . isString ( type ) || JSONFunction . class . isAssignableFrom ( type ) ) { if ( jsonConfig . isHandleJettisonEmptyElement ( ) && "" . equals ( value ) ) { setProperty ( bean , key , null , jsonConfig ) ; } else { setProperty ( bean , key , value , jsonConfig ) ; } } else { Class targetClass = resolveClass ( classMap , key , name , type ) ; JsonConfig jsc = jsonConfig . copy ( ) ; jsc . setRootClass ( targetClass ) ; jsc . setClassMap ( classMap ) ; if ( targetClass != null ) { setProperty ( bean , key , toBean ( ( JSONObject ) value , jsc ) , jsonConfig ) ; } else { setProperty ( bean , key , toBean ( ( JSONObject ) value ) , jsonConfig ) ; } } } else { PropertyDescriptor pd = PropertyUtils . getPropertyDescriptor ( bean , key ) ; if ( pd != null && pd . getWriteMethod ( ) == null ) { log . info ( "Property '" + key + "' of " + bean . getClass ( ) + " has no write method. SKIPPED." ) ; continue ; } if ( pd != null ) { Class targetType = pd . getPropertyType ( ) ; if ( ! JSONUtils . isNull ( value ) ) { if ( value instanceof JSONArray ) { if ( List . class . isAssignableFrom ( pd . getPropertyType ( ) ) ) { setProperty ( bean , key , convertPropertyValueToCollection ( key , value , jsonConfig , name , classMap , pd . getPropertyType ( ) ) , jsonConfig ) ; } else if ( Set . class . isAssignableFrom ( pd . getPropertyType ( ) ) ) { setProperty ( bean , key , convertPropertyValueToCollection ( key , value , jsonConfig , name , classMap , pd . getPropertyType ( ) ) , jsonConfig ) ; } else { setProperty ( bean , key , convertPropertyValueToArray ( key , value , targetType , jsonConfig , classMap ) , jsonConfig ) ; } } else if ( String . class . isAssignableFrom ( type ) || JSONUtils . isBoolean ( type ) || JSONUtils . isNumber ( type ) || JSONUtils . isString ( type ) || JSONFunction . class . isAssignableFrom ( type ) ) { if ( pd != null ) { if ( jsonConfig . isHandleJettisonEmptyElement ( ) && "" . equals ( value ) ) { setProperty ( bean , key , null , jsonConfig ) ; } else if ( ! targetType . isInstance ( value ) ) { setProperty ( bean , key , morphPropertyValue ( key , value , type , targetType ) , jsonConfig ) ; } else { setProperty ( bean , key , value , jsonConfig ) ; } } else if ( beanClass == null || bean instanceof Map ) { setProperty ( bean , key , value , jsonConfig ) ; } else { log . warn ( "Tried to assign property " + key + ":" + type . getName ( ) + " to bean of class " + bean . getClass ( ) . getName ( ) ) ; } } else { if ( jsonConfig . isHandleJettisonSingleElementArray ( ) ) { JSONArray array = new JSONArray ( ) . element ( value , jsonConfig ) ; Class newTargetClass = resolveClass ( classMap , key , name , type ) ; JsonConfig jsc = jsonConfig . copy ( ) ; jsc . setRootClass ( newTargetClass ) ; jsc . setClassMap ( classMap ) ; if ( targetType . isArray ( ) ) { setProperty ( bean , key , JSONArray . toArray ( array , jsc ) , jsonConfig ) ; } else if ( JSONArray . class . isAssignableFrom ( targetType ) ) { setProperty ( bean , key , array , jsonConfig ) ; } else if ( List . class . isAssignableFrom ( targetType ) || Set . class . isAssignableFrom ( targetType ) ) { jsc . setCollectionType ( targetType ) ; setProperty ( bean , key , JSONArray . toCollection ( array , jsc ) , jsonConfig ) ; } else { setProperty ( bean , key , toBean ( ( JSONObject ) value , jsc ) , jsonConfig ) ; } } else { if ( targetType == Object . class || targetType . isInterface ( ) ) { Class targetTypeCopy = targetType ; targetType = findTargetClass ( key , classMap ) ; targetType = targetType == null ? findTargetClass ( name , classMap ) : targetType ; targetType = targetType == null && targetTypeCopy . isInterface ( ) ? targetTypeCopy : targetType ; } JsonConfig jsc = jsonConfig . copy ( ) ; jsc . setRootClass ( targetType ) ; jsc . setClassMap ( classMap ) ; setProperty ( bean , key , toBean ( ( JSONObject ) value , jsc ) , jsonConfig ) ; } } } else { if ( type . isPrimitive ( ) ) { // assume assigned default value
log . warn ( "Tried to assign null value to " + key + ":" + type . getName ( ) ) ; setProperty ( bean , key , JSONUtils . getMorpherRegistry ( ) . morph ( type , null ) , jsonConfig ) ; } else { setProperty ( bean , key , null , jsonConfig ) ; } } } else { // pd is null
if ( ! JSONUtils . isNull ( value ) ) { if ( value instanceof JSONArray ) { setProperty ( bean , key , convertPropertyValueToCollection ( key , value , jsonConfig , name , classMap , List . class ) , jsonConfig ) ; } else if ( String . class . isAssignableFrom ( type ) || JSONUtils . isBoolean ( type ) || JSONUtils . isNumber ( type ) || JSONUtils . isString ( type ) || JSONFunction . class . isAssignableFrom ( type ) ) { if ( beanClass == null || bean instanceof Map || jsonConfig . getPropertySetStrategy ( ) != null || ! jsonConfig . isIgnorePublicFields ( ) ) { setProperty ( bean , key , value , jsonConfig ) ; } else { log . warn ( "Tried to assign property " + key + ":" + type . getName ( ) + " to bean of class " + bean . getClass ( ) . getName ( ) ) ; } } else { if ( jsonConfig . isHandleJettisonSingleElementArray ( ) ) { Class newTargetClass = resolveClass ( classMap , key , name , type ) ; JsonConfig jsc = jsonConfig . copy ( ) ; jsc . setRootClass ( newTargetClass ) ; jsc . setClassMap ( classMap ) ; setProperty ( bean , key , toBean ( ( JSONObject ) value , jsc ) , jsonConfig ) ; } else { setProperty ( bean , key , value , jsonConfig ) ; } } } else { if ( type . isPrimitive ( ) ) { // assume assigned default value
log . warn ( "Tried to assign null value to " + key + ":" + type . getName ( ) ) ; setProperty ( bean , key , JSONUtils . getMorpherRegistry ( ) . morph ( type , null ) , jsonConfig ) ; } else { setProperty ( bean , key , null , jsonConfig ) ; } } } } } catch ( JSONException jsone ) { throw jsone ; } catch ( Exception e ) { throw new JSONException ( "Error while setting property=" + name + " type " + type , e ) ; } } return bean ; |
public class Evaluation { /** * Eval .
* @ param _ permissionSet the PermissionSet
* @ throws EFapsException on error */
public static void eval ( final PermissionSet _permissionSet ) throws EFapsException { } } | Evaluation . LOG . debug ( "Evaluating PermissionSet {}" , _permissionSet ) ; final Person person = Person . get ( _permissionSet . getPersonId ( ) ) ; final Set < Long > ids = new HashSet < > ( person . getRoles ( ) ) ; ids . addAll ( person . getGroups ( ) ) ; ids . add ( person . getId ( ) ) ; final QueryBuilder userAttrQueryBldr = new QueryBuilder ( CIAdminAccess . AccessSet2UserAbstract ) ; userAttrQueryBldr . addWhereAttrEqValue ( CIAdminAccess . AccessSet2UserAbstract . UserAbstractLink , ids . toArray ( ) ) ; final QueryBuilder typeAttrQueryBldr = new QueryBuilder ( CIAdminAccess . AccessSet2DataModelType ) ; typeAttrQueryBldr . addWhereAttrEqValue ( CIAdminAccess . AccessSet2DataModelType . DataModelTypeLink , _permissionSet . getTypeId ( ) ) ; final QueryBuilder queryBldr = new QueryBuilder ( CIAdminAccess . AccessSet2Type ) ; queryBldr . addWhereAttrInQuery ( CIAdminAccess . AccessSet2Type . AccessSetLink , typeAttrQueryBldr . getAttributeQuery ( CIAdminAccess . AccessSet2DataModelType . AccessSetLink ) ) ; queryBldr . addWhereAttrInQuery ( CIAdminAccess . AccessSet2Type . AccessSetLink , userAttrQueryBldr . getAttributeQuery ( CIAdminAccess . AccessSet2UserAbstract . AccessSetLink ) ) ; final CachedMultiPrintQuery multi = queryBldr . getCachedPrint4Request ( ) ; multi . addAttribute ( CIAdminAccess . AccessSet2Type . AccessTypeLink ) ; multi . executeWithoutAccessCheck ( ) ; while ( multi . next ( ) ) { _permissionSet . addAccessTypeId ( multi . < Long > getAttribute ( CIAdminAccess . AccessSet2Type . AccessTypeLink ) ) ; } final Type type = Type . get ( _permissionSet . getTypeId ( ) ) ; if ( type . isCheckStatus ( ) ) { final QueryBuilder statusQueryBldr = new QueryBuilder ( CIAdminAccess . AccessSet2Status ) ; statusQueryBldr . addWhereAttrInQuery ( CIAdminAccess . AccessSet2Status . AccessSetLink , typeAttrQueryBldr . getAttributeQuery ( CIAdminAccess . AccessSet2DataModelType . AccessSetLink ) ) ; statusQueryBldr . addWhereAttrInQuery ( CIAdminAccess . AccessSet2Status . AccessSetLink , userAttrQueryBldr . getAttributeQuery ( CIAdminAccess . AccessSet2UserAbstract . AccessSetLink ) ) ; final CachedMultiPrintQuery statusMulti = statusQueryBldr . getCachedPrint4Request ( ) ; statusMulti . addAttribute ( CIAdminAccess . AccessSet2Status . SatusLink ) ; statusMulti . executeWithoutAccessCheck ( ) ; while ( statusMulti . next ( ) ) { final Long statusId = statusMulti . getAttribute ( CIAdminAccess . AccessSet2Status . SatusLink ) ; final Status status = Status . get ( statusId ) ; if ( status . getStatusGroup ( ) . getId ( ) == type . getStatusAttribute ( ) . getLink ( ) . getId ( ) ) { _permissionSet . addStatusId ( statusId ) ; } } } Evaluation . LOG . debug ( "Evaluated PermissionSet {}" , _permissionSet ) ; |
public class DMatrixUtils { /** * Get the order of the specified elements in descending or ascending order .
* @ param values A vector of integer values .
* @ param indices The indices which will be considered for ordering .
* @ param descending Flag indicating if we go descending or not .
* @ return A vector of indices sorted in the provided order . */
public static int [ ] getOrder ( int [ ] values , int [ ] indices , boolean descending ) { } } | // Create an index series :
Integer [ ] opIndices = ArrayUtils . toObject ( indices ) ; // Sort indices :
Arrays . sort ( opIndices , new Comparator < Integer > ( ) { @ Override public int compare ( Integer o1 , Integer o2 ) { if ( descending ) { return Double . compare ( values [ o2 ] , values [ o1 ] ) ; } else { return Double . compare ( values [ o1 ] , values [ o2 ] ) ; } } } ) ; return ArrayUtils . toPrimitive ( opIndices ) ; |
public class MethodCompiler { /** * Push item from runtime constant pool .
* Creates new constant if needed
* < p > Stack : . . . = & gt ; . . . , value
* @ param constant int constant
* @ throws IOException
* @ see nameArgument
* @ see addVariable */
@ Override public void ldc ( int constant ) throws IOException { } } | int index = subClass . resolveConstantIndex ( constant ) ; super . ldc ( index ) ; |
public class RefundService { /** * This function refunds a { @ link Transaction } that has been created previously and was refunded in parts or wasn ' t refunded at
* all . The inserted amount will be refunded to the credit card / direct debit of the original { @ link Transaction } . There will
* be some fees for the merchant for every refund .
* Note :
* < ul >
* < li > You can refund parts of a transaction until the transaction amount is fully refunded . But be careful there will be a fee
* for every refund < / li >
* < li > There is no need to define a currency for refunds , because they will be in the same currency as the original transaction < / li >
* < / ul >
* @ param transactionId
* Id of { @ link Transaction } , which will be refunded .
* @ param amount
* Amount ( in cents ) which will be charged .
* @ return A { @ link Refund } for the given { @ link Transaction } . */
public Refund refundTransaction ( String transactionId , Integer amount ) { } } | return this . refundTransaction ( new Transaction ( transactionId ) , amount , null ) ; |
public class OkCoinFuturesTradeService { /** * Parameters : see { @ link OkCoinFuturesTradeService . OkCoinFuturesTradeHistoryParams } */
@ Override public UserTrades getTradeHistory ( TradeHistoryParams params ) throws IOException { } } | OkCoinFuturesTradeHistoryParams myParams = ( OkCoinFuturesTradeHistoryParams ) params ; long orderId = myParams . getOrderId ( ) != null ? Long . valueOf ( myParams . getOrderId ( ) ) : - 1 ; CurrencyPair currencyPair = myParams . getCurrencyPair ( ) ; String date = myParams . getDate ( ) ; String page = myParams . getPageNumber ( ) . toString ( ) ; String pageLength = myParams . getPageLength ( ) . toString ( ) ; FuturesContract reqFuturesContract = myParams . futuresContract ; OkCoinFuturesTradeHistoryResult [ ] orderHistory = getFuturesTradesHistory ( OkCoinAdapters . adaptSymbol ( currencyPair ) , orderId , date ) ; return OkCoinAdapters . adaptTradeHistory ( orderHistory ) ; |
public class EntityMappingsImpl { /** * If not already created , a new < code > sequence - generator < / code > element will be created and returned .
* Otherwise , the first existing < code > sequence - generator < / code > element will be returned .
* @ return the instance defined for the element < code > sequence - generator < / code > */
public SequenceGenerator < EntityMappings < T > > getOrCreateSequenceGenerator ( ) { } } | List < Node > nodeList = childNode . get ( "sequence-generator" ) ; if ( nodeList != null && nodeList . size ( ) > 0 ) { return new SequenceGeneratorImpl < EntityMappings < T > > ( this , "sequence-generator" , childNode , nodeList . get ( 0 ) ) ; } return createSequenceGenerator ( ) ; |
public class InvocationWriter { /** * we match only on the number of arguments , not anything else */
private static ConstructorNode getMatchingConstructor ( List < ConstructorNode > constructors , List < Expression > argumentList ) { } } | ConstructorNode lastMatch = null ; for ( int i = 0 ; i < constructors . size ( ) ; i ++ ) { ConstructorNode cn = constructors . get ( i ) ; Parameter [ ] params = cn . getParameters ( ) ; // if number of parameters does not match we have no match
if ( argumentList . size ( ) != params . length ) continue ; if ( lastMatch == null ) { lastMatch = cn ; } else { // we already had a match so we don ' t make a direct call at all
return null ; } } return lastMatch ; |
public class Html5WebSocket { /** * { @ inheritDoc } */
@ Override public final ReadyState getReadyState ( ) { } } | if ( null == _webSocket ) { return ReadyState . CLOSED ; } else { return ReadyState . values ( ) [ _webSocket . getReadyState ( ) ] ; } |
public class JobTracker { /** * lock " is under JobTracker lock to avoid deadlocks . */
synchronized public List < List < String > > taskTrackerNames ( ) { } } | List < String > activeTrackers = new ArrayList < String > ( ) ; List < String > blacklistedTrackers = new ArrayList < String > ( ) ; synchronized ( taskTrackers ) { for ( TaskTracker tt : taskTrackers . values ( ) ) { TaskTrackerStatus status = tt . getStatus ( ) ; if ( ! faultyTrackers . isBlacklisted ( status . getHost ( ) ) ) { activeTrackers . add ( status . getTrackerName ( ) ) ; } else { blacklistedTrackers . add ( status . getTrackerName ( ) ) ; } } } List < List < String > > result = new ArrayList < List < String > > ( 2 ) ; result . add ( activeTrackers ) ; result . add ( blacklistedTrackers ) ; return result ; |
public class CmsPropertyEditorHelper { /** * Helper method to get the default property configuration for the given resource type . < p >
* @ param typeName the name of the resource type
* @ return the default property configuration for the given type */
protected Map < String , CmsXmlContentProperty > getDefaultPropertiesForType ( String typeName ) { } } | Map < String , CmsXmlContentProperty > propertyConfig = new LinkedHashMap < String , CmsXmlContentProperty > ( ) ; CmsExplorerTypeSettings explorerType = OpenCms . getWorkplaceManager ( ) . getExplorerTypeSetting ( typeName ) ; if ( explorerType != null ) { List < String > defaultProps = explorerType . getProperties ( ) ; for ( String propName : defaultProps ) { CmsXmlContentProperty property = new CmsXmlContentProperty ( propName , "string" , "string" , "" , "" , "" , "" , null , "" , "" , "false" ) ; propertyConfig . put ( propName , property ) ; } } return propertyConfig ; |
public class EditController { /** * Disables all the overrides for a specific profile
* @ param model
* @ param profileID
* @ param clientUUID
* @ return */
@ RequestMapping ( value = "api/edit/disableAll" , method = RequestMethod . POST ) public @ ResponseBody String disableAll ( Model model , int profileID , @ RequestParam ( defaultValue = Constants . PROFILE_CLIENT_DEFAULT_ID ) String clientUUID ) { } } | editService . disableAll ( profileID , clientUUID ) ; return null ; |
public class SimonStatement { /** * Starts the split for the SQL specific stopwatch , sets the note and returns the split .
* Used in the statment and prepared statement classes to measure runs of " execute " methods .
* @ return split for the execution of the specific SQL command */
protected Split startSplit ( ) { } } | Stopwatch stopwatch = SimonManager . getStopwatch ( sqlCmdLabel + Manager . HIERARCHY_DELIMITER + sqlNormalizer . getNormalizedSql ( ) . hashCode ( ) ) ; if ( stopwatch . getNote ( ) == null ) { stopwatch . setNote ( sqlNormalizer . getNormalizedSql ( ) ) ; } return stopwatch . start ( ) ; |
public class ProcessorGlobalVariableDecl { /** * Receive notification of the end of an element .
* @ param name The element type name .
* @ param attributes The specified or defaulted attributes .
* @ param handler non - null reference to current StylesheetHandler that is constructing the Templates .
* @ param uri The Namespace URI , or an empty string .
* @ param localName The local name ( without prefix ) , or empty string if not namespace processing .
* @ param rawName The qualified name ( with prefix ) . */
public void endElement ( StylesheetHandler handler , String uri , String localName , String rawName ) throws org . xml . sax . SAXException { } } | ElemVariable v = ( ElemVariable ) handler . getElemTemplateElement ( ) ; handler . getStylesheet ( ) . appendChild ( v ) ; handler . getStylesheet ( ) . setVariable ( v ) ; super . endElement ( handler , uri , localName , rawName ) ; |
public class DynamicMessage { /** * Parse a message of the given type from { @ code input } and return it . */
public static DynamicMessage parseFrom ( Descriptor type , InputStream input ) throws IOException { } } | return newBuilder ( type ) . mergeFrom ( input ) . buildParsed ( ) ; |
public class UpdateDirectConnectGatewayAssociationRequest { /** * The Amazon VPC prefixes to no longer advertise to the Direct Connect gateway .
* @ return The Amazon VPC prefixes to no longer advertise to the Direct Connect gateway . */
public java . util . List < RouteFilterPrefix > getRemoveAllowedPrefixesToDirectConnectGateway ( ) { } } | if ( removeAllowedPrefixesToDirectConnectGateway == null ) { removeAllowedPrefixesToDirectConnectGateway = new com . amazonaws . internal . SdkInternalList < RouteFilterPrefix > ( ) ; } return removeAllowedPrefixesToDirectConnectGateway ; |
public class ArmeriaMessageDeframer { /** * Closes this deframer and frees any resources . After this method is called , additional
* calls will have no effect . */
@ Override public void close ( ) { } } | if ( unprocessed != null ) { try { unprocessed . forEach ( ByteBuf :: release ) ; } finally { unprocessed = null ; } if ( endOfStream ) { listener . endOfStream ( ) ; } } |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link String } { @ code > } } */
@ XmlElementDecl ( namespace = "http://www.ibm.com/websphere/wim" , name = "street" ) public JAXBElement < String > createStreet ( String value ) { } } | return new JAXBElement < String > ( _Street_QNAME , String . class , null , value ) ; |
public class TileBoundingBoxUtils { /** * Get the overlapping bounding box between the two bounding boxes
* @ param boundingBox
* bounding box
* @ param boundingBox2
* bounding box 2
* @ param allowEmpty
* allow empty latitude and / or longitude ranges when determining
* overlap
* @ return bounding box
* @ since 2.0.0 */
public static BoundingBox overlap ( BoundingBox boundingBox , BoundingBox boundingBox2 , boolean allowEmpty ) { } } | return boundingBox . overlap ( boundingBox2 , allowEmpty ) ; |
public class HBCIUtils { /** * Berechnet die IBAN fuer ein angegebenes deutsches Konto .
* @ param k das Konto .
* @ return die berechnete IBAN . */
public static String getIBANForKonto ( Konto k ) { } } | String konto = k . number ; // Die Unterkonto - Nummer muss mit eingerechnet werden .
// Aber nur , wenn sie numerisch ist . Bei irgendeiner Bank wurde
// " EUR " als Unterkontonummer verwendet . Das geht natuerlich nicht ,
// weil damit nicht gerechnet werden kann
// Wir machen das auch nur dann , wenn beide Nummern zusammen max .
// 10 Zeichen ergeben
if ( k . subnumber != null && k . subnumber . length ( ) > 0 && k . subnumber . matches ( "[0-9]{1,8}" ) && k . number . length ( ) + k . subnumber . length ( ) <= 10 ) konto += k . subnumber ; // Pruefziffer berechnen
// Siehe http : / / www . iban . de / iban - pruefsumme . html
String zeros = "0000000000" ; String filledKonto = zeros . substring ( 0 , 10 - konto . length ( ) ) + konto ; // 10 - stellig mit Nullen fuellen
StringBuffer sb = new StringBuffer ( ) ; sb . append ( k . blz ) ; sb . append ( filledKonto ) ; sb . append ( "1314" ) ; // hartcodiert fuer " DE
sb . append ( "00" ) ; // fest vorgegeben
BigInteger mod = new BigInteger ( sb . toString ( ) ) . mod ( new BigInteger ( "97" ) ) ; // "97 " ist fest vorgegeben in ISO
// 7064 / Modulo 97-10
String checksum = String . valueOf ( 98 - mod . intValue ( ) ) ; // "98 " ist fest vorgegeben in ISO 7064 / Modulo 97-10
if ( checksum . length ( ) < 2 ) checksum = "0" + checksum ; StringBuffer result = new StringBuffer ( ) ; result . append ( "DE" ) ; result . append ( checksum ) ; result . append ( k . blz ) ; result . append ( filledKonto ) ; return result . toString ( ) ; |
public class PresenceImpl { /** * / * - - Internal Methods - - */
public JSONObject getFullPresence ( ) { } } | JSONObject game = getGameJson ( this . game ) ; return new JSONObject ( ) . put ( "afk" , idle ) . put ( "since" , System . currentTimeMillis ( ) ) . put ( "game" , game == null ? JSONObject . NULL : game ) . put ( "status" , getStatus ( ) . getKey ( ) ) ; |
public class JCalendarPopup { /** * This method is called from within the constructor to initialize the form . */
private void initComponents ( ) { } } | ClassLoader cl = this . getClass ( ) . getClassLoader ( ) ; this . setLayout ( new BoxLayout ( this , BoxLayout . Y_AXIS ) ) ; monthPanel = new JPanel ( ) ; monthPanel . setName ( "monthPanel" ) ; monthPanel . setLayout ( new BoxLayout ( monthPanel , BoxLayout . X_AXIS ) ) ; previousMonthButton = new JButton ( ) ; previousMonthButton . setName ( "previousMonthButton" ) ; monthLabel = new JLabel ( ) ; monthLabel . setName ( "monthLabel" ) ; try { Icon icon = new ImageIcon ( cl . getResource ( "org/jbundle/util/jcalendarbutton/images/buttons/" + "Back" + ".gif" ) ) ; previousMonthButton . setIcon ( icon ) ; } catch ( Exception ex ) { previousMonthButton . setText ( "<" ) ; } previousMonthButton . setMargin ( new Insets ( 2 , 2 , 2 , 2 ) ) ; previousMonthButton . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { prevMonthActionPerformed ( evt ) ; } } ) ; monthPanel . add ( previousMonthButton ) ; monthPanel . add ( Box . createHorizontalGlue ( ) ) ; monthLabel . setText ( "month" ) ; monthLabel . setHorizontalAlignment ( SwingConstants . CENTER ) ; monthPanel . add ( monthLabel ) ; nextMonthButton = new JButton ( ) ; nextMonthButton . setName ( "nextMonthButton" ) ; nextMonthButton . setAlignmentX ( 1.0F ) ; try { Icon icon = new ImageIcon ( cl . getResource ( "org/jbundle/util/jcalendarbutton/images/buttons/" + "Forward" + ".gif" ) ) ; nextMonthButton . setIcon ( icon ) ; } catch ( Exception ex ) { nextMonthButton . setText ( ">" ) ; } nextMonthButton . setMargin ( new Insets ( 2 , 2 , 2 , 2 ) ) ; nextMonthButton . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { nextMonthActionPerformed ( evt ) ; } } ) ; monthPanel . add ( Box . createHorizontalGlue ( ) ) ; monthPanel . add ( nextMonthButton ) ; add ( monthPanel ) ; yearPanel = new JPanel ( ) ; yearPanel . setName ( "yearPanel" ) ; yearPanel . setLayout ( new BoxLayout ( yearPanel , BoxLayout . X_AXIS ) ) ; previousYearButton = new JButton ( ) ; previousYearButton . setName ( "previousYearButton" ) ; yearLabel = new JLabel ( ) ; yearLabel . setName ( "yearLabel" ) ; try { Icon icon = new ImageIcon ( cl . getResource ( "org/jbundle/util/jcalendarbutton/images/buttons/" + "Back" + ".gif" ) ) ; previousYearButton . setIcon ( icon ) ; } catch ( Exception ex ) { previousYearButton . setText ( "<" ) ; } previousYearButton . setMargin ( new Insets ( 2 , 2 , 2 , 2 ) ) ; previousYearButton . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { prevYearActionPerformed ( evt ) ; } } ) ; yearPanel . add ( previousYearButton ) ; yearPanel . add ( Box . createHorizontalGlue ( ) ) ; yearLabel . setText ( "Year" ) ; yearLabel . setHorizontalAlignment ( SwingConstants . CENTER ) ; yearPanel . add ( yearLabel ) ; yearPanel . add ( Box . createHorizontalGlue ( ) ) ; nextYearButton = new JButton ( ) ; nextYearButton . setName ( "nextYearButton" ) ; nextYearButton . setAlignmentX ( 1.0F ) ; try { Icon icon = new ImageIcon ( cl . getResource ( "org/jbundle/util/jcalendarbutton/images/buttons/" + "Forward" + ".gif" ) ) ; nextYearButton . setIcon ( icon ) ; } catch ( Exception ex ) { nextYearButton . setText ( ">" ) ; } nextYearButton . setMargin ( new Insets ( 2 , 2 , 2 , 2 ) ) ; nextYearButton . addActionListener ( new ActionListener ( ) { public void actionPerformed ( ActionEvent evt ) { nextYearActionPerformed ( evt ) ; } } ) ; yearPanel . add ( nextYearButton ) ; add ( yearPanel ) ; panelDays = new JPanel ( ) ; panelDays . setName ( "panelDays" ) ; panelDays . setLayout ( new GridLayout ( 7 , 7 ) ) ; for ( int i = 1 ; i <= 7 ; i ++ ) { JLabel label = new JLabel ( ) ; label . setText ( Integer . toString ( i ) ) ; label . setHorizontalAlignment ( SwingConstants . CENTER ) ; panelDays . add ( label ) ; } for ( int i = 1 ; i <= 7 * 6 ; i ++ ) { JLabel label = new JLabel ( ) ; label . setBorder ( EMPTY_BORDER ) ; label . setHorizontalAlignment ( SwingConstants . CENTER ) ; panelDays . add ( label ) ; } add ( panelDays ) ; this . setBorder ( new EmptyBorder ( 2 , 2 , 2 , 2 ) ) ; |
public class DockerPathUtil { /** * Resolves the supplied resource ( a path or directory on the filesystem ) relative the supplied { @ code
* baseDir } . The returned { @ code File } is guaranteed to be { @ link File # isAbsolute ( ) absolute } . The returned file
* is < em > not < / em > guaranteed to exist .
* If the supplied { @ code pathToResolve } is already { @ link File # isAbsolute ( ) absolute } , then it is returned
* < em > unmodified < / em > . Otherwise , the { @ code pathToResolve } is returned as an absolute { @ code File } using the
* supplied { @ code baseDir } as its parent .
* @ param pathToResolve represents a filesystem resource , which may be an absolute path
* @ param baseDir the absolute path used to resolve non - absolute path resources ; < em > must < / em > be absolute
* @ return an absolute { @ code File } reference to { @ code pathToResolve } ; < em > not < / em > guaranteed to exist
* @ throws IllegalArgumentException if the supplied { @ code baseDir } does not represent an absolute path */
public static File resolveAbsolutely ( String pathToResolve , String baseDir ) { } } | // TODO : handle the case where pathToResolve specifies a non - existent path , for example , a base directory equal to " / " and a relative path of " . . / . . / foo " .
File fileToResolve = new File ( pathToResolve ) ; if ( fileToResolve . isAbsolute ( ) ) { return fileToResolve ; } if ( baseDir == null ) { throw new IllegalArgumentException ( "Cannot resolve relative path '" + pathToResolve + "' with a " + "null base directory." ) ; } File baseDirAsFile = new File ( baseDir ) ; if ( ! baseDirAsFile . isAbsolute ( ) ) { throw new IllegalArgumentException ( "Base directory '" + baseDirAsFile + "' must be absolute" ) ; } final File toCanonicalize = new File ( baseDirAsFile , pathToResolve ) ; try { return toCanonicalize . getCanonicalFile ( ) ; } catch ( IOException e ) { throw new RuntimeException ( "Unable to canonicalize the file path '" + toCanonicalize + "'" ) ; } |
public class Category { /** * Delegates to { @ link org . slf4j . Logger # debug ( String ) } method of SLF4J . */
public void debug ( Object message ) { } } | differentiatedLog ( null , CATEGORY_FQCN , LocationAwareLogger . DEBUG_INT , message , null ) ; |
public class MethodWriter { /** * Visit the implicit first frame of this method . */
private void visitImplicitFirstFrame ( ) { } } | // There can be at most descriptor . length ( ) + 1 locals
int frameIndex = startFrame ( 0 , descriptor . length ( ) + 1 , 0 ) ; if ( ( access & Opcodes . ACC_STATIC ) == 0 ) { if ( ( access & ACC_CONSTRUCTOR ) == 0 ) { frame [ frameIndex ++ ] = Frame . OBJECT | cw . addType ( cw . thisName ) ; } else { frame [ frameIndex ++ ] = Frame . UNINITIALIZED_THIS ; } } int i = 1 ; loop : while ( true ) { int j = i ; switch ( descriptor . charAt ( i ++ ) ) { case 'Z' : case 'C' : case 'B' : case 'S' : case 'I' : frame [ frameIndex ++ ] = Frame . INTEGER ; break ; case 'F' : frame [ frameIndex ++ ] = Frame . FLOAT ; break ; case 'J' : frame [ frameIndex ++ ] = Frame . LONG ; break ; case 'D' : frame [ frameIndex ++ ] = Frame . DOUBLE ; break ; case '[' : while ( descriptor . charAt ( i ) == '[' ) { ++ i ; } if ( descriptor . charAt ( i ) == 'L' ) { ++ i ; while ( descriptor . charAt ( i ) != ';' ) { ++ i ; } } frame [ frameIndex ++ ] = Frame . type ( cw , descriptor . substring ( j , ++ i ) ) ; break ; case 'L' : while ( descriptor . charAt ( i ) != ';' ) { ++ i ; } frame [ frameIndex ++ ] = Frame . OBJECT | cw . addType ( descriptor . substring ( j + 1 , i ++ ) ) ; break ; default : break loop ; } } frame [ 1 ] = frameIndex - 3 ; endFrame ( ) ; |
public class Groovy2CompilerHelper { /** * Compile the given source and load the resultant classes into a new { @ link ClassNotFoundException }
* @ return initialized and laoded classes
* @ throws ScriptCompilationException */
@ SuppressWarnings ( "unchecked" ) public Set < GroovyClass > compile ( ) throws ScriptCompilationException { } } | final CompilerConfiguration conf = compileConfig != null ? compileConfig : CompilerConfiguration . DEFAULT ; conf . setTolerance ( 0 ) ; conf . setVerbose ( true ) ; conf . setTargetDirectory ( targetDir . toFile ( ) ) ; final ClassLoader buildParentClassloader = parentClassLoader != null ? parentClassLoader : Thread . currentThread ( ) . getContextClassLoader ( ) ; GroovyClassLoader groovyClassLoader = AccessController . doPrivileged ( new PrivilegedAction < GroovyClassLoader > ( ) { public GroovyClassLoader run ( ) { return new GroovyClassLoader ( buildParentClassloader , conf , false ) ; } } ) ; CompilationUnit unit = new CompilationUnit ( conf , null , groovyClassLoader ) ; Set < String > scriptExtensions = conf . getScriptExtensions ( ) ; try { for ( ScriptArchive scriptArchive : scriptArchives ) { Set < String > entryNames = scriptArchive . getArchiveEntryNames ( ) ; for ( String entryName : entryNames ) { for ( String extension : scriptExtensions ) { if ( entryName . endsWith ( extension ) ) { // identified groovy file
unit . addSource ( scriptArchive . getEntry ( entryName ) ) ; } } } } } catch ( IOException e ) { throw new ScriptCompilationException ( "Exception loading source files" , e ) ; } for ( Path sourceFile : sourceFiles ) { unit . addSource ( sourceFile . toFile ( ) ) ; } try { unit . compile ( Phases . OUTPUT ) ; } catch ( CompilationFailedException e ) { throw new ScriptCompilationException ( "Exception during script compilation" , e ) ; } return new HashSet < GroovyClass > ( unit . getClasses ( ) ) ; |
public class InternalSARLParser { /** * InternalSARL . g : 9229:1 : ruleTypeReferenceWithTypeArgs returns [ EObject current = null ] : ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * ) | ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + ) | this _ XFunctionTypeRef _ 6 = ruleXFunctionTypeRef ) ; */
public final EObject ruleTypeReferenceWithTypeArgs ( ) throws RecognitionException { } } | EObject current = null ; EObject this_ParameterizedTypeReferenceWithTypeArgs_0 = null ; EObject this_TypeReferenceNoTypeArgs_3 = null ; EObject this_XFunctionTypeRef_6 = null ; enterRule ( ) ; try { // InternalSARL . g : 9235:2 : ( ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * ) | ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + ) | this _ XFunctionTypeRef _ 6 = ruleXFunctionTypeRef ) )
// InternalSARL . g : 9236:2 : ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * ) | ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + ) | this _ XFunctionTypeRef _ 6 = ruleXFunctionTypeRef )
{ // InternalSARL . g : 9236:2 : ( ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * ) | ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + ) | this _ XFunctionTypeRef _ 6 = ruleXFunctionTypeRef )
int alt245 = 3 ; alt245 = dfa245 . predict ( input ) ; switch ( alt245 ) { case 1 : // InternalSARL . g : 9237:3 : ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * )
{ // InternalSARL . g : 9237:3 : ( this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) * )
// InternalSARL . g : 9238:4 : this _ ParameterizedTypeReferenceWithTypeArgs _ 0 = ruleParameterizedTypeReferenceWithTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) *
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getParameterizedTypeReferenceWithTypeArgsParserRuleCall_0_0 ( ) ) ; } pushFollow ( FOLLOW_89 ) ; this_ParameterizedTypeReferenceWithTypeArgs_0 = ruleParameterizedTypeReferenceWithTypeArgs ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = this_ParameterizedTypeReferenceWithTypeArgs_0 ; afterParserOrEnumRuleCall ( ) ; } // InternalSARL . g : 9246:4 : ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) *
loop243 : do { int alt243 = 2 ; int LA243_0 = input . LA ( 1 ) ; if ( ( LA243_0 == 55 ) && ( synpred15_InternalSARL ( ) ) ) { alt243 = 1 ; } switch ( alt243 ) { case 1 : // InternalSARL . g : 9247:5 : ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets )
{ // InternalSARL . g : 9253:5 : ( ( ) ruleArrayBrackets )
// InternalSARL . g : 9254:6 : ( ) ruleArrayBrackets
{ // InternalSARL . g : 9254:6 : ( )
// InternalSARL . g : 9255:7:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElementAndSet ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getJvmGenericArrayTypeReferenceComponentTypeAction_0_1_0_0 ( ) , current ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getArrayBracketsParserRuleCall_0_1_0_1 ( ) ) ; } pushFollow ( FOLLOW_89 ) ; ruleArrayBrackets ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } break ; default : break loop243 ; } } while ( true ) ; } } break ; case 2 : // InternalSARL . g : 9272:3 : ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + )
{ // InternalSARL . g : 9272:3 : ( this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) + )
// InternalSARL . g : 9273:4 : this _ TypeReferenceNoTypeArgs _ 3 = ruleTypeReferenceNoTypeArgs ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) +
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getTypeReferenceNoTypeArgsParserRuleCall_1_0 ( ) ) ; } pushFollow ( FOLLOW_90 ) ; this_TypeReferenceNoTypeArgs_3 = ruleTypeReferenceNoTypeArgs ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = this_TypeReferenceNoTypeArgs_3 ; afterParserOrEnumRuleCall ( ) ; } // InternalSARL . g : 9281:4 : ( ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets ) ) +
int cnt244 = 0 ; loop244 : do { int alt244 = 2 ; int LA244_0 = input . LA ( 1 ) ; if ( ( LA244_0 == 55 ) && ( synpred16_InternalSARL ( ) ) ) { alt244 = 1 ; } switch ( alt244 ) { case 1 : // InternalSARL . g : 9282:5 : ( ( ( ) ruleArrayBrackets ) ) = > ( ( ) ruleArrayBrackets )
{ // InternalSARL . g : 9288:5 : ( ( ) ruleArrayBrackets )
// InternalSARL . g : 9289:6 : ( ) ruleArrayBrackets
{ // InternalSARL . g : 9289:6 : ( )
// InternalSARL . g : 9290:7:
{ if ( state . backtracking == 0 ) { current = forceCreateModelElementAndSet ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getJvmGenericArrayTypeReferenceComponentTypeAction_1_1_0_0 ( ) , current ) ; } } if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getArrayBracketsParserRuleCall_1_1_0_1 ( ) ) ; } pushFollow ( FOLLOW_89 ) ; ruleArrayBrackets ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { afterParserOrEnumRuleCall ( ) ; } } } break ; default : if ( cnt244 >= 1 ) break loop244 ; if ( state . backtracking > 0 ) { state . failed = true ; return current ; } EarlyExitException eee = new EarlyExitException ( 244 , input ) ; throw eee ; } cnt244 ++ ; } while ( true ) ; } } break ; case 3 : // InternalSARL . g : 9307:3 : this _ XFunctionTypeRef _ 6 = ruleXFunctionTypeRef
{ if ( state . backtracking == 0 ) { newCompositeNode ( grammarAccess . getTypeReferenceWithTypeArgsAccess ( ) . getXFunctionTypeRefParserRuleCall_2 ( ) ) ; } pushFollow ( FOLLOW_2 ) ; this_XFunctionTypeRef_6 = ruleXFunctionTypeRef ( ) ; state . _fsp -- ; if ( state . failed ) return current ; if ( state . backtracking == 0 ) { current = this_XFunctionTypeRef_6 ; afterParserOrEnumRuleCall ( ) ; } } break ; } } if ( state . backtracking == 0 ) { leaveRule ( ) ; } } catch ( RecognitionException re ) { recover ( input , re ) ; appendSkippedTokens ( ) ; } finally { } return current ; |
public class NameMatcher { /** * Create a NameMatcher that matches names equaling the given string . */
public static < T extends Key < T > > NameMatcher < T > nameEquals ( final String compareTo ) { } } | return new NameMatcher < > ( compareTo , StringOperatorName . EQUALS ) ; |
public class TagsUtil { /** * Creates tags info beans from given
* tags map with tag names as keys and tag values as map values
* @ param tagsMap map of tag names and values
* @ return list of tag entries */
public static List < TagEntryAO > tagsMapToTagEntries ( Map < String , String > tagsMap ) { } } | if ( tagsMap == null ) return Collections . EMPTY_LIST ; List < TagEntryAO > tagEntries = new ArrayList < > ( tagsMap . size ( ) ) ; for ( Map . Entry < String , String > entry : tagsMap . entrySet ( ) ) tagEntries . add ( new TagEntryAO ( entry . getKey ( ) , entry . getValue ( ) ) ) ; return tagEntries ; |
public class PandaApi { /** * Ask the Flickr Pandas for a list of recent public ( and " safe " ) photos .
* < br >
* More information about the pandas can be found on the
* < a href = " http : / / code . flickr . com / blog / 2009/03/03 / panda - tuesday - the - history - of - the - panda - new - apis - explore - and - you / " > dev blog < / a > . Authentication
* < br >
* This method does not require authentication .
* < br >
* You can fetch a list of all the current pandas using the { @ link # getList ( ) } API method .
* @ param pandaName ( Required ) The name of the panda to ask for photos from .
* @ param extras extra information to fetch for each returned record .
* @ param perPage Number of photos to return per page . If this argument is less than 1 , it defaults to 100 . The maximum allowed value is 500.
* @ param page The page of results to return . If this argument is less than 1 , it defaults to 1.
* @ param sign if true , the request will be signed .
* @ return photos object from the panda .
* @ throws Exception if required parameter is missing , or if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . panda . getPhotos . html " > flickr . panda . getPhotos < / a > */
public Photos getPhotos ( String pandaName , EnumSet < JinxConstants . PhotoExtras > extras , int perPage , int page , boolean sign ) throws Exception { } } | JinxUtils . validateParams ( pandaName ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.panda.getPhotos" ) ; params . put ( "panda_name" , pandaName ) ; if ( ! JinxUtils . isNullOrEmpty ( extras ) ) { params . put ( "extras" , JinxUtils . buildCommaDelimitedList ( extras ) ) ; } if ( perPage > 0 ) { params . put ( "per_page" , Integer . toString ( perPage ) ) ; } if ( page > 0 ) { params . put ( "page" , Integer . toString ( page ) ) ; } return jinx . flickrGet ( params , Photos . class , sign ) ; |
public class Waiter { /** * Waits for a log message to appear .
* Requires read logs permission ( android . permission . READ _ LOGS ) in AndroidManifest . xml of the application under test .
* @ param logMessage the log message to wait for
* @ param timeout the amount of time in milliseconds to wait
* @ return true if log message appears and false if it does not appear before the timeout */
public boolean waitForLogMessage ( String logMessage , int timeout ) { } } | StringBuilder stringBuilder = new StringBuilder ( ) ; long endTime = SystemClock . uptimeMillis ( ) + timeout ; while ( SystemClock . uptimeMillis ( ) <= endTime ) { if ( getLog ( stringBuilder ) . lastIndexOf ( logMessage ) != - 1 ) { return true ; } sleeper . sleep ( ) ; } return false ; |
public class ExpressionUtils { /** * Create the intersection of the given arguments
* @ param exprs predicates
* @ return intersection */
@ Nullable public static Predicate allOf ( Collection < Predicate > exprs ) { } } | Predicate rv = null ; for ( Predicate b : exprs ) { if ( b != null ) { rv = rv == null ? b : ExpressionUtils . and ( rv , b ) ; } } return rv ; |
public class ResourceDescriptionsData { /** * Put a new resource description into the index , or remove one if the delta has no new description . A delta for a
* particular URI may be registered more than once ; overwriting any earlier registration .
* @ param delta
* The resource change .
* @ since 2.9 */
public void register ( Delta delta ) { } } | final IResourceDescription newDesc = delta . getNew ( ) ; if ( newDesc == null ) { removeDescription ( delta . getUri ( ) ) ; } else { addDescription ( delta . getUri ( ) , newDesc ) ; } |
public class JournalConsumer { /** * Reject API calls from outside while we are in recovery mode . */
public Date setDatastreamState ( Context context , String pid , String dsID , String dsState , String logMessage ) throws ServerException { } } | throw rejectCallsFromOutsideWhileInRecoveryMode ( ) ; |
public class CanonicalPlanner { /** * Validate the supplied query .
* @ param context the context in which the query is being planned
* @ param query the set query to be planned
* @ param usedSelectors the map of { @ link SelectorName } s ( aliases or names ) used in the query . */
protected void validate ( QueryContext context , QueryCommand query , Map < SelectorName , Table > usedSelectors ) { } } | // / / Resolve everything . . .
// Visitors . visitAll ( query , new Validator ( context , usedSelectors ) ) ;
// Resolve everything ( except subqueries ) . . .
Validator validator = new Validator ( context , usedSelectors ) ; query . accept ( new WalkAllVisitor ( validator ) { @ Override protected void enqueue ( Visitable objectToBeVisited ) { if ( objectToBeVisited instanceof Subquery ) return ; super . enqueue ( objectToBeVisited ) ; } } ) ; |
public class IntArrayList { /** * Removes all of the elements from this list . The list will
* be empty after this call returns . */
@ Override public void clear ( ) { } } | modCount ++ ; // Let gc do its work
for ( int i = 0 ; i < size ; i ++ ) elementData [ i ] = 0 ; size = 0 ; |
public class MemoizeExtension { /** * True if one of the given annotations is { @ code @ Nullable } in any package . */
private static boolean containsNullable ( List < ? extends AnnotationMirror > annotations ) { } } | return annotations . stream ( ) . map ( a -> a . getAnnotationType ( ) . asElement ( ) . getSimpleName ( ) ) . anyMatch ( n -> n . contentEquals ( "Nullable" ) ) ; |
public class LDPathWrapper { /** * Execute an LDPath query
* @ param uri the URI to query
* @ param program the LDPath program
* @ return a result object wrapped in a List
* @ throws LDPathParseException if the LDPath program was malformed */
public List < Map < String , Collection < ? > > > programQuery ( final String uri , final InputStream program ) throws LDPathParseException { } } | return singletonList ( ldpath . programQuery ( new URIImpl ( uri ) , new InputStreamReader ( program ) ) ) ; |
public class ST_Densify { /** * Densify a geometry using the given distance tolerance .
* @ param geometry Geometry
* @ param tolerance Distance tolerance
* @ return Densified geometry */
public static Geometry densify ( Geometry geometry , double tolerance ) { } } | if ( geometry == null ) { return null ; } return Densifier . densify ( geometry , tolerance ) ; |
public class JPAEntityManager { /** * ( non - Javadoc )
* @ see javax . persistence . EntityManager # setFlushMode ( javax . persistence . FlushModeType ) */
@ Override public void setFlushMode ( FlushModeType flushMode ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "em.setFlushMode(" + flushMode + ");\n" + toString ( ) ) ; getEMInvocationInfo ( false ) . setFlushMode ( flushMode ) ; |
public class BaseDestinationHandler { /** * Check permission to access a Discriminator
* @ param secContext
* @ param operation
* @ return */
@ Override public boolean checkDiscriminatorAccess ( SecurityContext secContext , OperationType operation ) throws SIDiscriminatorSyntaxException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "checkDiscriminatorAccess" , new Object [ ] { secContext , operation } ) ; boolean allow = true ; if ( isTopicAccessCheckRequired ( ) ) { if ( ! accessChecker . checkDiscriminatorAccess ( secContext , this , secContext . getDiscriminator ( ) , operation ) ) { allow = false ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "checkDiscriminatorAccess" , Boolean . valueOf ( allow ) ) ; return allow ; |
public class Types { /** * Insert a type in a closure */
public List < Type > insert ( List < Type > cl , Type t , BiPredicate < Type , Type > shouldSkip ) { } } | if ( cl . isEmpty ( ) ) { return cl . prepend ( t ) ; } else if ( shouldSkip . test ( t , cl . head ) ) { return cl ; } else if ( t . tsym . precedes ( cl . head . tsym , this ) ) { return cl . prepend ( t ) ; } else { // t comes after head , or the two are unrelated
return insert ( cl . tail , t , shouldSkip ) . prepend ( cl . head ) ; } |
public class DateUtils { /** * Adds a number of days to a date returning a new object .
* The original date object is unchanged .
* @ param date the date , not null
* @ param numberOfDays the amount to add , may be negative
* @ return the new date object with the amount added */
public static Date addDays ( Date date , int numberOfDays ) { } } | return Date . from ( date . toInstant ( ) . plus ( numberOfDays , ChronoUnit . DAYS ) ) ; |
public class SyncPointInfo { /** * < code > optional string syncPointUri = 1 ; < / code > */
public com . google . protobuf . ByteString getSyncPointUriBytes ( ) { } } | java . lang . Object ref = syncPointUri_ ; if ( ref instanceof java . lang . String ) { com . google . protobuf . ByteString b = com . google . protobuf . ByteString . copyFromUtf8 ( ( java . lang . String ) ref ) ; syncPointUri_ = b ; return b ; } else { return ( com . google . protobuf . ByteString ) ref ; } |
public class ComputationGraphConfiguration { /** * Handle { @ link WeightInit } and { @ link Distribution } from legacy configs in Json format . Copied from handling of { @ link Activation }
* above .
* @ return True if all is well and layer iteration shall continue . False else - wise . */
private static void handleLegacyWeightInitFromJson ( String json , Layer layer , ObjectMapper mapper , JsonNode vertices ) { } } | if ( layer instanceof BaseLayer && ( ( BaseLayer ) layer ) . getWeightInitFn ( ) == null ) { String layerName = layer . getLayerName ( ) ; try { if ( vertices == null ) { JsonNode jsonNode = mapper . readTree ( json ) ; vertices = jsonNode . get ( "vertices" ) ; } JsonNode vertexNode = vertices . get ( layerName ) ; JsonNode layerVertexNode = vertexNode . get ( "LayerVertex" ) ; if ( layerVertexNode == null || ! layerVertexNode . has ( "layerConf" ) || ! layerVertexNode . get ( "layerConf" ) . has ( "layer" ) ) { return ; } JsonNode layerWrapperNode = layerVertexNode . get ( "layerConf" ) . get ( "layer" ) ; if ( layerWrapperNode == null || layerWrapperNode . size ( ) != 1 ) { return ; } JsonNode layerNode = layerWrapperNode . elements ( ) . next ( ) ; JsonNode weightInit = layerNode . get ( "weightInit" ) ; // Should only have 1 element : " dense " , " output " , etc
JsonNode distribution = layerNode . get ( "dist" ) ; Distribution dist = null ; if ( distribution != null ) { dist = mapper . treeToValue ( distribution , Distribution . class ) ; } if ( weightInit != null ) { final IWeightInit wi = WeightInit . valueOf ( weightInit . asText ( ) ) . getWeightInitFunction ( dist ) ; ( ( BaseLayer ) layer ) . setWeightInitFn ( wi ) ; } } catch ( IOException e ) { log . warn ( "Layer with null ActivationFn field or pre-0.7.2 activation function detected: could not parse JSON" , e ) ; } } |
public class SqlBuilder { /** * 构建SQL语句参数表
* @ param parameters 参数对象
* @ return 参数表 < 参数名称 , 参数值 > */
@ SuppressWarnings ( "unchecked" ) private Map < String , Object > buildParameters ( Object parameters ) { } } | Map < String , Object > parameterMap = new HashMap < String , Object > ( ) ; if ( parameters != null ) { if ( parameters . getClass ( ) . isArray ( ) ) { Object [ ] paramValues = ( Object [ ] ) parameters ; for ( int i = 0 ; i < paramValues . length ; i ++ ) { if ( paramValues [ i ] == null ) { paramValues [ i ] = "" ; } parameterMap . put ( Integer . toString ( i ) , paramValues [ i ] ) ; } } else if ( parameters instanceof Map ) { parameterMap = ( Map < String , Object > ) parameters ; } else { Class < ? extends Object > paramClass = parameters . getClass ( ) ; Field [ ] fields = paramClass . getDeclaredFields ( ) ; for ( Field field : fields ) { field . setAccessible ( true ) ; String fieldName = field . getName ( ) ; Object fieldValue = null ; try { fieldValue = field . get ( parameters ) ; } catch ( Exception e ) { fieldValue = null ; } if ( fieldName != null && fieldValue != null ) { parameterMap . put ( fieldName , fieldValue ) ; } } } } return parameterMap ; |
public class UCSDAnomalyVideoFrameViewer { /** * Create the tree
* @ param top */
private void createNodes ( DefaultMutableTreeNode top ) { } } | // leaves
DefaultMutableTreeNode defaultMutableTreeNode = null ; // Train Files
DefaultMutableTreeNode trainCategory = new DefaultMutableTreeNode ( "Train" ) ; top . add ( trainCategory ) ; // Test Files
DefaultMutableTreeNode testCategory = new DefaultMutableTreeNode ( "Test" ) ; top . add ( testCategory ) ; // long count = UCSDAnomalyDAO . selectCount ( ) ;
int trainTestSplit = UCSDAnomalyDAO . getTrainTestSplit ( ) ; int index = 1 ; do { DefaultMutableTreeNode category = new DefaultMutableTreeNode ( index ) ; if ( index <= trainTestSplit ) { trainCategory . add ( category ) ; } else { testCategory . add ( category ) ; } List < UCSDAnomaly > fames = UCSDAnomalyDAO . selectClip ( index ) ; for ( UCSDAnomaly ucsdAnomaly : fames ) { // ucsdAnomaly . getTifid ( ) ;
defaultMutableTreeNode = new DefaultMutableTreeNode ( ucsdAnomaly ) ; category . add ( defaultMutableTreeNode ) ; } } while ( UCSDAnomalyDAO . selectClip ( ++ index ) . size ( ) > 0 ) ; |
public class PushManager { /** * Checks if Google Play Services is available on the device .
* @ return True if Google Play Services is available . */
boolean checkAvailablePush ( Context context ) { } } | int connectionStatus = GoogleApiAvailability . getInstance ( ) . isGooglePlayServicesAvailable ( context ) ; if ( connectionStatus == ConnectionResult . SUCCESS ) { log . i ( "Google Play Services are available on this device." ) ; return true ; } else { if ( GoogleApiAvailability . getInstance ( ) . isUserResolvableError ( connectionStatus ) ) { log . e ( "Google Play Services is probably not up to date. User recoverable Error Code is " + connectionStatus ) ; } else { log . e ( "This device is not supported by Google Play Services." ) ; } return false ; } |
public class BinaryEnricher { /** * Iterates through all nodes of the given KeePass file and replace the
* nodes with enriched attachment data nodes .
* @ param keePassFile
* the KeePass file which should be iterated
* @ return an enriched KeePass file */
public KeePassFile enrichNodesWithBinaryData ( KeePassFile keePassFile ) { } } | Binaries binaryLibrary = keePassFile . getMeta ( ) . getBinaries ( ) ; GroupZipper zipper = new GroupZipper ( keePassFile ) ; Iterator < Group > iter = zipper . iterator ( ) ; while ( iter . hasNext ( ) ) { Group group = iter . next ( ) ; enrichEntriesWithBinaryData ( binaryLibrary , group ) ; } return zipper . close ( ) ; |
public class IntPoint { /** * Calculate Euclidean distance between two points .
* @ param anotherPoint Point to calculate distance to .
* @ return Euclidean distance between this point and anotherPoint points . */
public float DistanceTo ( IntPoint anotherPoint ) { } } | float dx = this . x - anotherPoint . x ; float dy = this . y - anotherPoint . y ; return ( float ) Math . sqrt ( dx * dx + dy * dy ) ; |
public class RelativePath { /** * figure out a string representing the relative path of
* ' f ' with respect to ' r '
* @ param basePath home path
* @ param filePath path of file */
private static String matchPathLists ( List < String > basePath , List < String > filePath ) { } } | // start at the beginning of the lists
// iterate while both lists are equal
final StringBuilder relativePath = new StringBuilder ( ) ; final ListIterator < String > basePathItr = basePath . listIterator ( basePath . size ( ) - 1 ) ; final ListIterator < String > filePathItr = filePath . listIterator ( filePath . size ( ) - 1 ) ; // first eliminate common root elements
while ( basePathItr . hasPrevious ( ) && filePathItr . hasPrevious ( ) ) { if ( ! basePathItr . previous ( ) . equals ( filePathItr . previous ( ) ) ) { basePathItr . next ( ) ; filePathItr . next ( ) ; break ; } } // for each remaining level in the home path , add a . .
for ( ; basePathItr . hasPrevious ( ) ; basePathItr . previous ( ) ) { relativePath . append ( ".." ) . append ( File . separator ) ; } // for each level in the file path , add the path
while ( filePathItr . hasPrevious ( ) ) { relativePath . append ( filePathItr . previous ( ) ) ; if ( filePathItr . hasPrevious ( ) ) { relativePath . append ( File . separator ) ; } } return relativePath . toString ( ) ; |
public class JSONParser { /** * Stream processing of JSON text .
* @ see JsonContentHandler
* @ param in
* @ param contentHandler
* @ param isResume - Indicates if it continues previous parsing operation .
* If set to true , resume parsing the old stream , and parameter ' in ' will be ignored .
* If this method is called for the first time in this instance , isResume will be ignored .
* @ throws IOException
* @ throws ParseException
* @ throws SAXException */
public void parse ( Reader in , JsonContentHandler contentHandler , boolean isResume ) throws IOException , ParseException , SAXException { } } | if ( ! isResume ) { reset ( in ) ; handlerStatusStack = new LinkedList < Object > ( ) ; } else { if ( handlerStatusStack == null ) { isResume = false ; reset ( in ) ; handlerStatusStack = new LinkedList < Object > ( ) ; } } LinkedList < Object > statusStack = handlerStatusStack ; try { do { switch ( status ) { case S_INIT : contentHandler . startJSON ( ) ; nextToken ( ) ; switch ( token . type ) { case Yytoken . TYPE_VALUE : status = S_IN_FINISHED_VALUE ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . primitive ( token . value ) ) return ; break ; case Yytoken . TYPE_LEFT_BRACE : status = S_IN_OBJECT ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startObject ( ) ) return ; break ; case Yytoken . TYPE_LEFT_SQUARE : status = S_IN_ARRAY ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startArray ( ) ) return ; break ; default : status = S_IN_ERROR ; } // inner switch
break ; case S_IN_FINISHED_VALUE : nextToken ( ) ; if ( token . type == Yytoken . TYPE_EOF ) { contentHandler . endJSON ( ) ; status = S_END ; return ; } else { status = S_IN_ERROR ; throw new ParseException ( getPosition ( ) , ParseException . ERROR_UNEXPECTED_TOKEN , token ) ; } case S_IN_OBJECT : nextToken ( ) ; switch ( token . type ) { case Yytoken . TYPE_COMMA : break ; case Yytoken . TYPE_VALUE : if ( token . value instanceof String ) { String key = ( String ) token . value ; status = S_PASSED_PAIR_KEY ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startObjectEntry ( key ) ) return ; } else { status = S_IN_ERROR ; } break ; case Yytoken . TYPE_RIGHT_BRACE : if ( statusStack . size ( ) > 1 ) { statusStack . removeFirst ( ) ; status = peekStatus ( statusStack ) ; } else { status = S_IN_FINISHED_VALUE ; } if ( ! contentHandler . endObject ( ) ) return ; break ; default : status = S_IN_ERROR ; break ; } // inner switch
break ; case S_PASSED_PAIR_KEY : nextToken ( ) ; switch ( token . type ) { case Yytoken . TYPE_COLON : break ; case Yytoken . TYPE_VALUE : statusStack . removeFirst ( ) ; status = peekStatus ( statusStack ) ; if ( ! contentHandler . primitive ( token . value ) ) return ; if ( ! contentHandler . endObjectEntry ( ) ) return ; break ; case Yytoken . TYPE_LEFT_SQUARE : statusStack . removeFirst ( ) ; statusStack . addFirst ( new Integer ( S_IN_PAIR_VALUE ) ) ; status = S_IN_ARRAY ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startArray ( ) ) return ; break ; case Yytoken . TYPE_LEFT_BRACE : statusStack . removeFirst ( ) ; statusStack . addFirst ( new Integer ( S_IN_PAIR_VALUE ) ) ; status = S_IN_OBJECT ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startObject ( ) ) return ; break ; default : status = S_IN_ERROR ; } break ; case S_IN_PAIR_VALUE : /* * S _ IN _ PAIR _ VALUE is just a marker to indicate the end of an object entry , it doesn ' t proccess any token ,
* therefore delay consuming token until next round . */
statusStack . removeFirst ( ) ; status = peekStatus ( statusStack ) ; if ( ! contentHandler . endObjectEntry ( ) ) return ; break ; case S_IN_ARRAY : nextToken ( ) ; switch ( token . type ) { case Yytoken . TYPE_COMMA : break ; case Yytoken . TYPE_VALUE : if ( ! contentHandler . primitive ( token . value ) ) return ; break ; case Yytoken . TYPE_RIGHT_SQUARE : if ( statusStack . size ( ) > 1 ) { statusStack . removeFirst ( ) ; status = peekStatus ( statusStack ) ; } else { status = S_IN_FINISHED_VALUE ; } if ( ! contentHandler . endArray ( ) ) return ; break ; case Yytoken . TYPE_LEFT_BRACE : status = S_IN_OBJECT ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startObject ( ) ) return ; break ; case Yytoken . TYPE_LEFT_SQUARE : status = S_IN_ARRAY ; statusStack . addFirst ( new Integer ( status ) ) ; if ( ! contentHandler . startArray ( ) ) return ; break ; default : status = S_IN_ERROR ; } // inner switch
break ; case S_END : return ; case S_IN_ERROR : throw new ParseException ( getPosition ( ) , ParseException . ERROR_UNEXPECTED_TOKEN , token ) ; } // switch
if ( status == S_IN_ERROR ) { throw new ParseException ( getPosition ( ) , ParseException . ERROR_UNEXPECTED_TOKEN , token ) ; } } while ( token . type != Yytoken . TYPE_EOF ) ; } catch ( IOException ie ) { status = S_IN_ERROR ; throw ie ; } catch ( ParseException pe ) { status = S_IN_ERROR ; throw pe ; } catch ( RuntimeException re ) { status = S_IN_ERROR ; throw re ; } catch ( Error e ) { status = S_IN_ERROR ; throw e ; } status = S_IN_ERROR ; throw new ParseException ( getPosition ( ) , ParseException . ERROR_UNEXPECTED_TOKEN , token ) ; |
public class JCalendarPopup { /** * Create this calendar in a popup menu and synchronize the text field on change .
* @ param dateTarget The initial date for this button .
* @ param button The calling button . */
public static JCalendarPopup createCalendarPopup ( Date dateTarget , Component button ) { } } | return JCalendarPopup . createCalendarPopup ( null , dateTarget , button , null ) ; |
public class RecaptchaEnterpriseServiceV1Beta1Client { /** * Creates an Assessment of the likelihood an event is legitimate .
* < p > Sample code :
* < pre > < code >
* try ( RecaptchaEnterpriseServiceV1Beta1Client recaptchaEnterpriseServiceV1Beta1Client = RecaptchaEnterpriseServiceV1Beta1Client . create ( ) ) {
* ProjectName parent = ProjectName . of ( " [ PROJECT ] " ) ;
* Assessment assessment = Assessment . newBuilder ( ) . build ( ) ;
* Assessment response = recaptchaEnterpriseServiceV1Beta1Client . createAssessment ( parent , assessment ) ;
* < / code > < / pre >
* @ param parent Required . The name of the project in which the assessment will be created , in the
* format " projects / { project _ number } " .
* @ param assessment The asessment details .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final Assessment createAssessment ( ProjectName parent , Assessment assessment ) { } } | CreateAssessmentRequest request = CreateAssessmentRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setAssessment ( assessment ) . build ( ) ; return createAssessment ( request ) ; |
public class MediaDescriptorField { /** * Creates or updates application format using payload number and text format description .
* @ param payload the payload number of the format .
* @ param description text description of the format
* @ return format object */
private RTPFormat createApplicationFormat ( int payload , Text description ) { } } | Iterator < Text > it = description . split ( '/' ) . iterator ( ) ; // encoding name
Text token = it . next ( ) ; token . trim ( ) ; EncodingName name = new EncodingName ( token ) ; // clock rate
token = it . next ( ) ; token . trim ( ) ; RTPFormat rtpFormat = getFormat ( payload ) ; if ( rtpFormat == null ) { formats . add ( new RTPFormat ( payload , FormatFactory . createApplicationFormat ( name ) ) ) ; } else { ( ( ApplicationFormat ) rtpFormat . getFormat ( ) ) . setName ( name ) ; } return rtpFormat ; |
public class HttpClientModule { /** * Register a HttpClientObserver which observes only requests from a HttpClient with the given Guice binding annotation .
* @ return the binding builder you should register with */
public static LinkedBindingBuilder < HttpClientObserver > bindNewObserver ( final Binder binder , final Annotation annotation ) { } } | return Multibinder . newSetBinder ( binder , HttpClientObserver . class , annotation ) . addBinding ( ) ; |
public class ClassBuilder { /** * Construct a new ClassBuilder .
* @ param context the build context
* @ param classDoc the class being documented .
* @ param writer the doclet specific writer . */
public static ClassBuilder getInstance ( Context context , ClassDoc classDoc , ClassWriter writer ) { } } | return new ClassBuilder ( context , classDoc , writer ) ; |
public class ContentKey { /** * Create an operation that will retrieve the given content key .
* @ param contentKeyId
* id of content key to retrieve
* @ return the operation */
public static EntityGetOperation < ContentKeyInfo > get ( String contentKeyId ) { } } | return new DefaultGetOperation < ContentKeyInfo > ( ENTITY_SET , contentKeyId , ContentKeyInfo . class ) ; |
public class Reflect { /** * Check for a field with the given name in a java object or scripted object
* if the field exists fetch the value , if not check for a property value .
* If neither is found return Primitive . VOID . */
public static Object getObjectFieldValue ( Object object , String fieldName ) throws UtilEvalError , ReflectError { } } | if ( object instanceof This ) { return ( ( This ) object ) . namespace . getVariable ( fieldName ) ; } else if ( object == Primitive . NULL ) { throw new UtilTargetError ( new NullPointerException ( "Attempt to access field '" + fieldName + "' on null value" ) ) ; } else { try { return getFieldValue ( object . getClass ( ) , object , fieldName , false /* onlystatic */
) ; } catch ( ReflectError e ) { // no field , try property access
if ( hasObjectPropertyGetter ( object . getClass ( ) , fieldName ) ) return getObjectProperty ( object , fieldName ) ; else throw e ; } } |
public class TextProtocolUtil { /** * In the particular case of Memcached , the end of operation / command
* is signaled by " \ r \ n " characters . So , if end of operation is
* found , this method would return true . On the contrary , if space was
* found instead of end of operation character , then it ' d return the element and false . */
static boolean readElement ( ByteBuf buffer , OutputStream byteBuffer ) throws IOException { } } | for ( ; ; ) { byte next = buffer . readByte ( ) ; if ( next == SP ) { // Space
return false ; } else if ( next == CR ) { // CR
next = buffer . readByte ( ) ; if ( next == LF ) { // LF
return true ; } else { byteBuffer . write ( next ) ; } } else { byteBuffer . write ( next ) ; } } |
public class AnyUnblockedGrantPermissionPolicy { /** * This method performs the actual , low - level checking of a single activity and target . Is IS
* responsible for performing the same check for affiliated groups in the Groups hierarchy , but
* it is NOT responsible for understanding the nuances of relationships some activities and / or
* targets have with one another ( e . g . MANAGE _ APPROVED , ALL _ PORTLETS , etc . ) . It performs the
* following steps , in order :
* < ol >
* < li > Find out if the specified principal is < em > specifically < / em > granted or denied ; if an
* answer is found in this step , return it
* < li > Find out what groups this principal belongs to ; convert each one to a principal and
* seek an answer by invoking ourselves recursively ; if an answer is found in this step ,
* return it
* < li > Return false ( no explicit GRANT means no permission )
* < / ol > */
private boolean hasUnblockedPathToGrant ( IAuthorizationService service , IAuthorizationPrincipal principal , IPermissionOwner owner , IPermissionActivity activity , IPermissionTarget target , Set < IGroupMember > seenGroups ) throws GroupsException { } } | if ( log . isTraceEnabled ( ) ) { log . trace ( "Searching for unblocked path to GRANT for principal '{}' to " + "'{}' on target '{}' having already checked: {}" , principal . getKey ( ) , activity . getFname ( ) , target . getKey ( ) , seenGroups ) ; } /* * Step # 1 : Specific GRANT / DENY attached to this principal */
final IPermission [ ] permissions = service . getPermissionsForPrincipal ( principal , owner . getFname ( ) , activity . getFname ( ) , target . getKey ( ) ) ; final Set < IPermission > activePermissions = removeInactivePermissions ( permissions ) ; final boolean denyExists = containsType ( activePermissions , IPermission . PERMISSION_TYPE_DENY ) ; if ( denyExists ) { // We need go no further ; DENY trumps both GRANT & inherited permissions
return false ; } final boolean grantExists = containsType ( activePermissions , IPermission . PERMISSION_TYPE_GRANT ) ; if ( grantExists ) { // We need go no further ; explicit GRANT at this level of the hierarchy
if ( log . isTraceEnabled ( ) ) { log . trace ( "Found unblocked path to this permission set including a GRANT: {}" , activePermissions ) ; } return true ; } /* * Step # 2 : Seek an answer from affiliated groups */
IGroupMember principalAsGroupMember = service . getGroupMember ( principal ) ; if ( seenGroups . contains ( principalAsGroupMember ) ) { if ( log . isTraceEnabled ( ) ) { log . trace ( "Declining to re-examine principal '{}' for permission to '{}' " + "on '{}' because this group is among already checked groups: {}" , principal . getKey ( ) , activity . getFname ( ) , target . getKey ( ) , seenGroups ) ; } return false ; } seenGroups . add ( principalAsGroupMember ) ; Set < IEntityGroup > immediatelyContainingGroups = principalAsGroupMember . getParentGroups ( ) ; for ( IGroupMember parentGroup : immediatelyContainingGroups ) { try { if ( parentGroup != null ) { IAuthorizationPrincipal parentPrincipal = service . newPrincipal ( parentGroup ) ; boolean parentHasUnblockedPathToGrant = hasUnblockedPathToGrantWithCache ( service , parentPrincipal , owner , activity , target , seenGroups ) ; if ( parentHasUnblockedPathToGrant ) { return true ; } // Parent didn ' t have a path to grant , fall through and try another parent ( if
// any )
} } catch ( Exception e ) { // problem evaluating this path , but let ' s not let it stop
// us from exploring other paths . Though a portion of the
// group structure is broken , permission may be granted by
// an unbroken portion
log . error ( "Error evaluating permissions of parent group [" + parentGroup + "]" , e ) ; } } /* * Step # 3 : No explicit GRANT means no permission */
return false ; |
public class AwsSecurityFindingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AwsSecurityFinding awsSecurityFinding , ProtocolMarshaller protocolMarshaller ) { } } | if ( awsSecurityFinding == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( awsSecurityFinding . getSchemaVersion ( ) , SCHEMAVERSION_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getId ( ) , ID_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getProductArn ( ) , PRODUCTARN_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getGeneratorId ( ) , GENERATORID_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getAwsAccountId ( ) , AWSACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getTypes ( ) , TYPES_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getFirstObservedAt ( ) , FIRSTOBSERVEDAT_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getLastObservedAt ( ) , LASTOBSERVEDAT_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getCreatedAt ( ) , CREATEDAT_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getUpdatedAt ( ) , UPDATEDAT_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getSeverity ( ) , SEVERITY_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getConfidence ( ) , CONFIDENCE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getCriticality ( ) , CRITICALITY_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getTitle ( ) , TITLE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getDescription ( ) , DESCRIPTION_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getRemediation ( ) , REMEDIATION_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getSourceUrl ( ) , SOURCEURL_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getProductFields ( ) , PRODUCTFIELDS_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getUserDefinedFields ( ) , USERDEFINEDFIELDS_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getMalware ( ) , MALWARE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getNetwork ( ) , NETWORK_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getProcess ( ) , PROCESS_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getThreatIntelIndicators ( ) , THREATINTELINDICATORS_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getResources ( ) , RESOURCES_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getCompliance ( ) , COMPLIANCE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getVerificationState ( ) , VERIFICATIONSTATE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getWorkflowState ( ) , WORKFLOWSTATE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getRecordState ( ) , RECORDSTATE_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getRelatedFindings ( ) , RELATEDFINDINGS_BINDING ) ; protocolMarshaller . marshall ( awsSecurityFinding . getNote ( ) , NOTE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ArrayUtils { /** * Convert an array of any type to an array of strings
* @ param array
* @ return */
public static String [ ] toStringArray ( final Object array ) { } } | final int length = Array . getLength ( array ) ; final String [ ] result = new String [ length ] ; for ( int i = 0 ; i < length ; i ++ ) { result [ i ] = Array . get ( array , i ) . toString ( ) ; } return result ; |
public class DefaultBlitz4jConfig { /** * ( non - Javadoc )
* @ see com . netflix . blitz4j . BlitzConfig # getAsyncAppenders ( ) */
@ Override public String [ ] getAsyncAppenders ( ) { } } | return CONFIGURATION . getStringProperty ( PROP_ASYNC_APPENDERS , this . getPropertyValue ( PROP_ASYNC_APPENDERS , "OFF" ) ) . get ( ) . split ( "," ) ; |
public class DescribeSpotFleetInstancesResult { /** * The running instances . This list is refreshed periodically and might be out of date .
* @ param activeInstances
* The running instances . This list is refreshed periodically and might be out of date . */
public void setActiveInstances ( java . util . Collection < ActiveInstance > activeInstances ) { } } | if ( activeInstances == null ) { this . activeInstances = null ; return ; } this . activeInstances = new com . amazonaws . internal . SdkInternalList < ActiveInstance > ( activeInstances ) ; |
public class JdbcTemplateJdbcHelper { /** * Get { @ link JdbcTemplate } instance for a given { @ link Connection } .
* Note : the returned { @ link JdbcTemplate } will not automatically close the
* { @ link Connection } .
* @ param conn
* @ return */
protected JdbcTemplate jdbcTemplate ( Connection conn ) { } } | DataSource ds = new SingleConnectionDataSource ( conn , true ) ; return new JdbcTemplate ( ds ) ; |
public class TaskServiceEJBImpl { /** * implemented methods */
@ Override public List < TaskSummary > getTasksAssignedAsBusinessAdministrator ( String userId , String language ) { } } | return delegate . getTasksAssignedAsBusinessAdministrator ( userId , language ) ; |
public class TemplateElasticsearchUpdater { /** * Check if a template exists
* @ param client Elasticsearch client
* @ param template template name
* @ return true if the template exists
* @ throws IOException if something goes wrong */
public static boolean isTemplateExist ( RestClient client , String template ) throws IOException { } } | Response response = client . performRequest ( new Request ( "HEAD" , "/_template/" + template ) ) ; return response . getStatusLine ( ) . getStatusCode ( ) == 200 ; |
public class StreamingWriterInterceptor { /** * < p > applyStreaming . < / p >
* @ param requestContext a { @ link javax . ws . rs . container . ContainerRequestContext } object .
* @ param context a { @ link javax . ws . rs . ext . WriterInterceptorContext } object .
* @ throws java . io . IOException if any . */
protected void applyStreaming ( ContainerRequestContext requestContext , WriterInterceptorContext context ) throws IOException { } } | Object entity = context . getEntity ( ) ; StreamingProcess < Object > process = MessageHelper . getStreamingProcess ( context . getEntity ( ) , manager ) ; if ( process != null ) { ContainerResponseContext responseContext = ( ContainerResponseContext ) requestContext . getProperty ( RESP_PROP_N ) ; responseContext . setStatusInfo ( Response . Status . PARTIAL_CONTENT ) ; context . getHeaders ( ) . putSingle ( ACCEPT_RANGES , BYTES_RANGE ) ; context . setType ( StreamingOutput . class ) ; context . setEntity ( new MediaStreaming ( entity , requestContext . getHeaderString ( MediaStreaming . RANGE ) , process , context . getMediaType ( ) , context . getHeaders ( ) ) ) ; } |
public class CommonOps_DDF2 { /** * < p > Performs an element by element division operation : < br >
* < br >
* c < sub > i < / sub > = a < sub > i < / sub > / b < sub > i < / sub > < br >
* @ param a The left vector in the division operation . Not modified .
* @ param b The right vector in the division operation . Not modified .
* @ param c Where the results of the operation are stored . Modified . */
public static void elementDiv ( DMatrix2 a , DMatrix2 b , DMatrix2 c ) { } } | c . a1 = a . a1 / b . a1 ; c . a2 = a . a2 / b . a2 ; |
public class arp { /** * Use this API to fetch all the arp resources that are configured on netscaler . */
public static arp [ ] get ( nitro_service service ) throws Exception { } } | arp obj = new arp ( ) ; arp [ ] response = ( arp [ ] ) obj . get_resources ( service ) ; return response ; |
public class Flowable { /** * Returns a Flowable that emits the items emitted by the source Publisher or a specified default item
* if the source Publisher is empty .
* < img width = " 640 " height = " 305 " src = " https : / / raw . github . com / wiki / ReactiveX / RxJava / images / rx - operators / defaultIfEmpty . png " alt = " " >
* < dl >
* < dt > < b > Backpressure : < / b > < / dt >
* < dd > If the source { @ code Publisher } is empty , this operator is guaranteed to honor backpressure from downstream .
* If the source { @ code Publisher } is non - empty , it is expected to honor backpressure as well ; if the rule is violated ,
* a { @ code MissingBackpressureException } < em > may < / em > get signaled somewhere downstream .
* < / dd >
* < dt > < b > Scheduler : < / b > < / dt >
* < dd > { @ code defaultIfEmpty } does not operate by default on a particular { @ link Scheduler } . < / dd >
* < / dl >
* @ param defaultItem
* the item to emit if the source Publisher emits no items
* @ return a Flowable that emits either the specified default item if the source Publisher emits no
* items , or the items emitted by the source Publisher
* @ see < a href = " http : / / reactivex . io / documentation / operators / defaultifempty . html " > ReactiveX operators documentation : DefaultIfEmpty < / a > */
@ CheckReturnValue @ BackpressureSupport ( BackpressureKind . FULL ) @ SchedulerSupport ( SchedulerSupport . NONE ) public final Flowable < T > defaultIfEmpty ( T defaultItem ) { } } | ObjectHelper . requireNonNull ( defaultItem , "item is null" ) ; return switchIfEmpty ( just ( defaultItem ) ) ; |
public class YarnDependencyCollector { /** * preventing circular dependencies by making sure the dependency is not a descendant of its own */
private boolean isDescendant ( DependencyInfo ancestor , DependencyInfo descendant ) { } } | for ( DependencyInfo child : ancestor . getChildren ( ) ) { if ( child . equals ( descendant ) ) { return true ; } if ( isDescendant ( child , descendant ) ) { return true ; } } return false ; |
public class AnnotationUtils { /** * Tries to find required annotation in scope of all annotations of incoming ' source ' .
* @ param source
* { @ link AnnotatedElement }
* @ param targetAnnotationClass
* { @ link Class } - actually required annotation class
* @ param < A >
* - type param
* @ return { @ link A } in case if found , { @ code null } otherwise */
private static < A extends Annotation > A findAnnotationInAnnotations ( final AnnotatedElement source , final Class < A > targetAnnotationClass ) { } } | final Annotation [ ] allAnnotations = source . getAnnotations ( ) ; for ( final Annotation annotation : allAnnotations ) { final A result = findAnnotation ( annotation , targetAnnotationClass ) ; if ( result != null ) return result ; } return null ; |
public class QueryResultsRowImpl { /** * Return the Object for the given Declaration . */
public Object get ( final Declaration declaration ) { } } | return declaration . getValue ( ( InternalWorkingMemory ) workingMemory , getObject ( getFactHandle ( declaration ) ) ) ; |
public class RegistrationManagerImpl { /** * { @ inheritDoc } */
@ Override public void registerService ( ProvidedServiceInstance serviceInstance ) throws ServiceException { } } | ServiceInstanceUtils . validateManagerIsStarted ( isStarted ) ; ServiceInstanceUtils . validateProvidedServiceInstance ( serviceInstance ) ; getRegistrationService ( ) . registerService ( serviceInstance ) ; |
public class GetDomainNamesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( GetDomainNamesRequest getDomainNamesRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( getDomainNamesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getDomainNamesRequest . getPosition ( ) , POSITION_BINDING ) ; protocolMarshaller . marshall ( getDomainNamesRequest . getLimit ( ) , LIMIT_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ModuleLoader { /** * Normalizes the given root paths , which are path prefixes to be removed from a module path when
* resolved . */
private static ImmutableList < String > createRootPaths ( Iterable < String > roots , PathResolver resolver , PathEscaper escaper ) { } } | // Sort longest length to shortest so that paths are applied most specific to least .
Set < String > builder = new TreeSet < > ( Comparator . comparingInt ( String :: length ) . thenComparing ( String :: compareTo ) . reversed ( ) ) ; for ( String root : roots ) { String rootModuleName = escaper . escape ( resolver . apply ( root ) ) ; if ( isAmbiguousIdentifier ( rootModuleName ) ) { rootModuleName = MODULE_SLASH + rootModuleName ; } builder . add ( rootModuleName ) ; } return ImmutableList . copyOf ( builder ) ; |
public class ServiceClientImpl { /** * / * ( non - Javadoc )
* @ see com . ibm . g11n . pipeline . client . ServiceClient # getTRSegment ( java . lang . String , com . ibm . g11n . pipeline . client . DocumentType , java . lang . String , java . lang . String , java . lang . String ) */
@ Override public SegmentData getTRSegment ( String trId , DocumentType type , String documentId , String language , String segmentKey ) throws ServiceException { } } | if ( trId == null || trId . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty trId must be specified." ) ; } if ( documentId == null || documentId . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty documentId must be specified." ) ; } if ( language == null || language . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty language must be specified." ) ; } if ( segmentKey == null || segmentKey . isEmpty ( ) ) { throw new IllegalArgumentException ( "Non-empty segmentKey must be specified." ) ; } GetSegmentResponse resp = invokeApiJson ( "GET" , escapePathSegment ( account . getInstanceId ( ) ) + "/v2/doc-trs/" + escapePathSegment ( trId ) + "/" + type . toString ( ) . toLowerCase ( ) + "/" + escapePathSegment ( documentId ) + "/" + language + "/" + escapePathSegment ( segmentKey ) , null , GetSegmentResponse . class ) ; if ( resp . getStatus ( ) == Status . ERROR ) { throw new ServiceException ( resp . getMessage ( ) ) ; } return new SegmentDataImpl ( resp . segmentData ) ; |
public class PHS398FellowshipSupplementalV1_1Generator { /** * This method is used to get PHSFellowshipSupplemental11 XMLObject and set
* the data to it from DevelopmentProposal data . */
private PHSFellowshipSupplemental11 getPHSFellowshipSupplemental11 ( ) { } } | PHSFellowshipSupplemental11 phsFellowshipSupplemental = PHSFellowshipSupplemental11 . Factory . newInstance ( ) ; phsFellowshipSupplemental . setFormVersion ( FormVersion . v1_1 . getVersion ( ) ) ; phsFellowshipSupplemental . setApplicationType ( getApplicationType ( ) ) ; phsFellowshipSupplemental . setAppendix ( getAppendix ( ) ) ; phsFellowshipSupplemental . setAdditionalInformation ( getAdditionalInformation ( ) ) ; phsFellowshipSupplemental . setResearchTrainingPlan ( getResearchTrainingPlan ( ) ) ; phsFellowshipSupplemental . setBudget ( getBudget ( ) ) ; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( phsFellowshipSupplemental . toString ( ) . getBytes ( ) ) ; sortAttachments ( byteArrayInputStream ) ; return phsFellowshipSupplemental ; |
public class CmsDriverManager { /** * Returns a filtered list of resources for publishing . < p >
* Contains all resources , which are not locked
* and which have a parent folder that is already published or will be published , too . < p >
* @ param dbc the current database context
* @ param publishList the filling publish list
* @ param resourceList the list of resources to filter
* @ return a filtered list of resources */
private List < CmsResource > filterResources ( CmsDbContext dbc , CmsPublishList publishList , List < CmsResource > resourceList ) { } } | List < CmsResource > result = new ArrayList < CmsResource > ( ) ; // local folder list for adding new publishing subfolders
// this solves the { @ link org . opencms . file . TestPublishIssues # testPublishScenarioD } problem .
List < CmsResource > newFolderList = new ArrayList < CmsResource > ( publishList == null ? resourceList : publishList . getFolderList ( ) ) ; for ( int i = 0 ; i < resourceList . size ( ) ; i ++ ) { CmsResource res = resourceList . get ( i ) ; try { CmsLock lock = getLock ( dbc , res ) ; if ( lock . isPublish ( ) ) { // if already enqueued
continue ; } if ( ! lock . isLockableBy ( dbc . currentUser ( ) ) ) { // checks if there is a shared lock and if the resource is deleted
// this solves the { @ link org . opencms . file . TestPublishIssues # testPublishScenarioE } problem .
if ( lock . isShared ( ) && ( publishList != null ) ) { if ( ! res . getState ( ) . isDeleted ( ) || ! checkDeletedParentFolder ( dbc , publishList . getDeletedFolderList ( ) , res ) ) { continue ; } } else { // don ' t add locked resources
continue ; } } if ( ! "/" . equals ( res . getRootPath ( ) ) && ! checkParentResource ( dbc , newFolderList , res ) ) { continue ; } // check permissions
try { m_securityManager . checkPermissions ( dbc , res , CmsPermissionSet . ACCESS_DIRECT_PUBLISH , false , CmsResourceFilter . ALL ) ; } catch ( CmsException e ) { // skip if not enough permissions
continue ; } if ( res . isFolder ( ) ) { newFolderList . add ( res ) ; } result . add ( res ) ; } catch ( Exception e ) { // should never happen
LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } return result ; |
public class WebDriverHelper { /** * Returns a new WebDriver instance and loads an existing profile from the
* disk . You must pass the path to the profile .
* @ param pathToProfile
* the path to the profile folder
* @ return a new FirefoxDriver that loads the supplied profile */
public static WebDriver getFirefoxDriverWithExistingProfile ( final String pathToProfile ) { } } | FirefoxProfile profile = new FirefoxProfile ( new File ( pathToProfile ) ) ; return new FirefoxDriver ( profile ) ; |
public class Utils { /** * Reads the content of an URL ( assumed to be text content ) .
* @ param url an URL
* @ return a non - null string
* @ throws IOException
* @ throws URISyntaxException */
public static String readUrlContent ( String url ) throws IOException , URISyntaxException { } } | InputStream in = null ; try { URI uri = UriUtils . urlToUri ( url ) ; in = uri . toURL ( ) . openStream ( ) ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; Utils . copyStreamSafely ( in , os ) ; return os . toString ( "UTF-8" ) ; } finally { closeQuietly ( in ) ; } |
public class JacksonSingleton { /** * Registers a new Jackson Module .
* @ param module the module to register */
@ Override public void register ( Module module ) { } } | if ( module == null ) { return ; } LOGGER . info ( "Adding JSON module {}" , module . getModuleName ( ) ) ; synchronized ( lock ) { modules . add ( module ) ; rebuildMappers ( ) ; } |
public class MeetingSettingMarshaller { /** * Marshall the given parameter object . */
public void marshall ( MeetingSetting meetingSetting , ProtocolMarshaller protocolMarshaller ) { } } | if ( meetingSetting == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( meetingSetting . getRequirePin ( ) , REQUIREPIN_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MessagingClientFactoryRegistry { /** * Notifies the messaging client factory listeners that a factory has been added / removed .
* @ param factory the incoming / outgoing messaging client factory .
* @ param isAdded flag indicating whether the factory has been added or removed . */
private void notifyListeners ( IMessagingClientFactory factory , boolean isAdded ) { } } | for ( MessagingClientFactoryListener listener : this . listeners ) { try { if ( isAdded ) listener . addMessagingClientFactory ( factory ) ; else listener . removeMessagingClientFactory ( factory ) ; } catch ( Throwable t ) { // Log the exception , but * do not * interrupt the notification of the other listeners .
this . logger . warning ( "Messaging client factory listener has thrown an exception: " + listener ) ; Utils . logException ( this . logger , new RuntimeException ( t ) ) ; } } |
public class RestRequestValidator { /** * Method to read a key ( or keys ) present in the HTTP request URI . The URI
* must be of the format / < store _ name > / < key > [ , < key > , . . . ]
* @ param requestURI The URI of the HTTP request */
protected void parseKeys ( String requestURI ) { } } | this . parsedKeys = null ; String [ ] parts = requestURI . split ( "/" ) ; if ( parts . length > 2 ) { String base64KeyList = parts [ 2 ] ; this . parsedKeys = new ArrayList < ByteArray > ( ) ; if ( ! base64KeyList . contains ( "," ) ) { String rawKey = base64KeyList . trim ( ) ; this . parsedKeys . add ( new ByteArray ( RestUtils . decodeVoldemortKey ( rawKey ) ) ) ; } else { String [ ] base64KeyArray = base64KeyList . split ( "," ) ; for ( String base64Key : base64KeyArray ) { String rawKey = base64Key . trim ( ) ; this . parsedKeys . add ( new ByteArray ( RestUtils . decodeVoldemortKey ( rawKey ) ) ) ; } } } |
public class Vulnerability { /** * Adds a reference .
* @ param referenceSource the source of the reference
* @ param referenceName the referenceName of the reference
* @ param referenceUrl the url of the reference */
public void addReference ( String referenceSource , String referenceName , String referenceUrl ) { } } | final Reference ref = new Reference ( ) ; ref . setSource ( referenceSource ) ; ref . setName ( referenceName ) ; ref . setUrl ( referenceUrl ) ; this . references . add ( ref ) ; |
public class TopologySpec { /** * Creates a builder for the TopologySpec based on values in a topology properties config . */
public static TopologySpec . Builder builder ( URI catalogURI , Properties topologyProps ) { } } | String name = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_NAME_KEY ) ; String group = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_GROUP_KEY , "default" ) ; try { URI topologyURI = new URI ( catalogURI . getScheme ( ) , catalogURI . getAuthority ( ) , "/" + group + "/" + name , null ) ; TopologySpec . Builder builder = new TopologySpec . Builder ( topologyURI ) . withConfigAsProperties ( topologyProps ) ; String descr = topologyProps . getProperty ( ConfigurationKeys . TOPOLOGY_DESCRIPTION_KEY , null ) ; if ( null != descr ) { builder = builder . withDescription ( descr ) ; } return builder ; } catch ( URISyntaxException e ) { throw new RuntimeException ( "Unable to create a TopologySpec URI: " + e , e ) ; } |
public class Parser { /** * originalText may be null if not available */
private static Path parsePathExpression ( Iterator < Token > expression , ConfigOrigin origin , String originalText ) { } } | // each builder in " buf " is an element in the path .
List < Element > buf = new ArrayList < Element > ( ) ; buf . add ( new Element ( "" , false ) ) ; if ( ! expression . hasNext ( ) ) { throw new ConfigException . BadPath ( origin , originalText , "Expecting a field name or path here, but got nothing" ) ; } while ( expression . hasNext ( ) ) { Token t = expression . next ( ) ; if ( Tokens . isValueWithType ( t , ConfigValueType . STRING ) ) { AbstractConfigValue v = Tokens . getValue ( t ) ; // this is a quoted string ; so any periods
// in here don ' t count as path separators
String s = v . transformToString ( ) ; addPathText ( buf , true , s ) ; } else if ( t == Tokens . END ) { // ignore this ; when parsing a file , it should not happen
// since we ' re parsing a token list rather than the main
// token iterator , and when parsing a path expression from the
// API , it ' s expected to have an END .
} else { // any periods outside of a quoted string count as
// separators
String text ; if ( Tokens . isValue ( t ) ) { // appending a number here may add
// a period , but we _ do _ count those as path
// separators , because we basically want
// " foo 3.0bar " to parse as a string even
// though there ' s a number in it . The fact that
// we tokenize non - string values is largely an
// implementation detail .
AbstractConfigValue v = Tokens . getValue ( t ) ; text = v . transformToString ( ) ; } else if ( Tokens . isUnquotedText ( t ) ) { text = Tokens . getUnquotedText ( t ) ; } else { throw new ConfigException . BadPath ( origin , originalText , "Token not allowed in path expression: " + t + " (you can double-quote this token if you really want it here)" ) ; } addPathText ( buf , false , text ) ; } } PathBuilder pb = new PathBuilder ( ) ; for ( Element e : buf ) { if ( e . sb . length ( ) == 0 && ! e . canBeEmpty ) { throw new ConfigException . BadPath ( origin , originalText , "path has a leading, trailing, or two adjacent period '.' (use quoted \"\" empty string if you want an empty element)" ) ; } else { pb . appendKey ( e . sb . toString ( ) ) ; } } return pb . result ( ) ; |
public class BeanMap { /** * Sets the bean property with the given name to the given value .
* @ param name the name of the property to set
* @ param value the value to set that property to
* @ return the previous value of that property */
@ Override public Object put ( String name , Object value ) { } } | if ( bean != null ) { Object oldValue = get ( name ) ; Method method = getWriteMethod ( name ) ; if ( method == null ) { throw new IllegalArgumentException ( "The bean of type: " + bean . getClass ( ) . getName ( ) + " has no property called: " + name ) ; } try { Object [ ] arguments = createWriteMethodArguments ( method , value ) ; method . invoke ( bean , arguments ) ; Object newValue = get ( name ) ; firePropertyChange ( name , oldValue , newValue ) ; } catch ( InvocationTargetException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } catch ( IllegalAccessException e ) { throw new IllegalArgumentException ( e . getMessage ( ) ) ; } return oldValue ; } return null ; |
public class NetworkWatchersInner { /** * Gets the current network topology by resource group .
* @ param resourceGroupName The name of the resource group .
* @ param networkWatcherName The name of the network watcher .
* @ param parameters Parameters that define the representation of topology .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the TopologyInner object if successful . */
public TopologyInner getTopology ( String resourceGroupName , String networkWatcherName , TopologyParameters parameters ) { } } | return getTopologyWithServiceResponseAsync ( resourceGroupName , networkWatcherName , parameters ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class Moment { /** * / * [ deutsch ]
* < p > Addiert einen Betrag in der angegegebenen SI - Zeiteinheit auf die
* UTC - Zeit dieses Zeitstempels . < / p >
* @ param amount amount in units to be added
* @ param unit time unit defined in UTC time space
* @ return changed copy of this instance
* @ throws UnsupportedOperationException if either this moment or the result are before 1972
* @ throws ArithmeticException in case of overflow */
public Moment plus ( long amount , SI unit ) { } } | Moment . check1972 ( this ) ; if ( amount == 0 ) { return this ; } Moment result ; try { switch ( unit ) { case SECONDS : if ( LeapSeconds . getInstance ( ) . isEnabled ( ) ) { result = new Moment ( Math . addExact ( this . getElapsedTimeUTC ( ) , amount ) , this . getNanosecond ( ) , UTC ) ; } else { result = Moment . of ( Math . addExact ( this . posixTime , amount ) , this . getNanosecond ( ) , POSIX ) ; } break ; case NANOSECONDS : long sum = Math . addExact ( this . getNanosecond ( ) , amount ) ; int nano = ( int ) Math . floorMod ( sum , MRD ) ; long second = Math . floorDiv ( sum , MRD ) ; if ( LeapSeconds . getInstance ( ) . isEnabled ( ) ) { result = new Moment ( Math . addExact ( this . getElapsedTimeUTC ( ) , second ) , nano , UTC ) ; } else { result = Moment . of ( Math . addExact ( this . posixTime , second ) , nano , POSIX ) ; } break ; default : throw new UnsupportedOperationException ( ) ; } } catch ( IllegalArgumentException iae ) { ArithmeticException ex = new ArithmeticException ( "Result beyond boundaries of time axis." ) ; ex . initCause ( iae ) ; throw ex ; } if ( amount < 0 ) { Moment . check1972 ( result ) ; } return result ; |
public class GPXPoint { /** * Set the number of satellites used to calculate the GPX fix for a point .
* @ param contentBuffer Contains the information to put in the table */
public final void setSat ( StringBuilder contentBuffer ) { } } | ptValues [ GpxMetadata . PTSAT ] = Integer . parseInt ( contentBuffer . toString ( ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.