signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class CompilerOptions { /** * Utility method to turn old options into new deprecation flag . */
public static DeprecationWarnings getDeprecationWarnings ( int deprecationLevel , boolean failOnWarn ) { } } | if ( deprecationLevel < 0 ) { return DeprecationWarnings . OFF ; } else { return failOnWarn ? DeprecationWarnings . FATAL : DeprecationWarnings . ON ; } |
public class RepositoryService { /** * Immediately change and apply the specified external source field in the current repository configuration to the new value .
* @ param defn the attribute definition for the value ; may not be null
* @ param newValue the new string value
* @ param sourceName the name of the source
* @ throws RepositoryException if there is a problem obtaining the repository configuration or applying the change
* @ throws OperationFailedException if there is a problem obtaining the raw value from the supplied model node */
public void changeSourceField ( MappedAttributeDefinition defn , ModelNode newValue , String sourceName ) throws RepositoryException , OperationFailedException { } } | ModeShapeEngine engine = getEngine ( ) ; String repositoryName = repositoryName ( ) ; // Get a snapshot of the current configuration . . .
RepositoryConfiguration config = engine . getRepositoryConfiguration ( repositoryName ) ; // Now start to make changes . . .
Editor editor = config . edit ( ) ; // Find the array of sequencer documents . . .
EditableDocument externalSources = editor . getOrCreateDocument ( FieldName . EXTERNAL_SOURCES ) ; EditableDocument externalSource = externalSources . getDocument ( sourceName ) ; assert externalSource != null ; // Change the field . . .
String fieldName = defn . getFieldName ( ) ; // Get the raw value from the model node . . .
Object rawValue = defn . getTypedValue ( newValue ) ; // And update the field . . .
externalSource . set ( fieldName , rawValue ) ; // Get and apply the changes to the current configuration . Note that the ' update ' call asynchronously
// updates the configuration , and returns a Future < JcrRepository > that we could use if we wanted to
// wait for the changes to take place . But we don ' t want / need to wait , so we ' ll not use the Future . . .
Changes changes = editor . getChanges ( ) ; engine . update ( repositoryName , changes ) ; |
public class TenantService { /** * Create a new tenant with the given definition and return the updated definition .
* Throw a { @ link DuplicateException } if the tenant has already been defined .
* @ param tenantDef { @ link TenantDefinition } of new tenant .
* @ return Updated definition . */
public TenantDefinition defineTenant ( TenantDefinition tenantDef ) { } } | checkServiceState ( ) ; String tenantName = tenantDef . getName ( ) ; if ( getTenantDef ( tenantName ) != null ) { throw new DuplicateException ( "Tenant already exists: " + tenantName ) ; } defineNewTenant ( tenantDef ) ; TenantDefinition updatedTenantDef = getTenantDef ( tenantName ) ; if ( updatedTenantDef == null ) { throw new RuntimeException ( "Tenant definition could not be retrieved after creation: " + tenantName ) ; } removeUserHashes ( updatedTenantDef ) ; return updatedTenantDef ; |
public class CPDefinitionLinkUtil { /** * Returns the cp definition links before and after the current cp definition link in the ordered set where CProductId = & # 63 ; .
* @ param CPDefinitionLinkId the primary key of the current cp definition link
* @ param CProductId the c product ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the previous , current , and next cp definition link
* @ throws NoSuchCPDefinitionLinkException if a cp definition link with the primary key could not be found */
public static CPDefinitionLink [ ] findByCProductId_PrevAndNext ( long CPDefinitionLinkId , long CProductId , OrderByComparator < CPDefinitionLink > orderByComparator ) throws com . liferay . commerce . product . exception . NoSuchCPDefinitionLinkException { } } | return getPersistence ( ) . findByCProductId_PrevAndNext ( CPDefinitionLinkId , CProductId , orderByComparator ) ; |
public class LiveOutputsInner { /** * Get Live Output .
* Gets a Live Output .
* @ param resourceGroupName The name of the resource group within the Azure subscription .
* @ param accountName The Media Services account name .
* @ param liveEventName The name of the Live Event .
* @ param liveOutputName The name of the Live Output .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the LiveOutputInner object */
public Observable < LiveOutputInner > getAsync ( String resourceGroupName , String accountName , String liveEventName , String liveOutputName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , accountName , liveEventName , liveOutputName ) . map ( new Func1 < ServiceResponse < LiveOutputInner > , LiveOutputInner > ( ) { @ Override public LiveOutputInner call ( ServiceResponse < LiveOutputInner > response ) { return response . body ( ) ; } } ) ; |
public class State { /** * { @ inheritDoc } */
@ Override public < B > Lazy < State < S , B > > lazyZip ( Lazy < ? extends Applicative < Function < ? super A , ? extends B > , State < S , ? > > > lazyAppFn ) { } } | return Monad . super . lazyZip ( lazyAppFn ) . fmap ( Monad < B , State < S , ? > > :: coerce ) ; |
public class ElementMatchers { /** * Matches any Java bean getter method which returns an value with a type matches the supplied matcher .
* @ param matcher A matcher to be allied to a getter method ' s argument type .
* @ param < T > The type of the matched object .
* @ return A matcher that matches a getter method with a return type that matches the supplied matcher . */
public static < T extends MethodDescription > ElementMatcher . Junction < T > isGetter ( ElementMatcher < ? super TypeDescription > matcher ) { } } | return isGenericGetter ( erasure ( matcher ) ) ; |
public class HostName { /** * Validates that this string is a valid host name or IP address , and if not , throws an exception with a descriptive message indicating why it is not .
* @ throws HostNameException */
@ Override public void validate ( ) throws HostNameException { } } | if ( parsedHost != null ) { return ; } if ( validationException != null ) { throw validationException ; } synchronized ( this ) { if ( parsedHost != null ) { return ; } if ( validationException != null ) { throw validationException ; } try { parsedHost = getValidator ( ) . validateHost ( this ) ; } catch ( HostNameException e ) { validationException = e ; throw e ; } } |
public class JMWordSplitter { /** * Split as stream stream .
* @ param splitPattern the split pattern
* @ param text the text
* @ return the stream */
public static Stream < String > splitAsStream ( Pattern splitPattern , String text ) { } } | return splitPattern . splitAsStream ( text ) ; |
public class SecureUtil { /** * Returns true if we can generate our ciphers . */
public static boolean ciphersSupported ( PublicKey key ) { } } | return getRSACipher ( key ) != null && getAESCipher ( Cipher . ENCRYPT_MODE , new byte [ 16 ] ) != null ; |
public class MaterialListValueBox { /** * Removes all items from the list box . */
@ Override public void clear ( ) { } } | values . clear ( ) ; listBox . clear ( ) ; clearStatusText ( ) ; if ( emptyPlaceHolder != null ) { insertEmptyPlaceHolder ( emptyPlaceHolder ) ; } reload ( ) ; if ( isAllowBlank ( ) ) { addBlankItemIfNeeded ( ) ; } |
public class DateBuilder { /** * Get a < code > Date < / code > object that represents the given time , on
* tomorrow ' s date .
* @ param second
* The value ( 0-59 ) to give the seconds field of the date
* @ param minute
* The value ( 0-59 ) to give the minutes field of the date
* @ param hour
* The value ( 0-23 ) to give the hours field of the date
* @ return the new date */
public static Date tomorrowAt ( final int hour , final int minute , final int second ) { } } | validateSecond ( second ) ; validateMinute ( minute ) ; validateHour ( hour ) ; final Date date = new Date ( ) ; final Calendar c = PDTFactory . createCalendar ( ) ; c . setTime ( date ) ; c . setLenient ( true ) ; // advance one day
c . add ( Calendar . DAY_OF_YEAR , 1 ) ; c . set ( Calendar . HOUR_OF_DAY , hour ) ; c . set ( Calendar . MINUTE , minute ) ; c . set ( Calendar . SECOND , second ) ; c . set ( Calendar . MILLISECOND , 0 ) ; return c . getTime ( ) ; |
public class GenericProblem { /** * Validate a solution by checking all mandatory constraints . The solution will only pass validation if
* all mandatory constraints are satisfied .
* In case there are no mandatory constraints , this method always returns { @ link SimpleValidation # PASSED } .
* If a single mandatory constraint has been specified , the corresponding validation is returned . In case
* of two or more constraints , an aggregated validation is constructed that only passes if all constraints are
* satisfied . Short - circuiting is applied : as soon as one violated constraint is found , the remaining constraints
* are not checked .
* @ param solution solution to validate
* @ return aggregated validation */
@ Override public Validation validate ( SolutionType solution ) { } } | if ( mandatoryConstraints . isEmpty ( ) ) { // CASE 1 : no mandatory constraints
return SimpleValidation . PASSED ; } else if ( mandatoryConstraints . size ( ) == 1 ) { // CASE 2 : single mandatory constraint
return mandatoryConstraints . get ( 0 ) . validate ( solution , data ) ; } else { // CASE 3 ( default ) : aggregate multiple constraint validations
UnanimousValidation val = new UnanimousValidation ( ) ; mandatoryConstraints . stream ( ) . allMatch ( c -> { // validate solution against constraint c
Validation cval = c . validate ( solution , data ) ; // add to unanimous validation
val . addValidation ( c , cval ) ; // continue until one constraint is not satisfied
return cval . passed ( ) ; } ) ; return val ; } |
public class MPSelectorEvaluatorImpl { /** * Method parseSelector
* Used to parse the string representation of a selector into a MatchSpace selector tree .
* @ param selector */
public Selector parseSelector ( String selectorString , SelectorDomain domain ) throws SISelectorSyntaxException { } } | if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "parseSelector" , new Object [ ] { selectorString , domain } ) ; Selector selectorTree = mpm . parseSelector ( selectorString , domain ) ; if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "parseSelector" , selectorTree ) ; return selectorTree ; |
public class CanonicalXML { /** * Receive notification of the start of a Namespace mapping .
* < p > By default , do nothing . Application writers may override this
* method in a subclass to take specific actions at the start of
* each Namespace prefix scope ( such as storing the prefix mapping ) . < / p >
* @ param prefix The Namespace prefix being declared .
* @ param uriThe Namespace URI mapped to the prefix .
* @ throws org . xml . sax . SAXException Any SAX exception , possibly
* wrapping another exception .
* @ see org . xml . sax . ContentHandler # startPrefixMapping */
@ Override public void startPrefixMapping ( String prefix , String uri ) throws SAXException { } } | mNamespaces . addAttribute ( "" , prefix , prefix . equals ( "" ) ? "xmlns" : "xmlns:" + prefix , "CDATA" , uri ) ; if ( ! "" . equals ( uri ) ) { try { URI u = new URI ( uri ) ; if ( ! u . isAbsolute ( ) ) { System . err . println ( "*** (Canonical XML:) namespace URI " + u + " is not absolute" ) ; } } catch ( URISyntaxException err ) { System . err . println ( "*** (Canonical XML:) namespace " + uri + " is not a valid URI" ) ; } } |
public class ListUtil { /** * Replies if the given element is inside the list , using a dichotomic algorithm .
* < p > This function ensure that the comparator is invoked as : < code > comparator ( data , dataAlreadyInList ) < / code > .
* @ param < E > is the type of the elements in the list .
* @ param list is the list to explore .
* @ param comparator is the comparator of elements .
* @ param data is the data to search for .
* @ return < code > true < / code > if the data is inside the list , otherwise < code > false < / code > */
@ Pure public static < E > boolean contains ( List < E > list , Comparator < ? super E > comparator , E data ) { } } | assert list != null ; assert comparator != null ; assert data != null ; int first = 0 ; int last = list . size ( ) - 1 ; while ( last >= first ) { final int center = ( first + last ) / 2 ; final E dt = list . get ( center ) ; final int cmpR = comparator . compare ( data , dt ) ; if ( cmpR == 0 ) { return true ; } else if ( cmpR < 0 ) { last = center - 1 ; } else { first = center + 1 ; } } return false ; |
public class ArrayTrie { @ Override public V getBest ( String s , int offset , int len ) { } } | return getBest ( 0 , s , offset , len ) ; |
public class HelpBlock { /** * { @ inheritDoc } */
@ Override public void setText ( String value ) { } } | String oldValue = getText ( ) ; if ( ! oldValue . equals ( value ) ) { super . setText ( value ) ; DomEvent . fireNativeEvent ( Document . get ( ) . createChangeEvent ( ) , this ) ; } |
public class BaseCalendar { /** * protected */
public long getFixedDate ( CalendarDate date ) { } } | if ( ! date . isNormalized ( ) ) { normalizeMonth ( date ) ; } return getFixedDate ( ( ( Date ) date ) . getNormalizedYear ( ) , date . getMonth ( ) , date . getDayOfMonth ( ) , ( BaseCalendar . Date ) date ) ; |
public class RpcConfigs { /** * Gets boolean value .
* @ param primaryKey the primary key
* @ param secondaryKey the secondary key
* @ return the boolean value */
public static boolean getBooleanValue ( String primaryKey , String secondaryKey ) { } } | Object val = CFG . get ( primaryKey ) ; if ( val == null ) { val = CFG . get ( secondaryKey ) ; if ( val == null ) { throw new SofaRpcRuntimeException ( "Not found key: " + primaryKey + "/" + secondaryKey ) ; } } return Boolean . valueOf ( val . toString ( ) ) ; |
public class OmsPenmanEtp { /** * reference height for wind speed */
@ Execute public void penman ( ) { } } | checkNull ( inPressure , inTemp , inRh , inWind , inSwe , inVegetation , inShortradiation , inNetradiation ) ; outEtp = new HashMap < Integer , double [ ] > ( ) ; DateTime currentTimestamp = formatter . parseDateTime ( tCurrent ) ; int monthOfYear = currentTimestamp . getMonthOfYear ( ) ; Set < Entry < Integer , double [ ] > > elevSet = inTemp . entrySet ( ) ; for ( Entry < Integer , double [ ] > entry : elevSet ) { Integer basinId = entry . getKey ( ) ; // double elevation = inElevations . get ( basinId ) [ 0 ] ;
double tair = entry . getValue ( ) [ 0 ] ; double pressure = inPressure . get ( basinId ) [ 0 ] ; double relativeHumidity = inRh . get ( basinId ) [ 0 ] ; double wind = inWind . get ( basinId ) [ 0 ] ; double snowWaterEquivalent = inSwe . get ( basinId ) [ 0 ] ; double shortRadiation = inShortradiation . get ( basinId ) [ 0 ] ; double netRadiation = inNetradiation . get ( basinId ) [ 0 ] ; VegetationLibraryRecord vegetation = inVegetation . get ( basinId ) ; double displacement = vegetation . getDisplacement ( monthOfYear ) ; double roughness = vegetation . getRoughness ( monthOfYear ) ; double rs = vegetation . getMinStomatalResistance ( ) ; double RGL = vegetation . getRgl ( ) ; double lai = vegetation . getLai ( monthOfYear ) ; double rarc = vegetation . getArchitecturalResistance ( ) ; /* * set the pressure in Pascal instead of in hPa as the input link gives */
pressure = pressure / 100 ; double vpd = svp ( tair ) - ( relativeHumidity * 100 / svp ( tair ) ) ; // vpd in KPa
double ra = calcAerodynamic ( displacement , roughness , ZREF , wind , snowWaterEquivalent ) ; // CONSIDER THE SOIL RESISTANCE NULL
// / / calculate gsm _ inv : soil moisture stress factor
// double criticalSoilMoisture = 0.33 ; / / fraction of soil moisture content at the
// critical
// / / point
// double wiltingPointSoilMoisture = 0.133;
// double waterContentCriticalPoint = criticalSoilMoisture * maxMoisture ;
// double waterContentWiltingPoint = wiltingPointSoilMoisture * maxMoisture ;
// double gsm _ inv ; / / soil moisture stress factor
// if ( soilMoisture > = waterContentCriticalPoint ) {
// gsm _ inv = 1.0;
// } else if ( soilMoisture > = waterContentWiltingPoint ) {
// gsm _ inv = ( soilMoisture - waterContentWiltingPoint ) / ( waterContentCriticalPoint -
// waterContentWiltingPoint ) ;
// } else {
// gsm _ inv = 0.0;
/* calculate the slope of the saturated vapor pressure curve in Pa / K */
double slope = svp_slope ( tair ) * 1000.0 ; /* factor for canopy resistance based on photosynthesis */
double dayFactor ; /* calculate resistance factors ( Wigmosta et al . , 1994) */
double f = 0.0 ; if ( rs > 0. ) { if ( RGL < 0 ) { throw new ModelsIllegalargumentException ( "Invalid value of RGL for the current class." , this , pm ) ; } else if ( RGL == 0 ) { f = shortRadiation ; } else { f = shortRadiation / RGL ; } dayFactor = ( 1. + f ) / ( f + rs / RSMAX ) ; } else dayFactor = 1. ; /* factor for canopy resistance based on temperature */
double tFactor = .08 * tair - 0.0016 * tair * tair ; tFactor = ( tFactor <= 0.0 ) ? 1e-10 : tFactor ; /* factor for canopy resistance based on vpd */
double vpdFactor = 1 - vpd / CLOSURE ; vpdFactor = ( vpdFactor < VPDMINFACTOR ) ? VPDMINFACTOR : vpdFactor ; /* calculate canopy resistance in s / m */
// double rc = rs / ( lai * gsm _ inv * tFactor * vpdFactor ) * dayFactor ;
double rc = rs / ( lai * tFactor * vpdFactor ) * dayFactor ; rc = ( rc > RSMAX ) ? RSMAX : rc ; // double h ; / * scale height in the atmosphere ( m ) * /
// / * calculate scale height based on average temperature in the column * /
// h = 287 / 9.81 * ( ( tair + 273.15 ) + 0.5 * ( double ) elevation * LAPSE _ PM ) ;
// / * use hypsometric equation to calculate p _ z , assume that virtual temperature is
// equal
// air _ temp * /
// pz = PS _ PM * Math . exp ( - ( double ) elevation / h ) ;
// instead of calculating the pressure in h . adige it is possible to read the
// interpolated
// pressure from input link
// pz is the surface air pressure
/* calculate latent heat of vaporization . Eq . 4.2.1 in Handbook of Hydrology , assume Ts is Tair */
double lv = 2501000 - 2361 * tair ; /* calculate the psychrometric constant gamma ( Pa / C ) . Eq . 4.2.28 . Handbook of Hydrology */
double gamma = 1628.6 * pressure / lv ; /* calculate factor to be applied to rc / ra */
/* calculate the air density ( in kg / m3 ) , using eq . 4.2.4 Handbook of Hydrology */
double r_air = 0.003486 * pressure / ( 275 + tair ) ; /* calculate the Penman - Monteith evaporation in mm / day ( by not dividing by
* the density of water ( ~ 1000 kg / m3 ) ) , the result ends up being in mm instead of m */
double evap = ( ( slope * netRadiation + r_air * CP_PM * vpd / ra ) / ( lv * ( slope + gamma * ( 1 + ( rc + rarc ) / ra ) ) ) * SEC_PER_DAY ) / 24.0 ; if ( vpd >= 0.0 && evap < 0.0 ) evap = 0.0 ; outEtp . put ( basinId , new double [ ] { evap } ) ; } |
public class LayerableConfig { /** * Exports the layerable node from config .
* @ param config The config reference ( must not be < code > null < / code > ) .
* @ return The layerable node .
* @ throws LionEngineException If unable to read node or invalid integer . */
public static Xml exports ( LayerableConfig config ) { } } | Check . notNull ( config ) ; final Xml node = new Xml ( NODE_LAYERABLE ) ; node . writeInteger ( ATT_REFRESH , config . getLayerRefresh ( ) ) ; node . writeInteger ( ATT_DISPLAY , config . getLayerDisplay ( ) ) ; return node ; |
public class AssignmentStatement { /** * If the identifier was initialized without a type specification
* and a null value , the identifier ' s type becomes that of it ' s first
* assignment .
* TODO cgross : I don ' t think this is necessary any more . Remove it . */
private void resetIdentifierType ( ) { } } | Expression expression = getExpression ( ) ; if ( expression == null ) { return ; } Identifier identifier = getIdentifier ( ) ; if ( identifier == null ) { return ; } ISymbol symbol = identifier . getSymbol ( ) ; if ( symbol . getType ( ) == GosuParserTypes . NULL_TYPE ( ) ) { symbol . setType ( expression . getType ( ) ) ; } |
public class OutputsInner { /** * Updates an existing output under an existing streaming job . This can be used to partially update ( ie . update one or two properties ) an output without affecting the rest the job or output definition .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param jobName The name of the streaming job .
* @ param outputName The name of the output .
* @ param output An Output object . The properties specified here will overwrite the corresponding properties in the existing output ( ie . Those properties will be updated ) . Any properties that are set to null here will mean that the corresponding property in the existing output will remain the same and not change as a result of this PATCH operation .
* @ param ifMatch The ETag of the output . Omit this value to always overwrite the current output . Specify the last - seen ETag value to prevent accidentally overwritting concurrent changes .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the OutputInner object */
public Observable < OutputInner > updateAsync ( String resourceGroupName , String jobName , String outputName , OutputInner output , String ifMatch ) { } } | return updateWithServiceResponseAsync ( resourceGroupName , jobName , outputName , output , ifMatch ) . map ( new Func1 < ServiceResponseWithHeaders < OutputInner , OutputsUpdateHeaders > , OutputInner > ( ) { @ Override public OutputInner call ( ServiceResponseWithHeaders < OutputInner , OutputsUpdateHeaders > response ) { return response . body ( ) ; } } ) ; |
public class SparseDataset { /** * Set the class label of a datum . If the index
* exceeds the current matrix size , the matrix will resize itself .
* @ param i the row index of entry .
* @ param y the class label or real - valued response of the datum . */
public void set ( int i , int y ) { } } | if ( response == null ) { throw new IllegalArgumentException ( "The dataset has no response values." ) ; } if ( response . getType ( ) != Attribute . Type . NOMINAL ) { throw new IllegalArgumentException ( "The response variable is not nominal." ) ; } if ( i < 0 ) { throw new IllegalArgumentException ( "Invalid index: i = " + i ) ; } int nrows = size ( ) ; if ( i >= nrows ) { for ( int k = nrows ; k <= i ; k ++ ) { data . add ( new Datum < > ( new SparseArray ( ) ) ) ; } } get ( i ) . y = y ; |
public class ProgressRule { /** * Sets the actions value for this ProgressRule .
* @ param actions * Pending or completed actions for this rule . */
public void setActions ( com . google . api . ads . admanager . axis . v201902 . ProgressAction [ ] actions ) { } } | this . actions = actions ; |
public class AbstractGpxParserDefault { /** * Initialisation of all the indicators used to read the document . */
public void clear ( ) { } } | setElementNames ( new StringStack ( STRINGSTACK_SIZE ) ) ; setContentBuffer ( new StringBuilder ( ) ) ; setSpecificElement ( false ) ; minLat = 0 ; maxLat = 0 ; minLon = 0 ; maxLon = 0 ; creator = null ; version = null ; name = null ; desc = null ; link = null ; linkText = null ; time = null ; authorName = null ; email = null ; authorLink = null ; authorLinkText = null ; keywords = null ; |
public class ReferencedValueHashMap { /** * Scans the contents of this map , removing all entries that have a
* cleared soft value . */
private void cleanup ( ) { } } | Entry < K , V > [ ] tab = this . table ; for ( int i = tab . length ; i -- > 0 ; ) { for ( Entry < K , V > e = tab [ i ] , prev = null ; e != null ; e = e . next ) { if ( e . get ( ) == null ) { // Clean up after a cleared Reference .
this . modCount ++ ; if ( prev != null ) { prev . next = e . next ; } else { tab [ i ] = e . next ; } this . count -- ; } else { prev = e ; } } } |
public class PermissionAwareCrudService { /** * This method adds ( user ) permissions to the passed entity and persists ( ! )
* the permission collection !
* If no permissions have been set before , they will be created . Otherwise
* the passed permissions will be added to the existing permission
* collection .
* @ param entity The secured entity
* @ param user The user that gets permissions for the entity
* @ param permissions The permissions the user gets for the entity */
public void addAndSaveUserPermissions ( E entity , User user , Permission ... permissions ) { } } | if ( entity == null ) { LOG . error ( "Could not add permissions: The passed entity is NULL." ) ; return ; } // create a set from the passed array
final HashSet < Permission > permissionsSet = new HashSet < Permission > ( Arrays . asList ( permissions ) ) ; if ( permissionsSet == null || permissionsSet . isEmpty ( ) ) { LOG . error ( "Could not add permissions: No permissions have been passed." ) ; return ; } // get the existing permission
PermissionCollection userPermissionCollection = entity . getUserPermissions ( ) . get ( user ) ; // whether or not we have to persist the permission collection ( which is only
// the case if it is new or its size has changed )
boolean persistPermissionCollection = false ; // whether or not we have to persist the entity ( which is only the case
// if a new permission collection will be created in the next step )
boolean persistEntity = false ; if ( userPermissionCollection == null ) { // create a new user permission collection and attach it to the user
userPermissionCollection = new PermissionCollection ( permissionsSet ) ; entity . getUserPermissions ( ) . put ( user , userPermissionCollection ) ; LOG . debug ( "Attached a new permission collection for a user: " + permissionsSet ) ; // persist permission collection and the entity as a new permission
// collection has been attached
persistPermissionCollection = true ; persistEntity = true ; } else { Set < Permission > userPermissions = userPermissionCollection . getPermissions ( ) ; int originalNrOfPermissions = userPermissions . size ( ) ; // add the passed permissions to the the existing permission collection
userPermissions . addAll ( permissionsSet ) ; int newNrOfPermissions = userPermissions . size ( ) ; if ( newNrOfPermissions > originalNrOfPermissions ) { // persist the collection as we have " really " added new permission ( s )
persistPermissionCollection = true ; LOG . debug ( "Added the following permissions to an existing permission collection: " + permissionsSet ) ; } } if ( persistPermissionCollection ) { // persist the permission collection
permissionCollectionService . saveOrUpdate ( userPermissionCollection ) ; LOG . debug ( "Persisted a permission collection" ) ; // persist the entity if necessary
if ( persistEntity ) { this . saveOrUpdate ( entity ) ; LOG . debug ( "Persisted the entity with a new permission collection." ) ; } } |
public class MagickUtil { /** * Converts an ( A ) RGB { @ code MagickImage } to a { @ code BufferedImage } , of
* type { @ code TYPE _ 4BYTE _ ABGR } or { @ code TYPE _ 3BYTE _ BGR } .
* @ param pImage the original { @ code MagickImage }
* @ param pAlpha keep alpha channel
* @ return a new { @ code BufferedImage }
* @ throws MagickException if an exception occurs during conversion
* @ see BufferedImage */
private static BufferedImage rgbToBuffered ( MagickImage pImage , boolean pAlpha ) throws MagickException { } } | Dimension size = pImage . getDimension ( ) ; int length = size . width * size . height ; int bands = pAlpha ? 4 : 3 ; byte [ ] pixels = new byte [ length * bands ] ; // TODO : If we do multiple dispatches ( one per line , typically ) , we could provide listener
// feedback . But it ' s currently a lot slower than fetching all the pixels in one go .
// Note : The ordering ABGR or BGR corresponds to BufferedImage
// TYPE _ 4BYTE _ ABGR and TYPE _ 3BYTE _ BGR respectively
pImage . dispatchImage ( 0 , 0 , size . width , size . height , pAlpha ? "ABGR" : "BGR" , pixels ) ; // Init databuffer with array , to avoid allocation of empty array
DataBuffer buffer = new DataBufferByte ( pixels , pixels . length ) ; int [ ] bandOffsets = pAlpha ? BAND_OFF_TRANS : BAND_OFF_OPAQUE ; WritableRaster raster = Raster . createInterleavedRaster ( buffer , size . width , size . height , size . width * bands , bands , bandOffsets , LOCATION_UPPER_LEFT ) ; return new BufferedImage ( pAlpha ? CM_COLOR_ALPHA : CM_COLOR_OPAQUE , raster , pAlpha , null ) ; |
public class SimpleMailSender { /** * @ param mailInfo
* @ return */
private static Message setCommon ( MailSenderInfo mailInfo ) throws MessagingException { } } | // 判断是否需要身份认证
MyAuthenticator authenticator = null ; Properties pro = mailInfo . getProperties ( ) ; if ( mailInfo . isValidate ( ) ) { // 如果需要身份认证 , 则创建一个密码验证器
authenticator = new MyAuthenticator ( mailInfo . getUserName ( ) , mailInfo . getPassword ( ) ) ; } // 根据邮件会话属性和密码验证器构造一个发送邮件的session
Session sendMailSession = Session . getDefaultInstance ( pro , authenticator ) ; // 根据session创建一个邮件消息
Message mailMessage = new MimeMessage ( sendMailSession ) ; // 创建邮件发送者地址
Address from = new InternetAddress ( mailInfo . getFromAddress ( ) ) ; // 设置邮件消息的发送者
mailMessage . setFrom ( from ) ; // 创建邮件的接收者地址 , 并设置到邮件消息中
Address to = new InternetAddress ( mailInfo . getToAddress ( ) ) ; mailMessage . setRecipient ( Message . RecipientType . TO , to ) ; // 设置邮件消息的主题
mailMessage . setSubject ( mailInfo . getSubject ( ) ) ; // 设置邮件消息发送的时间
mailMessage . setSentDate ( new Date ( ) ) ; return mailMessage ; |
public class ProjectCalendarWeek { /** * { @ inheritDoc } */
@ Override public int compareTo ( ProjectCalendarWeek o ) { } } | long fromTime1 = m_dateRange . getStart ( ) . getTime ( ) ; long fromTime2 = o . m_dateRange . getStart ( ) . getTime ( ) ; return ( ( fromTime1 < fromTime2 ) ? ( - 1 ) : ( ( fromTime1 == fromTime2 ) ? 0 : 1 ) ) ; |
public class MessageHeader { /** * Removes bare Negotiate and Kerberos headers when an " NTLM . . . "
* appears . All Performed on headers with key being k .
* @ return true if there is a change */
public boolean filterNTLMResponses ( String k ) { } } | boolean found = false ; for ( int i = 0 ; i < nkeys ; i ++ ) { if ( k . equalsIgnoreCase ( keys [ i ] ) && values [ i ] != null && values [ i ] . length ( ) > 5 && values [ i ] . regionMatches ( true , 0 , "NTLM " , 0 , 5 ) ) { found = true ; break ; } } if ( found ) { int j = 0 ; for ( int i = 0 ; i < nkeys ; i ++ ) { if ( k . equalsIgnoreCase ( keys [ i ] ) && ( "Negotiate" . equalsIgnoreCase ( values [ i ] ) || "Kerberos" . equalsIgnoreCase ( values [ i ] ) ) ) { continue ; } if ( i != j ) { keys [ j ] = keys [ i ] ; values [ j ] = values [ i ] ; } j ++ ; } if ( j != nkeys ) { nkeys = j ; return true ; } } return false ; |
public class ViewUtility { /** * 重置相应的method绑定 */
public static void reset ( Object object ) { } } | if ( object instanceof Activity ) { reset ( object , ( ( Activity ) object ) . getWindow ( ) . getDecorView ( ) . findViewById ( android . R . id . content ) ) ; } else if ( object instanceof Fragment ) { reset ( object , ( ( Fragment ) object ) . getView ( ) ) ; } else if ( object instanceof View ) { reset ( object , ( View ) object ) ; } |
public class Solo { /** * Types text in a WebElement matching the specified By object .
* @ param by the By object . Examples are : { @ code By . id ( " id " ) } and { @ code By . name ( " name " ) }
* @ param text the text to enter in the { @ link WebElement } field
* @ param match if multiple objects match , this determines which one will be typed in */
public void typeTextInWebElement ( By by , String text , int match ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "typeTextInWebElement(" + by + ", \"" + text + "\", " + match + ")" ) ; } clicker . clickOnWebElement ( by , match , true , false ) ; dialogUtils . hideSoftKeyboard ( null , true , true ) ; instrumentation . sendStringSync ( text ) ; |
public class DateUtils { /** * Parses the given date string returned by the AWS service into a Date
* object . */
public static Date parseServiceSpecificDate ( String dateString ) { } } | if ( dateString == null ) return null ; try { BigDecimal dateValue = new BigDecimal ( dateString ) ; return new Date ( dateValue . scaleByPowerOfTen ( AWS_DATE_MILLI_SECOND_PRECISION ) . longValue ( ) ) ; } catch ( NumberFormatException nfe ) { throw new SdkClientException ( "Unable to parse date : " + dateString , nfe ) ; } |
public class DefaultFacebookClient { /** * Returns the base endpoint URL for the Graph API ' s video upload functionality .
* @ return The base endpoint URL for the Graph API ' s video upload functionality .
* @ since 1.6.5 */
protected String getFacebookGraphVideoEndpointUrl ( ) { } } | if ( apiVersion . isUrlElementRequired ( ) ) { return getFacebookEndpointUrls ( ) . getGraphVideoEndpoint ( ) + '/' + apiVersion . getUrlElement ( ) ; } else { return getFacebookEndpointUrls ( ) . getGraphVideoEndpoint ( ) ; } |
public class CmsXmlSeoConfiguration { /** * Loads the bean data from the given resource . < p >
* @ param cms the CMS context to use
* @ param resource the resource from which to load the data
* @ throws CmsException if something goes wrong */
public void load ( CmsObject cms , CmsResource resource ) throws CmsException { } } | CmsFile file = cms . readFile ( resource ) ; CmsObject rootCms = OpenCms . initCmsObject ( cms ) ; rootCms . getRequestContext ( ) . setSiteRoot ( "" ) ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( cms , file ) ; Locale en = new Locale ( "en" ) ; for ( I_CmsXmlContentValue value : content . getValues ( N_INCLUDE , en ) ) { String include = value . getStringValue ( rootCms ) ; if ( ! CmsStringUtil . isEmpty ( include ) ) { m_includes . add ( include ) ; } } for ( I_CmsXmlContentValue value : content . getValues ( N_EXCLUDE , en ) ) { String exclude = value . getStringValue ( rootCms ) ; if ( ! CmsStringUtil . isEmpty ( exclude ) ) { m_excludes . add ( exclude ) ; } } I_CmsXmlContentValue robotsValue = content . getValue ( N_MODE , en ) ; m_mode = robotsValue . getStringValue ( rootCms ) ; I_CmsXmlContentValue robotsTxtTextValue = content . getValue ( N_ROBOTS_TXT_TEXT , en ) ; if ( robotsTxtTextValue != null ) { m_robotsTxtText = robotsTxtTextValue . getStringValue ( rootCms ) ; } I_CmsXmlContentValue computeContPageDates = content . getValue ( N_COMPUTE_CONTAINER_PAGE_DATES , en ) ; if ( computeContPageDates != null ) { m_computeContainerPageDates = Boolean . parseBoolean ( computeContPageDates . getStringValue ( rootCms ) ) ; } I_CmsXmlContentValue generatorClassValue = content . getValue ( N_GENERATOR_CLASS , en ) ; if ( generatorClassValue != null ) { m_generatorClassName = generatorClassValue . getStringValue ( rootCms ) ; } I_CmsXmlContentValue cacheValue = content . getValue ( N_CACHE , en ) ; if ( cacheValue != null ) { m_useCache = Boolean . parseBoolean ( cacheValue . getStringValue ( rootCms ) ) ; } I_CmsXmlContentValue serverUrlValue = content . getValue ( N_SERVER_URL , en ) ; if ( serverUrlValue != null ) { m_serverUrl = serverUrlValue . getStringValue ( rootCms ) ; } |
public class DefaultGrailsPluginManager { /** * / * ( non - Javadoc )
* @ see grails . plugins . GrailsPluginManager # loadPlugins ( ) */
public void loadPlugins ( ) throws PluginException { } } | if ( initialised ) { return ; } ClassLoader gcl = application . getClassLoader ( ) ; attemptLoadPlugins ( gcl ) ; if ( ! delayedLoadPlugins . isEmpty ( ) ) { loadDelayedPlugins ( ) ; } if ( ! delayedEvictions . isEmpty ( ) ) { processDelayedEvictions ( ) ; } pluginList = sortPlugins ( pluginList ) ; initializePlugins ( ) ; initialised = true ; |
public class Parser { public final Parser < RECORD > dropDissector ( Class < ? extends Dissector > dissectorClassToDrop ) { } } | assembled = false ; Set < Dissector > removeDissector = new HashSet < > ( ) ; for ( final Dissector dissector : allDissectors ) { if ( dissector . getClass ( ) . equals ( dissectorClassToDrop ) ) { removeDissector . add ( dissector ) ; } } allDissectors . removeAll ( removeDissector ) ; return this ; |
public class CommerceAccountOrganizationRelPersistenceImpl { /** * Returns the commerce account organization rel with the primary key or returns < code > null < / code > if it could not be found .
* @ param primaryKey the primary key of the commerce account organization rel
* @ return the commerce account organization rel , or < code > null < / code > if a commerce account organization rel with the primary key could not be found */
@ Override public CommerceAccountOrganizationRel fetchByPrimaryKey ( Serializable primaryKey ) { } } | Serializable serializable = entityCache . getResult ( CommerceAccountOrganizationRelModelImpl . ENTITY_CACHE_ENABLED , CommerceAccountOrganizationRelImpl . class , primaryKey ) ; if ( serializable == nullModel ) { return null ; } CommerceAccountOrganizationRel commerceAccountOrganizationRel = ( CommerceAccountOrganizationRel ) serializable ; if ( commerceAccountOrganizationRel == null ) { Session session = null ; try { session = openSession ( ) ; commerceAccountOrganizationRel = ( CommerceAccountOrganizationRel ) session . get ( CommerceAccountOrganizationRelImpl . class , primaryKey ) ; if ( commerceAccountOrganizationRel != null ) { cacheResult ( commerceAccountOrganizationRel ) ; } else { entityCache . putResult ( CommerceAccountOrganizationRelModelImpl . ENTITY_CACHE_ENABLED , CommerceAccountOrganizationRelImpl . class , primaryKey , nullModel ) ; } } catch ( Exception e ) { entityCache . removeResult ( CommerceAccountOrganizationRelModelImpl . ENTITY_CACHE_ENABLED , CommerceAccountOrganizationRelImpl . class , primaryKey ) ; throw processException ( e ) ; } finally { closeSession ( session ) ; } } return commerceAccountOrganizationRel ; |
public class RadialPickerLayout { /** * Necessary for accessibility , to ensure we support " scrolling " forward and backward
* in the circle . */
@ Override @ TargetApi ( Build . VERSION_CODES . ICE_CREAM_SANDWICH ) public void onInitializeAccessibilityNodeInfo ( AccessibilityNodeInfo info ) { } } | super . onInitializeAccessibilityNodeInfo ( info ) ; info . addAction ( AccessibilityNodeInfo . ACTION_SCROLL_FORWARD ) ; info . addAction ( AccessibilityNodeInfo . ACTION_SCROLL_BACKWARD ) ; |
public class PathNormalizer { /** * Normalizes two paths and joins them as a single path .
* @ param prefix
* the path prefix
* @ param path
* the path
* @ return the joined path */
public static String joinPaths ( String prefix , String path ) { } } | String joinedPath = null ; if ( prefix . startsWith ( JawrConstant . HTTP_URL_PREFIX ) || prefix . startsWith ( JawrConstant . HTTPS_URL_PREFIX ) || prefix . startsWith ( "//" ) ) { joinedPath = joinDomainToPath ( prefix , path ) ; } else { String normalizedPrefix = PathNormalizer . normalizePath ( prefix ) ; StringBuilder sb = new StringBuilder ( JawrConstant . URL_SEPARATOR ) ; if ( ! "" . equals ( normalizedPrefix ) ) sb . append ( normalizedPrefix ) . append ( JawrConstant . URL_SEPARATOR ) ; sb . append ( PathNormalizer . normalizePath ( path ) ) ; joinedPath = sb . toString ( ) ; } return joinedPath ; |
public class POJOService { /** * adds attribute to constructor
* @ param constructorBuilder constructor to modify
* @ param attributeName name of attribute to be added
* @ param type type of attribute to be added */
private void addConstructorParameter ( final MethodSpec . Builder constructorBuilder , final String attributeName , final TypeName type ) { } } | constructorBuilder . addParameter ( type , attributeName , Modifier . FINAL ) ; constructorBuilder . addCode ( "this." + attributeName + "=" + attributeName + ";" ) ; |
public class FactoryDefinition { /** * Get a score for this factory based on the given data . The higher the
* score the more arguments were found .
* @ param data
* @ return */
public int getScore ( Map < String , Object > data ) { } } | if ( ! hasSerializedFields ) { return 0 ; } int score = 0 ; for ( Argument arg : arguments ) { if ( arg instanceof FactoryDefinition . SerializedArgument ) { if ( data . containsKey ( ( ( SerializedArgument ) arg ) . name ) ) { score ++ ; } } } return score ; |
public class CSVUtil { /** * Exports the data from database to CVS . Title will be added at the first line and columns will be quoted .
* @ param out
* @ param rs
* @ return */
public static long exportCSV ( final Writer out , final ResultSet rs ) throws UncheckedSQLException , UncheckedIOException { } } | return exportCSV ( out , rs , 0 , Long . MAX_VALUE , true , true ) ; |
public class UserAPI { /** * 批量获取关注者信息
* @ param userInfoList 关注者ID列表
* @ return 关注者信息对象列表 */
public GetUserInfoListResponse getUserInfoList ( List < UserInfo > userInfoList ) { } } | String url = BASE_API_URL + "cgi-bin/user/info/batchget?access_token=#" ; Map < String , List < UserInfo > > param = new HashMap < String , List < UserInfo > > ( ) ; param . put ( "user_list" , userInfoList ) ; BaseResponse r = executePost ( url , JSONUtil . toJson ( param ) ) ; String resultJson = isSuccess ( r . getErrcode ( ) ) ? r . getErrmsg ( ) : r . toJsonString ( ) ; GetUserInfoListResponse getUserInfoListResponse = JSONUtil . toBean ( resultJson , GetUserInfoListResponse . class ) ; return getUserInfoListResponse ; |
public class DescribeTableStatisticsResult { /** * The table statistics .
* @ param tableStatistics
* The table statistics . */
public void setTableStatistics ( java . util . Collection < TableStatistics > tableStatistics ) { } } | if ( tableStatistics == null ) { this . tableStatistics = null ; return ; } this . tableStatistics = new java . util . ArrayList < TableStatistics > ( tableStatistics ) ; |
public class ComputerVisionImpl { /** * This operation generates a list of words , or tags , that are relevant to the content of the supplied image . The Computer Vision API can return tags based on objects , living beings , scenery or actions found in images . Unlike categories , tags are not organized according to a hierarchical classification system , but correspond to image content . Tags may contain hints to avoid ambiguity or provide context , for example the tag ' cello ' may be accompanied by the hint ' musical instrument ' . All tags are in English .
* @ param image An image stream .
* @ param tagImageInStreamOptionalParameter the object representing the optional parameters to be set before calling this API
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the TagResult object */
public Observable < TagResult > tagImageInStreamAsync ( byte [ ] image , TagImageInStreamOptionalParameter tagImageInStreamOptionalParameter ) { } } | return tagImageInStreamWithServiceResponseAsync ( image , tagImageInStreamOptionalParameter ) . map ( new Func1 < ServiceResponse < TagResult > , TagResult > ( ) { @ Override public TagResult call ( ServiceResponse < TagResult > response ) { return response . body ( ) ; } } ) ; |
public class LightWeightHashSet { /** * Compute capacity given initial capacity .
* @ return final capacity , either MIN _ CAPACITY , MAX _ CAPACITY , or power of 2
* closest to the requested capacity . */
private int computeCapacity ( int initial ) { } } | if ( initial < MINIMUM_CAPACITY ) { return MINIMUM_CAPACITY ; } if ( initial > MAXIMUM_CAPACITY ) { return MAXIMUM_CAPACITY ; } int capacity = 1 ; while ( capacity < initial ) { capacity <<= 1 ; } return capacity ; |
public class GoogleMap { /** * A property tied to the map , updated when the idle state event is fired .
* @ return */
public final ReadOnlyObjectProperty < LatLongBounds > boundsProperty ( ) { } } | if ( bounds == null ) { bounds = new ReadOnlyObjectWrapper < > ( getBounds ( ) ) ; addStateEventHandler ( MapStateEventType . idle , ( ) -> { bounds . set ( getBounds ( ) ) ; } ) ; } return bounds . getReadOnlyProperty ( ) ; |
public class AbstractInput { /** * Iterates over the { @ link Diagnostic } s and finds the diagnostics that related to the current component .
* @ param diags A List of Diagnostic objects .
* @ param severity A Diagnostic severity code . e . g . { @ link Diagnostic # ERROR } */
protected void showIndicatorsForComponent ( final List < Diagnostic > diags , final int severity ) { } } | InputModel model = getOrCreateComponentModel ( ) ; if ( severity == Diagnostic . ERROR ) { model . errorDiagnostics . clear ( ) ; } else { model . warningDiagnostics . clear ( ) ; } UIContext uic = UIContextHolder . getCurrent ( ) ; for ( int i = 0 ; i < diags . size ( ) ; i ++ ) { Diagnostic diagnostic = diags . get ( i ) ; // NOTE : double equals because they must be the same instance .
if ( diagnostic . getSeverity ( ) == severity && uic == diagnostic . getContext ( ) && this == diagnostic . getComponent ( ) ) { if ( severity == Diagnostic . ERROR ) { model . errorDiagnostics . add ( diagnostic ) ; } else { model . warningDiagnostics . add ( diagnostic ) ; } } } |
public class Base64 { /** * Returns whether or not the < code > octet < / code > is in the base 64 alphabet .
* @ param octet
* The value to test
* @ return { @ code true } if the value is defined in the the base 64 alphabet , { @ code false } otherwise .
* @ since 1.4 */
public static boolean isBase64 ( final byte octet ) { } } | return octet == PAD_DEFAULT || ( octet >= 0 && octet < DECODE_TABLE . length && DECODE_TABLE [ octet ] != - 1 ) ; |
public class ReviewReportMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ReviewReport reviewReport , ProtocolMarshaller protocolMarshaller ) { } } | if ( reviewReport == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( reviewReport . getReviewResults ( ) , REVIEWRESULTS_BINDING ) ; protocolMarshaller . marshall ( reviewReport . getReviewActions ( ) , REVIEWACTIONS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class CSSUpdate { /** * Read the file .
* @ param _ installFile the install file
* @ return CSSUpdate */
public static CSSUpdate readFile ( final InstallFile _installFile ) { } } | final CSSUpdate ret = new CSSUpdate ( _installFile ) ; final CSSDefinition definition = ret . new CSSDefinition ( _installFile ) ; ret . addDefinition ( definition ) ; return ret ; |
public class SimpleBufferedReadable { /** * Stop any pending read , and block until they are cancelled or done . */
public void stop ( ) { } } | AsyncWork < Integer , IOException > currentRead = readTask ; if ( currentRead != null && ! currentRead . isUnblocked ( ) ) { currentRead . cancel ( new CancelException ( "SimpleBufferedReadable.stop" ) ) ; currentRead . block ( 0 ) ; } |
public class TargetConfigurationMarshaller { /** * Marshall the given parameter object . */
public void marshall ( TargetConfiguration targetConfiguration , ProtocolMarshaller protocolMarshaller ) { } } | if ( targetConfiguration == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( targetConfiguration . getTargetValue ( ) , TARGETVALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ConceptBuilder { /** * Check if this pre - existing concept conforms to all specified parameters
* @ throws GraqlQueryException if any parameter does not match */
private void validate ( Concept concept ) { } } | validateParam ( concept , TYPE , Thing . class , Thing :: type ) ; validateParam ( concept , SUPER_CONCEPT , SchemaConcept . class , SchemaConcept :: sup ) ; validateParam ( concept , LABEL , SchemaConcept . class , SchemaConcept :: label ) ; validateParam ( concept , ID , Concept . class , Concept :: id ) ; validateParam ( concept , VALUE , Attribute . class , Attribute :: value ) ; validateParam ( concept , DATA_TYPE , AttributeType . class , AttributeType :: dataType ) ; validateParam ( concept , WHEN , Rule . class , Rule :: when ) ; validateParam ( concept , THEN , Rule . class , Rule :: then ) ; |
public class FixedLengthList { /** * Appends all of the elements in the argument collection in the order that they are returned by the collection ' s iterator .
* Does so by calling FixedLengthList . add ( E entry ) . */
public boolean addAll ( Collection < ? extends E > c ) { } } | Iterator < ? extends E > cIterator = c . iterator ( ) ; while ( cIterator . hasNext ( ) ) { this . add ( cIterator . next ( ) ) ; } return true ; |
public class WhileyFileParser { /** * Match a given token kind , whilst moving passed any whitespace encountered
* inbetween . In the case that meet the end of the stream , or we don ' t match
* the expected token , then an error is thrown .
* @ param kind
* @ return */
private Token match ( Token . Kind kind ) { } } | checkNotEof ( ) ; Token token = tokens . get ( index ++ ) ; if ( token . kind != kind ) { syntaxError ( "expecting \"" + kind + "\" here" , token ) ; } return token ; |
public class GrailsConfigUtils { /** * Checks if a Config parameter is true or a System property with the same name is true
* @ param application
* @ param propertyName
* @ return true if the Config parameter is true or the System property with the same name is true */
public static boolean isConfigTrue ( GrailsApplication application , String propertyName ) { } } | return application . getConfig ( ) . getProperty ( propertyName , Boolean . class , false ) ; |
public class RandomICAutomatonGenerator { /** * Generates an initially - connected ( IC ) deterministic automaton with the given parameters . The resulting automaton
* is instantiated using the given { @ code creator } . Note that the resulting automaton will < b > not < / b > be minimized .
* @ param numStates
* the number of states of the resulting automaton
* @ param alphabet
* the input alphabet of the resulting automaton
* @ param creator
* an { @ link AutomatonCreator } for instantiating the result automaton
* @ param r
* the randomness source
* @ return a randomly - generated IC deterministic automaton */
public < I , A extends MutableDeterministic < ? , I , ? , ? super SP , ? super TP > > A generateICDeterministicAutomaton ( int numStates , Alphabet < I > alphabet , AutomatonCreator < ? extends A , I > creator , Random r ) { } } | A result = creator . createAutomaton ( alphabet , numStates ) ; return generateICDeterministicAutomaton ( numStates , alphabet , result , r ) ; |
public class JSONConverter { /** * 将JSONArray转换为指定类型的对量列表
* @ param < T > 元素类型
* @ param jsonArray JSONArray
* @ param elementType 对象元素类型
* @ return 对象列表 */
protected static < T > List < T > toList ( JSONArray jsonArray , Class < T > elementType ) { } } | return Convert . toList ( elementType , jsonArray ) ; |
public class IOUtil { /** * Write json .
* @ param < T > the type parameter
* @ param obj the obj
* @ param file the file */
public static < T > void writeJson ( T obj , File file ) { } } | StringWriter writer = new StringWriter ( ) ; try { objectMapper . writeValue ( writer , obj ) ; Files . write ( file . toPath ( ) , writer . toString ( ) . getBytes ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } |
public class BowgunCurtainBefore { public static synchronized void handleBowgunCurtainBefore ( FwAssistantDirector assistantDirector ) { } } | if ( bowgunCurtainBeforeList != null ) { bowgunCurtainBeforeList . forEach ( bowgun -> bowgun . hook ( assistantDirector ) ) ; } |
public class CmsJlanNetworkFile { /** * Loads the file data from the VFS . < p >
* @ param needContent true if we need the file content to be loaded
* @ throws IOException if an IO error happens
* @ throws CmsException if a CMS operation fails */
protected void load ( boolean needContent ) throws IOException , CmsException { } } | try { if ( m_resource . isFolder ( ) && needContent ) { throw new AccessDeniedException ( "Operation not supported for directories!" ) ; } if ( m_resource . isFile ( ) && needContent && ( ! ( m_resource instanceof CmsFile ) ) ) { m_resource = m_cms . readFile ( m_cms . getSitePath ( m_resource ) , CmsJlanDiskInterface . STANDARD_FILTER ) ; } if ( ! m_bufferInitialized && ( getFile ( ) != null ) ) { // readResource may already have returned a CmsFile , this is why we need to initialize the buffer
// here and not in the if - block above
m_buffer . init ( getFile ( ) . getContents ( ) ) ; m_bufferInitialized = true ; } } catch ( CmsException e ) { throw e ; } |
public class TypeaheadDatum { /** * Create a new TypeaheadDatum with a text and an ID using
* { @ link # getTokensFromValue ( String ) } to tokenize the string .
* @ param sValue
* Value to display . Must not be < code > null < / code > .
* @ param sID
* Optional ID of the element . May be < code > null < / code > .
* @ return New { @ link TypeaheadDatum } . */
@ Nonnull public static TypeaheadDatum createWithID ( @ Nonnull final String sValue , @ Nullable final String sID ) { } } | return new TypeaheadDatum ( sValue , getTokensFromValue ( sValue ) , sID ) ; |
public class MerlinReader { /** * Read resource data . */
private void processResources ( ) throws SQLException { } } | List < Row > rows = getRows ( "select * from zresource where zproject=? order by zorderinproject" , m_projectID ) ; for ( Row row : rows ) { Resource resource = m_project . addResource ( ) ; resource . setUniqueID ( row . getInteger ( "Z_PK" ) ) ; resource . setEmailAddress ( row . getString ( "ZEMAIL" ) ) ; resource . setInitials ( row . getString ( "ZINITIALS" ) ) ; resource . setName ( row . getString ( "ZTITLE_" ) ) ; resource . setGUID ( row . getUUID ( "ZUNIQUEID" ) ) ; resource . setType ( row . getResourceType ( "ZTYPE" ) ) ; resource . setMaterialLabel ( row . getString ( "ZMATERIALUNIT" ) ) ; if ( resource . getType ( ) == ResourceType . WORK ) { resource . setMaxUnits ( Double . valueOf ( NumberHelper . getDouble ( row . getDouble ( "ZAVAILABLEUNITS_" ) ) * 100.0 ) ) ; } Integer calendarID = row . getInteger ( "ZRESOURCECALENDAR" ) ; if ( calendarID != null ) { ProjectCalendar calendar = m_project . getCalendarByUniqueID ( calendarID ) ; if ( calendar != null ) { calendar . setName ( resource . getName ( ) ) ; resource . setResourceCalendar ( calendar ) ; } } m_eventManager . fireResourceReadEvent ( resource ) ; } |
public class IfcElementImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcRelVoidsElement > getHasOpenings ( ) { } } | return ( EList < IfcRelVoidsElement > ) eGet ( Ifc4Package . Literals . IFC_ELEMENT__HAS_OPENINGS , true ) ; |
public class HashIntSet { /** * Find position of the integer in { @ link # cells } . If not found , returns the
* first empty cell .
* @ param element element to search
* @ return if < code > returned value > = 0 < / code > , it returns the index of the
* element ; if < code > returned value < 0 < / code > , the index of the
* first empty cell is < code > - ( returned value - 1 ) < / code > */
private int findElementOrEmpty ( int element ) { } } | assert element >= 0 ; int index = toIndex ( IntHashCode . hashCode ( element ) ) ; int offset = 1 ; while ( cells [ index ] != EMPTY ) { // element found !
if ( cells [ index ] == element ) { return index ; } // compute the next index to check
index = toIndex ( index + offset ) ; offset <<= 1 ; offset ++ ; if ( offset < 0 ) { offset = 2 ; } } // element not found !
return - ( index + 1 ) ; |
public class TheDavidboxOperationFactory { /** * It sends the url get to the service and parse the response in the desired response target class .
* @ param urlGet the url to send to the service
* @ param responseTargetClass the response target class
* @ return the response object filled with the xml result
* @ throws TheDavidBoxClientException exception in the client */
private < T extends DavidBoxResponse > T sendAndParse ( String urlGet , Class < T > responseTargetClass ) throws TheDavidBoxClientException { } } | logger . debug ( "urlGet: " + urlGet ) ; // Notify the listener about the request
notifyRequest ( urlGet ) ; // Call the davidbox service to get the xml response
String xmlResponse = "" ; try { xmlResponse = getRemoteHttpService ( ) . sendGetRequest ( urlGet ) ; } catch ( TheDavidBoxClientException e1 ) { throw new TheDavidBoxClientException ( e1 , urlGet , xmlResponse ) ; } // Notify the listener about the response
notifyResponse ( xmlResponse ) ; // Parse the response into a business object
T responseObject = null ; try { responseObject = getDavidBoxPaser ( ) . parse ( responseTargetClass , xmlResponse ) ; } catch ( TheDavidBoxClientException e2 ) { throw new TheDavidBoxClientException ( e2 , urlGet , xmlResponse ) ; } return responseObject ; |
public class ByteOp { /** * Compare two byte arrays
* @ param a byte array to compare
* @ param b byte array to compare
* @ return true if a and b have same length , and all the same values , false
* otherwise */
public static boolean cmp ( byte [ ] a , byte [ ] b ) { } } | if ( a . length != b . length ) { return false ; } for ( int i = 0 ; i < a . length ; i ++ ) { if ( a [ i ] != b [ i ] ) { return false ; } } return true ; |
public class BigtableAsyncTable { /** * { @ inheritDoc } */
@ Override public CompletableFuture < Result > get ( Get get ) { } } | return toCompletableFuture ( clientWrapper . readFlatRowsAsync ( hbaseAdapter . adapt ( get ) ) ) . thenApply ( BigtableAsyncTable :: toResult ) ; |
public class Tags { /** * 或者用户身上标签
* @ param openId openId
* @ return */
public List < Integer > getUserTags ( String openId ) { } } | String url = WxEndpoint . get ( "url.tag.user.gettag" ) ; Map < String , Object > map = new HashMap < > ( ) ; map . put ( "openid" , openId ) ; String response = wxClient . post ( url , JsonMapper . nonEmptyMapper ( ) . toJson ( map ) ) ; TagIdsWrapper tagIdsWrapper = JsonMapper . defaultMapper ( ) . fromJson ( response , TagIdsWrapper . class ) ; return tagIdsWrapper . getList ( ) ; |
public class JSONArray { /** * Creates a java array from a JSONArray . < br > */
public static Object toArray ( JSONArray jsonArray , JsonConfig jsonConfig ) { } } | Class objectClass = jsonConfig . getRootClass ( ) ; Map classMap = jsonConfig . getClassMap ( ) ; if ( jsonArray . size ( ) == 0 ) { return Array . newInstance ( objectClass == null ? Object . class : objectClass , 0 ) ; } int [ ] dimensions = JSONArray . getDimensions ( jsonArray ) ; Object array = Array . newInstance ( objectClass == null ? Object . class : objectClass , dimensions ) ; int size = jsonArray . size ( ) ; for ( int i = 0 ; i < size ; i ++ ) { Object value = jsonArray . get ( i ) ; if ( JSONUtils . isNull ( value ) ) { Array . set ( array , i , null ) ; } else { Class type = value . getClass ( ) ; if ( JSONArray . class . isAssignableFrom ( type ) ) { Array . set ( array , i , toArray ( ( JSONArray ) value , objectClass , classMap ) ) ; } else if ( String . class . isAssignableFrom ( type ) || Boolean . class . isAssignableFrom ( type ) || Character . class . isAssignableFrom ( type ) || JSONFunction . class . isAssignableFrom ( type ) ) { if ( objectClass != null && ! objectClass . isAssignableFrom ( type ) ) { value = JSONUtils . getMorpherRegistry ( ) . morph ( objectClass , value ) ; } Array . set ( array , i , value ) ; } else if ( JSONUtils . isNumber ( type ) ) { if ( objectClass != null && ( Byte . class . isAssignableFrom ( objectClass ) || Byte . TYPE . isAssignableFrom ( objectClass ) ) ) { Array . set ( array , i , Byte . valueOf ( String . valueOf ( value ) ) ) ; } else if ( objectClass != null && ( Short . class . isAssignableFrom ( objectClass ) || Short . TYPE . isAssignableFrom ( objectClass ) ) ) { Array . set ( array , i , Short . valueOf ( String . valueOf ( value ) ) ) ; } else { Array . set ( array , i , value ) ; } } else { if ( objectClass != null ) { JsonConfig jsc = jsonConfig . copy ( ) ; jsc . setRootClass ( objectClass ) ; jsc . setClassMap ( classMap ) ; Array . set ( array , i , JSONObject . toBean ( ( JSONObject ) value , jsc ) ) ; } else { Array . set ( array , i , JSONObject . toBean ( ( JSONObject ) value ) ) ; } } } } return array ; |
public class IbanUtil { /** * Validates iban .
* @ param iban to be validated .
* @ throws IbanFormatException if iban is invalid .
* UnsupportedCountryException if iban ' s country is not supported .
* InvalidCheckDigitException if iban has invalid check digit . */
public static void validate ( final String iban ) throws IbanFormatException , InvalidCheckDigitException , UnsupportedCountryException { } } | try { validateEmpty ( iban ) ; validateCountryCode ( iban ) ; validateCheckDigitPresence ( iban ) ; final BbanStructure structure = getBbanStructure ( iban ) ; validateBbanLength ( iban , structure ) ; validateBbanEntries ( iban , structure ) ; validateCheckDigit ( iban ) ; } catch ( Iban4jException e ) { throw e ; } catch ( RuntimeException e ) { throw new IbanFormatException ( UNKNOWN , e . getMessage ( ) ) ; } |
public class OTAUpdateFile { /** * A list of name / attribute pairs .
* @ param attributes
* A list of name / attribute pairs .
* @ return Returns a reference to this object so that method calls can be chained together . */
public OTAUpdateFile withAttributes ( java . util . Map < String , String > attributes ) { } } | setAttributes ( attributes ) ; return this ; |
public class ChatService { /** * PUT method for updating or creating an instance of ChatService
* @ param content representation for the resource
* @ return an HTTP response with content of the updated or created resource . */
@ PUT @ Consumes ( "application/json" ) public void putJson ( IncomingMessage msg ) { } } | chatBean . addMessage ( msg . nick , msg . content ) ; |
public class TvShowsActivity { /** * Initialize the Activity with some injected data . */
@ Override public void onCreate ( Bundle savedInstanceState ) { } } | super . onCreate ( savedInstanceState ) ; setContentView ( R . layout . activity_tv_shows_sample ) ; ButterKnife . inject ( this ) ; initializeDraggableView ( ) ; initializeGridView ( ) ; hookListeners ( ) ; |
public class NamespaceParser { /** * getInstance .
* @ param file a { @ link java . io . File } object .
* @ return a { @ link com . obdobion . argument . input . IParserInput } object .
* @ throws java . io . IOException if any . */
static public IParserInput getInstance ( final File file ) throws IOException { } } | final List < String > args = new ArrayList < > ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { String aConfigLine = null ; while ( ( aConfigLine = reader . readLine ( ) ) != null ) if ( aConfigLine . length ( ) > 0 && aConfigLine . charAt ( 0 ) != '#' ) args . add ( aConfigLine ) ; } final NamespaceParser parser = new NamespaceParser ( ) ; parser . args = args . toArray ( new String [ args . size ( ) ] ) ; return parser ; |
public class CPDefinitionUtil { /** * Returns the first cp definition in the ordered set where companyId = & # 63 ; .
* @ param companyId the company ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the first matching cp definition , or < code > null < / code > if a matching cp definition could not be found */
public static CPDefinition fetchByCompanyId_First ( long companyId , OrderByComparator < CPDefinition > orderByComparator ) { } } | return getPersistence ( ) . fetchByCompanyId_First ( companyId , orderByComparator ) ; |
public class ServicesAmpImpl { /** * @ Override
* public StubAmp createStub ( Object bean , ServiceConfig config )
* return createActor ( null , bean , config ) ;
* @ Override
* private StubAmp createActor ( String path ,
* Object bean ,
* ServiceConfig config )
* if ( bean instanceof StubAmp ) {
* return ( StubAmp ) bean ;
* else {
* return stubFactory ( ) . stub ( bean , path , path , null , config ) ; */
protected InboxAmp createSystemInbox ( ) { } } | String path = getSystemAddress ( ) ; StubAmpSystem actorSystem = new StubAmpSystem ( path , this ) ; // ServiceConfig config = ServiceConfig . Builder . create ( ) . build ( ) ;
// ServiceRefAmp serviceRef = service ( actorSystem , path , config ) ;
ServiceRefAmp serviceRef = newService ( actorSystem ) . ref ( ) ; actorSystem . setInbox ( serviceRef . inbox ( ) ) ; serviceRef . bind ( path ) ; return serviceRef . inbox ( ) ; |
public class FirestoreClient { /** * Rolls back a transaction .
* < p > Sample code :
* < pre > < code >
* try ( FirestoreClient firestoreClient = FirestoreClient . create ( ) ) {
* String formattedDatabase = DatabaseRootName . format ( " [ PROJECT ] " , " [ DATABASE ] " ) ;
* ByteString transaction = ByteString . copyFromUtf8 ( " " ) ;
* firestoreClient . rollback ( formattedDatabase , transaction ) ;
* < / code > < / pre >
* @ param database The database name . In the format :
* ` projects / { project _ id } / databases / { database _ id } ` .
* @ param transaction The transaction to roll back .
* @ throws com . google . api . gax . rpc . ApiException if the remote call fails */
public final void rollback ( String database , ByteString transaction ) { } } | RollbackRequest request = RollbackRequest . newBuilder ( ) . setDatabase ( database ) . setTransaction ( transaction ) . build ( ) ; rollback ( request ) ; |
public class GridFTPClient { /** * Performs a third - party transfer between two servers using extended
* block mode .
* If server modes are unset , source will be set to active
* and destination to passive .
* @ param remoteSrcFile source filename
* @ param destination destination server
* @ param remoteDstFile destination filename
* @ param mListener transer progress listener .
* Can be set to null . */
public void extendedTransfer ( String remoteSrcFile , GridFTPClient destination , String remoteDstFile , MarkerListener mListener ) throws IOException , ServerException , ClientException { } } | extendedTransfer ( remoteSrcFile , 0 , getSize ( remoteSrcFile ) , destination , remoteDstFile , 0 , mListener ) ; |
public class DefaultVersionConstraint { /** * Create a new { @ link DefaultVersionConstraint } instance which is the combination of the provided version ranges
* and this version ranges .
* @ param otherRanges the version ranges to merge with this version ranges
* @ return the new { @ link DefaultVersionConstraint }
* @ throws IncompatibleVersionConstraintException the provided version and version ranges are not compatible with
* this version constraint */
private DefaultVersionConstraint mergeRanges ( VersionConstraint otherConstraint ) throws IncompatibleVersionConstraintException { } } | Collection < VersionRangeCollection > resolvedRanges = resolveRanges ( this ) ; Collection < VersionRangeCollection > otherResolvedRanges = resolveRanges ( otherConstraint ) ; return mergeRanges ( resolvedRanges , otherResolvedRanges ) ; |
public class ElasticPool { /** * Returns an element to the pool of available elements . The element must
* have been obtained from this pool through obtain ( ) . The recycle ( ) method
* is called before the element is available for obtain ( ) .
* @ param element the element to be returned */
public void release ( T element ) { } } | try { if ( recycle ( element ) ) { elements . add ( element ) ; } } finally { semaphore . release ( ) ; } |
public class Disjunction { /** * { @ inheritDoc } */
public ElementMatcher < ? super S > resolve ( TypeDescription typeDescription ) { } } | ElementMatcher . Junction < S > matcher = none ( ) ; for ( LatentMatcher < ? super S > latentMatcher : matchers ) { matcher = matcher . or ( latentMatcher . resolve ( typeDescription ) ) ; } return matcher ; |
public class KeyInfo { /** * Add this key area description to the Record . */
public KeyArea setupKey ( int iKeyArea ) { } } | KeyArea keyArea = null ; if ( iKeyArea == 0 ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , ID_KEY ) ; keyArea . addKeyField ( ID , DBConstants . ASCENDING ) ; } if ( iKeyArea == 1 ) { keyArea = this . makeIndex ( DBConstants . UNIQUE , KEY_FILENAME_KEY ) ; keyArea . addKeyField ( KEY_FILENAME , DBConstants . ASCENDING ) ; keyArea . addKeyField ( KEY_NUMBER , DBConstants . ASCENDING ) ; } if ( keyArea == null ) keyArea = super . setupKey ( iKeyArea ) ; return keyArea ; |
public class ID3v1Genres { /** * Match provided description against genres , ignoring case .
* @ param description genre description
* @ return matching genre index or - 1 */
public static int matchGenreDescription ( String description ) { } } | if ( description != null && description . length ( ) > 0 ) { for ( int i = 0 ; i < ID3v1Genres . GENRES . length ; i ++ ) { if ( ID3v1Genres . GENRES [ i ] . equalsIgnoreCase ( description ) ) { return i ; } } } return - 1 ; |
public class AcceptQualificationRequestRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( AcceptQualificationRequestRequest acceptQualificationRequestRequest , ProtocolMarshaller protocolMarshaller ) { } } | if ( acceptQualificationRequestRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( acceptQualificationRequestRequest . getQualificationRequestId ( ) , QUALIFICATIONREQUESTID_BINDING ) ; protocolMarshaller . marshall ( acceptQualificationRequestRequest . getIntegerValue ( ) , INTEGERVALUE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class URLClassPath { /** * Get the URL protocol of given URL string .
* @ param urlString
* the URL string
* @ return the protocol name ( " http " , " file " , etc . ) , or null if there is no
* protocol */
public static String getURLProtocol ( String urlString ) { } } | String protocol = null ; int firstColon = urlString . indexOf ( ':' ) ; if ( firstColon >= 0 ) { String specifiedProtocol = urlString . substring ( 0 , firstColon ) ; if ( FindBugs . knownURLProtocolSet . contains ( specifiedProtocol ) ) { protocol = specifiedProtocol ; } } return protocol ; |
public class PyramidKltTracker { /** * Only sets the image pyramid . The derivatives are set to null . Only use this when tracking .
* @ param image Image pyramid */
public void setImage ( ImagePyramid < InputImage > image ) { } } | this . image = image ; this . derivX = null ; this . derivY = null ; |
public class EntitiesParseUtil { /** * / * package */
static HashtagEntity [ ] getHashtags ( JSONObject entities ) throws JSONException , TwitterException { } } | if ( ! entities . isNull ( "hashtags" ) ) { JSONArray hashtagsArray = entities . getJSONArray ( "hashtags" ) ; int len = hashtagsArray . length ( ) ; HashtagEntity [ ] hashtagEntities = new HashtagEntity [ len ] ; for ( int i = 0 ; i < len ; i ++ ) { hashtagEntities [ i ] = new HashtagEntityJSONImpl ( hashtagsArray . getJSONObject ( i ) ) ; } return hashtagEntities ; } else { return null ; } |
public class RestItemHandler { /** * Updates the properties at the path .
* If path points to a property , this method expects the request content to be either a JSON array or a JSON string . The array
* or string will become the values or value of the property . If path points to a node , this method expects the request
* content to be a JSON object . The keys of the objects correspond to property names that will be set and the values for the
* keys correspond to the values that will be set on the properties .
* @ param request the servlet request ; may not be null or unauthenticated
* @ param rawRepositoryName the URL - encoded repository name
* @ param rawWorkspaceName the URL - encoded workspace name
* @ param path the path to the item
* @ param requestContent the JSON - encoded representation of the values and , possibly , properties to be set
* @ return the JSON - encoded representation of the node on which the property or properties were set .
* @ throws JSONException if there is an error encoding the node
* @ throws RepositoryException if any error occurs at the repository level . */
public RestItem updateItem ( HttpServletRequest request , String rawRepositoryName , String rawWorkspaceName , String path , String requestContent ) throws JSONException , RepositoryException { } } | Session session = getSession ( request , rawRepositoryName , rawWorkspaceName ) ; Item item = itemAtPath ( path , session ) ; item = updateItem ( item , stringToJSONObject ( requestContent ) ) ; session . save ( ) ; return createRestItem ( request , 0 , session , item ) ; |
public class PhoneNumberUtil { /** * format phone number in E123 national format with cursor position handling .
* @ param pphoneNumber phone number as String to format with cursor position
* @ param pcountryCode iso code of country
* @ return formated phone number as String with new cursor position */
public final ValueWithPos < String > formatE123NationalWithPos ( final ValueWithPos < String > pphoneNumber , final String pcountryCode ) { } } | return valueWithPosDefaults ( this . formatE123NationalWithPos ( this . parsePhoneNumber ( pphoneNumber , pcountryCode ) ) , pphoneNumber ) ; |
public class XsdAsmVisitor { /** * Adds a specific method for a visitAttribute call .
* Example :
* void visitAttributeManifest ( String manifestValue ) {
* visitAttribute ( " manifest " , manifestValue ) ;
* @ param classWriter The ElementVisitor class { @ link ClassWriter } .
* @ param attribute The specific attribute . */
private static void addVisitorAttributeMethod ( ClassWriter classWriter , XsdAttribute attribute ) { } } | MethodVisitor mVisitor = classWriter . visitMethod ( ACC_PUBLIC , VISIT_ATTRIBUTE_NAME + getCleanName ( attribute . getName ( ) ) , "(" + JAVA_STRING_DESC + ")V" , null , null ) ; mVisitor . visitLocalVariable ( firstToLower ( getCleanName ( attribute . getName ( ) ) ) , JAVA_STRING_DESC , null , new Label ( ) , new Label ( ) , 1 ) ; mVisitor . visitCode ( ) ; mVisitor . visitVarInsn ( ALOAD , 0 ) ; mVisitor . visitLdcInsn ( attribute . getRawName ( ) ) ; mVisitor . visitVarInsn ( ALOAD , 1 ) ; mVisitor . visitMethodInsn ( INVOKEVIRTUAL , elementVisitorType , VISIT_ATTRIBUTE_NAME , "(" + JAVA_STRING_DESC + JAVA_STRING_DESC + ")V" , false ) ; mVisitor . visitInsn ( RETURN ) ; mVisitor . visitMaxs ( 3 , 2 ) ; mVisitor . visitEnd ( ) ; |
public class SFSUtilities { /** * Return the sfs geometry type identifier of the provided Geometry
* @ param geometry Geometry instance
* @ return The sfs geometry type identifier */
public static int getGeometryTypeFromGeometry ( Geometry geometry ) { } } | Integer sfsGeomCode = GEOM_TYPE_TO_SFS_CODE . get ( geometry . getGeometryType ( ) . toLowerCase ( ) ) ; if ( sfsGeomCode == null ) { return GeometryTypeCodes . GEOMETRY ; } else { return sfsGeomCode ; } |
public class ElmBaseVisitor { /** * Visit a FunctionRef . This method will be called for
* every node in the tree that is a FunctionRef .
* @ param elm the ELM tree
* @ param context the context passed to the visitor
* @ return the visitor result */
public T visitFunctionRef ( FunctionRef elm , C context ) { } } | for ( Expression element : elm . getOperand ( ) ) { visitElement ( element , context ) ; } return null ; |
public class DefaultViewMapper { /** * 查询control对应的view的名字 ( 没有后缀 )
* @ param className
* @ param methodName
* @ param viewName */
public String getViewPath ( String className , String methodName , String viewName ) { } } | if ( Strings . isNotEmpty ( viewName ) ) { if ( viewName . charAt ( 0 ) == Constants . separator ) { return viewName ; } } Profile profile = profileServie . getProfile ( className ) ; if ( null == profile ) { throw new RuntimeException ( "no convention profile for " + className ) ; } StringBuilder buf = new StringBuilder ( ) ; if ( profile . getViewPathStyle ( ) . equals ( Constants . FULL_VIEWPATH ) ) { buf . append ( Constants . separator ) ; buf . append ( profile . getFullPath ( className ) ) ; } else if ( profile . getViewPathStyle ( ) . equals ( Constants . SIMPLE_VIEWPATH ) ) { buf . append ( profile . getViewPath ( ) ) ; // 添加中缀路径
buf . append ( profile . getInfix ( className ) ) ; } else if ( profile . getViewPathStyle ( ) . equals ( Constants . SEO_VIEWPATH ) ) { buf . append ( profile . getViewPath ( ) ) ; buf . append ( Strings . unCamel ( profile . getInfix ( className ) ) ) ; } else { throw new RuntimeException ( profile . getViewPathStyle ( ) + " was not supported" ) ; } // add method mapping path
buf . append ( Constants . separator ) ; if ( Strings . isEmpty ( viewName ) || viewName . equals ( "success" ) ) { viewName = methodName ; } if ( null == methodViews . get ( viewName ) ) { buf . append ( viewName ) ; } else { buf . append ( methodViews . get ( viewName ) ) ; } return buf . toString ( ) ; |
public class MobileIDAuthenticator { /** * Checks whether login is already complete .
* < p > This is a non - blocking version of { @ link # waitForLogin ( MobileIDSession ) }
* @ param session previously returned by { @ link # startLogin }
* @ return true if login successful */
public boolean isLoginComplete ( MobileIDSession session ) { } } | StringHolder status = getLoginStatus ( session ) ; if ( "OUTSTANDING_TRANSACTION" . equals ( status . value ) ) return false ; else if ( "USER_AUTHENTICATED" . equals ( status . value ) ) return true ; else throw new AuthenticationException ( valueOf ( status . value ) ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.