idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
3,900
public Bundle addIteration ( String label ) { mCpuTime = Process . getElapsedCpuTime ( ) - mCpuTime ; mExecTime = SystemClock . uptimeMillis ( ) - mExecTime ; Bundle iteration = new Bundle ( ) ; iteration . putString ( METRIC_KEY_LABEL , label ) ; iteration . putLong ( METRIC_KEY_EXECUTION_TIME , mExecTime ) ; iteration . putLong ( METRIC_KEY_CPU_TIME , mCpuTime ) ; mPerfMeasurement . getParcelableArrayList ( METRIC_KEY_ITERATIONS ) . add ( iteration ) ; mExecTime = SystemClock . uptimeMillis ( ) ; mCpuTime = Process . getElapsedCpuTime ( ) ; return iteration ; }
Add a measured segment and start measuring the next segment . Returns collected data in a Bundle object .
3,901
public Bundle stopTiming ( String label ) { addIteration ( label ) ; if ( mPerfWriter != null ) mPerfWriter . writeStopTiming ( mPerfMeasurement ) ; return mPerfMeasurement ; }
Stop measurement of user and cpu time .
3,902
public void addMeasurement ( String label , String value ) { if ( mPerfWriter != null ) mPerfWriter . writeMeasurement ( label , value ) ; }
Add a string field to the collector .
3,903
public static < T > Predicate < T > and ( Predicate < ? super T > ... components ) { return and ( Arrays . asList ( components ) ) ; }
Returns a Predicate that evaluates to true iff each of its components evaluates to true . The components are evaluated in order and evaluation will be short - circuited as soon as the answer is determined .
3,904
public static < T > Predicate < T > or ( Predicate < ? super T > ... components ) { return or ( Arrays . asList ( components ) ) ; }
Returns a Predicate that evaluates to true iff any one of its components evaluates to true . The components are evaluated in order and evaluation will be short - circuited as soon as the answer is determined .
3,905
public static < T > Predicate < T > or ( Iterable < ? extends Predicate < ? super T > > components ) { return new OrPredicate ( components ) ; }
Returns a Predicate that evaluates to true iff any one of its components evaluates to true . The components are evaluated in order and evaluation will be short - circuited as soon as the answer is determined . Does not defensively copy the iterable passed in so future changes to it will alter the behavior of this Predicate . If components is empty the returned Predicate will always evaluate to false .
3,906
private final void applyPagination ( final Query query , final PaginationData pagination ) { query . setFirstResult ( ( pagination . getPageNumber ( ) - 1 ) * pagination . getPageSize ( ) ) ; query . setMaxResults ( pagination . getPageSize ( ) ) ; }
Applies pagination to the query .
3,907
public static Program compete ( List < Program > programs , Program current , Program candidate , LGP manager , RandEngine randEngine ) { if ( manager . getReplacementStrategy ( ) == LGPReplacementStrategy . DirectCompetition ) { if ( CollectionUtils . isBetterThan ( candidate , current ) ) { int index = programs . indexOf ( current ) ; programs . set ( index , candidate ) ; return current ; } else { return candidate ; } } else { if ( randEngine . uniform ( ) <= manager . getReplacementProbability ( ) ) { int index = programs . indexOf ( current ) ; programs . set ( index , candidate ) ; return current ; } else { return candidate ; } } }
this method returns the pointer to the loser in the competition for survival ;
3,908
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) void changeViewPosition ( float xAxisDelta , float yAxisDelta ) { float endLeftBoundPointX = calculateEndLeftBound ( xAxisDelta ) ; float endTopBoundPointY = calculateEndTopBound ( yAxisDelta ) ; getView ( ) . setX ( endLeftBoundPointX ) ; getView ( ) . setY ( endTopBoundPointY ) ; LOGGER . trace ( "Updated view position: leftX = {}, topY = {}" , endLeftBoundPointX , endTopBoundPointY ) ; }
Changes the position of the view based on view s visual position within its parent container
3,909
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) int calculateEndLeftBound ( float xAxisDelta ) { return ( int ) ( getView ( ) . getX ( ) + xAxisDelta ) ; }
Calculates the resulting X coordinate of the view s left bound based on the X position of the view and the X - axis delta
3,910
@ TargetApi ( Build . VERSION_CODES . JELLY_BEAN ) int calculateEndTopBound ( float yAxisDelta ) { return ( int ) ( getView ( ) . getY ( ) + yAxisDelta ) ; }
Calculates the resulting Y coordinate of the view s top bound based on the Y position of the view and the Y - axis delta
3,911
public int compareTo ( Program that ) { int cmp = Integer . compare ( depth , that . depth ) ; if ( cmp == 0 ) { return Integer . compare ( length , that . length ) ; } else { return cmp ; } }
The method return - 1 if this program is better than that program
3,912
private boolean isViewLeftAligned ( ViewGroup . MarginLayoutParams layoutParams ) { final int left = getView ( ) . getLeft ( ) ; boolean viewLeftAligned = left == 0 || left == layoutParams . leftMargin ; LOGGER . trace ( "View is {} aligned" , viewLeftAligned ? "LEFT" : "RIGHT" ) ; return viewLeftAligned ; }
Checks whether view is left aligned
3,913
private boolean isViewTopAligned ( ViewGroup . MarginLayoutParams layoutParams ) { final int top = getView ( ) . getTop ( ) ; boolean viewTopAligned = top == 0 || top == layoutParams . topMargin ; LOGGER . trace ( "View is {} aligned" , viewTopAligned ? "TOP" : "BOTTOM" ) ; return viewTopAligned ; }
Checks whether view is top aligned
3,914
private String determineAnnotatedEndpointPath ( Class < ? > endpointClass ) { if ( endpointClass . isAnnotationPresent ( ServerEndpoint . class ) ) { return endpointClass . getAnnotation ( ServerEndpoint . class ) . value ( ) ; } else { throw new IllegalArgumentException ( String . format ( "@ServerEndpoint annotation not found on Websocket-class: '%s'. Either annotate the class or register it as a programmatic endpoint using ServerEndpointConfig.class" , endpointClass ) ) ; } }
move to sort of ruleEngine
3,915
public static DaVinci init ( Context context , int size ) { if ( INSTANCE == null ) INSTANCE = new DaVinci ( context , size ) ; if ( context != null ) INSTANCE . mContext = context ; return INSTANCE ; }
Initialise DaVinci muse have a googleApiClient to retrieve Bitmaps from Smartphone
3,916
public Drawable get ( ) { final Drawable [ ] drawables = new Drawable [ ] { mPlaceHolder , new BitmapDrawable ( mContext . getResources ( ) , Bitmap . createBitmap ( 1 , 1 , Bitmap . Config . ARGB_8888 ) ) , } ; final TransitionDrawable transitionDrawable = new TransitionDrawable ( drawables ) ; into ( new Callback ( ) { public void onBitmapLoaded ( String path , Bitmap bitmap ) { Log . d ( TAG , "callback " + path + " called" ) ; if ( bitmap != null ) { Log . d ( TAG , "bitmap " + path + " loaded" ) ; Drawable drawable = drawables [ 1 ] ; if ( drawable != null && drawable instanceof BitmapDrawable ) { BitmapDrawable bitmapDrawable = ( BitmapDrawable ) drawables [ 1 ] ; try { Method method = BitmapDrawable . class . getDeclaredMethod ( "setBitmap" , Bitmap . class ) ; method . setAccessible ( true ) ; method . invoke ( bitmapDrawable , bitmap ) ; Log . d ( TAG , "bitmap " + path + " added to transition" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } transitionDrawable . startTransition ( 500 ) ; Log . d ( TAG , "image " + path + " transition started" ) ; } } } ) ; return transitionDrawable ; }
Load the bitmap into a TransitionDrawable Starts the treatment when loaded execute a transition
3,917
private Bitmap loadImage ( final String path , final Object into , final Transformation transformation ) { if ( into == null || mImagesCache == null || path == null || path . trim ( ) . isEmpty ( ) ) return null ; Log . d ( TAG , "load(" + path + ")" ) ; Bitmap bitmap = null ; if ( transformation == null ) { bitmap = loadFromLruCache ( path , true ) ; } else { final String pathTransformed = generatePathFromTransformation ( path , transformation ) ; bitmap = loadFromLruCache ( pathTransformed , true ) ; if ( bitmap == null ) { bitmap = loadFromLruCache ( path , true ) ; if ( bitmap != null ) { new AsyncTask < Void , Void , Bitmap > ( ) { protected Bitmap doInBackground ( Void ... params ) { return transformAndSaveBitmap ( path , transformation ) ; } protected void onPostExecute ( Bitmap bitmap ) { super . onPostExecute ( bitmap ) ; if ( bitmap != null ) { loadImage ( path , into , transformation ) ; } } } . execute ( ) ; return null ; } } } Log . d ( TAG , "bitmap from cache " + bitmap + " for " + path ) ; if ( bitmap != null ) { returnBitmapInto ( bitmap , path , into ) ; Log . d ( TAG , "image " + path + " available in the cache" ) ; } else { Log . d ( TAG , "image " + path + " not available in the cache, trying to download it" ) ; if ( isUrlPath ( path ) ) { Log . d ( TAG , "loadImage " + path + " send request to smartphone " + path . hashCode ( ) ) ; addIntoWaiting ( path , into , transformation ) ; } else { downloadBitmap ( path , into , transformation ) ; } } return bitmap ; }
Start the loading of an image
3,918
private void downloadBitmap ( final String path , final Object into , final Transformation transformation ) { new AsyncTask < Void , Void , Bitmap > ( ) { protected Bitmap doInBackground ( Void ... params ) { Bitmap bitmap = getBitmap ( path ) ; Log . d ( TAG , "bitmap from bluetooth " + path + " " + bitmap ) ; if ( bitmap != null ) { Log . d ( TAG , "save bitmap " + path + " into cache" ) ; saveBitmap ( getKey ( path ) , bitmap ) ; if ( transformation != null ) { return transformAndSaveBitmap ( path , transformation ) ; } } return bitmap ; } protected void onPostExecute ( Bitmap bitmap ) { super . onPostExecute ( bitmap ) ; if ( into != null ) returnBitmapInto ( bitmap , path , into ) ; } } . execute ( ) ; }
Download bitmap from bluetooth asset and store it into LruCache and LruDiskCache
3,919
public void onDataChanged ( DataEventBuffer dataEvents ) { for ( DataEvent dataEvent : dataEvents ) { String path = dataEvent . getDataItem ( ) . getUri ( ) . getPath ( ) ; Log . d ( TAG , "onDataChanged(" + path + ")" ) ; if ( path . startsWith ( DAVINCI_PATH ) ) { Log . d ( TAG , "davinci-onDataChanged " + path ) ; Asset asset = DataMapItem . fromDataItem ( dataEvent . getDataItem ( ) ) . getDataMap ( ) . getAsset ( DAVINCI_ASSET_IMAGE ) ; Bitmap bitmap = loadBitmapFromAsset ( asset ) ; if ( bitmap != null ) saveBitmap ( getKey ( path ) , bitmap ) ; callIntoWaiting ( path ) ; } } }
When received assets from DataApi
3,920
boolean isPreviousAnimationCompleted ( ) { Animation previousAnimation = view . getAnimation ( ) ; boolean previousAnimationCompleted = previousAnimation == null || previousAnimation . hasEnded ( ) ; if ( ! previousAnimationCompleted ) { LOGGER . warn ( "Unable to move the view. View is being currently moving" ) ; } return previousAnimationCompleted ; }
Checks whether previous animation on the view completed
3,921
private void updateXAxisDelta ( MovingParams details ) { if ( ! hasHorizontalSpaceToMove ( details . getXAxisDelta ( ) ) ) { LOGGER . warn ( "Unable to move the view horizontally. No horizontal space left to move" ) ; details . setXAxisDelta ( 0.0f ) ; } }
Updates the X - axis delta in moving details based on checking whether there is enough space left to move the view horizontally
3,922
private void updateYAxisDelta ( MovingParams details ) { if ( ! hasVerticalSpaceToMove ( details . getYAxisDelta ( ) ) ) { LOGGER . warn ( "Unable to move the view vertically. No vertical space left to move" ) ; details . setYAxisDelta ( 0.0f ) ; } }
Updates the Y - axis delta in moving details based on checking whether there is enough space left to move the view vertically
3,923
public static void apply ( Program child , LGP manager , RandEngine randEngine ) { double r = randEngine . uniform ( ) ; List < Instruction > instructions = child . getInstructions ( ) ; if ( child . length ( ) < manager . getMacroMutateMaxProgramLength ( ) && ( ( r < manager . getMacroMutateInsertionRate ( ) ) || child . length ( ) == manager . getMacroMutateMinProgramLength ( ) ) ) { Instruction inserted_instruction = new Instruction ( ) ; InstructionHelper . initialize ( inserted_instruction , child , randEngine ) ; int loc = randEngine . nextInt ( child . length ( ) ) ; if ( loc == child . length ( ) - 1 ) { instructions . add ( inserted_instruction ) ; } else { instructions . add ( loc , inserted_instruction ) ; } if ( manager . isEffectiveMutation ( ) ) { while ( loc < instructions . size ( ) && instructions . get ( loc ) . getOperator ( ) . isConditionalConstruct ( ) ) { loc ++ ; } if ( loc < instructions . size ( ) ) { Set < Integer > Reff = new HashSet < > ( ) ; child . markStructuralIntrons ( loc , Reff , manager ) ; if ( Reff . size ( ) > 0 ) { int iRegisterIndex = - 1 ; for ( Integer Reff_value : Reff ) { if ( iRegisterIndex == - 1 ) { iRegisterIndex = Reff_value ; } else if ( randEngine . uniform ( ) < 0.5 ) { iRegisterIndex = Reff_value ; } } instructions . get ( loc ) . setTargetOperand ( child . getRegisterSet ( ) . get ( iRegisterIndex ) ) ; } } } } else if ( child . length ( ) > manager . getMacroMutateMinProgramLength ( ) && ( ( r > manager . getMacroMutateInsertionRate ( ) ) || child . length ( ) == manager . getMacroMutateMaxProgramLength ( ) ) ) { int loc = randEngine . nextInt ( instructions . size ( ) ) ; if ( manager . isEffectiveMutation ( ) ) { for ( int i = 0 ; i < 10 ; i ++ ) { loc = randEngine . nextInt ( instructions . size ( ) ) ; if ( ! instructions . get ( loc ) . isStructuralIntron ( ) ) { break ; } } } instructions . remove ( loc ) ; } child . invalidateCost ( ) ; }
single instruction would only be exchanged there would be no code growth .
3,924
public static List < String > getAccountEmails ( Context context ) { final Set < String > emailSet = new HashSet < String > ( ) ; final Account [ ] accounts = AccountManager . get ( context ) . getAccounts ( ) ; for ( Account account : accounts ) { if ( isEmail ( account . name ) ) { emailSet . add ( account . name ) ; } } return new ArrayList < String > ( emailSet ) ; }
Retrieves a list of e - mails on the device
3,925
private static boolean isEmail ( String account ) { if ( TextUtils . isEmpty ( account ) ) { return false ; } final Pattern emailPattern = Patterns . EMAIL_ADDRESS ; final Matcher matcher = emailPattern . matcher ( account ) ; return matcher . matches ( ) ; }
Returns true if the given string is an email .
3,926
public FutureAPIResponse createEventAsFuture ( Event event ) throws IOException { RequestBuilder builder = new RequestBuilder ( "POST" ) ; builder . setUrl ( apiUrl + "/events.json?accessKey=" + accessKey ) ; String requestJsonString = event . toJsonString ( ) ; builder . setBody ( requestJsonString ) ; builder . setHeader ( "Content-Type" , "application/json" ) ; builder . setHeader ( "Content-Length" , "" + requestJsonString . length ( ) ) ; return new FutureAPIResponse ( client . executeRequest ( builder . build ( ) , getHandler ( ) ) ) ; }
Sends an asynchronous create event request to the API .
3,927
public String createEvent ( Event event ) throws ExecutionException , InterruptedException , IOException { return createEvent ( createEventAsFuture ( event ) ) ; }
Sends a synchronous create event request to the API .
3,928
public String createEvent ( FutureAPIResponse response ) throws ExecutionException , InterruptedException , IOException { int status = response . get ( ) . getStatus ( ) ; String message = response . get ( ) . getMessage ( ) ; if ( status != HTTP_CREATED ) { throw new IOException ( status + " " + message ) ; } return ( ( JsonObject ) parser . parse ( message ) ) . get ( "eventId" ) . getAsString ( ) ; }
Synchronize a previously sent asynchronous create event request .
3,929
public FutureAPIResponse getEventAsFuture ( String eid ) throws IOException { Request request = ( new RequestBuilder ( "GET" ) ) . setUrl ( apiUrl + "/events/" + eid + ".json?accessKey=" + accessKey ) . build ( ) ; return new FutureAPIResponse ( client . executeRequest ( request , getHandler ( ) ) ) ; }
Sends an asynchronous get event request to the API .
3,930
public Event getEvent ( String eid ) throws ExecutionException , InterruptedException , IOException { return getEvent ( getEventAsFuture ( eid ) ) ; }
Sends a synchronous get event request to the API .
3,931
public Event getEvent ( FutureAPIResponse response ) throws ExecutionException , InterruptedException , IOException { int status = response . get ( ) . getStatus ( ) ; String message = response . get ( ) . getMessage ( ) ; if ( status == HTTP_OK ) { GsonBuilder gsonBuilder = new GsonBuilder ( ) ; gsonBuilder . registerTypeAdapter ( DateTime . class , new DateTimeAdapter ( ) ) ; Gson gson = gsonBuilder . create ( ) ; return gson . fromJson ( message , Event . class ) ; } else { throw new IOException ( message ) ; } }
Synchronize a previously sent asynchronous get item request .
3,932
public FutureAPIResponse setUserAsFuture ( String uid , Map < String , Object > properties , DateTime eventTime ) throws IOException { return createEventAsFuture ( new Event ( ) . event ( "$set" ) . entityType ( "user" ) . entityId ( uid ) . eventTime ( eventTime ) . properties ( properties ) ) ; }
Sends a set user properties request . Implicitly creates the user if it s not already there . Properties could be empty .
3,933
public String setUser ( String uid , Map < String , Object > properties , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( setUserAsFuture ( uid , properties , eventTime ) ) ; }
Sets properties of a user . Implicitly creates the user if it s not already there . Properties could be empty .
3,934
public String unsetUser ( String uid , List < String > properties , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( unsetUserAsFuture ( uid , properties , eventTime ) ) ; }
Unsets properties of a user . The list must not be empty .
3,935
public FutureAPIResponse deleteUserAsFuture ( String uid , DateTime eventTime ) throws IOException { return createEventAsFuture ( new Event ( ) . event ( "$delete" ) . entityType ( "user" ) . entityId ( uid ) . eventTime ( eventTime ) ) ; }
Sends a delete user request .
3,936
public String deleteUser ( String uid ) throws ExecutionException , InterruptedException , IOException { return deleteUser ( uid , new DateTime ( ) ) ; }
Deletes a user . Event time is recorded as the time when the function is called .
3,937
public FutureAPIResponse setItemAsFuture ( String iid , Map < String , Object > properties , DateTime eventTime ) throws IOException { return createEventAsFuture ( new Event ( ) . event ( "$set" ) . entityType ( "item" ) . entityId ( iid ) . eventTime ( eventTime ) . properties ( properties ) ) ; }
Sends a set item properties request . Implicitly creates the item if it s not already there . Properties could be empty .
3,938
public String setItem ( String iid , Map < String , Object > properties , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( setItemAsFuture ( iid , properties , eventTime ) ) ; }
Sets properties of a item . Implicitly creates the item if it s not already there . Properties could be empty .
3,939
public FutureAPIResponse unsetItemAsFuture ( String iid , List < String > properties , DateTime eventTime ) throws IOException { if ( properties . isEmpty ( ) ) { throw new IllegalStateException ( "property list cannot be empty" ) ; } Map < String , Object > propertiesMap = Maps . newHashMap ( ) ; for ( String property : properties ) { propertiesMap . put ( property , "" ) ; } return createEventAsFuture ( new Event ( ) . event ( "$unset" ) . entityType ( "item" ) . entityId ( iid ) . eventTime ( eventTime ) . properties ( propertiesMap ) ) ; }
Sends an unset item properties request . The list must not be empty .
3,940
public String unsetItem ( String iid , List < String > properties , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( unsetItemAsFuture ( iid , properties , eventTime ) ) ; }
Unsets properties of a item . The list must not be empty .
3,941
public FutureAPIResponse deleteItemAsFuture ( String iid , DateTime eventTime ) throws IOException { return createEventAsFuture ( new Event ( ) . event ( "$delete" ) . entityType ( "item" ) . entityId ( iid ) . eventTime ( eventTime ) ) ; }
Sends a delete item request .
3,942
public String deleteItem ( String iid , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( deleteItemAsFuture ( iid , eventTime ) ) ; }
Deletes a item .
3,943
public String deleteItem ( String iid ) throws ExecutionException , InterruptedException , IOException { return deleteItem ( iid , new DateTime ( ) ) ; }
Deletes a item . Event time is recorded as the time when the function is called .
3,944
public FutureAPIResponse userActionItemAsFuture ( String action , String uid , String iid , Map < String , Object > properties , DateTime eventTime ) throws IOException { return createEventAsFuture ( new Event ( ) . event ( action ) . entityType ( "user" ) . entityId ( uid ) . targetEntityType ( "item" ) . targetEntityId ( iid ) . properties ( properties ) . eventTime ( eventTime ) ) ; }
Sends a user - action - on - item request .
3,945
public String userActionItem ( String action , String uid , String iid , Map < String , Object > properties , DateTime eventTime ) throws ExecutionException , InterruptedException , IOException { return createEvent ( userActionItemAsFuture ( action , uid , iid , properties , eventTime ) ) ; }
Records a user - action - on - item event .
3,946
public void createEvent ( String eventName , String entityType , String entityId , String targetEntityType , String targetEntityId , Map < String , Object > properties , DateTime eventTime ) throws IOException { if ( eventTime == null ) { eventTime = new DateTime ( ) ; } Event event = new Event ( ) . event ( eventName ) . entityType ( entityType ) . entityId ( entityId ) . eventTime ( eventTime ) ; if ( targetEntityType != null ) { event . targetEntityType ( targetEntityType ) ; } if ( targetEntityId != null ) { event . targetEntityId ( targetEntityId ) ; } if ( properties != null ) { event . properties ( properties ) ; } out . write ( event . toJsonString ( ) . getBytes ( "UTF8" ) ) ; out . write ( '\n' ) ; }
Create and write a json - encoded event to the underlying file .
3,947
public void log ( Object ... args ) { if ( ! isRateLimited ( ) ) { level . log ( logger , message , args ) ; } incrementStats ( ) ; }
logging APIs .
3,948
public FutureAPIResponse sendQueryAsFuture ( Map < String , Object > query ) throws ExecutionException , InterruptedException , IOException { RequestBuilder builder = new RequestBuilder ( "POST" ) ; builder . setUrl ( apiUrl + "/queries.json" ) ; GsonBuilder gsonBuilder = new GsonBuilder ( ) ; gsonBuilder . registerTypeAdapter ( DateTime . class , new DateTimeAdapter ( ) ) ; Gson gson = gsonBuilder . create ( ) ; String requestJsonString = gson . toJson ( query ) ; builder . setBody ( requestJsonString ) ; builder . setHeader ( "Content-Type" , "application/json" ) ; builder . setHeader ( "Content-Length" , "" + requestJsonString . length ( ) ) ; return new FutureAPIResponse ( client . executeRequest ( builder . build ( ) , getHandler ( ) ) ) ; }
Sends a query asynchronously .
3,949
public JsonObject sendQuery ( Map < String , Object > query ) throws ExecutionException , InterruptedException , IOException { return sendQuery ( sendQueryAsFuture ( query ) ) ; }
Sends a query synchronously .
3,950
public JsonObject sendQuery ( FutureAPIResponse response ) throws ExecutionException , InterruptedException , IOException { int status = response . get ( ) . getStatus ( ) ; String message = response . get ( ) . getMessage ( ) ; if ( status != HTTP_OK ) { throw new IOException ( status + " " + message ) ; } return ( ( JsonObject ) parser . parse ( message ) ) ; }
Gets query result from a previously sent asynchronous request .
3,951
public static RateLimitedLogBuilder . MissingRateAndPeriod withRateLimit ( Logger logger ) { return new RateLimitedLogBuilder . MissingRateAndPeriod ( Objects . requireNonNull ( logger ) ) ; }
Start building a new RateLimitedLog wrapping the SLF4J logger
3,952
private void outOfCacheCapacity ( ) { synchronized ( knownPatterns ) { if ( knownPatterns . size ( ) > MAX_PATTERNS_PER_LOG ) { logger . warn ( "out of capacity in RateLimitedLog registry; accidentally " + "using interpolated strings as patterns?" ) ; registry . flush ( ) ; knownPatterns . clear ( ) ; } } }
We ve run out of capacity in our cache of RateLimitedLogWithPattern objects . This probably means that the caller is accidentally calling us with an already - interpolated string instead of using the pattern as the key and letting us do the interpolation . Don t lose data ; instead fall back to flushing the entire cache but carrying on . The worst - case scenario here is that we flush the logs far more frequently than their requested durations potentially allowing the logging to impact throughput but we don t lose any log data .
3,953
public void setClearVisible ( boolean visible ) { if ( mClearButtonEnabled ) { final Drawable d = ( visible ? mTappableDrawable : null ) ; final Drawable [ ] drawables = getCompoundDrawables ( ) ; if ( drawables != null ) { setCompoundDrawables ( drawables [ 0 ] , drawables [ 1 ] , d , drawables [ 3 ] ) ; } else { Log . w ( TAG , "No clear button is available." ) ; } } }
Sets the visibility of the clear button . The clear button must also be enabled for it to be visible .
3,954
public String getStatus ( ) throws ExecutionException , InterruptedException , IOException { return ( new FutureAPIResponse ( client . prepareGet ( apiUrl ) . execute ( getHandler ( ) ) ) ) . get ( ) . getMessage ( ) ; }
Get status of the API .
3,955
public static SecretKey generateKey ( final byte [ ] key ) { return new SecretKey ( ) { private byte [ ] k ; { if ( key . length == 16 ) { k = key ; } else { k = new byte [ 16 ] ; System . arraycopy ( key , 0 , k , 0 , key . length < 16 ? key . length : 16 ) ; } } public String getAlgorithm ( ) { return "AES" ; } public String getFormat ( ) { return "RAW" ; } public byte [ ] getEncoded ( ) { return k ; } } ; }
16 bytes max 128 - bit encription
3,956
public void setAxis ( int axis ) { boolean axisChanged = ( axis != majorAxis ) ; majorAxis = axis ; if ( axisChanged ) { preferenceChanged ( null , true , true ) ; } }
Sets the tile axis property . This is the axis along which the child views are tiled .
3,957
private Rectangle getCompleteBoxAllocation ( Box b ) { Rectangle ret = b . getAbsoluteBounds ( ) ; if ( b instanceof ElementBox ) { ElementBox eb = ( ElementBox ) b ; for ( int i = eb . getStartChild ( ) ; i < eb . getEndChild ( ) ; i ++ ) { Box child = eb . getSubBox ( i ) ; if ( child . isVisible ( ) ) { Rectangle r = getCompleteBoxAllocation ( child ) ; ret . add ( r ) ; } } } return ret . intersection ( b . getClipBlock ( ) . getClippedContentBounds ( ) ) ; }
Obtains the allocation of a box together with all its child boxes .
3,958
protected boolean isBefore ( int x , int y , Rectangle innerAlloc ) { innerAlloc . setBounds ( box . getAbsoluteBounds ( ) ) ; if ( majorAxis == View . X_AXIS ) { return ( x < innerAlloc . x ) ; } else { return ( y < innerAlloc . y ) ; } }
Determines if a point falls before an allocated region .
3,959
protected boolean isAfter ( int x , int y , Rectangle innerAlloc ) { innerAlloc . setBounds ( box . getAbsoluteBounds ( ) ) ; if ( majorAxis == View . X_AXIS ) { return ( x > ( innerAlloc . width + innerAlloc . x ) ) ; } else { return ( y > ( innerAlloc . height + innerAlloc . y ) ) ; } }
Determines if a point falls after an allocated region .
3,960
protected boolean validateLayout ( Dimension dim ) { if ( majorAxis == X_AXIS ) { majorRequest = getRequirements ( X_AXIS , majorRequest ) ; minorRequest = getRequirements ( Y_AXIS , minorRequest ) ; oldDimension . setSize ( majorRequest . preferred , minorRequest . preferred ) ; } else { majorRequest = getRequirements ( Y_AXIS , majorRequest ) ; minorRequest = getRequirements ( X_AXIS , minorRequest ) ; oldDimension . setSize ( minorRequest . preferred , majorRequest . preferred ) ; } majorReqValid = true ; minorReqValid = true ; majorAllocValid = true ; minorAllocValid = true ; return false ; }
Validates layout .
3,961
public static final Rectangle toRect ( Shape a ) { return a instanceof Rectangle ? ( Rectangle ) a : a . getBounds ( ) ; }
Converts an Shape to instance of rectangle
3,962
public static final boolean intersection ( Rectangle src1 , Rectangle src2 , Rectangle dest ) { int x1 = Math . max ( src1 . x , src2 . x ) ; int y1 = Math . max ( src1 . y , src2 . y ) ; int x2 = Math . min ( src1 . x + src1 . width , src2 . x + src2 . width ) ; int y2 = Math . min ( src1 . y + src1 . height , src2 . y + src2 . height ) ; dest . setBounds ( x1 , y1 , x2 - x1 , y2 - y1 ) ; if ( dest . width <= 0 || dest . height <= 0 ) return false ; return true ; }
Calculates intersection of two rectangles
3,963
public static final Box getBox ( CSSBoxView v ) { try { AttributeSet attr = v . getAttributes ( ) ; return ( Box ) attr . getAttribute ( Constants . ATTRIBUTE_BOX_REFERENCE ) ; } catch ( Exception e ) { throw new IllegalStateException ( e ) ; } }
Gets the box reference from properties
3,964
public static final Box getBox ( View v ) { if ( v instanceof CSSBoxView ) return getBox ( ( CSSBoxView ) v ) ; AttributeSet attr = v . getAttributes ( ) ; if ( attr == null ) { throw new NullPointerException ( "AttributeSet of " + v . getClass ( ) . getName ( ) + "@" + Integer . toHexString ( v . hashCode ( ) ) + " is set to NULL." ) ; } Object obj = attr . getAttribute ( Constants . ATTRIBUTE_BOX_REFERENCE ) ; if ( obj != null && obj instanceof Box ) { return ( Box ) obj ; } else { throw new IllegalArgumentException ( "Box reference in attributes is not an instance of a Box." ) ; } }
Gets the box reference from properties .
3,965
public void activateTooltip ( boolean show ) { if ( show ) { ToolTipManager . sharedInstance ( ) . registerComponent ( this ) ; } else { ToolTipManager . sharedInstance ( ) . unregisterComponent ( this ) ; } ToolTipManager . sharedInstance ( ) . setEnabled ( show ) ; }
Activates tooltips .
3,966
public void fireGeneralEvent ( GeneralEvent e ) { Object [ ] listeners = listenerList . getListenerList ( ) ; for ( int i = listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( listeners [ i ] == GeneralEventListener . class ) { ( ( GeneralEventListener ) listeners [ i + 1 ] ) . generalEventUpdate ( e ) ; } } }
Fires general event . All registered listeners will be notified .
3,967
public Graphics2D renderContent ( ) { View view = null ; ViewFactory factory = getEditorKit ( ) . getViewFactory ( ) ; if ( factory instanceof SwingBoxViewFactory ) { view = ( ( SwingBoxViewFactory ) factory ) . getViewport ( ) ; } if ( view != null ) { int w = ( int ) view . getPreferredSpan ( View . X_AXIS ) ; int h = ( int ) view . getPreferredSpan ( View . Y_AXIS ) ; Rectangle rec = new Rectangle ( w , h ) ; BufferedImage img = new BufferedImage ( w , h , BufferedImage . TYPE_INT_RGB ) ; Graphics2D g = img . createGraphics ( ) ; g . setClip ( rec ) ; view . paint ( g , rec ) ; return g ; } return null ; }
Renders current content to graphic context which is returned . May return null ;
3,968
public Graphics2D renderContent ( Graphics2D g ) { if ( g . getClip ( ) == null ) throw new NullPointerException ( "Clip is not set on graphics context" ) ; ViewFactory factory = getEditorKit ( ) . getViewFactory ( ) ; if ( factory instanceof SwingBoxViewFactory ) { View view = ( ( SwingBoxViewFactory ) factory ) . getViewport ( ) ; if ( view != null ) view . paint ( g , g . getClip ( ) ) ; } return g ; }
Renders current content to given graphic context which is updated and returned . Context must have set the clip otherwise NullPointerException is thrown .
3,969
public boolean setCSSBoxAnalyzer ( CSSBoxAnalyzer cba ) { EditorKit kit = getEditorKit ( ) ; if ( kit instanceof SwingBoxEditorKit ) { ( ( SwingBoxEditorKit ) kit ) . setCSSBoxAnalyzer ( cba ) ; return true ; } return false ; }
Sets the css box analyzer .
3,970
public JFrame getMainWindow ( ) { if ( mainWindow == null ) { mainWindow = new JFrame ( ) ; mainWindow . setTitle ( "Swing Browser" ) ; mainWindow . setVisible ( true ) ; mainWindow . setBounds ( new Rectangle ( 0 , 0 , 583 , 251 ) ) ; mainWindow . setContentPane ( getMainPanel ( ) ) ; mainWindow . addWindowListener ( new java . awt . event . WindowAdapter ( ) { public void windowClosing ( java . awt . event . WindowEvent e ) { mainWindow . setVisible ( false ) ; System . exit ( 0 ) ; } } ) ; } return mainWindow ; }
This method initializes jFrame
3,971
private static int [ ] makeCharTable ( byte [ ] needle ) { int [ ] table = new int [ ALPHABET_SIZE ] ; int l = needle . length ; for ( int i = 0 ; i < ALPHABET_SIZE ; ++ i ) { table [ i ] = l ; } l -- ; for ( int i = 0 ; i < l ; ++ i ) { table [ needle [ i ] & 0xff ] = l - i ; } return table ; }
Makes the jump table based on the mismatched character information .
3,972
private static int [ ] makeOffsetTable ( byte [ ] needle ) { int l = needle . length ; int [ ] table = new int [ l ] ; int lastPrefixPosition = l ; for ( int i = l - 1 ; i >= 0 ; -- i ) { if ( isPrefix ( needle , i + 1 ) ) { lastPrefixPosition = i + 1 ; } table [ l - 1 - i ] = lastPrefixPosition - i + l - 1 ; } for ( int i = 0 ; i < l - 1 ; ++ i ) { int slen = suffixLength ( needle , i ) ; table [ slen ] = l - 1 - i + slen ; } return table ; }
Makes the jump table based on the scan offset which mismatch occurs .
3,973
private static int suffixLength ( byte [ ] needle , int p ) { int len = 0 ; for ( int i = p , j = needle . length - 1 ; i >= 0 && needle [ i ] == needle [ j ] ; -- i , -- j ) { len ++ ; } return len ; }
Returns the maximum length of the substring ends at p and is a suffix .
3,974
protected void processPaint ( Graphics gg , Shape a ) { Graphics2D g = ( Graphics2D ) gg ; AffineTransform tmpTransform = g . getTransform ( ) ; if ( ! tmpTransform . equals ( transform ) ) { transform = tmpTransform ; invalidateTextLayout ( ) ; } Component c = container ; int p0 = getStartOffset ( ) ; int p1 = getEndOffset ( ) ; Color fg = getForeground ( ) ; if ( c instanceof JTextComponent ) { JTextComponent tc = ( JTextComponent ) c ; if ( ! tc . isEnabled ( ) ) { fg = tc . getDisabledTextColor ( ) ; } Highlighter highLighter = tc . getHighlighter ( ) ; if ( highLighter instanceof LayeredHighlighter ) { ( ( LayeredHighlighter ) highLighter ) . paintLayeredHighlights ( g , p0 , p1 , box . getAbsoluteContentBounds ( ) , tc , this ) ; } } if ( ! box . isEmpty ( ) && ! getText ( ) . isEmpty ( ) ) renderContent ( g , a , fg , p0 , p1 ) ; }
Process paint .
3,975
protected void renderContent ( Graphics2D g , Shape a , Color fg , int p0 , int p1 ) { TextLayout layout = getTextLayout ( ) ; Rectangle absoluteBounds = box . getAbsoluteBounds ( ) ; Rectangle absoluteContentBounds = box . getAbsoluteContentBounds ( ) ; int pStart = getStartOffset ( ) ; int pEnd = getEndOffset ( ) ; int x = absoluteBounds . x ; int y = absoluteBounds . y ; Shape oldclip = g . getClip ( ) ; BlockBox clipblock = box . getClipBlock ( ) ; if ( clipblock != null ) { Rectangle newclip = clipblock . getClippedContentBounds ( ) ; Rectangle clip = toRect ( oldclip ) . intersection ( newclip ) ; g . setClip ( clip ) ; } g . setFont ( getFont ( ) ) ; g . setColor ( fg ) ; if ( p0 > pStart || p1 < pEnd ) { try { Shape s = modelToView ( p0 , Position . Bias . Forward , p1 , Position . Bias . Backward , a ) ; absoluteContentBounds = absoluteContentBounds . intersection ( toRect ( s ) ) ; } catch ( BadLocationException ignored ) { } } layout . draw ( g , x , y + layout . getAscent ( ) ) ; if ( underline || strike || overline ) { Stroke origStroke = g . getStroke ( ) ; int w ; if ( getFont ( ) . isBold ( ) ) w = getFont ( ) . getSize ( ) / 8 ; else w = getFont ( ) . getSize ( ) / 10 ; if ( w < 1 ) w = 1 ; y += w / 2 ; g . setStroke ( new BasicStroke ( w ) ) ; int xx = absoluteContentBounds . x + absoluteContentBounds . width ; if ( overline ) { g . drawLine ( absoluteContentBounds . x , y , xx , y ) ; } if ( underline ) { int yy = y + absoluteContentBounds . height - ( int ) layout . getDescent ( ) ; g . drawLine ( absoluteContentBounds . x , yy , xx , yy ) ; } if ( strike ) { int yy = y + absoluteContentBounds . height / 2 ; g . drawLine ( absoluteContentBounds . x , yy , xx , yy ) ; } g . setStroke ( origStroke ) ; } g . setClip ( oldclip ) ; }
Renders content .
3,976
protected void repaint ( final int ms , final Rectangle bounds ) { if ( container != null ) { container . repaint ( ms , bounds . x , bounds . y , bounds . width , bounds . height ) ; } }
Repaints the content used by blink decoration .
3,977
protected Rectangle2D getStringBounds ( TextLayout tl ) { return new Rectangle2D . Float ( 0 , - tl . getAscent ( ) , tl . getAdvance ( ) , tl . getAscent ( ) + tl . getDescent ( ) + tl . getLeading ( ) ) ; }
Gets the string bounds .
3,978
protected String getTextEx ( int position , int len ) { try { return getDocument ( ) . getText ( position , len ) ; } catch ( BadLocationException e ) { e . printStackTrace ( ) ; return "" ; } }
Gets the text .
3,979
protected void setPropertiesFromAttributes ( AttributeSet attr ) { if ( attr != null ) { Font newFont = ( Font ) attr . getAttribute ( Constants . ATTRIBUTE_FONT ) ; if ( newFont != null ) { setFont ( newFont ) ; } else { throw new IllegalStateException ( "Font can not be null !" ) ; } setForeground ( ( Color ) attr . getAttribute ( Constants . ATTRIBUTE_FOREGROUND ) ) ; setFontVariant ( ( String ) attr . getAttribute ( Constants . ATTRIBUTE_FONT_VARIANT ) ) ; @ SuppressWarnings ( "unchecked" ) List < TextDecoration > attribute = ( List < TextDecoration > ) attr . getAttribute ( Constants . ATTRIBUTE_TEXT_DECORATION ) ; setTextDecoration ( attribute ) ; } }
Sets the properties from the attributes .
3,980
protected void setFont ( Font newFont ) { if ( font == null || ! font . equals ( newFont ) ) { font = new Font ( newFont . getAttributes ( ) ) ; invalidateCache ( ) ; invalidateTextLayout ( ) ; } }
Sets the font .
3,981
protected void setForeground ( Color newColor ) { if ( foreground == null || ! foreground . equals ( newColor ) ) { foreground = new Color ( newColor . getRGB ( ) ) ; invalidateCache ( ) ; } }
Sets the foreground .
3,982
protected void setFontVariant ( String newFontVariant ) { if ( fontVariant == null || ! fontVariant . equals ( newFontVariant ) ) { FontVariant val [ ] = FontVariant . values ( ) ; for ( FontVariant aVal : val ) { if ( aVal . toString ( ) . equals ( newFontVariant ) ) { fontVariant = newFontVariant ; invalidateCache ( ) ; return ; } } } }
Sets the font variant .
3,983
protected void setTextDecoration ( List < TextDecoration > newTextDecoration ) { if ( textDecoration == null || ! textDecoration . equals ( newTextDecoration ) ) { textDecoration = newTextDecoration ; reflectTextDecoration ( textDecoration ) ; invalidateCache ( ) ; } }
Sets the text decoration .
3,984
protected TextLayout getTextLayout ( ) { if ( refreshTextLayout ) { refreshTextLayout = false ; layout = new TextLayout ( getText ( ) , getFont ( ) , new FontRenderContext ( transform , true , false ) ) ; } return layout ; }
Gets the text layout .
3,985
public void update ( SwingBoxDocument doc , Viewport root , Dimension dim ) throws IOException { ContentReader rdr = new ContentReader ( ) ; List < ElementSpec > elements = rdr . update ( root , dim , getCSSBoxAnalyzer ( ) ) ; ElementSpec elementsArray [ ] = elements . toArray ( new ElementSpec [ 0 ] ) ; doc . create ( elementsArray ) ; }
Updates layout using new dimensions .
3,986
protected void loadPage ( JEditorPane pane , HyperlinkEvent evt ) { try { pane . setPage ( evt . getURL ( ) ) ; } catch ( IOException e ) { System . err . println ( e . getLocalizedMessage ( ) ) ; } }
Loads given page as HyperlinkEvent .
3,987
public List < ElementSpec > read ( DocumentSource docSource , CSSBoxAnalyzer cba , Dimension dim ) throws IOException { if ( cba == null ) throw new IllegalArgumentException ( "CSSBoxAnalyzer can not be NULL !!!\nProvide your custom implementation or check instantiation of DefaultAnalyzer object..." ) ; elements = new Vector < ElementSpec > ( ) ; elements . add ( new ElementSpec ( SimpleAttributeSet . EMPTY , ElementSpec . EndTagType ) ) ; order = 0 ; Viewport vp ; try { vp = cba . analyze ( docSource , dim ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } vp . draw ( this ) ; return elements ; }
Reads input data and converts them to elements
3,988
public List < ElementSpec > update ( Viewport root , Dimension newDimension , CSSBoxAnalyzer cba ) throws IOException { if ( cba == null ) throw new IllegalArgumentException ( "CSSBoxAnalyzer can not be NULL !!!\nProvide your custom implementation or check instantiation of DefaultAnalyzer object..." ) ; elements = new LinkedList < ElementSpec > ( ) ; elements . add ( new ElementSpec ( SimpleAttributeSet . EMPTY , ElementSpec . EndTagType ) ) ; order = 0 ; Viewport vp ; try { vp = cba . update ( newDimension ) ; } catch ( Exception e ) { throw new IOException ( e ) ; } vp . draw ( this ) ; return elements ; }
Updates the layout . It is designed to do a re - layout only not to process input data again .
3,989
void HuffmanBlockEncoder ( BufferedOutputStream outStream , int zigzag [ ] , int prec , int DCcode , int ACcode ) throws IOException { int temp , temp2 , nbits , k , r , i ; temp = temp2 = zigzag [ 0 ] - prec ; if ( temp < 0 ) { temp = - temp ; temp2 -- ; } nbits = 0 ; while ( temp != 0 ) { nbits ++ ; temp >>= 1 ; } bufferIt ( outStream , ( DC_matrix [ DCcode ] ) [ nbits ] [ 0 ] , ( DC_matrix [ DCcode ] ) [ nbits ] [ 1 ] ) ; if ( nbits != 0 ) { bufferIt ( outStream , temp2 , nbits ) ; } r = 0 ; for ( k = 1 ; k < 64 ; k ++ ) { if ( ( temp = zigzag [ jpegNaturalOrder [ k ] ] ) == 0 ) { r ++ ; } else { while ( r > 15 ) { bufferIt ( outStream , ( AC_matrix [ ACcode ] ) [ 0xF0 ] [ 0 ] , ( AC_matrix [ ACcode ] ) [ 0xF0 ] [ 1 ] ) ; r -= 16 ; } temp2 = temp ; if ( temp < 0 ) { temp = - temp ; temp2 -- ; } nbits = 1 ; while ( ( temp >>= 1 ) != 0 ) { nbits ++ ; } i = ( r << 4 ) + nbits ; bufferIt ( outStream , ( AC_matrix [ ACcode ] ) [ i ] [ 0 ] , ( AC_matrix [ ACcode ] ) [ i ] [ 1 ] ) ; bufferIt ( outStream , temp2 , nbits ) ; r = 0 ; } } if ( r > 0 ) { bufferIt ( outStream , ( AC_matrix [ ACcode ] ) [ 0 ] [ 0 ] , ( AC_matrix [ ACcode ] ) [ 0 ] [ 1 ] ) ; } }
HuffmanBlockEncoder run length encodes and Huffman encodes the quantized data .
3,990
void bufferIt ( BufferedOutputStream outStream , int code , int size ) throws IOException { int PutBuffer = code ; int PutBits = bufferPutBits ; PutBuffer &= ( 1 << size ) - 1 ; PutBits += size ; PutBuffer <<= 24 - PutBits ; PutBuffer |= bufferPutBuffer ; while ( PutBits >= 8 ) { int c = ( ( PutBuffer >> 16 ) & 0xFF ) ; outStream . write ( c ) ; if ( c == 0xFF ) { outStream . write ( 0 ) ; } PutBuffer <<= 8 ; PutBits -= 8 ; } bufferPutBuffer = PutBuffer ; bufferPutBits = PutBits ; }
and sends them to outStream by the byte .
3,991
public boolean check ( String value , String hashString ) { return update ( value . getBytes ( ) ) . asString ( ) . equalsIgnoreCase ( hashString ) ; }
get hash from given string and check for equals it with hashString
3,992
public < T > Flow < T > map ( Mapper < ? super B , T > mapper ) { return then ( new FlowMap < B , T > ( mapper ) ) ; }
converts B into T with Mapper ignores null - values
3,993
public static org . w3c . dom . Element findAnchorElement ( org . w3c . dom . Element e ) { if ( "a" . equalsIgnoreCase ( e . getTagName ( ) . trim ( ) ) ) return e ; else if ( e . getParentNode ( ) != null && e . getParentNode ( ) . getNodeType ( ) == Node . ELEMENT_NODE ) return findAnchorElement ( ( org . w3c . dom . Element ) e . getParentNode ( ) ) ; else return null ; }
Examines the given element and all its parent elements in order to find the a element .
3,994
public void setParent ( View parent ) { if ( parent == null && view != null ) view . setParent ( null ) ; this . parent = parent ; if ( ( parent != null ) && ( getElement ( ) != null ) ) { ViewFactory f = getViewFactory ( ) ; loadChildren ( f ) ; } }
Sets the view parent .
3,995
public String getDelegateName ( ) { javax . swing . text . Element data = getElement ( ) ; if ( data instanceof DelegateElement ) { return ( ( DelegateElement ) data ) . getDelegateName ( ) ; } return null ; }
Gets the name of delegate
3,996
public float getMaximumSpan ( int axis ) { if ( view != null ) { return view . getMaximumSpan ( axis ) ; } return Integer . MAX_VALUE ; }
Determines the maximum span for this view along an axis .
3,997
public void paint ( Graphics g , Shape allocation ) { if ( view != null ) { view . paint ( g , allocation ) ; } }
Renders the view .
3,998
public Shape getChildAllocation ( int index , Shape a ) { if ( view != null ) return view . getChildAllocation ( index , a ) ; return a ; }
Fetches the allocation for the given child view . This enables finding out where various views are located without assuming the views store their location . This returns the given allocation since this view simply acts as a gateway between the view hierarchy and the associated component .
3,999
public int viewToModel ( float x , float y , Shape a , Position . Bias [ ] bias ) { if ( view != null ) { int retValue = view . viewToModel ( x , y , a , bias ) ; return retValue ; } return - 1 ; }
Provides a mapping from the view coordinate space to the logical coordinate space of the model .