signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class BackendlessSerializer { /** * Returns serialized object from cache or serializes object if it ' s not present in cache .
* @ param entityEntryValue object to be serialized
* @ return Map formed from given object */
private Object getOrMakeSerializedObject ( Object entityEntryValue , Map < Object , Map < String , Object > > serializedCache ) { } } | if ( serializedCache . containsKey ( entityEntryValue ) ) // cyclic relation
{ // take from cache and substitute
return serializedCache . get ( entityEntryValue ) ; } else // not cyclic relation
{ // serialize and put into result
return serializeToMap ( entityEntryValue , serializedCache ) ; } |
public class Resolver { /** * Resolves a subject BelTerm , relationship type , and object BelTerm to a
* { @ link KamEdge } , if it exists within the { @ link Kam } . If it does not
* exist then a < tt > null < / tt > is returned .
* This resolve operation must resolve both the < tt > subjectBelTerm < / tt > and
* < tt > objectBelTerm < / tt > to a { @ link KamNode } in order to find a
* { @ link KamEdge } .
* @ param kam { @ link Kam } , the kam to resolve into , which cannot be null
* @ param kAMStore { @ link KAMStore } , the KAM store to use in resolving
* the BelTerms and Edge , which cannot be null
* @ param subject { @ link String } , the subject BelTerm to resolve to
* a { @ link KamNode } , which cannot be null
* @ param r { @ link RelationshipType } , the relationship type of the
* edge to resolve , which cannot be null
* @ param object { @ link String } , the object BelTerm to resolve to a
* { @ link KamNode } , which cannot be null
* @ return the resolved { @ link KamEdge } in < tt > kam < / tt > , or < tt > null < / tt >
* if the edge does not exist
* @ throws InvalidArgument Thrown when a parameter is { @ code null }
* @ throws ResolverException Thrown if an error occurred resolving the
* BelTerm ; exceptions will be wrapped */
public KamEdge resolve ( final Kam kam , final KAMStore kAMStore , final String subject , final RelationshipType r , final String object , Map < String , String > nsmap , Equivalencer eq ) throws ResolverException { } } | if ( nulls ( kam , kAMStore , subject , r , object , eq ) ) { throw new InvalidArgument ( "null parameter(s) provided to resolve API." ) ; } // resolve subject bel term to kam node .
final KamNode subjectKamNode = resolve ( kam , kAMStore , subject , nsmap , eq ) ; if ( subjectKamNode == null ) return null ; // resolve object bel term to kam node .
final KamNode objectKamNode = resolve ( kam , kAMStore , object , nsmap , eq ) ; if ( objectKamNode == null ) return null ; // only resolve edge if kam nodes resolved
return resolveEdge ( kam , subjectKamNode , r , objectKamNode ) ; |
public class JSONObject { /** * get JSONArray value .
* @ param key key .
* @ return value or default value . */
public JSONArray getArray ( String key ) { } } | Object tmp = objectMap . get ( key ) ; return tmp == null ? null : tmp instanceof JSONArray ? ( JSONArray ) tmp : null ; |
public class VectorUtil { /** * Compute the dot product of the angle between two vectors .
* @ param v1 first vector
* @ param v2 second vector
* @ return Dot product */
public static double dot ( NumberVector v1 , NumberVector v2 ) { } } | // Java Hotspot appears to optimize these better than if - then - else :
return v1 instanceof SparseNumberVector ? v2 instanceof SparseNumberVector ? dotSparse ( ( SparseNumberVector ) v1 , ( SparseNumberVector ) v2 ) : dotSparseDense ( ( SparseNumberVector ) v1 , v2 ) : v2 instanceof SparseNumberVector ? dotSparseDense ( ( SparseNumberVector ) v2 , v1 ) : dotDense ( v1 , v2 ) ; |
public class OptimizedSIXAResourceProxy { /** * Release a " reader " lock on the close synchronization primative . */
private void releaseCloseLock ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "releaseCloseLock" ) ; closeLock . readLock ( ) . unlock ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "releaseCloseLock" ) ; |
public class Base64 { /** * Encode string value into Base64 format .
* @ param string string to encode .
* @ return given < code > string < / code > value encoded Base64. */
public static String encode ( String string ) { } } | try { return encode ( string . getBytes ( "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { throw new BugError ( "JVM with missing support for UTF-8." ) ; } |
public class JTSGeometryExpression { /** * Returns a geometric object that represents all Points whose distance from this geometric
* object is less than or equal to distance . Calculations are in the spatial reference system
* of this geometric object . Because of the limitations of linear interpolation , there will
* often be some relatively small error in this distance , but it should be near the resolution
* of the coordinates used .
* @ param distance distance
* @ return buffer */
public JTSGeometryExpression < Geometry > buffer ( double distance ) { } } | return JTSGeometryExpressions . geometryOperation ( SpatialOps . BUFFER , mixin , ConstantImpl . create ( distance ) ) ; |
public class Grid { /** * Converts a { @ link HttpResponse } into a { @ link JSONObject }
* @ param resp
* A { @ link HttpResponse } obtained from executing a request against a host
* @ return An object of type { @ link JSONObject }
* @ throws IOException
* @ throws JSONException */
private static JSONObject extractObject ( HttpResponse resp ) throws IOException , JSONException { } } | logger . entering ( resp ) ; BufferedReader rd = new BufferedReader ( new InputStreamReader ( resp . getEntity ( ) . getContent ( ) ) ) ; StringBuilder s = new StringBuilder ( ) ; String line ; while ( ( line = rd . readLine ( ) ) != null ) { s . append ( line ) ; } rd . close ( ) ; JSONObject objToReturn = new JSONObject ( s . toString ( ) ) ; logger . exiting ( objToReturn ) ; return objToReturn ; |
public class GenericsResolutionUtils { /** * Resolve type generics by declaration ( as upper bound ) . Used for cases when actual generic definition is not
* available ( so actual generics are unknown ) . In most cases such generics resolved as Object
* ( for example , { @ code Some < T > } ) .
* If class is inner class , resolve outer class generics ( which may be used in class )
* @ param type class to analyze generics for
* @ return resolved generics ( including outer class generics ) or empty map if not generics used
* @ see # resolveDirectRawGenerics ( Class ) to resolve without outer type */
public static LinkedHashMap < String , Type > resolveRawGenerics ( final Class < ? > type ) { } } | // inner class can use outer class generics
return fillOuterGenerics ( type , resolveDirectRawGenerics ( type ) , null ) ; |
public class ProcComm { /** * Creates a medium settings type for the supplied medium identifier .
* @ param id a medium identifier from command line option
* @ return medium settings object
* @ throws KNXIllegalArgumentException on unknown medium identifier */
private static KNXMediumSettings getMedium ( String id ) { } } | if ( id . equals ( "tp0" ) ) return TPSettings . TP0 ; else if ( id . equals ( "tp1" ) ) return TPSettings . TP1 ; else if ( id . equals ( "p110" ) ) return new PLSettings ( false ) ; else if ( id . equals ( "p132" ) ) return new PLSettings ( true ) ; else if ( id . equals ( "rf" ) ) return new RFSettings ( null ) ; else throw new KNXIllegalArgumentException ( "unknown medium" ) ; |
public class PythonDistributionAnalyzer { /** * Retrieves the next temporary destination directory for extracting an
* archive .
* @ return a directory
* @ throws AnalysisException thrown if unable to create temporary directory */
private File getNextTempDirectory ( ) throws AnalysisException { } } | File directory ; // getting an exception for some directories not being able to be
// created ; might be because the directory already exists ?
do { final int dirCount = DIR_COUNT . incrementAndGet ( ) ; directory = new File ( tempFileLocation , String . valueOf ( dirCount ) ) ; } while ( directory . exists ( ) ) ; if ( ! directory . mkdirs ( ) ) { throw new AnalysisException ( String . format ( "Unable to create temp directory '%s'." , directory . getAbsolutePath ( ) ) ) ; } return directory ; |
public class XMLBuilder { /** * Same as above but with a single attribute name / value pair as well . */
public void addDataElement ( String elemName , String content , String attrName , String attrValue ) { } } | AttributesImpl attrs = new AttributesImpl ( ) ; attrs . addAttribute ( "" , attrName , "" , "CDATA" , attrValue ) ; writeDataElement ( elemName , attrs , content ) ; |
public class SerializableUtil { /** * Loads a serialized object of the specifed type from the stream . This
* method does not close the stream after reading
* @ param file the file from which a mapping should be loaded
* @ param type the type of the object being deserialized
* @ return the object that was serialized in the file */
@ SuppressWarnings ( "unchecked" ) public static < T > T load ( InputStream stream ) { } } | try { ObjectInputStream inStream = ( stream instanceof ObjectInputStream ) ? ( ObjectInputStream ) stream : new ObjectInputStream ( stream ) ; T object = ( T ) inStream . readObject ( ) ; return object ; } catch ( IOException ioe ) { throw new IOError ( ioe ) ; } catch ( ClassNotFoundException cnfe ) { throw new IOError ( cnfe ) ; } |
public class PropertiesHistory { /** * Checks that property reaches given value or makes given transition within given time .
* If found , remove old values from history .
* @ param property the property name
* @ param values the expected property value or values ( transition )
* @ param mustBeAtBegin true if value or transition must occur at begin of history
* @ param mustBeAtEnd true if value or transition must occur at end of history
* @ param maxTime _ ms the maximum time to wait for the property value , in milliseconds
* @ param expectedValueOrTransition expected value or transition ( only used for error messages )
* @ throws QTasteTestFailException if the property doesn ' t reach specified value or make specified transition or
* if a possible notification loss occurred */
public void checkPropertyValueOrTransition ( String property , String [ ] values , boolean mustBeAtBegin , boolean mustBeAtEnd , long maxTime_ms , String expectedValueOrTransition ) throws QTasteDataException , QTasteTestFailException { } } | long beginTime_ms = System . currentTimeMillis ( ) ; // begin time
long elapsedTime_ms ; // total elapsed time
long checkTimeInterval_ms = 100 ; // check every 100 milliseconds
LinkedList < TimestampedValue > list = null ; long lastCheckedTimestamp = 0 ; boolean foundMatching = false ; boolean foundNotMatching = false ; String currentPropertyHistory = null ; loop : do { synchronized ( this ) { // get list of values if none yet
if ( list == null ) { list = hash . get ( property ) ; } if ( list != null && list . size ( ) > 0 ) { if ( mustBeAtBegin ) { if ( ! list . get ( 0 ) . value . equals ( values [ 0 ] ) ) { foundNotMatching = true ; } else if ( list . size ( ) >= values . length ) { if ( ( values . length == 1 || list . get ( 1 ) . value . equals ( values [ 1 ] ) ) && ( ! mustBeAtEnd || list . size ( ) == values . length ) ) { foundMatching = true ; lastCheckedTimestamp = list . get ( values . length - 1 ) . timestamp ; break loop ; } else { foundNotMatching = true ; } } } else { ListIterator < TimestampedValue > iTSValue = list . listIterator ( ) ; int index = - 1 ; while ( iTSValue . hasNext ( ) ) { index ++ ; TimestampedValue tsValue = iTSValue . next ( ) ; TimestampedValue nextTsValue = null ; if ( iTSValue . hasNext ( ) ) { nextTsValue = iTSValue . next ( ) ; iTSValue . previous ( ) ; } if ( tsValue . value . equals ( values [ 0 ] ) && ( values . length == 1 || ( iTSValue . hasNext ( ) && nextTsValue . value . equals ( values [ 1 ] ) ) ) ) { if ( ! mustBeAtEnd || list . size ( ) == ( index + values . length ) ) { foundMatching = true ; lastCheckedTimestamp = ( values . length == 1 ? tsValue . timestamp : nextTsValue . timestamp ) ; break loop ; } else { foundNotMatching = true ; } } } } } // value is not in list yet
elapsedTime_ms = System . currentTimeMillis ( ) - beginTime_ms ; if ( foundNotMatching || ( elapsedTime_ms >= maxTime_ms ) ) { currentPropertyHistory = getHistoryString ( property , false ) ; break ; } } try { Thread . sleep ( checkTimeInterval_ms ) ; } catch ( InterruptedException e ) { throw new QTasteDataException ( "Sleep has been interrupted while checking " + component + " property" ) ; } } while ( true ) ; if ( possibleNotificationLoss ) { throw new QTasteTestFailException ( component + " property value cannot be checked because of a possible notification loss!" ) ; } if ( foundMatching ) { removePrecedingValues ( property , lastCheckedTimestamp ) ; } else { throw new QTasteTestFailException ( component + " " + property + " property didn't behave as expected ('" + currentPropertyHistory + "' doesn't match expected '" + expectedValueOrTransition + "')" ) ; } |
public class JAXBSerialiser { /** * Helper method to get a JAXBSerialiser from a JAXB Context Path ( i . e . a package name or colon - delimited list of package
* names ) with the underlying JAXB implementation picked using the default rules for JAXB acquisition < br / >
* This is an expensive operation and so the result should ideally be cached
* @ param contextPath
* a package name or colon - delimited list of package names
* @ return */
public static JAXBSerialiser getInstance ( String contextPath ) { } } | if ( log . isTraceEnabled ( ) ) log . trace ( "Create serialiser for " + contextPath ) ; return new JAXBSerialiser ( contextPath ) ; |
public class RandomUtils { /** * Returns a random < code > long < / code > value out of a specified range
* @ param lowerBound Lower bound of the target range ( inclusive )
* @ param upperBound Upper bound of the target range ( exclusive )
* @ return A random < code > long < / code > value out of a specified range */
public static long randomLongBetween ( long lowerBound , long upperBound ) { } } | if ( upperBound < lowerBound ) { throw new IllegalArgumentException ( "lower bound higher than upper bound" ) ; } return lowerBound + ( long ) ( rand . nextDouble ( ) * ( upperBound - lowerBound ) ) ; |
public class ExpressionUtil { /** * Input is email template with image tags :
* < code >
* & lt ; img src = " $ { image : com . centurylink . mdw . base / mdw . png } " alt = " MDW " & gt ;
* < / code >
* Uses the unqualified image name as its CID . Populates imageMap with results . */
public static String substituteImages ( String input , Map < String , String > imageMap ) { } } | StringBuffer substituted = new StringBuffer ( input . length ( ) ) ; Matcher matcher = tokenPattern . matcher ( input ) ; int index = 0 ; while ( matcher . find ( ) ) { String match = matcher . group ( ) ; substituted . append ( input . substring ( index , matcher . start ( ) ) ) ; if ( imageMap != null && ( match . startsWith ( "${image:" ) ) ) { String imageFile = match . substring ( 8 , match . length ( ) - 1 ) ; String imageId = imageFile . substring ( imageFile . lastIndexOf ( '/' ) + 1 ) ; substituted . append ( "cid:" + imageId ) ; imageMap . put ( imageId , imageFile ) ; } else { // ignore everything but images
substituted . append ( match ) ; } index = matcher . end ( ) ; } substituted . append ( input . substring ( index ) ) ; return substituted . toString ( ) ; |
public class PropertyManager { /** * Directory where MDW config files can be found . */
public static String getConfigLocation ( ) { } } | if ( configLocation == null ) { String configLoc = System . getProperty ( MDW_CONFIG_LOCATION ) ; if ( configLoc != null ) { if ( ! configLoc . endsWith ( "/" ) ) configLoc = configLoc + "/" ; configLocation = configLoc ; System . out . println ( "Loading configuration files from '" + new File ( configLoc ) . getAbsolutePath ( ) + "'" ) ; } } return configLocation ; |
public class StepPattern { /** * Execute an expression in the XPath runtime context , and return the
* result of the expression .
* @ param xctxt The XPath runtime context .
* @ param currentNode The currentNode .
* @ param dtm The DTM of the current node .
* @ param expType The expanded type ID of the current node .
* @ return The result of the expression in the form of a < code > XObject < / code > .
* @ throws javax . xml . transform . TransformerException if a runtime exception
* occurs . */
public XObject execute ( XPathContext xctxt , int currentNode , DTM dtm , int expType ) throws javax . xml . transform . TransformerException { } } | if ( m_whatToShow == NodeTest . SHOW_BYFUNCTION ) { if ( null != m_relativePathPattern ) { return m_relativePathPattern . execute ( xctxt ) ; } else return NodeTest . SCORE_NONE ; } XObject score ; score = super . execute ( xctxt , currentNode , dtm , expType ) ; if ( score == NodeTest . SCORE_NONE ) return NodeTest . SCORE_NONE ; if ( getPredicateCount ( ) != 0 ) { if ( ! executePredicates ( xctxt , dtm , currentNode ) ) return NodeTest . SCORE_NONE ; } if ( null != m_relativePathPattern ) return m_relativePathPattern . executeRelativePathPattern ( xctxt , dtm , currentNode ) ; return score ; |
public class GetPartitionRequest { /** * The values that define the partition .
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setPartitionValues ( java . util . Collection ) } or { @ link # withPartitionValues ( java . util . Collection ) } if you
* want to override the existing values .
* @ param partitionValues
* The values that define the partition .
* @ return Returns a reference to this object so that method calls can be chained together . */
public GetPartitionRequest withPartitionValues ( String ... partitionValues ) { } } | if ( this . partitionValues == null ) { setPartitionValues ( new java . util . ArrayList < String > ( partitionValues . length ) ) ; } for ( String ele : partitionValues ) { this . partitionValues . add ( ele ) ; } return this ; |
public class UpdatableResultSet { /** * { inheritDoc } . */
public void updateDouble ( int columnIndex , double value ) throws SQLException { } } | checkUpdatable ( columnIndex ) ; parameterHolders [ columnIndex - 1 ] = new DoubleParameter ( value ) ; |
public class GetStaticIpsResult { /** * An array of key - value pairs containing information about your get static IPs request .
* @ param staticIps
* An array of key - value pairs containing information about your get static IPs request . */
public void setStaticIps ( java . util . Collection < StaticIp > staticIps ) { } } | if ( staticIps == null ) { this . staticIps = null ; return ; } this . staticIps = new java . util . ArrayList < StaticIp > ( staticIps ) ; |
public class CmsJspDateSeriesBean { /** * Returns the next event of this series that takes place at the given date or after it . < p >
* In case this is just a single event and not a series , this is identical to the date of the event . < p >
* @ param date the date relative to which the event is returned .
* @ return the next event of this series */
public CmsJspInstanceDateBean getPreviousFor ( Object date ) { } } | Date d = toDate ( date ) ; if ( ( d != null ) && ( m_dates != null ) && ( ! m_dates . isEmpty ( ) ) ) { Date lastDate = m_dates . first ( ) ; for ( Date instanceDate : m_dates ) { if ( instanceDate . after ( d ) ) { return new CmsJspInstanceDateBean ( ( Date ) lastDate . clone ( ) , CmsJspDateSeriesBean . this ) ; } lastDate = instanceDate ; } return new CmsJspInstanceDateBean ( ( Date ) lastDate . clone ( ) , CmsJspDateSeriesBean . this ) ; } return getLast ( ) ; |
public class BaseExchangeRateProvider { /** * Access a { @ link javax . money . convert . ExchangeRate } using the given currencies . The
* { @ link javax . money . convert . ExchangeRate } may be , depending on the data provider , eal - time or
* deferred . This method should return the rate that is < i > currently < / i >
* valid .
* @ param baseCode base currency code , not { @ code null }
* @ param termCode term / target currency code , not { @ code null }
* @ return the matching { @ link javax . money . convert . ExchangeRate } .
* @ throws javax . money . convert . CurrencyConversionException If no such rate is available .
* @ throws javax . money . MonetaryException if one of the currency codes passed is not valid . */
public ExchangeRate getExchangeRate ( String baseCode , String termCode ) { } } | return getExchangeRate ( Monetary . getCurrency ( baseCode ) , Monetary . getCurrency ( termCode ) ) ; |
public class PersistentState { /** * Turns a temporary snapshot file into a valid snapshot file .
* @ param tempFile the temporary file which stores current state .
* @ param zxid the last applied zxid for state machine .
* @ return the snapshot file . */
File setSnapshotFile ( File tempFile , Zxid zxid ) throws IOException { } } | File snapshot = new File ( dataDir , String . format ( "snapshot.%s" , zxid . toSimpleString ( ) ) ) ; LOG . debug ( "Atomically move snapshot file to {}" , snapshot ) ; FileUtils . atomicMove ( tempFile , snapshot ) ; // Since the new snapshot file gets created , we need to fsync the directory .
fsyncDirectory ( ) ; return snapshot ; |
public class PhotosCommentsApi { /** * Returns the comments for a photo
* < br >
* This method does not require authentication . You can choose to sign the call by passing true or false
* as the value of the sign parameter .
* < br >
* @ param photoId ( Required ) The id of the photo to fetch comments for .
* @ param minCommentDate ( Optional ) Minimum date that a a comment was added . The date should be in the form of a unix timestamp .
* @ param maxCommentDate ( Optional ) Maximum date that a comment was added . The date should be in the form of a unix timestamp .
* @ param sign if true , the request will be signed .
* @ return object with a list of comments for the specified photo .
* @ throws JinxException if required parameters are missing , or if there are any errors .
* @ see < a href = " https : / / www . flickr . com / services / api / flickr . photos . comments . getList . html " > flickr . photos . comments . getList < / a > */
public Comments getList ( String photoId , String minCommentDate , String maxCommentDate , boolean sign ) throws JinxException { } } | JinxUtils . validateParams ( photoId ) ; Map < String , String > params = new TreeMap < > ( ) ; params . put ( "method" , "flickr.photos.comments.getList" ) ; params . put ( "photo_id" , photoId ) ; if ( ! JinxUtils . isNullOrEmpty ( minCommentDate ) ) { params . put ( "min_comment_date" , minCommentDate ) ; } if ( ! JinxUtils . isNullOrEmpty ( maxCommentDate ) ) { params . put ( "max_comment_date" , maxCommentDate ) ; } return jinx . flickrGet ( params , Comments . class , sign ) ; |
public class AbstractClientHttpRequestFactoryWrapper { /** * This implementation simply calls { @ link # createRequest ( URI , HttpMethod , ClientHttpRequestFactory ) }
* with the wrapped request factory provided to the
* { @ linkplain # AbstractClientHttpRequestFactoryWrapper ( ClientHttpRequestFactory ) constructor } . */
public final ClientHttpRequest createRequest ( URI uri , HttpMethod httpMethod ) throws IOException { } } | return createRequest ( uri , httpMethod , requestFactory ) ; |
public class ExecutionGraph { /** * Returns the a stringified version of the user - defined accumulators .
* @ return an Array containing the StringifiedAccumulatorResult objects */
@ Override public StringifiedAccumulatorResult [ ] getAccumulatorResultsStringified ( ) { } } | Map < String , OptionalFailure < Accumulator < ? , ? > > > accumulatorMap = aggregateUserAccumulators ( ) ; return StringifiedAccumulatorResult . stringifyAccumulatorResults ( accumulatorMap ) ; |
public class PointerHierarchyRepresentationBuilder { /** * Finalize the result .
* @ return Completed result */
public PointerHierarchyRepresentationResult complete ( ) { } } | if ( csize != null ) { csize . destroy ( ) ; csize = null ; } if ( mergecount != ids . size ( ) - 1 ) { LOG . warning ( mergecount + " merges were added to the hierarchy, expected " + ( ids . size ( ) - 1 ) ) ; } if ( prototypes != null ) { return new PointerPrototypeHierarchyRepresentationResult ( ids , parent , parentDistance , isSquared , order , prototypes ) ; } return new PointerHierarchyRepresentationResult ( ids , parent , parentDistance , isSquared , order ) ; |
public class ConfigException { /** * For deserialization - uses reflection to set the final origin field on the object */
private static < T > void setOriginField ( T hasOriginField , Class < T > clazz , ConfigOrigin origin ) throws IOException { } } | // circumvent " final "
Field f ; try { f = clazz . getDeclaredField ( "origin" ) ; } catch ( NoSuchFieldException e ) { throw new IOException ( clazz . getSimpleName ( ) + " has no origin field?" , e ) ; } catch ( SecurityException e ) { throw new IOException ( "unable to fill out origin field in " + clazz . getSimpleName ( ) , e ) ; } f . setAccessible ( true ) ; try { f . set ( hasOriginField , origin ) ; } catch ( IllegalArgumentException e ) { throw new IOException ( "unable to set origin field" , e ) ; } catch ( IllegalAccessException e ) { throw new IOException ( "unable to set origin field" , e ) ; } |
public class GobblinMetrics { /** * Parse custom { @ link org . apache . gobblin . metrics . Tag } s from property { @ link # METRICS _ STATE _ CUSTOM _ TAGS }
* in the input { @ link org . apache . gobblin . configuration . State } .
* @ param state { @ link org . apache . gobblin . configuration . State } possibly containing custom tags .
* @ return List of { @ link org . apache . gobblin . metrics . Tag } parsed from input . */
public static List < Tag < ? > > getCustomTagsFromState ( State state ) { } } | List < Tag < ? > > tags = Lists . newArrayList ( ) ; for ( String tagKeyValue : state . getPropAsList ( METRICS_STATE_CUSTOM_TAGS , "" ) ) { Tag < ? > tag = Tag . fromString ( tagKeyValue ) ; if ( tag != null ) { tags . add ( tag ) ; } } return tags ; |
public class LUDecompositor { /** * Returns the result of LU decomposition of given matrix
* See < a href = " http : / / mathworld . wolfram . com / LUDecomposition . html " >
* http : / / mathworld . wolfram . com / LUDecomposition . html < / a > for more details .
* @ return { L , U , P } */
@ Override public Matrix [ ] decompose ( ) { } } | Matrix [ ] lup = super . decompose ( ) ; Matrix lu = lup [ 0 ] ; Matrix p = lup [ 1 ] ; Matrix l = matrix . blankOfShape ( lu . rows ( ) , lu . columns ( ) ) ; for ( int i = 0 ; i < l . rows ( ) ; i ++ ) { for ( int j = 0 ; j <= i ; j ++ ) { if ( i > j ) { l . set ( i , j , lu . get ( i , j ) ) ; } else { l . set ( i , j , 1.0 ) ; } } } Matrix u = matrix . blankOfShape ( lu . columns ( ) , lu . columns ( ) ) ; for ( int i = 0 ; i < u . rows ( ) ; i ++ ) { for ( int j = i ; j < u . columns ( ) ; j ++ ) { u . set ( i , j , lu . get ( i , j ) ) ; } } return new Matrix [ ] { l , u , p } ; |
public class SearchUrl { /** * Get Resource Url for UpdateSynonymDefinition
* @ param responseFields Filtering syntax appended to an API call to increase or decrease the amount of data returned inside a JSON object . This parameter should only be used to retrieve data . Attempting to update data using this parameter may cause data loss .
* @ param synonymId The unique identifier of the synonym definition .
* @ return String Resource Url */
public static MozuUrl updateSynonymDefinitionUrl ( String responseFields , Integer synonymId ) { } } | UrlFormatter formatter = new UrlFormatter ( "/api/commerce/catalog/admin/search/synonyms/{synonymId}?responseFields={responseFields}" ) ; formatter . formatUrl ( "responseFields" , responseFields ) ; formatter . formatUrl ( "synonymId" , synonymId ) ; return new MozuUrl ( formatter . getResourceUrl ( ) , MozuUrl . UrlLocation . TENANT_POD ) ; |
public class BeanELResolver { /** * If the base object is not < code > null < / code > , invoke the method , with the given parameters on
* this bean . The return value from the method is returned .
* If the base is not < code > null < / code > , the < code > propertyResolved < / code > property of the
* < code > ELContext < / code > object must be set to < code > true < / code > by this resolver , before
* returning . If this property is not < code > true < / code > after this method is called , the caller
* should ignore the return value .
* The provided method object will first be coerced to a < code > String < / code > . The methods in the
* bean is then examined and an attempt will be made to select one for invocation . If no
* suitable can be found , a < code > MethodNotFoundException < / code > is thrown .
* If the given paramTypes is not < code > null < / code > , select the method with the given name and
* parameter types .
* Else select the method with the given name that has the same number of parameters . If there
* are more than one such method , the method selection process is undefined .
* Else select the method with the given name that takes a variable number of arguments .
* Note the resolution for overloaded methods will likely be clarified in a future version of
* the spec .
* The provided parameters are coerced to the corresponding parameter types of the method , and
* the method is then invoked .
* @ param context
* The context of this evaluation .
* @ param base
* The bean on which to invoke the method
* @ param method
* The simple name of the method to invoke . Will be coerced to a < code > String < / code > .
* If method is " & lt ; init & gt ; " or " & lt ; clinit & gt ; " a MethodNotFoundException is
* thrown .
* @ param paramTypes
* An array of Class objects identifying the method ' s formal parameter types , in
* declared order . Use an empty array if the method has no parameters . Can be
* < code > null < / code > , in which case the method ' s formal parameter types are assumed
* to be unknown .
* @ param params
* The parameters to pass to the method , or < code > null < / code > if no parameters .
* @ return The result of the method invocation ( < code > null < / code > if the method has a
* < code > void < / code > return type ) .
* @ throws MethodNotFoundException
* if no suitable method can be found .
* @ throws ELException
* if an exception was thrown while performing ( base , method ) resolution . The thrown
* exception must be included as the cause property of this exception , if available .
* If the exception thrown is an < code > InvocationTargetException < / code > , extract its
* < code > cause < / code > and pass it to the < code > ELException < / code > constructor .
* @ since 2.2 */
@ Override public Object invoke ( ELContext context , Object base , Object method , Class < ? > [ ] paramTypes , Object [ ] params ) { } } | if ( context == null ) { throw new NullPointerException ( ) ; } Object result = null ; if ( isResolvable ( base ) ) { if ( params == null ) { params = new Object [ 0 ] ; } String name = method . toString ( ) ; Method target = findMethod ( base , name , paramTypes , params . length ) ; if ( target == null ) { throw new MethodNotFoundException ( "Cannot find method " + name + " with " + params . length + " parameters in " + base . getClass ( ) ) ; } try { result = target . invoke ( base , coerceParams ( getExpressionFactory ( context ) , target , params ) ) ; } catch ( InvocationTargetException e ) { throw new ELException ( e . getCause ( ) ) ; } catch ( IllegalAccessException e ) { throw new ELException ( e ) ; } context . setPropertyResolved ( true ) ; } return result ; |
public class MoreCollectors { /** * Converts a stream of unicode code points into a String .
* < pre >
* { @ code
* String spacesRemoved = MoreCollectors . codePointsToString ( " a b c " . codePoints ( ) . filter ( c - > c ! = ' ' ) ) ;
* Assert . assertEquals ( " abc " , spacesRemoved ) ; ;
* < / pre > */
public static String codePointsToString ( IntStream codePoints ) { } } | return codePoints . collect ( StringBuilder :: new , StringBuilder :: appendCodePoint , StringBuilder :: append ) . toString ( ) ; |
public class Context { /** * Returns a opened connection resource . If a previous close connection
* resource already exists , this already existing connection resource is
* returned .
* @ return opened connection resource
* @ throws EFapsException if connection resource cannot be created */
public static Connection getConnection ( ) throws EFapsException { } } | Connection con = null ; try { con = Context . DATASOURCE . getConnection ( ) ; con . setAutoCommit ( false ) ; } catch ( final SQLException e ) { throw new EFapsException ( Context . class , "getConnection.SQLException" , e ) ; } return con ; |
public class HtmlTemplateCompiler { /** * Called to push a new lexical scope onto the stack . */
private boolean lexicalClimb ( PageCompilingContext pc , Node node ) { } } | if ( node . attr ( ANNOTATION ) . length ( ) > 1 ) { // Setup a new lexical scope ( symbol table changes on each scope encountered ) .
if ( REPEAT_WIDGET . equalsIgnoreCase ( node . attr ( ANNOTATION_KEY ) ) || CHOOSE_WIDGET . equalsIgnoreCase ( node . attr ( ANNOTATION_KEY ) ) ) { String [ ] keyAndContent = { node . attr ( ANNOTATION_KEY ) , node . attr ( ANNOTATION_CONTENT ) } ; pc . lexicalScopes . push ( new MvelEvaluatorCompiler ( parseRepeatScope ( pc , keyAndContent , node ) ) ) ; return true ; } // Setup a new lexical scope for compiling against embedded pages ( closures ) .
final PageBook . Page embed = pageBook . forName ( node . attr ( ANNOTATION_KEY ) ) ; if ( null != embed ) { final Class < ? > embedClass = embed . pageClass ( ) ; MvelEvaluatorCompiler compiler = new MvelEvaluatorCompiler ( embedClass ) ; checkEmbedAgainst ( pc , compiler , Parsing . toBindMap ( node . attr ( ANNOTATION_CONTENT ) ) , embedClass , node ) ; pc . lexicalScopes . push ( compiler ) ; return true ; } } return false ; |
public class VirtualNetworkGatewaysInner { /** * Deletes the specified virtual network gateway .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void beginDelete ( String resourceGroupName , String virtualNetworkGatewayName ) { } } | beginDeleteWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class BackupDocumentWriter { /** * Append the supplied document to the files .
* @ param document the document to be written ; may not be null */
public void write ( Document document ) { } } | assert document != null ; ++ count ; ++ totalCount ; if ( count > maxDocumentsPerFile ) { // Close the stream ( we ' ll open a new one later in the method ) . . .
close ( ) ; count = 1 ; } try { if ( stream == null ) { // Open the stream to the next file . . .
++ fileCount ; String suffix = StringUtil . justifyRight ( Long . toString ( fileCount ) , BackupService . NUM_CHARS_IN_FILENAME_SUFFIX , '0' ) ; String filename = filenamePrefix + "_" + suffix + DOCUMENTS_EXTENSION ; if ( compress ) filename = filename + GZIP_EXTENSION ; currentFile = new File ( parentDirectory , filename ) ; OutputStream fileStream = new FileOutputStream ( currentFile ) ; if ( compress ) fileStream = new GZIPOutputStream ( fileStream ) ; stream = new BufferedOutputStream ( fileStream ) ; } Json . write ( document , stream ) ; // Need to append a non - consumable character so that we can read multiple JSON documents per file
stream . write ( ( byte ) '\n' ) ; } catch ( IOException e ) { problems . addError ( JcrI18n . problemsWritingDocumentToBackup , currentFile . getAbsolutePath ( ) , e . getMessage ( ) ) ; } |
public class LocalResourcesDownloader { /** * Generates a tmp directory based on : < / br >
* TMP _ OS _ DIRECTORY / brooklyn / ENTITY _ ID / RANDOM _ STRING ( 8)
* @ return */
public static String findATmpDir ( ) { } } | String osTmpDir = new Os . TmpDirFinder ( ) . get ( ) . get ( ) ; return osTmpDir + File . separator + BROOKLYN_DIR + File . separator + Strings . makeRandomId ( 8 ) ; |
public class MediaClient { /** * Creates a water mark and return water mark ID
* @ param request The request object containing all options for creating new water mark .
* @ return watermarkId the unique ID of the new water mark . */
public CreateWaterMarkResponse createWaterMark ( CreateWaterMarkRequest request ) { } } | checkStringNotEmpty ( request . getBucket ( ) , "The parameter bucket should NOT be null or empty string." ) ; checkStringNotEmpty ( request . getKey ( ) , "The parameter key should NOT be null or empty string." ) ; InternalRequest internalRequest = createRequest ( HttpMethodName . POST , request , WATER_MARK ) ; return invokeHttpClient ( internalRequest , CreateWaterMarkResponse . class ) ; |
public class VirtualMachineScaleSetsInner { /** * Gets a list of SKUs available for your VM scale set , including the minimum and maximum VM instances allowed for each SKU .
* ServiceResponse < PageImpl1 < VirtualMachineScaleSetSkuInner > > * @ param resourceGroupName The name of the resource group .
* ServiceResponse < PageImpl1 < VirtualMachineScaleSetSkuInner > > * @ param vmScaleSetName The name of the VM scale set .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; VirtualMachineScaleSetSkuInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < VirtualMachineScaleSetSkuInner > > > listSkusSinglePageAsync ( final String resourceGroupName , final String vmScaleSetName ) { } } | if ( resourceGroupName == null ) { throw new IllegalArgumentException ( "Parameter resourceGroupName is required and cannot be null." ) ; } if ( vmScaleSetName == null ) { throw new IllegalArgumentException ( "Parameter vmScaleSetName is required and cannot be null." ) ; } if ( this . client . subscriptionId ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.subscriptionId() is required and cannot be null." ) ; } if ( this . client . apiVersion ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.apiVersion() is required and cannot be null." ) ; } return service . listSkus ( resourceGroupName , vmScaleSetName , this . client . subscriptionId ( ) , this . client . apiVersion ( ) , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < VirtualMachineScaleSetSkuInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < VirtualMachineScaleSetSkuInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl1 < VirtualMachineScaleSetSkuInner > > result = listSkusDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < VirtualMachineScaleSetSkuInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class ScriptPluginProviderLoader { /** * Validate provider def */
private static void validateProviderDef ( final ProviderDef pluginDef ) throws PluginException { } } | if ( null == pluginDef . getPluginType ( ) || "" . equals ( pluginDef . getPluginType ( ) ) ) { throw new PluginException ( "Script plugin missing plugin-type" ) ; } if ( "script" . equals ( pluginDef . getPluginType ( ) ) ) { validateScriptProviderDef ( pluginDef ) ; } else if ( "ui" . equals ( pluginDef . getPluginType ( ) ) ) { validateUIProviderDef ( pluginDef ) ; } else { throw new PluginException ( "Script plugin has invalid plugin-type: " + pluginDef . getPluginType ( ) ) ; } |
public class InternalPureXbaseLexer { /** * $ ANTLR start " T _ _ 66" */
public final void mT__66 ( ) throws RecognitionException { } } | try { int _type = T__66 ; int _channel = DEFAULT_TOKEN_CHANNEL ; // InternalPureXbase . g : 64:7 : ( ' for ' )
// InternalPureXbase . g : 64:9 : ' for '
{ match ( "for" ) ; } state . type = _type ; state . channel = _channel ; } finally { } |
public class InvocationContextImpl { /** * Since some interceptor methods cannot throw ' Exception ' , but the target
* method on the bean can throw application exceptions , this method may be
* used to unwrap the application exception from either an
* InvocationTargetException or UndeclaredThrowableException .
* @ param undeclaredException the InvocationTargetException or UndeclaredThrowableException
* that is wrapping the real application exception .
* @ throws Exception the application exception */
private void throwUndeclaredExceptionCause ( Throwable undeclaredException ) throws Exception { } } | Throwable cause = undeclaredException . getCause ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "proceed unwrappering " + undeclaredException . getClass ( ) . getSimpleName ( ) + " : " + cause , cause ) ; // CDI interceptors tend to result in a UndeclaredThrowableException wrapped in an InvocationTargetException
if ( cause instanceof UndeclaredThrowableException ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , "proceed unwrappering " + cause . getClass ( ) . getSimpleName ( ) + " : " + cause , cause . getCause ( ) ) ; cause = cause . getCause ( ) ; } if ( cause instanceof RuntimeException ) { // Let the mapping strategy handle this unchecked exception .
throw ( RuntimeException ) cause ; } else if ( cause instanceof Error ) { // Let the mapping strategy handle this unchecked exception .
throw ( Error ) cause ; } else { // Probably an application exception occurred , so just throw it . The mapping
// strategy will handle if it turns out not to be an application exception .
throw ( Exception ) cause ; } |
public class JsonWriteContext { /** * Method that writer is to call before it writes a field name .
* @ return Index of the field entry ( 0 - based ) */
public final int writeFieldName ( String name ) { } } | if ( _type == TYPE_OBJECT ) { if ( _currentName != null ) { // just wrote a name . . .
return STATUS_EXPECT_VALUE ; } _currentName = name ; return ( _index < 0 ) ? STATUS_OK_AS_IS : STATUS_OK_AFTER_COMMA ; } return STATUS_EXPECT_VALUE ; |
public class QueryCriterionSerializer { /** * Filter the delimeter from the String array .
* remove the String element in the delimeter .
* @ param arr
* the target array .
* @ param delimeter
* the delimeter array need to remove .
* @ return
* the array List . */
private static List < String > filterDelimeterElement ( List < String > arr , char [ ] delimeter ) { } } | List < String > list = new ArrayList < String > ( ) ; for ( String s : arr ) { if ( s == null || s . isEmpty ( ) ) { continue ; } if ( s . length ( ) > 1 ) { list . add ( s ) ; continue ; } char strChar = s . charAt ( 0 ) ; boolean find = false ; for ( char c : delimeter ) { if ( c == strChar ) { find = true ; break ; } } if ( find == false ) { list . add ( s ) ; } } return list ; |
public class mps_image { /** * Use this API to fetch filtered set of mps _ image resources .
* filter string should be in JSON format . eg : " vm _ state : DOWN , name : [ a - z ] + " */
public static mps_image [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | mps_image obj = new mps_image ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; mps_image [ ] response = ( mps_image [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class ControllerRegistry { /** * Iterate over all registered controllers to get the first suitable one .
* @ param jsonPath built JsonPath object mad from request path
* @ param method type of a HTTP request
* @ return suitable controller */
public Controller getController ( JsonPath jsonPath , String method ) { } } | for ( Controller controller : controllers ) { if ( controller . isAcceptable ( jsonPath , method ) ) { LOGGER . debug ( "using controller {}" , controller ) ; return controller ; } } throw new BadRequestException ( jsonPath + " with method " + method ) ; |
public class TypeConstrainedMappingJackson2HttpMessageConverter { /** * ( non - Javadoc )
* @ see org . springframework . http . converter . json . MappingJackson2HttpMessageConverter # canRead ( java . lang . Class , org . springframework . http . MediaType ) */
@ Override public boolean canRead ( Class < ? > clazz , @ Nullable MediaType mediaType ) { } } | return type . isAssignableFrom ( clazz ) && super . canRead ( clazz , mediaType ) ; |
public class StaticFilesResource { /** * Completes with { @ code Ok } and the file content or { @ code NotFound } .
* @ param contentFile the String name of the content file to be served
* @ param root the String root path of the static content
* @ param validSubPaths the String indicating the valid file paths under the root */
public void serveFile ( final String contentFile , final String root , final String validSubPaths ) { } } | if ( rootPath == null ) { final String slash = root . endsWith ( "/" ) ? "" : "/" ; rootPath = root + slash ; } final String contentPath = rootPath + context . request . uri ; try { final byte [ ] fileContent = readFile ( contentPath ) ; completes ( ) . with ( Response . of ( Ok , Body . from ( fileContent , Body . Encoding . UTF8 ) . content ) ) ; } catch ( IOException e ) { completes ( ) . with ( Response . of ( InternalServerError ) ) ; } catch ( IllegalArgumentException e ) { completes ( ) . with ( Response . of ( NotFound ) ) ; } |
public class FactorGraph { /** * Gets the factor in this named { @ code name } . Returns { @ code null }
* if no such factor exists .
* @ param name
* @ return */
public Factor getFactorByName ( String name ) { } } | int index = getFactorIndexByName ( name ) ; if ( index == - 1 ) { return null ; } return factors [ index ] ; |
public class CmsObject { /** * Returns a set of principals that are responsible for a specific resource . < p >
* @ param resource the resource to get the responsible principals from
* @ return the set of principals that are responsible for a specific resource
* @ throws CmsException if something goes wrong */
public Set < I_CmsPrincipal > readResponsiblePrincipals ( CmsResource resource ) throws CmsException { } } | return m_securityManager . readResponsiblePrincipals ( m_context , resource ) ; |
public class HtmlTree { /** * Generates a UL tag with the style class attribute and some content .
* @ param styleClass style for the tag
* @ param first initial content to be added
* @ param more a series of additional content nodes to be added
* @ return an HtmlTree object for the UL tag */
public static HtmlTree UL ( HtmlStyle styleClass , Content first , Content ... more ) { } } | HtmlTree htmlTree = new HtmlTree ( HtmlTag . UL ) ; htmlTree . addContent ( nullCheck ( first ) ) ; for ( Content c : more ) { htmlTree . addContent ( nullCheck ( c ) ) ; } htmlTree . addStyle ( nullCheck ( styleClass ) ) ; return htmlTree ; |
public class Table { /** * Removes all columns except for those given in the argument from this table */
public Table retainColumns ( String ... columnNames ) { } } | List < Column < ? > > retained = columns ( columnNames ) ; columnList . clear ( ) ; columnList . addAll ( retained ) ; return this ; |
public class PayloadStorage { /** * Downloads the payload from the given uri .
* @ param uri the location from where the object is to be downloaded
* @ return an inputstream of the payload in the external storage
* @ throws ConductorClientException if the download fails due to an invalid path or an error from external storage */
@ Override public InputStream download ( String uri ) { } } | HttpURLConnection connection = null ; String errorMsg ; try { URL url = new URI ( uri ) . toURL ( ) ; connection = ( HttpURLConnection ) url . openConnection ( ) ; connection . setDoOutput ( false ) ; // Check the HTTP response code
int responseCode = connection . getResponseCode ( ) ; if ( responseCode == HttpURLConnection . HTTP_OK ) { logger . debug ( "Download completed with HTTP response code: {}" , connection . getResponseCode ( ) ) ; return org . apache . commons . io . IOUtils . toBufferedInputStream ( connection . getInputStream ( ) ) ; } errorMsg = String . format ( "Unable to download. Response code: %d" , responseCode ) ; logger . error ( errorMsg ) ; throw new ConductorClientException ( errorMsg ) ; } catch ( URISyntaxException | MalformedURLException e ) { errorMsg = String . format ( "Invalid uri specified: %s" , uri ) ; logger . error ( errorMsg , e ) ; throw new ConductorClientException ( errorMsg , e ) ; } catch ( IOException e ) { errorMsg = String . format ( "Error downloading from uri: %s" , uri ) ; logger . error ( errorMsg , e ) ; throw new ConductorClientException ( errorMsg , e ) ; } finally { if ( connection != null ) { connection . disconnect ( ) ; } } |
public class Repositories { /** * Sets all repositories whether is writable with the specified flag .
* @ param writable the specified flat , { @ code true } for writable , { @ code false } otherwise */
public static void setRepositoriesWritable ( final boolean writable ) { } } | for ( final Map . Entry < String , Repository > entry : REPOS_HOLDER . entrySet ( ) ) { final String repositoryName = entry . getKey ( ) ; final Repository repository = entry . getValue ( ) ; repository . setWritable ( writable ) ; LOGGER . log ( Level . INFO , "Sets repository[name={0}] writable[{1}]" , new Object [ ] { repositoryName , writable } ) ; } repositoryiesWritable = writable ; |
public class Index { /** * { @ inheritDoc } */
@ Override public String build ( ) { } } | StringBuilder sb = new StringBuilder ( ) ; sb . append ( "CREATE CUSTOM INDEX " ) ; sb . append ( name ) . append ( " " ) ; String fullTable = keyspace == null ? table : keyspace + "." + table ; sb . append ( String . format ( "ON %s(%s) " , fullTable , column == null ? "" : column ) ) ; sb . append ( "USING 'com.stratio.cassandra.lucene.Index' WITH OPTIONS = {" ) ; option ( sb , "refresh_seconds" , refreshSeconds ) ; option ( sb , "directory_path" , directoryPath ) ; option ( sb , "ram_buffer_mb" , ramBufferMb ) ; option ( sb , "max_merge_mb" , maxMergeMb ) ; option ( sb , "max_cached_mb" , maxCachedMb ) ; option ( sb , "indexing_threads" , indexingThreads ) ; option ( sb , "indexing_queues_size" , indexingQueuesSize ) ; option ( sb , "excluded_data_centers" , excludedDataCenters ) ; option ( sb , "partitioner" , partitioner ) ; option ( sb , "sparse" , sparse ) ; sb . append ( String . format ( "'schema':'%s'}" , schema ) ) ; return sb . toString ( ) ; |
public class VirtualCdj { /** * Controls the tempo at which we report ourselves to be playing . Only meaningful if we are sending status packets .
* If { @ link # isSynced ( ) } is { @ code true } and we are not the tempo master , any value set by this method will
* overridden by the the next tempo master change .
* @ param bpm the tempo , in beats per minute , that we should report in our status and beat packets */
public void setTempo ( double bpm ) { } } | if ( bpm == 0.0 ) { throw new IllegalArgumentException ( "Tempo cannot be zero." ) ; } final double oldTempo = metronome . getTempo ( ) ; metronome . setTempo ( bpm ) ; notifyBeatSenderOfChange ( ) ; if ( isTempoMaster ( ) && ( Math . abs ( bpm - oldTempo ) > getTempoEpsilon ( ) ) ) { deliverTempoChangedAnnouncement ( bpm ) ; } |
public class BrowserPane { /** * Initial settings */
protected void init ( ) { } } | // " support for SSL "
String handlerPkgs = System . getProperty ( "java.protocol.handler.pkgs" ) ; if ( ( handlerPkgs != null ) && ! ( handlerPkgs . isEmpty ( ) ) ) { handlerPkgs = handlerPkgs + "|com.sun.net.ssl.internal.www.protocol" ; } else { handlerPkgs = "com.sun.net.ssl.internal.www.protocol" ; } System . setProperty ( "java.protocol.handler.pkgs" , handlerPkgs ) ; java . security . Security . addProvider ( new com . sun . net . ssl . internal . ssl . Provider ( ) ) ; // Create custom EditorKit if needed
if ( swingBoxEditorKit == null ) { swingBoxEditorKit = new SwingBoxEditorKit ( ) ; } setEditable ( false ) ; setContentType ( "text/html" ) ; activateTooltip ( true ) ; Caret caret = getCaret ( ) ; if ( caret instanceof DefaultCaret ) ( ( DefaultCaret ) caret ) . setUpdatePolicy ( DefaultCaret . NEVER_UPDATE ) ; |
public class VersionHistory { /** * endregion */
public void updateVersionHistory ( double timestamp , Integer newVersionCode , String newVersionName ) { } } | boolean exists = false ; for ( VersionHistoryItem item : versionHistoryItems ) { if ( item . getVersionCode ( ) == newVersionCode && item . getVersionName ( ) . equals ( newVersionName ) ) { exists = true ; break ; } } if ( ! exists ) { VersionHistoryItem newVersionHistoryItem = new VersionHistoryItem ( timestamp , newVersionCode , newVersionName ) ; versionHistoryItems . add ( newVersionHistoryItem ) ; notifyDataChanged ( ) ; } |
public class DateUtils { /** * # func 获取当前时间当月的第一天 < br >
* @ author dongguoshuang */
public static Date getFirstDayOfMonth ( Date date ) { } } | Calendar calendar = Calendar . getInstance ( ) ; calendar . setTime ( date ) ; int firstDay = calendar . getActualMinimum ( Calendar . DAY_OF_MONTH ) ; return org . apache . commons . lang . time . DateUtils . setDays ( date , firstDay ) ; |
public class Formatter { /** * 格式化为货币字符串
* @ param locale { @ link Locale } , 比如 : { @ link Locale # CHINA }
* @ param number 数字
* @ return 货币字符串
* @ since 1.0.9 */
public static String toCurrency ( Locale locale , double number ) { } } | return NumberFormat . getCurrencyInstance ( locale ) . format ( number ) ; |
public class AbstractCompactSimpleNondet { /** * public void setTransitions ( int state , int inputIdx , TIntCollection successors ) { */
public void setTransitions ( int state , int inputIdx , Collection < ? extends Integer > successors ) { } } | // TODO : replace by primitive specialization
int transIdx = toMemoryIndex ( state , inputIdx ) ; // TIntSet succs = transitions [ transIdx ] ;
Set < Integer > succs = transitions [ transIdx ] ; // TODO : replace by primitive specialization
if ( succs == null ) { // succs = new TIntHashSet ( successors ) ;
succs = Sets . newHashSetWithExpectedSize ( successors . size ( ) ) ; // TODO : replace by primitive specialization
transitions [ transIdx ] = succs ; } else { succs . clear ( ) ; } succs . addAll ( successors ) ; |
public class AbstractControllerServer { /** * @ param scope
* @ param participantConfig
* @ throws InitializationException
* @ throws InterruptedException */
public void init ( final Scope scope , final ParticipantConfig participantConfig ) throws InitializationException , InterruptedException { } } | manageLock . lockWrite ( this ) ; try { final boolean alreadyActivated = isActive ( ) ; ParticipantConfig internalParticipantConfig = participantConfig ; if ( scope == null ) { throw new NotAvailableException ( "scope" ) ; } // check if this instance was partly or fully initialized before .
if ( initialized | informerWatchDog != null | serverWatchDog != null ) { deactivate ( ) ; reset ( ) ; } this . scope = scope ; rsb . Scope internalScope = new rsb . Scope ( ScopeProcessor . generateStringRep ( scope ) . toLowerCase ( ) ) ; // init new instances .
logger . debug ( "Init AbstractControllerServer for component " + getClass ( ) . getSimpleName ( ) + " on " + internalScope + "." ) ; informer = new RSBSynchronizedInformer < > ( internalScope . concat ( new rsb . Scope ( rsb . Scope . COMPONENT_SEPARATOR ) . concat ( SCOPE_SUFFIX_STATUS ) ) , Object . class , internalParticipantConfig ) ; informerWatchDog = new WatchDog ( informer , "RSBInformer[" + internalScope . concat ( new rsb . Scope ( rsb . Scope . COMPONENT_SEPARATOR ) . concat ( SCOPE_SUFFIX_STATUS ) ) + "]" ) ; // get local server object which allows to expose remotely callable methods .
server = RSBFactoryImpl . getInstance ( ) . createSynchronizedLocalServer ( internalScope . concat ( new rsb . Scope ( rsb . Scope . COMPONENT_SEPARATOR ) . concat ( SCOPE_SUFFIX_CONTROL ) ) , internalParticipantConfig ) ; // register rpc methods .
RPCHelper . registerInterface ( Pingable . class , this , server ) ; RPCHelper . registerInterface ( Requestable . class , this , server ) ; registerMethods ( server ) ; serverWatchDog = new WatchDog ( server , "RSBLocalServer[" + internalScope . concat ( new rsb . Scope ( rsb . Scope . COMPONENT_SEPARATOR ) . concat ( SCOPE_SUFFIX_CONTROL ) ) + "]" ) ; this . informerWatchDog . addObserver ( ( final WatchDog source , WatchDog . ServiceState data ) -> { if ( data == WatchDog . ServiceState . RUNNING ) { // Sync data after service start .
initialDataSyncFuture = GlobalCachedExecutorService . submit ( ( ) -> { try { // skip if shutdown was already initiated
if ( informerWatchDog . isServiceDone ( ) || serverWatchDog . isServiceDone ( ) ) { return ; } informerWatchDog . waitForServiceActivation ( ) ; serverWatchDog . waitForServiceActivation ( ) ; // mark controller as online .
setAvailabilityState ( ONLINE ) ; logger . debug ( "trigger initial sync" ) ; notifyChange ( ) ; } catch ( InterruptedException ex ) { logger . debug ( "Initial sync was skipped because of controller shutdown." ) ; } catch ( CouldNotPerformException ex ) { ExceptionPrinter . printHistory ( new CouldNotPerformException ( "Could not trigger data sync!" , ex ) , logger , LogLevel . ERROR ) ; } } ) ; } } ) ; postInit ( ) ; initialized = true ; // check if communication service was already activated before and recover state .
if ( alreadyActivated ) { activate ( ) ; } } catch ( CouldNotPerformException | NullPointerException ex ) { throw new InitializationException ( this , ex ) ; } finally { manageLock . unlockWrite ( this ) ; } |
public class ExperimentUUID { /** * setter for uuid - sets
* @ generated */
public void setUuid ( String v ) { } } | if ( ExperimentUUID_Type . featOkTst && ( ( ExperimentUUID_Type ) jcasType ) . casFeat_uuid == null ) jcasType . jcas . throwFeatMissing ( "uuid" , "edu.cmu.lti.oaqa.framework.types.ExperimentUUID" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( ExperimentUUID_Type ) jcasType ) . casFeatCode_uuid , v ) ; |
public class MongoDBUtils { /** * Populate compound key .
* @ param dbObj
* the db obj
* @ param m
* the m
* @ param metaModel
* the meta model
* @ param id
* the id */
public static void populateCompoundKey ( DBObject dbObj , EntityMetadata m , MetamodelImpl metaModel , Object id ) { } } | EmbeddableType compoundKey = metaModel . embeddable ( m . getIdAttribute ( ) . getBindableJavaType ( ) ) ; // Iterator < Attribute > iter = compoundKey . getAttributes ( ) . iterator ( ) ;
BasicDBObject compoundKeyObj = new BasicDBObject ( ) ; compoundKeyObj = getCompoundKeyColumns ( m , id , compoundKey , metaModel ) ; dbObj . put ( "_id" , compoundKeyObj ) ; |
public class JCudaDriver { /** * Maps an OpenGL buffer object .
* < pre >
* CUresult cuGLMapBufferObject (
* CUdeviceptr * dptr ,
* size _ t * size ,
* GLuint buffer )
* < / pre >
* < div >
* < p > Maps an OpenGL buffer object .
* Deprecated < span > This function is
* deprecated as of Cuda 3.0 . < / span > Maps the buffer object specified by
* < tt > buffer < / tt > into the address space of the current CUDA context
* and returns in < tt > * dptr < / tt > and < tt > * size < / tt > the base pointer
* and size of the resulting mapping .
* < p > There must be a valid OpenGL context
* bound to the current thread when this function is called . This must be
* the same context ,
* or a member of the same shareGroup ,
* as the context that was bound when the buffer was registered .
* < p > All streams in the current CUDA
* context are synchronized with the current GL context .
* < div >
* < span > Note : < / span >
* < p > Note that
* this function may also return error codes from previous , asynchronous
* launches .
* < / div >
* < / div >
* @ param dptr Returned mapped base pointer
* @ param size Returned size of mapping
* @ param buffer The name of the buffer object to map
* @ return CUDA _ SUCCESS , CUDA _ ERROR _ DEINITIALIZED , CUDA _ ERROR _ NOT _ INITIALIZED ,
* CUDA _ ERROR _ INVALID _ CONTEXT , CUDA _ ERROR _ INVALID _ VALUE ,
* CUDA _ ERROR _ MAP _ FAILED
* @ see JCudaDriver # cuGraphicsMapResources
* @ deprecated Deprecated as of CUDA 3.0 */
@ Deprecated public static int cuGLMapBufferObject ( CUdeviceptr dptr , long size [ ] , int bufferobj ) { } } | return checkResult ( cuGLMapBufferObjectNative ( dptr , size , bufferobj ) ) ; |
public class RestNodeTypeHandlerImpl { /** * Imports a CND file into the repository , providing that the repository ' s { @ link javax . jcr . nodetype . NodeTypeManager } is a valid ModeShape
* node type manager .
* @ param request a non - null { @ link Request }
* @ param repositoryName a non - null , URL encoded { @ link String } representing the name of a repository
* @ param workspaceName a non - null , URL encoded { @ link String } representing the name of a workspace
* @ param allowUpdate a flag which indicates whether existing types should be updated or not .
* @ param cndInputStream a { @ link java . io . InputStream } which is expected to be the input stream of a CND file .
* @ return a non - null { @ link Result } instance
* @ throws javax . jcr . RepositoryException if any JCR related operation fails */
@ Override public Result importCND ( Request request , String repositoryName , String workspaceName , boolean allowUpdate , InputStream cndInputStream ) throws RepositoryException { } } | CheckArg . isNotNull ( cndInputStream , "request body" ) ; Session session = getSession ( request , repositoryName , workspaceName ) ; NodeTypeManager nodeTypeManager = session . getWorkspace ( ) . getNodeTypeManager ( ) ; if ( ! ( nodeTypeManager instanceof org . modeshape . jcr . api . nodetype . NodeTypeManager ) ) { // 501 = not implemented
return new Result ( Result . NOT_IMPLEMENTED ) ; } org . modeshape . jcr . api . nodetype . NodeTypeManager modeshapeTypeManager = ( org . modeshape . jcr . api . nodetype . NodeTypeManager ) nodeTypeManager ; try { List < RestNodeType > registeredTypes = registerCND ( request , allowUpdate , cndInputStream , modeshapeTypeManager ) ; return createOkResponse ( registeredTypes ) ; } catch ( IOException e ) { throw new RepositoryException ( e ) ; } |
public class BigMoney { /** * Obtains an instance of { @ code BigMoney } from a { @ code BigDecimal } at a specific scale .
* This allows you to create an instance with a specific currency and amount .
* No rounding is performed on the amount , so it must have a
* scale less than or equal to the new scale .
* The result will have a minimum scale of zero .
* @ param currency the currency , not null
* @ param amount the amount of money , not null
* @ param scale the scale to use , zero or positive
* @ return the new instance , never null
* @ throws ArithmeticException if the scale exceeds the currency scale */
public static BigMoney ofScale ( CurrencyUnit currency , BigDecimal amount , int scale ) { } } | return BigMoney . ofScale ( currency , amount , scale , RoundingMode . UNNECESSARY ) ; |
public class Utils { /** * Text is truncated if exceed field capacity . Uses spaces as padding
* @ param text the text to write
* @ param characterSetName The charset to use
* @ param length field length
* @ param alignment where to align the data
* @ param paddingByte the byte to use for padding
* @ return byte [ ] to store in the file
* @ throws UnsupportedEncodingException if characterSetName doesn ' t exists
* @ deprecated Use { @ link DBFUtils # textPadding ( String , Charset , int , DBFAlignment , byte ) } */
@ Deprecated public static byte [ ] textPadding ( String text , String characterSetName , int length , int alignment , byte paddingByte ) throws UnsupportedEncodingException { } } | DBFAlignment align = DBFAlignment . RIGHT ; if ( alignment == ALIGN_LEFT ) { align = DBFAlignment . LEFT ; } return textPadding ( text , characterSetName , length , align , paddingByte ) ; |
public class MappingFilterParser { /** * C : \ \ Project \ \ Obdalib \ \ obdalib - parent \ \ obdalib - core \ \ src \ \ main \ \ java \ \ it \ \ unibz \ \ inf \ \ obda \ \ gui \ \ swing \ \ utils \ \ MappingFilter . g : 42:1 : parse returns [ ArrayList < TreeModelFilter < OBDAMappingAxiom > > filterList ] : f1 = filter ( SEMI f2 = filter ) * EOF ; */
public final ArrayList < TreeModelFilter < SQLPPTriplesMap > > parse ( ) throws RecognitionException { } } | ArrayList < TreeModelFilter < SQLPPTriplesMap > > filterList = null ; TreeModelFilter < SQLPPTriplesMap > f1 = null ; TreeModelFilter < SQLPPTriplesMap > f2 = null ; filterList = new ArrayList < TreeModelFilter < SQLPPTriplesMap > > ( ) ; try { // C : \ \ Project \ \ Obdalib \ \ obdalib - parent \ \ obdalib - core \ \ src \ \ main \ \ java \ \ it \ \ unibz \ \ inf \ \ obda \ \ gui \ \ swing \ \ utils \ \ MappingFilter . g : 46:3 : ( f1 = filter ( SEMI f2 = filter ) * EOF )
// C : \ \ Project \ \ Obdalib \ \ obdalib - parent \ \ obdalib - core \ \ src \ \ main \ \ java \ \ it \ \ unibz \ \ inf \ \ obda \ \ gui \ \ swing \ \ utils \ \ MappingFilter . g : 46:5 : f1 = filter ( SEMI f2 = filter ) * EOF
{ pushFollow ( FOLLOW_filter_in_parse49 ) ; f1 = filter ( ) ; state . _fsp -- ; filterList . add ( f1 ) ; // C : \ \ Project \ \ Obdalib \ \ obdalib - parent \ \ obdalib - core \ \ src \ \ main \ \ java \ \ it \ \ unibz \ \ inf \ \ obda \ \ gui \ \ swing \ \ utils \ \ MappingFilter . g : 46:47 : ( SEMI f2 = filter ) *
loop1 : do { int alt1 = 2 ; int LA1_0 = input . LA ( 1 ) ; if ( ( LA1_0 == SEMI ) ) { alt1 = 1 ; } switch ( alt1 ) { case 1 : // C : \ \ Project \ \ Obdalib \ \ obdalib - parent \ \ obdalib - core \ \ src \ \ main \ \ java \ \ it \ \ unibz \ \ inf \ \ obda \ \ gui \ \ swing \ \ utils \ \ MappingFilter . g : 46:48 : SEMI f2 = filter
{ match ( input , SEMI , FOLLOW_SEMI_in_parse54 ) ; pushFollow ( FOLLOW_filter_in_parse58 ) ; f2 = filter ( ) ; state . _fsp -- ; filterList . add ( f2 ) ; } break ; default : break loop1 ; } } while ( true ) ; match ( input , EOF , FOLLOW_EOF_in_parse64 ) ; } } catch ( RecognitionException e ) { throw e ; } finally { // do for sure before leaving
} return filterList ; |
public class ColumnMaskedMatrix { /** * { @ inheritDoc } */
public void setRow ( int row , DoubleVector values ) { } } | if ( values . length ( ) != columns ) throw new IllegalArgumentException ( "cannot set a row " + "whose dimensions are different than the matrix" ) ; if ( values instanceof SparseVector ) { SparseVector sv = ( SparseVector ) values ; for ( int nz : sv . getNonZeroIndices ( ) ) backingMatrix . set ( nz , getRealColumn ( nz ) , values . get ( nz ) ) ; } else { for ( int i = 0 ; i < columnToReal . length ; ++ i ) backingMatrix . set ( i , columnToReal [ i ] , values . get ( i ) ) ; } |
public class AggregatePlanNode { /** * Add an aggregate to this plan node .
* @ param aggType
* @ param isDistinct Is distinct being applied to the argument of this aggregate ?
* @ param aggOutputColumn Which output column in the output schema this
* aggregate should occupy
* @ param aggInputExpr The input expression which should get aggregated */
public void addAggregate ( ExpressionType aggType , boolean isDistinct , Integer aggOutputColumn , AbstractExpression aggInputExpr ) { } } | m_aggregateTypes . add ( aggType ) ; if ( isDistinct ) { m_aggregateDistinct . add ( 1 ) ; } else { m_aggregateDistinct . add ( 0 ) ; } m_aggregateOutputColumns . add ( aggOutputColumn ) ; if ( aggType . isNullary ( ) ) { assert ( aggInputExpr == null ) ; m_aggregateExpressions . add ( null ) ; } else { assert ( aggInputExpr != null ) ; m_aggregateExpressions . add ( aggInputExpr . clone ( ) ) ; } |
public class CmsImportVersion7 { /** * Sets the aceFlags . < p >
* @ param aceFlags the aceFlags to set
* @ see # N _ FLAGS
* @ see # addResourceAceRules ( Digester , String ) */
public void setAceFlags ( String aceFlags ) { } } | try { m_aceFlags = Integer . parseInt ( aceFlags ) ; } catch ( Throwable e ) { m_throwable = e ; } |
public class ApiOvhRouter { /** * Accept , reject or cancel a pending request
* REST : POST / router / { serviceName } / privateLink / { peerServiceName } / request / manage
* @ param action [ required ]
* @ param serviceName [ required ] The internal name of your Router offer
* @ param peerServiceName [ required ] Service name of the other side of this link */
public String serviceName_privateLink_peerServiceName_request_manage_POST ( String serviceName , String peerServiceName , OvhPrivLinkReqActionEnum action ) throws IOException { } } | String qPath = "/router/{serviceName}/privateLink/{peerServiceName}/request/manage" ; StringBuilder sb = path ( qPath , serviceName , peerServiceName ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "action" , action ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , String . class ) ; |
public class Variable { /** * Gets the term of the given name .
* @ param name is the name of the term to retrieve
* @ return the term of the given name */
public Term getTerm ( String name ) { } } | for ( Term term : this . terms ) { if ( name . equals ( term . getName ( ) ) ) { return term ; } } return null ; |
public class AmazonIdentityManagementClient { /** * Lists the IAM groups that the specified IAM user belongs to .
* You can paginate the results using the < code > MaxItems < / code > and < code > Marker < / code > parameters .
* @ param listGroupsForUserRequest
* @ return Result of the ListGroupsForUser operation returned by the service .
* @ throws NoSuchEntityException
* The request was rejected because it referenced a resource entity that does not exist . The error message
* describes the resource .
* @ throws ServiceFailureException
* The request processing has failed because of an unknown error , exception or failure .
* @ sample AmazonIdentityManagement . ListGroupsForUser
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / iam - 2010-05-08 / ListGroupsForUser " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ListGroupsForUserResult listGroupsForUser ( ListGroupsForUserRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListGroupsForUser ( request ) ; |
public class AbstractResourceServices { /** * Trivial implementation that does * not * leverage bootstrap validation nor caching */
@ Override public ResourceReferenceFactory < Object > registerResourceInjectionPoint ( final InjectionPoint injectionPoint ) { } } | return new ResourceReferenceFactory < Object > ( ) { @ Override public ResourceReference < Object > createResource ( ) { return new SimpleResourceReference < Object > ( resolveResource ( injectionPoint ) ) ; } } ; |
public class BoosterParms { /** * Iterates over a set of parameters and applies locale - specific formatting
* to decimal ones ( Floats and Doubles ) .
* @ param params Parameters to localize
* @ return Map with localized parameter values */
private static Map < String , Object > localizeDecimalParams ( final Map < String , Object > params ) { } } | Map < String , Object > localized = new HashMap < > ( params . size ( ) ) ; final NumberFormat localizedNumberFormatter = DecimalFormat . getNumberInstance ( ) ; for ( String key : params . keySet ( ) ) { final Object value = params . get ( key ) ; final Object newValue ; if ( value instanceof Float || value instanceof Double ) { newValue = localizedNumberFormatter . format ( value ) ; } else newValue = value ; localized . put ( key , newValue ) ; } return Collections . unmodifiableMap ( localized ) ; |
public class PerformanceListenerStoreImpl { /** * { @ inheritDoc }
* After { @ link # optimizeGet ( ) } has been called , this method will return
* instances of { @ link CopyOnWriteArrayList } . */
@ Override protected < T > List < T > createListenerList ( int sizeHint ) { } } | if ( this . optimized ) { return new CopyOnWriteArrayList < > ( ) ; } return super . createListenerList ( sizeHint ) ; |
public class ActorToolbar { /** * Use this method to colorize toolbar icons to the desired target color
* @ param toolbarView toolbar view being colored
* @ param toolbarIconsColor the target color of toolbar icons
* @ param activity reference to activity needed to register observers */
public static void colorizeToolbar ( Toolbar toolbarView , int toolbarIconsColor , Activity activity ) { } } | final PorterDuffColorFilter colorFilter = new PorterDuffColorFilter ( toolbarIconsColor , PorterDuff . Mode . SRC_IN ) ; for ( int i = 0 ; i < toolbarView . getChildCount ( ) ; i ++ ) { final View v = toolbarView . getChildAt ( i ) ; doColorizing ( v , colorFilter , toolbarIconsColor ) ; } // Step 3 : Changing the color of title and subtitle .
toolbarView . setTitleTextColor ( toolbarIconsColor ) ; toolbarView . setSubtitleTextColor ( toolbarIconsColor ) ; |
public class HBaseClient { /** * ( non - Javadoc )
* @ see com . impetus . kundera . client . Client # findIdsByColumn ( java . lang . String ,
* java . lang . String , java . lang . String , java . lang . Object , java . lang . Class ) */
@ Override public Object [ ] findIdsByColumn ( String schemaName , String tableName , String pKeyName , String columnName , Object columnValue , Class entityClazz ) { } } | EntityMetadata m = KunderaMetadataManager . getEntityMetadata ( kunderaMetadata , entityClazz ) ; byte [ ] valueInBytes = HBaseUtils . getBytes ( columnValue ) ; Filter f = new SingleColumnValueFilter ( Bytes . toBytes ( tableName ) , Bytes . toBytes ( columnName ) , CompareOp . EQUAL , valueInBytes ) ; KeyOnlyFilter keyFilter = new KeyOnlyFilter ( ) ; FilterList filterList = new FilterList ( f , keyFilter ) ; try { return handler . scanRowyKeys ( filterList , schemaName , tableName , columnName + "_" + columnValue , m . getIdAttribute ( ) . getBindableJavaType ( ) ) ; } catch ( IOException e ) { log . error ( "Error while executing findIdsByColumn(), Caused by: ." , e ) ; throw new KunderaException ( e ) ; } |
public class StrBuilder { /** * Calls { @ link String # format ( String , Object . . . ) } and appends the result .
* @ param format the format string
* @ param objs the objects to use in the format string
* @ return { @ code this } to enable chaining
* @ see String # format ( String , Object . . . )
* @ since 3.2 */
@ GwtIncompatible ( "incompatible method" ) public StrBuilder append ( final String format , final Object ... objs ) { } } | return append ( String . format ( format , objs ) ) ; |
public class Types { /** * Return first abstract member of class ` sym ' . */
public MethodSymbol firstUnimplementedAbstract ( ClassSymbol sym ) { } } | try { return firstUnimplementedAbstractImpl ( sym , sym ) ; } catch ( CompletionFailure ex ) { chk . completionError ( enter . getEnv ( sym ) . tree . pos ( ) , ex ) ; return null ; } |
public class CPRuleUserSegmentRelPersistenceImpl { /** * Returns the last cp rule user segment rel in the ordered set where commerceUserSegmentEntryId = & # 63 ; .
* @ param commerceUserSegmentEntryId the commerce user segment entry ID
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching cp rule user segment rel
* @ throws NoSuchCPRuleUserSegmentRelException if a matching cp rule user segment rel could not be found */
@ Override public CPRuleUserSegmentRel findByCommerceUserSegmentEntryId_Last ( long commerceUserSegmentEntryId , OrderByComparator < CPRuleUserSegmentRel > orderByComparator ) throws NoSuchCPRuleUserSegmentRelException { } } | CPRuleUserSegmentRel cpRuleUserSegmentRel = fetchByCommerceUserSegmentEntryId_Last ( commerceUserSegmentEntryId , orderByComparator ) ; if ( cpRuleUserSegmentRel != null ) { return cpRuleUserSegmentRel ; } StringBundler msg = new StringBundler ( 4 ) ; msg . append ( _NO_SUCH_ENTITY_WITH_KEY ) ; msg . append ( "commerceUserSegmentEntryId=" ) ; msg . append ( commerceUserSegmentEntryId ) ; msg . append ( "}" ) ; throw new NoSuchCPRuleUserSegmentRelException ( msg . toString ( ) ) ; |
public class PlantUmlVerbatimSerializer { /** * Register an instance of { @ link PlantUmlVerbatimSerializer } in the given serializer ' s map . */
public static void addToMap ( final Map < String , VerbatimSerializer > serializerMap ) { } } | PlantUmlVerbatimSerializer serializer = new PlantUmlVerbatimSerializer ( ) ; for ( Type type : Type . values ( ) ) { String name = type . getName ( ) ; serializerMap . put ( name , serializer ) ; } |
public class ExpandableButtonMenu { /** * Inflates the view */
private void inflate ( ) { } } | ( ( LayoutInflater ) getContext ( ) . getSystemService ( Context . LAYOUT_INFLATER_SERVICE ) ) . inflate ( R . layout . ebm__menu , this , true ) ; mOverlay = findViewById ( R . id . ebm__menu_overlay ) ; mMidContainer = findViewById ( R . id . ebm__menu_middle_container ) ; mLeftContainer = findViewById ( R . id . ebm__menu_left_container ) ; mRightContainer = findViewById ( R . id . ebm__menu_right_container ) ; mMidText = ( TextView ) findViewById ( R . id . ebm__menu_middle_text ) ; mLeftText = ( TextView ) findViewById ( R . id . ebm__menu_left_text ) ; mRightText = ( TextView ) findViewById ( R . id . ebm__menu_right_text ) ; mCloseBtn = ( ImageButton ) findViewById ( R . id . ebm__menu_close_image ) ; mMidBtn = ( ImageButton ) findViewById ( R . id . ebm__menu_middle_image ) ; mRightBtn = ( ImageButton ) findViewById ( R . id . ebm__menu_right_image ) ; mLeftBtn = ( ImageButton ) findViewById ( R . id . ebm__menu_left_image ) ; sWidth = ScreenHelper . getScreenWidth ( getContext ( ) ) ; sHeight = ScreenHelper . getScreenHeight ( getContext ( ) ) ; mMidBtn . setEnabled ( false ) ; mRightBtn . setEnabled ( false ) ; mLeftBtn . setEnabled ( false ) ; mCloseBtn . setOnClickListener ( this ) ; mMidBtn . setOnClickListener ( this ) ; mRightBtn . setOnClickListener ( this ) ; mLeftBtn . setOnClickListener ( this ) ; mOverlay . setOnClickListener ( this ) ; |
public class ArmeriaConfigurationUtil { /** * Parses the data size text as a decimal { @ code long } .
* @ param dataSizeText the data size text , i . e . { @ code 1 } , { @ code 1B } , { @ code 1KB } , { @ code 1MB } ,
* { @ code 1GB } or { @ code 1TB } */
public static long parseDataSize ( String dataSizeText ) { } } | requireNonNull ( dataSizeText , "text" ) ; final Matcher matcher = DATA_SIZE_PATTERN . matcher ( dataSizeText ) ; checkArgument ( matcher . matches ( ) , "Invalid data size text: %s (expected: %s)" , dataSizeText , DATA_SIZE_PATTERN ) ; final long unit ; final String unitText = matcher . group ( 2 ) ; if ( Strings . isNullOrEmpty ( unitText ) ) { unit = 1L ; } else { switch ( Ascii . toLowerCase ( unitText ) ) { case "b" : unit = 1L ; break ; case "kb" : unit = 1024L ; break ; case "mb" : unit = 1024L * 1024L ; break ; case "gb" : unit = 1024L * 1024L * 1024L ; break ; case "tb" : unit = 1024L * 1024L * 1024L * 1024L ; break ; default : throw new IllegalArgumentException ( "Invalid data size text: " + dataSizeText + " (expected: " + DATA_SIZE_PATTERN + ')' ) ; } } try { final long amount = Long . parseLong ( matcher . group ( 1 ) ) ; return LongMath . checkedMultiply ( amount , unit ) ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Invalid data size text: " + dataSizeText + " (expected: " + DATA_SIZE_PATTERN + ')' , e ) ; } |
public class StringIterate { /** * For each int code point in the { @ code string } in reverse order , execute the { @ link CodePointProcedure } .
* @ deprecated since 7.0 . Use { @ link # reverseForEachCodePoint ( String , CodePointProcedure ) } instead . */
@ Deprecated public static void reverseForEach ( String string , CodePointProcedure procedure ) { } } | StringIterate . reverseForEachCodePoint ( string , procedure ) ; |
public class Reductions { /** * Reduces an array of elements using the passed function .
* @ param < E > the element type parameter
* @ param < R > the result type parameter
* @ param array the array to be consumed
* @ param function the reduction function
* @ param init the initial value for reductions
* @ return the reduced value */
public static < E , R > R reduce ( E [ ] array , BiFunction < R , E , R > function , R init ) { } } | return new Reductor < > ( function , init ) . apply ( new ArrayIterator < E > ( array ) ) ; |
public class VitalTransformer { /** * Retrieve the payload from storage and return as a byte array .
* @ param object Our digital object .
* @ param pid The payload ID to retrieve .
* @ return byte [ ] The byte array containing payload data
* @ throws Exception on any errors */
private byte [ ] getBytes ( DigitalObject object , String pid ) throws Exception { } } | // These can happily throw exceptions higher
Payload payload = object . getPayload ( pid ) ; InputStream in = payload . open ( ) ; byte [ ] result = null ; // But here , the payload must receive
// a close before throwing the error
try { result = IOUtils . toByteArray ( in ) ; } catch ( Exception ex ) { throw ex ; } finally { payload . close ( ) ; } return result ; |
public class EditScript { /** * { @ inheritDoc } */
@ Override public Diff next ( ) { } } | if ( mIndex < mChanges . size ( ) ) { return mChanges . get ( mIndex ++ ) ; } else { throw new NoSuchElementException ( "No more elements in the change list!" ) ; } |
public class KinesisActionMarshaller { /** * Marshall the given parameter object . */
public void marshall ( KinesisAction kinesisAction , ProtocolMarshaller protocolMarshaller ) { } } | if ( kinesisAction == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( kinesisAction . getRoleArn ( ) , ROLEARN_BINDING ) ; protocolMarshaller . marshall ( kinesisAction . getStreamName ( ) , STREAMNAME_BINDING ) ; protocolMarshaller . marshall ( kinesisAction . getPartitionKey ( ) , PARTITIONKEY_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class MvpLceFragment { /** * Create the loading view . Default is { @ code findViewById ( R . id . loadingView ) }
* @ param view The main view returned from { @ link # onCreateView ( LayoutInflater , ViewGroup , * Bundle ) }
* @ return the loading view */
@ NonNull protected View createLoadingView ( View view ) { } } | return view . findViewById ( R . id . loadingView ) ; |
public class NewRelicMeterRegistry { /** * VisibleForTesting */
Stream < String > writeGauge ( Gauge gauge ) { } } | Double value = gauge . value ( ) ; if ( Double . isFinite ( value ) ) { return Stream . of ( event ( gauge . getId ( ) , new Attribute ( "value" , value ) ) ) ; } return Stream . empty ( ) ; |
public class BraveSpan { /** * Converts a map to a string of form : " key1 = value1 key2 = value2" */
static String toAnnotation ( Map < String , ? > fields ) { } } | // special - case the " event " field which is similar to the semantics of a zipkin annotation
Object event = fields . get ( "event" ) ; if ( event != null && fields . size ( ) == 1 ) return event . toString ( ) ; return joinOnEqualsSpace ( fields ) ; |
public class AuthorizedList { /** * Adds a resource that the user should be allowed to access
* @ param theResources The resource names , e . g . " Patient / 123 " ( in this example the user would be allowed to access Patient / 123 but not Observations where Observation . subject = " Patient / 123 " m , etc .
* @ return Returns < code > this < / code > for easy method chaining */
public AuthorizedList addResources ( String ... theResources ) { } } | Validate . notNull ( theResources , "theResources must not be null" ) ; for ( String next : theResources ) { addResource ( next ) ; } return this ; |
public class JobInProgress { /** * Return a MapTask , if appropriate , to run on the given tasktracker */
public synchronized Task obtainNewMapTask ( TaskTrackerStatus tts , int clusterSize , int numUniqueHosts , int maxCacheLevel ) throws IOException { } } | if ( status . getRunState ( ) != JobStatus . RUNNING ) { LOG . info ( "Cannot create task split for " + profile . getJobID ( ) ) ; return null ; } int target = findNewMapTask ( tts , clusterSize , numUniqueHosts , maxCacheLevel ) ; if ( target == - 1 ) { return null ; } Task result = maps [ target ] . getTaskToRun ( tts . getTrackerName ( ) ) ; if ( result != null ) { addRunningTaskToTIP ( maps [ target ] , result . getTaskID ( ) , tts , true ) ; } return result ; |
public class StereoTool { /** * Checks these 7 atoms to see if they are at the points of an octahedron .
* @ param atomA one of the axial atoms
* @ param atomB the central atom
* @ param atomC one of the equatorial atoms
* @ param atomD one of the equatorial atoms
* @ param atomE one of the equatorial atoms
* @ param atomF one of the equatorial atoms
* @ param atomG the other axial atom
* @ return true if the geometry is octahedral */
public static boolean isOctahedral ( IAtom atomA , IAtom atomB , IAtom atomC , IAtom atomD , IAtom atomE , IAtom atomF , IAtom atomG ) { } } | Point3d pointA = atomA . getPoint3d ( ) ; Point3d pointB = atomB . getPoint3d ( ) ; Point3d pointC = atomC . getPoint3d ( ) ; Point3d pointD = atomD . getPoint3d ( ) ; Point3d pointE = atomE . getPoint3d ( ) ; Point3d pointF = atomF . getPoint3d ( ) ; Point3d pointG = atomG . getPoint3d ( ) ; // the points on the axis should be in a line
boolean isColinearABG = isColinear ( pointA , pointB , pointG ) ; if ( ! isColinearABG ) return false ; // check that CDEF are in a plane
Vector3d normal = new Vector3d ( ) ; isSquarePlanar ( pointC , pointD , pointE , pointF , normal ) ; // now check rotation in relation to the first atom
Vector3d vectorAB = new Vector3d ( pointA ) ; vectorAB . sub ( pointB ) ; // that is , they point in opposite directions
return normal . dot ( vectorAB ) < 0 ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.