idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
138,000 | public void rput ( Term [ ] terms , int index , Element value ) throws InvalidTermException { throw new EvaluationException ( MessageUtils . format ( MSG_CANNOT_ADD_CHILD , this . getTypeAsString ( ) ) ) ; } | Add the given child to this resource creating intermediate resources as necessary . If this Element is not a resource then this will throw an InvalidTermException . The default implementation of this method throws such an exception . This resource must be a writable resource otherwise an exception will be thrown . |
138,001 | public static void main ( final String ... args ) { System . out . println ( "starting server" ) ; final Model model = new Model ( ) ; final SynchronizeFxServer syncFxServer = SynchronizeFxBuilder . create ( ) . server ( ) . model ( model ) . callback ( new ServerCallback ( ) { public void onError ( final SynchronizeFX... | The main entry point to the server application . |
138,002 | private static void checkNumericIndex ( long index ) { if ( index > Integer . MAX_VALUE ) { throw EvaluationException . create ( MSG_INDEX_EXCEEDS_MAXIMUM , index , Integer . MAX_VALUE ) ; } else if ( index < Integer . MIN_VALUE ) { throw EvaluationException . create ( MSG_INDEX_BELOW_MINIMUM , index , Integer . MIN_VA... | An internal method to check that a numeric index is valid . It must be a non - negative integer . |
138,003 | private static long [ ] checkStringIndex ( String term ) { assert ( term != null ) ; long [ ] result = { 0L , 1L } ; if ( "" . equals ( term ) ) { throw EvaluationException . create ( MSG_KEY_CANNOT_BE_EMPTY_STRING ) ; } if ( isIndexPattern . matcher ( term ) . matches ( ) ) { if ( isIndexLeadingZerosPattern . matcher ... | An internal method to check that a string value is valid . It can either be an Integer or String which is returned . |
138,004 | public static Term create ( String term ) { Term res = createStringCache . get ( term ) ; if ( res == null ) { if ( term != null && term . length ( ) >= 2 && term . charAt ( 0 ) == '{' && term . charAt ( term . length ( ) - 1 ) == '}' ) { term = EscapeUtils . escape ( term . substring ( 1 , term . length ( ) - 1 ) ) ; ... | Constructor of a path from a String . If the path does not have the correct syntax an IllegalArgumentException will be thrown . |
138,005 | public static Term create ( long index ) { Term res = createLongCache . get ( index ) ; if ( res == null ) { checkNumericIndex ( index ) ; res = ( Term ) LongProperty . getInstance ( index ) ; createLongCache . put ( index , res ) ; return res ; } return res ; } | Create a term directly from a long index . |
138,006 | public static Term create ( Element element ) { if ( element instanceof StringProperty ) { return create ( ( ( StringProperty ) element ) . getValue ( ) ) ; } else if ( element instanceof LongProperty ) { return create ( ( ( LongProperty ) element ) . getValue ( ) . longValue ( ) ) ; } else { throw EvaluationException ... | Create a term from a given element . |
138,007 | public static int compare ( Term self , Term other ) { if ( self == null || other == null ) { throw new NullPointerException ( ) ; } if ( self == other ) { return 0 ; } if ( self . isKey ( ) != other . isKey ( ) ) { return ( self . isKey ( ) ) ? 1 : - 1 ; } try { if ( self . isKey ( ) ) { return self . getKey ( ) . com... | A utility method to allow the comparison of any two terms . |
138,008 | public void execute ( final List < Command > commands ) { try { modelWalkingSynchronizer . doWhenModelWalkerFinished ( ActionType . INCOMMING_COMMANDS , new Runnable ( ) { public void run ( ) { for ( Object command : commands ) { execute ( command ) ; } } } ) ; } catch ( final SynchronizeFXException e ) { topology . on... | Executes commands to change the domain model of the user . |
138,009 | public void commandsForDomainModel ( final CommandsForDomainModelCallback callback ) { if ( this . root == null ) { topology . onError ( new SynchronizeFXException ( "Request to create necessary commands to reproduce the domain model " + " but the root object of the domain model is not set." ) ) ; return ; } try { mode... | This method creates the commands necessary to reproduce the entire domain model . |
138,010 | public void shutDown ( ) { synchronized ( channels ) { isCurrentlyShutingDown = true ; for ( final SynchronizeFXWebsocketChannel server : channels . values ( ) ) { server . shutdown ( ) ; } servers . clear ( ) ; channels . clear ( ) ; clients . clear ( ) ; isCurrentlyShutingDown = false ; } } | Shuts down this servers with all its channels and disconnects all remaining clients . |
138,011 | public void ensureMinimumBuildThreadLimit ( int minLimit ) { if ( buildThreadLimit . get ( ) < minLimit ) { synchronized ( buildThreadLock ) { buildThreadLimit . set ( minLimit ) ; ThreadPoolExecutor buildExecutor = executors . get ( TaskResult . ResultType . BUILD ) ; buildExecutor . setMaximumPoolSize ( minLimit ) ; ... | Ensures that the number of threads in the build pool is at least as large as the number given . Because object templates can have dependencies on each other it is possible to deadlock the compilation with a rigidly fixed build queue . To avoid this allow the build queue limit to be increased . |
138,012 | public synchronized CompilerResults process ( ) { Set < Throwable > exceptions = new TreeSet < Throwable > ( new ThrowableComparator ( ) ) ; long start = new Date ( ) . getTime ( ) ; stats . setFileCount ( files . size ( ) ) ; if ( options . formatters . size ( ) > 0 ) { for ( File f : files ) { ccache . retrieve ( f .... | Process the templates referenced by the CompilerOptions object used to initialize this instance . This will run through the complete compiling building and validation stages as requested . This method should only be invoked once per instance . |
138,013 | public void submit ( Task < ? extends TaskResult > task ) { remainingTasks . incrementAndGet ( ) ; stats . incrementStartedTasks ( task . resultType ) ; executors . get ( task . resultType ) . submit ( task ) ; resultsQueue . add ( task ) ; stats . updateMemoryInfo ( ) ; } | Submits a task to one of the compiler s task queues for processing . Although public this method should only be called by tasks started by the compiler itself . |
138,014 | public static SSLEngine createEngine ( final boolean clientMode ) { if ( context == null ) { context = createContext ( ) ; } SSLEngine engine = context . createSSLEngine ( ) ; engine . setUseClientMode ( clientMode ) ; return engine ; } | Creates a new engine for TLS communication in client or server mode . |
138,015 | public void readChild ( Element element , PrintWriter ps , int level , String name ) { String nbTab = tabMaker ( level ) ; if ( element instanceof Resource ) { Resource resource = ( Resource ) element ; writeBegin ( ps , nbTab , name , level , element . getTypeAsString ( ) ) ; for ( Resource . Entry entry : resource ) ... | Reads each child . |
138,016 | public String tabMaker ( int n ) { StringBuilder buf = new StringBuilder ( "" ) ; for ( int i = 1 ; i <= n ; i ++ ) { buf . append ( " " ) ; } String tab = buf . toString ( ) ; return tab ; } | Calculates the number of tabulations to write at the beginning of a line |
138,017 | public Element put ( String name , Element value ) { assert ( name != null ) ; Element oldValue = null ; if ( value != null ) { oldValue = map . put ( name , value ) ; if ( oldValue != null ) { oldValue . checkValidReplacement ( value ) ; } } else { oldValue = map . remove ( name ) ; } return oldValue ; } | Assign the value to the given variable name . If the value is null then the variable is undefined . If an old value existed then this method will check that the new value is a valid replacement for the old one . If not an exception will be thrown . |
138,018 | private boolean checkField ( EditText editText ) { boolean valid = true ; if ( TextUtils . isEmpty ( editText . getText ( ) ) ) { editText . startAnimation ( mWiggle ) ; editText . requestFocus ( ) ; valid = false ; } return valid ; } | Check if the edit text is valid or not . |
138,019 | public Element put ( int index , Element newValue ) { Element oldValue = null ; int size = list . size ( ) ; if ( index < 0 ) { if ( index < - size ) { throw new EvaluationException ( MessageUtils . format ( MSG_INVALID_NEGATIVE_LIST_INDEX , Integer . toString ( index ) , size ) ) ; } else { index += size ; } } try { i... | This is an optimized version of the put method which doesn t require creating a Term object . |
138,020 | public SoundCloudTrack getCurrentTrack ( ) { if ( mCurrentTrackIndex > - 1 && mCurrentTrackIndex < mSoundCloudPlaylist . getTracks ( ) . size ( ) ) { return mSoundCloudPlaylist . getTracks ( ) . get ( mCurrentTrackIndex ) ; } return null ; } | Return the current track . |
138,021 | public void addAll ( List < SoundCloudTrack > tracks ) { for ( SoundCloudTrack track : tracks ) { add ( mSoundCloudPlaylist . getTracks ( ) . size ( ) , track ) ; } } | Add all tracks at the end of the playlist . |
138,022 | public void add ( int position , SoundCloudTrack track ) { if ( mCurrentTrackIndex == - 1 ) { mCurrentTrackIndex = 0 ; } mSoundCloudPlaylist . addTrack ( position , track ) ; } | Add a track to the given position . |
138,023 | public SoundCloudTrack next ( ) { mCurrentTrackIndex = ( mCurrentTrackIndex + 1 ) % mSoundCloudPlaylist . getTracks ( ) . size ( ) ; return mSoundCloudPlaylist . getTracks ( ) . get ( mCurrentTrackIndex ) ; } | Retrieve the next track . |
138,024 | public SoundCloudTrack previous ( ) { int tracks = mSoundCloudPlaylist . getTracks ( ) . size ( ) ; mCurrentTrackIndex = ( tracks + mCurrentTrackIndex - 1 ) % tracks ; return mSoundCloudPlaylist . getTracks ( ) . get ( mCurrentTrackIndex ) ; } | Retrieve the previous track . |
138,025 | void setPlayingTrack ( int playingTrackPosition ) { if ( playingTrackPosition < 0 || playingTrackPosition >= mSoundCloudPlaylist . getTracks ( ) . size ( ) ) { throw new IllegalArgumentException ( "No tracks a the position " + playingTrackPosition ) ; } mCurrentTrackIndex = playingTrackPosition ; } | Allow to set the current playing song index . private package . |
138,026 | protected String getChannelName ( final HttpServletRequest request ) { final String path = request . getPathInfo ( ) ; return path == null ? "" : path . startsWith ( "/" ) ? path . substring ( 1 ) : path ; } | Extracts the name of the channel the client that invoked a request wants to connect to . |
138,027 | public void destroy ( ) { synchronized ( channels ) { isCurrentlyShutingDown = true ; for ( final SynchronizeFXTomcatChannel server : channels . values ( ) ) { server . shutdown ( ) ; } servers . clear ( ) ; channels . clear ( ) ; isCurrentlyShutingDown = false ; } } | Disconnect all clients an clear the connections when the handler is destroyed by CDI . |
138,028 | public < T > void registerSerializableClass ( final Class < T > clazz , final Serializer < T > serializer ) { kryo . registerSerializableClass ( clazz , serializer ) ; } | Registers a class that may be send over the network . |
138,029 | public static NotificationManager getInstance ( Context context ) { if ( sInstance == null ) { sInstance = new NotificationManager ( context ) ; } return sInstance ; } | Encapsulate player notification behaviour . |
138,030 | private void initializeArtworkTarget ( ) { mThumbnailArtworkTarget = new Target ( ) { public void onBitmapLoaded ( Bitmap bitmap , Picasso . LoadedFrom from ) { mNotificationView . setImageViewBitmap ( R . id . simple_sound_cloud_notification_thumbnail , bitmap ) ; mNotificationExpandedView . setImageViewBitmap ( R . i... | Initialize target used to load artwork asynchronously . |
138,031 | private void initNotificationBuilder ( Context context ) { mNotificationBuilder = new NotificationCompat . Builder ( context ) ; mNotificationView = new RemoteViews ( context . getPackageName ( ) , R . layout . simple_sound_cloud_notification ) ; mNotificationExpandedView = new RemoteViews ( context . getPackageName ( ... | Init all static components of the notification . |
138,032 | private void addSmallIcon ( RemoteViews notificationView ) { notificationView . setInt ( R . id . simple_sound_cloud_notification_icon , "setBackgroundResource" , mNotificationConfig . getNotificationIconBackground ( ) ) ; notificationView . setImageViewResource ( R . id . simple_sound_cloud_notification_icon , mNotifi... | Add the small right icon for Lollipop device . |
138,033 | static public boolean isValidTemplateName ( String name ) { if ( ! validTemplateNameChars . matcher ( name ) . matches ( ) ) { return false ; } for ( String t : name . split ( "/" ) ) { if ( "" . equals ( t ) || t . startsWith ( "." ) ) { return false ; } } return true ; } | Check to see if the given name is a valid template name . Valid template names may include only letters digits underscores hyphens periods pluses and slashes . In addition each term when split by slashes must not be empty and must not start with a period . The second case excludes potential hidden files and special nam... |
138,034 | public Object execute ( Context context , boolean runStatic ) { for ( Statement s : ( ( runStatic ) ? staticStatements : normalStatements ) ) { s . execute ( context ) ; } return null ; } | Execute each of the statements in turn . |
138,035 | public static boolean checkValidInclude ( TemplateType includeeType , TemplateType includedType ) { return allowedIncludes [ includeeType . ordinal ( ) ] [ includedType . ordinal ( ) ] ; } | Determine whether a particular include combination is legal . |
138,036 | public void templateNameVerification ( String expectedName ) throws SyntaxException { if ( ! name . equals ( expectedName ) ) { throw SyntaxException . create ( null , source , MSG_MISNAMED_TPL , expectedName ) ; } } | Check that the internal template name matches the expected template name . |
138,037 | public Observable < ArrayList < SoundCloudTrack > > getArtistTracks ( ) { checkState ( ) ; if ( mCacheRam . tracks . size ( ) != 0 ) { return Observable . create ( new Observable . OnSubscribe < ArrayList < SoundCloudTrack > > ( ) { public void call ( Subscriber < ? super ArrayList < SoundCloudTrack > > subscriber ) { ... | Retrieve the public tracks of the supported artist . |
138,038 | public Observable < SoundCloudUser > getArtistProfile ( ) { checkState ( ) ; if ( mCacheRam . artistProfile != null ) { return Observable . create ( new Observable . OnSubscribe < SoundCloudUser > ( ) { public void call ( Subscriber < ? super SoundCloudUser > subscriber ) { subscriber . onNext ( mCacheRam . artistProfi... | Retrieve SoundCloud artist profile . |
138,039 | public Observable < ArrayList < SoundCloudComment > > getTrackComments ( final SoundCloudTrack track ) { checkState ( ) ; if ( mCacheRam . tracksComments . get ( track . getId ( ) ) != null ) { return Observable . create ( new Observable . OnSubscribe < ArrayList < SoundCloudComment > > ( ) { public void call ( Subscri... | Retrieve comments related to a track of the supported artist . |
138,040 | private Func1 < SoundCloudUser , SoundCloudUser > cacheArtistProfile ( ) { return new Func1 < SoundCloudUser , SoundCloudUser > ( ) { public SoundCloudUser call ( SoundCloudUser soundCloudUser ) { mCacheRam . artistProfile = soundCloudUser ; return soundCloudUser ; } } ; } | Cache the artist profile retrieved from network in RAM to avoid requesting SoundCloud API for next call . |
138,041 | private Func1 < ArrayList < SoundCloudComment > , ArrayList < SoundCloudComment > > cacheTrackComments ( ) { return new Func1 < ArrayList < SoundCloudComment > , ArrayList < SoundCloudComment > > ( ) { public ArrayList < SoundCloudComment > call ( ArrayList < SoundCloudComment > trackComments ) { if ( trackComments . s... | Cache the comments linked to a track retrieved from network in RAM to avoid requesting SoundCloud API for next call . |
138,042 | private Func1 < ArrayList < SoundCloudTrack > , ArrayList < SoundCloudTrack > > cacheTracks ( ) { return new Func1 < ArrayList < SoundCloudTrack > , ArrayList < SoundCloudTrack > > ( ) { public ArrayList < SoundCloudTrack > call ( ArrayList < SoundCloudTrack > soundCloudTracks ) { if ( soundCloudTracks . size ( ) > 0 )... | Cache the tracks list of the supported artist retrieved from network in RAM to avoid requesting SoundCloud API for next call . |
138,043 | protected Term [ ] calculateTerms ( Context context ) throws EvaluationException { Term [ ] terms = new Term [ ops . length ] ; for ( int i = 0 ; i < ops . length ; i ++ ) { terms [ i ] = TermFactory . create ( ops [ i ] . execute ( context ) ) ; } return terms ; } | A utility method that creates a list of terms from the given arguments . |
138,044 | public void cleanReferenceCache ( ) { final long now = currentDateSupplier . get ( ) . getTime ( ) ; final Iterator < HardReference > it = hardReferences . iterator ( ) ; while ( it . hasNext ( ) ) { if ( it . next ( ) . keeptSince . getTime ( ) + REFERENCE_KEEPING_TIME <= now ) { it . remove ( ) ; } } } | Checks and cleans cached references that have timed out . |
138,045 | Iterable < Object > getHardReferences ( ) { final List < Object > references = new ArrayList < Object > ( hardReferences . size ( ) ) ; for ( final HardReference reference : hardReferences ) { references . add ( reference . referenceToKeep ) ; } return references ; } | The list of all references that are currently kept . |
138,046 | public Element execute ( Context context ) { assert ( ops . length == 2 || ops . length == 3 ) ; boolean condition = false ; try { condition = ( ( BooleanProperty ) ops [ 0 ] . execute ( context ) ) . getValue ( ) ; } catch ( ClassCastException cce ) { throw new EvaluationException ( MessageUtils . format ( MSG_INVALID... | Perform the if statement . It will pop a boolean from the data stack . If that boolean is false the next operand if popped from the operand stack ; if true nothing is done . |
138,047 | public void stop ( ) { System . out . print ( "Stopping the client..." ) ; client . disconnect ( ) ; System . out . println ( "done" ) ; } | Disconnect the client when the application is closed . |
138,048 | public static DeprecationWarnings getDeprecationWarnings ( int deprecationLevel , boolean failOnWarn ) { if ( deprecationLevel < 0 ) { return DeprecationWarnings . OFF ; } else { return failOnWarn ? DeprecationWarnings . FATAL : DeprecationWarnings . ON ; } } | Utility method to turn old options into new deprecation flag . |
138,049 | public static CompilerOptions createCheckSyntaxOptions ( DeprecationWarnings deprecationWarnings ) { Pattern debugNsInclude = null ; Pattern debugNsExclude = null ; int maxIteration = 5000 ; int maxRecursion = 50 ; Set < Formatter > formatters = new HashSet < Formatter > ( ) ; File outputDirectory = null ; File annotat... | Create a CompilerOptions object that is appropriate for just doing a syntax check . |
138,050 | private void checkDirectory ( File d , String dtype ) { if ( ! d . isAbsolute ( ) ) { throw new IllegalArgumentException ( dtype + " directory must be an absolute path (" + d . getPath ( ) + ")" ) ; } if ( ! d . exists ( ) ) { throw new IllegalArgumentException ( dtype + " directory does not exist (" + d . getPath ( ) ... | A private utility function to verify that the directory is really a directory exists and absolute . |
138,051 | public Set < File > resolveFileList ( List < String > objectNames , Collection < File > tplFiles ) { Set < File > filesToProcess = new TreeSet < File > ( ) ; if ( tplFiles != null ) { filesToProcess . addAll ( tplFiles ) ; } if ( objectNames != null ) { for ( String oname : objectNames ) { SourceFile source = sourceRep... | Resolve a list of object template names and template Files to a set of files based on this instance s include directories . |
138,052 | public boolean checkDebugEnabled ( String tplName ) { if ( debugNsExclude != null && debugNsExclude . matcher ( tplName ) . matches ( ) ) { return false ; } if ( debugNsInclude != null && debugNsInclude . matcher ( tplName ) . matches ( ) ) { return true ; } return false ; } | A utility function that checks a given template name against the list of debug include and exclude patterns . |
138,053 | public static Set < Formatter > getFormatters ( String s ) { HashSet < Formatter > formatters = new HashSet < Formatter > ( ) ; String [ ] names = s . trim ( ) . split ( "\\s*,\\s*" ) ; for ( String fname : names ) { if ( "text" . equals ( fname ) ) { formatters . add ( TxtFormatter . getInstance ( ) ) ; } else if ( "j... | be used for a compilation . |
138,054 | public static void startActivity ( Context context , String artistName ) { Intent i = new Intent ( context , ArtistActivity . class ) ; i . putExtra ( BUNDLE_KEY_ARTIST_NAME , artistName ) ; context . startActivity ( i ) ; } | Start an ArtistActivity for a given artist name . Start activity pattern . |
138,055 | private void setTrackListPadding ( ) { mPlaylistRecyclerView . getViewTreeObserver ( ) . addOnPreDrawListener ( new ViewTreeObserver . OnPreDrawListener ( ) { public boolean onPreDraw ( ) { mPlaylistRecyclerView . getViewTreeObserver ( ) . removeOnPreDrawListener ( this ) ; int headerListHeight = getResources ( ) . get... | Used to position the track list at the bottom of the screen . |
138,056 | private void getArtistData ( ) { mRetrievedTracks . clear ( ) ; mAdapter . notifyDataSetChanged ( ) ; mTracksSubscription = mCheerleaderClient . getArtistTracks ( ) . subscribeOn ( Schedulers . io ( ) ) . observeOn ( AndroidSchedulers . mainThread ( ) ) . subscribe ( displayTracks ( ) ) ; mProfileSubscription = mCheerl... | Used to retrieved the tracks of the artist as well as artist details . |
138,057 | private String getExtraArtistName ( ) { Bundle extras = getIntent ( ) . getExtras ( ) ; if ( extras == null || ! extras . containsKey ( BUNDLE_KEY_ARTIST_NAME ) ) { return "" ; } return extras . getString ( BUNDLE_KEY_ARTIST_NAME ) ; } | Used to retrieve the artist name for the bundle . |
138,058 | void newMessage ( final byte [ ] message , final Session session ) { callback . recive ( serializer . deserialize ( message ) , session ) ; } | Inform this channel that one of its client has send a message . |
138,059 | public void startModelWalking ( ) { doWhenModelWalkerFinished ( ActionType . MODEL_WALKNG , new Runnable ( ) { public void run ( ) { memberLock . lock ( ) ; modelWalkingInProgess = true ; memberLock . unlock ( ) ; } } ) ; } | Informs this synchronizer that a new model walking process has started . |
138,060 | public void doWhenModelWalkerFinished ( final ActionType type , final Runnable action ) { memberLock . lock ( ) ; if ( ! modelWalkingInProgess ) { memberLock . unlock ( ) ; action . run ( ) ; return ; } CountDownLatch latch = new CountDownLatch ( 1 ) ; Set < CountDownLatch > latches = getLocksForAction ( type ) ; latch... | Lets the current thread sleep until a currently running model walking thread has finished . |
138,061 | public static void pause ( Context context , String clientId ) { Intent intent = new Intent ( context , PlaybackService . class ) ; intent . setAction ( ACTION_PAUSE_PLAYER ) ; intent . putExtra ( BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID , clientId ) ; context . startService ( intent ) ; } | Pause the SoundCloud player . |
138,062 | public static void resume ( Context context , String clientId ) { Intent intent = new Intent ( context , PlaybackService . class ) ; intent . setAction ( ACTION_RESUME_PLAYER ) ; intent . putExtra ( BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID , clientId ) ; context . startService ( intent ) ; } | Resume the SoundCloud player . |
138,063 | public static void stop ( Context context , String clientId ) { Intent intent = new Intent ( context , PlaybackService . class ) ; intent . setAction ( ACTION_STOP_PLAYER ) ; intent . putExtra ( BUNDLE_KEY_SOUND_CLOUD_CLIENT_ID , clientId ) ; context . startService ( intent ) ; } | Stop the SoundCloud player . |
138,064 | public static void registerListener ( Context context , PlaybackListener listener ) { IntentFilter filter = new IntentFilter ( ) ; filter . addAction ( PlaybackListener . ACTION_ON_TRACK_PLAYED ) ; filter . addAction ( PlaybackListener . ACTION_ON_PLAYER_PAUSED ) ; filter . addAction ( PlaybackListener . ACTION_ON_SEEK... | Register a listener to catch player event . |
138,065 | public static void unregisterListener ( Context context , PlaybackListener listener ) { LocalBroadcastManager . getInstance ( context . getApplicationContext ( ) ) . unregisterReceiver ( listener ) ; } | Unregister a registered listener . |
138,066 | private void resume ( ) { if ( mIsPaused ) { mIsPaused = false ; mIsPausedAfterAudioFocusChanged = false ; if ( mAudioManager . requestAudioFocus ( this , AudioManager . STREAM_MUSIC , AudioManager . AUDIOFOCUS_GAIN ) == AudioManager . AUDIOFOCUS_REQUEST_GRANTED ) { mMediaPlayer . start ( ) ; Intent intent = new Intent... | Resume the playback . |
138,067 | private void startTimer ( long duration ) { if ( mCountDown != null ) { mCountDown . cancel ( ) ; mCountDown = null ; } mCountDown = new CountDownTimer ( duration , 1000 ) { public void onTick ( long millisUntilFinished ) { Intent i = new Intent ( PlaybackListener . ACTION_ON_PROGRESS_CHANGED ) ; i . putExtra ( Playbac... | Start internal timer used to propagate the playback position . |
138,068 | private void readObject ( java . io . ObjectInputStream in ) throws IOException , ClassNotFoundException { in . defaultReadObject ( ) ; hashcode = value . hashCode ( ) ; } | This method is used to restore the volatile hashcode value when deserializing a Property object . |
138,069 | public UUID registerIfUnknown ( final Object object ) { final Optional < UUID > id = getId ( object ) ; if ( ! id . isPresent ( ) ) { return registerObject ( object ) ; } return id . get ( ) ; } | Registers an object in the meta model if it is not already registered . |
138,070 | public void registerObject ( final Object object , final UUID id ) { objectToId . put ( object , id ) ; idToObject . put ( id , object ) ; } | Registers an object in this model identified by a pre existing id . |
138,071 | private UUID registerObject ( final Object object ) { UUID id = UUID . randomUUID ( ) ; registerObject ( object , id ) ; return id ; } | Registers an object in this model identified by a newly created id . |
138,072 | public static boolean isXMLNameStart ( int codepoint ) { if ( codepoint >= Character . codePointAt ( "A" , 0 ) && codepoint <= Character . codePointAt ( "Z" , 0 ) ) { return true ; } else if ( codepoint == Character . codePointAt ( "_" , 0 ) ) { return true ; } else if ( codepoint >= Character . codePointAt ( "a" , 0 )... | Determine if the given character is a legal starting character for an XML name . Note that although a colon is a legal value its use is strongly discouraged and this method will return false for a colon . |
138,073 | public static boolean isXMLNamePart ( int codepoint ) { if ( isXMLNameStart ( codepoint ) ) { return true ; } else if ( codepoint >= Character . codePointAt ( "0" , 0 ) && codepoint <= Character . codePointAt ( "9" , 0 ) ) { return true ; } else if ( codepoint == Character . codePointAt ( "-" , 0 ) ) { return true ; } ... | Determine if the given character is a legal non - starting character for an XML name . Note that although a colon is a legal value its use is strongly discouraged and this method will return false for a colon . |
138,074 | public static boolean isValidXMLCharacter ( int codepoint ) { if ( codepoint >= 0x20 && codepoint <= 0xD7FF ) { return true ; } else if ( codepoint == 0x9 || codepoint == 0xA || codepoint == 0xD ) { return true ; } else if ( codepoint >= 0xE000 && codepoint <= 0xFFFD ) { return true ; } else if ( codepoint >= 0x10000 &... | Determine if a given UNICODE character can appear in a valid XML file . The allowed characters are 0x9 0xA 0xD 0x20 - 0xD7FF 0xE000 - 0xFFFD and 0x100000 - 0x10FFFF ; all other characters may not appear in an XML file . |
138,075 | public static boolean isValidXMLName ( String s ) { if ( s == null || "" . equals ( s ) ) { return false ; } if ( ! isXMLNameStart ( s . codePointAt ( 0 ) ) ) { return false ; } int length = s . length ( ) ; int index = 1 ; while ( index < length ) { int codePoint = s . codePointAt ( index ) ; if ( ! isXMLNamePart ( co... | Determine if the given string is a valid XML name . |
138,076 | public static boolean isValidXMLString ( String s ) { int length = s . length ( ) ; int index = 0 ; while ( index < length ) { int codePoint = s . codePointAt ( index ) ; if ( ! isValidXMLCharacter ( codePoint ) ) { return false ; } index += Character . charCount ( codePoint ) ; } return true ; } | Determine if the given string can be written to an XML file without encoding . This will be the case so long as the string does not contain illegal XML characters . |
138,077 | public static String encodeAsXMLName ( String s ) { StringBuilder sb = new StringBuilder ( "_" ) ; for ( byte b : s . getBytes ( Charset . forName ( "UTF-8" ) ) ) { sb . append ( Integer . toHexString ( ( b >>> 4 ) & 0xF ) ) ; sb . append ( Integer . toHexString ( b & 0xF ) ) ; } return sb . toString ( ) ; } | This will encode the given string as a valid XML name . The format will be an initial underscore followed by the hexadecimal representation of the string . |
138,078 | public String formatErrors ( ) { if ( errors . size ( ) > 0 ) { StringBuilder results = new StringBuilder ( ) ; for ( Throwable t : errors ) { results . append ( t . getMessage ( ) ) ; results . append ( "\n" ) ; if ( t instanceof NullPointerException || t instanceof CompilerError ) { results . append ( formatStackTrac... | Format the exceptions thrown during the compilation process . A null value will be returned if no exceptions were thrown . |
138,079 | private void init ( ) { this . setOrientation ( LinearLayout . VERTICAL ) ; mLayoutParams = new LayoutParams ( ViewGroup . LayoutParams . MATCH_PARENT , ViewGroup . LayoutParams . WRAP_CONTENT ) ; } | Initialize the view . |
138,080 | public static void createParentDirectories ( File file ) { File parent = file . getParentFile ( ) ; if ( ! parent . isDirectory ( ) ) { boolean created = parent . mkdirs ( ) ; if ( ! created && ! parent . isDirectory ( ) ) { throw new SystemException ( MessageUtils . format ( MSG_CANNOT_CREATE_OUTPUT_DIRECTORY , parent... | Creates parent directories of the given file . The file must be absolute . |
138,081 | protected static void checkStaticIndexes ( SourceRange sourceRange , Operation ... operations ) throws SyntaxException { for ( int i = 0 ; i < operations . length ; i ++ ) { if ( operations [ i ] instanceof Element ) { try { TermFactory . create ( ( Element ) operations [ i ] ) ; } catch ( EvaluationException ee ) { th... | Ensure that any constant indexes in the operation list are valid terms . |
138,082 | protected void validName ( String name ) throws SyntaxException { for ( String varName : automaticVariables ) { if ( varName . equals ( name ) ) { throw SyntaxException . create ( getSourceRange ( ) , MSG_AUTO_VAR_CANNOT_BE_SET , varName ) ; } } } | A utility method to determine if the variable name collides with one of the reserved automatic variables . |
138,083 | private String getVersion ( boolean verbose ) { try { InputStream stream = getClass ( ) . getResourceAsStream ( "/version.properties" ) ; Properties props = new Properties ( ) ; props . load ( stream ) ; if ( verbose ) { return String . format ( "Version=%s, build date=%s" , props . getProperty ( "version" ) , props . ... | Retrieve the current version . |
138,084 | private void setDefaults ( ) { if ( xsdInput == null ) { setXsdInput ( DEFAULT_INPUT_FOLDER_PATH ) ; } if ( output == null ) { setOutput ( DEFAULT_OUTPUT_FOLDER_PATH ) ; } if ( avroNamespacePrefix == null ) { setAvroNamespacePrefix ( DEFAULT_AVRO_NAMESPACE_PREFIX ) ; } } | Make sure mandatory parameters have default values . |
138,085 | private void applyMax ( Dimension dim ) { if ( getMaxHeight ( ) > 0 ) { dim . height = Math . min ( dim . height , getMaxHeight ( ) ) ; } if ( getMaxWidth ( ) > 0 ) { dim . width = Math . min ( dim . width , getMaxWidth ( ) ) ; } } | Applies the maximum height and width to the dimension . |
138,086 | protected void analyzeElVars ( final T descriptor , final DescriptorContext context ) { descriptor . el = ElAnalyzer . analyzeQuery ( context . generics , descriptor . command ) ; } | Analyze query string for el variables and creates el descriptor . |
138,087 | protected void analyzeParameters ( final T descriptor , final DescriptorContext context ) { final CommandParamsContext paramsContext = new CommandParamsContext ( context ) ; spiService . process ( descriptor , paramsContext ) ; } | Analyze method parameters search for extensions and prepare parameters context . |
138,088 | private void wrapText ( ) { if ( getFont ( ) == null || text == null ) { return ; } FontMetrics fm = getFontMetrics ( getFont ( ) ) ; StringBuilder tempText = new StringBuilder ( ) ; StringBuilder finalText = new StringBuilder ( "<html>" ) ; finalText . append ( "<STYLE type='text/css'>BODY { text-align: " ) ; finalTex... | The plain text is converted to HTML code . The wrap locations are calculated with the defined wrap width and component width . |
138,089 | public void checkFieldsCompatible ( final String ... fields ) { final Set < String > indexFields = Sets . newHashSet ( index . getDefinition ( ) . getFields ( ) ) ; final Joiner joiner = Joiner . on ( "," ) ; check ( indexFields . equals ( Sets . newHashSet ( fields ) ) , "Existing index '%s' (class '%s') fields '%s' a... | Checks if existing index consists of exactly the same fields . If not error thrown to indicate probable programmer error . |
138,090 | public void dropIndex ( final ODatabaseObject db ) { final String name = index . getName ( ) ; logger . info ( "Dropping existing index '{}' (class '{}'), because of definition mismatch" , name , index . getDefinition ( ) . getClassName ( ) ) ; SchemeUtils . dropIndex ( db , name ) ; } | Drops index . |
138,091 | @ SuppressWarnings ( "PMD.LinguisticNaming" ) public IndexMatchVerifier isIndexSigns ( final Object ... signs ) { final List < Object > idxsigns = Lists . newArrayList ( ) ; idxsigns . add ( index . getType ( ) ) ; idxsigns . addAll ( Arrays . asList ( signs ) ) ; return new IndexMatchVerifier ( idxsigns ) ; } | Compares current index configuration with new signature . Used to decide if index should be dropped and re - created or its completely equal to new signature . |
138,092 | public static Class < ? extends CobolContext > getInputKeyCobolContext ( Configuration conf ) { return conf . getClass ( CONF_INPUT_KEY_COBOL_CONTEXT , null , CobolContext . class ) ; } | Gets the job input key mainframe COBOL parameters . |
138,093 | public static void setInputKeyRecordType ( Job job , Class < ? extends CobolComplexType > cobolType ) { job . getConfiguration ( ) . setClass ( CONF_INPUT_KEY_RECORD_TYPE , cobolType , CobolComplexType . class ) ; } | Sets the job input key mainframe record type . |
138,094 | public static Class < ? extends CobolComplexType > getInputKeyRecordType ( Configuration conf ) { return conf . getClass ( CONF_INPUT_KEY_RECORD_TYPE , null , CobolComplexType . class ) ; } | Gets the job input key mainframe record type . |
138,095 | public static void setInputRecordMatcher ( Job job , Class < ? extends CobolTypeFinder > matcherClass ) { job . getConfiguration ( ) . setClass ( CONF_INPUT_RECORD_MATCHER_CLASS , matcherClass , CobolTypeFinder . class ) ; } | Sets the job input record matcher class . |
138,096 | public static Class < ? extends CobolTypeFinder > getInputRecordMatcher ( Configuration conf ) { return conf . getClass ( CONF_INPUT_RECORD_MATCHER_CLASS , null , CobolTypeFinder . class ) ; } | Gets the job input record matcher class . |
138,097 | public static void setInputChoiceStrategy ( Job job , Class < ? extends FromCobolChoiceStrategy > choiceStrategyClass ) { job . getConfiguration ( ) . setClass ( CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS , choiceStrategyClass , FromCobolChoiceStrategy . class ) ; } | Sets the job input record choice strategy class . |
138,098 | public static Class < ? extends FromCobolChoiceStrategy > getInputChoiceStrategy ( Configuration conf ) { return conf . getClass ( CONF_INPUT_RECORD_CHOICE_STRATEGY_CLASS , null , FromCobolChoiceStrategy . class ) ; } | Gets the job input record choice strategy class . |
138,099 | public int readFully ( byte b [ ] , int off , int len ) throws IOException { IOUtils . readFully ( inStream , b , off , len ) ; return len ; } | Read a number of bytes from the input stream blocking until all requested bytes are read or end of file is reached . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.