idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
2,800
public static base_response update ( nitro_service client , vpnurl resource ) throws Exception { vpnurl updateresource = new vpnurl ( ) ; updateresource . urlname = resource . urlname ; updateresource . linkname = resource . linkname ; updateresource . actualurl = resource . actualurl ; updateresource . clientlessaccess = resource . clientlessaccess ; updateresource . comment = resource . comment ; return updateresource . update_resource ( client ) ; }
Use this API to update vpnurl .
2,801
public static base_responses update ( nitro_service client , vpnurl resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { vpnurl updateresources [ ] = new vpnurl [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new vpnurl ( ) ; updateresources [ i ] . urlname = resources [ i ] . urlname ; updateresources [ i ] . linkname = resources [ i ] . linkname ; updateresources [ i ] . actualurl = resources [ i ] . actualurl ; updateresources [ i ] . clientlessaccess = resources [ i ] . clientlessaccess ; updateresources [ i ] . comment = resources [ i ] . comment ; } result = update_bulk_request ( client , updateresources ) ; } return result ; }
Use this API to update vpnurl resources .
2,802
public static base_response unset ( nitro_service client , vpnurl resource , String [ ] args ) throws Exception { vpnurl unsetresource = new vpnurl ( ) ; unsetresource . urlname = resource . urlname ; return unsetresource . unset_resource ( client , args ) ; }
Use this API to unset the properties of vpnurl resource . Properties that need to be unset are specified in args array .
2,803
public static base_responses unset ( nitro_service client , String urlname [ ] , String args [ ] ) throws Exception { base_responses result = null ; if ( urlname != null && urlname . length > 0 ) { vpnurl unsetresources [ ] = new vpnurl [ urlname . length ] ; for ( int i = 0 ; i < urlname . length ; i ++ ) { unsetresources [ i ] = new vpnurl ( ) ; unsetresources [ i ] . urlname = urlname [ i ] ; } result = unset_bulk_request ( client , unsetresources , args ) ; } return result ; }
Use this API to unset the properties of vpnurl resources . Properties that need to be unset are specified in args array .
2,804
public static vpnurl [ ] get ( nitro_service service ) throws Exception { vpnurl obj = new vpnurl ( ) ; vpnurl [ ] response = ( vpnurl [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch all the vpnurl resources that are configured on netscaler .
2,805
public static vpnurl get ( nitro_service service , String urlname ) throws Exception { vpnurl obj = new vpnurl ( ) ; obj . set_urlname ( urlname ) ; vpnurl response = ( vpnurl ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch vpnurl resource of given name .
2,806
public static vpnurl [ ] get ( nitro_service service , String urlname [ ] ) throws Exception { if ( urlname != null && urlname . length > 0 ) { vpnurl response [ ] = new vpnurl [ urlname . length ] ; vpnurl obj [ ] = new vpnurl [ urlname . length ] ; for ( int i = 0 ; i < urlname . length ; i ++ ) { obj [ i ] = new vpnurl ( ) ; obj [ i ] . set_urlname ( urlname [ i ] ) ; response [ i ] = ( vpnurl ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ; }
Use this API to fetch vpnurl resources of given names .
2,807
public Iterator < IntTaggedWord > ruleIteratorByWord ( String word , int loc ) { return ruleIteratorByWord ( wordIndex . indexOf ( word , true ) , loc , null ) ; }
Returns the possible POS taggings for a word .
2,808
public void addAll ( List < TaggedWord > taggedWords , double weight ) { List < IntTaggedWord > tagWords = listToEvents ( taggedWords ) ; }
Not yet implemented .
2,809
public final void train ( Collection < Tree > trees , double weight ) { for ( Tree tree : trees ) { train ( tree , weight ) ; } }
Trains this lexicon on the Collection of trees . Also trains the unknown word model pointed to by this lexicon .
2,810
protected void addTagging ( boolean seen , IntTaggedWord itw , double count ) { if ( seen ) { seenCounter . incrementCount ( itw , count ) ; if ( itw . tag ( ) == nullTag ) { words . add ( itw ) ; } else if ( itw . word ( ) == nullWord ) { tags . add ( itw ) ; } else { } } else { uwModel . addTagging ( seen , itw , count ) ; } }
Adds the tagging with count to the data structures in this Lexicon .
2,811
public void writeData ( Writer w ) throws IOException { PrintWriter out = new PrintWriter ( w ) ; for ( IntTaggedWord itw : seenCounter . keySet ( ) ) { out . println ( itw . toLexicalEntry ( wordIndex , tagIndex ) + " SEEN " + seenCounter . getCount ( itw ) ) ; } for ( IntTaggedWord itw : getUnknownWordModel ( ) . unSeenCounter ( ) . keySet ( ) ) { out . println ( itw . toLexicalEntry ( wordIndex , tagIndex ) + " UNSEEN " + getUnknownWordModel ( ) . unSeenCounter ( ) . getCount ( itw ) ) ; } for ( int i = 0 ; i < smooth . length ; i ++ ) { out . println ( "smooth[" + i + "] = " + smooth [ i ] ) ; } out . flush ( ) ; }
Writes out data from this Object to the Writer w . Rules are separated by newline and rule elements are delimited by \ t .
2,812
public static base_response add ( nitro_service client , nd6 resource ) throws Exception { nd6 addresource = new nd6 ( ) ; addresource . neighbor = resource . neighbor ; addresource . mac = resource . mac ; addresource . ifnum = resource . ifnum ; addresource . vlan = resource . vlan ; addresource . td = resource . td ; return addresource . add_resource ( client ) ; }
Use this API to add nd6 .
2,813
public static base_responses add ( nitro_service client , nd6 resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { nd6 addresources [ ] = new nd6 [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new nd6 ( ) ; addresources [ i ] . neighbor = resources [ i ] . neighbor ; addresources [ i ] . mac = resources [ i ] . mac ; addresources [ i ] . ifnum = resources [ i ] . ifnum ; addresources [ i ] . vlan = resources [ i ] . vlan ; addresources [ i ] . td = resources [ i ] . td ; } result = add_bulk_request ( client , addresources ) ; } return result ; }
Use this API to add nd6 resources .
2,814
public static base_response clear ( nitro_service client ) throws Exception { nd6 clearresource = new nd6 ( ) ; return clearresource . perform_operation ( client , "clear" ) ; }
Use this API to clear nd6 .
2,815
public static base_response delete ( nitro_service client , String neighbor ) throws Exception { nd6 deleteresource = new nd6 ( ) ; deleteresource . neighbor = neighbor ; return deleteresource . delete_resource ( client ) ; }
Use this API to delete nd6 of given name .
2,816
public static base_response delete ( nitro_service client , nd6 resource ) throws Exception { nd6 deleteresource = new nd6 ( ) ; deleteresource . neighbor = resource . neighbor ; deleteresource . vlan = resource . vlan ; deleteresource . td = resource . td ; return deleteresource . delete_resource ( client ) ; }
Use this API to delete nd6 .
2,817
public static base_responses delete ( nitro_service client , String neighbor [ ] ) throws Exception { base_responses result = null ; if ( neighbor != null && neighbor . length > 0 ) { nd6 deleteresources [ ] = new nd6 [ neighbor . length ] ; for ( int i = 0 ; i < neighbor . length ; i ++ ) { deleteresources [ i ] = new nd6 ( ) ; deleteresources [ i ] . neighbor = neighbor [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; }
Use this API to delete nd6 resources of given names .
2,818
public static nd6 [ ] get ( nitro_service service ) throws Exception { nd6 obj = new nd6 ( ) ; nd6 [ ] response = ( nd6 [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch all the nd6 resources that are configured on netscaler .
2,819
public static csvserver_lbvserver_binding [ ] get ( nitro_service service , String name ) throws Exception { csvserver_lbvserver_binding obj = new csvserver_lbvserver_binding ( ) ; obj . set_name ( name ) ; csvserver_lbvserver_binding response [ ] = ( csvserver_lbvserver_binding [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch csvserver_lbvserver_binding resources of given name .
2,820
public static streamidentifier_binding get ( nitro_service service , String name ) throws Exception { streamidentifier_binding obj = new streamidentifier_binding ( ) ; obj . set_name ( name ) ; streamidentifier_binding response = ( streamidentifier_binding ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch streamidentifier_binding resource of given name .
2,821
public static appfwprofile_xmlxss_binding [ ] get ( nitro_service service , String name ) throws Exception { appfwprofile_xmlxss_binding obj = new appfwprofile_xmlxss_binding ( ) ; obj . set_name ( name ) ; appfwprofile_xmlxss_binding response [ ] = ( appfwprofile_xmlxss_binding [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch appfwprofile_xmlxss_binding resources of given name .
2,822
public static authenticationlocalpolicy_binding get ( nitro_service service , String name ) throws Exception { authenticationlocalpolicy_binding obj = new authenticationlocalpolicy_binding ( ) ; obj . set_name ( name ) ; authenticationlocalpolicy_binding response = ( authenticationlocalpolicy_binding ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch authenticationlocalpolicy_binding resource of given name .
2,823
public static dnspolicy64_lbvserver_binding [ ] get ( nitro_service service , String name ) throws Exception { dnspolicy64_lbvserver_binding obj = new dnspolicy64_lbvserver_binding ( ) ; obj . set_name ( name ) ; dnspolicy64_lbvserver_binding response [ ] = ( dnspolicy64_lbvserver_binding [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch dnspolicy64_lbvserver_binding resources of given name .
2,824
public static < E > double logSum ( Counter < E > c ) { return ArrayMath . logSum ( ArrayMath . unbox ( c . values ( ) ) ) ; }
Returns ArrayMath . logSum of the values in this counter .
2,825
public static < E > double max ( Counter < E > c ) { double max = Double . NEGATIVE_INFINITY ; for ( double v : c . values ( ) ) { max = Math . max ( max , v ) ; } return max ; }
Returns the value of the maximum entry in this counter . This is also the Linfinity norm . An empty counter is given a max value of Double . NEGATIVE_INFINITY .
2,826
public static < E > Counter < E > asCounter ( Collection < E > c ) { Counter < E > count = new ClassicCounter < E > ( ) ; for ( E elem : c ) { count . incrementCount ( elem ) ; } return count ; }
Takes in a Collection of something and makes a counter incrementing once for each object in the collection .
2,827
public static < E > double min ( Counter < E > c ) { double min = Double . POSITIVE_INFINITY ; for ( double v : c . values ( ) ) { min = Math . min ( min , v ) ; } return min ; }
Returns the value of the smallest entry in this counter .
2,828
public static < E > E argmax ( Counter < E > c ) { double max = Double . NEGATIVE_INFINITY ; E argmax = null ; for ( E key : c . keySet ( ) ) { double count = c . getCount ( key ) ; if ( argmax == null || count > max ) { max = count ; argmax = key ; } } return argmax ; }
Finds and returns the key in the Counter with the largest count . Returning null if count is empty .
2,829
public static < E > E argmin ( Counter < E > c ) { double min = Double . POSITIVE_INFINITY ; E argmin = null ; for ( E key : c . keySet ( ) ) { double count = c . getCount ( key ) ; if ( argmin == null || count < min ) { min = count ; argmin = key ; } } return argmin ; }
Finds and returns the key in this Counter with the smallest count .
2,830
public static < E > void addInPlace ( Counter < E > target , double value ) { for ( E key : target . keySet ( ) ) { target . incrementCount ( key , value ) ; } }
Increments all keys in a Counter by a specific value .
2,831
public static < E > void divideInPlace ( Counter < E > target , Counter < E > denominator ) { for ( E key : target . keySet ( ) ) { target . setCount ( key , target . getCount ( key ) / denominator . getCount ( key ) ) ; } }
Divides every non - zero count in target by the corresponding value in the denominator Counter . Beware that this can give NaN values for zero counts in the denominator counter!
2,832
public static < E > void dotProductInPlace ( Counter < E > target , Counter < E > term ) { for ( E key : target . keySet ( ) ) { target . setCount ( key , target . getCount ( key ) * term . getCount ( key ) ) ; } }
Multiplies every count in target by the corresponding value in the term Counter .
2,833
public static < E > Counter < E > divideInPlace ( Counter < E > target , double divisor ) { for ( Entry < E , Double > entry : target . entrySet ( ) ) { target . setCount ( entry . getKey ( ) , entry . getValue ( ) / divisor ) ; } return target ; }
Divides each value in target by the given divisor in place .
2,834
public static < E > Counter < E > multiplyInPlace ( Counter < E > target , double multiplier ) { for ( Entry < E , Double > entry : target . entrySet ( ) ) { target . setCount ( entry . getKey ( ) , entry . getValue ( ) * multiplier ) ; } return target ; }
Multiplies each value in target by the given multiplier in place .
2,835
public static < E > List < E > deleteOutofRange ( Counter < E > c , int top , int bottom ) { List < E > purgedItems = new ArrayList < E > ( ) ; int numToPurge = top + bottom ; if ( numToPurge <= 0 ) { return purgedItems ; } List < E > l = Counters . toSortedList ( c ) ; for ( int i = 0 ; i < top ; i ++ ) { E item = l . get ( i ) ; purgedItems . add ( item ) ; c . remove ( item ) ; } int size = c . size ( ) ; for ( int i = c . size ( ) - 1 ; i >= ( size - bottom ) ; i -- ) { E item = l . get ( i ) ; purgedItems . add ( item ) ; c . remove ( item ) ; } return purgedItems ; }
Delete top and bottom number of elements from the top and bottom respectively
2,836
public static < E > Set < E > retainNonZeros ( Counter < E > counter ) { Set < E > removed = new HashSet < E > ( ) ; for ( E key : counter . keySet ( ) ) { if ( counter . getCount ( key ) == 0.0 ) { removed . add ( key ) ; } } for ( E key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with 0 count in the counter returning the set of removed entries .
2,837
public static < E > Set < E > retainAbove ( Counter < E > counter , double countThreshold ) { Set < E > removed = new HashSet < E > ( ) ; for ( E key : counter . keySet ( ) ) { if ( counter . getCount ( key ) < countThreshold ) { removed . add ( key ) ; } } for ( E key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with counts below the given threshold returning the set of removed entries .
2,838
public static < E > Set < E > retainBelow ( Counter < E > counter , double countMaxThreshold ) { Set < E > removed = new HashSet < E > ( ) ; for ( E key : counter . keySet ( ) ) { if ( counter . getCount ( key ) > countMaxThreshold ) { removed . add ( key ) ; } } for ( E key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with counts above the given threshold returning the set of removed entries .
2,839
public static Set < String > retainMatchingKeys ( Counter < String > counter , List < Pattern > matchPatterns ) { Set < String > removed = new HashSet < String > ( ) ; for ( String key : counter . keySet ( ) ) { boolean matched = false ; for ( Pattern pattern : matchPatterns ) { if ( pattern . matcher ( key ) . matches ( ) ) { matched = true ; break ; } } if ( ! matched ) { removed . add ( key ) ; } } for ( String key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with keys that does not match one of the given patterns
2,840
public static < E > Set < E > retainKeys ( Counter < E > counter , Collection < E > matchKeys ) { Set < E > removed = new HashSet < E > ( ) ; for ( E key : counter . keySet ( ) ) { boolean matched = matchKeys . contains ( key ) ; if ( ! matched ) { removed . add ( key ) ; } } for ( E key : removed ) { counter . remove ( key ) ; } return removed ; }
Removes all entries with keys that does not match the given set of keys
2,841
public static < E > void removeKeys ( Counter < E > counter , Collection < E > removeKeysCollection ) { for ( E key : removeKeysCollection ) counter . remove ( key ) ; }
Removes all entries with keys in the given collection
2,842
public static < T1 , T2 > Counter < T2 > transform ( Counter < T1 > c , Function < T1 , T2 > f ) { Counter < T2 > c2 = new ClassicCounter < T2 > ( ) ; for ( T1 key : c . keySet ( ) ) { c2 . setCount ( f . apply ( key ) , c . getCount ( key ) ) ; } return c2 ; }
Returns the counter with keys modified according to function F . Eager evaluation .
2,843
public static < E > IntCounter < E > toRankCounter ( Counter < E > c ) { IntCounter < E > rankCounter = new IntCounter < E > ( ) ; List < E > sortedList = toSortedList ( c ) ; for ( int i = 0 ; i < sortedList . size ( ) ; i ++ ) { rankCounter . setCount ( sortedList . get ( i ) , i ) ; } return rankCounter ; }
Converts a counter to ranks
2,844
public static < E > List < Pair < E , Double > > toSortedListWithCounts ( Counter < E > c ) { List < Pair < E , Double > > l = new ArrayList < Pair < E , Double > > ( c . size ( ) ) ; for ( E e : c . keySet ( ) ) { l . add ( new Pair < E , Double > ( e , c . getCount ( e ) ) ) ; } Collections . sort ( l , new Comparator < Pair < E , Double > > ( ) { public int compare ( Pair < E , Double > a , Pair < E , Double > b ) { return Double . compare ( b . second , a . second ) ; } } ) ; return l ; }
A List of the keys in c sorted from highest count to lowest paired with counts
2,845
public static < E > Counter < E > intersection ( Counter < E > c1 , Counter < E > c2 ) { Counter < E > result = c1 . getFactory ( ) . create ( ) ; for ( E key : Sets . union ( c1 . keySet ( ) , c2 . keySet ( ) ) ) { double count1 = c1 . getCount ( key ) ; double count2 = c2 . getCount ( key ) ; double minCount = ( count1 < count2 ? count1 : count2 ) ; if ( minCount > 0 ) { result . setCount ( key , minCount ) ; } } return result ; }
Returns a counter that is the intersection of c1 and c2 . If both c1 and c2 contain a key the min of the two counts is used .
2,846
public static < E > double optimizedDotProduct ( Counter < E > c1 , Counter < E > c2 ) { double dotProd = 0.0 ; int size1 = c1 . size ( ) ; int size2 = c2 . size ( ) ; if ( size1 < size2 ) { for ( E key : c1 . keySet ( ) ) { double count1 = c1 . getCount ( key ) ; if ( count1 != 0.0 ) { double count2 = c2 . getCount ( key ) ; if ( count2 != 0.0 ) dotProd += ( count1 * count2 ) ; } } } else { for ( E key : c2 . keySet ( ) ) { double count2 = c2 . getCount ( key ) ; if ( count2 != 0.0 ) { double count1 = c1 . getCount ( key ) ; if ( count1 != 0.0 ) dotProd += ( count1 * count2 ) ; } } } return dotProd ; }
This method does not check entries for NAN or INFINITY values in the doubles returned . It also only iterates over the counter with the smallest number of keys to help speed up computation . Pair this method with normalizing your counters before hand and you have a reasonably quick implementation of cosine .
2,847
public static < E > Counter < E > absoluteDifference ( Counter < E > c1 , Counter < E > c2 ) { Counter < E > result = c1 . getFactory ( ) . create ( ) ; for ( E key : Sets . union ( c1 . keySet ( ) , c2 . keySet ( ) ) ) { double newCount = Math . abs ( c1 . getCount ( key ) - c2 . getCount ( key ) ) ; if ( newCount > 0 ) { result . setCount ( key , newCount ) ; } } return result ; }
Returns |c1 - c2| .
2,848
public static < E > Counter < E > division ( Counter < E > c1 , Counter < E > c2 ) { Counter < E > result = c1 . getFactory ( ) . create ( ) ; for ( E key : Sets . union ( c1 . keySet ( ) , c2 . keySet ( ) ) ) { result . setCount ( key , c1 . getCount ( key ) / c2 . getCount ( key ) ) ; } return result ; }
Returns c1 divided by c2 . Note that this can create NaN if c1 has non - zero counts for keys that c2 has zero counts .
2,849
public static < E > double crossEntropy ( Counter < E > from , Counter < E > to ) { double tot2 = to . totalCount ( ) ; double result = 0.0 ; for ( E key : from . keySet ( ) ) { double count1 = from . getCount ( key ) ; if ( count1 == 0.0 ) { continue ; } double count2 = to . getCount ( key ) ; double logFract = Math . log ( count2 / tot2 ) ; if ( logFract == Double . NEGATIVE_INFINITY ) { return Double . NEGATIVE_INFINITY ; } result += count1 * ( logFract / LOG_E_2 ) ; } return result ; }
Note that this implementation doesn t normalize the from Counter . It does however normalize the to Counter . Result is meaningless if any of the counts are negative .
2,850
public static < E , C extends Counter < E > > C L2Normalize ( C c ) { return scale ( c , 1.0 / L2Norm ( c ) ) ; }
L2 normalize a counter .
2,851
public static < E , C extends Counter < E > > Counter < E > L2NormalizeInPlace ( Counter < E > c ) { return multiplyInPlace ( c , 1.0 / L2Norm ( c ) ) ; }
L2 normalize a counter in place .
2,852
public static < E , C extends Counter < E > > C saferL2Normalize ( C c ) { return scale ( c , 1.0 / saferL2Norm ( c ) ) ; }
L2 normalize a counter using the safer L2 normalizer .
2,853
public static < E > Counter < E > average ( Counter < E > c1 , Counter < E > c2 ) { Counter < E > average = c1 . getFactory ( ) . create ( ) ; Set < E > allKeys = new HashSet < E > ( c1 . keySet ( ) ) ; allKeys . addAll ( c2 . keySet ( ) ) ; for ( E key : allKeys ) { average . setCount ( key , ( c1 . getCount ( key ) + c2 . getCount ( key ) ) * 0.5 ) ; } return average ; }
Returns a new Counter with counts averaged from the two given Counters . The average Counter will contain the union of keys in both source Counters and each count will be the average of the two source counts for that key where as usual a missing count in one Counter is treated as count 0 .
2,854
public static < E > Counter < E > linearCombination ( Counter < E > c1 , double w1 , Counter < E > c2 , double w2 ) { Counter < E > result = c1 . getFactory ( ) . create ( ) ; for ( E o : c1 . keySet ( ) ) { result . incrementCount ( o , c1 . getCount ( o ) * w1 ) ; } for ( E o : c2 . keySet ( ) ) { result . incrementCount ( o , c2 . getCount ( o ) * w2 ) ; } return result ; }
Returns a Counter which is a weighted average of c1 and c2 . Counts from c1 are weighted with weight w1 and counts from c2 are weighted with w2 .
2,855
@ SuppressWarnings ( "unchecked" ) public static < E , C extends Counter < E > > C scale ( C c , double s ) { C scaled = ( C ) c . getFactory ( ) . create ( ) ; for ( E key : c . keySet ( ) ) { scaled . setCount ( key , c . getCount ( key ) * s ) ; } return scaled ; }
Returns a new Counter which is scaled by the given scale factor .
2,856
@ SuppressWarnings ( "unchecked" ) public static < E , C extends Counter < E > > C tfLogScale ( C c , double base ) { C scaled = ( C ) c . getFactory ( ) . create ( ) ; for ( E key : c . keySet ( ) ) { double cnt = c . getCount ( key ) ; double scaledCnt = 0.0 ; if ( cnt > 0 ) { scaledCnt = 1.0 + SloppyMath . log ( cnt , base ) ; } scaled . setCount ( key , scaledCnt ) ; } return scaled ; }
Returns a new Counter which is the input counter with log tf scaling
2,857
private static < E > void loadIntoCounter ( String filename , Class < E > c , Counter < E > counter ) throws RuntimeException { try { Constructor < E > m = c . getConstructor ( String . class ) ; BufferedReader in = IOUtils . getBufferedFileReader ( filename ) ; String line = in . readLine ( ) ; while ( line != null && line . length ( ) > 0 ) { int endPos = Math . max ( line . lastIndexOf ( ' ' ) , line . lastIndexOf ( '\t' ) ) ; counter . setCount ( m . newInstance ( line . substring ( 0 , endPos ) . trim ( ) ) , Double . parseDouble ( line . substring ( endPos , line . length ( ) ) . trim ( ) ) ) ; line = in . readLine ( ) ; } in . close ( ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; } }
Loads a file into an GenericCounter .
2,858
public static < E > Counter < E > toCounter ( Map < Integer , ? extends Number > counts , Index < E > index ) { Counter < E > counter = new ClassicCounter < E > ( ) ; for ( Map . Entry < Integer , ? extends Number > entry : counts . entrySet ( ) ) { counter . setCount ( index . get ( entry . getKey ( ) ) , entry . getValue ( ) . doubleValue ( ) ) ; } return counter ; }
Turns the given map and index into a counter instance . For each entry in counts its key is converted to a counter key via lookup in the given index .
2,859
@ SuppressWarnings ( "unchecked" ) public static < T > T sample ( Counter < T > c , Random rand ) { Iterable < T > objects ; Set < T > keySet = c . keySet ( ) ; objects = c . keySet ( ) ; if ( rand == null ) { rand = new Random ( ) ; } else { if ( ! keySet . isEmpty ( ) && keySet . iterator ( ) . next ( ) instanceof Comparable ) { List l = new ArrayList < T > ( keySet ) ; Collections . sort ( l ) ; objects = l ; } else { throw new RuntimeException ( "Results won't be stable since Counters keys are comparable." ) ; } } double r = rand . nextDouble ( ) * c . totalCount ( ) ; double total = 0.0 ; for ( T t : objects ) { total += c . getCount ( t ) ; if ( total >= r ) return t ; } return c . keySet ( ) . iterator ( ) . next ( ) ; }
Does not assumes c is normalized .
2,860
public static < E > Counter < E > powNormalized ( Counter < E > c , double temp ) { Counter < E > d = c . getFactory ( ) . create ( ) ; double total = c . totalCount ( ) ; for ( E e : c . keySet ( ) ) { d . setCount ( e , Math . pow ( c . getCount ( e ) / total , temp ) ) ; } return d ; }
Returns a counter where each element corresponds to the normalized count of the corresponding element in c raised to the given power .
2,861
public static < E > Counter < E > asCounter ( FixedPrioritiesPriorityQueue < E > p ) { FixedPrioritiesPriorityQueue < E > pq = p . clone ( ) ; ClassicCounter < E > counter = new ClassicCounter < E > ( ) ; while ( pq . hasNext ( ) ) { double priority = pq . getPriority ( ) ; E element = pq . next ( ) ; counter . incrementCount ( element , priority ) ; } return counter ; }
Returns a counter whose keys are the elements in this priority queue and whose counts are the priorities in this queue . In the event there are multiple instances of the same element in the queue the counter s count will be the sum of the instances priorities .
2,862
public static < E > Map < E , Double > asMap ( final Counter < E > counter ) { return new AbstractMap < E , Double > ( ) { public int size ( ) { return counter . size ( ) ; } public Set < Entry < E , Double > > entrySet ( ) { return counter . entrySet ( ) ; } @ SuppressWarnings ( "unchecked" ) public boolean containsKey ( Object key ) { return counter . containsKey ( ( E ) key ) ; } @ SuppressWarnings ( "unchecked" ) public Double get ( Object key ) { return counter . getCount ( ( E ) key ) ; } public Double put ( E key , Double value ) { double last = counter . getCount ( key ) ; counter . setCount ( key , value ) ; return last ; } @ SuppressWarnings ( "unchecked" ) public Double remove ( Object key ) { return counter . remove ( ( E ) key ) ; } public Set < E > keySet ( ) { return counter . keySet ( ) ; } } ; }
Returns a map view of the given counter .
2,863
public static appqoepolicy_binding get ( nitro_service service , String name ) throws Exception { appqoepolicy_binding obj = new appqoepolicy_binding ( ) ; obj . set_name ( name ) ; appqoepolicy_binding response = ( appqoepolicy_binding ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch appqoepolicy_binding resource of given name .
2,864
public static base_response add ( nitro_service client , appfwxmlcontenttype resource ) throws Exception { appfwxmlcontenttype addresource = new appfwxmlcontenttype ( ) ; addresource . xmlcontenttypevalue = resource . xmlcontenttypevalue ; addresource . isregex = resource . isregex ; return addresource . add_resource ( client ) ; }
Use this API to add appfwxmlcontenttype .
2,865
public static base_responses add ( nitro_service client , appfwxmlcontenttype resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { appfwxmlcontenttype addresources [ ] = new appfwxmlcontenttype [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new appfwxmlcontenttype ( ) ; addresources [ i ] . xmlcontenttypevalue = resources [ i ] . xmlcontenttypevalue ; addresources [ i ] . isregex = resources [ i ] . isregex ; } result = add_bulk_request ( client , addresources ) ; } return result ; }
Use this API to add appfwxmlcontenttype resources .
2,866
public static base_response delete ( nitro_service client , String xmlcontenttypevalue ) throws Exception { appfwxmlcontenttype deleteresource = new appfwxmlcontenttype ( ) ; deleteresource . xmlcontenttypevalue = xmlcontenttypevalue ; return deleteresource . delete_resource ( client ) ; }
Use this API to delete appfwxmlcontenttype of given name .
2,867
public static base_responses delete ( nitro_service client , String xmlcontenttypevalue [ ] ) throws Exception { base_responses result = null ; if ( xmlcontenttypevalue != null && xmlcontenttypevalue . length > 0 ) { appfwxmlcontenttype deleteresources [ ] = new appfwxmlcontenttype [ xmlcontenttypevalue . length ] ; for ( int i = 0 ; i < xmlcontenttypevalue . length ; i ++ ) { deleteresources [ i ] = new appfwxmlcontenttype ( ) ; deleteresources [ i ] . xmlcontenttypevalue = xmlcontenttypevalue [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; }
Use this API to delete appfwxmlcontenttype resources of given names .
2,868
public static appfwxmlcontenttype [ ] get ( nitro_service service ) throws Exception { appfwxmlcontenttype obj = new appfwxmlcontenttype ( ) ; appfwxmlcontenttype [ ] response = ( appfwxmlcontenttype [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch all the appfwxmlcontenttype resources that are configured on netscaler .
2,869
public static appfwxmlcontenttype get ( nitro_service service , String xmlcontenttypevalue ) throws Exception { appfwxmlcontenttype obj = new appfwxmlcontenttype ( ) ; obj . set_xmlcontenttypevalue ( xmlcontenttypevalue ) ; appfwxmlcontenttype response = ( appfwxmlcontenttype ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch appfwxmlcontenttype resource of given name .
2,870
public static appfwxmlcontenttype [ ] get ( nitro_service service , String xmlcontenttypevalue [ ] ) throws Exception { if ( xmlcontenttypevalue != null && xmlcontenttypevalue . length > 0 ) { appfwxmlcontenttype response [ ] = new appfwxmlcontenttype [ xmlcontenttypevalue . length ] ; appfwxmlcontenttype obj [ ] = new appfwxmlcontenttype [ xmlcontenttypevalue . length ] ; for ( int i = 0 ; i < xmlcontenttypevalue . length ; i ++ ) { obj [ i ] = new appfwxmlcontenttype ( ) ; obj [ i ] . set_xmlcontenttypevalue ( xmlcontenttypevalue [ i ] ) ; response [ i ] = ( appfwxmlcontenttype ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ; }
Use this API to fetch appfwxmlcontenttype resources of given names .
2,871
public static base_response add ( nitro_service client , policymap resource ) throws Exception { policymap addresource = new policymap ( ) ; addresource . mappolicyname = resource . mappolicyname ; addresource . sd = resource . sd ; addresource . su = resource . su ; addresource . td = resource . td ; addresource . tu = resource . tu ; return addresource . add_resource ( client ) ; }
Use this API to add policymap .
2,872
public static base_responses add ( nitro_service client , policymap resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { policymap addresources [ ] = new policymap [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new policymap ( ) ; addresources [ i ] . mappolicyname = resources [ i ] . mappolicyname ; addresources [ i ] . sd = resources [ i ] . sd ; addresources [ i ] . su = resources [ i ] . su ; addresources [ i ] . td = resources [ i ] . td ; addresources [ i ] . tu = resources [ i ] . tu ; } result = add_bulk_request ( client , addresources ) ; } return result ; }
Use this API to add policymap resources .
2,873
public static base_response delete ( nitro_service client , String mappolicyname ) throws Exception { policymap deleteresource = new policymap ( ) ; deleteresource . mappolicyname = mappolicyname ; return deleteresource . delete_resource ( client ) ; }
Use this API to delete policymap of given name .
2,874
public static base_responses delete ( nitro_service client , String mappolicyname [ ] ) throws Exception { base_responses result = null ; if ( mappolicyname != null && mappolicyname . length > 0 ) { policymap deleteresources [ ] = new policymap [ mappolicyname . length ] ; for ( int i = 0 ; i < mappolicyname . length ; i ++ ) { deleteresources [ i ] = new policymap ( ) ; deleteresources [ i ] . mappolicyname = mappolicyname [ i ] ; } result = delete_bulk_request ( client , deleteresources ) ; } return result ; }
Use this API to delete policymap resources of given names .
2,875
public static policymap [ ] get ( nitro_service service ) throws Exception { policymap obj = new policymap ( ) ; policymap [ ] response = ( policymap [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch all the policymap resources that are configured on netscaler .
2,876
public static policymap get ( nitro_service service , String mappolicyname ) throws Exception { policymap obj = new policymap ( ) ; obj . set_mappolicyname ( mappolicyname ) ; policymap response = ( policymap ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch policymap resource of given name .
2,877
public static policymap [ ] get ( nitro_service service , String mappolicyname [ ] ) throws Exception { if ( mappolicyname != null && mappolicyname . length > 0 ) { policymap response [ ] = new policymap [ mappolicyname . length ] ; policymap obj [ ] = new policymap [ mappolicyname . length ] ; for ( int i = 0 ; i < mappolicyname . length ; i ++ ) { obj [ i ] = new policymap ( ) ; obj [ i ] . set_mappolicyname ( mappolicyname [ i ] ) ; response [ i ] = ( policymap ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ; }
Use this API to fetch policymap resources of given names .
2,878
public static base_response unset ( nitro_service client , iptunnelparam resource , String [ ] args ) throws Exception { iptunnelparam unsetresource = new iptunnelparam ( ) ; return unsetresource . unset_resource ( client , args ) ; }
Use this API to unset the properties of iptunnelparam resource . Properties that need to be unset are specified in args array .
2,879
public static iptunnelparam get ( nitro_service service ) throws Exception { iptunnelparam obj = new iptunnelparam ( ) ; iptunnelparam [ ] response = ( iptunnelparam [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; }
Use this API to fetch all the iptunnelparam resources that are configured on netscaler .
2,880
public static statobjects get ( nitro_service service ) throws Exception { statobjects obj = new statobjects ( ) ; statobjects [ ] response = ( statobjects [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; }
Use this API to fetch all the statistic objects resources that are available on netscaler .
2,881
public static lbmonitor_metric_binding [ ] get ( nitro_service service , String monitorname ) throws Exception { lbmonitor_metric_binding obj = new lbmonitor_metric_binding ( ) ; obj . set_monitorname ( monitorname ) ; lbmonitor_metric_binding response [ ] = ( lbmonitor_metric_binding [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch lbmonitor_metric_binding resources of given name .
2,882
public static long count ( nitro_service service , String monitorname ) throws Exception { lbmonitor_metric_binding obj = new lbmonitor_metric_binding ( ) ; obj . set_monitorname ( monitorname ) ; options option = new options ( ) ; option . set_count ( true ) ; lbmonitor_metric_binding response [ ] = ( lbmonitor_metric_binding [ ] ) obj . get_resources ( service , option ) ; if ( response != null ) { return response [ 0 ] . __count ; } return 0 ; }
Use this API to count lbmonitor_metric_binding resources configued on NetScaler .
2,883
public static server_binding get ( nitro_service service , String name ) throws Exception { server_binding obj = new server_binding ( ) ; obj . set_name ( name ) ; server_binding response = ( server_binding ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch server_binding resource of given name .
2,884
public static base_response update ( nitro_service client , aaacertparams resource ) throws Exception { aaacertparams updateresource = new aaacertparams ( ) ; updateresource . usernamefield = resource . usernamefield ; updateresource . groupnamefield = resource . groupnamefield ; updateresource . defaultauthenticationgroup = resource . defaultauthenticationgroup ; return updateresource . update_resource ( client ) ; }
Use this API to update aaacertparams .
2,885
public static base_response unset ( nitro_service client , aaacertparams resource , String [ ] args ) throws Exception { aaacertparams unsetresource = new aaacertparams ( ) ; return unsetresource . unset_resource ( client , args ) ; }
Use this API to unset the properties of aaacertparams resource . Properties that need to be unset are specified in args array .
2,886
public static aaacertparams get ( nitro_service service ) throws Exception { aaacertparams obj = new aaacertparams ( ) ; aaacertparams [ ] response = ( aaacertparams [ ] ) obj . get_resources ( service ) ; return response [ 0 ] ; }
Use this API to fetch all the aaacertparams resources that are configured on netscaler .
2,887
public static base_response add ( nitro_service client , cmpaction resource ) throws Exception { cmpaction addresource = new cmpaction ( ) ; addresource . name = resource . name ; addresource . cmptype = resource . cmptype ; addresource . deltatype = resource . deltatype ; return addresource . add_resource ( client ) ; }
Use this API to add cmpaction .
2,888
public static base_responses add ( nitro_service client , cmpaction resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { cmpaction addresources [ ] = new cmpaction [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { addresources [ i ] = new cmpaction ( ) ; addresources [ i ] . name = resources [ i ] . name ; addresources [ i ] . cmptype = resources [ i ] . cmptype ; addresources [ i ] . deltatype = resources [ i ] . deltatype ; } result = add_bulk_request ( client , addresources ) ; } return result ; }
Use this API to add cmpaction resources .
2,889
public static cmpaction [ ] get ( nitro_service service , options option ) throws Exception { cmpaction obj = new cmpaction ( ) ; cmpaction [ ] response = ( cmpaction [ ] ) obj . get_resources ( service , option ) ; return response ; }
Use this API to fetch all the cmpaction resources that are configured on netscaler .
2,890
public static cmpaction get ( nitro_service service , String name ) throws Exception { cmpaction obj = new cmpaction ( ) ; obj . set_name ( name ) ; cmpaction response = ( cmpaction ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch cmpaction resource of given name .
2,891
public static base_response delete ( nitro_service client , String name ) throws Exception { netbridge deleteresource = new netbridge ( ) ; deleteresource . name = name ; return deleteresource . delete_resource ( client ) ; }
Use this API to delete netbridge of given name .
2,892
public static netbridge [ ] get ( nitro_service service , options option ) throws Exception { netbridge obj = new netbridge ( ) ; netbridge [ ] response = ( netbridge [ ] ) obj . get_resources ( service , option ) ; return response ; }
Use this API to fetch all the netbridge resources that are configured on netscaler .
2,893
public static netbridge get ( nitro_service service , String name ) throws Exception { netbridge obj = new netbridge ( ) ; obj . set_name ( name ) ; netbridge response = ( netbridge ) obj . get_resource ( service ) ; return response ; }
Use this API to fetch netbridge resource of given name .
2,894
public static base_response change ( nitro_service client , nsaptlicense resource ) throws Exception { nsaptlicense updateresource = new nsaptlicense ( ) ; updateresource . id = resource . id ; updateresource . sessionid = resource . sessionid ; updateresource . bindtype = resource . bindtype ; updateresource . countavailable = resource . countavailable ; updateresource . licensedir = resource . licensedir ; return updateresource . perform_operation ( client , "update" ) ; }
Use this API to change nsaptlicense .
2,895
public static base_responses change ( nitro_service client , nsaptlicense resources [ ] ) throws Exception { base_responses result = null ; if ( resources != null && resources . length > 0 ) { nsaptlicense updateresources [ ] = new nsaptlicense [ resources . length ] ; for ( int i = 0 ; i < resources . length ; i ++ ) { updateresources [ i ] = new nsaptlicense ( ) ; updateresources [ i ] . id = resources [ i ] . id ; updateresources [ i ] . sessionid = resources [ i ] . sessionid ; updateresources [ i ] . bindtype = resources [ i ] . bindtype ; updateresources [ i ] . countavailable = resources [ i ] . countavailable ; updateresources [ i ] . licensedir = resources [ i ] . licensedir ; } result = perform_operation_bulk_request ( client , updateresources , "update" ) ; } return result ; }
Use this API to change nsaptlicense resources .
2,896
public static nsaptlicense [ ] get ( nitro_service service , nsaptlicense_args args ) throws Exception { nsaptlicense obj = new nsaptlicense ( ) ; options option = new options ( ) ; option . set_args ( nitro_util . object_to_string_withoutquotes ( args ) ) ; nsaptlicense [ ] response = ( nsaptlicense [ ] ) obj . get_resources ( service , option ) ; return response ; }
Use this API to fetch all the nsaptlicense resources that are configured on netscaler . This uses nsaptlicense_args which is a way to provide additional arguments while fetching the resources .
2,897
public static cacheglobal_cachepolicy_binding [ ] get ( nitro_service service ) throws Exception { cacheglobal_cachepolicy_binding obj = new cacheglobal_cachepolicy_binding ( ) ; cacheglobal_cachepolicy_binding response [ ] = ( cacheglobal_cachepolicy_binding [ ] ) obj . get_resources ( service ) ; return response ; }
Use this API to fetch a cacheglobal_cachepolicy_binding resources .
2,898
public static responderpolicy_stats [ ] get ( nitro_service service ) throws Exception { responderpolicy_stats obj = new responderpolicy_stats ( ) ; responderpolicy_stats [ ] response = ( responderpolicy_stats [ ] ) obj . stat_resources ( service ) ; return response ; }
Use this API to fetch the statistics of all responderpolicy_stats resources that are configured on netscaler .
2,899
public static responderpolicy_stats get ( nitro_service service , String name ) throws Exception { responderpolicy_stats obj = new responderpolicy_stats ( ) ; obj . set_name ( name ) ; responderpolicy_stats response = ( responderpolicy_stats ) obj . stat_resource ( service ) ; return response ; }
Use this API to fetch statistics of responderpolicy_stats resource of given name .