idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
135,200 | public Method findMethod ( String methodName , Class < ? > [ ] parameterTypes ) throws NoSuchMethodException { maybeLoadMethods ( ) ; List < Member > methodList = _methodMap . get ( methodName ) ; if ( methodList == null ) { throw new NoSuchMethodException ( "No method named " + _clazz . getName ( ) + "." + methodName ... | Returns the most specific public method in my target class that has the given name and accepts the number and type of parameters in the given Class array in a reflective invocation . |
135,201 | protected void maybeLoadConstructors ( ) { if ( _ctorList == null ) { _ctorList = new ArrayList < Member > ( ) ; Constructor < ? > [ ] ctors = _clazz . getConstructors ( ) ; for ( int i = 0 ; i < ctors . length ; ++ i ) { _ctorList . add ( ctors [ i ] ) ; _paramMap . put ( ctors [ i ] , ctors [ i ] . getParameterTypes ... | Loads up the data structures for my target class s constructors . |
135,202 | protected void maybeLoadMethods ( ) { if ( _methodMap == null ) { _methodMap = new HashMap < String , List < Member > > ( ) ; Method [ ] methods = _clazz . getMethods ( ) ; for ( int i = 0 ; i < methods . length ; ++ i ) { Method m = methods [ i ] ; String methodName = m . getName ( ) ; Class < ? > [ ] paramTypes = m .... | Loads up the data structures for my target class s methods . |
135,203 | public static < A , B > B foldLeft ( F < B , A > func , B zero , Iterable < ? extends A > values ) { for ( A value : values ) { zero = func . apply ( zero , value ) ; } return zero ; } | Left folds the supplied function over the supplied values using the supplied starting value . |
135,204 | public static < A > A reduceLeft ( F < A , A > func , Iterable < ? extends A > values ) { Iterator < ? extends A > iter = values . iterator ( ) ; A zero = iter . next ( ) ; while ( iter . hasNext ( ) ) { zero = func . apply ( zero , iter . next ( ) ) ; } return zero ; } | Reduces the supplied values using the supplied function with a left fold . |
135,205 | public static int sum ( int zero , Iterable < ? extends Number > values ) { for ( Number value : values ) { zero += value . intValue ( ) ; } return zero ; } | Sums the supplied collection of numbers to an int with a left to right fold . |
135,206 | public static long sum ( long zero , Iterable < ? extends Number > values ) { for ( Number value : values ) { zero += value . longValue ( ) ; } return zero ; } | Sums the supplied collection of numbers to a long with a left to right fold . |
135,207 | public static float sum ( float zero , Iterable < ? extends Number > values ) { for ( Number value : values ) { zero += value . floatValue ( ) ; } return zero ; } | Sums the supplied collection of numbers to a float with a left to right fold . |
135,208 | public static double sum ( double zero , Iterable < ? extends Number > values ) { for ( Number value : values ) { zero += value . doubleValue ( ) ; } return zero ; } | Sums the supplied collection of numbers to a double with a left to right fold . |
135,209 | public static BigInteger sum ( BigInteger zero , Iterable < ? extends BigInteger > values ) { for ( BigInteger value : values ) { zero = zero . add ( value ) ; } return zero ; } | Sums the supplied collection of numbers to a bigint with a left to right fold . |
135,210 | public static String truncate ( String text , int length , String append ) { return StringUtil . truncate ( text , length , append ) ; } | Truncates the supplied text at the specified length appending the specified elipsis indicator to the text if truncated . |
135,211 | public static String join ( String [ ] values , String sep ) { return StringUtil . join ( values , sep ) ; } | Joins the supplied strings with the given separator . |
135,212 | public static String copyright ( String holder , int startYear ) { Calendar cal = Calendar . getInstance ( ) ; int year = cal . get ( Calendar . YEAR ) ; return "© " + holder + " " + startYear + "-" + year ; } | Generates a copyright string for the specified copyright holder from the specified first year to the current year . |
135,213 | public void render ( Component host , RadialMenu menu , Graphics2D gfx , int x , int y ) { paint ( gfx , x , y , menu ) ; } | Renders this menu item at the specified location . |
135,214 | public void addObject ( int x , int y , Object object ) { Record record = new Record ( x , y , object ) ; if ( _size == 0 ) { _records [ _size ++ ] = record ; return ; } int ipoint = binarySearch ( x ) ; if ( _size >= _records . length ) { int nsize = _size * 2 ; Record [ ] records = new Record [ nsize ] ; System . arr... | Adds an object to the tracker . |
135,215 | public static int distance ( int x1 , int y1 , int x2 , int y2 ) { int dx = x1 - x2 , dy = y1 - y2 ; return ( int ) Math . sqrt ( dx * dx + dy * dy ) ; } | Computes the geometric distance between the supplied two points . |
135,216 | protected int binarySearch ( int x ) { int low = 0 ; int high = _size - 1 ; while ( low <= high ) { int mid = ( low + high ) >>> 1 ; int cmp = ( _records [ mid ] . x - x ) ; if ( cmp < 0 ) { low = mid + 1 ; } else if ( cmp > 0 ) { high = mid - 1 ; } else { return mid ; } } return low ; } | Returns the index of a record with the specified x coordinate or a value representing the index where such a record would be inserted while preserving the sort order of the array . Doesn t work if the records array contains zero elements . |
135,217 | public static String compose ( String key , Object ... args ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( key ) ; buf . append ( '|' ) ; for ( int i = 0 ; i < args . length ; i ++ ) { if ( i > 0 ) { buf . append ( '|' ) ; } String arg = ( args [ i ] == null ) ? "" : String . valueOf ( args [ i ] ) ; in... | Composes a message key with an array of arguments . The message can subsequently be decomposed and translated without prior knowledge of how many arguments were provided . |
135,218 | public static String unescape ( String value ) { int bsidx = value . indexOf ( '\\' ) ; if ( bsidx == - 1 ) { return value ; } StringBuilder buf = new StringBuilder ( ) ; int vlength = value . length ( ) ; for ( int ii = 0 ; ii < vlength ; ii ++ ) { char ch = value . charAt ( ii ) ; if ( ch != '\\' || ii == vlength - 1... | Unescapes characters that are escaped in a call to compose . |
135,219 | public static String [ ] decompose ( String compoundKey ) { String [ ] args = compoundKey . split ( "\\|" ) ; for ( int ii = 0 ; ii < args . length ; ii ++ ) { args [ ii ] = unescape ( args [ ii ] ) ; } return args ; } | Decomposes a compound key into its constituent parts . Arguments that were tainted during composition will remain tainted . |
135,220 | public static String qualify ( String bundle , String key ) { if ( bundle . indexOf ( QUAL_PREFIX ) != - 1 || bundle . indexOf ( QUAL_SEP ) != - 1 ) { String errmsg = "Message bundle may not contain '" + QUAL_PREFIX + "' or '" + QUAL_SEP + "' [bundle=" + bundle + ", key=" + key + "]" ; throw new IllegalArgumentExceptio... | Returns a fully qualified message key which when translated by some other bundle will know to resolve and utilize the supplied bundle to translate this particular key . |
135,221 | public static String getBundle ( String qualifiedKey ) { if ( ! qualifiedKey . startsWith ( QUAL_PREFIX ) ) { throw new IllegalArgumentException ( qualifiedKey + " is not a fully qualified message key." ) ; } int qsidx = qualifiedKey . indexOf ( QUAL_SEP ) ; if ( qsidx == - 1 ) { throw new IllegalArgumentException ( qu... | Returns the bundle name from a fully qualified message key . |
135,222 | public static String getUnqualifiedKey ( String qualifiedKey ) { if ( ! qualifiedKey . startsWith ( QUAL_PREFIX ) ) { throw new IllegalArgumentException ( qualifiedKey + " is not a fully qualified message key." ) ; } int qsidx = qualifiedKey . indexOf ( QUAL_SEP ) ; if ( qsidx == - 1 ) { throw new IllegalArgumentExcept... | Returns the unqualified portion of the key from a fully qualified message key . |
135,223 | public int createUser ( Username username , Password password , String realname , String email , int siteId ) throws UserExistsException , PersistenceException { User user = new User ( ) ; user . setDirtyMask ( _utable . getFieldMask ( ) ) ; populateUser ( user , username , password , realname , email , siteId ) ; retu... | Requests that a new user be created in the repository . |
135,224 | public User loadUserBySession ( String sessionKey ) throws PersistenceException { User user = load ( _utable , "sessions" , "where authcode = '" + sessionKey + "' " + "AND sessions.userId = users.userId" ) ; if ( user != null ) { user . setDirtyMask ( _utable . getFieldMask ( ) ) ; } return user ; } | Looks up a user by a session identifier . |
135,225 | public HashIntMap < User > loadUsersFromId ( int [ ] userIds ) throws PersistenceException { HashIntMap < User > data = new HashIntMap < User > ( ) ; if ( userIds . length > 0 ) { String query = "where userId in (" + genIdString ( userIds ) + ")" ; for ( User user : loadAll ( _utable , query ) ) { user . setDirtyMask (... | Looks up users by userid |
135,226 | public ArrayList < User > lookupUsersByEmail ( String email ) throws PersistenceException { return loadAll ( _utable , "where email = " + JDBCUtil . escape ( email ) ) ; } | Lookup a user by email address something that is not efficient and should really only be done by site admins attempting to look up a user record . |
135,227 | public ArrayList < User > lookupUsersWhere ( final String where ) throws PersistenceException { ArrayList < User > users = loadAll ( _utable , where ) ; for ( User user : users ) { user . setDirtyMask ( _utable . getFieldMask ( ) ) ; } return users ; } | Looks up a list of users that match an arbitrary query . Care should be taken in constructing these queries as the user table is likely to be large and a query that does not make use of indices could be very slow . |
135,228 | public boolean updateUser ( final User user ) throws PersistenceException { if ( ! user . getDirtyMask ( ) . isModified ( ) ) { return false ; } update ( _utable , user , user . getDirtyMask ( ) ) ; return true ; } | Updates a user that was previously fetched from the repository . Only fields that have been modified since it was loaded will be written to the database and those fields will subsequently be marked clean once again . |
135,229 | public void deleteUser ( final User user ) throws PersistenceException { if ( user . isDeleted ( ) ) { return ; } executeUpdate ( new Operation < Object > ( ) { public Object invoke ( Connection conn , DatabaseLiaison liaison ) throws PersistenceException , SQLException { FieldMask mask = _utable . getFieldMask ( ) ; m... | Delete the users account such that they can no longer access it however we do not delete the record from the db . The name is changed such that the original name has XX = FOO if the name were FOO originally . If we have to lop off any of the name to get our prefix to fit we use a minus sign instead of a equals side . T... |
135,230 | public String registerSession ( User user , int expireDays ) throws PersistenceException { final String query = "select authcode from sessions where userId = " + user . userId ; String authcode = execute ( new Operation < String > ( ) { public String invoke ( Connection conn , DatabaseLiaison liaison ) throws Persisten... | Creates a new session for the specified user and returns the randomly generated session identifier for that session . If a session entry already exists for the specified user it will be reused . |
135,231 | public boolean refreshSession ( String sessionKey , int expireDays ) throws PersistenceException { Calendar cal = Calendar . getInstance ( ) ; cal . add ( Calendar . DATE , expireDays ) ; Date expires = new Date ( cal . getTime ( ) . getTime ( ) ) ; return ( update ( "update sessions set expires = '" + expires + "' " +... | Validates that the supplied session key is still valid and if so refreshes it for the specified number of days . |
135,232 | public String [ ] loadAllRealNames ( ) throws PersistenceException { final ArrayList < String > names = new ArrayList < String > ( ) ; execute ( new Operation < Object > ( ) { public Object invoke ( Connection conn , DatabaseLiaison liaison ) throws PersistenceException , SQLException { Statement stmt = conn . createSt... | Returns an array with the real names of every user in the system . |
135,233 | protected void populateUser ( User user , Username name , Password pass , String realname , String email , int siteId ) { user . username = name . getUsername ( ) ; user . setPassword ( pass ) ; user . setRealName ( realname ) ; user . setEmail ( email ) ; user . created = new Date ( System . currentTimeMillis ( ) ) ; ... | Configures the supplied user record with the provided information in preparation for inserting the record into the database for the first time . |
135,234 | protected int insertUser ( final User user ) throws UserExistsException , PersistenceException { executeUpdate ( new Operation < Object > ( ) { public Object invoke ( Connection conn , DatabaseLiaison liaison ) throws PersistenceException , SQLException { try { _utable . insert ( conn , user ) ; user . userId = liaison... | Inserts the supplied user record into the user database assigning it a userid in the process which is returned . |
135,235 | protected User loadUserWhere ( String where ) throws PersistenceException { User user = load ( _utable , where ) ; if ( user != null ) { user . setDirtyMask ( _utable . getFieldMask ( ) ) ; } return user ; } | Loads up a user record that matches the specified where clause . Returns null if no record matches . |
135,236 | public static synchronized void setToggling ( AbstractButton b ) { if ( _toggler == null ) { _toggler = new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { AbstractButton but = ( AbstractButton ) event . getSource ( ) ; but . setSelected ( ! but . isSelected ( ) ) ; } } ; } b . addActionListene... | Set the specified button such that it alternates between being selected and not whenever it is pushed . |
135,237 | public static ActionListener cycleToProperty ( final String property , final PrefsConfig config , AbstractButton button , final int [ ] values ) { ActionListener al = new ActionListener ( ) { public void actionPerformed ( ActionEvent event ) { int oldval = config . getValue ( property , values [ 0 ] ) ; int newidx = ( ... | Configure the specified button to cause the specified property to cycle through the specified values whenever the button is pressed . |
135,238 | public boolean createTableIfMissing ( Connection conn , String table , List < String > columns , List < ColumnDefinition > defns , List < List < String > > uniqueColumns , List < String > pkColumns ) throws SQLException { if ( columns . size ( ) != defns . size ( ) ) { throw new IllegalArgumentException ( "Column name ... | it may be that uniqueness should be removed from ColumnDefinition . |
135,239 | private boolean canAddTableToFromClause ( Table table , Map < Table , List < JoinCriteria > > destMap , List < Table > allTables ) { if ( ( table == null ) || allTables . contains ( table ) ) { return false ; } if ( ( destMap . get ( table ) != null ) && ( destMap . get ( table ) . size ( ) > 0 ) ) { List < JoinCriteri... | outer joins are written in Table class |
135,240 | public static < T > void sort ( T [ ] a , Comparator < ? super T > comp ) { sort ( a , 0 , a . length - 1 , comp ) ; } | Sorts the supplied array of objects from least to greatest using the supplied comparator . |
135,241 | public static < T extends Comparable < ? super T > > void sort ( T [ ] a ) { sort ( a , 0 , a . length - 1 ) ; } | Sorts the supplied array of comparable objects from least to greatest . |
135,242 | public static < T > void rsort ( T [ ] a , Comparator < ? super T > comp ) { rsort ( a , 0 , a . length - 1 , comp ) ; } | Sorts the supplied array of objects from greatest to least using the supplied comparator . |
135,243 | public static < T extends Comparable < ? super T > > void rsort ( T [ ] a ) { rsort ( a , 0 , a . length - 1 ) ; } | Sorts the supplied array of comparable objects from greatest to least . |
135,244 | public static < T > void sort ( T [ ] a , int lo0 , int hi0 , Comparator < ? super T > comp ) { if ( hi0 <= lo0 ) { return ; } T t ; if ( hi0 - lo0 == 1 ) { if ( comp . compare ( a [ hi0 ] , a [ lo0 ] ) < 0 ) { t = a [ lo0 ] ; a [ lo0 ] = a [ hi0 ] ; a [ hi0 ] = t ; } return ; } T mid = a [ ( lo0 + hi0 ) >>> 1 ] ; int ... | Sorts the specified subset of the supplied array from least to greatest using the supplied comparator . |
135,245 | public static < T extends Comparable < ? super T > > void sort ( T [ ] a , int lo0 , int hi0 ) { if ( hi0 <= lo0 ) { return ; } T t ; if ( hi0 - lo0 == 1 ) { if ( a [ lo0 ] . compareTo ( a [ hi0 ] ) > 0 ) { t = a [ lo0 ] ; a [ lo0 ] = a [ hi0 ] ; a [ hi0 ] = t ; } return ; } T mid = a [ ( lo0 + hi0 ) >>> 1 ] ; int lo =... | Sorts the specified subset of the supplied array of comparables from least to greatest using the supplied comparator . |
135,246 | public static < T extends Comparable < ? super T > > void sort ( List < T > a ) { sort ( a , new Comparator < T > ( ) { public int compare ( T o1 , T o2 ) { if ( o1 == o2 ) { return 0 ; } else if ( o1 == null ) { return 1 ; } else if ( o2 == null ) { return - 1 ; } return o1 . compareTo ( o2 ) ; } } ) ; } | Sort the elements in the specified List according to their natural order . |
135,247 | public static < T > void sort ( List < T > a , Comparator < ? super T > comp ) { sort ( a , 0 , a . size ( ) - 1 , comp ) ; } | Sort the elements in the specified List according to the ordering imposed by the specified Comparator . |
135,248 | public static < T > void rsort ( List < T > a , Comparator < ? super T > comp ) { sort ( a , Collections . reverseOrder ( comp ) ) ; } | Sort the elements in the specified List according to the reverse ordering imposed by the specified Comparator . |
135,249 | public static < T > void sort ( List < T > a , int lo0 , int hi0 , Comparator < ? super T > comp ) { if ( hi0 <= lo0 ) { return ; } T e1 , e2 ; if ( hi0 - lo0 == 1 ) { e1 = a . get ( lo0 ) ; e2 = a . get ( hi0 ) ; if ( comp . compare ( e2 , e1 ) < 0 ) { a . set ( hi0 , e1 ) ; a . set ( lo0 , e2 ) ; } return ; } T mid =... | Sort a subset of the elements in the specified List according to the ordering imposed by the specified Comparator . |
135,250 | @ ReplacedBy ( "com.google.common.collect.Iterators#concat() or com.google.common.collect.Iterables#concat()" ) public static < T > Iterator < T > getMetaIterator ( Iterable < Iterator < T > > metaIterable ) { return new MetaIterator < T > ( metaIterable ) ; } | Returns an Iterator that iterates over all the elements contained within the Iterators within the specified Iterable . |
135,251 | public static < T extends Comparable < ? super T > > Iterator < T > getSortedIterator ( Iterable < T > coll ) { return getSortedIterator ( coll . iterator ( ) , new Comparator < T > ( ) { public int compare ( T o1 , T o2 ) { if ( o1 == o2 ) { return 0 ; } else if ( o1 == null ) { return 1 ; } else if ( o2 == null ) { r... | Get an Iterator over the supplied Collection that returns the elements in their natural order . |
135,252 | public static < T > Iterator < T > getSortedIterator ( Iterable < T > coll , Comparator < T > comparator ) { return getSortedIterator ( coll . iterator ( ) , comparator ) ; } | Get an Iterator over the supplied Collection that returns the elements in the order dictated by the supplied Comparator . |
135,253 | public static < T extends Comparable < ? super T > > Iterator < T > getSortedIterator ( Iterator < T > itr ) { return getSortedIterator ( itr , new Comparator < T > ( ) { public int compare ( T o1 , T o2 ) { if ( o1 == o2 ) { return 0 ; } else if ( o1 == null ) { return 1 ; } else if ( o2 == null ) { return - 1 ; } ret... | Get an Iterator that returns the same elements returned by the supplied Iterator but in their natural order . |
135,254 | public static < T > Iterator < T > getSortedIterator ( Iterator < T > itr , Comparator < T > comparator ) { SortableArrayList < T > list = new SortableArrayList < T > ( ) ; CollectionUtil . addAll ( list , itr ) ; list . sort ( comparator ) ; return getUnmodifiableIterator ( list ) ; } | Get an Iterator that returns the same elements returned by the supplied Iterator but in the order dictated by the supplied Comparator . |
135,255 | public static < T > Iterator < T > getRandomIterator ( Iterable < T > c ) { return getRandomIterator ( c . iterator ( ) ) ; } | Get an Iterator over the supplied Iterable that returns the elements in a completely random order . Normally Iterators return elements in an undefined order but it is usually the same between different invocations as long as the underlying Iterable has not changed . This method mixes things up . |
135,256 | public static < T > Iterator < T > getRandomIterator ( Iterator < T > itr ) { ArrayList < T > list = new ArrayList < T > ( ) ; CollectionUtil . addAll ( list , itr ) ; java . util . Collections . shuffle ( list ) ; return getUnmodifiableIterator ( list ) ; } | Get an Iterator that returns the same elements returned by the supplied Iterator but in a completely random order . |
135,257 | public static < T > Iterator < T > getUnmodifiableIterator ( Iterable < T > c ) { return getUnmodifiableIterator ( c . iterator ( ) ) ; } | Get an Iterator that returns the elements in the supplied Iterable but blocks removal . |
135,258 | @ ReplacedBy ( "com.google.common.collect.Iterators#unmodifiableIterator()" ) public static < T > Iterator < T > getUnmodifiableIterator ( final Iterator < T > itr ) { return new Iterator < T > ( ) { public boolean hasNext ( ) { return itr . hasNext ( ) ; } public T next ( ) { return itr . next ( ) ; } public void remo... | Get an iterator that returns the same elements as the supplied iterator but blocks removal . |
135,259 | public static Object unmarshal ( Class < ? > type , String source ) throws Exception { if ( type . isEnum ( ) ) { @ SuppressWarnings ( "unchecked" ) Class < Dummy > etype = ( Class < Dummy > ) type ; return Enum . valueOf ( etype , source ) ; } Parser parser = _parsers . get ( type ) ; if ( parser == null ) { throw new... | Attempts to convert the specified value to an instance of the specified object type . |
135,260 | protected final void rangeCheck ( int index , boolean insert ) { if ( ( index < 0 ) || ( insert ? ( index > _size ) : ( index >= _size ) ) ) { throw new IndexOutOfBoundsException ( "Index: " + index + ", Size: " + _size ) ; } } | Check the range of a passed - in index to make sure it s valid . |
135,261 | public Class getValueClass ( ) { if ( valueClass == null ) { if ( valueClassName != null ) { try { valueClass = Class . forName ( valueClassName ) ; } catch ( ClassNotFoundException e ) { throw new RuntimeException ( e ) ; } } } return valueClass ; } | Get java class object for the parameter value |
135,262 | public void setPreviewValue ( String previewValue ) { if ( ! isProcedureParameter && ( previewValue != null ) ) { throw new IllegalArgumentException ( "Parameter '" + name + "' is not a procedure parameter." ) ; } this . previewValue = previewValue ; } | Set preview value for procedure parameter Allows to set null for any type |
135,263 | public String getValue ( String name , String defval ) { return _props . getProperty ( name , defval ) ; } | Fetches and returns the value for the specified configuration property . If the value is not specified in the associated properties file the supplied default value is returned instead . |
135,264 | public Object instantiateValue ( String name , String defcname ) throws Exception { return Class . forName ( getValue ( name , defcname ) ) . newInstance ( ) ; } | Looks up the specified string - valued configuration entry loads the class with that name and instantiates a new instance of that class which is returned . |
135,265 | public Iterator < String > keys ( ) { HashSet < String > matches = new HashSet < String > ( ) ; enumerateKeys ( matches ) ; return matches . iterator ( ) ; } | Returns an iterator that returns all of the configuration keys in this config object . |
135,266 | private void put ( PrintStream p , String s , int column , int colSpan , BandElement bandElement ) { if ( s == null ) { put ( p , "" , column , colSpan , bandElement ) ; return ; } int size = 0 ; if ( colSpan > 1 ) { for ( int i = column ; i < column + colSpan ; i ++ ) { size += columnWidth [ i ] ; } } else { size = co... | Write one tsv field to the file followed by a separator unless it is the last field on the line . Lead and trailing blanks will be removed . |
135,267 | protected static PropRecord parseMetaData ( String path , URL sourceURL ) throws IOException { InputStream input = sourceURL . openStream ( ) ; BufferedReader bin = new BufferedReader ( new InputStreamReader ( input ) ) ; try { PropRecord record = new PropRecord ( path , sourceURL ) ; boolean started = false ; String l... | Performs simple processing of the supplied input stream to obtain inheritance metadata from the properties file . |
135,268 | public static InputStream getStream ( String path , ClassLoader loader ) { InputStream in = getResourceAsStream ( path , loader ) ; if ( in != null ) { return in ; } try { ClassLoader sysloader = ClassLoader . getSystemClassLoader ( ) ; if ( sysloader != loader ) { return getResourceAsStream ( path , loader ) ; } } cat... | Returns an input stream referencing a file that exists somewhere in the classpath . |
135,269 | public boolean waitForResponse ( ) throws TimeoutException { if ( _success == 0 ) { synchronized ( this ) { try { if ( _timeout == NO_TIMEOUT ) { wait ( ) ; } else { wait ( 1000L * _timeout ) ; } if ( _success == 0 ) { throw new TimeoutException ( ) ; } } catch ( InterruptedException ie ) { throw ( TimeoutException ) n... | Blocks waiting for the response . |
135,270 | public static final < T > T silenceDeepCopy ( T object ) { try { return deepCopy ( object ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } } | Throws a RuntimeException if an exception occurs . |
135,271 | public final boolean isModified ( ) { int mcount = _modified . length ; for ( int ii = 0 ; ii < mcount ; ii ++ ) { if ( _modified [ ii ] ) { return true ; } } return false ; } | Returns true if any of the fields in this mask are modified . |
135,272 | public final boolean isModified ( String fieldName ) { Integer index = _descripMap . get ( fieldName ) ; if ( index == null ) { throw new IllegalArgumentException ( "Field not in mask: " + fieldName ) ; } return _modified [ index . intValue ( ) ] ; } | Returns true if the field with the specified name is modifed . |
135,273 | public final boolean onlySubsetModified ( Set < String > fieldSet ) { for ( String field : _descripMap . keySet ( ) ) { if ( isModified ( field ) && ( ! fieldSet . contains ( field ) ) ) { return false ; } } return true ; } | Returns true only if the set of modified fields is a subset of the fields specified . |
135,274 | public void setModified ( String fieldName ) { Integer index = _descripMap . get ( fieldName ) ; if ( index == null ) { throw new IllegalArgumentException ( "Field not in mask: " + fieldName ) ; } _modified [ index . intValue ( ) ] = true ; } | Marks the specified field as modified . |
135,275 | public void addValue ( int value ) { if ( value < _minValue ) { _buckets [ 0 ] ++ ; } else if ( value >= _maxValue ) { _buckets [ _buckets . length - 1 ] ++ ; } else { _buckets [ ( value - _minValue ) / _bucketWidth ] ++ ; } _count ++ ; } | Registers a value with this histogram . |
135,276 | public String summarize ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( _count ) . append ( ":" ) ; for ( int ii = 0 ; ii < _buckets . length ; ii ++ ) { if ( ii > 0 ) { buf . append ( "," ) ; } buf . append ( _buckets [ ii ] ) ; } return buf . toString ( ) ; } | Generates a terse summary of the count and contents of the values in this histogram . |
135,277 | public < E extends T > Iterator < E > filter ( final Iterator < E > input ) { return new Iterator < E > ( ) { public boolean hasNext ( ) { return _found || findNext ( ) ; } public E next ( ) { if ( _found || findNext ( ) ) { _found = false ; return _last ; } else { throw new NoSuchElementException ( ) ; } } public void... | Return a new iterator that contains only matching elements from the input iterator . |
135,278 | public < E extends T > void filter ( Collection < E > coll ) { for ( Iterator < E > itr = coll . iterator ( ) ; itr . hasNext ( ) ; ) { if ( ! isMatch ( itr . next ( ) ) ) { itr . remove ( ) ; } } } | Remove non - matching elements from the specified collection . |
135,279 | public < E extends T > Iterable < E > createView ( final Iterable < E > input ) { return new Iterable < E > ( ) { public Iterator < E > iterator ( ) { return filter ( input . iterator ( ) ) ; } } ; } | Create an Iterable view of the specified Iterable that only contains elements that match the predicate . This Iterable can be iterated over at any time in the future to view the current predicate - matching elements of the input Iterable . |
135,280 | public < E extends T > Collection < E > createView ( final Collection < E > input ) { return new AbstractCollection < E > ( ) { public int size ( ) { int size = 0 ; for ( Iterator < E > iter = iterator ( ) ; iter . hasNext ( ) ; ) { iter . next ( ) ; size ++ ; } return size ; } public boolean add ( E element ) { return... | Create a view of the specified collection that only contains elements that match the predicate . This collection can be examined at any time in the future to view the current predicate - matching elements of the input collection . |
135,281 | public static Builder at ( long millis ) { Calendar calendar = Calendar . getInstance ( ) ; calendar . setTimeInMillis ( millis ) ; return with ( calendar ) ; } | Returns a fluent wrapper around a calendar configured with the specified time . |
135,282 | public static Builder at ( int year , int month , int day ) { Calendar calendar = Calendar . getInstance ( ) ; calendar . set ( year , month , day ) ; return with ( calendar ) . zeroTime ( ) ; } | Returns a fluent wrapper around a calendar configured to zero milliseconds after midnight on the specified day in the specified month and year . |
135,283 | public static Builder in ( TimeZone zone , Locale locale ) { return with ( Calendar . getInstance ( zone , locale ) ) ; } | Returns a fluent wrapper around a calendar for the specifed time zone and locale . |
135,284 | public RadialMenuItem addMenuItem ( String command , String label , Image icon , Predicate predicate ) { RadialMenuItem item = new RadialMenuItem ( command , label , new ImageIcon ( icon ) , predicate ) ; addMenuItem ( item ) ; return item ; } | Adds a menu item to the menu . The menu should not currently be active . |
135,285 | public boolean removeMenuItem ( String command ) { int icount = _items . size ( ) ; for ( int i = 0 ; i < icount ; i ++ ) { RadialMenuItem item = _items . get ( i ) ; if ( item . command . equals ( command ) ) { _items . remove ( i ) ; return true ; } } return false ; } | Removes the first menu item that matches the specified command from this menu . |
135,286 | public void deactivate ( ) { if ( _host != null ) { Component comp = _host . getComponent ( ) ; comp . removeMouseListener ( this ) ; comp . removeMouseMotionListener ( this ) ; if ( _hijacker != null ) { _hijacker . release ( ) ; _hijacker = null ; } _host . menuDeactivated ( this ) ; repaint ( ) ; } _host = null ; _t... | Deactivates the menu . |
135,287 | public void render ( Graphics2D gfx ) { Component host = _host . getComponent ( ) ; int x = _bounds . x , y = _bounds . y ; if ( _centerLabel != null ) { _centerLabel . paint ( gfx , x + _centerLabel . closedBounds . x , y + _centerLabel . closedBounds . y , this ) ; } int icount = _items . size ( ) ; for ( int i = 0 ;... | Renders the current configuration of this menu . |
135,288 | protected void repaint ( ) { _host . repaintRect ( _bounds . x , _bounds . y , _bounds . width + 1 , _bounds . height + 1 ) ; } | Requests that our host component repaint the part of itself that we occupy . |
135,289 | public static String currency ( double value , Locale locale ) { return currency ( value , NumberFormat . getCurrencyInstance ( locale ) ) ; } | Converts a number representing currency in the specified locale to a displayable string . |
135,290 | protected < T > int update ( final Table < T > table , final T object , final FieldMask mask ) throws PersistenceException { return executeUpdate ( new Operation < Integer > ( ) { public Integer invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { return table . update ( con... | Updates fields specified by the supplied field mask in the supplied object in the specified table . |
135,291 | protected < T > ArrayList < T > loadAll ( final Table < T > table , final String query ) throws PersistenceException { return execute ( new Operation < ArrayList < T > > ( ) { public ArrayList < T > invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { return table . select (... | Loads all objects from the specified table that match the supplied query . |
135,292 | protected < T > ArrayList < T > loadAllByExample ( final Table < T > table , final T example ) throws PersistenceException { return execute ( new Operation < ArrayList < T > > ( ) { public ArrayList < T > invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { return table . qu... | Loads all objects from the specified table that match the supplied example . |
135,293 | protected < T > int store ( final Table < T > table , final T object ) throws PersistenceException { return executeUpdate ( new Operation < Integer > ( ) { public Integer invoke ( Connection conn , DatabaseLiaison liaison ) throws SQLException , PersistenceException { if ( table . update ( conn , object ) == 0 ) { tabl... | First attempts to update the supplied object and if that modifies zero rows inserts the object into the specified table . The table must be configured to store items of the supplied type . |
135,294 | public String fixedText ( String name , String extra , Object value ) { return fixedInput ( "text" , name , value , extra ) ; } | Creates a text input field with the specified name and the specified extra arguments and the specified value . |
135,295 | public String submitExtra ( String name , String text , String extra ) { return fixedInput ( "submit" , name , text , extra ) ; } | Constructs a submit element with the specified parameter name and the specified button text with the specified extra text . |
135,296 | public String imageSubmit ( String name , String value , String imagePath ) { return fixedInput ( "image" , name , value , "src=\"" + imagePath + "\"" ) ; } | Constructs a image submit element with the specified parameter name and image path . |
135,297 | public String button ( String name , String text , String extra ) { return fixedInput ( "button" , name , text , extra ) ; } | Constructs a button input element with the specified parameter name the specified button text and the specified extra text . |
135,298 | public String hidden ( String name , Object defaultValue ) { return fixedHidden ( name , getValue ( name , defaultValue ) ) ; } | Constructs a hidden element with the specified parameter name where the value is extracted from the appropriate request parameter unless there is no value in which case the supplied default value is used . |
135,299 | public String checkbox ( String name , boolean defaultValue ) { String value = getParameter ( name ) ; return fixedCheckbox ( name , ( value == null ) ? defaultValue : ! value . equals ( "" ) ) ; } | Constructs a checkbox input field with the specified name and default value . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.