signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class BufferNeeds { /** * This method considers the various factors of the specified output size * ( in blocks ) , and returns the highest factor that is less than the number * of available buffers . * @ param size * the size of the output file * @ param tx * the tx to execute * @ return the highest number less than the number of available buffers , * that is a factor of the plan ' s output size */ public static int bestFactor ( long size , Transaction tx ) { } }
int avail = tx . bufferMgr ( ) . available ( ) ; if ( avail <= 1 ) return 1 ; long k = size ; double i = 1.0 ; while ( k > avail ) { i ++ ; k = ( int ) Math . ceil ( size / i ) ; } return ( int ) k ;
public class CommerceVirtualOrderItemLocalServiceBaseImpl { /** * Returns a range of commerce virtual order items matching the UUID and company . * @ param uuid the UUID of the commerce virtual order items * @ param companyId the primary key of the company * @ param start the lower bound of the range of commerce virtual order items * @ param end the upper bound of the range of commerce virtual order items ( not inclusive ) * @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > ) * @ return the range of matching commerce virtual order items , or an empty list if no matches were found */ @ Override public List < CommerceVirtualOrderItem > getCommerceVirtualOrderItemsByUuidAndCompanyId ( String uuid , long companyId , int start , int end , OrderByComparator < CommerceVirtualOrderItem > orderByComparator ) { } }
return commerceVirtualOrderItemPersistence . findByUuid_C ( uuid , companyId , start , end , orderByComparator ) ;
public class AT_Row { /** * Sets the left padding for all cells in the row . * @ param paddingLeft new padding , ignored if smaller than 0 * @ return this to allow chaining */ public AT_Row setPaddingLeft ( int paddingLeft ) { } }
if ( this . hasCells ( ) ) { for ( AT_Cell cell : this . getCells ( ) ) { cell . getContext ( ) . setPaddingLeft ( paddingLeft ) ; } } return this ;
public class ErfcStddevWeight { /** * Return Erfc weight , scaled by standard deviation . max is ignored . */ @ Override public double getWeight ( double distance , double max , double stddev ) { } }
if ( stddev <= 0 ) { return 1 ; } return NormalDistribution . erfc ( MathUtil . SQRTHALF * distance / stddev ) ;
public class User { /** * Gets the { @ link User } object representing the supplied { @ link Authentication } or * { @ code null } if the supplied { @ link Authentication } is either anonymous or { @ code null } * @ param a the supplied { @ link Authentication } . * @ return a { @ link User } object for the supplied { @ link Authentication } or { @ code null } * @ since 1.609 */ public static @ CheckForNull User get ( @ CheckForNull Authentication a ) { } }
if ( a == null || a instanceof AnonymousAuthenticationToken ) return null ; // Since we already know this is a name , we can just call getOrCreateById with the name directly . return getById ( a . getName ( ) , true ) ;
public class RequestTools { /** * This method is used to get a serialized object into its equivalent JSON representation . * @ param object * { @ code Object } the body object . * @ param contentType * { @ ContentType } the content type header . * @ return { @ code String } */ String getBody ( Object object , ContentType contentType ) { } }
if ( contentType == ContentType . APPLICATION_FORM_URLENCODED ) { return jsonToUrlEncodedString ( ( JsonObject ) new JsonParser ( ) . parse ( gson . toJson ( object ) ) ) ; } return gson . toJson ( object ) ;
public class YUIErrorReporter { /** * Creates an EvaluatorException that will be thrown by Rhino . * @ param message * a String describing the error * @ param sourceName * a String describing the JavaScript source where the error * occured ; typically a filename or URL * @ param line * the line number associated with the error * @ param lineSource * the text of the line ( may be null ) * @ param lineOffset * the offset into lineSource where problem was detected * @ return an EvaluatorException that will be thrown . */ @ Override public EvaluatorException runtimeError ( String message , String sourceName , int line , String lineSource , int lineOffset ) { } }
StringBuilder errorMsg = new StringBuilder ( "YUI failed to minify the bundle with id: '" + status . getCurrentBundle ( ) . getId ( ) + "'.\n" ) ; errorMsg . append ( "YUI error message(s):[" ) . append ( this . yuiErrorMessage ) . append ( "]\n" ) ; errorMsg . append ( "The error happened at this point in your javascript: \n" ) ; errorMsg . append ( "_______________________________________________\n...\n" ) ; BufferedReader rd = new BufferedReader ( new StringReader ( bundleData . toString ( ) ) ) ; String s ; int totalLines = 0 ; int start = this . errorLine - 10 ; try { while ( ( s = rd . readLine ( ) ) != null ) { totalLines ++ ; if ( totalLines >= start && totalLines <= this . errorLine ) { errorMsg . append ( s ) ; if ( totalLines == this . errorLine ) errorMsg . append ( " <-- ERROR" ) ; errorMsg . append ( "\n" ) ; } } } catch ( IOException e ) { errorMsg . append ( "[Jawr suffered an IOException while attempting to show the faulty script]" ) ; } errorMsg . append ( "_______________________________________________" ) ; errorMsg . append ( "\nIf you can't find the error, try to check the scripts using JSLint (http://www.jslint.com/) to find the conflicting part of the code.\n" ) ; return new EvaluatorException ( errorMsg . toString ( ) , status . getCurrentBundle ( ) . getName ( ) , this . errorLine ) ;
public class AnnotationTypeFieldWriterImpl { /** * { @ inheritDoc } */ protected void addNavDetailLink ( boolean link , Content liNav ) { } }
if ( link ) { liNav . addContent ( writer . getHyperLink ( SectionName . ANNOTATION_TYPE_FIELD_DETAIL , contents . navField ) ) ; } else { liNav . addContent ( contents . navField ) ; }
public class ToolTipPopup { /** * Display this tool tip to the user */ public void show ( ) { } }
if ( mAnchorViewRef . get ( ) != null ) { mPopupContent = new PopupContentView ( mContext ) ; TextView body = ( TextView ) mPopupContent . findViewById ( R . id . com_facebook_tooltip_bubble_view_text_body ) ; body . setText ( mText ) ; if ( mStyle == Style . BLUE ) { mPopupContent . bodyFrame . setBackgroundResource ( R . drawable . com_facebook_tooltip_blue_background ) ; mPopupContent . bottomArrow . setImageResource ( R . drawable . com_facebook_tooltip_blue_bottomnub ) ; mPopupContent . topArrow . setImageResource ( R . drawable . com_facebook_tooltip_blue_topnub ) ; mPopupContent . xOut . setImageResource ( R . drawable . com_facebook_tooltip_blue_xout ) ; } else { mPopupContent . bodyFrame . setBackgroundResource ( R . drawable . com_facebook_tooltip_black_background ) ; mPopupContent . bottomArrow . setImageResource ( R . drawable . com_facebook_tooltip_black_bottomnub ) ; mPopupContent . topArrow . setImageResource ( R . drawable . com_facebook_tooltip_black_topnub ) ; mPopupContent . xOut . setImageResource ( R . drawable . com_facebook_tooltip_black_xout ) ; } final Window window = ( ( Activity ) mContext ) . getWindow ( ) ; final View decorView = window . getDecorView ( ) ; final int decorWidth = decorView . getWidth ( ) ; final int decorHeight = decorView . getHeight ( ) ; registerObserver ( ) ; mPopupContent . onMeasure ( View . MeasureSpec . makeMeasureSpec ( decorWidth , View . MeasureSpec . AT_MOST ) , View . MeasureSpec . makeMeasureSpec ( decorHeight , View . MeasureSpec . AT_MOST ) ) ; mPopupWindow = new PopupWindow ( mPopupContent , mPopupContent . getMeasuredWidth ( ) , mPopupContent . getMeasuredHeight ( ) ) ; mPopupWindow . showAsDropDown ( mAnchorViewRef . get ( ) ) ; updateArrows ( ) ; if ( mNuxDisplayTime > 0 ) { mPopupContent . postDelayed ( new Runnable ( ) { @ Override public void run ( ) { dismiss ( ) ; } } , mNuxDisplayTime ) ; } mPopupWindow . setTouchable ( true ) ; mPopupContent . setOnClickListener ( new View . OnClickListener ( ) { @ Override public void onClick ( View v ) { dismiss ( ) ; } } ) ; }
public class ContentSpecValidator { /** * Validate the Bug Links MetaData for a Content Specification . * @ param contentSpec The Content Spec to validate . * @ param strict If strict validation should be performed ( invalid matches throws an error instead of a warning ) * @ return True if the links are valid , otherwise false . */ public boolean postValidateBugLinks ( final ContentSpec contentSpec , boolean strict ) { } }
// If Bug Links are turned off then there isn ' t any need to validate them . if ( ! contentSpec . isInjectBugLinks ( ) ) { return true ; } try { final BugLinkOptions bugOptions ; final BugLinkType type ; if ( contentSpec . getBugLinks ( ) . equals ( BugLinkType . JIRA ) ) { type = BugLinkType . JIRA ; bugOptions = contentSpec . getJIRABugLinkOptions ( ) ; } else { type = BugLinkType . BUGZILLA ; bugOptions = contentSpec . getBugzillaBugLinkOptions ( ) ; } final BaseBugLinkStrategy bugLinkStrategy = BugLinkStrategyFactory . getInstance ( ) . create ( type , bugOptions . getBaseUrl ( ) ) ; // This step should have been performed by the preValidate method , so just make sure incase it hasn ' t been called . try { bugLinkStrategy . checkValidValues ( bugOptions ) ; } catch ( ValidationException e ) { return false ; } // Validate the content in the bug options against the external service using the appropriate bug link strategy try { bugLinkStrategy . validate ( bugOptions ) ; } catch ( ValidationException e ) { final Throwable cause = ExceptionUtilities . getRootCause ( e ) ; if ( strict ) { log . error ( cause . getMessage ( ) ) ; return false ; } else { log . warn ( cause . getMessage ( ) ) ; } } return true ; } catch ( Exception e ) { if ( e instanceof ConnectException || e instanceof MalformedURLException ) { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_CONNECT ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_CONNECT ) ; } } else if ( e . getCause ( ) instanceof ConnectionException ) { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUGZILLA_UNABLE_TO_CONNECT ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUGZILLA_UNABLE_TO_CONNECT ) ; } } else { if ( strict ) { log . error ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_VALIDATE ) ; log . error ( e . toString ( ) ) ; return false ; } else { log . warn ( ProcessorConstants . ERROR_BUG_LINKS_UNABLE_TO_VALIDATE ) ; log . warn ( e . toString ( ) ) ; } } } return true ;
public class ToStringStyle { /** * < p > Sets the content end text . < / p > * < p > < code > null < / code > is accepted , but will be converted to * an empty String . < / p > * @ param contentEnd the new content end text */ protected void setContentEnd ( String contentEnd ) { } }
if ( contentEnd == null ) { contentEnd = StringUtils . EMPTY ; } this . contentEnd = contentEnd ;
public class ManagedComponent { /** * Emits an alert for a caught Throwable through this manageable , entering the alert into a logger along the way . */ @ Override public < T extends Throwable > T emit ( T throwable , String message , long sequence , Logger logger ) { } }
message = message == null ? Throwables . getFullMessage ( throwable ) : message + ": " + Throwables . getFullMessage ( throwable ) ; emit ( Level . WARNING , message , sequence , logger ) ; return throwable ;
public class Matrix { /** * Validate the properties have the correct values . */ public final void postConstruct ( ) { } }
Assert . equals ( 2 , this . tileSize . length , "tileSize must have exactly 2 elements to the array. Was: " + Arrays . toString ( this . tileSize ) ) ; Assert . equals ( 2 , this . topLeftCorner . length , "topLeftCorner must have exactly 2 elements to the array. Was: " + Arrays . toString ( this . topLeftCorner ) ) ; Assert . equals ( 2 , this . matrixSize . length , "matrixSize must have exactly 2 elements to the array. Was: " + Arrays . toString ( this . matrixSize ) ) ;
public class ManagementClientImpl { /** * / * ( non - Javadoc ) * @ see tuwien . auto . calimero . mgmt . ManagementClient # writeAddress * ( byte [ ] , tuwien . auto . calimero . IndividualAddress ) */ public void writeAddress ( byte [ ] serialNo , IndividualAddress newAddress ) throws KNXTimeoutException , KNXLinkClosedException { } }
if ( serialNo . length != 6 ) throw new KNXIllegalArgumentException ( "length of serial number not 6 bytes" ) ; final byte [ ] asdu = new byte [ 12 ] ; for ( int i = 0 ; i < 6 ; ++ i ) asdu [ i ] = serialNo [ i ] ; asdu [ 6 ] = ( byte ) ( newAddress . getRawAddress ( ) >>> 8 ) ; asdu [ 7 ] = ( byte ) newAddress . getRawAddress ( ) ; tl . broadcast ( false , Priority . SYSTEM , DataUnitBuilder . createAPDU ( IND_ADDR_SN_WRITE , asdu ) ) ;
public class DateTimeExtensions { /** * Returns a { @ link java . time . LocalDateTime } of this time and the provided { @ link java . time . LocalDate } . * @ param self a LocalTime * @ param date a LocalDate * @ return a LocalDateTime * @ since 2.5.0 */ public static LocalDateTime leftShift ( final LocalTime self , LocalDate date ) { } }
return LocalDateTime . of ( date , self ) ;
public class KTypeHashSet { /** * Adds all elements from the given iterable to this set . * @ return Returns the number of elements actually added as a result of this * call ( not previously present in the set ) . */ public int addAll ( Iterable < ? extends KTypeCursor < ? extends KType > > iterable ) { } }
int count = 0 ; for ( KTypeCursor < ? extends KType > cursor : iterable ) { if ( add ( cursor . value ) ) { count ++ ; } } return count ;
public class CloudWatchDestination { /** * A list of dimensions upon which to categorize your emails when you publish email sending events to Amazon * CloudWatch . * @ return A list of dimensions upon which to categorize your emails when you publish email sending events to Amazon * CloudWatch . */ public java . util . List < CloudWatchDimensionConfiguration > getDimensionConfigurations ( ) { } }
if ( dimensionConfigurations == null ) { dimensionConfigurations = new com . amazonaws . internal . SdkInternalList < CloudWatchDimensionConfiguration > ( ) ; } return dimensionConfigurations ;
public class SSLChannel { /** * @ see com . ibm . wsspi . channelfw . Channel # start ( ) */ @ Override public void start ( ) throws ChannelException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "start" ) ; } stop0Called = false ; try { // If this is an inbound channel , we can pull out the listening host / port / endpointName . if ( getConfig ( ) . isInbound ( ) ) { // Get access to the ChainData object for future use . ChainData chainData = SSLChannelProvider . getCfw ( ) . getInternalRunningChains ( getConfig ( ) . getName ( ) ) [ 0 ] ; ChannelData channelData = chainData . getChannelList ( ) [ 0 ] ; Map < ? , ? > channelProperties = channelData . getPropertyBag ( ) ; this . inboundHost = ( String ) channelProperties . get ( "hostname" ) ; this . inboundPort = ( String ) channelProperties . get ( "port" ) ; // End point name will only ever get a value when running in was . Otherwise , null is fine . this . endPointName = ( String ) channelProperties . get ( "endPointName" ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "inboundHost = " + this . inboundHost + " inboundPort = " + this . inboundPort + " endPointName = " + this . endPointName ) ; } } } catch ( Exception e ) { // no FFDC required if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Caught exception during start, throwing up stack. " + e ) ; } throw new ChannelException ( e ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "start" ) ; }
public class ShardingEncryptorStrategy { /** * Get assisted query column count . * @ param logicTableName logic table name * @ return assisted query column count */ public Integer getAssistedQueryColumnCount ( final String logicTableName ) { } }
if ( Collections2 . filter ( columns , new Predicate < ColumnNode > ( ) { @ Override public boolean apply ( final ColumnNode input ) { return input . getTableName ( ) . equals ( logicTableName ) ; } } ) . isEmpty ( ) ) { return 0 ; } return Collections2 . filter ( assistedQueryColumns , new Predicate < ColumnNode > ( ) { @ Override public boolean apply ( final ColumnNode input ) { return input . getTableName ( ) . equals ( logicTableName ) ; } } ) . size ( ) ;
public class MSPDIReader { /** * This method extracts data for a normal working day from an MSPDI file . * @ param calendar Calendar data * @ param weekDay Day data */ private void readNormalDay ( ProjectCalendar calendar , Project . Calendars . Calendar . WeekDays . WeekDay weekDay ) { } }
int dayNumber = weekDay . getDayType ( ) . intValue ( ) ; Day day = Day . getInstance ( dayNumber ) ; calendar . setWorkingDay ( day , BooleanHelper . getBoolean ( weekDay . isDayWorking ( ) ) ) ; ProjectCalendarHours hours = calendar . addCalendarHours ( day ) ; Project . Calendars . Calendar . WeekDays . WeekDay . WorkingTimes times = weekDay . getWorkingTimes ( ) ; if ( times != null ) { for ( Project . Calendars . Calendar . WeekDays . WeekDay . WorkingTimes . WorkingTime period : times . getWorkingTime ( ) ) { Date startTime = period . getFromTime ( ) ; Date endTime = period . getToTime ( ) ; if ( startTime != null && endTime != null ) { if ( startTime . getTime ( ) >= endTime . getTime ( ) ) { endTime = DateHelper . addDays ( endTime , 1 ) ; } hours . addRange ( new DateRange ( startTime , endTime ) ) ; } } }
public class Drawable { /** * Set the DPI to use . Computed automatically depending of the baseline resolution and the current configuration . * Resources has to be suffixed with " _ DPI " before the extension . * For example , baseline resources is " image . png " , support for other DPI will need : * < ul > * < li > image _ ldpi . png - support for low resolution < / li > * < li > image _ mdpi . png - support for baseline resolution , same as image . png , not required < / li > * < li > image _ hdpi . png - support for high resolution < / li > * < li > image _ xhdpi . png - support for very high resolution < / li > * < / ul > * If there is not dedicated DPI resource , the baseline one will be use instead . * < b > Must be set after engine started , before resource loading . < / b > * @ param baseline The baseline resolution ( must not be < code > null < / code > ) . * @ param config The configuration used ( must not be < code > null < / code > ) . * @ throws LionEngineException If invalid arguments . */ public static void setDpi ( Resolution baseline , Config config ) { } }
Check . notNull ( baseline ) ; Check . notNull ( config ) ; setDpi ( DpiType . from ( baseline , config . getOutput ( ) ) ) ;
public class HiggsBosonDemo { /** * Overriding this to weed out the - 999.0 values in the dataset */ @ Override public void addToMap ( Map < String , String > properties , Map < String , List < Float > > rawHistogramData ) { } }
// System . out . println ( Arrays . toString ( properties . entrySet ( ) . toArray ( ) ) ) ; 0 for ( Entry < String , String > entrySet : properties . entrySet ( ) ) { String key = entrySet . getKey ( ) ; String value = entrySet . getValue ( ) ; try { Float floatValue = Float . parseFloat ( value ) ; if ( floatValue > - 900.0f ) { List < Float > rawDataForSingleProperty = rawHistogramData . get ( key ) ; if ( rawDataForSingleProperty == null ) { rawDataForSingleProperty = new ArrayList < Float > ( ) ; } rawDataForSingleProperty . add ( floatValue ) ; rawHistogramData . put ( key , rawDataForSingleProperty ) ; } } catch ( NumberFormatException e ) { // wasn ' t a float , skip . } }
public class CreateBranchRequest { /** * Tag for the branch . * @ param tags * Tag for the branch . * @ return Returns a reference to this object so that method calls can be chained together . */ public CreateBranchRequest withTags ( java . util . Map < String , String > tags ) { } }
setTags ( tags ) ; return this ;
public class Smb2NegotiateRequest { /** * { @ inheritDoc } * @ see jcifs . internal . smb2 . ServerMessageBlock2 # writeBytesWireFormat ( byte [ ] , int ) */ @ Override protected int writeBytesWireFormat ( byte [ ] dst , int dstIndex ) { } }
int start = dstIndex ; SMBUtil . writeInt2 ( 36 , dst , dstIndex ) ; SMBUtil . writeInt2 ( this . dialects . length , dst , dstIndex + 2 ) ; dstIndex += 4 ; SMBUtil . writeInt2 ( this . securityMode , dst , dstIndex ) ; SMBUtil . writeInt2 ( 0 , dst , dstIndex + 2 ) ; // Reserved dstIndex += 4 ; SMBUtil . writeInt4 ( this . capabilities , dst , dstIndex ) ; dstIndex += 4 ; System . arraycopy ( this . clientGuid , 0 , dst , dstIndex , 16 ) ; dstIndex += 16 ; // if SMB 3.11 support negotiateContextOffset / negotiateContextCount int negotitateContextOffsetOffset = 0 ; if ( this . negotiateContexts == null || this . negotiateContexts . length == 0 ) { SMBUtil . writeInt8 ( 0 , dst , dstIndex ) ; } else { negotitateContextOffsetOffset = dstIndex ; SMBUtil . writeInt2 ( this . negotiateContexts . length , dst , dstIndex + 4 ) ; SMBUtil . writeInt2 ( 0 , dst , dstIndex + 6 ) ; } dstIndex += 8 ; for ( int dialect : this . dialects ) { SMBUtil . writeInt2 ( dialect , dst , dstIndex ) ; dstIndex += 2 ; } dstIndex += pad8 ( dstIndex ) ; if ( this . negotiateContexts != null && this . negotiateContexts . length != 0 ) { SMBUtil . writeInt4 ( dstIndex - getHeaderStart ( ) , dst , negotitateContextOffsetOffset ) ; for ( NegotiateContextRequest nc : this . negotiateContexts ) { SMBUtil . writeInt2 ( nc . getContextType ( ) , dst , dstIndex ) ; int lenOffset = dstIndex + 2 ; dstIndex += 4 ; SMBUtil . writeInt4 ( 0 , dst , dstIndex ) ; dstIndex += 4 ; // Reserved int dataLen = size8 ( nc . encode ( dst , dstIndex ) ) ; SMBUtil . writeInt2 ( dataLen , dst , lenOffset ) ; dstIndex += dataLen ; } } return dstIndex - start ;
public class QueryBuilder { /** * Get the QAbstractValue for a value . * @ param _ value value the QAbstractValue is wanted for * @ return QAbstractValue * @ throws EFapsException on error */ private AbstractQValue getValue ( final Object _value ) throws EFapsException { } }
AbstractQValue ret = null ; if ( _value == null ) { ret = new QNullValue ( ) ; } else if ( _value instanceof Number ) { ret = new QNumberValue ( ( Number ) _value ) ; } else if ( _value instanceof String ) { ret = new QStringValue ( ( String ) _value ) ; } else if ( _value instanceof DateTime ) { ret = new QDateTimeValue ( ( DateTime ) _value ) ; } else if ( _value instanceof Boolean ) { ret = new QBooleanValue ( ( Boolean ) _value ) ; } else if ( _value instanceof Status ) { ret = new QNumberValue ( ( ( Status ) _value ) . getId ( ) ) ; } else if ( _value instanceof CIStatus ) { ret = new QNumberValue ( Status . find ( ( CIStatus ) _value ) . getId ( ) ) ; } else if ( _value instanceof Instance ) { if ( ! ( ( Instance ) _value ) . isValid ( ) ) { QueryBuilder . LOG . error ( "the given Instance was not valid and cannot be used as filter criteria" , _value ) ; throw new EFapsException ( QueryBuilder . class , "invalid Instance given" ) ; } ret = new QNumberValue ( ( ( Instance ) _value ) . getId ( ) ) ; } else if ( _value instanceof UoM ) { ret = new QNumberValue ( ( ( UoM ) _value ) . getId ( ) ) ; } else if ( _value instanceof IBitEnum ) { ret = new QBitValue ( ( IBitEnum ) _value ) ; } else if ( _value instanceof IEnum ) { ret = new QNumberValue ( ( ( IEnum ) _value ) . getInt ( ) ) ; } else if ( _value instanceof AbstractQValue ) { ret = ( AbstractQValue ) _value ; } else { throw new EFapsException ( QueryBuilder . class , "notsuported" ) ; } return ret ;
public class NodeImpl { /** * { @ inheritDoc } */ public void checkout ( ) throws RepositoryException , UnsupportedRepositoryOperationException { } }
checkValid ( ) ; if ( ! session . getAccessManager ( ) . hasPermission ( getACL ( ) , new String [ ] { PermissionType . SET_PROPERTY } , session . getUserState ( ) . getIdentity ( ) ) ) { throw new AccessDeniedException ( "Access denied: checkout operation " + getPath ( ) + " for: " + session . getUserID ( ) + " item owner " + getACL ( ) . getOwner ( ) ) ; } if ( ! this . isNodeType ( Constants . MIX_VERSIONABLE ) ) { throw new UnsupportedRepositoryOperationException ( "Node.checkout() is not supported for not mix:versionable node " ) ; } if ( ! checkLocking ( ) ) { throw new LockException ( "Node " + getPath ( ) + " is locked " ) ; } if ( checkedOut ( ) ) { return ; } SessionChangesLog changesLog = new SessionChangesLog ( session ) ; changesLog . add ( ItemState . createUpdatedState ( updatePropertyData ( Constants . JCR_ISCHECKEDOUT , new TransientValueData ( true ) ) ) ) ; ValueData baseVersion = ( ( PropertyData ) dataManager . getItemData ( nodeData ( ) , new QPathEntry ( Constants . JCR_BASEVERSION , 0 ) , ItemType . PROPERTY ) ) . getValues ( ) . get ( 0 ) ; changesLog . add ( ItemState . createUpdatedState ( updatePropertyData ( Constants . JCR_PREDECESSORS , baseVersion ) ) ) ; dataManager . getTransactManager ( ) . save ( changesLog ) ; session . getActionHandler ( ) . postCheckout ( this ) ;
public class MoleculeBuilder { /** * Builds the main chain which may act as a foundation for futher working groups . * @ param mainChain The parsed prefix which depicts the chain ' s length . * @ param isMainCyclic A flag to show if the molecule is a ring . 0 means not a ring , 1 means is a ring . * @ return A Molecule containing the requested chain . */ private IAtomContainer buildChain ( int length , boolean isMainCyclic ) { } }
IAtomContainer currentChain ; if ( length > 0 ) { // If is cyclic if ( isMainCyclic ) { // Rely on CDK ' s ring class constructor to generate our cyclic molecules . currentChain = currentMolecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; currentChain . add ( currentMolecule . getBuilder ( ) . newInstance ( IRing . class , length , "C" ) ) ; } // Else must not be cyclic else { currentChain = makeAlkane ( length ) ; } } else { currentChain = currentMolecule . getBuilder ( ) . newInstance ( IAtomContainer . class ) ; } return currentChain ;
public class ResponseCollector { /** * If you really must name the variable something other than ' serviceSummary ' , * you can override this method to retrieve its value . */ protected ServiceSummary getServiceSummary ( ) throws ActivityException { } }
ServiceSummary serviceSummary = ( ServiceSummary ) getVariableValue ( "serviceSummary" ) ; if ( serviceSummary == null ) throw new ActivityException ( "Missing variable: serviceSummary" ) ; return serviceSummary ;
public class DateTimePicker { /** * toStringPermissive , This returns a string representation of the values which are currently * stored in the date and time picker . If the last valid value of the date picker is null , then * this will return an empty string ( " " ) . If the last valid value of the time picker is null , * then that portion of the time will be replaced with LocalTime . MIDNIGHT . * Javadocs from LocalDateTime . toString ( ) : * Outputs this date - time as a { @ code String } , such as { @ code 2007-12-03T10:15:30 } . * The output will be one of the following ISO - 8601 formats : * < ul > * < li > { @ code uuuu - MM - dd ' T ' HH : mm } < / li > * < li > { @ code uuuu - MM - dd ' T ' HH : mm : ss } < / li > * < li > { @ code uuuu - MM - dd ' T ' HH : mm : ss . SSS } < / li > * < li > { @ code uuuu - MM - dd ' T ' HH : mm : ss . SSSSS } < / li > * < li > { @ code uuuu - MM - dd ' T ' HH : mm : ss . SSSSS } < / li > * < / ul > * The format used will be the shortest that outputs the full value of the time where the * omitted parts are implied to be zero . */ public String toStringPermissive ( ) { } }
LocalDateTime dateTime = getDateTimePermissive ( ) ; String text = ( dateTime == null ) ? "" : dateTime . toString ( ) ; return text ;
public class CnvIbnIntegerToCv { /** * < p > Put Integer object to ColumnsValues without transformation . < / p > * @ param pAddParam additional params , e . g . version algorithm or * bean source class for generic converter that consume set of subtypes . * @ param pFrom from a Integer object * @ param pTo to ColumnsValues * @ param pName by a name * @ throws Exception - an exception */ @ Override public final void convert ( final Map < String , Object > pAddParam , final Integer pFrom , final ColumnsValues pTo , final String pName ) throws Exception { } }
pTo . put ( pName , pFrom ) ;
public class PublicKeyEncryptor { /** * { @ inheritDoc } */ @ Override protected Cipher newCipher ( final PublicKey key , final String algorithm , final byte [ ] salt , final int iterationCount , final int operationMode ) throws NoSuchAlgorithmException , InvalidKeySpecException , NoSuchPaddingException , InvalidKeyException , InvalidAlgorithmParameterException , UnsupportedEncodingException { } }
final Cipher cipher = CipherFactory . newCipher ( algorithm ) ; cipher . init ( operationMode , key ) ; return cipher ;
public class AlluxioBlockStore { /** * Gets the total capacity of Alluxio ' s BlockStore . * @ return the capacity in bytes */ public long getCapacityBytes ( ) throws IOException { } }
try ( CloseableResource < BlockMasterClient > blockMasterClientResource = mContext . acquireBlockMasterClientResource ( ) ) { return blockMasterClientResource . get ( ) . getCapacityBytes ( ) ; }
public class SingletonTokenStream { /** * { @ inheritDoc } */ @ Override public void reset ( ) throws IOException { } }
consumed = false ; if ( termAttribute == null ) { termAttribute = addAttribute ( CharTermAttribute . class ) ; } if ( payloadAttribute == null ) { payloadAttribute = addAttribute ( PayloadAttribute . class ) ; }
public class Paging { /** * / * package */ List < HttpParameter > asPostParameterList ( char [ ] supportedParams , String perPageParamName ) { } }
java . util . List < HttpParameter > pagingParams = new ArrayList < HttpParameter > ( supportedParams . length ) ; addPostParameter ( supportedParams , 's' , pagingParams , "since_id" , getSinceId ( ) ) ; addPostParameter ( supportedParams , 'm' , pagingParams , "max_id" , getMaxId ( ) ) ; addPostParameter ( supportedParams , 'c' , pagingParams , perPageParamName , getCount ( ) ) ; addPostParameter ( supportedParams , 'p' , pagingParams , "page" , getPage ( ) ) ; if ( pagingParams . size ( ) == 0 ) { return NULL_PARAMETER_LIST ; } else { return pagingParams ; }
public class KriptonXmlContext { /** * / * ( non - Javadoc ) * @ see com . abubusoft . kripton . AbstractContext # createParser ( java . io . InputStream ) */ public XmlWrapperParser createParser ( InputStream inputStream ) { } }
try { return new XmlWrapperParser ( this , inputStream , getSupportedFormat ( ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new KriptonRuntimeException ( e ) ; }
public class VorbisStyleComments { /** * Returns all comments for a given tag , in * file order . Will return an empty list for * tags which aren ' t present . */ public List < String > getComments ( String tag ) { } }
List < String > c = comments . get ( normaliseTag ( tag ) ) ; if ( c == null ) { return new ArrayList < String > ( ) ; } else { return c ; }
public class RewriteGenderMsgsPass { /** * Helper to verify that a rewritten soy msg tree does not exceed the restriction on number of * total genders allowed ( 2 if includes plural , 3 otherwise ) . * @ param selectNode The select node to start searching from . * @ param depth The current depth of the select node . * @ return Whether the tree is valid . */ private boolean checkExceedsMaxGenders ( MsgSelectNode selectNode , int depth ) { } }
for ( int caseNum = 0 ; caseNum < selectNode . numChildren ( ) ; caseNum ++ ) { if ( selectNode . getChild ( caseNum ) . numChildren ( ) > 0 ) { StandaloneNode caseNodeChild = selectNode . getChild ( caseNum ) . getChild ( 0 ) ; // Plural cannot contain plurals or selects , so no need to recurse further . if ( caseNodeChild instanceof MsgPluralNode && depth >= 3 ) { errorReporter . report ( selectNode . getSourceLocation ( ) , MORE_THAN_TWO_GENDER_EXPRS_WITH_PLURAL ) ; return false ; } if ( caseNodeChild instanceof MsgSelectNode ) { if ( depth >= 3 ) { errorReporter . report ( selectNode . getSourceLocation ( ) , MORE_THAN_THREE_TOTAL_GENDERS ) ; return false ; } else { boolean validSubtree = checkExceedsMaxGenders ( ( MsgSelectNode ) caseNodeChild , depth + 1 ) ; if ( ! validSubtree ) { return false ; } } } } } return true ;
public class ActionResourceImpl { /** * Publishes an API to the gateway . * @ param action */ private void publishApi ( ActionBean action ) throws ActionException { } }
if ( ! securityContext . hasPermission ( PermissionType . apiAdmin , action . getOrganizationId ( ) ) ) throw ExceptionFactory . notAuthorizedException ( ) ; ApiVersionBean versionBean ; try { versionBean = orgs . getApiVersion ( action . getOrganizationId ( ) , action . getEntityId ( ) , action . getEntityVersion ( ) ) ; } catch ( ApiVersionNotFoundException e ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "ApiNotFound" ) ) ; // $ NON - NLS - 1 $ } // Validate that it ' s ok to perform this action - API must be Ready . if ( ! versionBean . isPublicAPI ( ) && versionBean . getStatus ( ) != ApiStatus . Ready ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "InvalidApiStatus" ) ) ; // $ NON - NLS - 1 $ } if ( versionBean . isPublicAPI ( ) ) { if ( versionBean . getStatus ( ) == ApiStatus . Retired || versionBean . getStatus ( ) == ApiStatus . Created ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "InvalidApiStatus" ) ) ; // $ NON - NLS - 1 $ } if ( versionBean . getStatus ( ) == ApiStatus . Published ) { Date modOn = versionBean . getModifiedOn ( ) ; Date publishedOn = versionBean . getPublishedOn ( ) ; int c = modOn . compareTo ( publishedOn ) ; if ( c <= 0 ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "ApiRePublishNotRequired" ) ) ; // $ NON - NLS - 1 $ } } } Api gatewayApi = new Api ( ) ; gatewayApi . setEndpoint ( versionBean . getEndpoint ( ) ) ; gatewayApi . setEndpointType ( versionBean . getEndpointType ( ) . toString ( ) ) ; if ( versionBean . getEndpointContentType ( ) != null ) { gatewayApi . setEndpointContentType ( versionBean . getEndpointContentType ( ) . toString ( ) ) ; } gatewayApi . setEndpointProperties ( versionBean . getEndpointProperties ( ) ) ; gatewayApi . setOrganizationId ( versionBean . getApi ( ) . getOrganization ( ) . getId ( ) ) ; gatewayApi . setApiId ( versionBean . getApi ( ) . getId ( ) ) ; gatewayApi . setVersion ( versionBean . getVersion ( ) ) ; gatewayApi . setPublicAPI ( versionBean . isPublicAPI ( ) ) ; gatewayApi . setParsePayload ( versionBean . isParsePayload ( ) ) ; boolean hasTx = false ; try { if ( versionBean . isPublicAPI ( ) ) { List < Policy > policiesToPublish = new ArrayList < > ( ) ; List < PolicySummaryBean > apiPolicies = query . getPolicies ( action . getOrganizationId ( ) , action . getEntityId ( ) , action . getEntityVersion ( ) , PolicyType . Api ) ; storage . beginTx ( ) ; hasTx = true ; for ( PolicySummaryBean policySummaryBean : apiPolicies ) { PolicyBean apiPolicy = storage . getPolicy ( PolicyType . Api , action . getOrganizationId ( ) , action . getEntityId ( ) , action . getEntityVersion ( ) , policySummaryBean . getId ( ) ) ; Policy policyToPublish = new Policy ( ) ; policyToPublish . setPolicyJsonConfig ( apiPolicy . getConfiguration ( ) ) ; policyToPublish . setPolicyImpl ( apiPolicy . getDefinition ( ) . getPolicyImpl ( ) ) ; policiesToPublish . add ( policyToPublish ) ; } gatewayApi . setApiPolicies ( policiesToPublish ) ; } } catch ( StorageException e ) { throw ExceptionFactory . actionException ( Messages . i18n . format ( "PublishError" ) , e ) ; // $ NON - NLS - 1 $ } finally { if ( hasTx ) { storage . rollbackTx ( ) ; } } // Publish the API to all relevant gateways try { storage . beginTx ( ) ; Set < ApiGatewayBean > gateways = versionBean . getGateways ( ) ; if ( gateways == null ) { throw new PublishingException ( "No gateways specified for API!" ) ; // $ NON - NLS - 1 $ } for ( ApiGatewayBean apiGatewayBean : gateways ) { IGatewayLink gatewayLink = createGatewayLink ( apiGatewayBean . getGatewayId ( ) ) ; gatewayLink . publishApi ( gatewayApi ) ; gatewayLink . close ( ) ; } versionBean . setStatus ( ApiStatus . Published ) ; versionBean . setPublishedOn ( new Date ( ) ) ; ApiBean api = storage . getApi ( action . getOrganizationId ( ) , action . getEntityId ( ) ) ; if ( api == null ) { throw new PublishingException ( "Error: could not find API - " + action . getOrganizationId ( ) + "=>" + action . getEntityId ( ) ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ } if ( api . getNumPublished ( ) == null ) { api . setNumPublished ( 1 ) ; } else { api . setNumPublished ( api . getNumPublished ( ) + 1 ) ; } storage . updateApi ( api ) ; storage . updateApiVersion ( versionBean ) ; storage . createAuditEntry ( AuditUtils . apiPublished ( versionBean , securityContext ) ) ; storage . commitTx ( ) ; } catch ( PublishingException e ) { storage . rollbackTx ( ) ; throw ExceptionFactory . actionException ( Messages . i18n . format ( "PublishError" ) , e ) ; // $ NON - NLS - 1 $ } catch ( Exception e ) { storage . rollbackTx ( ) ; throw ExceptionFactory . actionException ( Messages . i18n . format ( "PublishError" ) , e ) ; // $ NON - NLS - 1 $ } log . debug ( String . format ( "Successfully published API %s on specified gateways: %s" , // $ NON - NLS - 1 $ versionBean . getApi ( ) . getName ( ) , versionBean . getApi ( ) ) ) ;
public class RedisCache { /** * 获得byte [ ] 型的key * @ param key * @ return */ private byte [ ] getByteKey ( K key ) { } }
if ( key instanceof String ) { String preKey = this . keyPrefix + key ; return preKey . getBytes ( ) ; } else { return SerializeUtils . serialize ( key ) ; }
public class DeleteJobExecutionRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( DeleteJobExecutionRequest deleteJobExecutionRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( deleteJobExecutionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteJobExecutionRequest . getJobId ( ) , JOBID_BINDING ) ; protocolMarshaller . marshall ( deleteJobExecutionRequest . getThingName ( ) , THINGNAME_BINDING ) ; protocolMarshaller . marshall ( deleteJobExecutionRequest . getExecutionNumber ( ) , EXECUTIONNUMBER_BINDING ) ; protocolMarshaller . marshall ( deleteJobExecutionRequest . getForce ( ) , FORCE_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Page { /** * Add content to a named sections . If the named section cannot . * be found , the content is added to the page . */ public void addTo ( String section , Object element ) { } }
Composite s = ( Composite ) sections . get ( section ) ; if ( s == null ) add ( element ) ; else s . add ( element ) ;
public class LdapConfiguration { /** * Add an authentication filter that requires a certain LDAP role to access secured paths . * All routes starting with the value of the { @ code edison . ldap . prefixes } property will be secured by LDAP . * If no property is set this will default to all routes starting with ' / internal ' . * @ param ldapProperties the properties used to configure LDAP * @ return FilterRegistrationBean */ @ Bean @ ConditionalOnProperty ( prefix = "edison.ldap" , name = "required-role" ) public FilterRegistrationBean < LdapRoleAuthenticationFilter > ldapRoleAuthenticationFilter ( final LdapProperties ldapProperties ) { } }
FilterRegistrationBean < LdapRoleAuthenticationFilter > filterRegistration = new FilterRegistrationBean < > ( ) ; filterRegistration . setFilter ( new LdapRoleAuthenticationFilter ( ldapProperties ) ) ; filterRegistration . setOrder ( Ordered . LOWEST_PRECEDENCE ) ; ldapProperties . getPrefixes ( ) . forEach ( prefix -> filterRegistration . addUrlPatterns ( String . format ( "%s/*" , prefix ) ) ) ; return filterRegistration ;
public class AssessmentTemplate { /** * The rules packages that are specified for this assessment template . * @ param rulesPackageArns * The rules packages that are specified for this assessment template . */ public void setRulesPackageArns ( java . util . Collection < String > rulesPackageArns ) { } }
if ( rulesPackageArns == null ) { this . rulesPackageArns = null ; return ; } this . rulesPackageArns = new java . util . ArrayList < String > ( rulesPackageArns ) ;
public class ElevationApi { /** * Retrieves the elevation of a single location . * @ param context The { @ link GeoApiContext } to make requests through . * @ param location The location to retrieve the elevation for . * @ return The elevation as a { @ link PendingResult } . */ public static PendingResult < ElevationResult > getByPoint ( GeoApiContext context , LatLng location ) { } }
return context . get ( API_CONFIG , SingularResponse . class , "locations" , location . toString ( ) ) ;
public class ChannelFrameworkImpl { /** * @ see com . ibm . wsspi . channelfw . ChannelFramework # startChain ( String ) */ @ Override public synchronized void startChain ( String chainName ) throws ChannelException , ChainException { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "startChain: " + chainName ) ; } if ( null == chainName ) { throw new InvalidChainNameException ( "Null chain name" ) ; } // Get the chain configuration ChainData chainData = this . chainDataMap . get ( chainName ) ; if ( null == chainData ) { InvalidChainNameException e = new InvalidChainNameException ( "Nonexistent chain configuration" ) ; throw e ; } // Ensure we have an inbound chain . if ( FlowType . OUTBOUND . equals ( chainData . getType ( ) ) ) { throw new InvalidChainNameException ( "Outbound chain cannot use this interface." ) ; } startChainInternal ( chainData ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startChain" ) ; }
public class WorkWrapper { /** * Calls listener if setup failed * @ param listener work context listener */ private void fireWorkContextSetupFailed ( Object workContext ) { } }
if ( workContext != null && workContext instanceof WorkContextLifecycleListener ) { if ( trace ) log . tracef ( "WorkContextSetupFailed(%s) for %s" , workContext , this ) ; WorkContextLifecycleListener listener = ( WorkContextLifecycleListener ) workContext ; listener . contextSetupFailed ( WorkContextErrorCodes . CONTEXT_SETUP_FAILED ) ; }
public class SSLWriteServiceContext { /** * Check the status of the buffers set by the caller taking into account * the JITAllocation size if the buffers are null or verifying there is * space available in the the buffers based on the size of data requested . * @ param numBytes * @ param async * @ return IOException if an inconsistency / error is found in the request , * null otherwise . */ private IOException checkForErrors ( long numBytes , boolean async ) { } }
IOException exception = null ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "checkForErrors: numBytes=" + numBytes + " buffers=" + SSLUtils . getBufferTraceInfo ( getBuffers ( ) ) ) ; } // Extract the buffers provided by the calling channel . WsByteBuffer callerBuffers [ ] = getBuffers ( ) ; if ( callerBuffers == null || callerBuffers . length == 0 ) { exception = new IOException ( "No buffer(s) provided for writing data." ) ; } else if ( ( numBytes < - 1 ) || ( numBytes == 0 ) && ( async ) ) { // NumBytes requested must be - 1 ( write all ) or positive exception = new IOException ( "Number of bytes requested, " + numBytes + " is not valid." ) ; } else { // Ensure buffer provided by caller is big enough to contain the number of bytes requested . int bytesAvail = WsByteBufferUtils . lengthOf ( callerBuffers ) ; if ( bytesAvail < numBytes ) { exception = new IOException ( "Number of bytes requested, " + numBytes + " exceeds space remaining in the buffers provided: " + bytesAvail ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) && exception != null ) { Tr . debug ( tc , "Found error, exception generated: " + exception ) ; } return exception ;
public class DatabaseManager { /** * loosecannon1 @ users 1.7.2 patch properties on the JDBC URL */ private static synchronized Database getDatabaseObject ( String type , String path , HsqlProperties props ) { } }
Database db ; String key = path ; // A VoltDB extension to work around ENG - 6044 /* disable 13 lines . . . HashMap databaseMap ; if ( type = = DatabaseURL . S _ FILE ) { databaseMap = fileDatabaseMap ; key = filePathToKey ( path ) ; } else if ( type = = DatabaseURL . S _ RES ) { databaseMap = resDatabaseMap ; } else if ( type = = DatabaseURL . S _ MEM ) { databaseMap = memDatabaseMap ; } else { throw Error . runtimeError ( ErrorCode . U _ S0500, " DatabaseManager . getDatabaseObject " ) ; . . . disabled 13 lines */ assert ( type == DatabaseURL . S_MEM ) ; java . util . HashMap < String , Database > databaseMap = memDatabaseMap ; // End of VoltDB extension db = ( Database ) databaseMap . get ( key ) ; if ( db == null ) { db = new Database ( type , path , type + key , props ) ; db . databaseID = dbIDCounter ; databaseIDMap . put ( dbIDCounter , db ) ; dbIDCounter ++ ; databaseMap . put ( key , db ) ; } return db ;
public class JCusparse { /** * Description : Wrapper that sorts sparse matrix stored in CSR format * ( without exposing the permutation ) . */ public static int cusparseScsru2csr_bufferSizeExt ( cusparseHandle handle , int m , int n , int nnz , Pointer csrVal , Pointer csrRowPtr , Pointer csrColInd , csru2csrInfo info , long [ ] pBufferSizeInBytes ) { } }
return checkResult ( cusparseScsru2csr_bufferSizeExtNative ( handle , m , n , nnz , csrVal , csrRowPtr , csrColInd , info , pBufferSizeInBytes ) ) ;
public class LogFileHandle { /** * Get a new WritableLogRecord for the log file managed by this LogFileHandleInstance . * The size of the record must be specified along with the record ' s sequence number . * It is the caller ' s responsbility to ensure that both the sequence number is correct * and that the record written using the returned WritableLogRecord is of the given * length . * @ param recordLength The length of the record to be created * @ param sequenceNumber The newly created record ' s sequence number * @ return WriteableLogRecord A new writeable log record of the specified size */ public WriteableLogRecord getWriteableLogRecord ( int recordLength , long sequenceNumber ) throws InternalLogException { } }
if ( ! _headerFlushedFollowingRestart ) { // ensure header is updated now we start to write records for the first time // synchronization is assured through locks in LogHandle . getWriteableLogRecord writeFileHeader ( true ) ; _headerFlushedFollowingRestart = true ; } if ( tc . isEntryEnabled ( ) ) Tr . entry ( tc , "getWriteableLogRecord" , new Object [ ] { new Integer ( recordLength ) , new Long ( sequenceNumber ) , this } ) ; // Create a slice of the file buffer and reset its limit to the size of the WriteableLogRecord . // The view buffer ' s content is a shared subsequence of the file buffer . // No other log records have access to this log record ' s view buffer . ByteBuffer viewBuffer = ( ByteBuffer ) _fileBuffer . slice ( ) . limit ( recordLength + WriteableLogRecord . HEADER_SIZE ) ; WriteableLogRecord writeableLogRecord = new WriteableLogRecord ( viewBuffer , sequenceNumber , recordLength , _fileBuffer . position ( ) ) ; // Advance the file buffer ' s position to the end of the newly created WriteableLogRecord _fileBuffer . position ( _fileBuffer . position ( ) + recordLength + WriteableLogRecord . HEADER_SIZE ) ; _outstandingWritableLogRecords . incrementAndGet ( ) ; if ( tc . isEntryEnabled ( ) ) Tr . exit ( tc , "getWriteableLogRecord" , writeableLogRecord ) ; return writeableLogRecord ;
public class CmsPreviewDialog { /** * Generates the dialog caption . < p > * @ param previewInfo the preview info * @ return the caption */ private static String generateCaption ( CmsPreviewInfo previewInfo ) { } }
return ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( previewInfo . getTitle ( ) ) ? previewInfo . getTitle ( ) + " / " : "" ) + previewInfo . getSitePath ( ) ;
public class HttpResourceConnection { /** * Retrieves the resource identified by the given URL and returns the * InputStream . * @ param url the URL of the resource to download * @ return the stream to read the retrieved content from * @ throws org . owasp . dependencycheck . utils . DownloadFailedException is thrown * if there is an error downloading the resource */ public InputStream fetch ( URL url ) throws DownloadFailedException { } }
if ( "file" . equalsIgnoreCase ( url . getProtocol ( ) ) ) { final File file ; try { file = new File ( url . toURI ( ) ) ; } catch ( URISyntaxException ex ) { final String msg = format ( "Download failed, unable to locate '%s'" , url . toString ( ) ) ; throw new DownloadFailedException ( msg ) ; } if ( file . exists ( ) ) { try { return new FileInputStream ( file ) ; } catch ( IOException ex ) { final String msg = format ( "Download failed, unable to rerieve '%s'" , url . toString ( ) ) ; throw new DownloadFailedException ( msg , ex ) ; } } else { final String msg = format ( "Download failed, file ('%s') does not exist" , url . toString ( ) ) ; throw new DownloadFailedException ( msg ) ; } } else { if ( connection != null ) { LOGGER . warn ( "HTTP URL Connection was not properly closed" ) ; connection . disconnect ( ) ; connection = null ; } connection = obtainConnection ( url ) ; final String encoding = connection . getContentEncoding ( ) ; try { if ( encoding != null && "gzip" . equalsIgnoreCase ( encoding ) ) { return new GZIPInputStream ( connection . getInputStream ( ) ) ; } else if ( encoding != null && "deflate" . equalsIgnoreCase ( encoding ) ) { return new InflaterInputStream ( connection . getInputStream ( ) ) ; } else { return connection . getInputStream ( ) ; } } catch ( IOException ex ) { checkForCommonExceptionTypes ( ex ) ; final String msg = format ( "Error retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n" , url . toString ( ) , connection . getConnectTimeout ( ) , encoding ) ; throw new DownloadFailedException ( msg , ex ) ; } catch ( Exception ex ) { final String msg = format ( "Unexpected exception retrieving '%s'%nConnection Timeout: %d%nEncoding: %s%n" , url . toString ( ) , connection . getConnectTimeout ( ) , encoding ) ; throw new DownloadFailedException ( msg , ex ) ; } }
public class TagFileScanVisitor { /** * new method for jsp2.1ELwork */ private String checkConflict ( Element elem , String oldAttrValue , String attr ) throws JspCoreException { } }
String result = oldAttrValue ; String attrValue = null ; if ( elem . getAttributeNode ( attr ) != null ) { attrValue = elem . getAttributeNode ( attr ) . getValue ( ) ; } if ( attrValue != null ) { if ( oldAttrValue != null && ! oldAttrValue . equals ( attrValue ) ) { throw new JspTranslationException ( elem , "jsp.error.tag.conflict.attr" , new Object [ ] { attr , oldAttrValue , attrValue } ) ; } result = attrValue ; } return result ;
public class XSLTElementDef { /** * Tell if two objects are equal , when either one may be null . * If both are null , they are considered equal . * @ param obj1 A reference to the first object , or null . * @ param obj2 A reference to the second object , or null . * @ return true if the to objects are equal by both being null or * because obj2 . equals ( obj1 ) returns true . */ private static boolean equalsMayBeNull ( Object obj1 , Object obj2 ) { } }
return ( obj2 == obj1 ) || ( ( null != obj1 ) && ( null != obj2 ) && obj2 . equals ( obj1 ) ) ;
public class RtedAlgorithm { /** * Returns j for given i , result of j ( i ) form Demaine ' s algorithm . * @ param it * @ param aI * @ param aSubtreeWeight * @ param aSubtreeRevPre * @ param aSubtreePre * @ param aStrategy * @ param treeSize * @ return j for given i */ private int jOfI ( InfoTree it , int aI , int aSubtreeWeight , int aSubtreeRevPre , int aSubtreePre , int aStrategy , int treeSize ) { } }
return aStrategy == LEFT ? aSubtreeWeight - aI - it . info [ POST2_SIZE ] [ treeSize - 1 - ( aSubtreeRevPre + aI ) ] : aSubtreeWeight - aI - it . info [ POST2_SIZE ] [ it . info [ RPOST2_POST ] [ treeSize - 1 - ( aSubtreePre + aI ) ] ] ;
public class Attribute { /** * Set an attribute in the COSE object . * Setting an attribute in one map will remove it from all other maps as a side effect . * @ param label CBOR object which identifies the attribute in the map * @ param value CBOR object which contains the value of the attribute * @ param where Identifies which of the buckets to place the attribute in . * ProtectedAttributes - attributes cryptographically protected * UnprotectedAttributes - attributes not cryptographically protected * DontSendAttributes - attributes used locally and not transmitted * @ exception CoseException COSE Package exception */ public void addAttribute ( CBORObject label , CBORObject value , int where ) throws CoseException { } }
removeAttribute ( label ) ; if ( ( label . getType ( ) != CBORType . Number ) && ( label . getType ( ) != CBORType . TextString ) ) { throw new CoseException ( "Labels must be integers or strings" ) ; } switch ( where ) { case PROTECTED : if ( rgbProtected != null ) throw new CoseException ( "Cannot modify protected attribute if signature has been computed" ) ; objProtected . Add ( label , value ) ; break ; case UNPROTECTED : objUnprotected . Add ( label , value ) ; break ; case DO_NOT_SEND : objDontSend . Add ( label , value ) ; break ; default : throw new CoseException ( "Invalid attribute location given" ) ; }
public class RetrieveEnvironmentInfoResult { /** * The < a > EnvironmentInfoDescription < / a > of the environment . * < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use * { @ link # setEnvironmentInfo ( java . util . Collection ) } or { @ link # withEnvironmentInfo ( java . util . Collection ) } if you * want to override the existing values . * @ param environmentInfo * The < a > EnvironmentInfoDescription < / a > of the environment . * @ return Returns a reference to this object so that method calls can be chained together . */ public RetrieveEnvironmentInfoResult withEnvironmentInfo ( EnvironmentInfoDescription ... environmentInfo ) { } }
if ( this . environmentInfo == null ) { setEnvironmentInfo ( new com . amazonaws . internal . SdkInternalList < EnvironmentInfoDescription > ( environmentInfo . length ) ) ; } for ( EnvironmentInfoDescription ele : environmentInfo ) { this . environmentInfo . add ( ele ) ; } return this ;
public class PropositionUtil { /** * Filters a list of temporal propositions by time . * @ param params * a < code > List < / code > of propositions . * @ param minValid * @ param maxValid * @ return */ public static < T extends TemporalProposition > List < T > getView ( List < T > params , Long minValid , Long maxValid ) { } }
if ( params != null ) { if ( minValid == null && maxValid == null ) { return params ; } else { int min = minValid != null ? binarySearchMinStart ( params , minValid . longValue ( ) ) : 0 ; int max = maxValid != null ? binarySearchMaxFinish ( params , maxValid . longValue ( ) ) : params . size ( ) ; return params . subList ( min , max ) ; } } else { return null ; }
public class FileUtils { /** * Get a hash for a supplied file . * @ param aFile A file to get a hash for * @ param aAlgorithm A hash algorithm supported by < code > MessageDigest < / code > * @ return A hash string * @ throws NoSuchAlgorithmException If the supplied algorithm isn ' t supported * @ throws IOException If there is trouble reading the file */ public static String hash ( final File aFile , final String aAlgorithm ) throws NoSuchAlgorithmException , IOException { } }
final MessageDigest md = MessageDigest . getInstance ( aAlgorithm ) ; final FileInputStream inStream = new FileInputStream ( aFile ) ; final DigestInputStream mdStream = new DigestInputStream ( inStream , md ) ; final byte [ ] bytes = new byte [ 8192 ] ; int bytesRead = 0 ; while ( bytesRead != - 1 ) { bytesRead = mdStream . read ( bytes ) ; } final Formatter formatter = new Formatter ( ) ; for ( final byte bite : md . digest ( ) ) { formatter . format ( "%02x" , bite ) ; } IOUtils . closeQuietly ( mdStream ) ; final String hash = formatter . toString ( ) ; formatter . close ( ) ; return hash ;
public class DefaultManagedConnectionPool { /** * { @ inheritDoc } */ public synchronized void shutdown ( ) { } }
if ( pool . getConfiguration ( ) . isBackgroundValidation ( ) && pool . getConfiguration ( ) . getBackgroundValidationMillis ( ) > 0 ) { ConnectionValidator . getInstance ( ) . unregisterPool ( this ) ; } if ( pool . getConfiguration ( ) . getIdleTimeoutMinutes ( ) > 0 ) { IdleConnectionRemover . getInstance ( ) . unregisterPool ( this ) ; } for ( ConnectionListener cl : listeners ) { if ( cl . getState ( ) == IN_USE ) { // TODO } else if ( cl . getState ( ) == DESTROY ) { // TODO } try { if ( Tracer . isEnabled ( ) ) Tracer . clearConnectionListener ( pool . getConfiguration ( ) . getId ( ) , this , cl ) ; pool . destroyConnectionListener ( cl ) ; } catch ( ResourceException re ) { // TODO cl . setState ( ZOMBIE ) ; } } listeners . clear ( ) ;
public class BaseApplet { /** * Set the help pane . * @ return the help pane . */ public void setHelpView ( JBaseHtmlEditor helpEditor ) { } }
if ( m_helpEditor != null ) m_helpEditor . setCallingApplet ( null ) ; m_helpEditor = helpEditor ; if ( m_helpEditor != null ) m_helpEditor . setCallingApplet ( this ) ;
public class Track { /** * Register webhook for tracking shipment of a package . This corresponds to * API defined in https : / / goshippo . com / docs / reference # tracks - create . Please * note that the webhook where information will be posted need to be already * provided in https : / / app . goshippo . com * @ param carrier * Name of the carrier ( like " usps " ) tracking the packing * @ param trackingNumber * Tracking number provided by the carrier for a package * @ param metadata * Generic information related to this tracking * @ return Track object containing tracking info */ public static Track registerTrackingWebhook ( String carrier , String trackingNumber , String metadata , String apiKey ) throws AuthenticationException , InvalidRequestException , APIConnectionException , APIException { } }
Map < String , Object > params = new HashMap < String , Object > ( ) ; params . put ( "carrier" , carrier ) ; params . put ( "tracking_number" , trackingNumber ) ; params . put ( "metadata" , metadata ) ; return request ( RequestMethod . POST , classURLWithTrailingSlash ( Track . class ) , params , Track . class , apiKey ) ;
public class VoiceApi { /** * Reconnect the specified call . This releases the established call and retrieves the held call * in one step . This is a quick way to to do ` releaseCall ( ) ` and ` retrieveCall ( ) ` . * @ param connId The connection ID of the established call ( will be released ) . * @ param heldConnId The ID of the held call ( will be retrieved ) . * @ param reasons Information on causes for , and results of , actions taken by the user of the current DN . For details about reasons , refer to the [ * Genesys Events and Models Reference Manual * ] ( https : / / docs . genesys . com / Documentation / System / Current / GenEM / Reasons ) . ( optional ) * @ param extensions Media device / hardware reason codes and similar information . For details about extensions , refer to the [ * Genesys Events and Models Reference Manual * ] ( https : / / docs . genesys . com / Documentation / System / Current / GenEM / Extensions ) . ( optional ) */ public void reconnectCall ( String connId , String heldConnId , KeyValueCollection reasons , KeyValueCollection extensions ) throws WorkspaceApiException { } }
try { VoicecallsidreconnectData reconnectData = new VoicecallsidreconnectData ( ) ; reconnectData . setHeldConnId ( heldConnId ) ; reconnectData . setReasons ( Util . toKVList ( reasons ) ) ; reconnectData . setExtensions ( Util . toKVList ( extensions ) ) ; ReconnectData data = new ReconnectData ( ) ; data . data ( reconnectData ) ; ApiSuccessResponse response = this . voiceApi . reconnect ( connId , data ) ; throwIfNotOk ( "reconnectCall" , response ) ; } catch ( ApiException e ) { throw new WorkspaceApiException ( "reconnectCall failed." , e ) ; }
public class EventFilterMarshaller { /** * Marshall the given parameter object . */ public void marshall ( EventFilter eventFilter , ProtocolMarshaller protocolMarshaller ) { } }
if ( eventFilter == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( eventFilter . getEventArns ( ) , EVENTARNS_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEventTypeCodes ( ) , EVENTTYPECODES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getServices ( ) , SERVICES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getRegions ( ) , REGIONS_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getAvailabilityZones ( ) , AVAILABILITYZONES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getStartTimes ( ) , STARTTIMES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEndTimes ( ) , ENDTIMES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getLastUpdatedTimes ( ) , LASTUPDATEDTIMES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEntityArns ( ) , ENTITYARNS_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEntityValues ( ) , ENTITYVALUES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEventTypeCategories ( ) , EVENTTYPECATEGORIES_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getTags ( ) , TAGS_BINDING ) ; protocolMarshaller . marshall ( eventFilter . getEventStatusCodes ( ) , EVENTSTATUSCODES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class DrawerView { /** * Removes a fixed item from the drawer view * @ param id ID to remove */ public DrawerView removeFixedItemById ( long id ) { } }
for ( DrawerItem item : mAdapterFixed . getItems ( ) ) { if ( item . getId ( ) == id ) { mAdapterFixed . remove ( item ) ; updateFixedList ( ) ; return this ; } } return this ;
public class PaymentKit { /** * HmacSHA256 签名 * @ param stringSignTemp * @ param partnerKey * @ return * @ throws Exception */ public static String hmacSHA256 ( String stringSignTemp , String partnerKey ) throws UnsupportedEncodingException , NoSuchAlgorithmException , InvalidKeyException { } }
Mac sha256_HMAC = Mac . getInstance ( "HmacSHA256" ) ; SecretKeySpec secret_key = new SecretKeySpec ( partnerKey . getBytes ( ) , "HmacSHA256" ) ; sha256_HMAC . init ( secret_key ) ; return byteArrayToHexString ( sha256_HMAC . doFinal ( stringSignTemp . getBytes ( "utf-8" ) ) ) ;
public class SqlLineHighlighter { /** * Marks numbers position based on input . * < p > Assumes that a number starts at the specified position , * i . e . { @ code Character . isDigit ( line . charAt ( startingPoint ) ) = = true } * @ param line Line where to handle number string * @ param numberBitSet BitSet to use for position of number * @ param startingPoint Start point * @ return position where number finished */ int handleNumbers ( String line , BitSet numberBitSet , int startingPoint ) { } }
int end = startingPoint + 1 ; while ( end < line . length ( ) && Character . isDigit ( line . charAt ( end ) ) ) { end ++ ; } if ( end == line . length ( ) ) { if ( Character . isDigit ( line . charAt ( line . length ( ) - 1 ) ) ) { numberBitSet . set ( startingPoint , end ) ; } } else if ( Character . isWhitespace ( line . charAt ( end ) ) || line . charAt ( end ) == ';' || line . charAt ( end ) == ',' || line . charAt ( end ) == '=' || line . charAt ( end ) == '<' || line . charAt ( end ) == '>' || line . charAt ( end ) == '-' || line . charAt ( end ) == '+' || line . charAt ( end ) == '/' || line . charAt ( end ) == ')' || line . charAt ( end ) == '%' || line . charAt ( end ) == '*' || line . charAt ( end ) == '!' || line . charAt ( end ) == '^' || line . charAt ( end ) == '|' || line . charAt ( end ) == '&' || line . charAt ( end ) == ']' ) { numberBitSet . set ( startingPoint , end ) ; } startingPoint = end - 1 ; return startingPoint ;
public class JmsMsgProducerImpl { /** * This method carries out validation on the priority field . * @ param x */ private void validatePriority ( int x ) throws JMSException { } }
// Priority must be in the range 0-9 if ( ( x < 0 ) || ( x > 9 ) ) { throw ( JMSException ) JmsErrorUtils . newThrowable ( JMSException . class , "INVALID_VALUE_CWSIA0068" , new Object [ ] { "JMSPriority" , "" + x } , tc ) ; }
public class GraniteUiSyntheticResource { /** * Copy the given source resource as synthetic child under the target parent resource , including all children . * @ param targetParent Target parent resource * @ param source Source resource */ public static void copySubtree ( @ NotNull Resource targetParent , @ NotNull Resource source ) { } }
Resource targetChild = GraniteUiSyntheticResource . child ( targetParent , source . getName ( ) , source . getResourceType ( ) , source . getValueMap ( ) ) ; for ( Resource sourceChild : source . getChildren ( ) ) { copySubtree ( targetChild , sourceChild ) ; }
public class ImplColorHsv { /** * Converts an image from RGB into HSV . Pixels must have a value within the range of [ 0,1 ] . * @ param rgb ( Input ) Image in RGB format * @ param hsv ( Output ) Image in HSV format */ public static void rgbToHsv_F32 ( Planar < GrayF32 > rgb , Planar < GrayF32 > hsv ) { } }
GrayF32 R = rgb . getBand ( 0 ) ; GrayF32 G = rgb . getBand ( 1 ) ; GrayF32 B = rgb . getBand ( 2 ) ; GrayF32 H = hsv . getBand ( 0 ) ; GrayF32 S = hsv . getBand ( 1 ) ; GrayF32 V = hsv . getBand ( 2 ) ; // CONCURRENT _ BELOW BoofConcurrency . loopFor ( 0 , hsv . height , row - > { for ( int row = 0 ; row < hsv . height ; row ++ ) { int indexRgb = rgb . startIndex + row * rgb . stride ; int indexHsv = hsv . startIndex + row * hsv . stride ; int endRgb = indexRgb + hsv . width ; for ( ; indexRgb < endRgb ; indexHsv ++ , indexRgb ++ ) { float r = R . data [ indexRgb ] ; float g = G . data [ indexRgb ] ; float b = B . data [ indexRgb ] ; float max = r > g ? ( r > b ? r : b ) : ( g > b ? g : b ) ; float min = r < g ? ( r < b ? r : b ) : ( g < b ? g : b ) ; float delta = max - min ; V . data [ indexHsv ] = max ; if ( max != 0 ) S . data [ indexHsv ] = delta / max ; else { H . data [ indexHsv ] = Float . NaN ; S . data [ indexHsv ] = 0 ; continue ; } float h ; if ( r == max ) h = ( g - b ) / delta ; else if ( g == max ) h = 2 + ( b - r ) / delta ; else h = 4 + ( r - g ) / delta ; h *= d60_F32 ; if ( h < 0 ) h += PI2_F32 ; H . data [ indexHsv ] = h ; } } // CONCURRENT _ ABOVE } ) ;
public class MapUtils { /** * Transforms the values of the given Map with the specified Transformer . * @ param < K > Class type of the key . * @ param < V > Class type of the value . * @ param map { @ link Map } to transform . * @ param transformer { @ link Transformer } used to transform the { @ link Map } ' s values . * @ return a new { @ link Map } from the given { @ link Map } transformed by the { @ link Transformer } . * @ throws IllegalArgumentException if either the { @ link Map } or { @ link Transformer } are null . * @ see org . cp . elements . lang . Transformer * @ see java . util . Map */ public static < K , V > Map < K , V > transform ( Map < K , V > map , Transformer < V > transformer ) { } }
Assert . notNull ( map , "Map is required" ) ; Assert . notNull ( transformer , "Transformer is required" ) ; return map . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: < K > getKey , ( entry ) -> transformer . transform ( entry . getValue ( ) ) ) ) ;
public class Base64Data { /** * Creates in instance from the given JSON object . * @ param jsonObj * Object to read values from . * @ return New instance . */ public static Base64Data create ( final JsonObject jsonObj ) { } }
final String base64Str = jsonObj . getString ( EL_ROOT_NAME ) ; return new Base64Data ( base64Str ) ;
public class CmsUserDriver { /** * Updates additional user info . < p > * @ param dbc the current dbc * @ param userId the user id to add the user info for * @ param key the name of the additional user info * @ param value the value of the additional user info * @ throws CmsDataAccessException if something goes wrong */ protected void internalUpdateUserInfo ( CmsDbContext dbc , CmsUUID userId , String key , Object value ) throws CmsDataAccessException { } }
PreparedStatement stmt = null ; Connection conn = null ; try { conn = getSqlManager ( ) . getConnection ( dbc ) ; stmt = m_sqlManager . getPreparedStatement ( conn , "C_USERDATA_UPDATE_4" ) ; // write data to database m_sqlManager . setBytes ( stmt , 1 , CmsDataTypeUtil . dataSerialize ( value ) ) ; stmt . setString ( 2 , value . getClass ( ) . getName ( ) ) ; stmt . setString ( 3 , userId . toString ( ) ) ; stmt . setString ( 4 , key ) ; stmt . executeUpdate ( ) ; } catch ( SQLException e ) { throw new CmsDbSqlException ( Messages . get ( ) . container ( Messages . ERR_GENERIC_SQL_1 , CmsDbSqlException . getErrorQuery ( stmt ) ) , e ) ; } catch ( IOException e ) { throw new CmsDbIoException ( Messages . get ( ) . container ( Messages . ERR_SERIALIZING_USER_DATA_1 , userId ) , e ) ; } finally { m_sqlManager . closeAll ( dbc , conn , stmt , null ) ; }
public class ObjectTreeParser { /** * Find a field in a class by it ' s name . Note that this method is * only needed because the general reflection method is case * sensitive * @ param clazz The clazz to search * @ param name The name of the field to search for * @ return The field or null if none could be located */ private Field findField ( Class clazz , String name ) { } }
Field [ ] fields = clazz . getDeclaredFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { if ( fields [ i ] . getName ( ) . equalsIgnoreCase ( name ) ) { if ( fields [ i ] . getType ( ) . isPrimitive ( ) ) { return fields [ i ] ; } if ( fields [ i ] . getType ( ) == String . class ) { return fields [ i ] ; } } } return null ;
public class DefaultBtrpOperand { /** * Pretty textual representation of a given element type . * @ param degree 0 for a literal , 1 for a set , 2 for a set of sets , . . . * @ param t the literal * @ return a String */ public static String prettyType ( int degree , Type t ) { } }
StringBuilder b = new StringBuilder ( ) ; for ( int i = degree ; i > 0 ; i -- ) { b . append ( "set<" ) ; } b . append ( t . toString ( ) . toLowerCase ( ) ) ; for ( int i = 0 ; i < degree ; i ++ ) { b . append ( ">" ) ; } return b . toString ( ) ;
public class CmsImageGalleryField { /** * Parses the value and all its informations . < p > * First part is the URL of the image . The second one describes the scale of this image . < p > * The last one sets the selected format . < p > * @ param value that should be parsed * @ return the URL of the image without any parameters */ private String parseValue ( String value ) { } }
m_croppingParam = CmsCroppingParamBean . parseImagePath ( value ) ; String path = "" ; String params = "" ; if ( value . indexOf ( "?" ) > - 1 ) { path = value . substring ( 0 , value . indexOf ( "?" ) ) ; params = value . substring ( value . indexOf ( "?" ) ) ; } else { path = value ; } int indexofscale = params . indexOf ( PARAMETER_SCALE ) ; if ( indexofscale > - 1 ) { String scal = "" ; int hasmoreValues = params . lastIndexOf ( "&" ) ; if ( hasmoreValues > indexofscale ) { scal = params . substring ( indexofscale , params . indexOf ( "&" ) ) . replace ( PARAMETER_SCALE , "" ) ; } else { scal = params . substring ( indexofscale ) . replace ( PARAMETER_SCALE , "" ) ; } if ( ! scal . equals ( m_scaleValue ) ) { m_scaleValue = scal ; } params = params . replace ( PARAMETER_SCALE + m_scaleValue , "" ) ; } int indexofformat = params . indexOf ( PARAMETER_FORMAT ) ; if ( indexofformat > - 1 ) { int hasmoreValues = params . lastIndexOf ( "&" ) ; if ( hasmoreValues > indexofformat ) { m_selectedFormat = params . substring ( indexofformat , hasmoreValues ) . replace ( PARAMETER_FORMAT , "" ) ; } else { m_selectedFormat = params . substring ( indexofformat ) . replace ( PARAMETER_FORMAT , "" ) ; } params = params . replace ( PARAMETER_FORMAT + m_selectedFormat , "" ) ; m_formatSelection . selectValue ( m_selectedFormat ) ; } int indexofdescritption = params . indexOf ( PARAMETER_DESC ) ; if ( indexofdescritption > - 1 ) { int hasmoreValues = params . lastIndexOf ( "&" ) ; if ( hasmoreValues > indexofdescritption ) { m_description = params . substring ( indexofdescritption , hasmoreValues ) . replace ( PARAMETER_DESC , "" ) ; } else { m_description = params . substring ( indexofdescritption ) . replace ( PARAMETER_DESC , "" ) ; } params = params . replace ( PARAMETER_DESC + m_description , "" ) ; m_description = URL . decode ( m_description ) ; m_descriptionArea . setFormValueAsString ( m_description ) ; } updateUploadTarget ( CmsResource . getFolderPath ( path ) ) ; if ( ! path . isEmpty ( ) ) { String imageLink = CmsCoreProvider . get ( ) . link ( path ) ; setImagePreview ( path , imageLink ) ; } else { m_imagePreview . setInnerHTML ( "" ) ; } return path ;
public class PlanAssembler { /** * Given a relatively complete plan - sub - graph , apply a trivial projection * ( filter ) to it . If the root node can embed the projection do so . If not , * add a new projection node . * @ param rootNode * The root of the plan - sub - graph to add the projection to . * @ return The new root of the plan - sub - graph ( might be the same as the * input ) . */ private AbstractPlanNode addProjection ( AbstractPlanNode rootNode ) { } }
assert ( m_parsedSelect != null ) ; assert ( m_parsedSelect . m_displayColumns != null ) ; // Build the output schema for the projection based on the display columns NodeSchema proj_schema = m_parsedSelect . getFinalProjectionSchema ( ) ; for ( SchemaColumn col : proj_schema ) { // Adjust the differentiator fields of TVEs , since they need to // reflect the inlined projection node in scan nodes . AbstractExpression colExpr = col . getExpression ( ) ; Collection < TupleValueExpression > allTves = ExpressionUtil . getTupleValueExpressions ( colExpr ) ; for ( TupleValueExpression tve : allTves ) { if ( ! tve . needsDifferentiation ( ) ) { // PartitionByPlanNode and a following OrderByPlanNode // can have an internally generated RANK column . // These do not need to have their differentiator updated , // since it ' s only used for disambiguation in some // combinations of " SELECT * " and subqueries . // In fact attempting to adjust this special column will // cause failed assertions . The tve for this expression // will be marked as not needing differentiation , // so we just ignore it here . continue ; } rootNode . adjustDifferentiatorField ( tve ) ; } } ProjectionPlanNode projectionNode = new ProjectionPlanNode ( ) ; projectionNode . setOutputSchemaWithoutClone ( proj_schema ) ; // If the projection can be done inline . then add the // projection node inline . if ( rootNode instanceof AbstractScanPlanNode ) { rootNode . addInlinePlanNode ( projectionNode ) ; return rootNode ; } projectionNode . addAndLinkChild ( rootNode ) ; return projectionNode ;
public class VaultsInner { /** * Gets information about the deleted vaults in a subscription . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the PagedList & lt ; DeletedVaultInner & gt ; object */ public Observable < Page < DeletedVaultInner > > listDeletedNextAsync ( final String nextPageLink ) { } }
return listDeletedNextWithServiceResponseAsync ( nextPageLink ) . map ( new Func1 < ServiceResponse < Page < DeletedVaultInner > > , Page < DeletedVaultInner > > ( ) { @ Override public Page < DeletedVaultInner > call ( ServiceResponse < Page < DeletedVaultInner > > response ) { return response . body ( ) ; } } ) ;
public class CPDefinitionOptionRelPersistenceImpl { /** * Returns an ordered range of all the cp definition option rels where CPDefinitionId = & # 63 ; and skuContributor = & # 63 ; . * 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 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 QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link CPDefinitionOptionRelModelImpl } . 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 CPDefinitionId the cp definition ID * @ param skuContributor the sku contributor * @ param start the lower bound of the range of cp definition option rels * @ param end the upper bound of the range of cp definition option rels ( not inclusive ) * @ param orderByComparator the comparator to order the results by ( optionally < code > null < / code > ) * @ return the ordered range of matching cp definition option rels */ @ Override public List < CPDefinitionOptionRel > findByC_SC ( long CPDefinitionId , boolean skuContributor , int start , int end , OrderByComparator < CPDefinitionOptionRel > orderByComparator ) { } }
return findByC_SC ( CPDefinitionId , skuContributor , start , end , orderByComparator , true ) ;
public class AmazonCodeDeployClient { /** * For a blue / green deployment , starts the process of rerouting traffic from instances in the original environment * to instances in the replacement environment without waiting for a specified wait time to elapse . ( Traffic * rerouting , which is achieved by registering instances in the replacement environment with the load balancer , can * start as soon as all instances have a status of Ready . ) * @ param continueDeploymentRequest * @ return Result of the ContinueDeployment operation returned by the service . * @ throws DeploymentIdRequiredException * At least one deployment ID must be specified . * @ throws DeploymentDoesNotExistException * The deployment with the IAM user or AWS account does not exist . * @ throws DeploymentAlreadyCompletedException * The deployment is already complete . * @ throws InvalidDeploymentIdException * At least one of the deployment IDs was specified in an invalid format . * @ throws DeploymentIsNotInReadyStateException * The deployment does not have a status of Ready and can ' t continue yet . * @ throws UnsupportedActionForDeploymentTypeException * A call was submitted that is not supported for the specified deployment type . * @ throws InvalidDeploymentWaitTypeException * The wait type is invalid . * @ throws InvalidDeploymentStatusException * The specified deployment status doesn ' t exist or cannot be determined . * @ sample AmazonCodeDeploy . ContinueDeployment * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / codedeploy - 2014-10-06 / ContinueDeployment " target = " _ top " > AWS * API Documentation < / a > */ @ Override public ContinueDeploymentResult continueDeployment ( ContinueDeploymentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeContinueDeployment ( request ) ;
public class Rectangle { /** * Computes the membership function evaluated at ` x ` * @ param x * @ return ` \ begin { cases } 1h & \ mbox { if $ x \ in [ s , e ] $ } \ cr 0h & * \ mbox { otherwise } \ end { cases } ` * where ` h ` is the height of the Term , * ` s ` is the start of the Rectangle , * ` e ` is the end of the Rectangle . */ @ Override public double membership ( double x ) { } }
if ( Double . isNaN ( x ) ) { return Double . NaN ; } if ( Op . isGE ( x , start ) && Op . isLE ( x , end ) ) { return height * 1.0 ; } return height * 0.0 ;
public class ReportGenerator { /** * Determines the report file name based on the give output location and * format . If the output location contains a full file name that has the * correct extension for the given report type then the output location is * returned . However , if the output location is a directory , this method * will generate the correct name for the given output format . * @ param outputLocation the specified output location * @ param format the report format * @ return the report File */ protected File getReportFile ( String outputLocation , Format format ) { } }
File outFile = new File ( outputLocation ) ; if ( outFile . getParentFile ( ) == null ) { outFile = new File ( "." , outputLocation ) ; } final String pathToCheck = outputLocation . toLowerCase ( ) ; if ( format == Format . XML && ! pathToCheck . endsWith ( ".xml" ) ) { return new File ( outFile , "dependency-check-report.xml" ) ; } if ( format == Format . HTML && ! pathToCheck . endsWith ( ".html" ) && ! pathToCheck . endsWith ( ".htm" ) ) { return new File ( outFile , "dependency-check-report.html" ) ; } if ( format == Format . JSON && ! pathToCheck . endsWith ( ".json" ) ) { return new File ( outFile , "dependency-check-report.json" ) ; } if ( format == Format . CSV && ! pathToCheck . endsWith ( ".csv" ) ) { return new File ( outFile , "dependency-check-report.csv" ) ; } if ( format == Format . JUNIT && ! pathToCheck . endsWith ( ".xml" ) ) { return new File ( outFile , "dependency-check-junit.xml" ) ; } return outFile ;
public class LifeCycleThread { public synchronized void start ( ) throws Exception { } }
if ( _running ) { log . debug ( "Already started" ) ; return ; } _running = true ; if ( _thread == null ) { _thread = new Thread ( this ) ; _thread . setDaemon ( _daemon ) ; } _thread . start ( ) ;
public class CFMLWriterImpl { /** * reset configuration of buffer * @ param bufferSize size of the buffer * @ param autoFlush does the buffer autoflush * @ throws IOException */ @ Override public void setBufferConfig ( int bufferSize , boolean autoFlush ) throws IOException { } }
this . bufferSize = bufferSize ; this . autoFlush = autoFlush ; _check ( ) ;
public class GmailAd { /** * Gets the productImages value for this GmailAd . * @ return productImages * Product images . Support up to 15 product images . * < span class = " constraint Selectable " > This field * can be selected using the value " ProductImages " . < / span > */ public com . google . api . ads . adwords . axis . v201809 . cm . ProductImage [ ] getProductImages ( ) { } }
return productImages ;
public class Matchers { /** * Matches a whitelisted method invocation that is known to never return null */ public static Matcher < ExpressionTree > methodReturnsNonNull ( ) { } }
return anyOf ( instanceMethod ( ) . onDescendantOf ( "java.lang.Object" ) . named ( "toString" ) , instanceMethod ( ) . onExactClass ( "java.lang.String" ) , staticMethod ( ) . onClass ( "java.lang.String" ) , instanceMethod ( ) . onExactClass ( "java.util.StringTokenizer" ) . named ( "nextToken" ) ) ;
public class MicroServiceTemplateSupport { /** * � � װ � � � � value � ַ � * @ param dbColMap � ύ � � � * @ param modelEntryMap � � � ģ � � * @ return * @ throws Exception */ public String createInsertValueStr4ModelEntry ( Map dbColMap0 , Map < String , MicroDbModelEntry > modelEntryMap ) { } }
if ( dbColMap0 == null ) { return null ; } // add 201902 ning Map dbColMap = new CaseInsensitiveKeyMap ( ) ; if ( dbColMap0 != null ) { dbColMap . putAll ( dbColMap0 ) ; } Cobj crealValues = Cutil . createCobj ( ) ; Map metaFlagMap = new TreeMap ( ) ; String tempDbType = calcuDbType ( ) ; Iterator it = dbColMap . keySet ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; MicroDbModelEntry modelEntry = modelEntryMap . get ( key ) ; if ( modelEntry == null ) { continue ; } if ( CheckModelTypeUtil . isRealCol ( modelEntry ) == false ) { String value = ( String ) dbColMap . get ( key ) ; String metaName = modelEntry . getMetaContentId ( ) ; Map metaMap = ( Map ) metaFlagMap . get ( metaName ) ; String realKey = CheckModelTypeUtil . getRealColName ( key ) ; if ( metaMap == null ) { metaMap = new HashMap ( ) ; metaFlagMap . put ( metaName , metaMap ) ; } if ( CheckModelTypeUtil . isNumber ( modelEntry ) ) { if ( value . contains ( "." ) ) { metaMap . put ( realKey , new BigDecimal ( value ) ) ; } else { metaMap . put ( realKey , Long . valueOf ( value ) ) ; } } else if ( CheckModelTypeUtil . isDate ( modelEntry ) ) { metaMap . put ( realKey , value ) ; } else { metaMap . put ( realKey , value ) ; } } else { // add 20170830 by ninghao Object vobj = dbColMap . get ( key ) ; if ( vobj instanceof MicroColObj ) { String colInfoStr = ( ( MicroColObj ) vobj ) . getColInfo ( ) ; crealValues . append ( key + "=" + colInfoStr ) ; continue ; } // end String value = ( String ) dbColMap . get ( key ) ; String whereValue = "" ; // add 201807 ning if ( value != null && MICRO_DB_NULL . equals ( value ) ) { if ( tempDbType != null && "oracle" . equals ( tempDbType ) ) { whereValue = "NULL" ; } else { whereValue = "null" ; } // end } else if ( CheckModelTypeUtil . isNumber ( modelEntry ) ) { whereValue = Cutil . rep ( "<REPLACE>" , value ) ; } else if ( CheckModelTypeUtil . isDate ( modelEntry ) ) { // add for oracle String temp = "str_to_date('<REPLACE>','%Y-%m-%d %H:%i:%s')" ; if ( tempDbType != null && "oracle" . equals ( tempDbType ) ) { temp = "to_date('<REPLACE>','" + ORCL_DATE_FORMAT + "')" ; } whereValue = Cutil . rep ( temp , value ) ; } else { whereValue = Cutil . rep ( "'<REPLACE>'" , value ) ; } crealValues . append ( whereValue , value != null ) ; } } String dynamic = null ; Iterator iter = metaFlagMap . keySet ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { String key = ( String ) iter . next ( ) ; Map metaMap = ( Map ) metaFlagMap . get ( key ) ; Gson gson = new Gson ( ) ; dynamic = gson . toJson ( metaMap ) ; crealValues . append ( Cutil . rep ( "'<REPLACE>'" , dynamic , dynamic != null ) ) ; } return crealValues . getStr ( ) ;
public class EntityListenersService { /** * Update all registered listeners of the entities * @ return Stream < Entity > */ Stream < Entity > updateEntities ( String repoFullName , Stream < Entity > entities ) { } }
lock . readLock ( ) . lock ( ) ; try { verifyRepoRegistered ( repoFullName ) ; SetMultimap < Object , EntityListener > entityListeners = this . entityListenersByRepo . get ( repoFullName ) ; return entities . filter ( entity -> { Set < EntityListener > entityEntityListeners = entityListeners . get ( entity . getIdValue ( ) ) ; entityEntityListeners . forEach ( entityListener -> entityListener . postUpdate ( entity ) ) ; return true ; } ) ; } finally { lock . readLock ( ) . unlock ( ) ; }
public class UserGroupManager { /** * Delete the user group with the specified ID * @ param sUserGroupID * The ID of the user group to be deleted . May be < code > null < / code > . * @ return { @ link EChange # CHANGED } if the user group was deleted , * { @ link EChange # UNCHANGED } otherwise */ @ Nonnull public EChange deleteUserGroup ( @ Nullable final String sUserGroupID ) { } }
if ( StringHelper . hasNoText ( sUserGroupID ) ) return EChange . UNCHANGED ; final UserGroup aDeletedUserGroup = getOfID ( sUserGroupID ) ; if ( aDeletedUserGroup == null ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "no-such-usergroup-id" , sUserGroupID ) ; return EChange . UNCHANGED ; } if ( aDeletedUserGroup . isDeleted ( ) ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "already-deleted" , sUserGroupID ) ; return EChange . UNCHANGED ; } m_aRWLock . writeLock ( ) . lock ( ) ; try { if ( BusinessObjectHelper . setDeletionNow ( aDeletedUserGroup ) . isUnchanged ( ) ) { AuditHelper . onAuditDeleteFailure ( UserGroup . OT , "already-deleted" , sUserGroupID ) ; return EChange . UNCHANGED ; } internalMarkItemDeleted ( aDeletedUserGroup ) ; } finally { m_aRWLock . writeLock ( ) . unlock ( ) ; } AuditHelper . onAuditDeleteSuccess ( UserGroup . OT , sUserGroupID ) ; // Execute callback as the very last action m_aCallbacks . forEach ( aCB -> aCB . onUserGroupDeleted ( aDeletedUserGroup ) ) ; return EChange . CHANGED ;
public class Deflater { /** * Resets deflater so that a new set of input data can be processed . * Keeps current compression level and strategy settings . */ public void reset ( ) { } }
synchronized ( zsRef ) { ensureOpen ( ) ; reset ( zsRef . address ( ) ) ; finish = false ; finished = false ; off = len = 0 ; bytesRead = bytesWritten = 0 ; }
public class CheckMethodAdapter { /** * Checks that the given string is a valid unqualified name . * @ param version * the class version . * @ param name * the string to be checked . * @ param msg * a message to be used in case of error . */ static void checkUnqualifiedName ( int version , final String name , final String msg ) { } }
if ( ( version & 0xFFFF ) < Opcodes . V1_5 ) { checkIdentifier ( name , msg ) ; } else { for ( int i = 0 ; i < name . length ( ) ; ++ i ) { if ( ".;[/" . indexOf ( name . charAt ( i ) ) != - 1 ) { throw new IllegalArgumentException ( "Invalid " + msg + " (must be a valid unqualified name): " + name ) ; } } }
public class Header { /** * getter for language - gets The language of the document , O * @ generated * @ return value of the feature */ public String getLanguage ( ) { } }
if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_language == null ) jcasType . jcas . throwFeatMissing ( "language" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_language ) ;
public class Parser { /** * 11.7 Shift Expression */ private ParseTree parseShiftExpression ( ) { } }
SourcePosition start = getTreeStartLocation ( ) ; ParseTree left = parseAdditiveExpression ( ) ; while ( peekShiftOperator ( ) ) { Token operator = nextToken ( ) ; ParseTree right = parseAdditiveExpression ( ) ; left = new BinaryOperatorTree ( getTreeLocation ( start ) , left , operator , right ) ; } return left ;
public class Spinner { /** * Obtains the color of the hint , which should be shown , when no item is selected , from a * specific typed array . * @ param typedArray * The typed array , the hint should be obtained from , as an instance of the class { @ link * TypedArray } . The typed array may not be null */ private void obtainHintColor ( @ NonNull final TypedArray typedArray ) { } }
ColorStateList colors = typedArray . getColorStateList ( R . styleable . Spinner_android_textColorHint ) ; if ( colors == null ) { TypedArray styledAttributes = getContext ( ) . getTheme ( ) . obtainStyledAttributes ( new int [ ] { android . R . attr . textColorSecondary } ) ; colors = ColorStateList . valueOf ( styledAttributes . getColor ( 0 , 0 ) ) ; } setHintTextColor ( colors ) ;
public class FormMappingOption { public FormMappingOption filterSimpleTextParameter ( FormSimpleTextParameterFilter filter ) { } }
if ( filter == null ) { throw new IllegalArgumentException ( "The argument 'filter' should not be null." ) ; } this . simpleTextParameterFilter = OptionalThing . of ( filter ) ; return this ;
public class CndImporter { /** * Parse the child node definition ' s attributes , if they appear next on the token stream . * @ param tokens the tokens containing the attributes ; never null * @ param childDefn the child node definition ; never null * @ param nodeType the node type being created ; never null * @ throws ParsingException if there is a problem parsing the content * @ throws ConstraintViolationException not expected */ protected void parseNodeAttributes ( TokenStream tokens , JcrNodeDefinitionTemplate childDefn , JcrNodeTypeTemplate nodeType ) throws ConstraintViolationException { } }
boolean autoCreated = false ; boolean mandatory = false ; boolean isProtected = false ; boolean sns = false ; String onParentVersion = "COPY" ; while ( true ) { if ( tokens . canConsumeAnyOf ( "AUTOCREATED" , "AUT" , "A" ) ) { tokens . canConsume ( '?' ) ; autoCreated = true ; } else if ( tokens . canConsumeAnyOf ( "MANDATORY" , "MAN" , "M" ) ) { tokens . canConsume ( '?' ) ; mandatory = true ; } else if ( tokens . canConsumeAnyOf ( "PROTECTED" , "PRO" , "P" ) ) { tokens . canConsume ( '?' ) ; isProtected = true ; } else if ( tokens . canConsumeAnyOf ( "SNS" , "*" ) ) { // standard JCR 2.0 keywords for SNS . . . tokens . canConsume ( '?' ) ; sns = true ; } else if ( tokens . canConsumeAnyOf ( "MULTIPLE" , "MUL" , "*" ) ) { // from pre - JCR 2.0 ref impl Position pos = tokens . previousPosition ( ) ; int line = pos . getLine ( ) ; int column = pos . getColumn ( ) ; throw new ParsingException ( tokens . previousPosition ( ) , CndI18n . multipleKeywordNotValidInJcr2CndFormat . text ( line , column ) ) ; } else if ( tokens . matchesAnyOf ( VALID_ON_PARENT_VERSION ) ) { onParentVersion = tokens . consume ( ) ; tokens . canConsume ( '?' ) ; } else if ( tokens . matches ( "OPV" ) ) { // variant on - parent - version onParentVersion = tokens . consume ( ) ; tokens . canConsume ( '?' ) ; } else if ( tokens . canConsumeAnyOf ( "PRIMARYITEM" , "PRIMARY" , "PRI" , "!" ) ) { Position pos = tokens . previousPosition ( ) ; int line = pos . getLine ( ) ; int column = pos . getColumn ( ) ; throw new ParsingException ( tokens . previousPosition ( ) , CndI18n . primaryKeywordNotValidInJcr2CndFormat . text ( line , column ) ) ; } else if ( tokens . matches ( CndTokenizer . VENDOR_EXTENSION ) ) { List < Property > properties = new LinkedList < Property > ( ) ; parseVendorExtensions ( tokens , properties ) ; applyVendorExtensions ( childDefn , properties ) ; } else { break ; } } childDefn . setAutoCreated ( autoCreated ) ; childDefn . setMandatory ( mandatory ) ; childDefn . setProtected ( isProtected ) ; childDefn . setOnParentVersion ( OnParentVersionAction . valueFromName ( onParentVersion . toUpperCase ( Locale . ROOT ) ) ) ; childDefn . setSameNameSiblings ( sns ) ;
public class DatabaseUtils { /** * Concatenates two SQL WHERE clauses , handling empty or null values . */ public static String concatenateWhere ( String a , String b ) { } }
if ( TextUtils . isEmpty ( a ) ) { return b ; } if ( TextUtils . isEmpty ( b ) ) { return a ; } return "(" + a + ") AND (" + b + ")" ;
public class OWLValueObject { /** * Builds an instance * @ param model * @ param value * @ return * @ throws NotYetImplementedException * @ throws OWLTranslationException */ public static OWLValueObject buildFromOWLValue ( OWLModel model , OWLValue value ) throws NotYetImplementedException , OWLTranslationException { } }
if ( value . isDataValue ( ) ) { return new OWLValueObject ( model , OWLURIClass . from ( value . castTo ( OWLDataValue . class ) . getValue ( ) ) , value ) ; } if ( value . isIndividual ( ) ) { try { if ( value instanceof OWLListImpl ) { OWLList < OWLIndividual > owlList = ( OWLListImpl ) value ; OWLURIClass owlURIClass = OWLURIClass . from ( ObjectOWLSTranslator . owlIndividualToClass ( owlList . iterator ( ) . next ( ) ) ) ; return new OWLValueObject ( model , owlURIClass , value ) ; } if ( value . canCastTo ( Result . class ) ) { return buildFromOWLValueAndClass ( model , value , ObjectOWLSTranslator . owlsResultToClass ( value . castTo ( Result . class ) ) ) ; } if ( value . canCastTo ( OWLIndividual . class ) ) { return buildFromOWLValueAndClass ( model , value , ObjectOWLSTranslator . owlIndividualToClass ( value . castTo ( OWLIndividual . class ) ) ) ; } } catch ( ClassNotFoundException ex ) { throw new OWLTranslationException ( "casting OWLValue: " + value . toString ( ) , ex ) ; } } throw new NotYetImplementedException ( "fail to build new " + OWLValueObject . class . toString ( ) + " from: " + value . toString ( ) ) ;
public class KMeansPlusPlusInitialMeans { /** * Initialize the weight list . * @ param weights Weight list * @ param ids IDs * @ param first Added ID * @ param distQ Distance query * @ return Weight sum */ static double initialWeights ( WritableDoubleDataStore weights , DBIDs ids , NumberVector first , DistanceQuery < ? super NumberVector > distQ ) { } }
double weightsum = 0. ; for ( DBIDIter it = ids . iter ( ) ; it . valid ( ) ; it . advance ( ) ) { // Distance will usually already be squared double weight = distQ . distance ( first , it ) ; weights . putDouble ( it , weight ) ; weightsum += weight ; } return weightsum ;
public class NamespaceSpecification { /** * Check if this namespace specification competes with * another namespace specification . * @ param other The namespace specification we need to check if * it competes with this namespace specification . * @ return true if the namespace specifications compete . */ public boolean compete ( NamespaceSpecification other ) { } }
// if no wildcard for other then we check coverage if ( "" . equals ( other . wildcard ) ) { return covers ( other . ns ) ; } // split the namespaces at wildcards String [ ] otherParts = split ( other . ns , other . wildcard ) ; // if the given namepsace specification does not use its wildcard // then we just look if the current namespace specification covers it if ( otherParts . length == 1 ) { return covers ( other . ns ) ; } // if no wildcard for the current namespace specification if ( "" . equals ( wildcard ) ) { return other . covers ( ns ) ; } // also for the current namespace specification String [ ] parts = split ( ns , wildcard ) ; // now check if the current namespace specification is just an URI if ( parts . length == 1 ) { return other . covers ( ns ) ; } // now each namespace specification contains wildcards // suppose we have // ns = a1 * a2 * . . . * an // and // other . ns = b1 * b2 * . . . * bm // then we only need to check matchPrefix ( a1 , b1 ) and matchPrefix ( an , bn ) where // matchPrefix ( a , b ) means a starts with b or b starts with a . return matchPrefix ( parts [ 0 ] , otherParts [ 0 ] ) && matchPrefix ( parts [ parts . length - 1 ] , otherParts [ otherParts . length - 1 ] ) ;