signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class VirtualNetworkGatewaysInner { /** * This operation retrieves a list of routes the virtual network gateway has learned , including routes learned from BGP peers .
* @ param resourceGroupName The name of the resource group .
* @ param virtualNetworkGatewayName The name of the virtual network gateway .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable for the request */
public Observable < GatewayRouteListResultInner > getLearnedRoutesAsync ( String resourceGroupName , String virtualNetworkGatewayName ) { } } | return getLearnedRoutesWithServiceResponseAsync ( resourceGroupName , virtualNetworkGatewayName ) . map ( new Func1 < ServiceResponse < GatewayRouteListResultInner > , GatewayRouteListResultInner > ( ) { @ Override public GatewayRouteListResultInner call ( ServiceResponse < GatewayRouteListResultInner > response ) { return response . body ( ) ; } } ) ; |
public class GeneratedAnnotationSpecs { /** * Returns { @ code @ Generated ( " processorClass " } if either { @ code
* javax . annotation . processing . Generated } or { @ code javax . annotation . Generated } is { @ linkplain
* GeneratedAnnotations # generatedAnnotation ( Elements ) available at compile time } .
* @ deprecated prefer { @ link # generatedAnnotationSpec ( Elements , SourceVersion , Class ) } */
@ Deprecated public static Optional < AnnotationSpec > generatedAnnotationSpec ( Elements elements , Class < ? > processorClass ) { } } | return generatedAnnotationSpecBuilder ( elements , processorClass ) . map ( AnnotationSpec . Builder :: build ) ; |
public class ForkJoinPool { /** * Constructs and tries to install a new external queue ,
* failing if the workQueues array already has a queue at
* the given index .
* @ param index the index of the new queue */
private void tryCreateExternalQueue ( int index ) { } } | AuxState aux ; if ( ( aux = auxState ) != null && index >= 0 ) { WorkQueue q = new WorkQueue ( this , null ) ; q . config = index ; q . scanState = ~ UNSIGNALLED ; q . qlock = 1 ; // lock queue
boolean installed = false ; aux . lock ( ) ; try { // lock pool to install
WorkQueue [ ] ws ; if ( ( ws = workQueues ) != null && index < ws . length && ws [ index ] == null ) { ws [ index ] = q ; // else throw away
installed = true ; } } finally { aux . unlock ( ) ; } if ( installed ) { try { q . growArray ( ) ; } finally { q . qlock = 0 ; } } } |
public class AtomContainerManipulator { /** * Get the summed natural abundance of all atoms in an AtomContainer
* @ param atomContainer The IAtomContainer to manipulate
* @ return The summed natural abundance of all atoms in this AtomContainer . */
public static double getTotalNaturalAbundance ( IAtomContainer atomContainer ) { } } | try { Isotopes isotopes = Isotopes . getInstance ( ) ; double abundance = 1.0 ; double hAbundance = isotopes . getMajorIsotope ( 1 ) . getNaturalAbundance ( ) ; int nImplH = 0 ; for ( IAtom atom : atomContainer . atoms ( ) ) { if ( atom . getImplicitHydrogenCount ( ) == null ) throw new IllegalArgumentException ( "an atom had with unknown (null) implicit hydrogens" ) ; abundance *= atom . getNaturalAbundance ( ) ; for ( int h = 0 ; h < atom . getImplicitHydrogenCount ( ) ; h ++ ) abundance *= hAbundance ; nImplH += atom . getImplicitHydrogenCount ( ) ; } return abundance / Math . pow ( 100 , nImplH + atomContainer . getAtomCount ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( "Isotopes definitions could not be loaded" , e ) ; } |
public class MonitoringProxyActivator { /** * Reflectively locate the { @ code setClassAvailableTarget } method on
* the proxy at runtime .
* @ return the { @ code setProcessCandidateTarget } method instance
* @ throws Exception if a reflection error occurred */
Method findClassAvailableProxySetClassAvailableTargetMethod ( ) throws Exception { } } | Class < ? > proxyClass = Class . forName ( CLASS_AVAILABLE_PROXY_CLASS_NAME ) ; Method method = ReflectionHelper . getDeclaredMethod ( proxyClass , "setClassAvailableTarget" , Object . class , Method . class ) ; ReflectionHelper . setAccessible ( method , true ) ; return method ; |
public class BTreeLeaf { /** * Returns the schema of the B - tree leaf records .
* @ param keyType
* the type of the indexed field
* @ return the schema of the index records */
static Schema schema ( SearchKeyType keyType ) { } } | Schema sch = new Schema ( ) ; for ( int i = 0 ; i < keyType . length ( ) ; i ++ ) sch . addField ( keyFieldName ( i ) , keyType . get ( i ) ) ; sch . addField ( SCH_RID_BLOCK , BIGINT ) ; sch . addField ( SCH_RID_ID , INTEGER ) ; return sch ; |
public class ReflectionConfig { /** * { @ link Reflections } bean .
* @ return bean */
@ Bean public Reflections reflections ( ) { } } | return new Reflections ( new ConfigurationBuilder ( ) . setUrls ( ClasspathHelper . forPackage ( scanPackage ) ) . setScanners ( new MethodAnnotationsScanner ( ) ) ) ; |
public class Packer { /** * Get String stored in UTF - 8 format ( encoded as : Int32 - Length + bytes )
* @ return
* @ see # putString ( String ) */
public String getStringF ( ) { } } | int len = getInt ( ) ; byte [ ] utf = new byte [ len ] ; System . arraycopy ( buf , bufPosition , utf , 0 , utf . length ) ; bufPosition += utf . length ; return new String ( utf , 0 , len , charsetUTF8 ) ; |
public class DCFields { /** * Ensure the dc : identifiers include the pid of the target object
* @ param targetPid
* @ return String xml */
public String getAsXML ( String targetPid ) { } } | ReadableCharArrayWriter out = new ReadableCharArrayWriter ( 512 ) ; try { getAsXML ( targetPid , out ) ; } catch ( IOException wonthappen ) { throw new RuntimeException ( wonthappen ) ; } return out . getString ( ) ; |
public class DrizzleConnection { /** * Creates a default < code > PreparedStatement < / code > object capable of returning the auto - generated keys designated
* by the given array . This array contains the names of the columns in the target table that contain the
* auto - generated keys that should be returned . The driver will ignore the array if the SQL statement is not an
* < code > INSERT < / code > statement , or an SQL statement able to return auto - generated keys ( the list of such
* statements is vendor - specific ) .
* An SQL statement with or without IN parameters can be pre - compiled and stored in a < code > PreparedStatement < / code >
* object . This object can then be used to efficiently execute this statement multiple times .
* < B > Note : < / B > This method is optimized for handling parametric SQL statements that benefit from precompilation . If
* the driver supports precompilation , the method < code > prepareStatement < / code > will send the statement to the
* database for precompilation . Some drivers may not support precompilation . In this case , the statement may not be
* sent to the database until the < code > PreparedStatement < / code > object is executed . This has no direct effect on
* users ; however , it does affect which methods throw certain SQLExceptions .
* Result sets created using the returned < code > PreparedStatement < / code > object will by default be type
* < code > TYPE _ FORWARD _ ONLY < / code > and have a concurrency level of < code > CONCUR _ READ _ ONLY < / code > . The holdability of
* the created result sets can be determined by calling { @ link # getHoldability } .
* @ param sql an SQL statement that may contain one or more ' ? ' IN parameter placeholders
* @ param columnNames an array of column names indicating the columns that should be returned from the inserted row
* or rows
* @ return a new < code > PreparedStatement < / code > object , containing the pre - compiled statement , that is capable of
* returning the auto - generated keys designated by the given array of column names
* @ throws java . sql . SQLException if a database access error occurs or this method is called on a closed connection
* @ throws java . sql . SQLFeatureNotSupportedException
* if the JDBC driver does not support this method
* @ since 1.4 */
public PreparedStatement prepareStatement ( final String sql , final String [ ] columnNames ) throws SQLException { } } | if ( columnNames != null && columnNames . length == 1 && columnNames [ 0 ] . equals ( "insert_id" ) ) { return prepareStatement ( sql ) ; } throw SQLExceptionMapper . getSQLException ( "Only one auto generated key is supported, and it is called insert_id" ) ; |
public class SimonUtils { /** * Returns min / max counter values in human readable form - if the value is max or min long value
* it is considered unused and string " undef " is returned .
* @ param minmax counter extreme value
* @ return counter value or " undef " if counter contains { @ code Long . MIN _ VALUE } or { @ code Long . MAX _ VALUE } */
public static String presentMinMaxCount ( long minmax ) { } } | if ( minmax == Long . MAX_VALUE || minmax == Long . MIN_VALUE ) { return UNDEF_STRING ; } return String . valueOf ( minmax ) ; |
public class DepictionGenerator { /** * Specifies that reactions with atom - atom mappings should have their reactants / product
* coordinates aligned . Default : true .
* @ param val setting value
* @ return new generator for method chaining */
public DepictionGenerator withMappedRxnAlign ( boolean val ) { } } | DepictionGenerator copy = new DepictionGenerator ( this ) ; copy . alignMappedReactions = val ; return copy ; |
public class WebSockets { /** * Sends a complete close message , invoking the callback when complete
* @ param closeMessage The close message
* @ param wsChannel The web socket channel
* @ param callback The callback to invoke on completion */
public static void sendClose ( final CloseMessage closeMessage , final WebSocketChannel wsChannel , final WebSocketCallback < Void > callback ) { } } | sendClose ( closeMessage , wsChannel , callback , null ) ; |
public class JavaParser { /** * src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 392:1 : interfaceBodyDeclaration : ( ( modifier ) * interfaceMemberDecl | ' ; ' ) ; */
public final void interfaceBodyDeclaration ( ) throws RecognitionException { } } | int interfaceBodyDeclaration_StartIndex = input . index ( ) ; try { if ( state . backtracking > 0 && alreadyParsedRule ( input , 27 ) ) { return ; } // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 393:5 : ( ( modifier ) * interfaceMemberDecl | ' ; ' )
int alt40 = 2 ; int LA40_0 = input . LA ( 1 ) ; if ( ( LA40_0 == ENUM || LA40_0 == Identifier || LA40_0 == 53 || LA40_0 == 58 || LA40_0 == 63 || LA40_0 == 65 || LA40_0 == 67 || ( LA40_0 >= 71 && LA40_0 <= 72 ) || LA40_0 == 77 || LA40_0 == 83 || LA40_0 == 85 || ( LA40_0 >= 92 && LA40_0 <= 94 ) || LA40_0 == 96 || ( LA40_0 >= 100 && LA40_0 <= 102 ) || ( LA40_0 >= 105 && LA40_0 <= 107 ) || LA40_0 == 110 || LA40_0 == 114 || ( LA40_0 >= 118 && LA40_0 <= 119 ) ) ) { alt40 = 1 ; } else if ( ( LA40_0 == 52 ) ) { alt40 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 40 , 0 , input ) ; throw nvae ; } switch ( alt40 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 393:7 : ( modifier ) * interfaceMemberDecl
{ // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 393:7 : ( modifier ) *
loop39 : while ( true ) { int alt39 = 2 ; int LA39_0 = input . LA ( 1 ) ; if ( ( LA39_0 == 58 ) ) { int LA39_6 = input . LA ( 2 ) ; if ( ( LA39_6 == Identifier ) ) { alt39 = 1 ; } } else if ( ( LA39_0 == 63 || LA39_0 == 83 || LA39_0 == 96 || ( LA39_0 >= 100 && LA39_0 <= 102 ) || ( LA39_0 >= 106 && LA39_0 <= 107 ) || LA39_0 == 110 || LA39_0 == 114 || LA39_0 == 119 ) ) { alt39 = 1 ; } switch ( alt39 ) { case 1 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 393:7 : modifier
{ pushFollow ( FOLLOW_modifier_in_interfaceBodyDeclaration884 ) ; modifier ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; default : break loop39 ; } } pushFollow ( FOLLOW_interfaceMemberDecl_in_interfaceBodyDeclaration887 ) ; interfaceMemberDecl ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / semantics / java / parser / Java . g : 394:9 : ' ; '
{ match ( input , 52 , FOLLOW_52_in_interfaceBodyDeclaration897 ) ; if ( state . failed ) return ; } break ; } } catch ( RecognitionException re ) { reportError ( re ) ; recover ( input , re ) ; } finally { // do for sure before leaving
if ( state . backtracking > 0 ) { memoize ( input , 27 , interfaceBodyDeclaration_StartIndex ) ; } } |
public class Gauge { /** * Defines if the knob is visible .
* @ param VISIBLE */
public void setKnobVisible ( final boolean VISIBLE ) { } } | if ( null == knobVisible ) { _knobVisible = VISIBLE ; fireUpdateEvent ( VISIBILITY_EVENT ) ; } else { knobVisible . set ( VISIBLE ) ; } |
public class WListRenderer { /** * Paints the given WList .
* @ param component the WList to paint .
* @ param renderContext the RenderContext to paint to . */
@ Override public void doRender ( final WComponent component , final WebXmlRenderContext renderContext ) { } } | WList list = ( WList ) component ; XmlStringBuilder xml = renderContext . getWriter ( ) ; WList . Type type = list . getType ( ) ; WList . Separator separator = list . getSeparator ( ) ; Size gap = list . getSpace ( ) ; String gapString = gap == null ? null : gap . toString ( ) ; xml . appendTagOpen ( "ui:panel" ) ; xml . appendAttribute ( "id" , component . getId ( ) ) ; xml . appendOptionalAttribute ( "class" , component . getHtmlClass ( ) ) ; xml . appendOptionalAttribute ( "track" , component . isTracking ( ) , "true" ) ; xml . appendOptionalAttribute ( "type" , list . isRenderBorder ( ) , "box" ) ; xml . appendClose ( ) ; // Render margin
MarginRendererUtil . renderMargin ( list , renderContext ) ; xml . appendTagOpen ( "ui:listlayout" ) ; xml . appendOptionalAttribute ( "gap" , gapString ) ; if ( type != null ) { switch ( type ) { case FLAT : xml . appendAttribute ( "type" , "flat" ) ; break ; case STACKED : xml . appendAttribute ( "type" , "stacked" ) ; break ; case STRIPED : xml . appendAttribute ( "type" , "striped" ) ; break ; default : throw new SystemException ( "Unknown list type: " + type ) ; } } if ( separator != null ) { switch ( separator ) { case BAR : xml . appendAttribute ( "separator" , "bar" ) ; break ; case DOT : xml . appendAttribute ( "separator" , "dot" ) ; break ; case NONE : break ; default : throw new SystemException ( "Unknown list type: " + type ) ; } } xml . appendClose ( ) ; paintRows ( list , renderContext ) ; xml . appendEndTag ( "ui:listlayout" ) ; xml . appendEndTag ( "ui:panel" ) ; |
public class FeatureShapes { /** * Remove all map shapes in the database and table from the map , excluding shapes with the excluded types
* @ param database GeoPackage database
* @ param table table name
* @ param excludedTypes Google Map Shape Types to exclude from map removal
* @ return count of removed features
* @ since 3.2.0 */
public int removeShapesWithExclusions ( String database , String table , Set < GoogleMapShapeType > excludedTypes ) { } } | int count = 0 ; Map < Long , FeatureShape > featureIds = getFeatureIds ( database , table ) ; if ( featureIds != null ) { Iterator < Long > iterator = featureIds . keySet ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { long featureId = iterator . next ( ) ; FeatureShape featureShape = getFeatureShape ( featureIds , featureId ) ; if ( featureShape != null ) { Iterator < GoogleMapShape > shapeIterator = featureShape . getShapes ( ) . iterator ( ) ; while ( shapeIterator . hasNext ( ) ) { GoogleMapShape mapShape = shapeIterator . next ( ) ; if ( excludedTypes == null || ! excludedTypes . contains ( mapShape . getShapeType ( ) ) ) { mapShape . remove ( ) ; shapeIterator . remove ( ) ; } } } if ( featureShape == null || ! featureShape . hasShapes ( ) ) { if ( featureShape != null ) { featureShape . removeMetadataShapes ( ) ; } iterator . remove ( ) ; count ++ ; } } } return count ; |
public class ViewManager { /** * / / created for GH352
* Returns a Template instance by given path
* @ param path
* the path to the template
* @ return
* A template found by path or null if not found */
@ SuppressWarnings ( "unused" ) public Template getTemplate ( String path ) { } } | ActContext . Base ctx = ActContext . Base . currentContext ( ) ; if ( null != ctx ) { String curPath = ctx . templatePath ( ) ; ctx . templateLiteral ( path ) ; try { return load ( ctx ) ; } finally { ctx . templatePath ( curPath ) ; } } final String templatePath = S . ensureStartsWith ( path , '/' ) ; Template template = null ; View defView = Act . appConfig ( ) . defaultView ( ) ; if ( null != defView ) { template = ! isTemplatePath ( path ) ? defView . loadInlineTemplate ( path ) : defView . loadTemplate ( templatePath ) ; } if ( null == template && multiViews ) { for ( View view : viewList ) { if ( view == defView ) continue ; template = view . loadTemplate ( templatePath ) ; if ( null != template ) { break ; } } } if ( null != template ) { cache ( path , template ) ; } return template ; |
public class GVRAudioSource { /** * Preloads a sound file .
* @ param soundFile path / name of the file to be played . */
public void load ( String soundFile ) { } } | if ( mSoundFile != null ) { unload ( ) ; } mSoundFile = soundFile ; if ( mAudioListener != null ) { mAudioListener . getAudioEngine ( ) . preloadSoundFile ( soundFile ) ; Log . d ( "SOUND" , "loaded audio file %s" , getSoundFile ( ) ) ; } |
public class Eigen { /** * Computes the eigenvalues and eigenvectors of a general matrix .
* @ return an array of ComplexDoubleMatrix objects containing the eigenvectors
* stored as the columns of the first matrix , and the eigenvalues as the
* diagonal elements of the second matrix . */
public static ComplexDoubleMatrix [ ] eigenvectors ( DoubleMatrix A ) { } } | A . assertSquare ( ) ; // setting up result arrays
DoubleMatrix WR = new DoubleMatrix ( A . rows ) ; DoubleMatrix WI = WR . dup ( ) ; DoubleMatrix VR = new DoubleMatrix ( A . rows , A . rows ) ; SimpleBlas . geev ( 'N' , 'V' , A . dup ( ) , WR , WI , dummyDouble , VR ) ; // transferring the result
ComplexDoubleMatrix E = new ComplexDoubleMatrix ( WR , WI ) ; ComplexDoubleMatrix V = new ComplexDoubleMatrix ( A . rows , A . rows ) ; // System . err . printf ( " VR = % s \ n " , VR . toString ( ) ) ;
for ( int i = 0 ; i < A . rows ; i ++ ) { if ( E . get ( i ) . isReal ( ) ) { V . putColumn ( i , new ComplexDoubleMatrix ( VR . getColumn ( i ) ) ) ; } else { ComplexDoubleMatrix v = new ComplexDoubleMatrix ( VR . getColumn ( i ) , VR . getColumn ( i + 1 ) ) ; V . putColumn ( i , v ) ; V . putColumn ( i + 1 , v . conji ( ) ) ; i += 1 ; } } return new ComplexDoubleMatrix [ ] { V , ComplexDoubleMatrix . diag ( E ) } ; |
public class TangoEventsAdapter { public void removeTangoQualityChangeListener ( ITangoQualityChangeListener listener , String attrName ) throws DevFailed { } } | synchronized ( moni ) { TangoQualityChange tangoQualityChange ; String key = deviceName + "/" + attrName ; if ( ( tangoQualityChange = tango_quality_change_source . get ( key ) ) != null ) tangoQualityChange . removeTangoQualityChangeListener ( listener ) ; } |
public class AsynchronousRequest { /** * For more info on WvW matches API go < a href = " https : / / wiki . guildwars2 . com / wiki / API : 2 / wvw / matches " > here < / a > < br / >
* Give user the access to { @ link Callback # onResponse ( Call , Response ) } and { @ link Callback # onFailure ( Call , Throwable ) } methods for custom interactions
* @ param worldID { @ link World # id }
* @ param callback callback that is going to be used for { @ link Call # enqueue ( Callback ) }
* @ throws NullPointerException if given { @ link Callback } is empty
* @ see WvWMatchOverview WvW match overview info */
public void getWvWMatchOverview ( int worldID , Callback < WvWMatchOverview > callback ) throws NullPointerException { } } | gw2API . getWvWMatchOverviewUsingWorld ( Integer . toString ( worldID ) ) . enqueue ( callback ) ; |
public class PaymentSummaryBuilder { /** * Adds a { @ link PriceLabel } to the { @ link PaymentSummary } .
* @ param label
* the { @ link PriceLabel # label } .
* @ param amount
* the { @ link PriceLabel # amount } .
* @ return this builder . */
public PaymentSummaryBuilder addPriceLabel ( String label , String amount ) { } } | PriceLabel priceLabel = new PriceLabel ( label , amount ) ; return addPriceLabel ( priceLabel ) ; |
public class ConfusionMatrix { /** * Confusion matrix printed to text by toString can be parsed back
* @ param text input text
* @ return confusion matrix
* @ throws IllegalArgumentException if input is malformed */
public static ConfusionMatrix parseFromText ( String text ) throws IllegalArgumentException { } } | try { String [ ] lines = text . split ( "\n" ) ; String [ ] l = lines [ 0 ] . split ( "\\s+" ) ; List < String > labels = new ArrayList < > ( ) ; for ( String aL : l ) { if ( ! aL . isEmpty ( ) ) { labels . add ( aL ) ; } } ConfusionMatrix result = new ConfusionMatrix ( ) ; for ( int i = 1 ; i < lines . length ; i ++ ) { String line = lines [ i ] ; String [ ] split = line . split ( "\\s+" ) ; List < String > row = new ArrayList < > ( ) ; for ( String aSplit : split ) { if ( ! aSplit . isEmpty ( ) ) { row . add ( aSplit ) ; } } String predictedLabel = row . get ( 0 ) ; for ( int r = 1 ; r < row . size ( ) ; r ++ ) { String s = row . get ( r ) ; Integer val = Integer . valueOf ( s ) ; String acutalLabel = labels . get ( r - 1 ) ; result . increaseValue ( predictedLabel , acutalLabel , val ) ; } } return result ; } catch ( Exception e ) { throw new IllegalArgumentException ( "Wrong input format" , e ) ; } |
public class ViewUtils { /** * Get position of center child in X Axes */
public static int getCenterXChildPosition ( RecyclerView recyclerView ) { } } | int childCount = recyclerView . getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { View child = recyclerView . getChildAt ( i ) ; if ( isChildInCenterX ( recyclerView , child ) ) { return recyclerView . getChildAdapterPosition ( child ) ; } } return childCount ; |
public class ClassHierarchyImpl { /** * A helper method that returns the parsed default value of a given
* NamedParameter .
* @ return null or an empty set if there is no default value , the default value ( or set of values ) otherwise .
* @ throws ClassHierarchyException if a default value was specified , but could not be parsed , or if a set of
* values were specified for a non - set parameter . */
@ SuppressWarnings ( "unchecked" ) @ Override public < T > T parseDefaultValue ( final NamedParameterNode < T > name ) { } } | final String [ ] vals = name . getDefaultInstanceAsStrings ( ) ; final T [ ] ret = ( T [ ] ) new Object [ vals . length ] ; for ( int i = 0 ; i < vals . length ; i ++ ) { final String val = vals [ i ] ; try { ret [ i ] = parse ( name , val ) ; } catch ( final ParseException e ) { throw new ClassHierarchyException ( "Could not parse default value" , e ) ; } } if ( name . isSet ( ) ) { return ( T ) new HashSet < T > ( Arrays . asList ( ret ) ) ; } else if ( name . isList ( ) ) { return ( T ) new ArrayList < T > ( Arrays . asList ( ret ) ) ; } else { if ( ret . length == 0 ) { return null ; } else if ( ret . length == 1 ) { return ret [ 0 ] ; } else { throw new IllegalStateException ( "Multiple defaults for non-set named parameter! " + name . getFullName ( ) ) ; } } |
public class MiniTemplatorParser { /** * The main block is an implicitly defined block that covers the whole template . */
private void beginMainBlock ( ) { } } | int blockNo = registerBlock ( null ) ; BlockTabRec btr = blockTab [ blockNo ] ; btr . tPosBegin = 0 ; btr . tPosContentsBegin = 0 ; openBlocksTab [ currentNestingLevel ] = blockNo ; currentNestingLevel ++ ; |
public class PosTagger { /** * < p > Part - of - speech tag a string passed in on the command line . For
* example :
* < p > java opennlp . tools . lang . spanish . PosTagger - test " Sr . Smith da el auto a sus hermano en Lunes . " */
public static void main ( String [ ] args ) throws IOException { } } | if ( args . length == 0 ) { System . err . println ( "Usage: PosTaggerME [-td tagdict] model < tokenized_sentences" ) ; System . err . println ( " PosTaggerME -test model \"sentence\"" ) ; System . exit ( 1 ) ; } int ai = 0 ; boolean test = false ; String tagdict = null ; while ( ai < args . length && args [ ai ] . startsWith ( "-" ) ) { if ( args [ ai ] . equals ( "-test" ) ) { ai ++ ; test = true ; } else if ( args [ ai ] . equals ( "-td" ) ) { tagdict = args [ ai + 1 ] ; ai += 2 ; } } POSTaggerME tagger ; String modelFile = args [ ai ++ ] ; if ( tagdict != null ) { tagger = new PosTagger ( modelFile , new POSDictionary ( tagdict ) ) ; } else { tagger = new PosTagger ( modelFile ) ; } if ( test ) { System . out . println ( tagger . tag ( args [ ai ] ) ) ; } else { BufferedReader in = new BufferedReader ( new InputStreamReader ( System . in , "ISO-8859-1" ) ) ; PrintStream out = new PrintStream ( System . out , true , "ISO-8859-1" ) ; for ( String line = in . readLine ( ) ; line != null ; line = in . readLine ( ) ) { out . println ( tagger . tag ( line ) ) ; } } |
public class RedirectSupport { /** * gets the right value , encodes it , and prints or stores it */
@ Override public int doEndTag ( ) throws JspException { } } | String result ; // the eventual result
// add ( already encoded ) parameters
String baseUrl = UrlSupport . resolveUrl ( url , context , pageContext ) ; result = params . aggregateParams ( baseUrl ) ; // if the URL is relative , rewrite it with ' redirect ' encoding rules
HttpServletResponse response = ( ( HttpServletResponse ) pageContext . getResponse ( ) ) ; if ( ! UrlUtil . isAbsoluteUrl ( result ) ) { result = response . encodeRedirectURL ( result ) ; } // redirect !
try { response . sendRedirect ( result ) ; } catch ( java . io . IOException ex ) { throw new JspTagException ( ex . toString ( ) , ex ) ; } return SKIP_PAGE ; |
public class ExecutionGroupVertex { /** * Creates the initial execution vertices managed by this group vertex .
* @ param initialNumberOfVertices
* the initial number of execution vertices
* @ throws GraphConversionException
* thrown if the number of execution vertices for this group vertex cannot be set to the desired value */
void createInitialExecutionVertices ( final int initalNumberOfVertices ) throws GraphConversionException { } } | // If the requested number of group vertices does not change , do nothing
if ( initalNumberOfVertices == this . getCurrentNumberOfGroupMembers ( ) ) { return ; } // Make sure the method is only called for the initial setup of the graph
if ( this . getCurrentNumberOfGroupMembers ( ) != 1 ) { throw new IllegalStateException ( "This method can only be called for the initial setup of the execution graph" ) ; } // If the number of group vertices is user defined , prevent overwriting
if ( this . userDefinedNumberOfMembers != - 1 ) { if ( this . userDefinedNumberOfMembers == getCurrentNumberOfGroupMembers ( ) ) { // Note that
// this . userDefinedNumberOfMembers
// is final and requires no
// locking !
throw new GraphConversionException ( "Cannot overwrite user defined number of group members" ) ; } } // Make sure the value of newNumber is valid
// TODO : Move these checks to some other place
/* * if ( this . getMinimumNumberOfGroupMember ( ) < 1 ) {
* throw new GraphConversionException ( " The minimum number of members is below 1 for group vertex "
* + this . getName ( ) ) ;
* if ( ( this . getMaximumNumberOfGroupMembers ( ) ! = - 1)
* & & ( this . getMaximumNumberOfGroupMembers ( ) < this . getMinimumNumberOfGroupMember ( ) ) ) {
* throw new GraphConversionException (
* " The maximum number of members is smaller than the minimum for group vertex " + this . getName ( ) ) ; */
if ( initalNumberOfVertices < this . getMinimumNumberOfGroupMember ( ) ) { throw new GraphConversionException ( "Number of members must be at least " + this . getMinimumNumberOfGroupMember ( ) ) ; } if ( ( this . getMaximumNumberOfGroupMembers ( ) != - 1 ) && ( initalNumberOfVertices > this . getMaximumNumberOfGroupMembers ( ) ) ) { throw new GraphConversionException ( "Number of members cannot exceed " + this . getMaximumNumberOfGroupMembers ( ) ) ; } final ExecutionVertex originalVertex = this . getGroupMember ( 0 ) ; int currentNumberOfExecutionVertices = this . getCurrentNumberOfGroupMembers ( ) ; while ( currentNumberOfExecutionVertices ++ < initalNumberOfVertices ) { final ExecutionVertex vertex = originalVertex . splitVertex ( ) ; vertex . setAllocatedResource ( new AllocatedResource ( DummyInstance . createDummyInstance ( this . instanceType ) , this . instanceType , null ) ) ; this . groupMembers . add ( vertex ) ; } // Update the index and size information attached to the vertices
int index = 0 ; final Iterator < ExecutionVertex > it = this . groupMembers . iterator ( ) ; while ( it . hasNext ( ) ) { final ExecutionVertex vertex = it . next ( ) ; vertex . setIndexInVertexGroup ( index ++ ) ; } |
public class JsonPropertyExpander { /** * Populates the embedded object property with the relevant field values .
* @ param entity the entity
* @ param currentNode the current node to to process
* @ param property the embedded object property
* @ param field the Java field
* @ param node the node
* @ param map the map of field values
* @ throws ODataException If unable to fill object properties */
public void fillUpdatedObjectProperty ( Object entity , Object currentNode , StructuralProperty property , Field field , String node , Map < String , Object > map ) throws ODataException { } } | for ( Map . Entry < String , Object > entry : ( ( Map < String , Object > ) currentNode ) . entrySet ( ) ) { if ( findAppropriateElement ( entity , property , field , node , map , entry ) ) { break ; } } |
public class ConcurrentLinkedHashMap { /** * Drains the read buffer up to an amortized threshold . */
@ GuardedBy ( "evictionLock" ) void drainWriteBuffer ( ) { } } | for ( int i = 0 ; i < WRITE_BUFFER_DRAIN_THRESHOLD ; i ++ ) { final Runnable task = writeBuffer . poll ( ) ; if ( task == null ) { break ; } task . run ( ) ; } |
public class OpenPgpContact { /** * Return a { @ link Set } of { @ link OpenPgpV4Fingerprint } s of all keys of the contact , which have the trust state
* { @ link OpenPgpStore . Trust # undecided } .
* @ return undecided fingerprints
* @ throws IOException IO error
* @ throws PGPException PGP error */
public Set < OpenPgpV4Fingerprint > getUndecidedFingerprints ( ) throws IOException , PGPException { } } | return getFingerprintsOfKeysWithState ( getAnyPublicKeys ( ) , OpenPgpTrustStore . Trust . undecided ) ; |
public class Unchecked { /** * Wrap a { @ link CheckedToIntFunction } in a { @ link ToIntFunction } .
* Example :
* < code > < pre >
* map . computeIfAbsent ( " key " , Unchecked . toIntFunction ( k - > {
* if ( k . length ( ) > 10)
* throw new Exception ( " Only short strings allowed " ) ;
* return 42;
* < / pre > < / code > */
public static < T > ToIntFunction < T > toIntFunction ( CheckedToIntFunction < T > function ) { } } | return toIntFunction ( function , THROWABLE_TO_RUNTIME_EXCEPTION ) ; |
public class AbstractJsonProvider { /** * Removes a value in an object or array
* @ param obj an array or an object
* @ param key a String key or a numerical index to remove */
@ SuppressWarnings ( "unchecked" ) public void removeProperty ( Object obj , Object key ) { } } | if ( isMap ( obj ) ) ( ( Map ) obj ) . remove ( key . toString ( ) ) ; else { List list = ( List ) obj ; int index = key instanceof Integer ? ( Integer ) key : Integer . parseInt ( key . toString ( ) ) ; list . remove ( index ) ; } |
public class DeleteParametersResult { /** * The names of the deleted parameters .
* @ param deletedParameters
* The names of the deleted parameters . */
public void setDeletedParameters ( java . util . Collection < String > deletedParameters ) { } } | if ( deletedParameters == null ) { this . deletedParameters = null ; return ; } this . deletedParameters = new com . amazonaws . internal . SdkInternalList < String > ( deletedParameters ) ; |
public class MappeableBitmapContainer { /** * Counts how many runs there is in the bitmap , up to a maximum
* @ param mustNotExceed maximum of runs beyond which counting is pointless
* @ return estimated number of courses */
public int numberOfRunsLowerBound ( int mustNotExceed ) { } } | int numRuns = 0 ; if ( BufferUtil . isBackedBySimpleArray ( bitmap ) ) { long [ ] b = bitmap . array ( ) ; for ( int blockOffset = 0 ; blockOffset < b . length ; blockOffset += BLOCKSIZE ) { for ( int i = blockOffset ; i < blockOffset + BLOCKSIZE ; i ++ ) { long word = b [ i ] ; numRuns += Long . bitCount ( ( ~ word ) & ( word << 1 ) ) ; } if ( numRuns > mustNotExceed ) { return numRuns ; } } } else { int len = bitmap . limit ( ) ; for ( int blockOffset = 0 ; blockOffset < len ; blockOffset += BLOCKSIZE ) { for ( int i = blockOffset ; i < blockOffset + BLOCKSIZE ; i ++ ) { long word = bitmap . get ( i ) ; numRuns += Long . bitCount ( ( ~ word ) & ( word << 1 ) ) ; } if ( numRuns > mustNotExceed ) { return numRuns ; } } } return numRuns ; |
public class QueueContainer { /** * Polls an item on the backup replica . The item ID is predetermined
* when executing the poll operation on the partition owner .
* Executed on the backup replica
* @ param itemId the item ID as determined by the primary replica */
public void pollBackup ( long itemId ) { } } | QueueItem item = getBackupMap ( ) . remove ( itemId ) ; if ( item != null ) { // for stats
age ( item , Clock . currentTimeMillis ( ) ) ; } |
public class ns_ssl_certkey { /** * < pre >
* Performs generic data validation for the operation to be performed
* < / pre > */
protected void validate ( String operationType ) throws Exception { } } | super . validate ( operationType ) ; MPSString id_validator = new MPSString ( ) ; id_validator . setConstraintIsReq ( MPSConstants . DELETE_CONSTRAINT , true ) ; id_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; id_validator . validate ( operationType , id , "\"id\"" ) ; MPSString ssl_certificate_validator = new MPSString ( ) ; ssl_certificate_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; ssl_certificate_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; ssl_certificate_validator . setConstraintIsReq ( MPSConstants . ADD_CONSTRAINT , true ) ; ssl_certificate_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; ssl_certificate_validator . validate ( operationType , ssl_certificate , "\"ssl_certificate\"" ) ; MPSString ssl_key_validator = new MPSString ( ) ; ssl_key_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; ssl_key_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; ssl_key_validator . validate ( operationType , ssl_key , "\"ssl_key\"" ) ; MPSString certkeypair_name_validator = new MPSString ( ) ; certkeypair_name_validator . setConstraintCharSetRegEx ( MPSConstants . GENERIC_CONSTRAINT , "[ a-zA-Z0-9_#.:@=-]+" ) ; certkeypair_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; certkeypair_name_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; certkeypair_name_validator . setConstraintIsReq ( MPSConstants . ADD_CONSTRAINT , true ) ; certkeypair_name_validator . setConstraintIsReq ( MPSConstants . MODIFY_CONSTRAINT , true ) ; certkeypair_name_validator . validate ( operationType , certkeypair_name , "\"certkeypair_name\"" ) ; MPSString cert_format_validator = new MPSString ( ) ; cert_format_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 64 ) ; cert_format_validator . validate ( operationType , cert_format , "\"cert_format\"" ) ; MPSInt days_to_expiry_validator = new MPSInt ( ) ; days_to_expiry_validator . setConstraintMinValue ( MPSConstants . GENERIC_CONSTRAINT , 0 ) ; days_to_expiry_validator . validate ( operationType , days_to_expiry , "\"days_to_expiry\"" ) ; MPSIPAddress ns_ip_address_validator = new MPSIPAddress ( ) ; ns_ip_address_validator . validate ( operationType , ns_ip_address , "\"ns_ip_address\"" ) ; MPSString status_validator = new MPSString ( ) ; status_validator . validate ( operationType , status , "\"status\"" ) ; MPSString device_name_validator = new MPSString ( ) ; device_name_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; device_name_validator . setConstraintMinStrLen ( MPSConstants . GENERIC_CONSTRAINT , 1 ) ; device_name_validator . validate ( operationType , device_name , "\"device_name\"" ) ; MPSIPAddress ns_ip_address_arr_validator = new MPSIPAddress ( ) ; ns_ip_address_arr_validator . setConstraintIsReq ( MPSConstants . GENERIC_CONSTRAINT , true ) ; if ( ns_ip_address_arr != null ) { for ( int i = 0 ; i < ns_ip_address_arr . length ; i ++ ) { ns_ip_address_arr_validator . validate ( operationType , ns_ip_address_arr [ i ] , "ns_ip_address_arr[" + i + "]" ) ; } } MPSBoolean save_config_validator = new MPSBoolean ( ) ; save_config_validator . validate ( operationType , save_config , "\"save_config\"" ) ; MPSBoolean no_domain_check_validator = new MPSBoolean ( ) ; no_domain_check_validator . validate ( operationType , no_domain_check , "\"no_domain_check\"" ) ; MPSString version_validator = new MPSString ( ) ; version_validator . validate ( operationType , version , "\"version\"" ) ; MPSInt serial_number_validator = new MPSInt ( ) ; serial_number_validator . validate ( operationType , serial_number , "\"serial_number\"" ) ; MPSString signature_algorithm_validator = new MPSString ( ) ; signature_algorithm_validator . validate ( operationType , signature_algorithm , "\"signature_algorithm\"" ) ; MPSString issuer_validator = new MPSString ( ) ; issuer_validator . validate ( operationType , issuer , "\"issuer\"" ) ; MPSString valid_from_validator = new MPSString ( ) ; valid_from_validator . validate ( operationType , valid_from , "\"valid_from\"" ) ; MPSString valid_to_validator = new MPSString ( ) ; valid_to_validator . validate ( operationType , valid_to , "\"valid_to\"" ) ; MPSString subject_validator = new MPSString ( ) ; subject_validator . validate ( operationType , subject , "\"subject\"" ) ; MPSString public_key_algorithm_validator = new MPSString ( ) ; public_key_algorithm_validator . validate ( operationType , public_key_algorithm , "\"public_key_algorithm\"" ) ; MPSInt public_key_size_validator = new MPSInt ( ) ; public_key_size_validator . validate ( operationType , public_key_size , "\"public_key_size\"" ) ; MPSString csr_validator = new MPSString ( ) ; csr_validator . validate ( operationType , csr , "\"csr\"" ) ; MPSString password_validator = new MPSString ( ) ; password_validator . setConstraintMaxStrLen ( MPSConstants . GENERIC_CONSTRAINT , 128 ) ; password_validator . validate ( operationType , password , "\"password\"" ) ; |
public class JdbcUtil { /** * Imports the data from < code > DataSet < / code > to database .
* @ param dataset
* @ param conn
* @ param insertSQL the column order in the sql must be consistent with the column order in the DataSet . Here is sample about how to create the sql :
* < pre > < code >
* List < String > columnNameList = new ArrayList < > ( dataset . columnNameList ( ) ) ;
* columnNameList . retainAll ( yourSelectColumnNames ) ;
* String sql = RE . insert ( columnNameList ) . into ( tableName ) . sql ( ) ;
* < / code > < / pre >
* @ param stmtSetter
* @ return
* @ throws UncheckedSQLException */
public static int importData ( final DataSet dataset , final Connection conn , final String insertSQL , final Try . BiConsumer < ? super PreparedStatement , ? super Object [ ] , SQLException > stmtSetter ) throws UncheckedSQLException { } } | return importData ( dataset , 0 , dataset . size ( ) , conn , insertSQL , stmtSetter ) ; |
public class FileAccessPermissions { /** * This method sets the flag ( s ) given by { @ code bitMask } of this this { @ link # getMaskBits ( ) mask } for the given
* { @ code fileModeClass } to the given value ( { @ code flag } ) .
* @ param fileModeClass is the class of access ( { @ link FileAccessClass # USER } , { @ link FileAccessClass # GROUP } , or
* { @ link FileAccessClass # OTHERS } ) .
* @ param bitMask is the bit - mask of the flag ( s ) to set .
* @ param flag - if { @ code true } the flag will be set , if { @ code false } it will be unset . */
private void setFlag ( FileAccessClass fileModeClass , int bitMask , boolean flag ) { } } | setBits ( shiftMask ( fileModeClass , bitMask ) , flag ) ; |
public class ServerCore { /** * Removes a client from the internal data structures . This also removes
* the client from all the events to which he subscribed .
* @ param clientId the client ' s id for the client we want to remove
* @ return true if the client was present in the internal data structures ,
* false otherwise . */
@ Override public boolean removeClient ( long clientId ) { } } | ClientData clientData = clientsData . get ( clientId ) ; if ( clientData == null ) { return false ; } dispatcher . removeClient ( clientId ) ; // Iterate over all the sets in which this client figures as subscribed
// and remove it
synchronized ( subscriptions ) { for ( Set < Long > subscribedSet : clientData . subscriptions ) { synchronized ( subscribedSet ) { subscribedSet . remove ( clientId ) ; } } } metrics . numTotalSubscriptions . set ( numTotalSubscriptions . getAndAdd ( - clientData . subscriptions . size ( ) ) ) ; clientsData . remove ( clientId ) ; LOG . info ( "Removed client " + clientData ) ; metrics . numRegisteredClients . set ( clientsData . size ( ) ) ; return true ; |
public class ConnectionUtility { /** * Destroy a data source got from or created by ConnectionUtility before .
* If any exception occurred , it will be logged but never propagated .
* @ param dataSource the data source to be destroyed
* @ param force Whether try to destroy the data source even if it was created using createDataSource ( . . . ) method rather than getDataSource ( . . . ) method .
* If it is true , the data source will always be destroyed , if it is false , the data source will be destroyed only if it
* was got using getDataSource ( . . . ) method . */
public static void destroyDataSource ( DataSource dataSource , boolean force ) { } } | synchronized ( dataSourcesStructureLock ) { String dsName = null ; for ( Map . Entry < String , DataSource > dsEntry : dataSources . entrySet ( ) ) { DataSource ds = dsEntry . getValue ( ) ; if ( ds == dataSource ) { dsName = dsEntry . getKey ( ) ; break ; } } if ( force || dsName != null ) { for ( Map . Entry < String , DataSourceProvider > dspEntry : dataSourceProviders . entrySet ( ) ) { // try them one by one
String dspName = dspEntry . getKey ( ) ; DataSourceProvider dsp = dspEntry . getValue ( ) ; try { if ( dsp . destroyDataSource ( dataSource ) ) { if ( dsName != null ) { dataSources . remove ( dsName ) ; } break ; } } catch ( NoClassDefFoundError e ) { // ignore
} catch ( Throwable e ) { log . error ( "Error when destroying data source '" + dsName + "' using provider '" + dspName + "'" , e ) ; } } } } |
public class Job { /** * Signal exceptional cancellation of this job .
* @ param ex exception causing the termination of job . */
public void cancel ( Throwable ex ) { } } | if ( ex instanceof JobCancelledException || ex . getMessage ( ) != null && ex . getMessage ( ) . contains ( "job was cancelled" ) ) return ; if ( ex instanceof IllegalArgumentException || ex . getCause ( ) instanceof IllegalArgumentException ) { cancel ( "Illegal argument: " + ex . getMessage ( ) ) ; return ; } StringWriter sw = new StringWriter ( ) ; PrintWriter pw = new PrintWriter ( sw ) ; ex . printStackTrace ( pw ) ; String stackTrace = sw . toString ( ) ; cancel ( "Got exception '" + ex . getClass ( ) + "', with msg '" + ex . getMessage ( ) + "'\n" + stackTrace , JobState . FAILED ) ; if ( _fjtask != null && ! _fjtask . isDone ( ) ) _fjtask . completeExceptionally ( ex ) ; |
public class UploadNotificationConfig { /** * Sets the same notification icon for all the notification statuses .
* @ param resourceID Resource ID of the icon to use
* @ return { @ link UploadNotificationConfig } */
public final UploadNotificationConfig setIconForAllStatuses ( int resourceID ) { } } | progress . iconResourceID = resourceID ; completed . iconResourceID = resourceID ; error . iconResourceID = resourceID ; cancelled . iconResourceID = resourceID ; return this ; |
public class ByteBufPool { /** * Appends one ByteBuf to another ByteBuf . If target ByteBuf
* can ' t accommodate the ByteBuf to be appended , a new ByteBuf
* is created which contains both target and source ByteBufs data .
* The source ByteBuf is recycled after append .
* If target ByteBuf has no readable bytes , it is being recycled
* and the source ByteBuf is returned .
* Both ByteBufs must be not recycled before the operation .
* @ param to the target ByteBuf to which another ByteBuf will be appended
* @ param from the source ByteBuf to be appended
* @ return ByteBuf which contains the result of the appending */
@ NotNull public static ByteBuf append ( @ NotNull ByteBuf to , @ NotNull ByteBuf from ) { } } | assert ! to . isRecycled ( ) && ! from . isRecycled ( ) ; if ( to . readRemaining ( ) == 0 ) { to . recycle ( ) ; return from ; } to = ensureWriteRemaining ( to , from . readRemaining ( ) ) ; to . put ( from ) ; from . recycle ( ) ; return to ; |
public class DRL5Expressions { /** * src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 588:1 : identifierSuffix : ( ( LEFT _ SQUARE RIGHT _ SQUARE ) = > ( LEFT _ SQUARE RIGHT _ SQUARE ) + DOT class _ key | ( ( LEFT _ SQUARE ) = > LEFT _ SQUARE expression RIGHT _ SQUARE ) + | arguments ) ; */
public final void identifierSuffix ( ) throws RecognitionException { } } | Token LEFT_SQUARE16 = null ; Token RIGHT_SQUARE17 = null ; Token DOT18 = null ; Token LEFT_SQUARE19 = null ; Token RIGHT_SQUARE20 = null ; try { // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 589:5 : ( ( LEFT _ SQUARE RIGHT _ SQUARE ) = > ( LEFT _ SQUARE RIGHT _ SQUARE ) + DOT class _ key | ( ( LEFT _ SQUARE ) = > LEFT _ SQUARE expression RIGHT _ SQUARE ) + | arguments )
int alt65 = 3 ; int LA65_0 = input . LA ( 1 ) ; if ( ( LA65_0 == LEFT_SQUARE ) ) { int LA65_1 = input . LA ( 2 ) ; if ( ( LA65_1 == RIGHT_SQUARE ) && ( synpred33_DRL5Expressions ( ) ) ) { alt65 = 1 ; } else if ( ( LA65_1 == BOOL || ( LA65_1 >= DECIMAL && LA65_1 <= DECR ) || LA65_1 == FLOAT || LA65_1 == HEX || ( LA65_1 >= ID && LA65_1 <= INCR ) || ( LA65_1 >= LEFT_PAREN && LA65_1 <= LESS ) || LA65_1 == MINUS || LA65_1 == NEGATION || LA65_1 == NULL || LA65_1 == PLUS || ( LA65_1 >= STAR && LA65_1 <= TIME_INTERVAL ) ) ) { alt65 = 2 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } int nvaeMark = input . mark ( ) ; try { input . consume ( ) ; NoViableAltException nvae = new NoViableAltException ( "" , 65 , 1 , input ) ; throw nvae ; } finally { input . rewind ( nvaeMark ) ; } } } else if ( ( LA65_0 == LEFT_PAREN ) ) { alt65 = 3 ; } else { if ( state . backtracking > 0 ) { state . failed = true ; return ; } NoViableAltException nvae = new NoViableAltException ( "" , 65 , 0 , input ) ; throw nvae ; } switch ( alt65 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 589:7 : ( LEFT _ SQUARE RIGHT _ SQUARE ) = > ( LEFT _ SQUARE RIGHT _ SQUARE ) + DOT class _ key
{ // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 589:35 : ( LEFT _ SQUARE RIGHT _ SQUARE ) +
int cnt63 = 0 ; loop63 : while ( true ) { int alt63 = 2 ; int LA63_0 = input . LA ( 1 ) ; if ( ( LA63_0 == LEFT_SQUARE ) ) { alt63 = 1 ; } switch ( alt63 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 589:36 : LEFT _ SQUARE RIGHT _ SQUARE
{ LEFT_SQUARE16 = ( Token ) match ( input , LEFT_SQUARE , FOLLOW_LEFT_SQUARE_in_identifierSuffix3240 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( LEFT_SQUARE16 , DroolsEditorType . SYMBOL ) ; } RIGHT_SQUARE17 = ( Token ) match ( input , RIGHT_SQUARE , FOLLOW_RIGHT_SQUARE_in_identifierSuffix3281 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( RIGHT_SQUARE17 , DroolsEditorType . SYMBOL ) ; } } break ; default : if ( cnt63 >= 1 ) break loop63 ; if ( state . backtracking > 0 ) { state . failed = true ; return ; } EarlyExitException eee = new EarlyExitException ( 63 , input ) ; throw eee ; } cnt63 ++ ; } DOT18 = ( Token ) match ( input , DOT , FOLLOW_DOT_in_identifierSuffix3325 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( DOT18 , DroolsEditorType . SYMBOL ) ; } pushFollow ( FOLLOW_class_key_in_identifierSuffix3329 ) ; class_key ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; case 2 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 592:7 : ( ( LEFT _ SQUARE ) = > LEFT _ SQUARE expression RIGHT _ SQUARE ) +
{ // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 592:7 : ( ( LEFT _ SQUARE ) = > LEFT _ SQUARE expression RIGHT _ SQUARE ) +
int cnt64 = 0 ; loop64 : while ( true ) { int alt64 = 2 ; int LA64_0 = input . LA ( 1 ) ; if ( ( LA64_0 == LEFT_SQUARE ) ) { int LA64_36 = input . LA ( 2 ) ; if ( ( synpred34_DRL5Expressions ( ) ) ) { alt64 = 1 ; } } switch ( alt64 ) { case 1 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 592:8 : ( LEFT _ SQUARE ) = > LEFT _ SQUARE expression RIGHT _ SQUARE
{ LEFT_SQUARE19 = ( Token ) match ( input , LEFT_SQUARE , FOLLOW_LEFT_SQUARE_in_identifierSuffix3344 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( LEFT_SQUARE19 , DroolsEditorType . SYMBOL ) ; } pushFollow ( FOLLOW_expression_in_identifierSuffix3374 ) ; expression ( ) ; state . _fsp -- ; if ( state . failed ) return ; RIGHT_SQUARE20 = ( Token ) match ( input , RIGHT_SQUARE , FOLLOW_RIGHT_SQUARE_in_identifierSuffix3402 ) ; if ( state . failed ) return ; if ( state . backtracking == 0 ) { helper . emit ( RIGHT_SQUARE20 , DroolsEditorType . SYMBOL ) ; } } break ; default : if ( cnt64 >= 1 ) break loop64 ; if ( state . backtracking > 0 ) { state . failed = true ; return ; } EarlyExitException eee = new EarlyExitException ( 64 , input ) ; throw eee ; } cnt64 ++ ; } } break ; case 3 : // src / main / resources / org / drools / compiler / lang / DRL5Expressions . g : 595:9 : arguments
{ pushFollow ( FOLLOW_arguments_in_identifierSuffix3418 ) ; arguments ( ) ; state . _fsp -- ; if ( state . failed ) return ; } break ; } } catch ( RecognitionException re ) { throw re ; } finally { // do for sure before leaving
} |
public class KnowledgeOperations { /** * Gets a list map .
* @ param message the message
* @ param expressionMappings the expression mappings
* @ param expand whether to expand
* @ param undefinedVariable the undefined variable name
* @ return the list map */
public static Map < String , List < Object > > getListMap ( Message message , List < ExpressionMapping > expressionMappings , boolean expand , String undefinedVariable ) { } } | return getListMap ( message , expressionMappings , expand , undefinedVariable , null ) ; |
public class CredentialsInner { /** * Retrieve the credential identified by credential name .
* @ param resourceGroupName Name of an Azure Resource group .
* @ param automationAccountName The name of the automation account .
* @ param credentialName The name of credential .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws ErrorResponseException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
* @ return the CredentialInner object if successful . */
public CredentialInner get ( String resourceGroupName , String automationAccountName , String credentialName ) { } } | return getWithServiceResponseAsync ( resourceGroupName , automationAccountName , credentialName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class CommerceSubscriptionEntryUtil { /** * Returns the last commerce subscription entry in the ordered set where subscriptionStatus = & # 63 ; .
* @ param subscriptionStatus the subscription status
* @ param orderByComparator the comparator to order the set by ( optionally < code > null < / code > )
* @ return the last matching commerce subscription entry , or < code > null < / code > if a matching commerce subscription entry could not be found */
public static CommerceSubscriptionEntry fetchBySubscriptionStatus_Last ( int subscriptionStatus , OrderByComparator < CommerceSubscriptionEntry > orderByComparator ) { } } | return getPersistence ( ) . fetchBySubscriptionStatus_Last ( subscriptionStatus , orderByComparator ) ; |
public class DefaultMobicentsCluster { /** * ( non - Javadoc )
* @ see MobicentsCluster # isSingleMember ( ) */
public boolean isSingleMember ( ) { } } | final Address localAddress = getLocalAddress ( ) ; if ( localAddress != null ) { final List < Address > clusterMembers = getClusterMembers ( ) ; return clusterMembers . size ( ) == 1 ; } else { return true ; } |
public class PactDslJsonRootValue { /** * Value that must match the provided date format
* @ param format date format to match */
public static PactDslJsonRootValue date ( String format ) { } } | FastDateFormat instance = FastDateFormat . getInstance ( format ) ; PactDslJsonRootValue value = new PactDslJsonRootValue ( ) ; value . generators . addGenerator ( Category . BODY , "" , new DateGenerator ( format ) ) ; value . setValue ( instance . format ( new Date ( DATE_2000 ) ) ) ; value . setMatcher ( value . matchDate ( format ) ) ; return value ; |
public class AbstractChorusOutputWriter { /** * This is an extension point to change Chorus output
* The user can provider their own OutputWriter which extends the default and
* overrides getPrintWriter ( ) to return a writer configured for a different output stream
* n . b . this method will be called frequently so it is expected that the PrintWriter returned
* will generally be cached and reused by the implementation , but in some circumstances it is
* useful to be able to change the PrintWriter during the testing process so the details are
* left to the implementation
* @ return a PrintWriter to use for all logging */
protected PrintWriter getPrintWriter ( ) { } } | if ( printWriter == null || printStream != ChorusOut . out ) { printWriter = new PrintWriter ( ChorusOut . out ) ; printStream = ChorusOut . out ; } return printWriter ; |
public class BaseMessageItemStream { /** * Gets the destination low messages limit currently being used by this localization .
* @ return */
public long getDestLowMsgs ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "getDestLowMsgs" ) ; SibTr . exit ( tc , "getDestLowMsgs" , Long . valueOf ( _destLowMsgs ) ) ; } return _destLowMsgs ; |
public class Datamodel { /** * Creates a { @ link TimeValue } for a given date and time . The precision is
* automatically set to { @ link TimeValue # PREC _ SECOND } .
* @ param year
* a year number , where 0 refers to 1BCE
* @ param month
* a month number between 1 and 12
* @ param day
* a day number between 1 and 31
* @ param hour
* an hour number between 0 and 23
* @ param minute
* a minute number between 0 and 59
* @ param second
* a second number between 0 and 60 ( possible leap second )
* @ param timezoneOffset
* offset in minutes that should be applied when displaying this
* time
* @ param calendarModel
* the IRI of the calendar model preferred when displaying the
* date ; usually { @ link TimeValue # CM _ GREGORIAN _ PRO } or
* { @ link TimeValue # CM _ JULIAN _ PRO }
* @ return a { @ link TimeValue } corresponding to the input */
public static TimeValue makeTimeValue ( long year , byte month , byte day , byte hour , byte minute , byte second , int timezoneOffset , String calendarModel ) { } } | return factory . getTimeValue ( year , month , day , hour , minute , second , TimeValue . PREC_SECOND , 0 , 0 , timezoneOffset , calendarModel ) ; |
public class DefaultGroovyMethods { /** * Iterates over the collection returning each element that matches
* using the IDENTITY Closure as a filter - effectively returning all elements which satisfy Groovy truth .
* Example :
* < pre class = " groovyTestCase " >
* def items = [ 1 , 2 , 0 , false , true , ' ' , ' foo ' , [ ] , [ 4 , 5 ] , null ]
* assert items . grep ( ) = = [ 1 , 2 , true , ' foo ' , [ 4 , 5 ] ]
* < / pre >
* @ param self a Collection
* @ return a collection of elements satisfy Groovy truth
* @ see Closure # IDENTITY
* @ since 2.0 */
public static < T > Collection < T > grep ( Collection < T > self ) { } } | return grep ( self , Closure . IDENTITY ) ; |
public class ReactiveMongoOperationsSessionRepository { /** * Gets the { @ link MongoSession } by the { @ link MongoSession # getId ( ) } or { @ link Mono # empty ( ) } if no
* { @ link MongoSession } is found .
* @ param id the { @ link MongoSession # getId ( ) } to lookup
* @ return the { @ link MongoSession } by the { @ link MongoSession # getId ( ) } or { @ link Mono # empty ( ) } if no
* { @ link MongoSession } is found . */
@ Override public Mono < MongoSession > findById ( String id ) { } } | return findSession ( id ) . map ( document -> convertToSession ( this . mongoSessionConverter , document ) ) . filter ( mongoSession -> ! mongoSession . isExpired ( ) ) . switchIfEmpty ( Mono . defer ( ( ) -> this . deleteById ( id ) . then ( Mono . empty ( ) ) ) ) ; |
public class DualInputOperator { /** * Add to the second input the union of the given operators .
* @ param input The operator ( s ) to be unioned with the second input .
* @ deprecated This method will be removed in future versions . Use the { @ link Union } operator instead . */
@ Deprecated public void addSecondInput ( Operator < IN2 > ... input ) { } } | this . input2 = Operator . createUnionCascade ( this . input2 , input ) ; |
public class VisitStateSet { /** * Adds a visit state to the set , if necessary .
* @ param v the state to be added .
* @ return true if the state set changed as a result of this operation . */
public boolean add ( final VisitState v ) { } } | // The starting point .
int pos = ( int ) ( MurmurHash3 . hash ( v . schemeAuthority ) & mask ) ; // There ' s always an unused entry .
while ( visitState [ pos ] != null ) { if ( Arrays . equals ( visitState [ pos ] . schemeAuthority , v . schemeAuthority ) ) return false ; pos = ( pos + 1 ) & mask ; } visitState [ pos ] = v ; if ( ++ size >= maxFill && n < ( 1 << 30 ) ) rehash ( 2 * n ) ; return true ; |
public class ScheduledEventMonitor { /** * Invoked periodically by the timer thread */
@ Override public void run ( ) { } } | try { ScheduledEventQueue queue = ScheduledEventQueue . getSingleton ( ) ; int batch_size = PropertyManager . getIntegerProperty ( PropertyNames . SCHEDULED_EVENTS_BATCH_SIZE , 1000 ) ; int count = 0 ; Date now = new Date ( DatabaseAccess . getCurrentTime ( ) ) ; logger . log ( LogLevel . TRACE , "Processing scheduled events at: " + now ) ; ScheduledEvent event = queue . getNextReadyEvent ( now ) ; while ( event != null && count < batch_size ) { count ++ ; queue . processEvent ( event , now ) ; event = queue . getNextReadyEvent ( now ) ; } } catch ( Throwable t ) { logger . severeException ( t . getMessage ( ) , t ) ; } |
public class ProcessorExsltFunction { /** * Must include ; super doesn ' t suffice ! */
protected void appendAndPush ( StylesheetHandler handler , ElemTemplateElement elem ) throws SAXException { } } | // System . out . println ( " ProcessorFunction appendAndPush ( ) " + elem ) ;
super . appendAndPush ( handler , elem ) ; // System . out . println ( " originating node " + handler . getOriginatingNode ( ) ) ;
elem . setDOMBackPointer ( handler . getOriginatingNode ( ) ) ; handler . getStylesheet ( ) . setTemplate ( ( ElemTemplate ) elem ) ; |
public class HashUtil { /** * Zobrist Hashing
* @ param key 字节数组
* @ param mask 掩码
* @ param tab tab
* @ return hash值 */
public static int zobrist ( char [ ] key , int mask , int [ ] [ ] tab ) { } } | int hash , i ; for ( hash = key . length , i = 0 ; i < key . length ; ++ i ) { hash ^= tab [ i ] [ key [ i ] ] ; } return ( hash & mask ) ; |
public class StoryFinder { /** * Finds paths from a source URL , allowing for includes / excludes patterns .
* Paths found are normalised by { @ link StoryFinder # normalise ( List < String > ) }
* @ param searchIn the source URL to search in
* @ param includes the Array of include patterns , or < code > null < / code > if
* none
* @ param excludes the Array of exclude patterns , or < code > null < / code > if
* none
* @ return A List of paths found */
public List < String > findPaths ( URL searchIn , String [ ] includes , String [ ] excludes ) { } } | return findPaths ( CodeLocations . getPathFromURL ( searchIn ) , asList ( includes ) , asList ( excludes ) ) ; |
public class SessionImpl { /** * { @ inheritDoc } */
public String [ ] getNamespacePrefixes ( ) throws RepositoryException { } } | Collection < String > allPrefixes = new LinkedList < String > ( ) ; allPrefixes . addAll ( namespaces . keySet ( ) ) ; String [ ] permanentPrefixes = workspace . getNamespaceRegistry ( ) . getPrefixes ( ) ; for ( int i = 0 ; i < permanentPrefixes . length ; i ++ ) { if ( ! prefixes . containsKey ( workspace . getNamespaceRegistry ( ) . getURI ( permanentPrefixes [ i ] ) ) ) { allPrefixes . add ( permanentPrefixes [ i ] ) ; } } return allPrefixes . toArray ( new String [ allPrefixes . size ( ) ] ) ; |
public class Component { /** * Callback for the start tag of this component . Should the body be
* evaluated again ?
* < b > NOTE : < / b > has a parameter to determine to pop the component stack .
* @ param writer the output writer .
* @ param body the rendered body .
* @ param popComponentStack
* should the component stack be popped ?
* @ return true if the body should be evaluated again */
protected boolean end ( Writer writer , String body , boolean popComponentStack ) { } } | assert ( body != null ) ; try { writer . write ( body ) ; } catch ( IOException e ) { throw new StrutsException ( "IOError while writing the body: " + e . getMessage ( ) , e ) ; } if ( popComponentStack ) popComponentStack ( ) ; return false ; |
public class BNFHeadersImpl { /** * Print debug information on the headers to the RAS tracing log . */
public void debug ( ) { } } | if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "*** Begin Header Debug ***" ) ; HeaderElement elem = this . hdrSequence ; while ( null != elem ) { Tr . debug ( tc , elem . getName ( ) + ": " + elem . getDebugValue ( ) ) ; elem = elem . nextSequence ; } Tr . debug ( tc , "*** End Header Debug ***" ) ; } |
public class DivSufSort { /** * Returns the pivot element . */
private int trPivot ( int ISAd , int first , int last ) { } } | int middle ; int t ; t = last - first ; middle = first + t / 2 ; if ( t <= 512 ) { if ( t <= 32 ) { return trMedian3 ( ISAd , first , middle , last - 1 ) ; } else { t >>= 2 ; return trMedian5 ( ISAd , first , first + t , middle , last - 1 - t , last - 1 ) ; } } t >>= 3 ; first = trMedian3 ( ISAd , first , first + t , first + ( t << 1 ) ) ; middle = trMedian3 ( ISAd , middle - t , middle , middle + t ) ; last = trMedian3 ( ISAd , last - 1 - ( t << 1 ) , last - 1 - t , last - 1 ) ; return trMedian3 ( ISAd , first , middle , last ) ; |
public class Matrix4f { /** * / * ( non - Javadoc )
* @ see org . joml . Matrix4fc # scaleAround ( float , float , float , float , org . joml . Matrix4f ) */
public Matrix4f scaleAround ( float factor , float ox , float oy , float oz , Matrix4f dest ) { } } | return scaleAround ( factor , factor , factor , ox , oy , oz , dest ) ; |
public class AmazonEC2Client { /** * Import single or multi - volume disk images or EBS snapshots into an Amazon Machine Image ( AMI ) . For more
* information , see < a
* href = " https : / / docs . aws . amazon . com / vm - import / latest / userguide / vmimport - image - import . html " > Importing a VM as an
* Image Using VM Import / Export < / a > in the < i > VM Import / Export User Guide < / i > .
* @ param importImageRequest
* Contains the parameters for ImportImage .
* @ return Result of the ImportImage operation returned by the service .
* @ sample AmazonEC2 . ImportImage
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ec2-2016-11-15 / ImportImage " target = " _ top " > AWS API
* Documentation < / a > */
@ Override public ImportImageResult importImage ( ImportImageRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeImportImage ( request ) ; |
public class OutputStreamResponseExtractor { public OutputStream extractData ( final ClientHttpResponse response ) throws IOException { } } | IoUtil . copy ( response . getBody ( ) , _output ) ; return _output ; |
public class Period { /** * Returns the duration of this period . If an explicit duration is not
* specified , the duration is derived from the end date .
* @ return the duration of this period in milliseconds . */
public final TemporalAmount getDuration ( ) { } } | if ( duration == null ) { return TemporalAmountAdapter . fromDateRange ( getStart ( ) , getEnd ( ) ) . getDuration ( ) ; } return duration . getDuration ( ) ; |
public class UriBasedVehicleInterfaceMixin { /** * Determine if two URIs refer to the same resource .
* The function safely attempts to convert the otherResource parameter to a
* URI object before comparing .
* @ return true if the address and port match the current in - use values . */
public static boolean sameResource ( URI uri , String otherResource ) { } } | try { return createUri ( otherResource ) . equals ( uri ) ; } catch ( DataSourceException e ) { return false ; } |
public class location { /** * Use this API to delete location of given name . */
public static base_response delete ( nitro_service client , String ipfrom ) throws Exception { } } | location deleteresource = new location ( ) ; deleteresource . ipfrom = ipfrom ; return deleteresource . delete_resource ( client ) ; |
public class ZipUtil { /** * Extracts the specified zip file to the specified location . If { @ code selector } is specified ,
* then only the entry specified by { @ code selector } ( if { @ code selector } is a filename ) or the
* contents of the directory specified by { @ code selector } ( if { @ code selector } is a directory
* name ) will be extracted . If { @ code selector } specifies a directory , then the contents of the
* directory in the zip file will be rooted at { @ code destDir } when extracted .
* @ param zipFile
* the { @ link File } object for the file to unzip
* @ param destDir
* the { @ link File } object for the target directory
* @ param selector
* The name of a file or directory to extract
* @ throws IOException */
public static void unzip ( File zipFile , File destDir , String selector ) throws IOException { } } | final String sourceMethod = "unzip" ; // $ NON - NLS - 1 $
final boolean isTraceLogging = log . isLoggable ( Level . FINER ) ; if ( isTraceLogging ) { log . entering ( sourceClass , sourceMethod , new Object [ ] { zipFile , destDir } ) ; } boolean selectorIsFolder = selector != null && selector . charAt ( selector . length ( ) - 1 ) == '/' ; ZipInputStream zipIn = new ZipInputStream ( new FileInputStream ( zipFile ) ) ; try { ZipEntry entry = zipIn . getNextEntry ( ) ; // iterates over entries in the zip file
while ( entry != null ) { String entryName = entry . getName ( ) ; if ( selector == null || ! selectorIsFolder && entryName . equals ( selector ) || selectorIsFolder && entryName . startsWith ( selector ) && entryName . length ( ) != selector . length ( ) ) { if ( selector != null ) { if ( selectorIsFolder ) { // selector is a directory . Strip selected path
entryName = entryName . substring ( selector . length ( ) ) ; } else { // selector is a filename . Extract the filename portion of the path
int idx = entryName . lastIndexOf ( "/" ) ; // $ NON - NLS - 1 $
if ( idx != - 1 ) { entryName = entryName . substring ( idx + 1 ) ; } } } File file = new File ( destDir , entryName . replace ( "/" , File . separator ) ) ; // $ NON - NLS - 1 $
if ( ! entry . isDirectory ( ) ) { // if the entry is a file , extract it
extractFile ( entry , zipIn , file ) ; } else { // if the entry is a directory , make the directory
extractDirectory ( entry , file ) ; } zipIn . closeEntry ( ) ; } entry = zipIn . getNextEntry ( ) ; } } finally { zipIn . close ( ) ; } if ( isTraceLogging ) { log . exiting ( sourceClass , sourceMethod ) ; } |
public class HFCAClient { /** * Generate certificate revocation list .
* @ param registrar admin user configured in CA - server
* @ param revokedBefore Restrict certificates returned to revoked before this date if not null .
* @ param revokedAfter Restrict certificates returned to revoked after this date if not null .
* @ param expireBefore Restrict certificates returned to expired before this date if not null .
* @ param expireAfter Restrict certificates returned to expired after this date if not null .
* @ throws InvalidArgumentException */
public String generateCRL ( User registrar , Date revokedBefore , Date revokedAfter , Date expireBefore , Date expireAfter ) throws InvalidArgumentException , GenerateCRLException { } } | if ( cryptoSuite == null ) { throw new InvalidArgumentException ( "Crypto primitives not set." ) ; } if ( registrar == null ) { throw new InvalidArgumentException ( "registrar is not set" ) ; } try { setUpSSL ( ) ; JsonObjectBuilder factory = Json . createObjectBuilder ( ) ; if ( revokedBefore != null ) { factory . add ( "revokedBefore" , Util . dateToString ( revokedBefore ) ) ; } if ( revokedAfter != null ) { factory . add ( "revokedAfter" , Util . dateToString ( revokedAfter ) ) ; } if ( expireBefore != null ) { factory . add ( "expireBefore" , Util . dateToString ( expireBefore ) ) ; } if ( expireAfter != null ) { factory . add ( "expireAfter" , Util . dateToString ( expireAfter ) ) ; } if ( caName != null ) { factory . add ( HFCAClient . FABRIC_CA_REQPROP , caName ) ; } JsonObject jsonObject = factory . build ( ) ; StringWriter stringWriter = new StringWriter ( ) ; JsonWriter jsonWriter = Json . createWriter ( new PrintWriter ( stringWriter ) ) ; jsonWriter . writeObject ( jsonObject ) ; jsonWriter . close ( ) ; String body = stringWriter . toString ( ) ; // send revoke request
JsonObject ret = httpPost ( url + HFCA_GENCRL , body , registrar ) ; return ret . getString ( "CRL" ) ; } catch ( Exception e ) { logger . error ( e . getMessage ( ) , e ) ; throw new GenerateCRLException ( e . getMessage ( ) , e ) ; } |
public class Months { /** * Returns a new instance with the specified number of months added .
* This instance is immutable and unaffected by this method call .
* @ param months the amount of months to add , may be negative
* @ return the new period plus the specified number of months
* @ throws ArithmeticException if the result overflows an int */
public Months plus ( int months ) { } } | if ( months == 0 ) { return this ; } return Months . months ( FieldUtils . safeAdd ( getValue ( ) , months ) ) ; |
public class MapCache { /** * Initialize and start watching the cache . */
@ Override public void start ( boolean block ) throws InterruptedException , ExecutionException { } } | Future < ? > task = m_es . submit ( new ParentEvent ( null ) ) ; if ( block ) { task . get ( ) ; } |
public class SwaptionAnalyticApproximation { /** * This function calculate the partial derivative < i > d log ( S ) / d log ( L < sub > k < / sub > ) < / i > for
* a given swap rate with respect to a vector of forward rates ( on a given forward rate tenor ) .
* It also returns some useful other quantities like the corresponding discout factors and swap annuities .
* @ param liborPeriodDiscretization The libor period discretization .
* @ param discountCurveInterface The discount curve . If this parameter is null , the discount curve will be calculated from the forward curve .
* @ param forwardCurveInterface The forward curve .
* @ return A map containing the partial derivatives ( key " value " ) , the discount factors ( key " discountFactors " ) and the annuities ( key " annuities " ) as vectors of double [ ] ( indexed by forward rate tenor index starting at swap start ) */
public Map < String , double [ ] > getLogSwaprateDerivative ( TimeDiscretizationInterface liborPeriodDiscretization , DiscountCurveInterface discountCurveInterface , ForwardCurveInterface forwardCurveInterface ) { } } | /* * We cache the calculation of the log swaprate derivative . In a calibration this method might be called quite often with the same arguments . */
synchronized ( cachedLogSwaprateDerivativeLock ) { if ( cachedLogSwaprateDerivative != null && liborPeriodDiscretization == cachedLogSwaprateDerivativeTimeDiscretization . get ( ) && discountCurveInterface == cachedLogSwaprateDerivativeDiscountCurve . get ( ) && forwardCurveInterface == cachedLogSwaprateDerivativeForwardCurve . get ( ) ) { return cachedLogSwaprateDerivative ; } cachedLogSwaprateDerivativeTimeDiscretization = new WeakReference < TimeDiscretizationInterface > ( liborPeriodDiscretization ) ; cachedLogSwaprateDerivativeDiscountCurve = new WeakReference < DiscountCurveInterface > ( discountCurveInterface ) ; cachedLogSwaprateDerivativeForwardCurve = new WeakReference < ForwardCurveInterface > ( forwardCurveInterface ) ; /* * Small workaround for the case that the discount curve is not set . This part will be removed later . */
AnalyticModel model = null ; if ( discountCurveInterface == null ) { discountCurveInterface = new DiscountCurveFromForwardCurve ( forwardCurveInterface . getName ( ) ) ; model = new AnalyticModel ( new CurveInterface [ ] { forwardCurveInterface , discountCurveInterface } ) ; } double swapStart = swapTenor [ 0 ] ; double swapEnd = swapTenor [ swapTenor . length - 1 ] ; // Get the indices of the swap start and end on the forward rate tenor
int swapStartIndex = liborPeriodDiscretization . getTimeIndex ( swapStart ) ; int swapEndIndex = liborPeriodDiscretization . getTimeIndex ( swapEnd ) ; // Precalculate forward rates and discount factors . Note : the swap contains swapEndIndex - swapStartIndex forward rates
double [ ] forwardRates = new double [ swapEndIndex - swapStartIndex + 1 ] ; double [ ] discountFactors = new double [ swapEndIndex - swapStartIndex + 1 ] ; // Calculate discount factor at swap start
discountFactors [ 0 ] = discountCurveInterface . getDiscountFactor ( model , swapStart ) ; // Calculate discount factors for swap period ends ( used for swap annuity )
for ( int liborPeriodIndex = swapStartIndex ; liborPeriodIndex < swapEndIndex ; liborPeriodIndex ++ ) { double libor = forwardCurveInterface . getForward ( null , liborPeriodDiscretization . getTime ( liborPeriodIndex ) ) ; forwardRates [ liborPeriodIndex - swapStartIndex ] = libor ; discountFactors [ liborPeriodIndex - swapStartIndex + 1 ] = discountCurveInterface . getDiscountFactor ( model , liborPeriodDiscretization . getTime ( liborPeriodIndex + 1 ) ) ; } // Precalculate swap annuities
double [ ] swapAnnuities = new double [ swapTenor . length - 1 ] ; double swapAnnuity = 0.0 ; for ( int swapPeriodIndex = swapTenor . length - 2 ; swapPeriodIndex >= 0 ; swapPeriodIndex -- ) { int periodEndIndex = liborPeriodDiscretization . getTimeIndex ( swapTenor [ swapPeriodIndex + 1 ] ) ; swapAnnuity += discountFactors [ periodEndIndex - swapStartIndex ] * ( swapTenor [ swapPeriodIndex + 1 ] - swapTenor [ swapPeriodIndex ] ) ; swapAnnuities [ swapPeriodIndex ] = swapAnnuity ; } // Precalculate weights : The formula is take from ISBN 0470047224
double [ ] swapCovarianceWeights = new double [ swapEndIndex - swapStartIndex ] ; double valueFloatLeg = 0.0 ; for ( int liborPeriodIndex = swapStartIndex ; liborPeriodIndex < swapEndIndex ; liborPeriodIndex ++ ) { double liborPeriodLength = liborPeriodDiscretization . getTimeStep ( liborPeriodIndex ) ; valueFloatLeg += forwardRates [ liborPeriodIndex - swapStartIndex ] * discountFactors [ liborPeriodIndex - swapStartIndex + 1 ] * liborPeriodLength ; } int swapPeriodIndex = 0 ; double valueFloatLegUpToSwapStart = 0.0 ; for ( int liborPeriodIndex = swapStartIndex ; liborPeriodIndex < swapEndIndex ; liborPeriodIndex ++ ) { if ( liborPeriodDiscretization . getTime ( liborPeriodIndex ) >= swapTenor [ swapPeriodIndex + 1 ] ) { swapPeriodIndex ++ ; } double libor = forwardRates [ liborPeriodIndex - swapStartIndex ] ; double liborPeriodLength = liborPeriodDiscretization . getTimeStep ( liborPeriodIndex ) ; valueFloatLegUpToSwapStart += forwardRates [ liborPeriodIndex - swapStartIndex ] * discountFactors [ liborPeriodIndex - swapStartIndex + 1 ] * liborPeriodLength ; double discountFactorAtPeriodEnd = discountCurveInterface . getDiscountFactor ( model , liborPeriodDiscretization . getTime ( liborPeriodIndex + 1 ) ) ; double derivativeFloatLeg = ( discountFactorAtPeriodEnd + valueFloatLegUpToSwapStart - valueFloatLeg ) * liborPeriodLength / ( 1.0 + libor * liborPeriodLength ) / valueFloatLeg ; double derivativeFixLeg = - swapAnnuities [ swapPeriodIndex ] / swapAnnuity * liborPeriodLength / ( 1.0 + libor * liborPeriodLength ) ; swapCovarianceWeights [ liborPeriodIndex - swapStartIndex ] = ( derivativeFloatLeg - derivativeFixLeg ) * libor ; } // Return results
Map < String , double [ ] > results = new HashMap < String , double [ ] > ( ) ; results . put ( "values" , swapCovarianceWeights ) ; results . put ( "discountFactors" , discountFactors ) ; results . put ( "swapAnnuities" , swapAnnuities ) ; cachedLogSwaprateDerivative = results ; return results ; } |
public class FctBnCnvBnFromRs { /** * < p > Get CnvBnRsToLong ( create and put into map ) . < / p >
* @ return requested CnvBnRsToLong
* @ throws Exception - an exception */
protected final CnvBnRsToLong < RS > createPutCnvBnRsToLong ( ) throws Exception { } } | CnvBnRsToLong < RS > convrt = new CnvBnRsToLong < RS > ( ) ; // assigning fully initialized object :
this . convertersMap . put ( CnvBnRsToLong . class . getSimpleName ( ) , convrt ) ; return convrt ; |
public class RelationalOperations { /** * Returns true if the segments of multipathA intersects env _ b */
private static boolean linearPathIntersectsEnvelope_ ( MultiPath multipath_a , Envelope2D env_b , double tolerance , ProgressTracker progress_tracker ) { } } | if ( ! multipath_a . hasNonLinearSegments ( ) ) { Envelope2D env_b_inflated = new Envelope2D ( ) ; env_b_inflated . setCoords ( env_b ) ; env_b_inflated . inflate ( tolerance , tolerance ) ; MultiPathImpl mimpl_a = ( MultiPathImpl ) multipath_a . _getImpl ( ) ; AttributeStreamOfDbl xy = ( AttributeStreamOfDbl ) ( mimpl_a . getAttributeStreamRef ( VertexDescription . Semantics . POSITION ) ) ; Point2D pt = new Point2D ( ) ; Point2D pt_prev = new Point2D ( ) ; Point2D pt_1 = new Point2D ( ) ; Point2D pt_2 = new Point2D ( ) ; for ( int ipath = 0 , npath = mimpl_a . getPathCount ( ) ; ipath < npath ; ipath ++ ) { boolean b_first = true ; for ( int i = mimpl_a . getPathStart ( ipath ) , n = mimpl_a . getPathEnd ( ipath ) ; i < n ; i ++ ) { if ( b_first ) { xy . read ( 2 * i , pt_prev ) ; b_first = false ; continue ; } xy . read ( 2 * i , pt ) ; pt_1 . setCoords ( pt_prev ) ; pt_2 . setCoords ( pt ) ; if ( env_b_inflated . clipLine ( pt_1 , pt_2 ) != 0 ) return true ; pt_prev . setCoords ( pt ) ; } } } else { Line line_1 = new Line ( env_b . xmin , env_b . ymin , env_b . xmin , env_b . ymax ) ; Line line_2 = new Line ( env_b . xmin , env_b . ymax , env_b . xmax , env_b . ymax ) ; Line line3 = new Line ( env_b . xmax , env_b . ymax , env_b . xmax , env_b . ymin ) ; Line line4 = new Line ( env_b . xmax , env_b . ymin , env_b . xmin , env_b . ymin ) ; SegmentIterator iter = multipath_a . querySegmentIterator ( ) ; while ( iter . nextPath ( ) ) { while ( iter . hasNextSegment ( ) ) { Segment polySeg = iter . nextSegment ( ) ; if ( polySeg . isIntersecting ( line_1 , tolerance ) ) return true ; if ( polySeg . isIntersecting ( line_2 , tolerance ) ) return true ; if ( polySeg . isIntersecting ( line3 , tolerance ) ) return true ; if ( polySeg . isIntersecting ( line4 , tolerance ) ) return true ; } } } return false ; |
public class JavaScriptScanner { /** * Read general text content of an inline tag , including HTML entities and elements .
* Matching pairs of { } are skipped ; the text is terminated by the first
* unmatched } . It is an error if the beginning of the next tag is detected . */
@ SuppressWarnings ( "fallthrough" ) private void inlineContent ( ) { } } | skipWhitespace ( ) ; int pos = bp ; int depth = 1 ; loop : while ( bp < buflen ) { switch ( ch ) { case '\n' : case '\r' : case '\f' : newline = true ; // fall through
case ' ' : case '\t' : nextChar ( ) ; break ; case '&' : entity ( null ) ; break ; case '<' : newline = false ; html ( ) ; break ; case '{' : newline = false ; depth ++ ; nextChar ( ) ; break ; case '}' : newline = false ; if ( -- depth == 0 ) { nextChar ( ) ; return ; } nextChar ( ) ; break ; case '@' : if ( newline ) break loop ; // fallthrough
default : nextChar ( ) ; break ; } } |
public class ApplicationSecurityGroupsInner { /** * Deletes the specified application security group .
* @ param resourceGroupName The name of the resource group .
* @ param applicationSecurityGroupName The name of the application security group .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ throws CloudException thrown if the request is rejected by server
* @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent */
public void beginDelete ( String resourceGroupName , String applicationSecurityGroupName ) { } } | beginDeleteWithServiceResponseAsync ( resourceGroupName , applicationSecurityGroupName ) . toBlocking ( ) . single ( ) . body ( ) ; |
public class ConnectionFactory { /** * Gets the connection .
* @ return the connection */
Connection getSingleConnection ( ) { } } | Connection connection = null ; try { Class . forName ( driver ) ; connection = DriverManager . getConnection ( url , user , password ) ; } catch ( SQLException e ) { throw new InitializationException ( "Could not initialize the connection" , e ) ; } catch ( ClassNotFoundException e ) { throw new InitializationException ( "Could not find the driver class" , e ) ; } return connection ; |
public class ServersInner { /** * Updates an existing server . The request body can contain one to many of the properties present in the normal server definition .
* @ param resourceGroupName The name of the resource group that contains the resource . You can obtain this value from the Azure Resource Manager API or the portal .
* @ param serverName The name of the server .
* @ param parameters The required parameters for updating a server .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the ServerInner object */
public Observable < ServerInner > beginUpdateAsync ( String resourceGroupName , String serverName , ServerUpdateParameters parameters ) { } } | return beginUpdateWithServiceResponseAsync ( resourceGroupName , serverName , parameters ) . map ( new Func1 < ServiceResponse < ServerInner > , ServerInner > ( ) { @ Override public ServerInner call ( ServiceResponse < ServerInner > response ) { return response . body ( ) ; } } ) ; |
public class FessMessages { /** * Add the created action message for the key ' errors . app . db . already . deleted ' with parameters .
* < pre >
* message : others might be updated , so retry .
* < / pre >
* @ param property The property name for the message . ( NotNull )
* @ return this . ( NotNull ) */
public FessMessages addErrorsAppDbAlreadyDeleted ( String property ) { } } | assertPropertyNotNull ( property ) ; add ( property , new UserMessage ( ERRORS_APP_DB_ALREADY_DELETED ) ) ; return this ; |
public class HtmlTool { /** * Reorders elements in HTML content so that selected elements are found at the top of the
* content . Can be limited to a certain amount , e . g . to bring just the first of selected
* elements to the top .
* @ param content
* HTML content to reorder
* @ param selector
* CSS selector for elements to bring to top of the content
* @ param amount
* Maximum number of elements to reorder
* @ param wrapRemaining
* HTML to wrap the remaining ( non - reordered ) part
* @ return HTML content with reordered elements , or the original content if no such elements
* found .
* @ since 1.0 */
public String reorderToTop ( String content , String selector , int amount , String wrapRemaining ) { } } | // extract the elements and then prepend them to the remaining body
List < Element > extracted = extractElements ( content , selector , amount ) ; if ( extracted . size ( ) > 1 ) { Element body = extracted . get ( 0 ) ; if ( wrapRemaining != null ) { wrapInner ( body , wrapRemaining ) ; } List < Element > elements = extracted . subList ( 1 , extracted . size ( ) ) ; // now prepend extracted elements to the body ( in backwards to preserve original order )
for ( int index = elements . size ( ) - 1 ; index >= 0 ; index -- ) { body . prependChild ( elements . get ( index ) ) ; } return body . html ( ) ; } else { // nothing to reorder
return content ; } |
public class KeyStoreManager { /** * This method returns the mapped certificate for a hostname , or generates a " standard "
* SSL server certificate issued by the CA to the supplied subject if no mapping has been
* created . This is not a true duplication , just a shortcut method
* that is adequate for web browsers .
* @ param hostname
* @ return
* @ throws CertificateParsingException
* @ throws InvalidKeyException
* @ throws CertificateExpiredException
* @ throws CertificateNotYetValidException
* @ throws SignatureException
* @ throws CertificateException
* @ throws NoSuchAlgorithmException
* @ throws NoSuchProviderException
* @ throws KeyStoreException
* @ throws UnrecoverableKeyException */
public X509Certificate getMappedCertificateForHostname ( String hostname ) throws CertificateParsingException , InvalidKeyException , CertificateExpiredException , CertificateNotYetValidException , SignatureException , CertificateException , NoSuchAlgorithmException , NoSuchProviderException , KeyStoreException , UnrecoverableKeyException { } } | String subject = getSubjectForHostname ( hostname ) ; String thumbprint = _subjectMap . get ( subject ) ; if ( thumbprint == null ) { KeyPair kp = getRSAKeyPair ( ) ; X509Certificate newCert = CertificateCreator . generateStdSSLServerCertificate ( kp . getPublic ( ) , getSigningCert ( ) , getSigningPrivateKey ( ) , subject ) ; addCertAndPrivateKey ( hostname , newCert , kp . getPrivate ( ) ) ; thumbprint = ThumbprintUtil . getThumbprint ( newCert ) ; _subjectMap . put ( subject , thumbprint ) ; if ( persistImmediately ) { persist ( ) ; } return newCert ; } return getCertificateByAlias ( thumbprint ) ; |
public class ToolTip { /** * Add content to the tooltip and show it with the given parameters .
* @ param content a list of Labels
* @ param left the left position of the tooltip
* @ param top the top position of the tooltip */
public void addContentAndShow ( List < Label > content , int left , int top , boolean showCloseButton ) { } } | // Add a closeButton when showCloseButton is true .
if ( showCloseButton ) { Label closeButtonLabel = new Label ( " X " ) ; closeButtonLabel . addStyleName ( ToolTipResource . INSTANCE . css ( ) . toolTipCloseButton ( ) ) ; contentPanel . add ( closeButtonLabel ) ; closeButtonLabel . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent event ) { hide ( ) ; } } ) ; } // Add the content to the panel .
for ( Label l : content ) { l . addStyleName ( ToolTipResource . INSTANCE . css ( ) . toolTipLine ( ) ) ; contentPanel . add ( l ) ; } // Finally set position of the tooltip and show it .
toolTip . setPopupPosition ( left , top ) ; toolTip . show ( ) ; |
public class HOTSAXImplementation { /** * Hash - table backed implementation ( in contrast to trie ) . Time series is converted into a
* SAXRecords data structure first , Hash - table backed magic array created second . HOTSAX applied
* third . Nearest neighbors are searched only among the subsequences which were produced by SAX
* with specified numerosity reduction . Thus , if the strategy is EXACT or MINDIST , discords do not
* match those produced by BruteForce or NONE .
* @ param series The timeseries .
* @ param discordsNumToReport The number of discords to report .
* @ param windowSize SAX sliding window size .
* @ param paaSize SAX PAA value .
* @ param alphabetSize SAX alphabet size .
* @ param strategy the numerosity reduction strategy .
* @ param nThreshold the normalization threshold value .
* @ return The set of discords found within the time series , it may return less than asked for - -
* in this case , there are no more discords .
* @ throws Exception if error occurs . , currentPos + windowSize */
public static DiscordRecords series2Discords ( double [ ] series , int discordsNumToReport , int windowSize , int paaSize , int alphabetSize , NumerosityReductionStrategy strategy , double nThreshold ) throws Exception { } } | // fix the start time
Date start = new Date ( ) ; // get the SAX transform done
NormalAlphabet normalA = new NormalAlphabet ( ) ; SAXRecords sax = sp . ts2saxViaWindow ( series , windowSize , paaSize , normalA . getCuts ( alphabetSize ) , strategy , nThreshold ) ; Date saxEnd = new Date ( ) ; LOGGER . debug ( "discretized in {}, words: {}, indexes: {}" , SAXProcessor . timeToString ( start . getTime ( ) , saxEnd . getTime ( ) ) , sax . getRecords ( ) . size ( ) , sax . getIndexes ( ) . size ( ) ) ; // fill the array for the outer loop
ArrayList < MagicArrayEntry > magicArray = new ArrayList < MagicArrayEntry > ( sax . getRecords ( ) . size ( ) ) ; for ( SAXRecord sr : sax . getRecords ( ) ) { magicArray . add ( new MagicArrayEntry ( String . valueOf ( sr . getPayload ( ) ) , sr . getIndexes ( ) . size ( ) ) ) ; } Date hashEnd = new Date ( ) ; LOGGER . debug ( "Magic array filled in : {}" , SAXProcessor . timeToString ( saxEnd . getTime ( ) , hashEnd . getTime ( ) ) ) ; DiscordRecords discords = getDiscordsWithMagic ( series , sax , windowSize , magicArray , discordsNumToReport , nThreshold ) ; Date end = new Date ( ) ; LOGGER . debug ( "{} discords found in {}" , discords . getSize ( ) , SAXProcessor . timeToString ( start . getTime ( ) , end . getTime ( ) ) ) ; return discords ; |
public class UriComponentsBuilder { /** * Append the given query parameter to the existing query parameters . The
* given name or any of the values may contain URI template variables . If no
* values are given , the resulting URI will contain the query parameter name
* only ( i . e . { @ code ? foo } instead of { @ code ? foo = bar } .
* @ param name the query parameter name
* @ param values the query parameter values
* @ return this UriComponentsBuilder */
public UriComponentsBuilder queryParam ( String name , Object ... values ) { } } | Assert . notNull ( name , "'name' must not be null" ) ; if ( ! ObjectUtils . isEmpty ( values ) ) { for ( Object value : values ) { String valueAsString = ( value != null ? value . toString ( ) : null ) ; this . queryParams . add ( name , valueAsString ) ; } } else { this . queryParams . add ( name , null ) ; } resetSchemeSpecificPart ( ) ; return this ; |
public class StreamUtils { /** * Cycles through a set of items indefinitely .
* @ param items The items to cycle through .
* @ param < T > The type of the items .
* @ return An infinite stream cycling through the supplied items . */
public static < T > Stream < T > cycle ( T ... items ) { } } | return IntStream . iterate ( 0 , i -> i == items . length - 1 ? 0 : i + 1 ) . mapToObj ( i -> items [ i ] ) ; |
public class GroovyMBean { /** * The values of each of the attributes on the MBean
* @ return list of values of each attribute */
public List < String > listAttributeValues ( ) { } } | List < String > list = new ArrayList < String > ( ) ; Collection < String > names = listAttributeNames ( ) ; for ( String name : names ) { try { Object val = this . getProperty ( name ) ; if ( val != null ) { list . add ( name + " : " + val . toString ( ) ) ; } } catch ( Exception e ) { throwException ( "Could not list attribute values. Reason: " , e ) ; } } return list ; |
public class AbsComparator { /** * Factory method to implement the comparator .
* @ param paramRtx
* rtx for accessing data
* @ param paramOperandOne
* operand one to be compared
* @ param paramOperandTwo
* operand two to be compared
* @ param paramKind
* kind of comparison
* @ param paramVal
* string value to estimate
* @ return AbsComparator the comparator of two axis */
public static final AbsComparator getComparator ( final INodeReadTrx paramRtx , final AbsAxis paramOperandOne , final AbsAxis paramOperandTwo , final CompKind paramKind , final String paramVal ) { } } | if ( "eq" . equals ( paramVal ) || "lt" . equals ( paramVal ) || "le" . equals ( paramVal ) || "gt" . equals ( paramVal ) || "ge" . equals ( paramVal ) ) { return new ValueComp ( paramRtx , paramOperandOne , paramOperandTwo , paramKind ) ; } else if ( "=" . equals ( paramVal ) || "!=" . equals ( paramVal ) || "<" . equals ( paramVal ) || "<=" . equals ( paramVal ) || ">" . equals ( paramVal ) || ">=" . equals ( paramVal ) ) { return new GeneralComp ( paramRtx , paramOperandOne , paramOperandTwo , paramKind ) ; } else if ( "is" . equals ( paramVal ) || "<<" . equals ( paramVal ) || ">>" . equals ( paramVal ) ) { return new NodeComp ( paramRtx , paramOperandOne , paramOperandTwo , paramKind ) ; } throw new IllegalStateException ( paramVal + " is not a valid comparison." ) ; |
public class Collections { /** * Checks whether any of an array ' s elements are also in the provided set .
* @ param aSet a { @ link Set } .
* @ param arr an array .
* @ return < code > true < / code > or < code > false < / code > . */
public static < K > boolean containsAny ( Set < K > aSet , K [ ] arr ) { } } | for ( K obj : arr ) { if ( aSet . contains ( obj ) ) { return true ; } } return false ; |
public class LinkAttributeUpdateMarshaller { /** * Marshall the given parameter object . */
public void marshall ( LinkAttributeUpdate linkAttributeUpdate , ProtocolMarshaller protocolMarshaller ) { } } | if ( linkAttributeUpdate == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( linkAttributeUpdate . getAttributeKey ( ) , ATTRIBUTEKEY_BINDING ) ; protocolMarshaller . marshall ( linkAttributeUpdate . getAttributeAction ( ) , ATTRIBUTEACTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; } |
public class ResolutionIterator { /** * check whether answers available , if answers not fully computed compute more answers
* @ return true if answers available */
@ Override public boolean hasNext ( ) { } } | nextAnswer = findNextAnswer ( ) ; if ( nextAnswer != null ) return true ; // iter finished
if ( reiterationRequired ) { long dAns = answers . size ( ) - oldAns ; if ( dAns != 0 || iter == 0 ) { LOG . debug ( "iter: {} answers: {} dAns = {}" , iter , answers . size ( ) , dAns ) ; iter ++ ; states . push ( query . subGoal ( new ConceptMap ( ) , new UnifierImpl ( ) , null , new HashSet < > ( ) ) ) ; oldAns = answers . size ( ) ; return hasNext ( ) ; } } toComplete . forEach ( query . tx ( ) . queryCache ( ) :: ackCompleteness ) ; return false ; |
public class ClusterHeartbeatManager { /** * Send heartbeats and calculate clock drift . This method is expected to be called periodically because it calculates
* the clock drift based on the expected and actual invocation period . */
void heartbeat ( ) { } } | if ( ! clusterService . isJoined ( ) ) { return ; } checkClockDrift ( heartbeatIntervalMillis ) ; final long clusterTime = clusterClock . getClusterTime ( ) ; if ( clusterService . isMaster ( ) ) { heartbeatWhenMaster ( clusterTime ) ; } else { heartbeatWhenSlave ( clusterTime ) ; } |
public class JDateChooser { /** * Listens for a " date " property change or a " day " property change event
* from the JCalendar . Updates the date editor and closes the popup .
* @ param evt
* the event */
public void propertyChange ( PropertyChangeEvent evt ) { } } | if ( evt . getPropertyName ( ) . equals ( "day" ) ) { if ( popup . isVisible ( ) && jcalendar . getCalendar ( ) . get ( Calendar . MONTH ) == jcalendar . monthChooser . getMonth ( ) ) { dateSelected = true ; popup . setVisible ( false ) ; setDate ( jcalendar . getCalendar ( ) . getTime ( ) ) ; } } else if ( evt . getPropertyName ( ) . equals ( "date" ) ) { if ( evt . getSource ( ) == dateEditor ) { firePropertyChange ( "date" , evt . getOldValue ( ) , evt . getNewValue ( ) ) ; } else { setDate ( ( Date ) evt . getNewValue ( ) ) ; } } |
public class InkView { /** * Returns the bitmap of the drawing with the specified background color
* @ param backgroundColor The background color for the bitmap
* @ return The bitmap */
public Bitmap getBitmap ( int backgroundColor ) { } } | // create new bitmap
Bitmap bitmap = Bitmap . createBitmap ( getWidth ( ) , getHeight ( ) , Bitmap . Config . ARGB_8888 ) ; Canvas bitmapCanvas = new Canvas ( bitmap ) ; // draw background if not transparent
if ( backgroundColor != 0 ) { bitmapCanvas . drawColor ( backgroundColor ) ; } // draw bitmap
bitmapCanvas . drawBitmap ( this . bitmap , 0 , 0 , null ) ; return bitmap ; |
public class RecountOnValidHandler { /** * Constructor .
* @ param record My owner ( usually passed as null , and set on addListener in setOwner ( ) ) .
* @ param recordSub The sub - record . */
public void init ( Record record , Record recordSub , boolean bRestoreCurrentRecord ) { } } | m_recordSub = recordSub ; m_bRestoreCurrentRecord = bRestoreCurrentRecord ; super . init ( record ) ; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.