idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
8,600
public static long getNextMidnight ( Time recycle , long theTime , String tz ) { if ( recycle == null ) { recycle = new Time ( ) ; } recycle . timezone = tz ; recycle . set ( theTime ) ; recycle . monthDay ++ ; recycle . hour = 0 ; recycle . minute = 0 ; recycle . second = 0 ; return recycle . normalize ( true ) ; }
Finds and returns the next midnight after theTime in milliseconds UTC
8,601
public static void checkForDuplicateNames ( Map < String , Boolean > isDuplicateName , Cursor cursor , int nameIndex ) { isDuplicateName . clear ( ) ; cursor . moveToPosition ( - 1 ) ; while ( cursor . moveToNext ( ) ) { String displayName = cursor . getString ( nameIndex ) ; if ( displayName != null ) { isDuplicateNam...
Scan through a cursor of calendars and check if names are duplicated . This travels a cursor containing calendar display names and fills in the provided map with whether or not each name is repeated .
8,602
public static int getDisplayColorFromColor ( int color ) { if ( ! isJellybeanOrLater ( ) ) { return color ; } float [ ] hsv = new float [ 3 ] ; Color . colorToHSV ( color , hsv ) ; hsv [ 1 ] = Math . min ( hsv [ 1 ] * SATURATION_ADJUST , 1.0f ) ; hsv [ 2 ] = hsv [ 2 ] * INTENSITY_ADJUST ; return Color . HSVToColor ( hs...
For devices with Jellybean or later darkens the given color to ensure that white text is clearly visible on top of it . For devices prior to Jellybean does nothing as the sync adapter handles the color change .
8,603
public static int getDeclinedColorFromColor ( int color ) { int bg = 0xffffffff ; int a = DECLINED_EVENT_ALPHA ; int r = ( ( ( color & 0x00ff0000 ) * a ) + ( ( bg & 0x00ff0000 ) * ( 0xff - a ) ) ) & 0xff000000 ; int g = ( ( ( color & 0x0000ff00 ) * a ) + ( ( bg & 0x0000ff00 ) * ( 0xff - a ) ) ) & 0x00ff0000 ; int b = (...
white . The result is the color that should be used for declined events .
8,604
private static void weaveDNAStrands ( LinkedList < DNASegment > segments , int firstJulianDay , HashMap < Integer , DNAStrand > strands , int top , int bottom , int [ ] dayXs ) { Iterator < DNAStrand > strandIterator = strands . values ( ) . iterator ( ) ; while ( strandIterator . hasNext ( ) ) { DNAStrand strand = str...
list of points to draw
8,605
private static int getPixelOffsetFromMinutes ( int minute , int workDayHeight , int remainderHeight ) { int y ; if ( minute < WORK_DAY_START_MINUTES ) { y = minute * remainderHeight / WORK_DAY_START_MINUTES ; } else if ( minute < WORK_DAY_END_MINUTES ) { y = remainderHeight + ( minute - WORK_DAY_START_MINUTES ) * workD...
Compute a pixel offset from the top for a given minute from the work day height and the height of the top area .
8,606
private static DNAStrand getOrCreateStrand ( HashMap < Integer , DNAStrand > strands , int color ) { DNAStrand strand = strands . get ( color ) ; if ( strand == null ) { strand = new DNAStrand ( ) ; strand . color = color ; strand . count = 0 ; strands . put ( strand . color , strand ) ; } return strand ; }
Try to get a strand of the given color . Create it if it doesn t exist .
8,607
public static void setUpSearchView ( SearchView view , Activity act ) { SearchManager searchManager = ( SearchManager ) act . getSystemService ( Context . SEARCH_SERVICE ) ; view . setSearchableInfo ( searchManager . getSearchableInfo ( act . getComponentName ( ) ) ) ; view . setQueryRefinementEnabled ( true ) ; }
This sets up a search view to use Calendar s search suggestions provider and to allow refining the search .
8,608
public static void setMidnightUpdater ( Handler h , Runnable r , String timezone ) { if ( h == null || r == null || timezone == null ) { return ; } long now = System . currentTimeMillis ( ) ; Time time = new Time ( timezone ) ; time . set ( now ) ; long runInMillis = ( 24 * 3600 - time . hour * 3600 - time . minute * 6...
do run the runnable
8,609
public static void resetMidnightUpdater ( Handler h , Runnable r ) { if ( h == null || r == null ) { return ; } h . removeCallbacks ( r ) ; }
Stop the midnight update thread
8,610
public static String getDisplayedTimezone ( long startMillis , String localTimezone , String eventTimezone ) { String tzDisplay = null ; if ( ! TextUtils . equals ( localTimezone , eventTimezone ) ) { TimeZone tz = TimeZone . getTimeZone ( localTimezone ) ; if ( tz == null || tz . getID ( ) . equals ( "GMT" ) ) { tzDis...
Returns the timezone to display in the event info if the local timezone is different from the event timezone . Otherwise returns null .
8,611
private static boolean singleDayEvent ( long startMillis , long endMillis , long localGmtOffset ) { if ( startMillis == endMillis ) { return true ; } int startDay = Time . getJulianDay ( startMillis , localGmtOffset ) ; int endDay = Time . getJulianDay ( endMillis - 1 , localGmtOffset ) ; return startDay == endDay ; }
Returns whether the specified time interval is in a single day .
8,612
private static int isTodayOrTomorrow ( Resources r , long dayMillis , long currentMillis , long localGmtOffset ) { int startDay = Time . getJulianDay ( dayMillis , localGmtOffset ) ; int currentDay = Time . getJulianDay ( currentMillis , localGmtOffset ) ; int days = startDay - currentDay ; if ( days == 1 ) { return TO...
Returns TODAY or TOMORROW if applicable . Otherwise returns NONE .
8,613
public static Intent createEmailAttendeesIntent ( Resources resources , String eventTitle , String body , List < String > toEmails , List < String > ccEmails , String ownerAccount ) { List < String > toList = toEmails ; List < String > ccList = ccEmails ; if ( toEmails . size ( ) <= 0 ) { if ( ccEmails . size ( ) <= 0 ...
Create an intent for emailing attendees of an event .
8,614
public static String getVersionCode ( Context context ) { if ( sVersion == null ) { try { sVersion = context . getPackageManager ( ) . getPackageInfo ( context . getPackageName ( ) , 0 ) . versionName ; } catch ( PackageManager . NameNotFoundException e ) { Log . e ( TAG , "Error finding package " + context . getApplic...
Return the app version code .
8,615
private static int findNanpMatchEnd ( CharSequence text , int startPos ) { if ( text . length ( ) > startPos + 4 && text . subSequence ( startPos , startPos + 4 ) . toString ( ) . equalsIgnoreCase ( "tel:" ) ) { startPos += 4 ; } int endPos = text . length ( ) ; int curPos = startPos ; int foundDigits = 0 ; char firstD...
Checks to see if there is a valid phone number in the input starting at the specified offset . If so the index of the last character + 1 is returned . The input is assumed to begin with a non - whitespace character .
8,616
private static boolean spanWillOverlap ( Spannable spanText , URLSpan [ ] spanList , int start , int end ) { if ( start == end ) { return false ; } for ( URLSpan span : spanList ) { int existingStart = spanText . getSpanStart ( span ) ; int existingEnd = spanText . getSpanEnd ( span ) ; if ( ( start >= existingStart &&...
Determines whether a new span at [ start end ) will overlap with any existing span .
8,617
private static int dayToUtilDay ( int day ) { switch ( day ) { case EventRecurrence . SU : return Calendar . SUNDAY ; case EventRecurrence . MO : return Calendar . MONDAY ; case EventRecurrence . TU : return Calendar . TUESDAY ; case EventRecurrence . WE : return Calendar . WEDNESDAY ; case EventRecurrence . TH : retur...
Converts EventRecurrence s day of week to DateUtil s day of week .
8,618
protected static String reportURL ( String type ) throws EasyPostException { try { String urlType = URLEncoder . encode ( type , "UTF-8" ) . toLowerCase ( ) ; return String . format ( "%s/reports/%s/" , EasyPost . API_BASE , urlType ) ; } catch ( java . io . UnsupportedEncodingException e ) { throw new EasyPostExceptio...
generate report URL pattern
8,619
public Item retrieveReference ( String name , String value ) throws EasyPostException { return retrieveReference ( name , value , null ) ; }
retrieve by custom reference
8,620
private URI getOriginalUri ( HttpServletRequest request ) { String requestUrl = request . getRequestURL ( ) . toString ( ) ; String incomingScheme = URI . create ( requestUrl ) . getScheme ( ) ; String originalScheme = request . getHeader ( "X-Forwarded-Proto" ) ; if ( originalScheme != null && ! incomingScheme . equal...
Return the URL as it was originally received from a possible frontend proxy .
8,621
private static byte [ ] hmacSha ( String crypto , byte [ ] keyBytes , byte [ ] text ) { try { Mac hmac ; hmac = Mac . getInstance ( crypto ) ; SecretKeySpec macKey = new SecretKeySpec ( keyBytes , "RAW" ) ; hmac . init ( macKey ) ; return hmac . doFinal ( text ) ; } catch ( GeneralSecurityException gse ) { throw new Un...
This method uses the JCE to provide the crypto algorithm . HMAC computes a Hashed Message Authentication Code with the crypto hash algorithm as a parameter .
8,622
public static int generateTOTP ( byte [ ] key , long time , int digits , String crypto ) { byte [ ] msg = ByteBuffer . allocate ( 8 ) . putLong ( time ) . array ( ) ; byte [ ] hash = hmacSha ( crypto , key , msg ) ; int offset = hash [ hash . length - 1 ] & 0xf ; int binary = ( ( hash [ offset ] & 0x7f ) << 24 ) | ( ( ...
This method generates a TOTP value for the given set of parameters .
8,623
@ SuppressWarnings ( "unchecked" ) public final List < RegisteredService > loadServices ( ) { logger . info ( "Loading Registered Services from: [ {} ]..." , this . servicesConfigFile ) ; final List < RegisteredService > resolvedServices = new ArrayList < RegisteredService > ( ) ; try { final Map < String , List > m = ...
This method is used as a Spring bean loadServices - method as well as the reloading method when the change in the services definition resource is detected at runtime
8,624
public void init ( ) throws Exception { try { unmarshalAndSetBackingMap ( ) ; } catch ( final ClassCastException ex ) { throw new BeanCreationException ( String . format ( "The semantic structure of the person attributes JSON config is not correct. Please fix it in this resource: [%s]" , this . personAttributesConfigFi...
Init method un - marshals JSON representation of the person attributes .
8,625
public void onApplicationEvent ( final ResourceChangeDetectingEventNotifier . ResourceChangedEvent resourceChangedEvent ) { try { if ( ! resourceChangedEvent . getResourceUri ( ) . equals ( this . personAttributesConfigFile . getURI ( ) ) ) { return ; } } catch ( final Throwable e ) { logger . error ( "An exception is ...
Reload person attributes when JSON config is changed . In case of un - marshaling errors or any other errors do not disturb running CAS server by propagating the exceptions but instead log the error and leave the previously cached person attributes state alone .
8,626
void init ( ) throws Throwable { if ( this . digestAlgorithmName != null ) { this . hashService . setHashAlgorithmName ( this . digestAlgorithmName ) ; } if ( this . hashIterations > 0 ) { this . hashService . setHashIterations ( this . hashIterations ) ; } }
This method is only intended to be called by the infrastructure code managing instances of this class once during initialization of this instance
8,627
public OutlookMessage parseMsg ( final InputStream msgFileStream ) throws IOException { final OutlookMessage msg = new OutlookMessage ( rtf2htmlConverter ) ; try { checkDirectoryEntry ( new POIFSFileSystem ( msgFileStream ) . getRoot ( ) , msg ) ; } finally { msgFileStream . close ( ) ; } convertHeaders ( msg ) ; retur...
Parses a . msg file provided by an input stream .
8,628
private byte [ ] getBytesFromStream ( final InputStream dstream ) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; final byte [ ] buffer = new byte [ 1024 ] ; int read ; while ( ( read = dstream . read ( buffer ) ) > 0 ) { baos . write ( buffer , 0 , read ) ; } return baos . toByt...
Reads the bytes from the stream to a byte array .
8,629
public void setProperty ( final OutlookMessageProperty msgProp ) { final String name = msgProp . getClazz ( ) ; final Object value = msgProp . getData ( ) ; if ( name != null && value != null ) { switch ( name ) { case "3701" : setSize ( msgProp . getSize ( ) ) ; setData ( ( byte [ ] ) value ) ; break ; case "3704" : s...
Sets the property specified by the name parameter . Unknown names are ignored .
8,630
private String getStringResource ( String path ) { InputStream in = getClass ( ) . getResourceAsStream ( path ) ; StringBuilder index = new StringBuilder ( ) ; char [ ] buffer = new char [ 1024 ] ; int read = 0 ; try ( InputStreamReader reader = new InputStreamReader ( in ) ) { while ( ( read = reader . read ( buffer )...
read the description contained in the index . html file
8,631
public Service getServiceObjectFromId ( String id ) { log . fine ( "Return service object for " + id ) ; Service service = null ; for ( Service s : services . getServices ( ) ) { if ( id . equals ( s . getId ( ) ) ) { return s ; } } return service ; }
Returns the service object associated with the given id
8,632
public File createGitRepository ( String repositoryName ) throws IOException { RepositoryService service = new RepositoryService ( ) ; service . getClient ( ) . setOAuth2Token ( oAuthToken ) ; Repository repository = new Repository ( ) ; repository . setName ( repositoryName ) ; repository = service . createRepository ...
Creates a repository on GitHub and in a local temporary directory . This is a one time operation as once it is created on GitHub and locally it cannot be recreated .
8,633
public static boolean hasChildNode ( Node parentNode , String nodeName ) { return getChildNode ( parentNode , nodeName , null ) != null ? true : false ; }
Determine if the parent node contains a child node with matching name
8,634
public static Node getChildNode ( Node parentNode , String name , String value ) { List < Node > matchingChildren = getChildren ( parentNode , name , value ) ; return ( matchingChildren . size ( ) > 0 ) ? matchingChildren . get ( 0 ) : null ; }
Get the matching child node
8,635
public static Node getGrandchildNode ( Node parentNode , String childNodeName , String grandChildNodeName , String grandChildNodeValue ) { List < Node > matchingChildren = getChildren ( parentNode , childNodeName , null ) ; for ( Node child : matchingChildren ) { Node matchingGrandChild = getChildNode ( child , grandCh...
Get the matching grand child node
8,636
private static List < Node > getChildren ( Node parentNode , String name , String value ) { List < Node > childNodes = new ArrayList < Node > ( ) ; if ( parentNode == null || name == null ) { return childNodes ; } if ( parentNode . getNodeType ( ) == Node . ELEMENT_NODE && parentNode . hasChildNodes ( ) ) { NodeList ch...
Get all matching child nodes
8,637
public static Node addChildNode ( Document doc , Node parentNode , String childName , String childValue ) { if ( doc == null || parentNode == null || childName == null ) { return null ; } Node childNode = doc . createElement ( childName ) ; if ( childValue != null ) { childNode . setTextContent ( childValue ) ; } paren...
Add a child node
8,638
public static Node findOrAddChildNode ( Document doc , Node parentNode , String childName , String childValue ) { Node matchingChild = getChildNode ( parentNode , childName , childValue ) ; return matchingChild != null ? matchingChild : addChildNode ( doc , parentNode , childName , childValue ) ; }
Get the matching child node . Create a node if it doens t already exist
8,639
public WebElement waitForElement ( By by ) { int attempts = 0 ; int size = driver . findElements ( by ) . size ( ) ; while ( size == 0 ) { size = driver . findElements ( by ) . size ( ) ; if ( attempts == MAX_ATTEMPTS ) fail ( String . format ( "Could not find %s after %d seconds" , by . toString ( ) , MAX_ATTEMPTS ) )...
Method that acts as an arbiter of implicit timeouts of sorts .. sort of like a Wait For Ajax method .
8,640
public String url ( ) { String url = "" ; if ( ! StringUtils . isEmpty ( baseUrl ( ) ) ) { url = baseUrl ( ) + path ( ) ; } else { if ( ! StringUtils . isEmpty ( properties . getProperty ( Constants . DEFAULT_PROPERTY_URL ) ) ) { url = properties . getProperty ( Constants . DEFAULT_PROPERTY_URL ) ; } if ( testConfig !=...
Url that automated tests will be testing .
8,641
public static IDataSource create ( JsonObject config ) throws DataSourceCreationException { String title = config . getAsJsonPrimitive ( "title" ) . getAsString ( ) ; String description = config . getAsJsonPrimitive ( "description" ) . getAsString ( ) ; String typeName = config . getAsJsonPrimitive ( "type" ) . getAsSt...
Create a datasource using a JSON config
8,642
private IDataSource getDataSource ( HttpServletRequest request ) throws DataSourceNotFoundException { String contextPath = request . getContextPath ( ) ; String requestURI = request . getRequestURI ( ) ; String path = contextPath == null ? requestURI : requestURI . substring ( contextPath . length ( ) ) ; if ( path . e...
Get the datasource
8,643
public void addMetadata ( final Model model ) { final Resource datasetId = model . createResource ( getDatasetURI ( ) ) ; final Resource fragmentId = model . createResource ( fragmentURL ) ; datasetId . addProperty ( CommonResources . RDF_TYPE , CommonResources . VOID_DATASET ) ; datasetId . addProperty ( CommonResourc...
Adds some basic metadata to the given RDF model . This method may be overridden in subclasses .
8,644
public void addControls ( final Model model ) { final URIBuilder pagedURL ; try { pagedURL = new URIBuilder ( fragmentURL ) ; } catch ( URISyntaxException e ) { throw new IllegalArgumentException ( e ) ; } final Resource fragmentId = model . createResource ( fragmentURL ) ; final Resource firstPageId = model . createRe...
Adds an RDF description of page links to the given RDF model . This method may be overridden in subclasses .
8,645
private Triple toTriple ( TripleID tripleId ) { return new Triple ( dictionary . getNode ( tripleId . getSubject ( ) , TripleComponentRole . SUBJECT ) , dictionary . getNode ( tripleId . getPredicate ( ) , TripleComponentRole . PREDICATE ) , dictionary . getNode ( tripleId . getObject ( ) , TripleComponentRole . OBJECT...
Converts the HDT triple to a Jena Triple .
8,646
public ElasticsearchContainer withSecureSetting ( String key , String value ) { securedKeys . put ( key , value ) ; return this ; }
Define the elasticsearch docker registry base url
8,647
public ElasticsearchContainer withPluginDir ( Path pluginDir ) { if ( pluginDir == null ) { return this ; } this . pluginDir = createVolumeDirectory ( true ) ; addFileSystemBind ( this . pluginDir . toString ( ) , "/plugins" , BindMode . READ_ONLY ) ; logger ( ) . debug ( "Installing plugins from [{}]" , pluginDir ) ; ...
Path to plugin dir which contains plugins that needs to be installed
8,648
public void start ( ) { Thread thread = new Thread ( new LogCatCommandExecutor ( ) ) ; thread . setName ( getClass ( ) . getSimpleName ( ) + " logcat for " + device . getSerialNumber ( ) ) ; thread . start ( ) ; try { sleep ( 500 ) ; } catch ( InterruptedException e ) { } logListenerCommandShell . activate ( ) ; }
Start receiving and acting on paparazzo requests from the device .
8,649
public static RGBColor rgb ( int r , int g , int b ) { return new RGBColor ( makeRgb ( r , g , b ) ) ; }
RGB color as r g b triple .
8,650
public double cur ( Element elem , String prop , boolean force ) { if ( JsUtils . isWindow ( elem ) ) { if ( "width" . equals ( prop ) ) { return getContentDocument ( elem ) . getClientWidth ( ) ; } if ( "height" . equals ( prop ) ) { return getContentDocument ( elem ) . getClientHeight ( ) ; } elem = GQuery . body ; }...
Returns the numeric value of a css property .
8,651
public String curCSS ( Element elem , String name , boolean force ) { if ( elem == null ) { return "" ; } name = fixPropertyName ( name ) ; String ret = elem . getStyle ( ) . getProperty ( name ) ; if ( force ) { Element toDetach = null ; if ( JsUtils . isDetached ( elem ) ) { toDetach = attachTemporary ( elem ) ; } if...
Return the string value of a css property of an element .
8,652
private void fixInlineElement ( Element e ) { if ( e . getClientHeight ( ) == 0 && e . getClientWidth ( ) == 0 && "inline" . equals ( curCSS ( e , "display" , true ) ) ) { setStyleProperty ( e , "display" , "inline-block" ) ; setStyleProperty ( e , "width" , "auto" ) ; setStyleProperty ( e , "height" , "auto" ) ; } }
inline elements do not have width nor height unless we set it to inline - block
8,653
public void setStyleProperty ( Element e , String prop , String val ) { if ( e == null || prop == null ) { return ; } prop = fixPropertyName ( prop ) ; if ( prop . matches ( "^[A-Z]+$" ) ) { prop = prop . toLowerCase ( ) ; } prop = JsUtils . camelize ( prop ) ; if ( val == null || val . trim ( ) . length ( ) == 0 ) { r...
Set the value of a style property of an element .
8,654
public String defaultDisplay ( String tagName ) { String ret = elemdisplay . get ( tagName ) ; if ( ret == null ) { Element e = DOM . createElement ( tagName ) ; Document . get ( ) . getBody ( ) . appendChild ( e ) ; ret = curCSS ( e , "display" , false ) ; e . removeFromParent ( ) ; if ( ret == null || ret . matches (...
Returns the default display value for each html tag .
8,655
public void setItems ( java . util . Collection < java . util . Map < String , AttributeValue > > items ) { if ( items == null ) { this . items = null ; return ; } java . util . List < java . util . Map < String , AttributeValue > > itemsCopy = new java . util . ArrayList < java . util . Map < String , AttributeValue >...
Sets the value of the Items property for this object .
8,656
public void queueAnimation ( final GQAnimation anim , final int duration ) { if ( isOff ( ) ) { anim . onStart ( ) ; anim . onComplete ( ) ; } else { queue ( anim . e , DEFAULT_NAME , new Function ( ) { public void cancel ( Element e ) { Animation anim = ( Animation ) data ( e , GQAnimation . ACTUAL_ANIMATION , null ) ...
Queue an animation for an element .
8,657
public static String vendorProperty ( String prop ) { return vendorPropNames . get ( prop ) != null ? vendorPropNames . get ( prop ) : prop ; }
Get the cached vendor property name .
8,658
public Effects slideToggle ( Function ... f ) { return as ( Effects ) . slideToggle ( Speed . DEFAULT , f ) ; }
Toggle the visibility of all matched elements by adjusting their height and firing an optional callback after completion . Only the height is adjusted for this animation causing all matched elements to be hidden or shown in a sliding manner
8,659
private void initResultsTable ( DeferredSelector [ ] dg , Benchmark ... benchs ) { int numRows = dg . length ; grid = new FlexTable ( ) ; grid . addStyleName ( "resultstable" ) ; RootPanel . get ( "results" ) . clear ( ) ; RootPanel . get ( "results" ) . add ( grid ) ; grid . setText ( 0 , 0 , "Selector" ) ; for ( int ...
Reset the result table
8,660
public Callbacks add ( com . google . gwt . core . client . Callback < ? , ? > ... c ) { addAll ( ( Object [ ] ) c ) ; return this ; }
Add a Callback or a collection of callbacks to a callback list .
8,661
public Callbacks fire ( Object ... o ) { if ( ! done ) { done = isOnce ; if ( isMemory ) { memory = new ArrayList < > ( Arrays . asList ( o ) ) ; } if ( stack != null ) for ( Object c : stack ) { if ( ! run ( c , o ) && stopOnFalse ) { break ; } } } return this ; }
Call all of the callbacks with the given arguments .
8,662
public synchronized void save ( String persistence ) { try { createObjectMapper ( ) . writeValue ( new File ( persistence ) , tableList ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Maybe save automatically on destroy?
8,663
public ObjectMapper createObjectMapper ( ) { ObjectMapper mapper = new ObjectMapper ( ) ; mapper . setVisibility ( PropertyAccessor . FIELD , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . CREATOR , JsonAutoDetect . Visibility . ANY ) . setVisibility ( PropertyAccessor . SETTER , JsonAutoDetec...
Not sure about this . If correct and only need one only create one instance
8,664
public void setSS ( java . util . Collection < String > sS ) { if ( sS == null ) { this . sS = null ; return ; } java . util . List < String > sSCopy = new java . util . ArrayList < String > ( sS . size ( ) ) ; sSCopy . addAll ( sS ) ; this . sS = sSCopy ; }
A set of strings .
8,665
public void setNS ( java . util . Collection < String > nS ) { if ( nS == null ) { this . nS = null ; return ; } java . util . List < String > nSCopy = new java . util . ArrayList < String > ( nS . size ( ) ) ; nSCopy . addAll ( nS ) ; this . nS = nSCopy ; }
A set of numbers .
8,666
public void setBS ( java . util . Collection < java . nio . ByteBuffer > bS ) { if ( bS == null ) { this . bS = null ; return ; } java . util . List < java . nio . ByteBuffer > bSCopy = new java . util . ArrayList < java . nio . ByteBuffer > ( bS . size ( ) ) ; bSCopy . addAll ( bS ) ; this . bS = bSCopy ; }
A set of binary attributes .
8,667
public static Promise when ( Object ... d ) { int l = d . length ; Promise [ ] p = new Promise [ l ] ; for ( int i = 0 ; i < l ; i ++ ) { p [ i ] = makePromise ( d [ i ] ) ; } return when ( p ) ; }
Provides a way to execute callback functions based on one or more objects usually Deferred objects that represent asynchronous events .
8,668
protected void trigger ( GwtEvent < ? > e , Function callback , Element element ) { trigger ( e , callback , element , eventBus ) ; }
fire event and call callback function .
8,669
public Iterator < T > iterator ( ) { final List < T > allResultsCopy = new ArrayList < T > ( ) ; allResultsCopy . addAll ( allResults ) ; final Iterator < T > iter = allResultsCopy . iterator ( ) ; return new Iterator < T > ( ) { Iterator < T > iterator = iter ; int pos = 0 ; public boolean hasNext ( ) { return iterato...
Returns an iterator over this list that lazily initializes results as necessary .
8,670
public List < T > subList ( int arg0 , int arg1 ) { while ( allResults . size ( ) < arg1 && nextResultsAvailable ( ) ) { moveNextResults ( ) ; } return Collections . unmodifiableList ( allResults . subList ( arg0 , arg1 ) ) ; }
Returns a sub - list in the range specified loading more results as necessary .
8,671
public int indexOf ( Object arg0 ) { int indexOf = allResults . indexOf ( arg0 ) ; if ( indexOf >= 0 ) return indexOf ; while ( nextResultsAvailable ( ) ) { indexOf = nextResults . indexOf ( arg0 ) ; int size = allResults . size ( ) ; moveNextResults ( ) ; if ( indexOf >= 0 ) return indexOf + size ; } return - 1 ; }
Returns the first index of the object given in the list . Additional results are loaded incrementally as necessary .
8,672
private static boolean supportsTransform3d ( ) { if ( transform == null ) { return false ; } String rotate = "rotateY(1deg)" ; divStyle . setProperty ( transform , rotate ) ; rotate = divStyle . getProperty ( transform ) ; return rotate != null && ! rotate . isEmpty ( ) ; }
Some browsers like HTMLUnit only support 2d transformations
8,673
public static String getVendorPropertyName ( String prop ) { String vendorProp = JsUtils . camelize ( "-" + prefix + "-" + prop ) ; if ( JsUtils . hasProperty ( divStyle , vendorProp ) ) { return vendorProp ; } if ( JsUtils . hasProperty ( divStyle , prop ) ) { return prop ; } String camelProp = JsUtils . camelize ( pr...
Compute the correct CSS property name for a specific browser vendor .
8,674
public static Transform getInstance ( Element e , String initial ) { Transform t = GQuery . data ( e , TRANSFORM ) ; if ( t == null || initial != null ) { if ( initial == null ) { initial = GQuery . getSelectorEngine ( ) . getDocumentStyleImpl ( ) . curCSS ( e , transform , false ) ; } t = new Transform ( initial ) ; G...
Return the Transform dictionary object of an element but reseting historical values and setting them to the initial value passed .
8,675
private void parse ( String s ) { if ( s != null ) { for ( MatchResult r = transformParseRegex . exec ( s ) ; r != null ; r = transformParseRegex . exec ( s ) ) { setFromString ( vendorProperty ( r . getGroup ( 1 ) ) , r . getGroup ( 2 ) ) ; } } }
Parse a transform value as string and fills the dictionary map .
8,676
public void setFromString ( String prop , String ... val ) { if ( val . length == 1 ) { String [ ] vals = val [ 0 ] . split ( "[\\s,]+" ) ; set ( prop , vals ) ; } else { set ( prop , val ) ; } }
Set a transform multi - value giving either a set of strings or just an string of values separated by comma .
8,677
@ SuppressWarnings ( "unchecked" ) public T clearQueue ( String name ) { for ( Element e : elements ( ) ) { queue ( e , name , null ) . clear ( ) ; } return ( T ) this ; }
remove all queued function from the named queue .
8,678
@ SuppressWarnings ( "unchecked" ) public T delay ( int milliseconds , String name , Function ... funcs ) { for ( Element e : elements ( ) ) { queue ( e , name , new DelayFunction ( e , name , milliseconds , funcs ) ) ; } return ( T ) this ; }
Add a delay in the named queue .
8,679
@ SuppressWarnings ( "unchecked" ) public T dequeue ( String name ) { for ( Element e : elements ( ) ) { dequeueCurrentAndRunNext ( e , name ) ; } return ( T ) this ; }
Removes a queued function from the front of the named queue and executes it .
8,680
public Promise promise ( final String name ) { final Promise . Deferred dfd = Deferred ( ) ; final Function resolve = new Function ( ) { int count = 1 ; { for ( Element elem : elements ( ) ) { if ( queue ( elem , name , null ) != null ) { emptyHooks ( elem , name ) . add ( this ) ; count ++ ; } } } public void f ( ) { ...
Returns a dynamically generated Promise that is resolved once all actions in the named queue have ended .
8,681
public int queue ( String name ) { Queue < ? > q = isEmpty ( ) ? null : queue ( get ( 0 ) , name , null ) ; return q == null ? 0 : q . size ( ) ; }
Show the number of functions to be executed on the first matched element in the named queue .
8,682
@ SuppressWarnings ( "unchecked" ) public T queue ( Function ... funcs ) { for ( Element e : elements ( ) ) { for ( Function f : funcs ) { queue ( e , DEFAULT_NAME , f ) ; } } return ( T ) this ; }
Adds new functions to be executed onto the end of the effects queue of all matched elements .
8,683
@ SuppressWarnings ( "unchecked" ) public T queue ( final String name , Function ... funcs ) { for ( final Function f : funcs ) { for ( Element e : elements ( ) ) { queue ( e , name , f ) ; } } return ( T ) this ; }
Adds new functions to be executed onto the end of the named queue of all matched elements .
8,684
@ SuppressWarnings ( "unchecked" ) public T queue ( String name , Queue < ? > queue ) { for ( Element e : elements ( ) ) { replacequeue ( e , name , queue ) ; } return ( T ) this ; }
Replaces the current named queue with the given queue on all matched elements .
8,685
public void dequeueIfNotDoneYet ( Element elem , String name , Object object ) { @ SuppressWarnings ( "rawtypes" ) Queue queue = queue ( elem , name , null ) ; if ( queue != null && object . equals ( queue . peek ( ) ) ) { dequeueCurrentAndRunNext ( elem , name ) ; } }
Dequeue the object and run the next if it is the first in the queue .
8,686
public final Object f ( Object ... args ) { return dfd != null && ( cache == CacheType . ALL || cache == CacheType . RESOLVED && dfd . promise ( ) . isResolved ( ) || cache == CacheType . REJECTED && dfd . promise ( ) . isRejected ( ) ) ? dfd . promise ( ) : new PromiseFunction ( ) { public void f ( Deferred dfd ) { Fu...
This function is called when the previous promise in the pipe is resolved .
8,687
@ SuppressWarnings ( "unchecked" ) public < T extends JavaScriptObject > T getArgumentJSO ( int argIdx , int pos ) { return ( T ) getArgument ( argIdx , pos , JavaScriptObject . class ) ; }
Utility method for safety getting a JavaScriptObject present at a certain position in the list of arguments composed by arrays .
8,688
public Object [ ] getArgumentArray ( int idx ) { Object o = idx < 0 ? arguments : getArgument ( idx ) ; if ( o != null ) { return o . getClass ( ) . isArray ( ) ? ( Object [ ] ) o : new Object [ ] { o } ; } else if ( idx == 0 ) { return arguments ; } return new Object [ 0 ] ; }
Utility method for safety getting an array present at a certain position in the list of arguments .
8,689
public < T > T getArgument ( int idx , Class < ? extends T > type ) { return getArgument ( - 1 , idx , type ) ; }
Safety return the argument in the position idx .
8,690
@ SuppressWarnings ( "unchecked" ) public < T > T getArgument ( int argIdx , int pos , Class < ? extends T > type ) { Object [ ] objs = getArgumentArray ( argIdx ) ; Object o = objs . length > pos ? objs [ pos ] : null ; if ( o != null && ( type == null || o . getClass ( ) == type || type == JavaScriptObject . class &&...
Utility method for safety getting an object present at a certain position in the list of arguments composed by arrays .
8,691
public Object f ( Widget w , int i ) { setElement ( w . getElement ( ) ) ; setIndex ( i ) ; f ( w ) ; return null ; }
Override this for GQuery methods which loop over matched widgets and invoke a callback on each widget .
8,692
public void f ( int i , Object ... args ) { setIndex ( i ) ; setArguments ( args ) ; if ( args . length == 1 && args [ 0 ] instanceof JavaScriptObject ) { if ( JsUtils . isElement ( ( JavaScriptObject ) args [ 0 ] ) ) { setElement ( ( com . google . gwt . dom . client . Element ) args [ 0 ] ) ; f ( getElement ( ) , i )...
Override this method for bound callbacks .
8,693
public boolean f ( Event e , Object ... arg ) { setArguments ( arg ) ; setEvent ( e ) ; return f ( e ) ; }
Override this method for bound event handlers if you wish to deal with per - handler user data .
8,694
public void f ( Widget w ) { setElement ( w . getElement ( ) ) ; if ( loop ) { loop = false ; f ( ) ; } else { f ( w . getElement ( ) . < com . google . gwt . dom . client . Element > cast ( ) ) ; } }
Override this for GQuery methods which take a callback but do not expect a return value apply to a single widget .
8,695
public static Promise ajax ( Settings settings ) { resolveSettings ( settings ) ; final Function onSuccess = settings . getSuccess ( ) ; if ( onSuccess != null ) { onSuccess . setElement ( settings . getContext ( ) ) ; } final Function onError = settings . getError ( ) ; if ( onError != null ) { onError . setElement ( ...
Perform an ajax request to the server .
8,696
public static final < T extends JavaScriptObject > T checkNull ( T js ) { if ( ! GWT . isProdMode ( ) && js == null ) { throw new NullPointerException ( ) ; } return js ; }
Throw a NPE when a js is null .
8,697
public static < T > T prop ( JavaScriptObject o , Object id , Class < ? extends T > type ) { return o == null ? null : o . < JsCache > cast ( ) . get ( id , type ) ; }
Returns a property present in a javascript object .
8,698
public static void prop ( JavaScriptObject o , Object id , Object val ) { if ( o != null ) { o . < JsCache > cast ( ) . put ( id , val ) ; } }
Set a property to a javascript object .
8,699
public static < T > T exec ( JavaScriptObject jsFunction , Object ... args ) { assert isFunction ( jsFunction ) ; return jsni ( jsFunction , "call" , jsFunction , args ) ; }
Execute a native javascript function .