idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
9,500
public static < T extends Sorter > T createSorterElseDefault ( final SortType type , final T defaultSorter ) { try { return createSorter ( type ) ; } catch ( IllegalArgumentException ignore ) { return defaultSorter ; } }
Creates an instance of the Sorter interface implementing the sorting algorithm based on the SortType otherwise returns the provided default Sorter implementation if a Sorter based on the specified SortType is not available .
54
40
9,501
@ Override public void start ( ) { super . start ( ) ; // If disabled we do not create a publisher to graphite but error counts are still collected. if ( enabled ) { metricPublishing . start ( new GraphiteConfigImpl ( host , port , pollintervalseconds , queuesize , sendasrate ) ) ; } this . startUpMetric = factory . createStartUpMetric ( metricObjects , subsystem , new Timer ( ) ) ; startUpMetric . start ( ) ; }
Starts the appender by starting a background thread to poll the error counters and publish them to Graphite . Multiple instances of this EmitToGraphiteLogbackAppender will only start one background thread . This method also starts the heartbeat metric background thread .
108
52
9,502
@ Override public void stop ( ) { if ( enabled ) { metricPublishing . stop ( ) ; } if ( startUpMetric != null ) { startUpMetric . stop ( ) ; } super . stop ( ) ; }
Stops the appender shutting down the background polling thread to ensure that the connection to the metrics database is closed . This method also stops the heartbeat method background thread .
50
33
9,503
protected String getFieldName ( String propertyName ) { return ObjectUtils . defaultIfNull ( propertyNameToFieldNameMapping . get ( propertyName ) , propertyName ) ; }
Gets the name of the field mapped to the given property . If no such mapping exists then the given property name is returned .
39
26
9,504
@ SuppressWarnings ( "unchecked" ) public void setModifiedBy ( USER modifiedBy ) { processChange ( "modifiedBy" , this . modifiedBy , modifiedBy ) ; this . lastModifiedBy = ObjectUtils . defaultIfNull ( this . lastModifiedBy , this . modifiedBy ) ; }
Sets the user who is responsible for modifying this object .
71
12
9,505
void changeState ( String propertyName , Object newValue ) { try { ObjectUtils . setField ( this , getFieldName ( propertyName ) , newValue ) ; } catch ( IllegalArgumentException e ) { throw new PropertyNotFoundException ( String . format ( "The property (%1$s) corresponding to field (%2$s) was not found in this Bean (%3$s)!" , propertyName , getFieldName ( propertyName ) , getClass ( ) . getName ( ) ) , e ) ; } }
Changes the value of the given property referenced by name to the new Object value effectively modifying the internal state of this Bean . This method uses the Java reflective APIs to set the field corresponding to the specified property .
113
41
9,506
@ SuppressWarnings ( "all" ) public int compareTo ( Bean < ID , USER , PROCESS > obj ) { Assert . isInstanceOf ( obj , getClass ( ) , new ClassCastException ( String . format ( "The Bean being compared with this Bean must be an instance of %1$s!" , getClass ( ) . getName ( ) ) ) ) ; return ComparatorUtils . compareIgnoreNull ( getId ( ) , obj . getId ( ) ) ; }
Compares the specified Bean with this Bean to determine order . The default implementation is to order by identifier where null identifiers are ordered before non - null identifiers .
109
31
9,507
protected PropertyChangeEvent newPropertyChangeEvent ( String propertyName , Object oldValue , Object newValue ) { if ( isEventDispatchEnabled ( ) ) { if ( vetoableChangeSupport . hasListeners ( propertyName ) || propertyChangeSupport . hasListeners ( propertyName ) ) { return new PropertyChangeEvent ( this , propertyName , oldValue , newValue ) ; } } return this . propertyChangeEvent ; }
Creates a new instance of the PropertyChangeEvent initialized with this Bean as the source as well as the name of the property that is changing along with the property s old and new values . A PropertyChangeEvent will be created only if event dispatching to registered listeners is enabled and there are either PropertyChangeListeners or VetoableChangeListeners registered on this Bean .
88
75
9,508
protected void firePropertyChange ( PropertyChangeEvent event ) { if ( isEventDispatchEnabled ( ) ) { Assert . notNull ( event , "The PropertyChangeEvent cannot be null!" ) ; if ( propertyChangeSupport . hasListeners ( event . getPropertyName ( ) ) ) { propertyChangeSupport . firePropertyChange ( event ) ; } } }
Notifies all PropertyChangeListeners of a property change event occurring on this Bean .
75
17
9,509
protected void fireVetoableChange ( PropertyChangeEvent event ) throws PropertyVetoException { if ( isEventDispatchEnabled ( ) ) { Assert . notNull ( event , "The PropertyChangeEvent cannot be null!" ) ; if ( vetoableChangeSupport . hasListeners ( event . getPropertyName ( ) ) ) { vetoableChangeSupport . fireVetoableChange ( event ) ; } } }
Notifies all VetoableChangeListeners of a property change event occurring on this Bean . The change to the property may potentially be vetoed by one of the VetoableChangeListeners listening to property changes on this Bean resulting in preventing the value of the property to change .
86
56
9,510
protected boolean mapPropertyNameToFieldName ( final String propertyName , final String fieldName ) { // TODO add possible validation for the property name and field name of this Bean class. propertyNameToFieldNameMapping . put ( propertyName , fieldName ) ; return propertyNameToFieldNameMapping . containsKey ( propertyName ) ; }
Creates a mapping from the specified property on this Bean class to one of the Bean object s fields .
72
21
9,511
protected boolean mapPropertyNameToParameterizedStateChangeCallback ( String propertyName , ParameterizedStateChangeCallback callback ) { propertyNameToParameterizedStateChangeCallbackMapping . put ( propertyName , callback ) ; return propertyNameToParameterizedStateChangeCallbackMapping . containsKey ( propertyName ) ; }
Creates a mapping from the specified property on this Bean to the specified ParameterizedStateChangeCallback for affecting state transitions and changes .
64
27
9,512
public static snmp_manager [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { snmp_manager obj = new snmp_manager ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; snmp_manager [ ] response = ( snmp_manager [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of snmp_manager resources . set the filter parameter values in filtervalue object .
90
24
9,513
public static long count ( nitro_service service ) throws Exception { sms_server obj = new sms_server ( ) ; options option = new options ( ) ; option . set_count ( true ) ; sms_server [ ] response = ( sms_server [ ] ) obj . get_resources ( service , option ) ; if ( response != null && response . length > 0 ) return response [ 0 ] . __count ; return 0 ; }
Use this API to count the sms_server resources configured on NetScaler SDX .
97
19
9,514
public void set_filter ( filtervalue [ ] filter ) { String str = null ; for ( int i = 0 ; i < filter . length ; i ++ ) { if ( str != null ) str = str + "," ; if ( str == null ) str = filter [ i ] . get_name ( ) + ":" + nitro_util . encode ( filter [ i ] . get_value ( ) ) ; else str = str + filter [ i ] . get_name ( ) + ":" + nitro_util . encode ( filter [ i ] . get_value ( ) ) ; ; } this . filter = str ; }
sets filter field .
136
4
9,515
public static task_device_log get ( nitro_service client , task_device_log resource ) throws Exception { resource . validate ( "get" ) ; return ( ( task_device_log [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get task log for each device .
59
11
9,516
public static < T > T withFields ( Class < T > clazz , Object ... keysAndValues ) { return Mockito . mock ( clazz , new FakerAnswer ( keysAndValues ) ) ; }
Create a mock object with given field values .
45
9
9,517
public Collection < String > getAllProperties ( ) { return wrappedSubmit ( new Callable < Collection < String > > ( ) { @ Override public Collection < String > call ( ) throws Exception { Collection < String > allProperties = new HashSet < String > ( ) ; ObjectMapper mapper = new ObjectMapper ( ) ; List < XmlProperty > xmlproperties = new ArrayList < XmlProperty > ( ) ; try { xmlproperties = mapper . readValue ( service . path ( resourceProperties ) . accept ( MediaType . APPLICATION_JSON ) . get ( String . class ) , new TypeReference < List < XmlProperty > > ( ) { } ) ; } catch ( JsonParseException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( JsonMappingException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( ClientHandlerException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( IOException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } for ( XmlProperty xmlproperty : xmlproperties ) { allProperties . add ( xmlproperty . getName ( ) ) ; } return allProperties ; } } ) ; }
Get a list of names of all the properties currently present on the channelfinder service .
293
17
9,518
public Collection < String > getAllTags ( ) { return wrappedSubmit ( new Callable < Collection < String > > ( ) { @ Override public Collection < String > call ( ) throws Exception { Collection < String > allTags = new HashSet < String > ( ) ; ObjectMapper mapper = new ObjectMapper ( ) ; List < XmlTag > xmltags = new ArrayList < XmlTag > ( ) ; try { xmltags = mapper . readValue ( service . path ( resourceTags ) . accept ( MediaType . APPLICATION_JSON ) . get ( String . class ) , new TypeReference < List < XmlTag > > ( ) { } ) ; } catch ( JsonParseException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( JsonMappingException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( ClientHandlerException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } catch ( IOException e ) { // TODO Auto-generated catch block e . printStackTrace ( ) ; } for ( XmlTag xmltag : xmltags ) { allTags . add ( xmltag . getName ( ) ) ; } return allTags ; } } ) ; }
Get a list of names of all the tags currently present on the channelfinder service .
298
17
9,519
public void set ( Collection < Builder > channels ) throws ChannelFinderException { wrappedSubmit ( new SetChannels ( ChannelUtil . toCollectionXmlChannels ( channels ) ) ) ; }
Destructively set a set of channels if any channels already exists it is replaced .
41
17
9,520
@ SuppressWarnings ( "all" ) @ NullSafe public static boolean and ( Boolean ... values ) { boolean result = ( values != null ) ; // innocent until proven guilty if ( result ) { for ( Boolean value : values ) { result &= valueOf ( value ) ; if ( ! result ) { // short-circuit if we find a false value break ; } } } return result ; }
Performs a logical AND on all the Boolean values and returns true if an only if all Boolean values evaluate to true as determined by the BooleanUtils . valueOf method on the Boolean wrapper object . If the Boolean array is null then the result of the AND operation is false .
86
56
9,521
@ SuppressWarnings ( "all" ) @ NullSafe public static boolean or ( Boolean ... values ) { boolean result = false ; // guilty until proven innocent for ( Boolean value : nullSafeArray ( values , Boolean . class ) ) { result |= valueOf ( value ) ; if ( result ) { // short-circuit if we find a true value break ; } } return result ; }
Performs a logical OR on all the Boolean values and returns true if just one Boolean value evaluates to true as determined by the BooleanUtils . valueOf method on the Boolean wrapper object . If the Boolean array is null the result of the OR operation is false .
84
53
9,522
@ NullSafe public static boolean xor ( Boolean ... values ) { boolean result = false ; // guilty until proven innocent. for ( Boolean value : nullSafeArray ( values , Boolean . class ) ) { boolean primitiveValue = valueOf ( value ) ; if ( result && primitiveValue ) { return false ; // short-circuit if we find more than 1 true value } result |= primitiveValue ; } return result ; }
Performs a logical exclusive OR on the array of Boolean values and returns true if and only if the Boolean array is not null and 1 and only 1 Boolean wrapper object evaluates to true as determined by the BooleanUtils . valueof method .
88
48
9,523
public static < V > StrategicBlockingQueue < V > newStrategicLinkedBlockingQueue ( QueueingStrategy < V > queueingStrategy ) { return new StrategicBlockingQueue < V > ( new LinkedBlockingQueue < V > ( ) , queueingStrategy ) ; }
Return a StrategicBlockingQueue backed by a LinkedBlockingQueue using the given QueueingStrategy .
64
23
9,524
public static < V > StrategicBlockingQueue < V > newStrategicArrayBlockingQueue ( int capacity , QueueingStrategy < V > queueingStrategy ) { return new StrategicBlockingQueue < V > ( new ArrayBlockingQueue < V > ( capacity ) , queueingStrategy ) ; }
Return a StrategicBlockingQueue backed by an ArrayBlockingQueue of the given capacity using the given QueueingStrategy .
66
26
9,525
public static < V > StrategicBlockingQueue < V > newStrategicBlockingQueue ( BlockingQueue < V > blockingQueue , QueueingStrategy < V > queueingStrategy ) { return new StrategicBlockingQueue < V > ( blockingQueue , queueingStrategy ) ; }
Return a StrategicBlockingQueue backed by the given BlockingQueue using the given QueueingStrategy .
62
22
9,526
public void show ( ) { if ( isVisible ( ) ) { return ; } resetToInitialState ( ) ; setVisible ( true ) ; final Timeline phaseOne = new Timeline ( ) ; phaseOne . getKeyFrames ( ) . addAll ( new KeyFrame ( Duration . ZERO , new KeyValue ( transformRadius , fromRadius ) , new KeyValue ( transformOpacity , 0 ) ) , new KeyFrame ( new Duration ( 120 ) , new KeyValue ( transformRadius , parentSection . getNominalRadius ( ) ) , new KeyValue ( transformOpacity , 1 ) ) ) ; final Timeline phaseTwo = new Timeline ( ) ; phaseTwo . getKeyFrames ( ) . addAll ( new KeyFrame ( Duration . ZERO , new KeyValue ( transformAngle , parentSection . getAngularAxisDeg ( ) ) ) , new KeyFrame ( new Duration ( 80 ) , new KeyValue ( transformAngle , angle ) ) ) ; phaseOne . setOnFinished ( event -> phaseTwo . play ( ) ) ; phaseTwo . setOnFinished ( event -> setMouseTransparent ( false ) ) ; phaseOne . play ( ) ; }
Trainsit the button to Visible state .
254
10
9,527
public static void setupMenuButton ( ButtonBase button , RadialMenuParams params , Node graphic , String tooltip , boolean addStyle ) { button . minWidthProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; button . minHeightProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; button . prefWidthProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; button . prefHeightProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; button . maxWidthProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; button . maxHeightProperty ( ) . bind ( params . buttonSizeProperty ( ) ) ; if ( addStyle ) { button . getStylesheets ( ) . addAll ( params . getStyleSheets ( ) ) ; } button . setId ( params . getStyleId ( ) ) ; button . getStyleClass ( ) . addAll ( params . getStyleClasses ( ) ) ; button . setGraphic ( graphic ) ; button . setTooltip ( new Tooltip ( tooltip ) ) ; }
Setup the round button .
232
5
9,528
public static < T > @ NonNull CompletableFuture < T > immediateFailedFuture ( final @ NonNull Throwable ex ) { final CompletableFuture < T > future = new CompletableFuture <> ( ) ; future . completeExceptionally ( ex ) ; return future ; }
Returns a completable future that is exceptionally completed with the provided exception .
62
14
9,529
public static ping get ( nitro_service client , ping resource ) throws Exception { resource . validate ( "get" ) ; return ( ( ping [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get the status of ping on a given device .
47
14
9,530
public static inventory get ( nitro_service client , inventory resource ) throws Exception { resource . validate ( "get" ) ; return ( ( inventory [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to start inventory of a given device . All devices if device IP Address is not specified ..
47
21
9,531
public static inventory [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { inventory obj = new inventory ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; inventory [ ] response = ( inventory [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of inventory resources . set the filter parameter values in filtervalue object .
75
21
9,532
public final void setId ( final ID id ) { Assert . notNull ( id , "The identifier for Rule ({0}) cannot be null!" , getClass ( ) . getName ( ) ) ; this . id = id ; }
Sets the identifier for this Rule .
50
8
9,533
public static void scan ( String source , OutputStream os ) throws IOException { scanSource ( source , new StringOutputStream ( os ) ) ; }
Iteratively finds all jar files if source is a directory and scans them or if a file scan it . The string values of the resulting records will be written to the specified output stream . Embedded jars are a record on their own .
31
47
9,534
public static ArrayList < VictimsRecord > getRecords ( String source ) throws IOException { ArrayList < VictimsRecord > records = new ArrayList < VictimsRecord > ( ) ; scan ( source , records ) ; return records ; }
Iteratively finds all jar files if source is a directory and scans them or if a file scan it .
48
21
9,535
public static boolean isIdentical ( final String expected , final String actual ) { final Diff diff = createDiffResult ( expected , actual , false ) ; return diff . identical ( ) ; }
This method will compare both XMLs and validate its attribute order .
39
13
9,536
public static boolean isSimilar ( final String expected , final String actual ) { final Diff diff = createDiffResult ( expected , actual , true ) ; return diff . similar ( ) ; }
This method will compare both XMLs and WILL NOT validate its attribute order .
38
15
9,537
@ SuppressWarnings ( "unchecked" ) public < T > @ NonNull Collection < Collection < T > > components ( ) { return ( Collection < Collection < T > > ) this . components ; }
Accesses the strongly connected components .
45
7
9,538
public static mps_doc_image [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { mps_doc_image obj = new mps_doc_image ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; mps_doc_image [ ] response = ( mps_doc_image [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of mps_doc_image resources . set the filter parameter values in filtervalue object .
100
26
9,539
@ SuppressWarnings ( "unchecked" ) protected < T > T configure ( final T object ) { if ( object instanceof Configurable && isConfigurationAvailable ( ) ) { ( ( Configurable ) object ) . configure ( getConfiguration ( ) ) ; } return object ; }
Configures the object with an available Configuration if the object implements Configurable .
60
15
9,540
protected < T > T initialize ( final T object , final Map < ? , ? > parameters ) { if ( object instanceof ParameterizedInitable ) { ( ( ParameterizedInitable ) object ) . init ( parameters ) ; return object ; } else { return initialize ( object , parameters . values ( ) ) ; } }
Initializes the object with the specified Map of named parameters providing the object implements the ParameterizedInitable interface otherwise delegates to the initialize method accepting an array of arguments by passing the values of the Map as the argument array .
69
45
9,541
protected < T > T initialize ( final T object , final Object ... args ) { if ( object instanceof ParameterizedInitable ) { ( ( ParameterizedInitable ) object ) . init ( args ) ; } else if ( object instanceof Initable ) { ( ( Initable ) object ) . init ( ) ; } return object ; }
Initializes the object with the specified array of arguments providing the object implements the ParameterizedInitable interface or calls the no argument init method if the object implements the Initable interface and finally does nothing if the object is not Initable .
73
48
9,542
public static br_device_profile [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { br_device_profile obj = new br_device_profile ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; br_device_profile [ ] response = ( br_device_profile [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of br_device_profile resources . set the filter parameter values in filtervalue object .
95
25
9,543
public static hostcpu get ( nitro_service client , hostcpu resource ) throws Exception { resource . validate ( "get" ) ; return ( ( hostcpu [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get CPU Cores .
50
9
9,544
private static String getPropertyValue ( String key ) { String env = System . getProperty ( key ) ; if ( env == null ) { if ( DEFAULT_PROPS . containsKey ( key ) ) { return DEFAULT_PROPS . get ( key ) ; } else { return null ; } } return env ; }
Return a configured value or the default .
68
8
9,545
public static String serviceURI ( ) throws VictimsException { URL merged ; try { merged = new URL ( new URL ( uri ( ) ) , entry ( ) ) ; return merged . toString ( ) ; } catch ( MalformedURLException e ) { throw new VictimsException ( "Invalid configuration for service URI." , e ) ; } }
Get a complete webservice uri by merging base and entry point .
73
15
9,546
public static File home ( ) throws VictimsException { File directory = new File ( getPropertyValue ( Key . HOME ) ) ; if ( ! directory . exists ( ) ) { try { FileUtils . forceMkdir ( directory ) ; } catch ( IOException e ) { throw new VictimsException ( "Could not create home directory." , e ) ; } } return directory ; }
Get the configured cache directory . If the directory does not exist it will be created .
80
17
9,547
public static ArrayList < Algorithms > algorithms ( ) { ArrayList < Algorithms > algorithms = new ArrayList < Algorithms > ( ) ; for ( String alg : getPropertyValue ( Key . ALGORITHMS ) . split ( "," ) ) { alg = alg . trim ( ) ; try { algorithms . add ( Algorithms . valueOf ( alg ) ) ; } catch ( Exception e ) { // skip } } if ( ! algorithms . contains ( getDefaultAlgorithm ( ) ) ) { algorithms . add ( getDefaultAlgorithm ( ) ) ; } return algorithms ; }
Returns a list of valid algorithms to be used when fingerprinting . If not specified or if all values are illegal all available algorithms are used .
131
28
9,548
public static String dbUrl ( ) { String dbUrl = getPropertyValue ( Key . DB_URL ) ; if ( dbUrl == null ) { if ( VictimsDB . Driver . exists ( dbDriver ( ) ) ) { return VictimsDB . defaultURL ( dbDriver ( ) ) ; } return VictimsDB . defaultURL ( ) ; } return dbUrl ; }
Get the db connection URL .
76
6
9,549
public static < K , V > Map < K , V > transform ( Map < K , V > map , Transformer < V > transformer ) { Assert . notNull ( map , "Map is required" ) ; Assert . notNull ( transformer , "Transformer is required" ) ; return map . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: < K > getKey , ( entry ) - > transformer . transform ( entry . getValue ( ) ) ) ) ; }
Transforms the values of the given Map with the specified Transformer .
112
14
9,550
public static String toIso8601 ( Date date ) { if ( date == null ) return null ; return ISODateTimeFormat . dateTimeNoMillis ( ) . withZoneUTC ( ) . print ( date . getTime ( ) ) ; }
Returns a ISO8601 string of the given date .
54
11
9,551
public void clean ( ) { if ( ! remove ( this ) ) return ; try { thunk . run ( ) ; } catch ( final Throwable x ) { AccessController . doPrivileged ( new PrivilegedAction < Void > ( ) { public Void run ( ) { if ( System . err != null ) new Error ( "Cleaner terminated abnormally" , x ) . printStackTrace ( ) ; System . exit ( 1 ) ; return null ; } } ) ; } }
Runs this cleaner if it has not been run before .
102
12
9,552
private boolean shouldPrettyPrint ( HttpRequest request ) { QueryStringDecoder decoder = new QueryStringDecoder ( request . getUri ( ) , Charsets . UTF_8 , true , 2 ) ; Map < String , List < String > > parameters = decoder . parameters ( ) ; if ( parameters . containsKey ( PP_PARAMETER ) ) { return parseBoolean ( parameters . get ( PP_PARAMETER ) . get ( 0 ) ) ; } else if ( parameters . containsKey ( PRETTY_PRINT_PARAMETER ) ) { return parseBoolean ( parameters . get ( PRETTY_PRINT_PARAMETER ) . get ( 0 ) ) ; } return true ; }
Determines whether the response to the request should be pretty - printed .
159
15
9,553
public static String constantValue ( int index , ConstantPool cp ) { Constant type = cp . getConstant ( index ) ; if ( type != null ) { switch ( type . getTag ( ) ) { case Constants . CONSTANT_Class : ConstantClass cls = ( ConstantClass ) type ; return constantValue ( cls . getNameIndex ( ) , cp ) ; case Constants . CONSTANT_Double : ConstantDouble dbl = ( ConstantDouble ) type ; return String . valueOf ( dbl . getBytes ( ) ) ; case Constants . CONSTANT_Fieldref : ConstantFieldref fieldRef = ( ConstantFieldref ) type ; return constantValue ( fieldRef . getClassIndex ( ) , cp ) + " " + constantValue ( fieldRef . getNameAndTypeIndex ( ) , cp ) ; case Constants . CONSTANT_Float : ConstantFloat flt = ( ConstantFloat ) type ; return String . valueOf ( flt . getBytes ( ) ) ; case Constants . CONSTANT_Integer : ConstantInteger integer = ( ConstantInteger ) type ; return String . valueOf ( integer . getBytes ( ) ) ; case Constants . CONSTANT_InterfaceMethodref : ConstantInterfaceMethodref intRef = ( ConstantInterfaceMethodref ) type ; return constantValue ( intRef . getClassIndex ( ) , cp ) + " " + constantValue ( intRef . getNameAndTypeIndex ( ) , cp ) ; case Constants . CONSTANT_Long : ConstantLong lng = ( ConstantLong ) type ; return String . valueOf ( lng . getBytes ( ) ) ; case Constants . CONSTANT_Methodref : ConstantMethodref methRef = ( ConstantMethodref ) type ; return constantValue ( methRef . getClassIndex ( ) , cp ) + " " + constantValue ( methRef . getNameAndTypeIndex ( ) , cp ) ; case Constants . CONSTANT_NameAndType : ConstantNameAndType nameType = ( ConstantNameAndType ) type ; return nameType . getName ( cp ) + " " + nameType . getSignature ( cp ) ; case Constants . CONSTANT_String : ConstantString str = ( ConstantString ) type ; return str . getBytes ( cp ) ; case Constants . CONSTANT_Utf8 : ConstantUtf8 utf8 = ( ConstantUtf8 ) type ; return utf8 . getBytes ( ) ; } } return "" ; }
Resolves a constants value from the constant pool to the lowest form it can be represented by . E . g . String Integer Float etc .
528
28
9,554
public static byte [ ] normalize ( byte [ ] bytes , String fileName ) throws IOException { ByteArrayInputStream is = new ByteArrayInputStream ( bytes ) ; ClassParser parser = new ClassParser ( is , fileName ) ; StringBuffer buf = new StringBuffer ( ) ; JavaClass klass = parser . parse ( ) ; ConstantPool cpool = klass . getConstantPool ( ) ; // source file buf . append ( klass . getSourceFileName ( ) ) ; // access flags buf . append ( String . valueOf ( klass . getAccessFlags ( ) ) ) ; // this class buf . append ( constantValue ( klass . getClassNameIndex ( ) , cpool ) ) ; // super class (extends) buf . append ( constantValue ( klass . getSuperclassNameIndex ( ) , cpool ) ) ; // interfaces (implements) for ( int index : klass . getInterfaceIndices ( ) ) { // implemented interface name buf . append ( constantValue ( index , cpool ) ) ; } // fields for ( Field f : klass . getFields ( ) ) { // access flags buf . append ( String . valueOf ( f . getAccessFlags ( ) ) ) ; // name buf . append ( constantValue ( f . getNameIndex ( ) , cpool ) ) ; // signature buf . append ( constantValue ( f . getSignatureIndex ( ) , cpool ) ) ; // value if ( f . getConstantValue ( ) != null ) { int index = f . getConstantValue ( ) . getConstantValueIndex ( ) ; buf . append ( constantValue ( index , klass . getConstantPool ( ) ) ) ; } } // methods for ( Method m : klass . getMethods ( ) ) { // access flags buf . append ( String . valueOf ( m . getAccessFlags ( ) ) ) ; // name buf . append ( constantValue ( m . getNameIndex ( ) , cpool ) ) ; // signature buf . append ( constantValue ( m . getSignatureIndex ( ) , cpool ) ) ; // code Code code = m . getCode ( ) ; if ( code != null ) { ByteSequence bytecode = new ByteSequence ( code . getCode ( ) ) ; buf . append ( formatBytecode ( bytecode , cpool ) ) ; } } return buf . toString ( ) . getBytes ( VictimsConfig . charset ( ) ) ; }
The driving function that normalizes given byte code .
526
10
9,555
public static < T extends Comparable < T > > RelationalOperator < T > equalTo ( T value ) { return new EqualToOperator <> ( value ) ; }
Gets the RelationalOperator performing equality comparisons to determine whether all provided values are equal to the given expected value .
38
24
9,556
public static < T extends Comparable < T > > RelationalOperator < T > greaterThan ( T lowerBound ) { return new GreaterThanOperator <> ( lowerBound ) ; }
Gets the RelationalOperator performing greater than comparisons to determine whether all provided values are greater than the given lower bound value .
42
26
9,557
public static < T extends Comparable < T > > RelationalOperator < T > greaterThanAndLessThan ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( greaterThan ( lowerBound ) , LogicalOperator . AND , lessThan ( upperBound ) ) ; }
Gets the RelationalOperator performing greater than and less than comparisons to determine whether all provided values are greater than some lower bound value and also less than some upper bound value .
70
36
9,558
public static < T extends Comparable < T > > RelationalOperator < T > greaterThanAndLessThanEqualTo ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( greaterThan ( lowerBound ) , LogicalOperator . AND , lessThanEqualTo ( upperBound ) ) ; }
Gets the RelationalOperator performing greater than and less than equal to comparisons to determine whether all provided values are greater than some lower bound value and also less than equal to some upper bound value .
76
40
9,559
public static < T extends Comparable < T > > RelationalOperator < T > greaterThanEqualTo ( T lowerBound ) { return new GreaterThanEqualToOperator <> ( lowerBound ) ; }
Gets the RelationalOperator performing greater than equal to comparisons to determine whether all provided values are greater than equal to the given lower bound value .
48
30
9,560
public static < T extends Comparable < T > > RelationalOperator < T > greaterThanEqualToAndLessThan ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( greaterThanEqualTo ( lowerBound ) , LogicalOperator . AND , lessThan ( upperBound ) ) ; }
Gets the RelationalOperator performing greater than equal to and less than comparisons to determine whether all provided values are greater than equal to some lower bound value and also less than some upper bound value .
76
40
9,561
public static < T extends Comparable < T > > RelationalOperator < T > greaterThanEqualToAndLessThanEqualTo ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( greaterThanEqualTo ( lowerBound ) , LogicalOperator . AND , lessThanEqualTo ( upperBound ) ) ; }
Gets the RelationalOperator performing greater than equal to and less than equal to comparisons to determine whether all provided values are greater than equal to some lower bound value and also less than equal to some upper bound value .
82
44
9,562
public static < T extends Comparable < T > > RelationalOperator < T > lessThan ( T lowerBound ) { return new LessThanOperator <> ( lowerBound ) ; }
Gets the RelationalOperator performing less than comparisons to determine whether all provided values are less than the given upper bound value .
42
26
9,563
public static < T extends Comparable < T > > RelationalOperator < T > lessThanOrGreaterThan ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( lessThan ( lowerBound ) , LogicalOperator . OR , greaterThan ( upperBound ) ) ; }
Gets the RelationalOperator performing less than or greater than comparisons to determine whether all provided values are less than some upper bound value or possibly greater than some lower bound value .
71
36
9,564
public static < T extends Comparable < T > > RelationalOperator < T > lessThanOrGreaterThanEqualTo ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( lessThan ( lowerBound ) , LogicalOperator . OR , greaterThanEqualTo ( upperBound ) ) ; }
Gets the RelationalOperator performing less than or greater than equal to comparisons to determine whether all provided values are less than some upper bound value or possibly greater than equal to some lower bound value .
77
40
9,565
public static < T extends Comparable < T > > RelationalOperator < T > lessThanEqualTo ( T lowerBound ) { return new LessThanEqualToOperator <> ( lowerBound ) ; }
Gets the RelationalOperator performing less than equal to comparisons to determine whether all provided values are less than equal to the given upper bound value .
48
30
9,566
public static < T extends Comparable < T > > RelationalOperator < T > lessThanEqualToOrGreaterThan ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( lessThanEqualTo ( lowerBound ) , LogicalOperator . OR , greaterThan ( upperBound ) ) ; }
Gets the RelationalOperator performing less than equal to or greater than comparisons to determine whether all provided values are less than equal to some upper bound value or possibly greater than some lower bound value .
77
40
9,567
public static < T extends Comparable < T > > RelationalOperator < T > lessThanEqualToOrGreaterThanEqualTo ( T lowerBound , T upperBound ) { return ComposableRelationalOperator . compose ( lessThanEqualTo ( lowerBound ) , LogicalOperator . OR , greaterThanEqualTo ( upperBound ) ) ; }
Gets the RelationalOperator performing less than equal to or greater than equal to comparisons to determine whether all provided values are less than equal to some upper bound value or possibly greater than equal to some lower bound value .
83
44
9,568
@ Override public < E > List < E > sort ( final List < E > elements ) { int position = elements . size ( ) ; do { int lastSwapPosition = 0 ; for ( int index = 1 ; index < position ; index ++ ) { if ( getOrderBy ( ) . compare ( elements . get ( index - 1 ) , elements . get ( index ) ) > 0 ) { swap ( elements , index - 1 , index ) ; lastSwapPosition = index ; } } position = lastSwapPosition ; } while ( position != 0 ) ; return elements ; }
Uses the Bubble Sort algorithm to sort a List of elements as defined by the Comparator or as determined by the elements in the collection if the elements are Comparable .
124
34
9,569
@ Override public < E > E search ( final Collection < E > collection ) { for ( E element : collection ) { if ( getMatcher ( ) . isMatch ( element ) ) { return element ; } } return null ; }
Searches the Collection of elements in order to find the element or elements matching the criteria defined by the Matcher .
50
24
9,570
@ NullSafe @ SuppressWarnings ( "all" ) public static boolean areAllNull ( Object ... values ) { for ( Object value : nullSafeArray ( values ) ) { if ( value != null ) { return false ; } } return true ; }
Null - safe method to determine if all the values in the array are null .
55
16
9,571
@ NullSafe public static boolean areAnyNull ( Object ... values ) { for ( Object value : nullSafeArray ( values ) ) { if ( value == null ) { return true ; } } return false ; }
Null - safe method to determine if any of the values in the array are null .
44
17
9,572
@ NullSafe @ SuppressWarnings ( { "unchecked" , "varargs" } ) public static < T > T defaultIfNull ( T ... values ) { for ( T value : nullSafeArray ( values ) ) { if ( value != null ) { return value ; } } return null ; }
Gets the first non - null value in the array of values .
66
14
9,573
public static RadialMenuSection add ( ContextRadialMenu owner , RadialPane pane , Menu menu , RadialMenuSection parentSection , Double angularAxisDeg ) { final RadialMenuSection section = new RadialMenuSection ( owner , pane , menu , parentSection , angularAxisDeg ) ; pane . addSection ( menu , section ) ; return section ; }
Create new RadialMenuSection
81
6
9,574
public static mps_ssl_certkey [ ] get_filtered ( nitro_service service , filtervalue [ ] filter ) throws Exception { mps_ssl_certkey obj = new mps_ssl_certkey ( ) ; options option = new options ( ) ; option . set_filter ( filter ) ; mps_ssl_certkey [ ] response = ( mps_ssl_certkey [ ] ) obj . getfiltered ( service , option ) ; return response ; }
Use this API to fetch filtered set of mps_ssl_certkey resources . set the filter parameter values in filtervalue object .
105
27
9,575
@ Override @ SuppressWarnings ( { "unchecked" , "varargs" } ) public < E > E [ ] sort ( final E ... elements ) { Arrays . sort ( elements , getOrderBy ( ) ) ; return elements ; }
Uses Java s modified Merge Sort to sort an array of elements as defined by the Comparator or as determined by the elements in the array if the elements are Comparable .
55
35
9,576
@ Override public < E > List < E > sort ( final List < E > elements ) { Collections . sort ( elements , getOrderBy ( ) ) ; return elements ; }
Uses Java s modified Merge Sort algorithm to sort a List of elements as defined by the Comparator or as determined by the elements in the collection if the elements are Comparable .
38
36
9,577
public static ns_conf_download_policy get ( nitro_service client ) throws Exception { ns_conf_download_policy resource = new ns_conf_download_policy ( ) ; resource . validate ( "get" ) ; return ( ( ns_conf_download_policy [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get the polling frequency of the Netscaler configuration file .
76
16
9,578
@ Override @ SuppressWarnings ( "unchecked" ) public < E > Matcher < E > getMatcher ( ) { Matcher < E > localMatcher = ( Matcher < E > ) MatcherHolder . get ( ) ; Assert . state ( localMatcher != null || matcher != null , "A reference to a Matcher used by this Searcher ({0}) for searching and matching elements in the collection was not properly configured!" , getClass ( ) . getName ( ) ) ; return ObjectUtils . defaultIfNull ( localMatcher , matcher ) ; }
Gets the Matcher used to match and find the desired element or elements in the collection .
129
19
9,579
public void setMatcher ( final Matcher matcher ) { Assert . notNull ( matcher , "The Matcher used to match elements in the collection during the search operation by this Searcher ({0}) cannot be null!" , getClass ( ) . getName ( ) ) ; this . matcher = matcher ; }
Sets the Matcher used to match and find the desired element or elements in the collection .
69
19
9,580
@ Override @ SuppressWarnings ( { "unchecked" , "varargs" } ) public < E > E search ( final E ... array ) { return search ( Arrays . asList ( array ) ) ; }
Searches the array of elements in order to find the element or elements matching the criteria defined by the Matcher .
49
24
9,581
@ Override public < E > E search ( final Searchable < E > searchable ) { try { return search ( configureMatcher ( searchable ) . asList ( ) ) ; } finally { MatcherHolder . unset ( ) ; } }
Searches the Searchable object in order to find the element or elements matching the criteria defined by the Matcher .
54
24
9,582
@ SuppressWarnings ( { "unchecked" , "varargs" } ) public < E > Iterable < E > searchForAll ( final E ... array ) { return searchForAll ( Arrays . asList ( array ) ) ; }
Searches an array of elements finding all elements in the array matching the criteria defined by the Matcher .
54
22
9,583
public < E > Iterable < E > searchForAll ( final Collection < E > collection ) { Assert . notNull ( collection , "The collection to search cannot be null!" ) ; final List < E > results = new ArrayList <> ( collection . size ( ) ) ; for ( E element : collection ) { if ( getMatcher ( ) . isMatch ( element ) ) { results . add ( element ) ; } } return results ; }
Searches a collection of elements finding all elements in the collection matching the criteria defined by the Matcher .
96
22
9,584
public < E > Iterable < E > searchForAll ( final Searchable < E > searchable ) { try { return searchForAll ( configureMatcher ( searchable ) . asList ( ) ) ; } finally { MatcherHolder . unset ( ) ; } }
Searches the Searchable object finding all elements in the Searchable object matching the criteria defined by the Matcher .
59
24
9,585
protected < T > Searchable < T > configureMatcher ( final Searchable < T > searchable ) { if ( isCustomMatcherAllowed ( ) ) { Matcher < T > matcher = searchable . getMatcher ( ) ; if ( matcher != null ) { MatcherHolder . set ( matcher ) ; } } return searchable ; }
Configures the desired Matcher used to match and find elements from the Searchable implementing object based on the annotation meta - data applying only to the calling Thread and only if a custom Matcher is allowed . The Matcher is local to calling Thread during the search operation and does not change the Matcher set on the Searcher .
78
66
9,586
@ NullSafe public static File assertExists ( File path ) throws FileNotFoundException { if ( isExisting ( path ) ) { return path ; } throw new FileNotFoundException ( String . format ( "[%1$s] was not found" , path ) ) ; }
Asserts that the given file exists .
60
9
9,587
public static String getExtension ( File file ) { Assert . notNull ( file , "File cannot be null" ) ; String filename = file . getName ( ) ; int dotIndex = filename . indexOf ( StringUtils . DOT_SEPARATOR ) ; return ( dotIndex != - 1 ? filename . substring ( dotIndex + 1 ) : StringUtils . EMPTY_STRING ) ; }
Returns the extension of the given file .
88
8
9,588
public static String getLocation ( File file ) { Assert . notNull ( file , "File cannot be null" ) ; File parent = file . getParentFile ( ) ; Assert . notNull ( parent , new IllegalArgumentException ( String . format ( "Unable to determine the location of file [%1$s]" , file ) ) ) ; return tryGetCanonicalPathElseGetAbsolutePath ( parent ) ; }
Returns the absolute path of the given file .
93
9
9,589
public static File tryGetCanonicalFileElseGetAbsoluteFile ( File file ) { try { return file . getCanonicalFile ( ) ; } catch ( IOException ignore ) { return file . getAbsoluteFile ( ) ; } }
Attempts to the get the canonical form of the given file otherwise returns the absolute form of the file .
52
20
9,590
public static String tryGetCanonicalPathElseGetAbsolutePath ( File file ) { try { return file . getCanonicalPath ( ) ; } catch ( IOException ignore ) { return file . getAbsolutePath ( ) ; } }
Attempts to the get the canonical path of the given file otherwise returns the absolute path of the file .
52
20
9,591
public static br_currentconfig get ( nitro_service client , br_currentconfig resource ) throws Exception { resource . validate ( "get" ) ; return ( ( br_currentconfig [ ] ) resource . get_resources ( client ) ) [ 0 ] ; }
Use this operation to get current configuration from Repeater Instance .
56
13
9,592
public static String join ( Collection < ? extends Object > lst , String separator ) { StringBuilder buf = new StringBuilder ( lst . size ( ) * 64 ) ; boolean first = true ; for ( Object value : lst ) { if ( first ) first = false ; else buf . append ( separator ) ; buf . append ( value . toString ( ) ) ; } return buf . toString ( ) ; }
Concatenates a list of objects using the given separator .
90
14
9,593
public static < T > T last ( List < T > lst ) { if ( lst == null || lst . isEmpty ( ) ) return null ; return lst . get ( lst . size ( ) - 1 ) ; }
Returns the last element of a list or null if empty .
51
12
9,594
@ SuppressWarnings ( "unchecked" ) public static < From , To > List < To > map ( List < From > list , MapClosure < From , To > f ) { List < To > result = new ArrayList < To > ( list . size ( ) ) ; for ( From value : list ) { result . add ( f . eval ( value ) ) ; } return result ; }
Applies a function to every item in a list .
86
11
9,595
public static < Accumulator , Value > Accumulator reduce ( List < Value > list , Accumulator init , ReduceClosure < Accumulator , Value > f ) { Accumulator accumulator = init ; for ( Value value : list ) { accumulator = f . eval ( accumulator , value ) ; } return accumulator ; }
Applies a binary function between each element of the given list .
72
13
9,596
@ SuppressWarnings ( "unchecked" ) public static int median ( List < Integer > values ) { if ( values == null || values . isEmpty ( ) ) return 0 ; values = new ArrayList < Integer > ( values ) ; Collections . sort ( values ) ; final int size = values . size ( ) ; final int sizeHalf = size / 2 ; if ( size % 2 == 1 ) { //is odd? // 0 1 [2] 3 4: size/2 = 5/2 = 2.5 -> 2 return values . get ( sizeHalf ) ; } // 0 1 [2 3] 4 5: size/2 = 6/2 = 3 return ( values . get ( sizeHalf - 1 ) + values . get ( sizeHalf ) ) / 2 ; }
Computes the median value of a list of integers .
166
11
9,597
static JsonRpcResponse error ( JsonRpcError error , JsonElement id ) { return new JsonRpcResponse ( id , error , null ) ; }
Builds a new response for an identifier request and containing an error .
37
14
9,598
public static JsonRpcResponse success ( JsonObject payload , JsonElement id ) { return new JsonRpcResponse ( id , null , payload ) ; }
Builds a new successful response .
36
7
9,599
public JsonObject toJson ( ) { JsonObject body = new JsonObject ( ) ; body . add ( JsonRpcProtocol . ID , id ( ) ) ; if ( isError ( ) ) { body . add ( JsonRpcProtocol . ERROR , error ( ) . toJson ( ) ) ; } else { body . add ( JsonRpcProtocol . RESULT , result ( ) ) ; } return body ; }
Generates the JSON representation of this response .
99
9