signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class LowLevelAbstractionDefinition { /** * Test whether or not the given time series satisfies the constraints of
* this detector and an optional algorithm . If no algorithm is specified ,
* then this test just uses the detector ' s constraints .
* @ param segment
* a time series < code > Segment < / code > .
* @ param algorithm
* an < code > Algorithm < / code > , or < code > null < / code > to
* specify no algorithm .
* @ return < code > true < / code > if the time series segment satisfies the
* constraints of this detector , < code > false < / code > otherwise
* @ throws AlgorithmProcessingException
* @ throws AlgorithmInitializationException */
final LowLevelAbstractionValueDefinition satisfiedBy ( Segment < PrimitiveParameter > segment , Algorithm algorithm ) throws AlgorithmInitializationException , AlgorithmProcessingException { } } | if ( satisfiesGapBetweenValues ( segment ) ) { for ( LowLevelAbstractionValueDefinition valueDef : this . valueDefinitions ) { if ( valueDef . satisfiedBy ( segment , algorithm ) ) { return valueDef ; } } } return null ; |
public class TypeParser { /** * Parses the given { @ code input } string to the given { @ code targetType } .
* Example : < br / >
* < code >
* TypeParser parser = TypeParser . newBuilder ( ) . build ( ) ; < br / >
* Integer i = parser . parse ( " 1 " , Integer . class ) ;
* < / code >
* @ param input - string value to parse
* @ param targetType - the expected type to convert { @ code input } to .
* @ return an instance of { @ code targetType } corresponding to the given { @ code input } .
* @ throws NullPointerException if any given argument is { @ code null } .
* @ throws TypeParserException if anything goes wrong while parsing { @ code input } to the given
* { @ code targetType } .
* @ throws NoSuchRegisteredParserException if there is no registered { @ link Parser } for the
* given { @ code targetType } . */
public < T > T parse ( String input , Class < T > targetType ) { } } | if ( input == null ) { throw new NullPointerException ( makeNullArgumentErrorMsg ( "input" ) ) ; } if ( targetType == null ) { throw new NullPointerException ( makeNullArgumentErrorMsg ( "targetType" ) ) ; } @ SuppressWarnings ( "unchecked" ) T temp = ( T ) parseType2 ( input , new TargetType ( targetType ) ) ; return temp ; |
public class SimpleConfigProperties { /** * Converts a hierarchical { @ link Map } of configuration values to { @ link ConfigProperties } . E . g . the hierarchical map
* < code > { " foo " = { " bar " = { " some " = " my - value " , " other " = " magic - value " } } } < / code > would result in { @ link ConfigProperties }
* { @ code myRoot } such that
* < code > myRoot . { @ link # getChild ( String . . . ) getChild } ( " foo " , " bar " ) . { @ link # getChildKeys ( ) } < / code > returns the
* { @ link Collection } { " some " , " other " } and
* < code > myRoot . { @ link # getChildValue ( String ) getValue } ( " foo . bar . some " ) < / code > returns " my - value " .
* @ param key the top - level key of the returned root { @ link ConfigProperties } - node . Typically the empty string ( " " )
* for root .
* @ param map the hierarchical { @ link Map } of the configuration values .
* @ return the root { @ link ConfigProperties } - node of the given hierarchical { @ link Map } converted to
* { @ link ConfigProperties } . */
public static ConfigProperties ofHierarchicalMap ( String key , Map < String , Object > map ) { } } | SimpleConfigProperties root = new SimpleConfigProperties ( key ) ; root . fromHierarchicalMap ( map ) ; return root ; |
public class CmsXmlEntityResolver { /** * Checks whether the given schema id is an internal schema id or is translated to an internal schema id . < p >
* @ param schema the schema id
* @ return true if the given schema id is an internal schema id or translated to an internal schema id */
public static boolean isInternalId ( String schema ) { } } | String translatedId = translateLegacySystemId ( schema ) ; if ( translatedId . startsWith ( INTERNAL_SCHEME ) ) { return true ; } return false ; |
public class ComplexFloat { /** * Multiply two complex numbers , in - place
* @ param c other complex number
* @ param result complex number where product is stored
* @ return same as result */
public ComplexFloat muli ( ComplexFloat c , ComplexFloat result ) { } } | float newR = r * c . r - i * c . i ; float newI = r * c . i + i * c . r ; result . r = newR ; result . i = newI ; return result ; |
public class AliPayApi { /** * 红包页面支付接口
* @ param model
* { AlipayFundCouponOrderPagePayModel }
* @ return { AlipayFundCouponOrderPagePayResponse }
* @ throws { AlipayApiException } */
public static AlipayFundCouponOrderPagePayResponse fundCouponOrderPagePayToResponse ( AlipayFundCouponOrderPagePayModel model ) throws AlipayApiException { } } | AlipayFundCouponOrderPagePayRequest request = new AlipayFundCouponOrderPagePayRequest ( ) ; request . setBizModel ( model ) ; return AliPayApiConfigKit . getAliPayApiConfig ( ) . getAlipayClient ( ) . execute ( request ) ; |
public class IsotopeFactory { /** * Get an isotope based on the element symbol and exact mass .
* @ param symbol the element symbol
* @ param exactMass the mass number
* @ param tolerance allowed difference from provided exact mass
* @ return the corresponding isotope */
public IIsotope getIsotope ( String symbol , double exactMass , double tolerance ) { } } | IIsotope ret = null ; double minDiff = Double . MAX_VALUE ; int elem = Elements . ofString ( symbol ) . number ( ) ; List < IIsotope > isotopes = this . isotopes [ elem ] ; if ( isotopes == null ) return null ; for ( IIsotope isotope : isotopes ) { double diff = Math . abs ( isotope . getExactMass ( ) - exactMass ) ; if ( isotope . getSymbol ( ) . equals ( symbol ) && diff <= tolerance && diff < minDiff ) { ret = clone ( isotope ) ; minDiff = diff ; } } return ret ; |
public class IncrementalSemanticAnalysis { /** * Returns the current semantic vector for the provided word , or if the word
* is not currently in the semantic space , a vector is added for it and
* returned .
* @ param word a word
* @ return the { @ code SemanticVector } for the provide word . */
private SemanticVector getSemanticVector ( String word ) { } } | SemanticVector v = wordToMeaning . get ( word ) ; if ( v == null ) { v = ( useSparseSemantics ) ? new SparseSemanticVector ( vectorLength ) : new DenseSemanticVector ( vectorLength ) ; wordToMeaning . put ( word , v ) ; } return v ; |
public class NFAState { /** * Adds a set of transitions
* @ param rs
* @ param to */
public void addTransition ( RangeSet rs , NFAState < T > to ) { } } | for ( CharRange c : rs ) { addTransition ( c , to ) ; } edges . add ( to ) ; to . inStates . add ( this ) ; |
public class RandomVariableDifferentiableAADPathwise { /** * / * ( non - Javadoc )
* @ see net . finmath . stochastic . RandomVariable # addProduct ( net . finmath . stochastic . RandomVariable , double ) */
@ Override public RandomVariable addProduct ( RandomVariable factor1 , double factor2 ) { } } | return new RandomVariableDifferentiableAADPathwise ( getValues ( ) . addProduct ( factor1 , factor2 ) , Arrays . asList ( this , factor1 , new RandomVariableFromDoubleArray ( factor2 ) ) , OperatorType . ADDPRODUCT ) ; |
public class SearchOptions { /** * Sets the limit on the number of results to return . */
public SearchOptions setLimit ( int limit ) { } } | if ( limit <= 0 ) { this . limit = MAX_LIMIT ; } else { this . limit = Math . min ( limit , MAX_LIMIT ) ; } return this ; |
public class HpelPlainFormatter { /** * Generates the short type string based off the RepositoryLogRecord ' s Level .
* @ param logRecord
* @ return String - The type . */
protected static String mapLevelToType ( RepositoryLogRecord logRecord ) { } } | if ( null == logRecord ) { return " Z " ; } Level l = logRecord . getLevel ( ) ; if ( null == l ) { return " Z " ; } // In HPEL SystemOut and SystemErr are recorded in custom level but since we want
// them to be handled specially do it now before checking for custom levels
String s = logRecord . getLoggerName ( ) ; if ( s != null ) { if ( s . equals ( "SystemOut" ) ) { return " O " ; } else if ( s . equals ( "SystemErr" ) ) { return " R " ; } } String id = customLevels . get ( l ) ; if ( id != null ) { return ( " " + id + " " ) ; } // Since we have used the static Level object throughout the logging framework
// object reference comparisons should work .
if ( l == Level . SEVERE ) { return " E " ; } if ( l == Level . WARNING ) { return " W " ; } if ( l == Level . INFO ) { return " I " ; } if ( l == Level . CONFIG ) { return " C " ; } if ( l == Level . FINE ) { return " 1 " ; } if ( l == Level . FINER ) { // D198403 Start
// added check for Entry and Exit messages to return < or >
String message = logRecord . getRawMessage ( ) ; if ( message != null ) { if ( message . indexOf ( "Entry" ) != - 1 || message . indexOf ( "ENTRY" ) != - 1 ) { return " > " ; } if ( message . indexOf ( "Exit" ) != - 1 || message . indexOf ( "RETURN" ) != - 1 ) { return " < " ; } } return " 2 " ; // D198403 End
} if ( l == Level . FINEST ) { return " 3 " ; } return " Z " ; |
public class ImageFormatList { /** * this method returns a format in a list given its index
* @ param l the image format list
* @ param i the index of the format
* @ return the image format with the given index , or null */
private ImageFormat getFormat ( List < ImageFormat > l , int i ) { } } | for ( ImageFormat f : l ) if ( f . getIndex ( ) == i ) return f ; return null ; |
public class RTMPProtocolEncoder { /** * Determine type of header to use .
* @ param header RTMP message header
* @ param lastHeader Previous header
* @ return Header type to use */
private byte getHeaderType ( final Header header , final Header lastHeader ) { } } | // int lastFullTs = ( ( RTMPConnection ) Red5 . getConnectionLocal ( ) ) . getState ( ) . getLastFullTimestampWritten ( header . getChannelId ( ) ) ;
if ( lastHeader == null || header . getStreamId ( ) != lastHeader . getStreamId ( ) || header . getTimer ( ) < lastHeader . getTimer ( ) ) { // new header mark if header for another stream
return HEADER_NEW ; } else if ( header . getSize ( ) != lastHeader . getSize ( ) || header . getDataType ( ) != lastHeader . getDataType ( ) ) { // same source header if last header data type or size differ
return HEADER_SAME_SOURCE ; } else if ( header . getTimer ( ) != lastHeader . getTimer ( ) ) { // timer change marker if there ' s time gap between header time stamps
return HEADER_TIMER_CHANGE ; } // continue encoding
return HEADER_CONTINUE ; |
public class SubWriterHolderWriter { /** * Get the method type links for the table caption .
* @ param methodType the method type to be displayed as link
* @ return the content tree for the method type link */
public Content getMethodTypeLinks ( MethodTypes methodType ) { } } | String jsShow = "javascript:show(" + methodType . tableTabs ( ) . value ( ) + ");" ; HtmlTree link = HtmlTree . A ( jsShow , configuration . getContent ( methodType . tableTabs ( ) . resourceKey ( ) ) ) ; return link ; |
public class Inet6Address { /** * Utility routine to check if the InetAddress in a wildcard address .
* @ return a < code > boolean < / code > indicating if the Inetaddress is
* a wildcard address .
* @ since 1.4 */
@ Override public boolean isAnyLocalAddress ( ) { } } | byte test = 0x00 ; for ( int i = 0 ; i < INADDRSZ ; i ++ ) { test |= ipaddress [ i ] ; } return ( test == 0x00 ) ; |
public class CDKHueckelAromaticityDetector { /** * Tests if the electron count matches the H & uuml ; ckel 4n + 2 rule . */
private static boolean isHueckelValid ( IAtomContainer singleRing ) throws CDKException { } } | int electronCount = 0 ; for ( IAtom ringAtom : singleRing . atoms ( ) ) { if ( ringAtom . getHybridization ( ) != CDKConstants . UNSET && ( ringAtom . getHybridization ( ) == Hybridization . SP2 ) || ringAtom . getHybridization ( ) == Hybridization . PLANAR3 ) { // for example , a carbon
// note : the double bond is in the ring , that has been tested earlier
// FIXME : this does assume bond orders to be resolved too , when detecting
// sprouting double bonds
if ( "N.planar3" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "N.minus.planar3" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "N.amide" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "S.2" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "S.planar3" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "C.minus.planar" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "O.planar3" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 2 ; } else if ( "N.sp2.3" . equals ( ringAtom . getAtomTypeName ( ) ) ) { electronCount += 1 ; } else { if ( factory == null ) { factory = AtomTypeFactory . getInstance ( "org/openscience/cdk/dict/data/cdk-atom-types.owl" , ringAtom . getBuilder ( ) ) ; } IAtomType type = factory . getAtomType ( ringAtom . getAtomTypeName ( ) ) ; Object property = type . getProperty ( CDKConstants . PI_BOND_COUNT ) ; if ( property != null && property instanceof Integer ) { electronCount += ( ( Integer ) property ) . intValue ( ) ; } } } else if ( ringAtom . getHybridization ( ) != null && ringAtom . getHybridization ( ) == Hybridization . SP3 && getLonePairCount ( ringAtom ) > 0 ) { // for example , a nitrogen or oxygen
electronCount += 2 ; } } return ( electronCount % 4 == 2 ) && ( electronCount > 2 ) ; |
public class JQMSearch { /** * Standard GWT ChangeEvent is not working for search input , that ' s why we have to activate
* it manually by listening jQuery change event . */
private void initChangeHandler ( ) { } } | JQMChangeHandler handler = new JQMChangeHandler ( ) { @ Override public void onEvent ( JQMEvent < ? > event ) { DomEvent . fireNativeEvent ( Document . get ( ) . createChangeEvent ( ) , input ) ; } } ; JQMHandlerRegistration . registerJQueryHandler ( new WidgetHandlerCounter ( ) { @ Override public int getHandlerCountForWidget ( GwtEvent . Type < ? > type ) { return getHandlerCount ( type ) ; } } , this , handler , JQMComponentEvents . CHANGE , JQMEventFactory . getType ( JQMComponentEvents . CHANGE , JQMChangeHandler . class ) ) ; |
public class InternalCache2kBuilder { /** * The generic wiring code is not working on android .
* Explicitly call the wiring methods . */
@ SuppressWarnings ( "unchecked" ) private void configureViaSettersDirect ( HeapCache < K , V > c ) { } } | if ( config . getLoader ( ) != null ) { Object obj = c . createCustomization ( config . getLoader ( ) ) ; if ( obj instanceof CacheLoader ) { final CacheLoader < K , V > _loader = ( CacheLoader ) obj ; c . setAdvancedLoader ( new AdvancedCacheLoader < K , V > ( ) { @ Override public V load ( final K key , final long currentTime , final CacheEntry < K , V > currentEntry ) throws Exception { return _loader . load ( key ) ; } } ) ; } else { final FunctionalCacheLoader < K , V > _loader = ( FunctionalCacheLoader ) obj ; c . setAdvancedLoader ( new AdvancedCacheLoader < K , V > ( ) { @ Override public V load ( final K key , final long currentTime , final CacheEntry < K , V > currentEntry ) throws Exception { return _loader . load ( key ) ; } } ) ; } } if ( config . getAdvancedLoader ( ) != null ) { final AdvancedCacheLoader < K , V > _loader = c . createCustomization ( config . getAdvancedLoader ( ) ) ; AdvancedCacheLoader < K , V > _wrappedLoader = new WrappedAdvancedCacheLoader < K , V > ( c , _loader ) ; c . setAdvancedLoader ( _wrappedLoader ) ; } if ( config . getExceptionPropagator ( ) != null ) { c . setExceptionPropagator ( c . createCustomization ( config . getExceptionPropagator ( ) ) ) ; } c . setCacheConfig ( config ) ; |
public class ReUtil { /** * 指定内容中是否有表达式匹配的内容
* @ param pattern 编译后的正则模式
* @ param content 被查找的内容
* @ return 指定内容中是否有表达式匹配的内容
* @ since 3.3.1 */
public static boolean contains ( Pattern pattern , CharSequence content ) { } } | if ( null == pattern || null == content ) { return false ; } return pattern . matcher ( content ) . find ( ) ; |
public class IOUtils { /** * Creates formatted String for displaying conservation legend in PDB output
* @ return legend String */
public static String getPDBLegend ( ) { } } | StringBuilder s = new StringBuilder ( ) ; s . append ( "</pre></div>" ) ; s . append ( " <div class=\"subText\">" ) ; s . append ( " <b>Legend:</b>" ) ; s . append ( " <span class=\"m\">Green</span> - identical residues |" ) ; s . append ( " <span class=\"sm\">Pink</span> - similar residues | " ) ; s . append ( " <span class=\"qg\">Blue</span> - sequence mismatch |" ) ; s . append ( " <span class=\"dm\">Brown</span> - insertion/deletion |" ) ; s . append ( " </div>" ) ; s . append ( String . format ( "%n" ) ) ; return s . toString ( ) ; |
public class NonSymmetricEquals { /** * implements the visitor to see if this method is equals ( Object o )
* @ param obj
* the context object of the currently parsed code block */
@ Override public void visitCode ( Code obj ) { } } | Method m = getMethod ( ) ; String name = m . getName ( ) ; String signature = m . getSignature ( ) ; if ( "equals" . equals ( name ) && SignatureBuilder . SIG_OBJECT_TO_BOOLEAN . equals ( signature ) && prescreen ( m ) ) { stack . resetForMethodEntry ( this ) ; super . visitCode ( obj ) ; } |
public class CCEncoder { /** * Encodes an incremental cardinality constraint and returns its encoding .
* @ param cc the cardinality constraint
* @ return the encoding of the constraint and the incremental data */
public Pair < ImmutableFormulaList , CCIncrementalData > encodeIncremental ( final PBConstraint cc ) { } } | final EncodingResult result = EncodingResult . resultForFormula ( f ) ; final CCIncrementalData incData = this . encodeIncremental ( cc , result ) ; return new Pair < > ( new ImmutableFormulaList ( FType . AND , result . result ( ) ) , incData ) ; |
public class RecyclerLinePageIndicator { /** * Determines the width of this view
* @ param measureSpec
* A measureSpec packed into an int
* @ return The width of the view , honoring constraints from measureSpec */
private int measureWidth ( int measureSpec ) { } } | float result ; int specMode = MeasureSpec . getMode ( measureSpec ) ; int specSize = MeasureSpec . getSize ( measureSpec ) ; if ( ( specMode == MeasureSpec . EXACTLY ) || ( mRecyclerView == null ) ) { // We were told how big to be
result = specSize ; } else { // Calculate the width according the views count
final int count = mRecyclerView . getAdapter ( ) . getItemCount ( ) ; result = getPaddingLeft ( ) + getPaddingRight ( ) + ( count * mLineWidth ) + ( ( count - 1 ) * mGapWidth ) ; // Respect AT _ MOST value if that was what is called for by measureSpec
if ( specMode == MeasureSpec . AT_MOST ) { result = Math . min ( result , specSize ) ; } } return ( int ) Math . ceil ( result ) ; |
public class BaseXMLBuilder { /** * Return the Document node representing the n < em > th < / em > ancestor element
* of this node , or the root node if n exceeds the document ' s depth .
* @ param steps
* the number of parent elements to step over while navigating up the chain
* of node ancestors . A steps value of 1 will find a node ' s parent , 2 will
* find its grandparent etc .
* @ return
* the n < em > th < / em > ancestor of this node , or the root node if this is
* reached before the n < em > th < / em > parent is found . */
protected Node upImpl ( int steps ) { } } | Node currNode = this . xmlNode ; int stepCount = 0 ; while ( currNode . getParentNode ( ) != null && stepCount < steps ) { currNode = currNode . getParentNode ( ) ; stepCount ++ ; } return currNode ; |
public class PropsCodeGen { /** * import ConfigProperty
* @ param def definition
* @ param out Writer
* @ throws IOException IOException */
protected void importConfigProperty ( Definition def , Writer out ) throws IOException { } } | if ( getConfigProps ( def ) . size ( ) > 0 ) { out . write ( "import javax.resource.spi.ConfigProperty;\n" ) ; } |
public class BaseField { /** * Convert this index to a string .
* This method is usually overidden by popup fields .
* @ param index The index to convert .
* @ return The display string . */
public String convertIndexToString ( int index ) { } } | String tempString = null ; if ( ( index >= 0 ) && ( index <= 9 ) ) { char value [ ] = new char [ 1 ] ; value [ 0 ] = ( char ) ( '0' + index ) ; tempString = new String ( value ) ; // 1 = ' 1 ' ; 2 = ' 2 ' ; etc . . .
} else tempString = Constants . BLANK ; return tempString ; |
public class AsyncRequestHandler { /** * Returns true if the request should continue .
* @ return */
private boolean initRequestHandler ( SelectionKey selectionKey ) { } } | ByteBuffer inputBuffer = inputStream . getBuffer ( ) ; int remaining = inputBuffer . remaining ( ) ; // Don ' t have enough bytes to determine the protocol yet . . .
if ( remaining < 3 ) return true ; byte [ ] protoBytes = { inputBuffer . get ( 0 ) , inputBuffer . get ( 1 ) , inputBuffer . get ( 2 ) } ; try { String proto = ByteUtils . getString ( protoBytes , "UTF-8" ) ; inputBuffer . clear ( ) ; RequestFormatType requestFormatType = RequestFormatType . fromCode ( proto ) ; requestHandler = requestHandlerFactory . getRequestHandler ( requestFormatType ) ; if ( logger . isInfoEnabled ( ) ) logger . info ( "Protocol negotiated for " + socketChannel . socket ( ) + ": " + requestFormatType . getDisplayName ( ) ) ; // The protocol negotiation is the first request , so respond by
// sticking the bytes in the output buffer , signaling the Selector ,
// and returning false to denote no further processing is needed .
outputStream . getBuffer ( ) . put ( ByteUtils . getBytes ( "ok" , "UTF-8" ) ) ; prepForWrite ( selectionKey ) ; return false ; } catch ( IllegalArgumentException e ) { // okay we got some nonsense . For backwards compatibility ,
// assume this is an old client who does not know how to negotiate
RequestFormatType requestFormatType = RequestFormatType . VOLDEMORT_V0 ; requestHandler = requestHandlerFactory . getRequestHandler ( requestFormatType ) ; if ( logger . isInfoEnabled ( ) ) logger . info ( "No protocol proposal given for " + socketChannel . socket ( ) + ", assuming " + requestFormatType . getDisplayName ( ) ) ; return true ; } |
public class systemglobal_auditsyslogpolicy_binding { /** * Use this API to fetch filtered set of systemglobal _ auditsyslogpolicy _ binding resources .
* filter string should be in JSON format . eg : " port : 80 , servicetype : HTTP " . */
public static systemglobal_auditsyslogpolicy_binding [ ] get_filtered ( nitro_service service , String filter ) throws Exception { } } | systemglobal_auditsyslogpolicy_binding obj = new systemglobal_auditsyslogpolicy_binding ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; systemglobal_auditsyslogpolicy_binding [ ] response = ( systemglobal_auditsyslogpolicy_binding [ ] ) obj . getfiltered ( service , option ) ; return response ; |
public class CommerceOrderItemPersistenceImpl { /** * Returns all the commerce order items where CPInstanceId = & # 63 ; .
* @ param CPInstanceId the cp instance ID
* @ return the matching commerce order items */
@ Override public List < CommerceOrderItem > findByCPInstanceId ( long CPInstanceId ) { } } | return findByCPInstanceId ( CPInstanceId , QueryUtil . ALL_POS , QueryUtil . ALL_POS , null ) ; |
public class Formation { /** * Changes the pattern of this formation and updates slot assignments if the number of member is supported by the given
* pattern .
* @ param pattern the pattern to set
* @ return { @ code true } if the pattern has effectively changed ; { @ code false } otherwise . */
public boolean changePattern ( FormationPattern < T > pattern ) { } } | // Find out how many slots we have occupied
int occupiedSlots = slotAssignments . size ; // Check if the pattern supports one more slot
if ( pattern . supportsSlots ( occupiedSlots ) ) { setPattern ( pattern ) ; // Update the slot assignments and return success
updateSlotAssignments ( ) ; return true ; } return false ; |
public class LoginHandler { /** * The person represented in the JAAS login context is created and
* associated to eFaps . If the person is defined in more than one JAAS
* system , the person is also associated to the other JAAS systems .
* @ param _ login JAAS login context
* @ return Java instance of newly created person
* @ throws EFapsException if a method of the principals inside the JAAS
* login contexts could not be executed . */
protected Person createPerson ( final LoginContext _login ) throws EFapsException { } } | Person person = null ; for ( final JAASSystem system : JAASSystem . getAllJAASSystems ( ) ) { final Set < ? > users = _login . getSubject ( ) . getPrincipals ( system . getPersonJAASPrincipleClass ( ) ) ; for ( final Object persObj : users ) { try { final String persKey = ( String ) system . getPersonMethodKey ( ) . invoke ( persObj ) ; final String persName = ( String ) system . getPersonMethodName ( ) . invoke ( persObj ) ; if ( person == null ) { person = Person . createPerson ( system , persKey , persName , null ) ; } else { person . assignToJAASSystem ( system , persKey ) ; } } catch ( final IllegalAccessException e ) { LoginHandler . LOG . error ( "could not execute a person method for system " + system . getName ( ) , e ) ; throw new EFapsException ( LoginHandler . class , "IllegalAccessException" , e ) ; } catch ( final IllegalArgumentException e ) { LoginHandler . LOG . error ( "could not execute a person method for system " + system . getName ( ) , e ) ; throw new EFapsException ( LoginHandler . class , "IllegalArgumentException" , e ) ; } catch ( final InvocationTargetException e ) { LoginHandler . LOG . error ( "could not execute a person method for system " + system . getName ( ) , e ) ; throw new EFapsException ( LoginHandler . class , "InvocationTargetException" , e ) ; } } } return person ; |
public class HtmlPageUtil { /** * Creates a { @ link HtmlPage } from a given { @ link Reader } that reads the HTML code for that page .
* @ param reader { @ link Reader } that reads the HTML code
* @ return { @ link HtmlPage } for this { @ link Reader } */
public static HtmlPage toHtmlPage ( Reader reader ) { } } | try { return toHtmlPage ( IOUtils . toString ( reader ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Error creating HtmlPage from Reader." , e ) ; } |
public class PolicyStatesInner { /** * Queries policy states for the subscription level policy definition .
* @ param policyStatesResource The virtual resource under PolicyStates resource type . In a given time range , ' latest ' represents the latest policy state ( s ) , whereas ' default ' represents all policy state ( s ) . Possible values include : ' default ' , ' latest '
* @ param subscriptionId Microsoft Azure subscription ID .
* @ param policyDefinitionName Policy definition name .
* @ param queryOptions Additional parameters for the operation
* @ 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 < PolicyStatesQueryResultsInner > listQueryResultsForPolicyDefinitionAsync ( PolicyStatesResource policyStatesResource , String subscriptionId , String policyDefinitionName , QueryOptions queryOptions , final ServiceCallback < PolicyStatesQueryResultsInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( listQueryResultsForPolicyDefinitionWithServiceResponseAsync ( policyStatesResource , subscriptionId , policyDefinitionName , queryOptions ) , serviceCallback ) ; |
public class JanusConfig { /** * Replies the value of the system property .
* @ param name
* - name of the property .
* @ param defaultValue
* - value to reply if the these is no property found
* @ return the value , or defaultValue . */
public static String getSystemProperty ( String name , String defaultValue ) { } } | String value ; value = System . getProperty ( name , null ) ; if ( value != null ) { return value ; } value = System . getenv ( name ) ; if ( value != null ) { return value ; } return defaultValue ; |
public class Sort { /** * Check if the long array is reverse sorted . It loops through the entire long
* array once , checking that the elements are reverse sorted .
* < br >
* < br >
* < i > Runtime : < / i > O ( n )
* @ param longArray the long array to check
* @ return < i > true < / i > if the long array is reverse sorted , else < i > false < / i > . */
public static boolean isReverseSorted ( long [ ] longArray ) { } } | for ( int i = 0 ; i < longArray . length - 1 ; i ++ ) { if ( longArray [ i ] < longArray [ i + 1 ] ) { return false ; } } return true ; |
public class CmsSiteManagerImpl { /** * Gets an offline project to read offline resources from . < p >
* @ return CmsProject */
private CmsProject getOfflineProject ( ) { } } | try { return m_clone . readProject ( "Offline" ) ; } catch ( CmsException e ) { try { for ( CmsProject p : OpenCms . getOrgUnitManager ( ) . getAllAccessibleProjects ( m_clone , "/" , true ) ) { if ( ! p . isOnlineProject ( ) ) { return p ; } } } catch ( CmsException e1 ) { LOG . error ( "Unable to get ptoject" , e ) ; } } return null ; |
public class Logging { /** * Log a message at the ' severe ' level .
* @ param message Warning log message .
* @ param e Exception */
public void error ( CharSequence message , Throwable e ) { } } | log ( Level . SEVERE , message , e ) ; |
public class ExecutionEnvironment { /** * Creates a { @ link DataSet } that represents the Strings produced by reading the given file line wise .
* The { @ link java . nio . charset . Charset } with the given name will be used to read the files .
* @ param filePath The path of the file , as a URI ( e . g . , " file : / / / some / local / file " or " hdfs : / / host : port / file / path " ) .
* @ param charsetName The name of the character set used to read the file .
* @ return A { @ link DataSet } that represents the data read from the given file as text lines . */
public DataSource < String > readTextFile ( String filePath , String charsetName ) { } } | Preconditions . checkNotNull ( filePath , "The file path may not be null." ) ; TextInputFormat format = new TextInputFormat ( new Path ( filePath ) ) ; format . setCharsetName ( charsetName ) ; return new DataSource < > ( this , format , BasicTypeInfo . STRING_TYPE_INFO , Utils . getCallLocationName ( ) ) ; |
public class Zones { /** * Evaluates to true if the input { @ link denominator . model . Zone } exists with { @ link
* denominator . model . Zone # name ( ) name } corresponding to the { @ code name } parameter .
* @ param name the { @ link denominator . model . Zone # name ( ) name } of the desired zone . */
public static Filter < Zone > nameEqualTo ( final String name ) { } } | checkNotNull ( name , "name" ) ; return new Filter < Zone > ( ) { @ Override public boolean apply ( Zone in ) { return in != null && name . equals ( in . name ( ) ) ; } @ Override public String toString ( ) { return "nameEqualTo(" + name + ")" ; } } ; |
public class SoftMethodStorage { /** * returns a methods matching given criteria or null if method doesn ' t exist
* @ param clazz clazz to get methods from
* @ param methodName Name of the Method to get
* @ param count wished count of arguments
* @ return matching Methods as Array */
public Method [ ] getMethods ( Class clazz , Collection . Key methodName , int count ) { } } | Map < Key , Array > methodsMap = map . get ( clazz ) ; if ( methodsMap == null ) methodsMap = store ( clazz ) ; Array methods = methodsMap . get ( methodName ) ; if ( methods == null ) return null ; Object o = methods . get ( count + 1 , null ) ; if ( o == null ) return null ; return ( Method [ ] ) o ; |
public class HlsGroupSettings { /** * Language to be used on Caption outputs
* < b > NOTE : < / b > This method appends the values to the existing list ( if any ) . Use
* { @ link # setCaptionLanguageMappings ( java . util . Collection ) } or
* { @ link # withCaptionLanguageMappings ( java . util . Collection ) } if you want to override the existing values .
* @ param captionLanguageMappings
* Language to be used on Caption outputs
* @ return Returns a reference to this object so that method calls can be chained together . */
public HlsGroupSettings withCaptionLanguageMappings ( HlsCaptionLanguageMapping ... captionLanguageMappings ) { } } | if ( this . captionLanguageMappings == null ) { setCaptionLanguageMappings ( new java . util . ArrayList < HlsCaptionLanguageMapping > ( captionLanguageMappings . length ) ) ; } for ( HlsCaptionLanguageMapping ele : captionLanguageMappings ) { this . captionLanguageMappings . add ( ele ) ; } return this ; |
public class JacksonJerseyAnnotationProcessor { /** * Given an { @ link Element } representing the method get either a cached { @ link ResourceClass } or
* produce a new one . */
private ResourceClass getParentResourceClass ( final Element e ) { } } | final String parentClassName = e . getEnclosingElement ( ) . toString ( ) ; final ResourceClass klass = resourceClasses . get ( parentClassName ) ; if ( klass != null ) { return klass ; } final Path klassPath = e . getEnclosingElement ( ) . getAnnotation ( Path . class ) ; final ResourceClass newKlass = new ResourceClass ( ( klassPath == null ) ? null : klassPath . value ( ) , Lists . < ResourceMethod > newArrayList ( ) ) ; resourceClasses . put ( parentClassName , newKlass ) ; return newKlass ; |
public class AWSMediaPackageClient { /** * Returns a collection of OriginEndpoint records .
* @ param listOriginEndpointsRequest
* @ return Result of the ListOriginEndpoints operation returned by the service .
* @ throws UnprocessableEntityException
* The parameters sent in the request are not valid .
* @ throws InternalServerErrorException
* An unexpected error occurred .
* @ throws ForbiddenException
* The client is not authorized to access the requested resource .
* @ throws NotFoundException
* The requested resource does not exist .
* @ throws ServiceUnavailableException
* An unexpected error occurred .
* @ throws TooManyRequestsException
* The client has exceeded their resource or throttling limits .
* @ sample AWSMediaPackage . ListOriginEndpoints
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mediapackage - 2017-10-12 / ListOriginEndpoints "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListOriginEndpointsResult listOriginEndpoints ( ListOriginEndpointsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListOriginEndpoints ( request ) ; |
public class WorkflowExecutor { /** * Executes the async system task */
public void executeSystemTask ( WorkflowSystemTask systemTask , String taskId , int unackTimeout ) { } } | try { Task task = executionDAOFacade . getTaskById ( taskId ) ; if ( task == null ) { LOGGER . error ( "TaskId: {} could not be found while executing SystemTask" , taskId ) ; return ; } LOGGER . info ( "Task: {} fetched from execution DAO for taskId: {}" , task , taskId ) ; if ( task . getStatus ( ) . isTerminal ( ) ) { // Tune the SystemTaskWorkerCoordinator ' s queues - if the queue size is very big this can happen !
LOGGER . info ( "Task {}/{} was already completed." , task . getTaskType ( ) , task . getTaskId ( ) ) ; queueDAO . remove ( QueueUtils . getQueueName ( task ) , task . getTaskId ( ) ) ; return ; } String workflowId = task . getWorkflowInstanceId ( ) ; Workflow workflow = executionDAOFacade . getWorkflowById ( workflowId , true ) ; if ( task . getStartTime ( ) == 0 ) { task . setStartTime ( System . currentTimeMillis ( ) ) ; Monitors . recordQueueWaitTime ( task . getTaskDefName ( ) , task . getQueueWaitTime ( ) ) ; } if ( workflow . getStatus ( ) . isTerminal ( ) ) { LOGGER . warn ( "Workflow {} has been completed for {}/{}" , workflow . getWorkflowId ( ) , systemTask . getName ( ) , task . getTaskId ( ) ) ; if ( ! task . getStatus ( ) . isTerminal ( ) ) { task . setStatus ( CANCELED ) ; } executionDAOFacade . updateTask ( task ) ; queueDAO . remove ( QueueUtils . getQueueName ( task ) , task . getTaskId ( ) ) ; return ; } if ( task . getStatus ( ) . equals ( SCHEDULED ) ) { if ( executionDAOFacade . exceedsInProgressLimit ( task ) ) { // to do add a metric to record this
LOGGER . warn ( "Concurrent Execution limited for {}:{}" , taskId , task . getTaskDefName ( ) ) ; return ; } if ( task . getRateLimitPerFrequency ( ) > 0 && executionDAOFacade . exceedsRateLimitPerFrequency ( task ) ) { LOGGER . warn ( "RateLimit Execution limited for {}:{}, limit:{}" , taskId , task . getTaskDefName ( ) , task . getRateLimitPerFrequency ( ) ) ; return ; } } LOGGER . info ( "Executing {}/{}-{}" , task . getTaskType ( ) , task . getTaskId ( ) , task . getStatus ( ) ) ; queueDAO . setUnackTimeout ( QueueUtils . getQueueName ( task ) , task . getTaskId ( ) , systemTask . getRetryTimeInSecond ( ) * 1000 ) ; task . setPollCount ( task . getPollCount ( ) + 1 ) ; executionDAOFacade . updateTask ( task ) ; switch ( task . getStatus ( ) ) { case SCHEDULED : systemTask . start ( workflow , task , this ) ; break ; case IN_PROGRESS : systemTask . execute ( workflow , task , this ) ; break ; default : break ; } if ( ! task . getStatus ( ) . isTerminal ( ) ) { task . setCallbackAfterSeconds ( unackTimeout ) ; } updateTask ( new TaskResult ( task ) ) ; LOGGER . info ( "Done Executing {}/{}-{} op={}" , task . getTaskType ( ) , task . getTaskId ( ) , task . getStatus ( ) , task . getOutputData ( ) . toString ( ) ) ; } catch ( Exception e ) { LOGGER . error ( "Error executing system task - {}, with id: {}" , systemTask , taskId , e ) ; } |
public class ExecutorFilter { /** * { @ inheritDoc } */
@ Override public final void filterWrite ( NextFilter nextFilter , IoSession session , WriteRequest writeRequest ) { } } | if ( eventTypes . contains ( IoEventType . WRITE ) ) { IoFilterEvent event = new IoFilterEvent ( nextFilter , IoEventType . WRITE , session , writeRequest ) ; fireEvent ( event ) ; } else { nextFilter . filterWrite ( session , writeRequest ) ; } |
public class WDropdownOptionsExample { /** * build the drop down controls .
* @ return a field set containing the dropdown controls . */
private WFieldSet getDropDownControls ( ) { } } | WFieldSet fieldSet = new WFieldSet ( "Drop down configuration" ) ; WFieldLayout layout = new WFieldLayout ( ) ; layout . setLabelWidth ( 25 ) ; fieldSet . add ( layout ) ; rbsDDType . setButtonLayout ( WRadioButtonSelect . LAYOUT_FLAT ) ; rbsDDType . setSelected ( WDropdown . DropdownType . NATIVE ) ; rbsDDType . setFrameless ( true ) ; layout . addField ( "Dropdown Type" , rbsDDType ) ; nfWidth . setMinValue ( 0 ) ; nfWidth . setDecimalPlaces ( 0 ) ; layout . addField ( "Width" , nfWidth ) ; layout . addField ( "ToolTip" , tfToolTip ) ; layout . addField ( "Include null option" , cbNullOption ) ; rgDefaultOption . setButtonLayout ( WRadioButtonSelect . LAYOUT_COLUMNS ) ; rgDefaultOption . setButtonColumns ( 2 ) ; rgDefaultOption . setSelected ( NONE ) ; rgDefaultOption . setFrameless ( true ) ; layout . addField ( "Default Option" , rgDefaultOption ) ; layout . addField ( "Action on change" , cbActionOnChange ) ; layout . addField ( "Ajax" , cbAjax ) ; WField subField = layout . addField ( "Subordinate" , cbSubordinate ) ; // . getLabel ( ) . setHint ( " Does not work with Dropdown Type COMBO " ) ;
layout . addField ( "Submit on change" , cbSubmitOnChange ) ; layout . addField ( "Visible" , cbVisible ) ; layout . addField ( "Disabled" , cbDisabled ) ; // Apply Button
WButton apply = new WButton ( "Apply" ) ; fieldSet . add ( apply ) ; WSubordinateControl subSubControl = new WSubordinateControl ( ) ; Rule rule = new Rule ( ) ; subSubControl . addRule ( rule ) ; rule . setCondition ( new Equal ( rbsDDType , WDropdown . DropdownType . COMBO ) ) ; rule . addActionOnTrue ( new Disable ( subField ) ) ; rule . addActionOnFalse ( new Enable ( subField ) ) ; fieldSet . add ( subSubControl ) ; apply . setAction ( new Action ( ) { @ Override public void execute ( final ActionEvent event ) { applySettings ( ) ; } } ) ; return fieldSet ; |
public class CmsJspStandardContextBean { /** * Returns the formatter configuration to the given element . < p >
* @ param element the element
* @ return the formatter configuration */
protected I_CmsFormatterBean getElementFormatter ( CmsContainerElementBean element ) { } } | if ( m_elementInstances == null ) { initPageData ( ) ; } I_CmsFormatterBean formatter = null ; CmsContainerBean container = m_parentContainers . get ( element . getInstanceId ( ) ) ; if ( container == null ) { // use the current container
container = getContainer ( ) ; } if ( container != null ) { String containerName = container . getName ( ) ; Map < String , String > settings = element . getSettings ( ) ; if ( settings != null ) { String formatterConfigId = settings . get ( CmsFormatterConfig . getSettingsKeyForContainer ( containerName ) ) ; if ( CmsUUID . isValidUUID ( formatterConfigId ) ) { formatter = OpenCms . getADEManager ( ) . getCachedFormatters ( false ) . getFormatters ( ) . get ( new CmsUUID ( formatterConfigId ) ) ; } } if ( formatter == null ) { try { CmsResource resource = m_cms . readResource ( m_cms . getRequestContext ( ) . getUri ( ) ) ; CmsADEConfigData config = OpenCms . getADEManager ( ) . lookupConfiguration ( m_cms , resource . getRootPath ( ) ) ; CmsFormatterConfiguration formatters = config . getFormatters ( m_cms , resource ) ; int width = - 2 ; try { width = Integer . parseInt ( container . getWidth ( ) ) ; } catch ( Exception e ) { LOG . debug ( e . getLocalizedMessage ( ) , e ) ; } formatter = formatters . getDefaultSchemaFormatter ( container . getType ( ) , width ) ; } catch ( CmsException e1 ) { if ( LOG . isWarnEnabled ( ) ) { LOG . warn ( e1 . getLocalizedMessage ( ) , e1 ) ; } } } } return formatter ; |
public class ColorHelper { /** * Method to transform from HSV to ARGB
* Source from : https : / / www . cs . rit . edu / ~ ncs / color / t _ convert . html
* @ param h - hue
* @ param s - saturation
* @ param v - brightness
* @ param a - alpha
* @ return rgb color */
public static int fromHSV ( float h , float s , float v , int a ) { } } | float r = v ; float g = v ; float b = v ; int i ; float f , p , q , t ; if ( s == 0 ) { // achromatic ( grey )
int ri = ( int ) ( r * 0xff ) ; int gi = ( int ) ( g * 0xff ) ; int bi = ( int ) ( b * 0xff ) ; return getRGB ( ri , gi , bi ) ; } h /= 60 ; // sector 0 to 5
i = ( int ) Math . floor ( h ) ; f = h - i ; // factorial part of h
p = v * ( 1 - s ) ; q = v * ( 1 - s * f ) ; t = v * ( 1 - s * ( 1 - f ) ) ; switch ( i ) { case 0 : r = v ; g = t ; b = p ; break ; case 1 : r = q ; g = v ; b = p ; break ; case 2 : r = p ; g = v ; b = t ; break ; case 3 : r = p ; g = q ; b = v ; break ; case 4 : r = t ; g = p ; b = v ; break ; // case 5:
default : r = v ; g = p ; b = q ; break ; } int ri = ( int ) ( r * 0xff ) ; int gi = ( int ) ( g * 0xff ) ; int bi = ( int ) ( b * 0xff ) ; return getARGB ( ri , gi , bi , a ) ; |
public class AbstractGraph { /** * { @ inheritDoc } */
public boolean contains ( int vertex1 , int vertex2 ) { } } | EdgeSet < T > e1 = getEdgeSet ( vertex1 ) ; return e1 != null && e1 . connects ( vertex2 ) ; |
public class IntegerProperty { /** * Sets the value of this integer property . The value is limited to the
* min / max range given during construction .
* @ return the previous value , or if not set : the default value . If no
* default value exists , 0 if that value is in the range [ minValue ,
* maxValue ] , or minValue if 0 is not in the range */
public int set ( int value ) { } } | String prevValue = setString ( Integer . toString ( limit ( value ) ) ) ; if ( prevValue == null ) { prevValue = getDefaultValue ( ) ; if ( prevValue == null ) { return noValue ( ) ; } } int v = Integer . parseInt ( prevValue ) ; return limit ( v ) ; |
public class GeometryFactoryImpl { /** * Creates the default factory implementation .
* < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
public static GeometryFactory init ( ) { } } | try { GeometryFactory theGeometryFactory = ( GeometryFactory ) EPackage . Registry . INSTANCE . getEFactory ( GeometryPackage . eNS_URI ) ; if ( theGeometryFactory != null ) { return theGeometryFactory ; } } catch ( Exception exception ) { EcorePlugin . INSTANCE . log ( exception ) ; } return new GeometryFactoryImpl ( ) ; |
public class QrCodeEncoder { /** * Call this function after you are done adding to the QR code
* @ return The generated QR Code */
public QrCode fixate ( ) { } } | autoSelectVersionAndError ( ) ; // sanity check of code
int expectedBitSize = bitsAtVersion ( qr . version ) ; qr . message = "" ; for ( MessageSegment m : segments ) { qr . message += m . message ; switch ( m . mode ) { case NUMERIC : encodeNumeric ( m . data , m . length ) ; break ; case ALPHANUMERIC : encodeAlphanumeric ( m . data , m . length ) ; break ; case BYTE : encodeBytes ( m . data , m . length ) ; break ; case KANJI : encodeKanji ( m . data , m . length ) ; break ; default : throw new RuntimeException ( "Unknown" ) ; } } if ( packed . size != expectedBitSize ) throw new RuntimeException ( "Bad size code. " + packed . size + " vs " + expectedBitSize ) ; int maxBits = QrCode . VERSION_INFO [ qr . version ] . codewords * 8 ; if ( packed . size > maxBits ) { throw new IllegalArgumentException ( "The message is longer than the max possible size" ) ; } if ( packed . size + 4 <= maxBits ) { // add the terminator to the bit stream
packed . append ( 0b0000 , 4 , false ) ; } bitsToMessage ( packed ) ; if ( autoMask ) { qr . mask = selectMask ( qr ) ; } return qr ; |
public class FactoryCache { /** * Adds the given factory to the cache and associates it with the given
* type name .
* @ param < T > Should match { @ code typeName } .
* @ param typeName The fully qualified name of the type .
* @ param factory The factory to associate with { @ code typeName } */
public < T > void put ( String typeName , PrefabValueFactory < T > factory ) { } } | if ( typeName != null ) { cache . put ( typeName , factory ) ; } |
public class StringUtils { /** * Removes trailing and leading whitespace , and also reduces each
* sequence of internal whitespace to a single space . */
public static String normalizeWS ( String value ) { } } | char [ ] tmp = new char [ value . length ( ) ] ; int pos = 0 ; boolean prevws = false ; for ( int ix = 0 ; ix < tmp . length ; ix ++ ) { char ch = value . charAt ( ix ) ; if ( ch != ' ' && ch != '\t' && ch != '\n' && ch != '\r' ) { if ( prevws && pos != 0 ) tmp [ pos ++ ] = ' ' ; tmp [ pos ++ ] = ch ; prevws = false ; } else prevws = true ; } return new String ( tmp , 0 , pos ) ; |
public class GeneFeatureHelper { /** * Loads Fasta file and GFF2 feature file generated from the geneid prediction algorithm
* @ param fastaSequenceFile
* @ param gffFile
* @ return
* @ throws Exception */
static public LinkedHashMap < String , ChromosomeSequence > loadFastaAddGeneFeaturesFromGeneIDGFF2 ( File fastaSequenceFile , File gffFile ) throws Exception { } } | LinkedHashMap < String , DNASequence > dnaSequenceList = FastaReaderHelper . readFastaDNASequence ( fastaSequenceFile ) ; LinkedHashMap < String , ChromosomeSequence > chromosomeSequenceList = GeneFeatureHelper . getChromosomeSequenceFromDNASequence ( dnaSequenceList ) ; FeatureList listGenes = GeneIDGFF2Reader . read ( gffFile . getAbsolutePath ( ) ) ; addGeneIDGFF2GeneFeatures ( chromosomeSequenceList , listGenes ) ; return chromosomeSequenceList ; |
public class DateUtils { /** * < p > 将 { @ link Date } 类型转换为指定格式的字符串 < / p >
* author : Crab2Died
* date : 2017年06月02日 15:32:04
* @ param date { @ link Date } 类型的时间
* @ param format 指定格式化类型
* @ return 返回格式化后的时间字符串 */
public static String date2Str ( Date date , String format ) { } } | SimpleDateFormat sdf = new SimpleDateFormat ( format ) ; return sdf . format ( date ) ; |
public class DefaultEasyFxml { /** * @ param fxmlNode The node who ' s filepath we look for
* @ return The node ' s { @ link FxmlNode # getFile ( ) } path prepended with the views root folder , as defined by
* environment variable " moe . tristan . easyfxml . fxml . fxml _ root _ path " . */
private String determineComponentViewFileLocation ( final FxmlNode fxmlNode ) { } } | final String rootPath = Try . of ( ( ) -> "moe.tristan.easyfxml.fxml.fxml_root_path" ) . map ( this . environment :: getRequiredProperty ) . getOrElse ( "" ) ; return rootPath + fxmlNode . getFile ( ) . getPath ( ) ; |
public class DRL6Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 500:1 : unaryExpressionNotPlusMinus returns [ BaseDescr result ] : ( TILDE unaryExpression | NEGATION unaryExpression | ( castExpression ) = > castExpression | ( backReferenceExpression ) = > backReferenceExpression | ( ( { . . . } ? ( var = ID COLON ) ) | ( { . . . } ? ( var = ID UNIFY ) ) ) ? ( ( xpathSeparator ID ) = > left2 = xpathPrimary | left1 = primary ) ( ( selector ) = > selector ) * ( ( INCR | DECR ) = > ( INCR | DECR ) ) ? ) ; */
public final DRL6Expressions . unaryExpressionNotPlusMinus_return unaryExpressionNotPlusMinus ( ) throws RecognitionException { } } | DRL6Expressions . unaryExpressionNotPlusMinus_return retval = new DRL6Expressions . unaryExpressionNotPlusMinus_return ( ) ; retval . start = input . LT ( 1 ) ; Token var = null ; Token COLON9 = null ; Token UNIFY10 = null ; BaseDescr left2 = null ; BaseDescr left1 = null ; boolean isLeft = false ; BindingDescr bind = null ; try { // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 502:5 : ( TILDE unaryExpression | NEGATION unaryExpression | ( castExpression ) = > castExpression | ( backReferenceExpression ) = > backReferenceExpression | ( ( { . . . } ? ( var = ID COLON ) ) | ( { . . . } ? ( var = ID UNIFY ) ) ) ? ( ( xpathSeparator ID ) = > left2 = xpathPrimary | left1 = primary ) ( ( selector ) = > selector ) * ( ( INCR | DECR ) = > ( INCR | DECR ) ) ? )
int alt54 = 5 ; int LA54_0 = input . LA ( 1 ) ; if ( ( LA54_0 == TILDE ) ) { alt54 = 1 ; } else if ( ( LA54_0 == NEGATION ) ) { alt54 = 2 ; } else if ( ( LA54_0 == LEFT_PAREN ) ) { int LA54_3 = input . LA ( 2 ) ; if ( ( synpred15_DRL6Expressions ( ) ) ) { alt54 = 3 ; } else if ( ( true ) ) { alt54 = 5 ; } } else if ( ( LA54_0 == DOT ) && ( synpred16_DRL6Expressions ( ) ) ) { alt54 = 4 ; } else if ( ( LA54_0 == BOOL || LA54_0 == DECIMAL || LA54_0 == DIV || LA54_0 == FLOAT || LA54_0 == HEX || LA54_0 == ID || ( LA54_0 >= LEFT_SQUARE && LA54_0 <= LESS ) || LA54_0 == NULL || LA54_0 == QUESTION_DIV || ( LA54_0 >= STAR && LA54_0 <= STRING ) || LA54_0 == TIME_INTERVAL ) ) { alt54 = 5 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 54 , 0 , input ) ; throw nvae ; } switch ( alt54 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 502:9 : TILDE unaryExpression
{ match ( input , TILDE , FOLLOW_TILDE_in_unaryExpressionNotPlusMinus2453 ) ; if ( state . failed ) return retval ; pushFollow ( FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2455 ) ; unaryExpression ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 503:8 : NEGATION unaryExpression
{ match ( input , NEGATION , FOLLOW_NEGATION_in_unaryExpressionNotPlusMinus2464 ) ; if ( state . failed ) return retval ; pushFollow ( FOLLOW_unaryExpression_in_unaryExpressionNotPlusMinus2466 ) ; unaryExpression ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; } break ; case 3 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 504:9 : ( castExpression ) = > castExpression
{ pushFollow ( FOLLOW_castExpression_in_unaryExpressionNotPlusMinus2480 ) ; castExpression ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; } break ; case 4 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 505:9 : ( backReferenceExpression ) = > backReferenceExpression
{ pushFollow ( FOLLOW_backReferenceExpression_in_unaryExpressionNotPlusMinus2494 ) ; backReferenceExpression ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; } break ; case 5 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 506:9 : ( ( { . . . } ? ( var = ID COLON ) ) | ( { . . . } ? ( var = ID UNIFY ) ) ) ? ( ( xpathSeparator ID ) = > left2 = xpathPrimary | left1 = primary ) ( ( selector ) = > selector ) * ( ( INCR | DECR ) = > ( INCR | DECR ) ) ?
{ if ( state . backtracking == 0 ) { isLeft = helper . getLeftMostExpr ( ) == null ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:9 : ( ( { . . . } ? ( var = ID COLON ) ) | ( { . . . } ? ( var = ID UNIFY ) ) ) ?
int alt50 = 3 ; int LA50_0 = input . LA ( 1 ) ; if ( ( LA50_0 == ID ) ) { int LA50_1 = input . LA ( 2 ) ; if ( ( LA50_1 == COLON ) ) { int LA50_3 = input . LA ( 3 ) ; if ( ( ( inMap == 0 && ternOp == 0 && input . LA ( 2 ) == DRL6Lexer . COLON ) ) ) { alt50 = 1 ; } } else if ( ( LA50_1 == UNIFY ) ) { alt50 = 2 ; } } switch ( alt50 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:11 : ( { . . . } ? ( var = ID COLON ) )
{ // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:11 : ( { . . . } ? ( var = ID COLON ) )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:12 : { . . . } ? ( var = ID COLON )
{ if ( ! ( ( inMap == 0 && ternOp == 0 && input . LA ( 2 ) == DRL6Lexer . COLON ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } throw new FailedPredicateException ( input , "unaryExpressionNotPlusMinus" , "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.COLON" ) ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:75 : ( var = ID COLON )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 507:76 : var = ID COLON
{ var = ( Token ) match ( input , ID , FOLLOW_ID_in_unaryExpressionNotPlusMinus2522 ) ; if ( state . failed ) return retval ; COLON9 = ( Token ) match ( input , COLON , FOLLOW_COLON_in_unaryExpressionNotPlusMinus2524 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { hasBindings = true ; helper . emit ( var , DroolsEditorType . IDENTIFIER_VARIABLE ) ; helper . emit ( COLON9 , DroolsEditorType . SYMBOL ) ; if ( buildDescr ) { bind = new BindingDescr ( ( var != null ? var . getText ( ) : null ) , null , false ) ; helper . setStart ( bind , var ) ; } } } } } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 509:11 : ( { . . . } ? ( var = ID UNIFY ) )
{ // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 509:11 : ( { . . . } ? ( var = ID UNIFY ) )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 509:12 : { . . . } ? ( var = ID UNIFY )
{ if ( ! ( ( inMap == 0 && ternOp == 0 && input . LA ( 2 ) == DRL6Lexer . UNIFY ) ) ) { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } throw new FailedPredicateException ( input , "unaryExpressionNotPlusMinus" , "inMap == 0 && ternOp == 0 && input.LA(2) == DRL6Lexer.UNIFY" ) ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 509:75 : ( var = ID UNIFY )
// src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 509:76 : var = ID UNIFY
{ var = ( Token ) match ( input , ID , FOLLOW_ID_in_unaryExpressionNotPlusMinus2563 ) ; if ( state . failed ) return retval ; UNIFY10 = ( Token ) match ( input , UNIFY , FOLLOW_UNIFY_in_unaryExpressionNotPlusMinus2565 ) ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { hasBindings = true ; helper . emit ( var , DroolsEditorType . IDENTIFIER_VARIABLE ) ; helper . emit ( UNIFY10 , DroolsEditorType . SYMBOL ) ; if ( buildDescr ) { bind = new BindingDescr ( ( var != null ? var . getText ( ) : null ) , null , true ) ; helper . setStart ( bind , var ) ; } } } } } break ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 513:9 : ( ( xpathSeparator ID ) = > left2 = xpathPrimary | left1 = primary )
int alt51 = 2 ; int LA51_0 = input . LA ( 1 ) ; if ( ( LA51_0 == DIV || LA51_0 == QUESTION_DIV ) && ( synpred17_DRL6Expressions ( ) ) ) { alt51 = 1 ; } else if ( ( LA51_0 == BOOL || LA51_0 == DECIMAL || LA51_0 == FLOAT || LA51_0 == HEX || LA51_0 == ID || ( LA51_0 >= LEFT_PAREN && LA51_0 <= LESS ) || LA51_0 == NULL || ( LA51_0 >= STAR && LA51_0 <= STRING ) || LA51_0 == TIME_INTERVAL ) ) { alt51 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } NoViableAltException nvae = new NoViableAltException ( "" , 51 , 0 , input ) ; throw nvae ; } switch ( alt51 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 513:11 : ( xpathSeparator ID ) = > left2 = xpathPrimary
{ pushFollow ( FOLLOW_xpathPrimary_in_unaryExpressionNotPlusMinus2619 ) ; left2 = xpathPrimary ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { if ( buildDescr ) { retval . result = left2 ; } } } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 514:13 : left1 = primary
{ pushFollow ( FOLLOW_primary_in_unaryExpressionNotPlusMinus2637 ) ; left1 = primary ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; if ( state . backtracking == 0 ) { if ( buildDescr ) { retval . result = left1 ; } } } break ; } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 517:9 : ( ( selector ) = > selector ) *
loop52 : while ( true ) { int alt52 = 2 ; int LA52_0 = input . LA ( 1 ) ; if ( ( LA52_0 == DOT ) && ( synpred18_DRL6Expressions ( ) ) ) { alt52 = 1 ; } else if ( ( LA52_0 == LEFT_SQUARE ) && ( synpred18_DRL6Expressions ( ) ) ) { alt52 = 1 ; } switch ( alt52 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 517:10 : ( selector ) = > selector
{ pushFollow ( FOLLOW_selector_in_unaryExpressionNotPlusMinus2665 ) ; selector ( ) ; state . _fsp -- ; if ( state . failed ) return retval ; } break ; default : break loop52 ; } } if ( state . backtracking == 0 ) { if ( buildDescr ) { String expr = input . toString ( retval . start , input . LT ( - 1 ) ) ; if ( isLeft ) { helper . setLeftMostExpr ( expr ) ; } if ( bind != null ) { if ( bind . isUnification ( ) ) { expr = expr . substring ( expr . indexOf ( ":=" ) + 2 ) . trim ( ) ; } else { expr = expr . substring ( expr . indexOf ( ":" ) + 1 ) . trim ( ) ; } bind . setExpressionAndBindingField ( expr ) ; helper . setEnd ( bind ) ; retval . result = bind ; } } } // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 536:9 : ( ( INCR | DECR ) = > ( INCR | DECR ) ) ?
int alt53 = 2 ; int LA53_0 = input . LA ( 1 ) ; if ( ( LA53_0 == DECR || LA53_0 == INCR ) && ( synpred19_DRL6Expressions ( ) ) ) { alt53 = 1 ; } switch ( alt53 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL6Expressions . g : 536:10 : ( INCR | DECR ) = > ( INCR | DECR )
{ if ( input . LA ( 1 ) == DECR || input . LA ( 1 ) == INCR ) { input . consume ( ) ; state . errorRecovery = false ; state . failed = false ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return retval ; } MismatchedSetException mse = new MismatchedSetException ( null , input ) ; throw mse ; } } break ; } } break ; } retval . stop = input . LT ( - 1 ) ; } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} return retval ; |
public class ChartComputator { /** * Finds the chart point ( i . e . within the chart ' s domain and range ) represented by the given pixel coordinates , if
* that pixel is within the chart region described by { @ link # contentRectMinusAllMargins } . If the point is found ,
* the " dest "
* argument is set to the point and this function returns true . Otherwise , this function returns false and
* " dest " is
* unchanged . */
public boolean rawPixelsToDataPoint ( float x , float y , PointF dest ) { } } | if ( ! contentRectMinusAllMargins . contains ( ( int ) x , ( int ) y ) ) { return false ; } dest . set ( currentViewport . left + ( x - contentRectMinusAllMargins . left ) * currentViewport . width ( ) / contentRectMinusAllMargins . width ( ) , currentViewport . bottom + ( y - contentRectMinusAllMargins . bottom ) * currentViewport . height ( ) / - contentRectMinusAllMargins . height ( ) ) ; return true ; |
public class RedisCacheManager { /** * redis回调调用
* @ param redisCallBack
* @ param clients
* @ param key
* @ param isRead
* @ return */
private < T > T execute ( RedisCallBack < T > redisCallBack , List < RedisClient > clients , Object key , boolean isRead ) { } } | for ( int i = 0 ; i < getRetryTimes ( ) ; i ++ ) { boolean result = redisCallBack . doInRedis ( clients , isRead , key ) ; if ( result ) { return redisCallBack . getResult ( ) ; } } Throwable e = redisCallBack . getException ( ) ; if ( e != null ) { logger . error ( "Return null because exception occurs: " + e . getMessage ( ) , e ) ; } return null ; |
public class AdminToolUtils { /** * Utility function that checks if store names are valid on a node .
* @ param adminClient An instance of AdminClient points to given cluster
* @ param nodeId Node id to fetch stores from
* @ param storeNames Store names to check */
public static void validateUserStoreNamesOnNode ( AdminClient adminClient , Integer nodeId , List < String > storeNames ) { } } | List < StoreDefinition > storeDefList = adminClient . metadataMgmtOps . getRemoteStoreDefList ( nodeId ) . getValue ( ) ; Map < String , Boolean > existingStoreNames = new HashMap < String , Boolean > ( ) ; for ( StoreDefinition storeDef : storeDefList ) { existingStoreNames . put ( storeDef . getName ( ) , true ) ; } for ( String storeName : storeNames ) { if ( ! Boolean . TRUE . equals ( existingStoreNames . get ( storeName ) ) ) { Utils . croak ( "Store " + storeName + " does not exist!" ) ; } } |
public class DescribeAccountLimitsResult { /** * Information about the limits .
* @ param limits
* Information about the limits . */
public void setLimits ( java . util . Collection < Limit > limits ) { } } | if ( limits == null ) { this . limits = null ; return ; } this . limits = new com . amazonaws . internal . SdkInternalList < Limit > ( limits ) ; |
public class ProductPartitionTreeImpl { /** * Returns a new tree based on a non - empty collection of ad group criteria . All parameters
* required .
* @ param adGroupId the ID of the ad group
* @ param parentIdMap the multimap from parent product partition ID to child criteria
* @ return a new ProductPartitionTree */
private static ProductPartitionTreeImpl createNonEmptyAdGroupTree ( Long adGroupId , ListMultimap < Long , AdGroupCriterion > parentIdMap ) { } } | Preconditions . checkNotNull ( adGroupId , "Null ad group ID" ) ; Preconditions . checkArgument ( ! parentIdMap . isEmpty ( ) , "parentIdMap passed for ad group ID %s is empty" , adGroupId ) ; Preconditions . checkArgument ( parentIdMap . containsKey ( null ) , "No root criterion found in the list of ad group criteria for ad group ID %s" , adGroupId ) ; AdGroupCriterion rootCriterion = Iterables . getOnlyElement ( parentIdMap . get ( null ) ) ; Preconditions . checkState ( rootCriterion instanceof BiddableAdGroupCriterion , "Root criterion for ad group ID %s is not a BiddableAdGroupCriterion" , adGroupId ) ; BiddableAdGroupCriterion biddableRootCriterion = ( BiddableAdGroupCriterion ) rootCriterion ; BiddingStrategyConfiguration biddingStrategyConfig = biddableRootCriterion . getBiddingStrategyConfiguration ( ) ; Preconditions . checkState ( biddingStrategyConfig != null , "Null bidding strategy config on the root node of ad group ID %s" , adGroupId ) ; ProductPartitionNode rootNode = new ProductPartitionNode ( null , ( ProductDimension ) null , rootCriterion . getCriterion ( ) . getId ( ) , new ProductDimensionComparator ( ) ) ; // Set the root ' s bid if a bid exists on the BiddableAdGroupCriterion .
Money rootNodeBid = getBid ( biddableRootCriterion ) ; if ( rootNodeBid != null ) { rootNode = rootNode . asBiddableUnit ( ) . setBid ( rootNodeBid . getMicroAmount ( ) ) ; } rootNode = rootNode . setTrackingUrlTemplate ( biddableRootCriterion . getTrackingUrlTemplate ( ) ) ; rootNode = copyCustomParametersToNode ( biddableRootCriterion , rootNode ) ; addChildNodes ( rootNode , parentIdMap ) ; return new ProductPartitionTreeImpl ( adGroupId , biddingStrategyConfig , rootNode ) ; |
public class JSLocalConsumerPoint { /** * ( non - Javadoc )
* @ see com . ibm . ws . sib . processor . impl . ConsumerPoint # notifyException ( com . ibm . ws . sib . processor . SIMPException ) */
@ Override public void notifyException ( Throwable exception ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "notifyException" , new Object [ ] { this , exception } ) ; // If an asynch consumer is registered we need to let them know something went wrong
if ( _asynchConsumerRegistered ) _asynchConsumer . notifyExceptionListeners ( exception , _consumerSession ) ; this . lock ( ) ; try { if ( _waiting ) { // We need to get the exception back to the synchronous consumer
_notifiedException = exception ; _waiter . signal ( ) ; } } finally { this . unlock ( ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "notifyException" ) ; |
public class EDTImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public Object eGet ( int featureID , boolean resolve , boolean coreType ) { } } | switch ( featureID ) { case AfplibPackage . EDT__DOC_NAME : return getDocName ( ) ; case AfplibPackage . EDT__TRIPLETS : return getTriplets ( ) ; } return super . eGet ( featureID , resolve , coreType ) ; |
public class AWSMediaLiveClient { /** * Creates a Input Security Group
* @ param createInputSecurityGroupRequest
* The IPv4 CIDRs to whitelist for this Input Security Group
* @ return Result of the CreateInputSecurityGroup operation returned by the service .
* @ throws BadRequestException
* The request to create an Input Security Group was Invalid
* @ throws InternalServerErrorException
* Internal Server Error
* @ throws ForbiddenException
* The requester does not have permission to create an Input Security Group
* @ throws BadGatewayException
* Bad Gateway Error
* @ throws GatewayTimeoutException
* Gateway Timeout Error
* @ throws TooManyRequestsException
* Limit Exceeded Error
* @ sample AWSMediaLive . CreateInputSecurityGroup
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / medialive - 2017-10-14 / CreateInputSecurityGroup "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public CreateInputSecurityGroupResult createInputSecurityGroup ( CreateInputSecurityGroupRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeCreateInputSecurityGroup ( request ) ; |
public class BundleUtil { /** * Extracts , but does not initialize , a serialized tileset bundle
* instance from the supplied file . */
public static TileSetBundle extractBundle ( File file ) throws IOException , ClassNotFoundException { } } | // unserialize the tileset bundles array
FileInputStream fin = new FileInputStream ( file ) ; try { ObjectInputStream oin = new ObjectInputStream ( new BufferedInputStream ( fin ) ) ; TileSetBundle tsb = ( TileSetBundle ) oin . readObject ( ) ; return tsb ; } finally { StreamUtil . close ( fin ) ; } |
public class ArrayUtils { /** * Removes the element at index from the given array .
* @ param < T > { @ link Class } type of the elements in the array .
* @ param array array from which to remove the element at index .
* @ param index index of the element to remove from the array .
* @ return a new array with the element at index removed .
* @ throws IllegalArgumentException if the given array is { @ literal null } .
* @ throws ArrayIndexOutOfBoundsException if the { @ code index } is not valid . */
@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] remove ( T [ ] array , int index ) { } } | Assert . notNull ( array , "Array is required" ) ; assertThat ( index ) . throwing ( new ArrayIndexOutOfBoundsException ( String . format ( "[%1$d] is not a valid index [0, %2$d] in the array" , index , array . length ) ) ) . isGreaterThanEqualToAndLessThan ( 0 , array . length ) ; Class < ? > componentType = defaultIfNull ( array . getClass ( ) . getComponentType ( ) , Object . class ) ; T [ ] newArray = ( T [ ] ) Array . newInstance ( componentType , array . length - 1 ) ; if ( index > 0 ) { System . arraycopy ( array , 0 , newArray , 0 , index ) ; } if ( index + 1 < array . length ) { System . arraycopy ( array , index + 1 , newArray , index , ( array . length - index - 1 ) ) ; } return newArray ; |
public class GetResponseSender { /** * Sends a multipart response . Each body part represents a versioned value
* of the given key .
* @ throws IOException
* @ throws MessagingException */
@ Override public void sendResponse ( StoreStats performanceStats , boolean isFromLocalZone , long startTimeInMs ) throws Exception { } } | /* * Pay attention to the code below . Note that in this method we wrap a multiPart object with a mimeMessage .
* However when writing to the outputStream we only send the multiPart object and not the entire
* mimeMessage . This is intentional .
* In the earlier version of this code we used to create a multiPart object and just send that multiPart
* across the wire .
* However , we later discovered that upon setting the content of a MimeBodyPart , JavaMail internally creates
* a DataHandler object wrapping the object you passed in . The part ' s Content - Type header is not updated
* immediately . In order to get the headers updated , one needs to to call MimeMessage . saveChanges ( ) on the
* enclosing message , which cascades down the MIME structure into a call to MimeBodyPart . updateHeaders ( )
* on the body part . It ' s this updateHeaders call that transfers the content type from the
* DataHandler to the part ' s MIME Content - Type header .
* To make sure that the Content - Type headers are being updated ( without changing too much code ) , we decided
* to wrap the multiPart in a mimeMessage , call mimeMessage . saveChanges ( ) and then just send the multiPart .
* This is to make sure multiPart ' s headers are updated accurately . */
MimeMessage message = new MimeMessage ( Session . getDefaultInstance ( new Properties ( ) ) ) ; MimeMultipart multiPart = new MimeMultipart ( ) ; ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; String base64Key = RestUtils . encodeVoldemortKey ( key . get ( ) ) ; String contentLocationKey = "/" + this . storeName + "/" + base64Key ; for ( Versioned < byte [ ] > versionedValue : versionedValues ) { byte [ ] responseValue = versionedValue . getValue ( ) ; VectorClock vectorClock = ( VectorClock ) versionedValue . getVersion ( ) ; String eTag = RestUtils . getSerializedVectorClock ( vectorClock ) ; numVectorClockEntries += vectorClock . getVersionMap ( ) . size ( ) ; // Create the individual body part for each versioned value of the
// requested key
MimeBodyPart body = new MimeBodyPart ( ) ; try { // Add the right headers
body . addHeader ( CONTENT_TYPE , "application/octet-stream" ) ; body . addHeader ( CONTENT_TRANSFER_ENCODING , "binary" ) ; body . addHeader ( RestMessageHeaders . X_VOLD_VECTOR_CLOCK , eTag ) ; body . setContent ( responseValue , "application/octet-stream" ) ; body . addHeader ( RestMessageHeaders . CONTENT_LENGTH , Integer . toString ( responseValue . length ) ) ; multiPart . addBodyPart ( body ) ; } catch ( MessagingException me ) { logger . error ( "Exception while constructing body part" , me ) ; outputStream . close ( ) ; throw me ; } } message . setContent ( multiPart ) ; message . saveChanges ( ) ; try { multiPart . writeTo ( outputStream ) ; } catch ( Exception e ) { logger . error ( "Exception while writing multipart to output stream" , e ) ; outputStream . close ( ) ; throw e ; } ChannelBuffer responseContent = ChannelBuffers . dynamicBuffer ( ) ; responseContent . writeBytes ( outputStream . toByteArray ( ) ) ; // Create the Response object
HttpResponse response = new DefaultHttpResponse ( HTTP_1_1 , OK ) ; // Set the right headers
response . setHeader ( CONTENT_TYPE , "multipart/binary" ) ; response . setHeader ( CONTENT_TRANSFER_ENCODING , "binary" ) ; response . setHeader ( CONTENT_LOCATION , contentLocationKey ) ; // Copy the data into the payload
response . setContent ( responseContent ) ; response . setHeader ( CONTENT_LENGTH , response . getContent ( ) . readableBytes ( ) ) ; // Write the response to the Netty Channel
if ( logger . isDebugEnabled ( ) ) { String keyStr = RestUtils . getKeyHexString ( this . key ) ; debugLog ( "GET" , this . storeName , keyStr , startTimeInMs , System . currentTimeMillis ( ) , numVectorClockEntries ) ; } this . messageEvent . getChannel ( ) . write ( response ) ; if ( performanceStats != null && isFromLocalZone ) { recordStats ( performanceStats , startTimeInMs , Tracked . GET ) ; } outputStream . close ( ) ; |
public class EbeanQueryCreator { /** * ( non - Javadoc )
* @ see org . springframework . data . repository . query . parser . AbstractQueryCreator # and ( org . springframework . data . repository . query . parser . Part , java . lang . Object , java . util . Iterator ) */
@ Override protected Expression and ( Part part , Expression base , Iterator < Object > iterator ) { } } | return Expr . and ( base , toExpression ( part , root ) ) ; |
public class DataSet { /** * Hash - partitions a DataSet on the specified key fields .
* < p > < b > Important : < / b > This operation shuffles the whole DataSet over the network and can take significant amount of time .
* @ param fields The field indexes on which the DataSet is hash - partitioned .
* @ return The partitioned DataSet . */
public PartitionOperator < T > partitionByHash ( int ... fields ) { } } | return new PartitionOperator < > ( this , PartitionMethod . HASH , new Keys . ExpressionKeys < > ( fields , getType ( ) ) , Utils . getCallLocationName ( ) ) ; |
public class XObject { /** * Create the right XObject based on the type of the object passed .
* This function < emph > can < / emph > make an XObject that exposes DOM Nodes , NodeLists , and
* NodeIterators to the XSLT stylesheet as node - sets .
* @ param val The java object which this object will wrap .
* @ param xctxt The XPath context .
* @ return the right XObject based on the type of the object passed . */
static public XObject create ( Object val , XPathContext xctxt ) { } } | return XObjectFactory . create ( val , xctxt ) ; |
public class BaseEntity { /** * Returns the property value as a Timestamp .
* @ throws DatastoreException if no such property
* @ throws ClassCastException if value is not a Timestamp */
@ SuppressWarnings ( "unchecked" ) public Timestamp getTimestamp ( String name ) { } } | return ( ( Value < Timestamp > ) getValue ( name ) ) . get ( ) ; |
public class DMatrixUtils { /** * Consumes an array and desired respective indices in an array and return a new array with values from the desired indices .
* @ param vector Values .
* @ param indices Desired indices for order .
* @ return A new array . */
public static double [ ] applyIndices ( double [ ] vector , int [ ] indices ) { } } | // Initialize the return array :
final double [ ] retval = new double [ indices . length ] ; // Iterate over indices and populate :
for ( int i = 0 ; i < retval . length ; i ++ ) { retval [ i ] = vector [ indices [ i ] ] ; } // Done , return the return value :
return retval ; |
public class CmsHtmlList { /** * Removes an item from the list . < p >
* Keeping care of all the state like sorted column , sorting order , displayed page and search filter . < p >
* Try to use it instead of < code > { @ link A _ CmsListDialog # refreshList ( ) } < / code > . < p >
* @ param id the id of the item to remove
* @ return the removed list item */
public CmsListItem removeItem ( String id ) { } } | CmsListItem item = getItem ( id ) ; if ( item == null ) { return null ; } CmsListState state = null ; if ( ( m_filteredItems != null ) || ( m_visibleItems != null ) ) { state = getState ( ) ; } m_originalItems . remove ( item ) ; if ( m_filteredItems != null ) { m_filteredItems . remove ( item ) ; } if ( m_visibleItems != null ) { m_visibleItems . remove ( item ) ; } if ( state != null ) { setState ( state ) ; } return item ; |
public class ItemStreamLink { /** * / * ( non - Javadoc )
* @ see com . ibm . ws . sib . msgstore . ItemCollection # findFirstMatchingItemStream ( com . ibm . ws . sib . msgstore . Filter ) */
public final ItemStream findFirstMatchingItemStream ( Filter filter ) throws MessageStoreException { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "findFirstMatchingItemStream" , filter ) ; ItemStream item = ( ItemStream ) _itemStreams . findFirstMatching ( filter ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "findFirstMatchingItemStream" , item ) ; return item ; |
public class FaceletViewDeclarationLanguage { /** * Generate the content type
* @ param context
* @ param orig
* @ return */
protected String getResponseContentType ( FacesContext context , String orig ) { } } | String contentType = orig ; // see if we need to override the contentType
Map < Object , Object > m = context . getAttributes ( ) ; if ( m . containsKey ( "facelets.ContentType" ) ) { contentType = ( String ) m . get ( "facelets.ContentType" ) ; if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "Facelet specified alternate contentType '" + contentType + "'" ) ; } } // safety check
if ( contentType == null ) { contentType = "text/html" ; log . finest ( "ResponseWriter created had a null ContentType, defaulting to text/html" ) ; } return contentType ; |
public class ServerUtility { /** * Signals for the server to reload its policies . */
public static void reloadPolicies ( String protocol , String user , String pass ) throws IOException { } } | getServerResponse ( protocol , user , pass , "/management/control?action=reloadPolicies" ) ; |
public class RemoteTaskRunner { /** * Ensures no workers are already running a task before assigning the task to a worker .
* It is possible that a worker is running a task that the RTR has no knowledge of . This occurs when the RTR
* needs to bootstrap after a restart .
* @ param taskRunnerWorkItem - the task to assign
* @ return true iff the task is now assigned */
private boolean tryAssignTask ( final Task task , final RemoteTaskRunnerWorkItem taskRunnerWorkItem ) throws Exception { } } | Preconditions . checkNotNull ( task , "task" ) ; Preconditions . checkNotNull ( taskRunnerWorkItem , "taskRunnerWorkItem" ) ; Preconditions . checkArgument ( task . getId ( ) . equals ( taskRunnerWorkItem . getTaskId ( ) ) , "task id != workItem id" ) ; if ( runningTasks . containsKey ( task . getId ( ) ) || findWorkerRunningTask ( task . getId ( ) ) != null ) { log . info ( "Task[%s] already running." , task . getId ( ) ) ; return true ; } else { // Nothing running this task , announce it in ZK for a worker to run it
WorkerBehaviorConfig workerConfig = workerConfigRef . get ( ) ; WorkerSelectStrategy strategy ; if ( workerConfig == null || workerConfig . getSelectStrategy ( ) == null ) { strategy = WorkerBehaviorConfig . DEFAULT_STRATEGY ; log . debug ( "No worker selection strategy set. Using default of [%s]" , strategy . getClass ( ) . getSimpleName ( ) ) ; } else { strategy = workerConfig . getSelectStrategy ( ) ; } ZkWorker assignedWorker = null ; final ImmutableWorkerInfo immutableZkWorker ; try { synchronized ( workersWithUnacknowledgedTask ) { immutableZkWorker = strategy . findWorkerForTask ( config , ImmutableMap . copyOf ( Maps . transformEntries ( Maps . filterEntries ( zkWorkers , new Predicate < Map . Entry < String , ZkWorker > > ( ) { @ Override public boolean apply ( Map . Entry < String , ZkWorker > input ) { return ! lazyWorkers . containsKey ( input . getKey ( ) ) && ! workersWithUnacknowledgedTask . containsKey ( input . getKey ( ) ) && ! blackListedWorkers . contains ( input . getValue ( ) ) ; } } ) , ( String key , ZkWorker value ) -> value . toImmutable ( ) ) ) , task ) ; if ( immutableZkWorker != null && workersWithUnacknowledgedTask . putIfAbsent ( immutableZkWorker . getWorker ( ) . getHost ( ) , task . getId ( ) ) == null ) { assignedWorker = zkWorkers . get ( immutableZkWorker . getWorker ( ) . getHost ( ) ) ; } } if ( assignedWorker != null ) { return announceTask ( task , assignedWorker , taskRunnerWorkItem ) ; } else { log . debug ( "Unsuccessful task-assign attempt for task [%s] on workers [%s]. Workers to ack tasks are [%s]." , task . getId ( ) , zkWorkers . values ( ) , workersWithUnacknowledgedTask ) ; } return false ; } finally { if ( assignedWorker != null ) { workersWithUnacknowledgedTask . remove ( assignedWorker . getWorker ( ) . getHost ( ) ) ; // if this attempt won the race to run the task then other task might be able to use this worker now after task ack .
runPendingTasks ( ) ; } } } |
public class PlaceRegistry { /** * Returns an enumeration of all of the registered place objects . This should only be accessed
* on the dobjmgr thread and shouldn ' t be kept around across event dispatches . */
public Iterator < PlaceObject > enumeratePlaces ( ) { } } | final Iterator < PlaceManager > itr = _pmgrs . values ( ) . iterator ( ) ; return new Iterator < PlaceObject > ( ) { public boolean hasNext ( ) { return itr . hasNext ( ) ; } public PlaceObject next ( ) { PlaceManager plmgr = itr . next ( ) ; return ( plmgr == null ) ? null : plmgr . getPlaceObject ( ) ; } public void remove ( ) { throw new UnsupportedOperationException ( ) ; } } ; |
public class RestService { /** * For entities with the given attribute that is part of a bidirectional one - to - many relationship
* update the other side of the relationship .
* @ param entity created or updated entity
* @ param existingEntity existing entity
* @ param attr bidirectional one - to - many attribute */
private void updateMappedByEntitiesOneToMany ( @ Nonnull Entity entity , @ Nullable @ CheckForNull Entity existingEntity , @ Nonnull Attribute attr ) { } } | if ( attr . getDataType ( ) != ONE_TO_MANY || ! attr . isMappedBy ( ) ) { throw new IllegalArgumentException ( format ( "Attribute [%s] is not of type [%s] or not mapped by another attribute" , attr . getName ( ) , attr . getDataType ( ) . toString ( ) ) ) ; } // update ref entities of created / updated entity
Attribute refAttr = attr . getMappedBy ( ) ; Stream < Entity > stream = stream ( entity . getEntities ( attr . getName ( ) ) ) ; if ( existingEntity != null ) { // filter out unchanged ref entities
Set < Object > refEntityIds = stream ( existingEntity . getEntities ( attr . getName ( ) ) ) . map ( Entity :: getIdValue ) . collect ( toSet ( ) ) ; stream = stream . filter ( refEntity -> ! refEntityIds . contains ( refEntity . getIdValue ( ) ) ) ; } List < Entity > updatedRefEntities = stream . map ( refEntity -> { if ( refEntity . getEntity ( refAttr . getName ( ) ) != null ) { throw new MolgenisDataException ( format ( "Updating [%s] with id [%s] not allowed: [%s] is already referred to by another [%s]" , attr . getRefEntity ( ) . getId ( ) , refEntity . getIdValue ( ) . toString ( ) , refAttr . getName ( ) , entity . getEntityType ( ) . getId ( ) ) ) ; } refEntity . set ( refAttr . getName ( ) , entity ) ; return refEntity ; } ) . collect ( toList ( ) ) ; // update ref entities of existing entity
if ( existingEntity != null ) { Set < Object > refEntityIds = stream ( entity . getEntities ( attr . getName ( ) ) ) . map ( Entity :: getIdValue ) . collect ( toSet ( ) ) ; List < Entity > updatedRefEntitiesExistingEntity = stream ( existingEntity . getEntities ( attr . getName ( ) ) ) . filter ( refEntity -> ! refEntityIds . contains ( refEntity . getIdValue ( ) ) ) . map ( refEntity -> { refEntity . set ( refAttr . getName ( ) , null ) ; return refEntity ; } ) . collect ( toList ( ) ) ; updatedRefEntities = Stream . concat ( updatedRefEntities . stream ( ) , updatedRefEntitiesExistingEntity . stream ( ) ) . collect ( toList ( ) ) ; } if ( ! updatedRefEntities . isEmpty ( ) ) { dataService . update ( attr . getRefEntity ( ) . getId ( ) , updatedRefEntities . stream ( ) ) ; } |
public class ExpressionToken { /** * Get a JavaBean property from the given < code > value < / code >
* @ param value the JavaBean
* @ param propertyName the property name
* @ return the value of the property from the object < code > value < / code > */
protected final Object beanLookup ( Object value , Object propertyName ) { } } | LOGGER . trace ( "get JavaBean property : " + propertyName ) ; return ParseUtils . getProperty ( value , propertyName . toString ( ) , PROPERTY_CACHE ) ; |
public class MapExpressionBase { /** * Create a { @ code value in values ( this ) } expression
* @ param value value
* @ return expression */
public final BooleanExpression containsValue ( Expression < V > value ) { } } | return Expressions . booleanOperation ( Ops . CONTAINS_VALUE , mixin , value ) ; |
public class GenericSorting { /** * Sorts the specified range of elements according
* to the order induced by the specified comparator . All elements in the
* range must be < i > mutually comparable < / i > by the specified comparator
* ( that is , < tt > c . compare ( a , b ) < / tt > must not throw an
* exception for any indexes < tt > a < / tt > and
* < tt > b < / tt > in the range ) . < p >
* This sort is guaranteed to be < i > stable < / i > : equal elements will
* not be reordered as a result of the sort . < p >
* The sorting algorithm is a modified mergesort ( in which the merge is
* omitted if the highest element in the low sublist is less than the
* lowest element in the high sublist ) . This algorithm offers guaranteed
* n * log ( n ) performance , and can approach linear performance on nearly
* sorted lists .
* @ param fromIndex the index of the first element ( inclusive ) to be sorted .
* @ param toIndex the index of the last element ( exclusive ) to be sorted .
* @ param c the comparator to determine the order of the generic data .
* @ param swapper an object that knows how to swap the elements at any two indexes ( a , b ) .
* @ see IntComparator
* @ see Swapper */
public static void mergeSort ( int fromIndex , int toIndex , IntComparator c , Swapper swapper ) { } } | /* We retain the same method signature as quickSort .
Given only a comparator and swapper we do not know how to copy and move elements from / to temporary arrays .
Hence , in contrast to the JDK mergesorts this is an " in - place " mergesort , i . e . does not allocate any temporary arrays .
A non - inplace mergesort would perhaps be faster in most cases , but would require non - intuitive delegate objects . . . */
int length = toIndex - fromIndex ; // Insertion sort on smallest arrays
if ( length < SMALL ) { for ( int i = fromIndex ; i < toIndex ; i ++ ) { for ( int j = i ; j > fromIndex && ( c . compare ( j - 1 , j ) > 0 ) ; j -- ) { swapper . swap ( j , j - 1 ) ; } } return ; } // Recursively sort halves
int mid = ( fromIndex + toIndex ) / 2 ; mergeSort ( fromIndex , mid , c , swapper ) ; mergeSort ( mid , toIndex , c , swapper ) ; // If list is already sorted , nothing left to do . This is an
// optimization that results in faster sorts for nearly ordered lists .
if ( c . compare ( mid - 1 , mid ) <= 0 ) return ; // Merge sorted halves
inplace_merge ( fromIndex , mid , toIndex , c , swapper ) ; |
public class LazyFutureStreamFunctions { /** * Returns a stream ed to all elements for which a predicate evaluates to
* < code > true < / code > .
* < code >
* / / ( 1 , 2)
* Seq . of ( 1 , 2 , 3 , 4 , 5 ) . limitUntil ( i - & gt ; i = = 3)
* < / code > */
@ SuppressWarnings ( "unchecked" ) public static < T > ReactiveSeq < T > takeUntil ( final Stream < T > stream , final Predicate < ? super T > predicate ) { } } | final Iterator < T > it = stream . iterator ( ) ; class LimitUntil implements Iterator < T > { T next = ( T ) NULL ; boolean test = false ; void test ( ) { if ( ! test && next == NULL && it . hasNext ( ) ) { next = it . next ( ) ; if ( test = predicate . test ( next ) ) { next = ( T ) NULL ; close ( it ) ; // need to close any open queues
} } } @ Override public boolean hasNext ( ) { test ( ) ; return next != NULL ; } @ Override public T next ( ) { if ( next == NULL ) throw new NoSuchElementException ( ) ; try { return next ; } finally { next = ( T ) NULL ; } } } return ReactiveSeq . fromIterator ( new LimitUntil ( ) ) . onClose ( ( ) -> { stream . close ( ) ; } ) ; |
public class DOMDifferenceEngine { /** * Compares properties of an attribute . */
private ComparisonState compareAttributes ( Attr control , XPathContext controlContext , Attr test , XPathContext testContext ) { } } | return compareAttributeExplicitness ( control , controlContext , test , testContext ) . apply ( ) . andThen ( new Comparison ( ComparisonType . ATTR_VALUE , control , getXPath ( controlContext ) , control . getValue ( ) , getParentXPath ( controlContext ) , test , getXPath ( testContext ) , test . getValue ( ) , getParentXPath ( testContext ) ) ) ; |
public class Bubble { /** * Sort the int array in descending order using this algorithm .
* @ param intArray the array of ints that we want to sort */
public static void sortDescending ( int [ ] intArray ) { } } | boolean swapped = true ; while ( swapped ) { swapped = false ; for ( int i = 0 ; i < ( intArray . length - 1 ) ; i ++ ) { if ( intArray [ i ] < intArray [ i + 1 ] ) { TrivialSwap . swap ( intArray , i , i + 1 ) ; swapped = true ; } } } |
public class DefaultJsonGenerator { /** * Serializes date and writes it into specified buffer . */
protected void writeDate ( Date date , CharBuf buffer ) { } } | SimpleDateFormat formatter = new SimpleDateFormat ( dateFormat , dateLocale ) ; formatter . setTimeZone ( timezone ) ; buffer . addQuoted ( formatter . format ( date ) ) ; |
public class V1BPMComponentImplementationModel { /** * { @ inheritDoc } */
@ Override public boolean isPersistent ( ) { } } | String p = getModelAttribute ( "persistent" ) ; return p != null ? Boolean . parseBoolean ( p ) : false ; |
public class ServiceOperations { /** * Initialize then start a service .
* The service state is checked < i > before < / i > the operation begins .
* This process is < i > not < / i > thread safe .
* @ param service a service that must be in the state
* { @ link Service . STATE # NOTINITED }
* @ param configuration the configuration to initialize the service with
* @ throws RuntimeException on a state change failure
* @ throws IllegalStateException if the service is in the wrong state */
public static void deploy ( Service service , HiveConf configuration ) { } } | init ( service , configuration ) ; start ( service ) ; |
public class DefaultGroovyPagesUriService { /** * / * ( non - Javadoc )
* @ see grails . web . pages . GroovyPagesUriService # getNoSuffixViewURI ( groovy . lang . GroovyObject , java . lang . String ) */
@ Override public String getNoSuffixViewURI ( GroovyObject controller , String viewName ) { } } | Assert . notNull ( controller , "Argument [controller] cannot be null" ) ; return getNoSuffixViewURI ( getLogicalControllerName ( controller ) , viewName ) ; |
public class JSONClient { /** * Demonstrates various JSON / flexible schema queries .
* @ throws Exception if anything unexpected happens . */
private VoltTable runQuery ( String description , String SQL ) throws Exception { } } | System . out . println ( description ) ; ClientResponse resp = client . callProcedure ( "@AdHoc" , SQL ) ; System . out . println ( "SQL query: " + SQL ) ; System . out . println ( ) ; VoltTable table = resp . getResults ( ) [ 0 ] ; System . out . println ( table . toFormattedString ( ) ) ; System . out . println ( ) ; return table ; |
public class LoggerFactory { /** * Return the { @ link ILoggerFactory } instance in use .
* ILoggerFactory instance is bound with this class at compile time .
* @ return the ILoggerFactory instance in use */
public static ILoggerFactory getILoggerFactory ( ) { } } | if ( INITIALIZATION_STATE == UNINITIALIZED ) { synchronized ( LoggerFactory . class ) { if ( INITIALIZATION_STATE == UNINITIALIZED ) { INITIALIZATION_STATE = ONGOING_INITIALIZATION ; performInitialization ( ) ; } } } switch ( INITIALIZATION_STATE ) { case SUCCESSFUL_INITIALIZATION : return StaticLoggerBinder . getSingleton ( ) . getLoggerFactory ( ) ; case NOP_FALLBACK_INITIALIZATION : return NOP_FALLBACK_FACTORY ; case FAILED_INITIALIZATION : throw new IllegalStateException ( UNSUCCESSFUL_INIT_MSG ) ; case ONGOING_INITIALIZATION : // support re - entrant behavior .
// See also http : / / jira . qos . ch / browse / SLF4J - 97
return SUBST_FACTORY ; } throw new IllegalStateException ( "Unreachable code" ) ; |
public class StopWorkspacesRequest { /** * The WorkSpaces to stop . You can specify up to 25 WorkSpaces .
* @ return The WorkSpaces to stop . You can specify up to 25 WorkSpaces . */
public java . util . List < StopRequest > getStopWorkspaceRequests ( ) { } } | if ( stopWorkspaceRequests == null ) { stopWorkspaceRequests = new com . amazonaws . internal . SdkInternalList < StopRequest > ( ) ; } return stopWorkspaceRequests ; |
public class XPathQueryBuilder { /** * Creates a new { @ link org . apache . jackrabbit . spi . commons . query . RelationQueryNode }
* with < code > queryNode < / code > as its parent node .
* @ param node a comparison expression node .
* @ param queryNode the current < code > QueryNode < / code > . */
private void createExpression ( SimpleNode node , NAryQueryNode queryNode ) { } } | if ( node . getId ( ) != JJTCOMPARISONEXPR ) { throw new IllegalArgumentException ( "node must be of type ComparisonExpr" ) ; } // get operation type
String opType = node . getValue ( ) ; int type = 0 ; if ( opType . equals ( OP_EQ ) ) { type = RelationQueryNode . OPERATION_EQ_VALUE ; } else if ( opType . equals ( OP_SIGN_EQ ) ) { type = RelationQueryNode . OPERATION_EQ_GENERAL ; } else if ( opType . equals ( OP_GT ) ) { type = RelationQueryNode . OPERATION_GT_VALUE ; } else if ( opType . equals ( OP_SIGN_GT ) ) { type = RelationQueryNode . OPERATION_GT_GENERAL ; } else if ( opType . equals ( OP_GE ) ) { type = RelationQueryNode . OPERATION_GE_VALUE ; } else if ( opType . equals ( OP_SIGN_GE ) ) { type = RelationQueryNode . OPERATION_GE_GENERAL ; } else if ( opType . equals ( OP_LE ) ) { type = RelationQueryNode . OPERATION_LE_VALUE ; } else if ( opType . equals ( OP_SIGN_LE ) ) { type = RelationQueryNode . OPERATION_LE_GENERAL ; } else if ( opType . equals ( OP_LT ) ) { type = RelationQueryNode . OPERATION_LT_VALUE ; } else if ( opType . equals ( OP_SIGN_LT ) ) { type = RelationQueryNode . OPERATION_LT_GENERAL ; } else if ( opType . equals ( OP_NE ) ) { type = RelationQueryNode . OPERATION_NE_VALUE ; } else if ( opType . equals ( OP_SIGN_NE ) ) { type = RelationQueryNode . OPERATION_NE_GENERAL ; } else { exceptions . add ( new InvalidQueryException ( "Unsupported ComparisonExpr type:" + node . getValue ( ) ) ) ; } final RelationQueryNode rqn = factory . createRelationQueryNode ( queryNode , type ) ; // traverse
node . childrenAccept ( this , rqn ) ; // check if string transformation is valid
try { rqn . acceptOperands ( new DefaultQueryNodeVisitor ( ) { public Object visit ( PropertyFunctionQueryNode node , Object data ) { String functionName = node . getFunctionName ( ) ; if ( ( functionName . equals ( PropertyFunctionQueryNode . LOWER_CASE ) || functionName . equals ( PropertyFunctionQueryNode . UPPER_CASE ) ) && rqn . getValueType ( ) != QueryConstants . TYPE_STRING ) { String msg = "Upper and lower case function are only supported with String literals" ; exceptions . add ( new InvalidQueryException ( msg ) ) ; } return data ; } } , null ) ; } catch ( RepositoryException e ) { exceptions . add ( e ) ; } queryNode . addOperand ( rqn ) ; |
public class Config { /** * Read config object stored in JSON format from < code > InputStream < / code >
* @ param inputStream object
* @ return config
* @ throws IOException error */
public static Config fromJSON ( InputStream inputStream ) throws IOException { } } | ConfigSupport support = new ConfigSupport ( ) ; return support . fromJSON ( inputStream , Config . class ) ; |
public class DoubleTupleCollections { /** * Create the specified number of tuples with the given dimensions
* ( { @ link Tuple # getSize ( ) size } ) , all initialized to zero , and place
* them into the given target collection
* @ param dimensions The dimensions ( { @ link Tuple # getSize ( ) size } )
* of the tuples to create
* @ param numElements The number of tuples to create
* @ param target The target collection
* @ throws IllegalArgumentException If the given dimensions are negative */
public static void create ( int dimensions , int numElements , Collection < ? super MutableDoubleTuple > target ) { } } | for ( int i = 0 ; i < numElements ; i ++ ) { target . add ( DoubleTuples . create ( dimensions ) ) ; } |
public class ElementPlugin { /** * Notify listeners of plugin events .
* @ param event The plugin event containing the action . */
@ EventHandler ( "action" ) private void onAction ( PluginEvent event ) { } } | PluginException exception = null ; PluginAction action = event . getAction ( ) ; boolean debug = log . isDebugEnabled ( ) ; if ( pluginEventListeners1 != null ) { for ( IPluginEvent listener : new ArrayList < > ( pluginEventListeners1 ) ) { try { if ( debug ) { log . debug ( "Invoking IPluginEvent.on" + WordUtils . capitalizeFully ( action . name ( ) ) + " for listener " + listener ) ; } switch ( action ) { case LOAD : listener . onLoad ( this ) ; continue ; case UNLOAD : listener . onUnload ( ) ; continue ; case ACTIVATE : listener . onActivate ( ) ; continue ; case INACTIVATE : listener . onInactivate ( ) ; continue ; } } catch ( Throwable e ) { exception = createChainedException ( action . name ( ) , e , exception ) ; } } } if ( pluginEventListeners2 != null ) { for ( IPluginEventListener listener : new ArrayList < > ( pluginEventListeners2 ) ) { try { if ( debug ) { log . debug ( "Delivering " + action . name ( ) + " event to IPluginEventListener listener " + listener ) ; } listener . onPluginEvent ( event ) ; } catch ( Throwable e ) { exception = createChainedException ( action . name ( ) , e , exception ) ; } } } if ( action == PluginAction . LOAD ) { doAfterLoad ( ) ; } if ( exception != null ) { throw exception ; } |
public class BuilderImpl { /** * ( non - Javadoc )
* @ see com . ibm . ws . security . jwt . internal . Builder # audience ( java . util . List ) */
@ Override public Builder audience ( List < String > newaudiences ) throws InvalidClaimException { } } | // this . AUDIENCE
if ( newaudiences != null && ! newaudiences . isEmpty ( ) ) { ArrayList < String > audiences = new ArrayList < String > ( ) ; for ( String aud : newaudiences ) { if ( aud != null && ! aud . trim ( ) . isEmpty ( ) && ! audiences . contains ( aud ) ) { audiences . add ( aud ) ; } } if ( audiences . isEmpty ( ) ) { String err = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_ERR" , new Object [ ] { Claims . AUDIENCE , newaudiences } ) ; throw new InvalidClaimException ( err ) ; } // this . audiences = new ArrayList < String > ( audiences ) ;
claims . put ( Claims . AUDIENCE , audiences ) ; } else { String err = Tr . formatMessage ( tc , "JWT_INVALID_CLAIM_VALUE_ERR" , new Object [ ] { Claims . AUDIENCE , newaudiences } ) ; throw new InvalidClaimException ( err ) ; } return this ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.