signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class PdfPRow { /** * Initializes the extra heights array . * @ since2.1.6 */ public void initExtraHeights ( ) { } }
extraHeights = new float [ cells . length ] ; for ( int i = 0 ; i < extraHeights . length ; i ++ ) { extraHeights [ i ] = 0 ; }
public class CoverageUtilities { /** * Simple method to get a value from a single band raster . * < p > Note that this method does always return a value . If invalid , a novalue is returned . < / p > * @ param raster * @ param easting * @ param northing * @ return */ public static double getValue ( GridCoverage2D raster , double easting , double northing ) { } }
double [ ] values = null ; try { values = raster . evaluate ( new Point2D . Double ( easting , northing ) , ( double [ ] ) null ) ; } catch ( Exception e ) { return doubleNovalue ; } return values [ 0 ] ;
public class ExchangeValues { /** * This function switches the values of two numbers . * Examples : * exchange _ values ( 10 , 20 ) - > ( 20 , 10) * exchange _ values ( 15 , 17 ) - > ( 17 , 15) * exchange _ values ( 100 , 200 ) - > ( 200 , 100) * @ param num1 , num2 : Two numbers that are to be swapped . * @ return : The two numbers in swapped positions . */ public int [ ] exchangeValues ( int num1 , int num2 ) { } }
int tempHolder = num1 ; num1 = num2 ; num2 = tempHolder ; return new int [ ] { num1 , num2 } ;
public class MethodAttribUtils { /** * Returns a map of method name to list of business methods . */ static Map < String , List < Method > > getBusinessMethodsByName ( BeanMetaData bmd ) { } }
Map < String , List < Method > > methodsByName = new HashMap < String , List < Method > > ( ) ; collectBusinessMethodsByName ( methodsByName , bmd . methodInfos ) ; collectBusinessMethodsByName ( methodsByName , bmd . localMethodInfos ) ; return methodsByName ;
public class WorkspaceDirectory { /** * The IP addresses of the DNS servers for the directory . * @ return The IP addresses of the DNS servers for the directory . */ public java . util . List < String > getDnsIpAddresses ( ) { } }
if ( dnsIpAddresses == null ) { dnsIpAddresses = new com . amazonaws . internal . SdkInternalList < String > ( ) ; } return dnsIpAddresses ;
public class Filters { /** * Converts a { @ link CommonAttributes # FILTER _ SPEC filter spec } to a legacy { @ link CommonAttributes # FILTER filter } . * @ param value the value to convert * @ return the complex filter object */ static ModelNode filterSpecToFilter ( final String value ) { } }
final ModelNode filter = new ModelNode ( CommonAttributes . FILTER . getName ( ) ) . setEmptyObject ( ) ; final Iterator < String > iterator = tokens ( value ) . iterator ( ) ; parseFilterExpression ( iterator , filter , true ) ; return filter ;
public class EventDistributor { /** * When an object implementing interface < code > Runnable < / code > is used * to create a thread , starting the thread causes the object ' s * < code > run < / code > method to be called in that separately executing * thread . * The general contract of the method < code > run < / code > is that it may * take any action whatsoever . * @ see Thread # run ( ) */ @ Override public void run ( ) { } }
while ( ! stop ) { try { EventModel < ? > event = events . take ( ) ; processEvent ( event ) ; } catch ( InterruptedException e ) { log . warn ( "interrupted" , e ) ; } }
public class UtilIO { /** * Searches for the root BoofCV directory and returns an absolute path from it . * @ param path File path relative to root directory * @ return Absolute path to file */ public static String path ( String path ) { } }
String pathToBase = getPathToBase ( ) ; if ( pathToBase == null ) return path ; return new File ( pathToBase , path ) . getAbsolutePath ( ) ;
public class AsciiArtRenderer { /** * < b > Example : < / b > * { @ code | foo | } */ @ Override public void renderReference ( PositionedText canvas , double x , double y , String target , String name ) { } }
canvas . add ( x , y , "|" + name + "|" ) ;
public class Replacement { /** * Creates a { @ link Replacement } . Start and end positions are represented as code unit indices in * a Unicode 16 - bit string . * @ param startPosition the beginning of the replacement * @ param endPosition the end of the replacement , exclusive * @ param replaceWith the replacement text */ public static Replacement create ( int startPosition , int endPosition , String replaceWith ) { } }
checkArgument ( startPosition >= 0 && startPosition <= endPosition , "invalid replacement: [%s, %s) (%s)" , startPosition , endPosition , replaceWith ) ; return new AutoValue_Replacement ( Range . closedOpen ( startPosition , endPosition ) , replaceWith ) ;
public class ObjFileImporter { /** * Creates a new { @ link Face } from data and adds it to { @ link # faces } . < br > * Tries to deduct parameters from the normals provided and disable brightness / AO calculations . * @ param data the data */ private void addFace ( String data ) { } }
matcher = facePattern . matcher ( data ) ; List < Vertex > faceVertex = new ArrayList < > ( ) ; List < Vector > faceNormals = new ArrayList < > ( ) ; int v = 0 , t = 0 , n = 0 ; String strV , strT , strN ; Vertex vertex , vertexCopy ; UV uv = null ; Vector normal ; while ( matcher . find ( ) ) { normal = null ; uv = null ; strV = matcher . group ( "v" ) ; strT = matcher . group ( "t" ) ; strN = matcher . group ( "n" ) ; v = Integer . parseInt ( strV ) ; vertex = vertexes . get ( v > 0 ? v - 1 : vertexes . size ( ) - v - 1 ) ; if ( vertex != null ) { vertexCopy = new Vertex ( vertex ) ; if ( strT != null ) { t = Integer . parseInt ( strT ) ; uv = uvs . get ( t > 0 ? t - 1 : uvs . size ( ) - t - 1 ) ; if ( uv != null ) vertexCopy . setUV ( uv . u , uv . v ) ; } faceVertex . add ( vertexCopy ) ; if ( strN != null ) { n = Integer . parseInt ( strN ) ; n = n > 0 ? n - 1 : normals . size ( ) - n - 1 ; if ( n >= 0 && n < normals . size ( ) ) normal = normals . get ( n ) ; if ( normal != null ) faceNormals . add ( new Vector ( normal . x , normal . y , normal . z ) ) ; } } else { MalisisCore . log . error ( "[ObjFileImporter] Wrong vertex reference {} for face at line {} :\n{}" , v , lineNumber , currentLine ) ; } } Face f = new Face ( faceVertex ) ; f . deductParameters ( faceNormals . toArray ( new Vector [ 0 ] ) ) ; RenderParameters params = f . getParameters ( ) ; if ( params . direction . get ( ) == EnumFacing . NORTH || params . direction . get ( ) == EnumFacing . EAST ) params . flipU . set ( true ) ; params . renderAllFaces . set ( true ) ; params . interpolateUV . set ( false ) ; params . calculateAOColor . set ( false ) ; // params . useEnvironmentBrightness . set ( false ) ; faces . add ( f ) ;
public class GeneralContextExtractor { /** * { @ inheritDoc } */ public void processDocument ( BufferedReader document , Wordsi wordsi ) { } }
Queue < String > prevWords = new ArrayDeque < String > ( ) ; Queue < String > nextWords = new ArrayDeque < String > ( ) ; Iterator < String > it = IteratorFactory . tokenizeOrdered ( document ) ; // Skip empty documents . if ( ! it . hasNext ( ) ) return ; // Read the header and use it as the secondary key for wordsi , if told // to do so . String header = null ; if ( readHeader ) header = it . next ( ) ; // Fill up the words after the context so that when the real processing // starts , the context is fully prepared . for ( int i = 0 ; i < windowSize && it . hasNext ( ) ; ++ i ) nextWords . offer ( it . next ( ) ) ; // Iterate through each of the words in the context , generating context // vectors for each acceptable word . String focus = null ; while ( ! nextWords . isEmpty ( ) ) { focus = nextWords . remove ( ) ; String secondaryKey = ( header == null ) ? focus : header ; // Advance the sliding window to the right . if ( it . hasNext ( ) ) nextWords . offer ( it . next ( ) ) ; // Represent the word if wordsi is willing to process it . if ( wordsi . acceptWord ( focus ) ) { SparseDoubleVector contextVector = generator . generateContext ( prevWords , nextWords ) ; wordsi . handleContextVector ( focus , secondaryKey , contextVector ) ; } // Advance the sliding window to the right . prevWords . offer ( focus ) ; if ( prevWords . size ( ) > windowSize ) prevWords . remove ( ) ; }
public class XmlScanner { /** * 从xmlPath的Set集合中解析判断是否是zealot的xml文件 , 如果是的话则将其添加到XmlContext上下文中 , 供后面解析 . */ private void addZealotXmlInContext ( ) { } }
for ( String xmlPath : xmlPaths ) { String nameSpace = XmlNodeHelper . getZealotXmlNameSpace ( xmlPath ) ; if ( StringHelper . isNotBlank ( nameSpace ) ) { XmlContext . INSTANCE . add ( nameSpace , xmlPath ) ; } }
public class UserDto { /** * transformers / / / / / */ public static UserDto fromUser ( User user , boolean isIncludeCredentials ) { } }
UserDto userDto = new UserDto ( ) ; userDto . setProfile ( UserProfileDto . fromUser ( user ) ) ; if ( isIncludeCredentials ) { userDto . setCredentials ( UserCredentialsDto . fromUser ( user ) ) ; } return userDto ;
public class DBUtils { /** * 用于查询SQL语句中返回的记录中的第一个字段的值 , 适用于单条记录单个字段的查询 * @ param sql 查询SQL语句 * @ param arg 传入的占位符的参数 * @ return 返回查询的记录的第一个字段的值 , 若有多个记录符合查询条件 , 则返回第一条记录的第一个字段的值 , 若没有符合条件的记录 , 则返回NULL */ public static < T > T getValueOfCertainColumnOfCertainRecord ( String sql , Object ... arg ) { } }
List < T > list = DBUtils . getValueOfCertainColumnOfAllRecord ( sql , arg ) ; if ( list . isEmpty ( ) ) { return null ; } return list . get ( 0 ) ;
public class WaitForFieldChangeHandler { /** * Set the field that owns this listener . * @ owner The field that this listener is being added to ( if null , this listener is being removed ) . */ public void setOwner ( ListenerOwner owner ) { } }
if ( owner == null ) { if ( m_messageListener != null ) { m_messageListener . free ( ) ; m_messageListener = null ; } } super . setOwner ( owner ) ; if ( owner != null ) { Record record = this . getOwner ( ) . getRecord ( ) ; MessageManager messageManager = ( ( Application ) record . getTask ( ) . getApplication ( ) ) . getMessageManager ( ) ; if ( messageManager != null ) { BaseMessageFilter messageFilter = new BaseMessageFilter ( MessageConstants . TRX_RETURN_QUEUE , MessageConstants . INTERNET_QUEUE , this , null ) ; messageManager . addMessageFilter ( messageFilter ) ; m_messageListener = new WaitForFieldChangeMessageListener ( messageFilter , this ) ; record . setupRecordListener ( m_messageListener , false , false ) ; // I need to listen for record changes } }
public class SelectList { /** * Deselect the option at the given index . This is done by examing the " index " attribute of an element , and not * merely by counting . * @ param index * the index to deselect */ public void deselectByIndex ( int index ) { } }
getDispatcher ( ) . beforeDeselect ( this , index ) ; new Select ( getElement ( ) ) . deselectByIndex ( index ) ; if ( Config . getBoolConfigProperty ( ConfigProperty . ENABLE_GUI_LOGGING ) ) { logUIActions ( UIActions . CLEARED , Integer . toString ( index ) ) ; } getDispatcher ( ) . afterDeselect ( this , index ) ;
public class AbcGrammar { /** * field - composer : : = % x43.3A * WSP tex - text header - eol < p > * < tt > C : < / tt > */ Rule FieldComposer ( ) { } }
return Sequence ( String ( "C:" ) , ZeroOrMore ( WSP ( ) ) . suppressNode ( ) , TexText ( ) , HeaderEol ( ) ) . label ( FieldComposer ) ;
public class JadeAgentIntrospector { /** * Non - supported in JadeAgentIntrospector */ @ Override public Object [ ] getAgentPlans ( String agent_name , Connector connector ) { } }
// Not supported in JADE connector . getLogger ( ) . warning ( "Non suported method for Jade Platform. There is no plans in Jade platform." ) ; throw new java . lang . UnsupportedOperationException ( "Non suported method for Jade Platform. There is no extra properties." ) ;
public class TagAttributeImpl { /** * If literal , call { @ link Integer # parseInt ( java . lang . String ) Integer . parseInt ( String ) } , otherwise call * { @ link # getObject ( FaceletContext , Class ) getObject ( FaceletContext , Class ) } . * @ see Integer # parseInt ( java . lang . String ) * @ see # getObject ( FaceletContext , Class ) * @ param ctx * FaceletContext to use * @ return int value */ public int getInt ( FaceletContext ctx ) { } }
if ( ( this . capabilities & EL_LITERAL ) != 0 ) { return Integer . parseInt ( this . value ) ; } else { return ( ( Number ) this . getObject ( ctx , Integer . class ) ) . intValue ( ) ; }
public class Blob { /** * Sends a copy request for the current blob to the target bucket , preserving its name . Possibly * copying also some of the metadata ( e . g . content - type ) . * < p > Example of copying the blob to a different bucket , keeping the original name . * < pre > { @ code * String bucketName = " my _ unique _ bucket " ; * CopyWriter copyWriter = blob . copyTo ( bucketName ) ; * Blob copiedBlob = copyWriter . getResult ( ) ; * } < / pre > * @ param targetBucket target bucket ' s name * @ param options source blob options * @ return a { @ link CopyWriter } object that can be used to get information on the newly created * blob or to complete the copy if more than one RPC request is needed * @ throws StorageException upon failure */ public CopyWriter copyTo ( String targetBucket , BlobSourceOption ... options ) { } }
return copyTo ( targetBucket , getName ( ) , options ) ;
public class CommonOps_ZDRM { /** * Solves for x in the following equation : < br > * < br > * A * x = b * If the system could not be solved then false is returned . If it returns true * that just means the algorithm finished operating , but the results could still be bad * because ' A ' is singular or nearly singular . * If repeat calls to solve are being made then one should consider using { @ link LinearSolverFactory _ ZDRM } * instead . * It is ok for ' b ' and ' x ' to be the same matrix . * @ param a A matrix that is m by n . Not modified . * @ param b A matrix that is n by k . Not modified . * @ param x A matrix that is m by k . Modified . * @ return true if it could invert the matrix false if it could not . */ public static boolean solve ( ZMatrixRMaj a , ZMatrixRMaj b , ZMatrixRMaj x ) { } }
LinearSolverDense < ZMatrixRMaj > solver ; if ( a . numCols == a . numRows ) { solver = LinearSolverFactory_ZDRM . lu ( a . numRows ) ; } else { solver = LinearSolverFactory_ZDRM . qr ( a . numRows , a . numCols ) ; } // make sure the inputs ' a ' and ' b ' are not modified solver = new LinearSolverSafe < ZMatrixRMaj > ( solver ) ; if ( ! solver . setA ( a ) ) return false ; solver . solve ( b , x ) ; return true ;
public class PreauthIntegrityNegotiateContext { /** * { @ inheritDoc } * @ see jcifs . Decodable # decode ( byte [ ] , int , int ) */ @ Override public int decode ( byte [ ] buffer , int bufferIndex , int len ) throws SMBProtocolDecodingException { } }
int start = bufferIndex ; int nalgos = SMBUtil . readInt2 ( buffer , bufferIndex ) ; int nsalt = SMBUtil . readInt2 ( buffer , bufferIndex + 2 ) ; bufferIndex += 4 ; this . hashAlgos = new int [ nalgos ] ; for ( int i = 0 ; i < nalgos ; i ++ ) { this . hashAlgos [ i ] = SMBUtil . readInt2 ( buffer , bufferIndex ) ; bufferIndex += 2 ; } this . salt = new byte [ nsalt ] ; System . arraycopy ( buffer , bufferIndex , this . salt , 0 , nsalt ) ; bufferIndex += nsalt ; return bufferIndex - start ;
public class IfcReinforcingMeshTypeImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ SuppressWarnings ( "unchecked" ) @ Override public EList < IfcBendingParameterSelect > getBendingParameters ( ) { } }
return ( EList < IfcBendingParameterSelect > ) eGet ( Ifc4Package . Literals . IFC_REINFORCING_MESH_TYPE__BENDING_PARAMETERS , true ) ;
public class Math { /** * Returns the maximum of a matrix . */ public static int max ( int [ ] [ ] matrix ) { } }
int m = matrix [ 0 ] [ 0 ] ; for ( int [ ] x : matrix ) { for ( int y : x ) { if ( m < y ) { m = y ; } } } return m ;
public class Agg { /** * Get a { @ link Collector } that calculates the < code > MAX ( ) < / code > function . */ public static < T > Collector < T , ? , Optional < T > > max ( Comparator < ? super T > comparator ) { } }
return maxBy ( t -> t , comparator ) ;
public class Console { /** * Changes workspace in the URL displayed by browser . * @ param name the name of the repository . * @ param changeHistory if true store URL changes in browser ' s history . */ public void changeWorkspaceInURL ( String name , boolean changeHistory ) { } }
jcrURL . setWorkspace ( name ) ; if ( changeHistory ) { htmlHistory . newItem ( jcrURL . toString ( ) , false ) ; }
public class YearQuarter { /** * Returns a copy of this year - quarter with the specified period in years added . * This instance is immutable and unaffected by this method call . * @ param yearsToAdd the years to add , may be negative * @ return a { @ code YearQuarter } based on this year - quarter with the years added , not null * @ throws DateTimeException if the result exceeds the supported range */ public YearQuarter plusYears ( long yearsToAdd ) { } }
if ( yearsToAdd == 0 ) { return this ; } int newYear = YEAR . checkValidIntValue ( year + yearsToAdd ) ; // safe overflow return with ( newYear , quarter ) ;
public class Base58 { /** * Decodes the given base58 string into the original data bytes . * @ param input the base58 - encoded string to decode * @ return the decoded data bytes * @ throws AddressFormatException if the given string is not a valid base58 string */ public static byte [ ] decode ( String input ) throws AddressFormatException { } }
if ( input . length ( ) == 0 ) { return new byte [ 0 ] ; } // Convert the base58 - encoded ASCII chars to a base58 byte sequence ( base58 digits ) . byte [ ] input58 = new byte [ input . length ( ) ] ; for ( int i = 0 ; i < input . length ( ) ; ++ i ) { char c = input . charAt ( i ) ; int digit = c < 128 ? INDEXES [ c ] : - 1 ; if ( digit < 0 ) { throw new AddressFormatException . InvalidCharacter ( c , i ) ; } input58 [ i ] = ( byte ) digit ; } // Count leading zeros . int zeros = 0 ; while ( zeros < input58 . length && input58 [ zeros ] == 0 ) { ++ zeros ; } // Convert base - 58 digits to base - 256 digits . byte [ ] decoded = new byte [ input . length ( ) ] ; int outputStart = decoded . length ; for ( int inputStart = zeros ; inputStart < input58 . length ; ) { decoded [ -- outputStart ] = divmod ( input58 , inputStart , 58 , 256 ) ; if ( input58 [ inputStart ] == 0 ) { ++ inputStart ; // optimization - skip leading zeros } } // Ignore extra leading zeroes that were added during the calculation . while ( outputStart < decoded . length && decoded [ outputStart ] == 0 ) { ++ outputStart ; } // Return decoded data ( including original number of leading zeros ) . return Arrays . copyOfRange ( decoded , outputStart - zeros , decoded . length ) ;
public class AuthEngine { /** * Checks that the " test " array is in the data array starting at the given offset . */ private void checkSubArray ( byte [ ] test , byte [ ] data , int offset ) { } }
Preconditions . checkArgument ( data . length >= test . length + offset ) ; for ( int i = 0 ; i < test . length ; i ++ ) { Preconditions . checkArgument ( test [ i ] == data [ i + offset ] ) ; }
public class DOValidatorSchematron { /** * Run the Schematron validation on a Fedora object . * @ param objectSource * the Fedora object as an StreamSource * @ throws ServerException */ public void validate ( StreamSource objectSource ) throws ServerException { } }
DOValidatorSchematronResult result = null ; try { // Create a transformer that uses the validating stylesheet . // Run the Schematron validation of the Fedora object and // output results in DOM format . Transformer vtransformer = validatingStyleSheet . newTransformer ( ) ; DOMResult validationResult = new DOMResult ( ) ; vtransformer . transform ( objectSource , validationResult ) ; result = new DOValidatorSchematronResult ( validationResult ) ; } catch ( Exception e ) { Validation validation = new Validation ( "unknown" ) ; String problem = "Schematron validation failed:" . concat ( e . getMessage ( ) ) ; validation . setObjectProblems ( Collections . singletonList ( problem ) ) ; logger . error ( "Schematron validation failed" , e ) ; throw new ObjectValidityException ( e . getMessage ( ) , validation ) ; } if ( ! result . isValid ( ) ) { String msg = null ; try { msg = result . getXMLResult ( ) ; } catch ( Exception e ) { logger . warn ( "Error getting XML result of schematron validation failure" , e ) ; } Validation validation = new Validation ( "unknown" ) ; if ( msg == null ) { msg = "Unknown schematron error. Error getting XML results of schematron validation" ; } validation . setObjectProblems ( Collections . singletonList ( msg ) ) ; throw new ObjectValidityException ( msg , validation ) ; }
public class DatabasesInner { /** * Returns database metric definitions . * @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal . * @ param serverName The name of the server . * @ param databaseName The name of the database . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < List < MetricDefinitionInner > > listMetricDefinitionsAsync ( String resourceGroupName , String serverName , String databaseName , final ServiceCallback < List < MetricDefinitionInner > > serviceCallback ) { } }
return ServiceFuture . fromResponse ( listMetricDefinitionsWithServiceResponseAsync ( resourceGroupName , serverName , databaseName ) , serviceCallback ) ;
public class ODataEntity { /** * Get the link with the given rel attribute * @ param rel * rel of link to retrieve * @ return The link if found , null if not . */ public < U extends ODataEntity < ? > > LinkInfo < U > getLink ( String rel ) { } }
for ( Object child : entry . getEntryChildren ( ) ) { LinkType link = linkFromChild ( child ) ; if ( link != null && link . getRel ( ) . equals ( rel ) ) { return new LinkInfo < U > ( link ) ; } } return null ;
public class UpdateServicePrimaryTaskSetRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( UpdateServicePrimaryTaskSetRequest updateServicePrimaryTaskSetRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( updateServicePrimaryTaskSetRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( updateServicePrimaryTaskSetRequest . getCluster ( ) , CLUSTER_BINDING ) ; protocolMarshaller . marshall ( updateServicePrimaryTaskSetRequest . getService ( ) , SERVICE_BINDING ) ; protocolMarshaller . marshall ( updateServicePrimaryTaskSetRequest . getPrimaryTaskSet ( ) , PRIMARYTASKSET_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class BinaryFast { /** * Returns the int [ ] values of the Binary Fast image * @ return int [ ] the greylevel array of the image */ public int [ ] getValues ( ) { } }
int [ ] graylevel = new int [ size ] ; int [ ] values1D = convertToArray ( ) ; for ( int i = 0 ; i < size ; i ++ ) { graylevel [ i ] = values1D [ i ] & 0x000000ff ; } return graylevel ;
public class GetParameterRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetParameterRequest getParameterRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getParameterRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getParameterRequest . getName ( ) , NAME_BINDING ) ; protocolMarshaller . marshall ( getParameterRequest . getWithDecryption ( ) , WITHDECRYPTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class SolrRepositoryConfigExtension { /** * ( non - Javadoc ) * @ see org . springframework . data . repository . config . RepositoryConfigurationExtensionSupport # postProcess ( org . springframework . beans . factory . support . BeanDefinitionBuilder , org . springframework . data . repository . config . XmlRepositoryConfigurationSource ) */ @ Override public void postProcess ( BeanDefinitionBuilder builder , XmlRepositoryConfigurationSource config ) { } }
Element element = config . getElement ( ) ; builder . addPropertyReference ( BeanDefinitionName . SOLR_OPERATIONS . getBeanName ( ) , element . getAttribute ( "solr-template-ref" ) ) ; if ( StringUtils . hasText ( element . getAttribute ( "schema-creation-support" ) ) ) { builder . addPropertyValue ( "schemaCreationSupport" , element . getAttribute ( "schema-creation-support" ) ) ; } builder . addPropertyReference ( BeanDefinitionName . SOLR_MAPPTING_CONTEXT . getBeanName ( ) , "solrMappingContext" ) ; builder . addPropertyReference ( BeanDefinitionName . SOLR_CONVERTER . getBeanName ( ) , "solrConverter" ) ;
public class ResourceName { /** * Creates a new resource name based on given template and path . The path must match the template , * otherwise null is returned . * @ throws ValidationException if the path does not match the template . */ public static ResourceName create ( PathTemplate template , String path ) { } }
ImmutableMap < String , String > values = template . match ( path ) ; if ( values == null ) { throw new ValidationException ( "path '%s' does not match template '%s'" , path , template ) ; } return new ResourceName ( template , values , null ) ;
public class EditText { /** * Called when an attached input method calls * { @ link InputConnection # performEditorAction ( int ) * InputConnection . performEditorAction ( ) } * for this text view . The default implementation will call your action * listener supplied to { @ link # setOnEditorActionListener } , or perform * a standard operation for { @ link EditorInfo # IME _ ACTION _ NEXT * EditorInfo . IME _ ACTION _ NEXT } , { @ link EditorInfo # IME _ ACTION _ PREVIOUS * EditorInfo . IME _ ACTION _ PREVIOUS } , or { @ link EditorInfo # IME _ ACTION _ DONE * EditorInfo . IME _ ACTION _ DONE } . * < p > For backwards compatibility , if no IME options have been set and the * text view would not normally advance focus on enter , then * the NEXT and DONE actions received here will be turned into an enter * key down / up pair to go through the normal key handling . * @ param actionCode The code of the action being performed . * @ see # setOnEditorActionListener */ public void onEditorAction ( int actionCode ) { } }
if ( mAutoCompleteMode == AUTOCOMPLETE_MODE_NONE ) ( ( InternalEditText ) mInputView ) . superOnEditorAction ( actionCode ) ; else if ( mAutoCompleteMode == AUTOCOMPLETE_MODE_SINGLE ) ( ( InternalAutoCompleteTextView ) mInputView ) . superOnEditorAction ( actionCode ) ; else ( ( InternalMultiAutoCompleteTextView ) mInputView ) . superOnEditorAction ( actionCode ) ;
import java . util . * ; import java . util . regex . * ; class GetQuotedValues { /** * This function extracts and returns values enclosed in quotation marks in a given string . * Examples : * get _ quoted _ values ( ' " Python " , " PHP " , " Java " ' ) * [ ' Python ' , ' PHP ' , ' Java ' ] * get _ quoted _ values ( ' " python " , " program " , " language " ' ) * [ ' python ' , ' program ' , ' language ' ] * get _ quoted _ values ( ' " red " , " blue " , " green " , " yellow " ' ) * [ ' red ' , ' blue ' , ' green ' , ' yellow ' ] * Args : * txt ( str ) : a string from which values enclosed in quotation marks are extracted . * Returns : * A list of strings that matches values enclosed in quotation marks within the input string . */ public static List < String > getQuotedValues ( String txt ) { } }
List < String > resultList = new ArrayList < > ( ) ; Pattern pattern = Pattern . compile ( "\"(.*?)\"" ) ; Matcher matcher = pattern . matcher ( txt ) ; while ( matcher . find ( ) ) { resultList . add ( matcher . group ( 1 ) ) ; } return resultList ;
public class StringFunctions { /** * TODO : implement N arguments char concat */ @ Description ( "concatenates given character strings" ) @ ScalarFunction @ LiteralParameters ( { } }
"x" , "y" , "u" } ) @ Constraint ( variable = "u" , expression = "x + y" ) @ SqlType ( "char(u)" ) public static Slice concat ( @ LiteralParameter ( "x" ) Long x , @ SqlType ( "char(x)" ) Slice left , @ SqlType ( "char(y)" ) Slice right ) { int rightLength = right . length ( ) ; if ( rightLength == 0 ) { return left ; } Slice paddedLeft = padSpaces ( left , x . intValue ( ) ) ; int leftLength = paddedLeft . length ( ) ; Slice result = Slices . allocate ( leftLength + rightLength ) ; result . setBytes ( 0 , paddedLeft ) ; result . setBytes ( leftLength , right ) ; return result ;
public class Http { /** * Executes a DELETE request . * @ param url url of resource to delete * @ param connectTimeout connection timeout in milliseconds . * @ param readTimeout read timeout in milliseconds . * @ return { @ link Delete } */ public static Delete delete ( String url , int connectTimeout , int readTimeout ) { } }
try { return new Delete ( url , connectTimeout , readTimeout ) ; } catch ( Exception e ) { throw new HttpException ( "Failed URL: " + url , e ) ; }
public class SimpleLog { /** * - - - - - Initializer */ private static String getStringProperty ( String name ) { } }
String prop = null ; try { prop = System . getProperty ( name ) ; } catch ( SecurityException e ) { // Ignore } return prop == null ? simpleLogProps . getProperty ( name ) : prop ;
public class StatementBuilder { /** * Adds a qualifier { @ link Snak } to the constructed statement . * @ param qualifier * the qualifier to add * @ return builder object to continue construction */ public StatementBuilder withQualifier ( Snak qualifier ) { } }
getQualifierList ( qualifier . getPropertyId ( ) ) . add ( qualifier ) ; return getThis ( ) ;
public class BadgeTextView { /** * if width and height of the view needs to be changed * @ param width new width that needs to be set * @ param height new height that needs to be set */ void setDimens ( int width , int height ) { } }
mAreDimensOverridden = true ; mDesiredWidth = width ; mDesiredHeight = height ; requestLayout ( ) ;
public class CPDefinitionUtil { /** * Returns the last cp definition in the ordered set where CProductId = & # 63 ; and status = & # 63 ; . * @ param CProductId the c product ID * @ param status the status * @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > ) * @ return the last matching cp definition , or < code > null < / code > if a matching cp definition could not be found */ public static CPDefinition fetchByC_S_Last ( long CProductId , int status , OrderByComparator < CPDefinition > orderByComparator ) { } }
return getPersistence ( ) . fetchByC_S_Last ( CProductId , status , orderByComparator ) ;
public class PDF417 { /** * Sets max / min row / col values * @ param maxCols maximum allowed columns * @ param minCols minimum allowed columns * @ param maxRows maximum allowed rows * @ param minRows minimum allowed rows */ public void setDimensions ( int maxCols , int minCols , int maxRows , int minRows ) { } }
this . maxCols = maxCols ; this . minCols = minCols ; this . maxRows = maxRows ; this . minRows = minRows ;
public class HttpRecorderMethod { /** * If a ' Proxy - Connection ' header has been added to the request , * it ' ll be of a ' keep - alive ' type . Until we support ' keep - alives ' , * override the Proxy - Connection setting and instead pass a ' close ' * ( Otherwise every request has to timeout before we notice * end - of - document ) . * @ param method Method to find proxy - connection header in . */ public void handleAddProxyConnectionHeader ( HttpMethod method ) { } }
Header h = method . getRequestHeader ( "Proxy-Connection" ) ; if ( h != null ) { h . setValue ( "close" ) ; method . setRequestHeader ( h ) ; }
public class WalletApplication { /** * This is an optional bean , you can modify Dubbo reference here to change the behavior of consumer */ @ Bean public DubboServiceCustomizationer dubboProviderCustomizationer ( ) { } }
return new DubboServiceCustomizationer ( ) { @ Override public void customDubboService ( BusinessIdentifer businessIdentifer , ServiceConfig < GenericService > serviceConfig ) { Logger logger = LoggerFactory . getLogger ( getClass ( ) ) ; logger . info ( "custom dubbo provider!" ) ; } } ;
public class StringUtils { /** * Convert String to an integer . Parses up to the first non - numeric * character . If no number is found an IllegalArgumentException is thrown * @ param string A String containing an integer . * @ param from The index to start parsing from * @ return an int */ public static int toInt ( String string , int from ) { } }
int val = 0 ; boolean started = false ; boolean minus = false ; for ( int i = from ; i < string . length ( ) ; i ++ ) { char b = string . charAt ( i ) ; if ( b <= ' ' ) { if ( started ) break ; } else if ( b >= '0' && b <= '9' ) { val = val * 10 + ( b - '0' ) ; started = true ; } else if ( b == '-' && ! started ) { minus = true ; } else break ; } if ( started ) return minus ? ( - val ) : val ; throw new NumberFormatException ( string ) ;
public class SvgPathData { /** * Checks an ' A ' command . */ private State checkA ( State state ) throws DatatypeException , IOException { } }
if ( state . context . length ( ) == 0 ) { state = appendToContext ( state ) ; } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; state = skipSpaces ( state ) ; boolean expectNumber = true ; for ( ; ; ) { switch ( state . current ) { default : if ( expectNumber ) reportNonNumber ( 'A' , state . current , state . context ) ; return state ; case '+' : case '-' : case '.' : case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : break ; } state = checkArg ( 'A' , "rx radius" , state ) ; state = skipCommaSpaces ( state ) ; state = checkArg ( 'A' , "ry radius" , state ) ; state = skipCommaSpaces ( state ) ; state = checkArg ( 'A' , "x-axis-rotation" , state ) ; state = skipCommaSpaces ( state ) ; switch ( state . current ) { default : reportUnexpected ( "\u201c0\u201d or \u201c1\u201d for" + " large-arc-flag for \u201cA\u201d" + " command" , state . current , state . context ) ; state = skipSubPath ( state ) ; return state ; case '0' : case '1' : break ; } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; state = skipCommaSpaces ( state ) ; switch ( state . current ) { default : reportUnexpected ( "\u201c0\u201d or \u201c1\u201d for" + " sweep-flag for \u201cA\u201d" + " command" , state . current , state . context ) ; state = skipSubPath ( state ) ; return state ; case '0' : case '1' : break ; } state . current = state . reader . read ( ) ; state = appendToContext ( state ) ; state = skipCommaSpaces ( state ) ; state = checkArg ( 'A' , "x coordinate" , state ) ; state = skipCommaSpaces ( state ) ; state = checkArg ( 'A' , "y coordinate" , state ) ; state = skipCommaSpaces2 ( state ) ; expectNumber = state . skipped ; }
public class DefaultRankCostCalculator { /** * Returns a { @ code SponsorTeam } ' s rank cost . * @ param team * the { @ code SponsorTeam } of which the rank cost will be * calculated * @ return the rank cost of the { @ code SponsorTeam } */ @ Override public final Integer getCost ( final SponsorTeam team ) { } }
Integer valoration ; checkNotNull ( team , "Received a null pointer as the team" ) ; valoration = 0 ; valoration += team . getCoachingDice ( ) * getDieCost ( ) ; valoration += team . getNastySurpriseCards ( ) * getNastySurpriseCardCost ( ) ; valoration += team . getSpecialMoveCards ( ) * getSpecialMoveCost ( ) ; valoration += team . getCheerleaders ( ) * getCheerleaderCost ( ) ; valoration += team . getWagers ( ) * getWagerCost ( ) ; valoration += team . getMediBots ( ) * getMediBotCost ( ) ; return valoration ;
public class XMemcachedClient { /** * ( non - Javadoc ) * @ see net . rubyeye . xmemcached . MemcachedClient # decr ( java . lang . String , int ) */ public final long decr ( String key , final long delta ) throws TimeoutException , InterruptedException , MemcachedException { } }
key = this . preProcessKey ( key ) ; return this . sendIncrOrDecrCommand ( key , delta , 0 , CommandType . DECR , false , this . opTimeout , 0 ) ;
public class AccountsInner { /** * Deletes the specified firewall rule from the specified Data Lake Store account . * @ param resourceGroupName The name of the Azure resource group that contains the Data Lake Store account . * @ param accountName The name of the Data Lake Store account from which to delete the firewall rule . * @ param firewallRuleName The name of the firewall rule to delete . * @ param serviceCallback the async ServiceCallback to handle successful and failed responses . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the { @ link ServiceFuture } object */ public ServiceFuture < Void > deleteFirewallRuleAsync ( String resourceGroupName , String accountName , String firewallRuleName , final ServiceCallback < Void > serviceCallback ) { } }
return ServiceFuture . fromResponse ( deleteFirewallRuleWithServiceResponseAsync ( resourceGroupName , accountName , firewallRuleName ) , serviceCallback ) ;
public class WmsUtilities { /** * Checks if the DPI value is already set for GeoServer . */ private static boolean isDpiSet ( final Multimap < String , String > extraParams ) { } }
String searchKey = "FORMAT_OPTIONS" ; for ( String key : extraParams . keys ( ) ) { if ( key . equalsIgnoreCase ( searchKey ) ) { for ( String value : extraParams . get ( key ) ) { if ( value . toLowerCase ( ) . contains ( "dpi:" ) ) { return true ; } } } } return false ;
public class JSConsumerSet { /** * Because there may be multiple members or the ConsumerSet , if we ' re managing * the active mesage count we must ' reserve ' a space for any message that a consumer * may lock , rather than lock it first then realise that the ConsumerSet has reached * its maximum active message limit and have to unlock it . * Preparing the add of a message will result in the maxActiveMessagePrepareLock being held * until the add succeeds ( committed ) or fails ( rolled back ) . * Normally the lock is held as a read lock unless this add would make the * active message count hit the maximum , in which case a write lock is taken to * ensure any inflight prepares complete first and no new ones can occur until * the outcome of this add is know . This prevents the suspend / resume state of the * ConsumerSet changing while any of the members are halfway through an add . */ public boolean prepareAddActiveMessage ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "prepareAddActiveMessage" ) ; boolean messageAccepted = false ; boolean limitReached = false ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock ) ; // Add us as a reader - this will block if a writer currently holds the lock . maxActiveMessagePrepareReadLock . lock ( ) ; // Lock the actual message counters - to prevent other ' readers ' concurrently making // changes . synchronized ( maxActiveMessageLock ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Active Messages: current: " + currentActiveMessages + ", prepared: " + preparedActiveMessages + ", maximum: " + maxActiveMessages + " (suspended: " + consumerSetSuspended + ")" ) ; // If we ' re already suspended we ' ll simply unlock the prepare and reject the message , // causing the consumer to suspend itself . // Otherwise , we need to check the current number of active messages . . . if ( ! consumerSetSuspended ) { // If adding this message would cause us to reach the limit then we need to // drop out of this synchronize and re - take the prepare lock as a write lock . if ( ( currentActiveMessages + preparedActiveMessages ) == ( maxActiveMessages - 1 ) ) { limitReached = true ; } // Otherwise , we ' re safe to accept the message and add this message to the // prepare counter else { preparedActiveMessages ++ ; messageAccepted = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Prepare added" ) ; } } // If the message hasn ' t been accepted yet ( because we ' re suspended or we // have to take the write lock ) then release the read lock if ( ! messageAccepted ) { maxActiveMessagePrepareReadLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.unlock(): " + maxActiveMessagePrepareLock ) ; } } // synchronize // If this message would cause us to reach the limit then we must take the write // lock to prevent others preparing messages while we ' re in the middle of this // threashold - case . We also need to block until any existing prepares complete to // ensure that we really are on the brink of suspending the set if ( limitReached ) { boolean releaseWriteLock = true ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.lock(): " + maxActiveMessagePrepareLock ) ; // Take the write lock and hold it until the commit / rollback maxActiveMessagePrepareWriteLock . lock ( ) ; // Re - take the active message counter lock synchronized ( maxActiveMessageLock ) { // We could have been suspended between us releasing the locks above // and re - taking them here , if that ' s the case we simply release the // write lock and reject the message add . if ( ! consumerSetSuspended ) { // We ' re not suspended yet so accept this message and add the prepared // message messageAccepted = true ; preparedActiveMessages ++ ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Prepare added" ) ; // If we ' re still in the position where committing this add would make // us hit the limit then we need to hold onto the write lock until the // commit / rollback . if ( ( currentActiveMessages + preparedActiveMessages ) == maxActiveMessages ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "Write lock held until commit/rollback" ) ; releaseWriteLock = false ; } // Otherwise , someone must have got in while we ' d released the locks and // removed one or more of the active messages . In which case this add won ' t // make us hit the limit so we downgrade the prepare lock to a read and release // the write lock once we ' ve done it . else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareReadLock.lock(): " + maxActiveMessagePrepareLock ) ; maxActiveMessagePrepareReadLock . lock ( ) ; } } // If we were told to release the write lock do it now . if ( releaseWriteLock ) { maxActiveMessagePrepareWriteLock . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "maxActiveMessagePrepareWriteLock.unlock(): " + maxActiveMessagePrepareLock ) ; } } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "prepareAddActiveMessage" , Boolean . valueOf ( messageAccepted ) ) ; return messageAccepted ;
public class TableFactor { /** * Product two factors , taking the multiplication at the intersections . * @ param other the other factor to be multiplied * @ return a factor containing the union of both variable sets */ public TableFactor multiply ( TableFactor other ) { } }
// Calculate the result domain List < Integer > domain = new ArrayList < > ( ) ; List < Integer > otherDomain = new ArrayList < > ( ) ; List < Integer > resultDomain = new ArrayList < > ( ) ; for ( int n : neighborIndices ) { domain . add ( n ) ; resultDomain . add ( n ) ; } for ( int n : other . neighborIndices ) { otherDomain . add ( n ) ; if ( ! resultDomain . contains ( n ) ) resultDomain . add ( n ) ; } // Create result TableFactor int [ ] resultNeighborIndices = new int [ resultDomain . size ( ) ] ; int [ ] resultDimensions = new int [ resultNeighborIndices . length ] ; for ( int i = 0 ; i < resultDomain . size ( ) ; i ++ ) { int var = resultDomain . get ( i ) ; resultNeighborIndices [ i ] = var ; // assert consistency about variable size , we can ' t have the same variable with two different sizes assert ( ( getVariableSize ( var ) == 0 && other . getVariableSize ( var ) > 0 ) || ( getVariableSize ( var ) > 0 && other . getVariableSize ( var ) == 0 ) || ( getVariableSize ( var ) == other . getVariableSize ( var ) ) ) ; resultDimensions [ i ] = Math . max ( getVariableSize ( resultDomain . get ( i ) ) , other . getVariableSize ( resultDomain . get ( i ) ) ) ; } TableFactor result = new TableFactor ( resultNeighborIndices , resultDimensions ) ; // OPTIMIZATION : // If we ' re a factor of size 2 receiving a message of size 1 , then we can optimize that pretty heavily // We could just use the general algorithm at the end of this set of special cases , but this is the fastest way if ( otherDomain . size ( ) == 1 && ( resultDomain . size ( ) == domain . size ( ) ) && domain . size ( ) == 2 ) { int msgVar = otherDomain . get ( 0 ) ; int msgIndex = resultDomain . indexOf ( msgVar ) ; if ( msgIndex == 0 ) { for ( int i = 0 ; i < resultDimensions [ 0 ] ; i ++ ) { double d = other . values [ i ] ; int k = i * resultDimensions [ 1 ] ; for ( int j = 0 ; j < resultDimensions [ 1 ] ; j ++ ) { int index = k + j ; result . values [ index ] = values [ index ] + d ; assert ! Double . isNaN ( values [ index ] ) ; } } } else if ( msgIndex == 1 ) { for ( int i = 0 ; i < resultDimensions [ 0 ] ; i ++ ) { int k = i * resultDimensions [ 1 ] ; for ( int j = 0 ; j < resultDimensions [ 1 ] ; j ++ ) { int index = k + j ; result . values [ index ] = values [ index ] + other . values [ j ] ; assert ! Double . isNaN ( values [ index ] ) ; } } } } // OPTIMIZATION : // The special case where we ' re a message of size 1 , and the other factor is receiving the message , and of size 2 else if ( domain . size ( ) == 1 && ( resultDomain . size ( ) == otherDomain . size ( ) ) && resultDomain . size ( ) == 2 ) { return other . multiply ( this ) ; } // Otherwise we follow the big comprehensive , slow general purpose algorithm else { // Calculate back - pointers from the result domain indices to original indices int [ ] mapping = new int [ result . neighborIndices . length ] ; int [ ] otherMapping = new int [ result . neighborIndices . length ] ; for ( int i = 0 ; i < result . neighborIndices . length ; i ++ ) { mapping [ i ] = domain . indexOf ( result . neighborIndices [ i ] ) ; otherMapping [ i ] = otherDomain . indexOf ( result . neighborIndices [ i ] ) ; } // Do the actual joining operation between the two tables , applying ' join ' for each result element . int [ ] assignment = new int [ neighborIndices . length ] ; int [ ] otherAssignment = new int [ other . neighborIndices . length ] ; // OPTIMIZATION : // Rather than use the standard iterator , which creates lots of int [ ] arrays on the heap , which need to be GC ' d , // we use the fast version that just mutates one array . Since this is read once for us here , this is ideal . Iterator < int [ ] > fastPassByReferenceIterator = result . fastPassByReferenceIterator ( ) ; int [ ] resultAssignment = fastPassByReferenceIterator . next ( ) ; while ( true ) { // Set the assignment arrays correctly for ( int i = 0 ; i < resultAssignment . length ; i ++ ) { if ( mapping [ i ] != - 1 ) assignment [ mapping [ i ] ] = resultAssignment [ i ] ; if ( otherMapping [ i ] != - 1 ) otherAssignment [ otherMapping [ i ] ] = resultAssignment [ i ] ; } result . setAssignmentLogValue ( resultAssignment , getAssignmentLogValue ( assignment ) + other . getAssignmentLogValue ( otherAssignment ) ) ; // This mutates the resultAssignment [ ] array , rather than creating a new one if ( fastPassByReferenceIterator . hasNext ( ) ) fastPassByReferenceIterator . next ( ) ; else break ; } } return result ;
public class VersionParser { /** * Try to determine the version number of the operating system by parsing the user agent string . * @ param family * family of the operating system * @ param userAgent * user agent string * @ return extracted version number */ public static VersionNumber parseOperatingSystemVersion ( @ Nonnull final OperatingSystemFamily family , @ Nonnull final String userAgent ) { } }
Check . notNull ( family , "family" ) ; Check . notNull ( userAgent , "userAgent" ) ; final VersionNumber v ; if ( OperatingSystemFamily . ANDROID == family ) { v = identifyAndroidVersion ( userAgent ) ; } else if ( OperatingSystemFamily . BADA == family ) { v = identifyBadaVersion ( userAgent ) ; } else if ( OperatingSystemFamily . BSD == family ) { v = identifyBSDVersion ( userAgent ) ; } else if ( OperatingSystemFamily . IOS == family ) { v = identifyIOSVersion ( userAgent ) ; } else if ( OperatingSystemFamily . JVM == family ) { v = identifyJavaVersion ( userAgent ) ; } else if ( OperatingSystemFamily . OS_X == family ) { v = identifyOSXVersion ( userAgent ) ; } else if ( OperatingSystemFamily . SYMBIAN == family ) { v = identifySymbianVersion ( userAgent ) ; } else if ( OperatingSystemFamily . WEBOS == family ) { v = identifyWebOSVersion ( userAgent ) ; } else if ( OperatingSystemFamily . WINDOWS == family ) { v = identifyWindowsVersion ( userAgent ) ; } else { v = VersionNumber . UNKNOWN ; } return v ;
public class GridGenerator { /** * Method sets the maximal 3d dimensions to given min and max values . */ public void setDimension ( double min , double max ) { } }
this . minx = min ; this . maxx = max ; this . miny = min ; this . maxy = max ; this . minz = min ; this . maxz = max ;
public class VarOptItemsSketch { /** * Creates a copy of the sketch , optionally discarding any information about marks that would * indicate the class ' s use as a union gadget as opposed to a valid sketch . * @ param asSketch If true , copies as a sketch ; if false , copies as a union gadget * @ param adjustedN Target value of n for the resulting sketch . Ignored if negative . * @ return A copy of the sketch . */ VarOptItemsSketch < T > copyAndSetN ( final boolean asSketch , final long adjustedN ) { } }
final VarOptItemsSketch < T > sketch ; sketch = new VarOptItemsSketch < > ( data_ , weights_ , k_ , n_ , currItemsAlloc_ , rf_ , h_ , r_ , totalWtR_ ) ; if ( ! asSketch ) { sketch . marks_ = this . marks_ ; sketch . numMarksInH_ = this . numMarksInH_ ; } if ( adjustedN >= 0 ) { sketch . n_ = adjustedN ; } return sketch ;
public class OptimizationRequestHandler { /** * rPri : = Ax - b */ protected DoubleMatrix1D rPri ( DoubleMatrix1D X ) { } }
if ( getA ( ) == null ) { return F1 . make ( 0 ) ; } return ColtUtils . zMult ( getA ( ) , X , getB ( ) , - 1 ) ;
public class TextBox { /** * Base support for the attribute tag . This is overridden to prevent setting the < code > type < / code > , * and < code > value < / code > attributes . * @ param name The name of the attribute . This value may not be null or the empty string . * @ param value The value of the attribute . This may contain an expression . * @ param facet The name of a facet to which the attribute will be applied . This is optional . * @ throws JspException A JspException may be thrown if there is an error setting the attribute . */ public void setAttribute ( String name , String value , String facet ) throws JspException { } }
if ( name != null ) { if ( name . equals ( TYPE ) || name . equals ( VALUE ) ) { String s = Bundle . getString ( "Tags_AttributeMayNotBeSet" , new Object [ ] { name } ) ; registerTagError ( s , null ) ; } else { if ( name . equals ( DISABLED ) ) { setDisabled ( Boolean . parseBoolean ( value ) ) ; return ; } else if ( name . equals ( READONLY ) ) { _state . readonly = new Boolean ( value ) . booleanValue ( ) ; return ; } else if ( name . equals ( MAXLENGTH ) ) { _state . maxlength = Integer . parseInt ( value ) ; return ; } else if ( name . equals ( SIZE ) ) { _state . size = Integer . parseInt ( value ) ; return ; } } } super . setAttribute ( name , value , facet ) ;
public class RelatedTablesCoreExtension { /** * Determine if the relation type is valid between the base and related * table * @ param baseTableName * base table name * @ param relatedTableName * related table name * @ param relationType * relation type */ private void validateRelationship ( String baseTableName , String relatedTableName , RelationType relationType ) { } }
if ( relationType != null ) { if ( ! geoPackage . isTableType ( relationType . getDataType ( ) , relatedTableName ) ) { throw new GeoPackageException ( "The related table must be a " + relationType . getDataType ( ) + " table. Related Table: " + relatedTableName + ", Type: " + geoPackage . getTableType ( relatedTableName ) ) ; } }
public class MockInternetGatewayController { /** * Delete InternetGateway . * @ param internetgatewayId * internetgatewayId to be deleted * @ return Mock InternetGateway . */ public MockInternetGateway deleteInternetGateway ( final String internetgatewayId ) { } }
if ( internetgatewayId != null && allMockInternetGateways . containsKey ( internetgatewayId ) ) { return allMockInternetGateways . remove ( internetgatewayId ) ; } return null ;
public class DestinationDefinitionImpl { /** * ( non - Javadoc ) * @ see com . ibm . ws . sib . admin . DestinationDefinition # isAuditAllowed ( ) */ public boolean isAuditAllowed ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "isAuditAllowed" , this ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "isAuditAllowed" , Boolean . valueOf ( _isAuditAllowed ) ) ; } return _isAuditAllowed ;
public class GISTreeSetUtil { /** * Compute the union of the building bounds of the given node and the given geolocation . */ private static Rectangle2d union ( AbstractGISTreeSetNode < ? , ? > node , Rectangle2afp < ? , ? , ? , ? , ? , ? > shape ) { } }
final Rectangle2d b = getNodeBuildingBounds ( node ) ; b . setUnion ( shape ) ; normalize ( b , shape ) ; return b ;
public class ProtobufIDLProxy { /** * Gets the proxy class name . * @ param name the name * @ param mappedUniName the mapped uni name * @ param isUniName the is uni name * @ return the proxy class name */ private static String getProxyClassName ( String name , Map < String , String > mappedUniName , boolean isUniName ) { } }
Set < String > emptyPkgs = Collections . emptySet ( ) ; return getProxyClassName ( name , emptyPkgs , mappedUniName , isUniName ) ;
public class DefaultAccountManager { /** * Returns the Account observable */ @ Override public Observable < Account > doLogin ( AuthCredentials credentials ) { } }
return Observable . just ( credentials ) . flatMap ( new Func1 < AuthCredentials , Observable < Account > > ( ) { @ Override public Observable < Account > call ( AuthCredentials credentials ) { try { // Simulate network delay Thread . sleep ( 3000 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } if ( credentials . getUsername ( ) . equals ( "ted" ) && credentials . getPassword ( ) . equals ( "robin" ) ) { currentAccount = new Account ( ) ; return Observable . just ( currentAccount ) ; } return Observable . error ( new LoginException ( ) ) ; } } ) ;
public class LoggingUtil { /** * Static version to log a warning message . * @ param message Warning message , may be null ( defaults to e . getMessage ( ) ) * @ param e causing exception */ public static void warning ( String message , Throwable e ) { } }
if ( message == null && e != null ) { message = e . getMessage ( ) ; } logExpensive ( Level . WARNING , message , e ) ;
public class KeysInner { /** * Retrieve the automation keys for an account . * @ param resourceGroupName Name of an Azure Resource group . * @ param automationAccountName The name of the automation account . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the KeyListResultInner object */ public Observable < KeyListResultInner > listByAutomationAccountAsync ( String resourceGroupName , String automationAccountName ) { } }
return listByAutomationAccountWithServiceResponseAsync ( resourceGroupName , automationAccountName ) . map ( new Func1 < ServiceResponse < KeyListResultInner > , KeyListResultInner > ( ) { @ Override public KeyListResultInner call ( ServiceResponse < KeyListResultInner > response ) { return response . body ( ) ; } } ) ;
public class Solo { /** * Waits for an Activity matching the specified class . Default timeout is 20 seconds . * @ param activityClass the class of the { @ code Activity } to wait for . Example is : { @ code MyActivity . class } * @ return { @ code true } if { @ code Activity } appears before the timeout and { @ code false } if it does not */ public boolean waitForActivity ( Class < ? extends Activity > activityClass ) { } }
if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "waitForActivity(" + activityClass + ")" ) ; } return waiter . waitForActivity ( activityClass , Timeout . getLargeTimeout ( ) ) ;
public class ContactType { /** * Add this field in the Record ' s field sequence . */ public BaseField setupField ( int iFieldSeq ) { } }
BaseField field = null ; // if ( iFieldSeq = = 0) // field = new CounterField ( this , ID , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 1) // field = new RecordChangedField ( this , LAST _ CHANGED , Constants . DEFAULT _ FIELD _ LENGTH , null , null ) ; // field . setHidden ( true ) ; // if ( iFieldSeq = = 2) // field = new BooleanField ( this , DELETED , Constants . DEFAULT _ FIELD _ LENGTH , null , new Boolean ( false ) ) ; // field . setHidden ( true ) ; if ( iFieldSeq == 3 ) field = new StringField ( this , DESCRIPTION , 30 , null , null ) ; if ( iFieldSeq == 4 ) field = new StringField ( this , CODE , 15 , null , null ) ; if ( iFieldSeq == 5 ) field = new ShortField ( this , LEVEL , Constants . DEFAULT_FIELD_LENGTH , null , new Short ( ( short ) 1 ) ) ; if ( iFieldSeq == 6 ) field = new ContactTypeField ( this , PARENT_CONTACT_TYPE_ID , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 7 ) field = new ImageField ( this , ICON , Constants . DEFAULT_FIELD_LENGTH , null , null ) ; if ( iFieldSeq == 8 ) field = new StringField ( this , RECORD_CLASS , 128 , null , null ) ; if ( field == null ) field = super . setupField ( iFieldSeq ) ; return field ;
public class DefaultInteractionListener { /** * / * ( non - Javadoc ) * @ see com . vilt . minium . actions . InteractionListener # onEvent ( com . vilt . minium . actions . InteractionEvent ) */ @ Override public void onEvent ( InteractionEvent event ) { } }
switch ( event . getType ( ) ) { case BEFORE_WAIT : onBeforeWaitEvent ( ( BeforeWaitInteractionEvent ) event ) ; break ; case BEFORE : onBeforeEvent ( ( BeforeInteractionEvent ) event ) ; break ; case AFTER_SUCCESS : onAfterSuccessEvent ( ( AfterSuccessInteractionEvent ) event ) ; onAfterEvent ( ( AfterInteractionEvent ) event ) ; break ; case AFTER_FAIL : onAfterFailEvent ( ( AfterFailInteractionEvent ) event ) ; onAfterEvent ( ( AfterInteractionEvent ) event ) ; break ; }
public class ExtensionManager { /** * Update an existing plugin with modified information If * < code > extension < / code > is null then a < code > NullPointerException < / code > is * thrown . * @ param extension The extension object with updated information * @ throws RemoteException * @ throws RuntimeFault * @ throws NotFound either because of the web service itself , or because of the * service provider unable to handle the request . */ public void updateExtension ( Extension extension ) throws NotFound , RuntimeFault , RemoteException { } }
if ( extension == null ) { throw new NullPointerException ( ) ; } encodeUrl ( extension ) ; getVimService ( ) . updateExtension ( getMOR ( ) , extension ) ;
public class Conversions { /** * Convert a string to a big decimal . * @ param value value to convert * @ return converted value , or < code > null < / code > if the supplied value was < code > null < / code > * @ throws IllegalArgumentException if the supplied value could not be parsed */ static BigDecimal decimal ( String value ) { } }
BigDecimal result ; if ( value != null ) { value = value . trim ( ) ; Matcher matcher = DECIMAL_PATTERN . matcher ( value ) ; if ( matcher . matches ( ) ) { result = new BigDecimal ( matcher . group ( 1 ) ) ; } else { throw new IllegalArgumentException ( "Unknown format for value: " + value ) ; } } else { result = null ; } return result ;
public class ClientConnection { /** * Save statistics to a CSV file . * @ param file * File path * @ throws IOException */ public void saveStatistics ( String file ) throws IOException { } }
if ( file != null && ! file . trim ( ) . isEmpty ( ) ) { FileWriter fw = new FileWriter ( file ) ; fw . write ( getStatistics ( ) . toRawString ( ',' ) ) ; fw . flush ( ) ; fw . close ( ) ; }
public class Ifc2x3tc1PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ public EClass getIfcLoop ( ) { } }
if ( ifcLoopEClass == null ) { ifcLoopEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc2x3tc1Package . eNS_URI ) . getEClassifiers ( ) . get ( 303 ) ; } return ifcLoopEClass ;
public class AuthleteApiFactory { /** * Create an instance of { @ link AuthleteApi } . * This method repeats to call { @ link # create ( AuthleteConfiguration , String ) } * until one of the known classes is successfully instantiated . * The classes listed below are the ones that the current implementation knows . * < ol > * < li > < code > com . authlete . jaxrs . api . AuthleteApiImpl < / code > < br / > * ( using JAX - RS 2.0 API , contained in < code > com . authlete : authlete - java - jaxrs < / code > ) * < li > < code > com . authlete . common . api . AuthleteApiImpl < / code > < br / > * ( using { @ link java . net . HttpURLConnection HttpURLConnection } , contained in < code > com . authlete : authlete - java - common < / code > since version 2.0) * < / ol > * @ param configuration * Authlete configuration . * @ return * An instance of { @ link AuthleteApi } . If none of the known classes * that implement { @ code AuthleteApi } interface was successfully * instantiated , { @ code null } is returned . */ public static AuthleteApi create ( AuthleteConfiguration configuration ) { } }
for ( String className : sKnownImpls ) { try { return create ( configuration , className ) ; } catch ( Exception e ) { // Ignore . } } // No implementation was found . return null ;
public class BitcointoyouMarketDataServiceRaw { /** * List all public trades made at Bitcointoyou Exchange . * @ param currencyPair the trade currency pair * @ return an array of { @ link BitcointoyouPublicTrade } * @ throws IOException */ BitcointoyouPublicTrade [ ] getBitcointoyouPublicTrades ( CurrencyPair currencyPair ) throws IOException { } }
try { return getBitcointoyouPublicTrades ( currencyPair , null , null ) ; } catch ( BitcointoyouException e ) { throw new ExchangeException ( e . getError ( ) ) ; }
public class GetServiceRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( GetServiceRequest getServiceRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( getServiceRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( getServiceRequest . getId ( ) , ID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class AccSessionFactoryImpl { /** * App Session Factory - - - - - */ @ Override public AppSession getSession ( String sessionId , Class < ? extends AppSession > aClass ) { } }
if ( sessionId == null ) { throw new IllegalArgumentException ( "SessionId must not be null" ) ; } if ( ! this . iss . exists ( sessionId ) ) { return null ; } AppSession appSession = null ; try { if ( aClass == ClientAccSession . class ) { IClientAccSessionData data = ( IClientAccSessionData ) this . sessionDataFactory . getAppSessionData ( ClientAccSession . class , sessionId ) ; ClientAccSessionImpl clientSession = new ClientAccSessionImpl ( data , sessionFactory , getClientSessionListener ( ) , getClientContextListener ( ) , getStateListener ( ) ) ; clientSession . getSessions ( ) . get ( 0 ) . setRequestListener ( clientSession ) ; appSession = clientSession ; } else if ( aClass == ServerAccSession . class ) { ServerAccSessionImpl serverSession = null ; IServerAccSessionData data = ( IServerAccSessionData ) this . sessionDataFactory . getAppSessionData ( ServerAccSession . class , sessionId ) ; // here we use shorter con , since some data is already present . serverSession = new ServerAccSessionImpl ( data , sessionFactory , getServerSessionListener ( ) , getServerContextListener ( ) , getStateListener ( ) ) ; serverSession . getSessions ( ) . get ( 0 ) . setRequestListener ( serverSession ) ; appSession = serverSession ; } else { throw new IllegalArgumentException ( "Wrong session class: " + aClass + ". Supported[" + ClientAccSession . class + "," + ServerAccSession . class + "]" ) ; } } catch ( Exception e ) { logger . error ( "Failure to obtain new Accounting Session." , e ) ; } return appSession ;
public class Configuration { /** * Get the SQL type name for the given java type * @ param type java type * @ return SQL type name */ public String getTypeName ( Class < ? > type ) { } }
Integer jdbcType = jdbcTypeMapping . get ( type ) ; if ( jdbcType == null ) { jdbcType = javaTypeMapping . getType ( type ) . getSQLTypes ( ) [ 0 ] ; } return templates . getTypeNameForCode ( jdbcType ) ;
public class JnlpDownloadServletMojo { /** * Resolve artifact of incoming jar resources ( user configured ones ) , check their main class . * If must include transitive dependencies , collect them and wrap them as new jar resources . * For each collected jar resource , copy his artifact file to lib directory ( if it has changed ) , * fill also his hrefValue if required ( jar resource with outputJarVersion filled ) . * @ param configuredJarResources list of configured jar resources * @ param commonJarResources list of resolved common jar resources ( null when resolving common jar resources ) * @ return the set of resolved jar resources * @ throws MojoExecutionException if something bas occurs while retrieving resources */ private Set < ResolvedJarResource > resolveJarResources ( Collection < JarResource > configuredJarResources , Set < ResolvedJarResource > commonJarResources ) throws MojoExecutionException { } }
Set < ResolvedJarResource > collectedJarResources = new LinkedHashSet < > ( ) ; if ( commonJarResources != null ) { collectedJarResources . addAll ( commonJarResources ) ; } ArtifactUtil artifactUtil = getArtifactUtil ( ) ; // artifacts resolved from repositories Set < Artifact > artifacts = new LinkedHashSet < > ( ) ; // sibling projects hit from a jar resources ( need a special transitive resolution ) Set < MavenProject > siblingProjects = new LinkedHashSet < > ( ) ; // for each configured JarResource , create and resolve the corresponding artifact and // check it for the mainClass if specified for ( JarResource jarResource : configuredJarResources ) { Artifact artifact = artifactUtil . createArtifact ( jarResource ) ; // first try to resolv from reactor MavenProject siblingProject = artifactUtil . resolveFromReactor ( artifact , getProject ( ) , reactorProjects ) ; if ( siblingProject == null ) { // try to resolve from repositories artifactUtil . resolveFromRepositories ( artifact , getRemoteRepositories ( ) , getLocalRepository ( ) ) ; artifacts . add ( artifact ) ; } else { artifact = siblingProject . getArtifact ( ) ; siblingProjects . add ( siblingProject ) ; artifacts . add ( artifact ) ; artifact . setResolved ( true ) ; } if ( StringUtils . isNotBlank ( jarResource . getMainClass ( ) ) ) { // check main class if ( artifact == null ) { throw new IllegalStateException ( "Implementation Error: The given jarResource cannot be checked for " + "a main class until the underlying artifact has been resolved: [" + jarResource + "]" ) ; } boolean containsMainClass = artifactUtil . artifactContainsClass ( artifact , jarResource . getMainClass ( ) ) ; if ( ! containsMainClass ) { throw new MojoExecutionException ( "The jar specified by the following jarResource does not contain the declared main class:" + jarResource ) ; } } ResolvedJarResource resolvedJarResource = new ResolvedJarResource ( jarResource , artifact ) ; getLog ( ) . debug ( "Add jarResource (configured): " + jarResource ) ; collectedJarResources . add ( resolvedJarResource ) ; } if ( ! isExcludeTransitive ( ) ) { // prepare artifact filter AndArtifactFilter artifactFilter = new AndArtifactFilter ( ) ; // restricts to runtime and compile scope artifactFilter . add ( new ScopeArtifactFilter ( Artifact . SCOPE_RUNTIME ) ) ; // restricts to not pom dependencies artifactFilter . add ( new InversionArtifactFilter ( new TypeArtifactFilter ( "pom" ) ) ) ; // get all transitive dependencies Set < Artifact > transitiveArtifacts = getArtifactUtil ( ) . resolveTransitively ( artifacts , siblingProjects , getProject ( ) . getArtifact ( ) , getLocalRepository ( ) , getRemoteRepositories ( ) , artifactFilter , getProject ( ) . getManagedVersionMap ( ) ) ; // for each transitive dependency , wrap it in a JarResource and add it to the collection of // existing jar resources ( if not already in ) for ( Artifact resolvedArtifact : transitiveArtifacts ) { ResolvedJarResource newJarResource = new ResolvedJarResource ( resolvedArtifact ) ; if ( ! collectedJarResources . contains ( newJarResource ) ) { getLog ( ) . debug ( "Add jarResource (transitive): " + newJarResource ) ; collectedJarResources . add ( newJarResource ) ; } } } // for each JarResource , copy its artifact to the lib directory if necessary for ( ResolvedJarResource jarResource : collectedJarResources ) { Artifact artifact = jarResource . getArtifact ( ) ; String filenameWithVersion = getDependencyFilenameStrategy ( ) . getDependencyFilename ( artifact , false , isUseUniqueVersions ( ) ) ; boolean copied = copyJarAsUnprocessedToDirectoryIfNecessary ( artifact . getFile ( ) , getLibDirectory ( ) , filenameWithVersion ) ; if ( copied ) { String name = artifact . getFile ( ) . getName ( ) ; verboseLog ( "Adding " + name + " to modifiedJnlpArtifacts list." ) ; getModifiedJnlpArtifacts ( ) . add ( name . substring ( 0 , name . lastIndexOf ( '.' ) ) ) ; } String filename = getDependencyFilenameStrategy ( ) . getDependencyFilename ( artifact , jarResource . isOutputJarVersion ( ) ? null : false , isUseUniqueVersions ( ) ) ; jarResource . setHrefValue ( filename ) ; } return collectedJarResources ;
public class BaseTraceService { /** * Route only trace log records . Messages including Systemout , err will not be routed to trace source to avoid duplicate entries */ protected boolean invokeTraceRouters ( RoutedMessage routedTrace ) { } }
boolean retMe = true ; LogRecord logRecord = routedTrace . getLogRecord ( ) ; /* * Avoid any feedback traces that are emitted after this point . * The first time the counter increments is the first pass - through . * The second time the counter increments is the second pass - through due * to trace emitted . We do not want any more pass - throughs . */ try { if ( ! ( counterForTraceRouter . incrementCount ( ) > 2 ) ) { if ( logRecord != null ) { Level level = logRecord . getLevel ( ) ; int levelValue = level . intValue ( ) ; if ( levelValue < Level . INFO . intValue ( ) ) { String levelName = level . getName ( ) ; if ( ! ( levelName . equals ( "SystemOut" ) || levelName . equals ( "SystemErr" ) ) ) { // SystemOut / Err = 700 WsTraceRouter internalTrRouter = internalTraceRouter . get ( ) ; if ( internalTrRouter != null ) { retMe &= internalTrRouter . route ( routedTrace ) ; } else if ( earlierTraces != null ) { synchronized ( this ) { if ( earlierTraces != null ) { earlierTraces . add ( routedTrace ) ; } } } } } } } } finally { counterForTraceRouter . decrementCount ( ) ; } return retMe ;
public class HeapPriorityQueueSet { /** * In contrast to the superclass and to maintain set semantics , removal here is based on comparing the given element * via { @ link # equals ( Object ) } . * @ return < code > true < / code > if the operation changed the head element or if is it unclear if the head element changed . * Only returns < code > false < / code > iff the head element was not changed by this operation . */ @ Override public boolean remove ( @ Nonnull T toRemove ) { } }
T storedElement = getDedupMapForElement ( toRemove ) . remove ( toRemove ) ; return storedElement != null && super . remove ( storedElement ) ;
public class AmazonElasticLoadBalancingClient { /** * Associates the specified security groups with the specified Application Load Balancer . The specified security * groups override the previously associated security groups . * You can ' t specify a security group for a Network Load Balancer . * @ param setSecurityGroupsRequest * @ return Result of the SetSecurityGroups operation returned by the service . * @ throws LoadBalancerNotFoundException * The specified load balancer does not exist . * @ throws InvalidConfigurationRequestException * The requested configuration is not valid . * @ throws InvalidSecurityGroupException * The specified security group does not exist . * @ sample AmazonElasticLoadBalancing . SetSecurityGroups * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / elasticloadbalancingv2-2015-12-01 / SetSecurityGroups " * target = " _ top " > AWS API Documentation < / a > */ @ Override public SetSecurityGroupsResult setSecurityGroups ( SetSecurityGroupsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeSetSecurityGroups ( request ) ;
public class UnionBasedQueryMergerImpl { /** * When such substitution DO NOT EXIST , returns an EMPTY OPTIONAL . * When NO renaming is NEEDED returns an EMPTY SUBSTITUTION . */ private Optional < InjectiveVar2VarSubstitution > computeRenamingSubstitution ( DistinctVariableOnlyDataAtom sourceProjectionAtom , DistinctVariableOnlyDataAtom targetProjectionAtom ) { } }
int arity = sourceProjectionAtom . getEffectiveArity ( ) ; if ( ! sourceProjectionAtom . getPredicate ( ) . equals ( targetProjectionAtom . getPredicate ( ) ) || ( arity != targetProjectionAtom . getEffectiveArity ( ) ) ) { return Optional . empty ( ) ; } else { ImmutableMap < Variable , Variable > newMap = FunctionalTools . zip ( sourceProjectionAtom . getArguments ( ) , targetProjectionAtom . getArguments ( ) ) . stream ( ) . distinct ( ) . filter ( e -> ! e . getKey ( ) . equals ( e . getValue ( ) ) ) . collect ( ImmutableCollectors . toMap ( ) ) ; return Optional . of ( substitutionFactory . getInjectiveVar2VarSubstitution ( newMap ) ) ; }
public class FilterBlur { /** * Create a blur kernel . * @ param radius The blur radius . * @ param width The image width . * @ param height The image height . * @ return The blur kernel . */ private static Kernel createKernel ( float radius , int width , int height ) { } }
final int r = ( int ) Math . ceil ( radius ) ; final int rows = r * 2 + 1 ; final float [ ] matrix = new float [ rows ] ; final float sigma = radius / 3 ; final float sigma22 = 2 * sigma * sigma ; final float sigmaPi2 = ( float ) ( 2 * Math . PI * sigma ) ; final float sqrtSigmaPi2 = ( float ) Math . sqrt ( sigmaPi2 ) ; final float radius2 = radius * radius ; float total = 0.0F ; int index = 0 ; for ( int row = - r ; row <= r ; row ++ ) { final float distance = row * ( float ) row ; if ( distance > radius2 ) { matrix [ index ] = 0 ; } else { matrix [ index ] = ( float ) Math . exp ( - distance / sigma22 ) / sqrtSigmaPi2 ; } total += matrix [ index ] ; index ++ ; } for ( int i = 0 ; i < rows ; i ++ ) { matrix [ i ] /= total ; } final float [ ] data = new float [ width * height ] ; System . arraycopy ( matrix , 0 , data , 0 , rows ) ; return new Kernel ( rows , data ) ;
public class MACNumber { /** * Join the specified MAC numbers to reply a string . * @ param addresses is the list of mac addresses to join . * @ return the joined string . */ @ Pure public static String join ( MACNumber ... addresses ) { } }
if ( ( addresses == null ) || ( addresses . length == 0 ) ) { return null ; } final StringBuilder buf = new StringBuilder ( ) ; for ( final MACNumber number : addresses ) { if ( buf . length ( ) > 0 ) { buf . append ( MACNUMBER_SEPARATOR ) ; } buf . append ( number ) ; } return buf . toString ( ) ;
public class Utility { /** * Are these two numbers effectively equal ? * The same logic is applied for each of the 3 vector dimensions : see { @ link # equal } * @ param v1 * @ param v2 */ public static boolean equal ( Vector3f v1 , Vector3f v2 ) { } }
return equal ( v1 . x , v2 . x ) && equal ( v1 . y , v2 . y ) && equal ( v1 . z , v2 . z ) ;
public class Status { /** * Method to initialize the Cache of this CacheObjectInterface . * @ param _ class class that called the method * @ throws CacheReloadException on error */ public static void initialize ( final Class < ? > _class ) throws CacheReloadException { } }
if ( InfinispanCache . get ( ) . exists ( Status . UUIDCACHE4GRP ) ) { InfinispanCache . get ( ) . < UUID , Status > getCache ( Status . UUIDCACHE4GRP ) . clear ( ) ; } else { InfinispanCache . get ( ) . < UUID , Status > getCache ( Status . UUIDCACHE4GRP ) . addListener ( new CacheLogListener ( Status . LOG ) ) ; } if ( InfinispanCache . get ( ) . exists ( Status . IDCACHE4STATUS ) ) { InfinispanCache . get ( ) . < Long , Status > getCache ( Status . IDCACHE4STATUS ) . clear ( ) ; } else { InfinispanCache . get ( ) . < Long , Status > getCache ( Status . IDCACHE4STATUS ) . addListener ( new CacheLogListener ( Status . LOG ) ) ; } if ( InfinispanCache . get ( ) . exists ( Status . NAMECACHE4GRP ) ) { InfinispanCache . get ( ) . < String , StatusGroup > getCache ( Status . NAMECACHE4GRP ) . clear ( ) ; } else { InfinispanCache . get ( ) . < String , StatusGroup > getCache ( Status . NAMECACHE4GRP ) . addListener ( new CacheLogListener ( Status . LOG ) ) ; }
public class AnimatorModel { /** * Check state in playing case . */ private void checkStatePlaying ( ) { } }
if ( ! reverse ) { if ( repeat ) { state = AnimState . PLAYING ; current = first ; } else { state = AnimState . FINISHED ; } } else { state = AnimState . REVERSING ; }
public class WebApp { /** * Add a listener . * @ param listener to add * @ throws NullArgumentException if listener or listener class is null */ public void addListener ( final WebAppListener listener ) { } }
NullArgumentException . validateNotNull ( listener , "Listener" ) ; NullArgumentException . validateNotNull ( listener . getListenerClass ( ) , "Listener class" ) ; if ( ! listeners . contains ( listener ) ) { listeners . add ( listener ) ; }
public class JdbcRow { /** * Returns the column as a boolean . * @ param index 1 - based * @ return column as a boolean */ public boolean getBoolean ( int index ) { } }
Object value = _values [ index - 1 ] ; if ( value instanceof Boolean ) { return ( Boolean ) value ; } else { return Boolean . valueOf ( value . toString ( ) ) ; }
public class LRFUEvictor { /** * This function is used to update CRF of all the blocks according to current logic time . When * some block is accessed in some time , only CRF of that block itself will be updated to current * time , other blocks who are not accessed recently will only be updated until * { @ link # freeSpaceWithView ( long , BlockStoreLocation , BlockMetadataManagerView ) } is called * because blocks need to be sorted in the increasing order of CRF . When this function is called , * { @ link # mBlockIdToLastUpdateTime } and { @ link # mBlockIdToCRFValue } need to be locked in case * of the changing of values . */ private void updateCRFValue ( ) { } }
long currentLogicTime = mLogicTimeCount . get ( ) ; for ( Entry < Long , Double > entry : mBlockIdToCRFValue . entrySet ( ) ) { long blockId = entry . getKey ( ) ; double crfValue = entry . getValue ( ) ; mBlockIdToCRFValue . put ( blockId , crfValue * calculateAccessWeight ( currentLogicTime - mBlockIdToLastUpdateTime . get ( blockId ) ) ) ; mBlockIdToLastUpdateTime . put ( blockId , currentLogicTime ) ; }
public class NamespaceContextImpl { /** * { @ inheritDoc } */ public String getPrefix ( String namespaceURI ) { } }
if ( namespaceURI == null ) { throw new IllegalArgumentException ( "null namespaceURI not allowed." ) ; } for ( String prefix : prefix2ns . keySet ( ) ) { if ( prefix2ns . get ( prefix ) . equals ( namespaceURI ) ) { return prefix ; } } return null ;
public class FilePermissions { /** * Check whether the current process can create a directory at the specified path . This is useful * for providing immediate feedback to an end user that a path they have selected or typed may not * be suitable before attempting to create the directory ; e . g . in a tooltip . * @ param path tentative location for directory * @ throws AccessDeniedException if a directory in the path is not writable * @ throws NotDirectoryException if a segment of the path is a file */ public static void verifyDirectoryCreatable ( Path path ) throws AccessDeniedException , NotDirectoryException { } }
Preconditions . checkNotNull ( path , "Null directory path" ) ; for ( Path segment = path ; segment != null ; segment = segment . getParent ( ) ) { if ( Files . exists ( segment ) ) { if ( Files . isDirectory ( segment ) ) { // Can ' t create a directory if the bottom most currently existing directory in // the path is not writable . if ( ! Files . isWritable ( segment ) ) { throw new AccessDeniedException ( segment + " is not writable" ) ; } } else { // Can ' t create a directory if a non - directory file already exists with that name // somewhere in the path . throw new NotDirectoryException ( segment + " is a file" ) ; } break ; } }
public class JsonConfigReader { /** * Reads configuration file , parameterizes its content and converts it into JSON * object . * @ param correlationId ( optional ) transaction id to trace execution through * call chain . * @ param parameters values to parameters the configuration . * @ return a JSON object with configuration . * @ throws ApplicationException when error occured . */ public Object readObject ( String correlationId , ConfigParams parameters ) throws ApplicationException { } }
if ( _path == null ) throw new ConfigException ( correlationId , "NO_PATH" , "Missing config file path" ) ; try { Path path = Paths . get ( _path ) ; String json = new String ( Files . readAllBytes ( path ) ) ; json = parameterize ( json , parameters ) ; return jsonMapper . readValue ( json , typeRef ) ; } catch ( Exception ex ) { throw new FileException ( correlationId , "READ_FAILED" , "Failed reading configuration " + _path + ": " + ex ) . withDetails ( "path" , _path ) . withCause ( ex ) ; }
public class CrossTab { /** * Returns a table containing two - dimensional cross - tabulated counts for each combination of values in * { @ code column1 } and { @ code column2} * @ param table The table we ' re deriving the counts from * @ param column1 A column in { @ code table } * @ param column2 Another column in { @ code table } * @ return A table containing the cross - tabs */ public static Table counts ( Table table , CategoricalColumn < ? > column1 , CategoricalColumn < ? > column2 ) { } }
Table t = Table . create ( "Crosstab Counts: " + column1 . name ( ) + " x " + column2 . name ( ) ) ; t . addColumns ( column1 . type ( ) . create ( LABEL_COLUMN_NAME ) ) ; Table temp = table . sortOn ( column1 . name ( ) , column2 . name ( ) ) ; int colIndex1 = table . columnIndex ( column1 . name ( ) ) ; int colIndex2 = table . columnIndex ( column2 . name ( ) ) ; com . google . common . collect . Table < String , String , Integer > gTable = TreeBasedTable . create ( ) ; String a ; String b ; for ( int row = 0 ; row < table . rowCount ( ) ; row ++ ) { a = temp . column ( colIndex1 ) . getString ( row ) ; b = temp . column ( colIndex2 ) . getString ( row ) ; Integer cellValue = gTable . get ( a , b ) ; Integer value ; if ( cellValue != null ) { value = cellValue + 1 ; } else { value = 1 ; } gTable . put ( a , b , value ) ; } for ( String colName : gTable . columnKeySet ( ) ) { t . addColumns ( IntColumn . create ( colName ) ) ; } t . addColumns ( IntColumn . create ( "total" ) ) ; int [ ] columnTotals = new int [ t . columnCount ( ) ] ; for ( String rowKey : gTable . rowKeySet ( ) ) { t . column ( 0 ) . appendCell ( rowKey ) ; int rowSum = 0 ; for ( String colKey : gTable . columnKeySet ( ) ) { Integer cellValue = gTable . get ( rowKey , colKey ) ; if ( cellValue != null ) { int colIdx = t . columnIndex ( colKey ) ; t . intColumn ( colIdx ) . append ( cellValue ) ; rowSum += cellValue ; columnTotals [ colIdx ] = columnTotals [ colIdx ] + cellValue ; } else { t . intColumn ( colKey ) . append ( 0 ) ; } } t . intColumn ( t . columnCount ( ) - 1 ) . append ( rowSum ) ; } if ( t . column ( 0 ) . type ( ) . equals ( ColumnType . STRING ) ) { t . column ( 0 ) . appendCell ( "Total" ) ; } else { t . column ( 0 ) . appendCell ( "" ) ; } int grandTotal = 0 ; for ( int i = 1 ; i < t . columnCount ( ) - 1 ; i ++ ) { t . intColumn ( i ) . append ( columnTotals [ i ] ) ; grandTotal = grandTotal + columnTotals [ i ] ; } t . intColumn ( t . columnCount ( ) - 1 ) . append ( grandTotal ) ; return t ;
public class Colorization { /** * Adjusts the supplied color by the offsets in this colorization , taking the appropriate * measures for hue ( wrapping it around ) and saturation and value ( clipping ) . * @ return the RGB value of the recolored color . */ public int recolorColor ( float [ ] hsv ) { } }
// hue will be wrapped - around by HSBtoRGB , we don ' t need to do it float hue = hsv [ 0 ] + offsets [ 0 ] ; // the others we must clip float sat = Math . min ( Math . max ( hsv [ 1 ] + offsets [ 1 ] , 0 ) , 1 ) ; float val = Math . min ( Math . max ( hsv [ 2 ] + offsets [ 2 ] , 0 ) , 1 ) ; // convert back to RGB space return Color . HSBtoRGB ( hue , sat , val ) ;