idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
11,700 | private static byte [ ] generateKey ( int size ) throws SymmetricKeyException { if ( size <= 0 ) throw new IllegalArgumentException ( "Size cannot be zero or less than zero." ) ; try { SecureRandom secureRandom = new SecureRandom ( ) ; KeyGenerator keyGenerator = KeyGenerator . getInstance ( "AES" ) ; keyGenerator . in... | Generate an AES key of the specifies size in bytes . | 130 | 12 |
11,701 | private static byte [ ] secureRandom ( int size ) { if ( size <= 0 ) throw new IllegalArgumentException ( "Size cannot be zero or less than zero." ) ; SecureRandom secureRandom = new SecureRandom ( ) ; byte [ ] bytes = new byte [ size ] ; secureRandom . nextBytes ( bytes ) ; return bytes ; } | Secure random bytes of size in bytes | 72 | 7 |
11,702 | private Cipher getCipher ( int mode , byte [ ] iv ) throws SymmetricKeyException { Cipher cipher = null ; try { cipher = getCipherInstance ( "AES/CBC/PKCS7Padding" ) ; if ( cipher == null ) { throw new SymmetricKeyException ( "Cannot get a cipher instance for AES/CBC/PKCS7Padding algorithm" ) ; } SecretKey secret = new... | Get a cipher instance for either encrypt or decrypt mode with an IV header . | 231 | 15 |
11,703 | private Cipher getCipherInstance ( String algorithm ) { Cipher cipher = null ; if ( ! useBCProvider ) { try { cipher = Cipher . getInstance ( algorithm ) ; } catch ( NoSuchAlgorithmException e ) { Log . v ( Log . TAG_SYMMETRIC_KEY , "Cannot find a cipher (no algorithm); will try with Bouncy Castle provider." ) ; } catc... | Get a cipher instance for the algorithm . It will try to use the Cipher from the default security provider by the platform . If it couldn t find the cipher it will try to the cipher from the Bouncy Castle if the BouncyCastle library is available . | 325 | 54 |
11,704 | public synchronized long addValue ( String value ) { sequences . add ( ++ lastSequence ) ; values . add ( value ) ; return lastSequence ; } | Adds a value to the map assigning it a sequence number and returning it . Sequence numbers start at 1 and increment from there . | 33 | 25 |
11,705 | public synchronized long getCheckpointedSequence ( ) { long sequence = lastSequence ; if ( ! sequences . isEmpty ( ) ) { sequence = sequences . first ( ) - 1 ; } if ( sequence > firstValueSequence ) { // Garbage-collect inaccessible values: int numToRemove = ( int ) ( sequence - firstValueSequence ) ; for ( int i = 0 ;... | Returns the maximum consecutively - removed sequence number . This is one less than the minimum remaining sequence number . | 115 | 21 |
11,706 | public synchronized String getCheckpointedValue ( ) { int index = ( int ) ( getCheckpointedSequence ( ) - firstValueSequence ) ; return ( index >= 0 ) ? values . get ( index ) : null ; } | Returns the value associated with the checkpointedSequence . | 50 | 11 |
11,707 | public static void serialize ( Serializable obj , ByteArrayOutputStream bout ) { try { ObjectOutputStream out = new ObjectOutputStream ( bout ) ; out . writeObject ( obj ) ; out . close ( ) ; } catch ( IOException e ) { throw new IllegalStateException ( "Could not serialize " + obj , e ) ; } } | Serialize the given object into the given stream | 74 | 9 |
11,708 | public static List < String > readToList ( File f ) throws IOException { try ( final Reader reader = asReaderUTF8Lenient ( new FileInputStream ( f ) ) ) { return readToList ( reader ) ; } catch ( IOException ioe ) { throw new IllegalStateException ( String . format ( "Failed to read %s: %s" , f . getAbsolutePath ( ) , ... | Read the file line for line and return the result in a list | 98 | 13 |
11,709 | public static List < String > readToList ( Reader r ) throws IOException { try ( BufferedReader in = new BufferedReader ( r ) ) { List < String > l = new ArrayList <> ( ) ; String line = null ; while ( ( line = in . readLine ( ) ) != null ) l . add ( line ) ; return Collections . unmodifiableList ( l ) ; } } | Read the Reader line for line and return the result in a list | 87 | 13 |
11,710 | public static String readFileToString ( File f ) throws IOException { StringWriter sw = new StringWriter ( ) ; IO . copyAndCloseBoth ( Common . asReaderUTF8Lenient ( new FileInputStream ( f ) ) , sw ) ; return sw . toString ( ) ; } | Read the contents of the given file into a string | 62 | 10 |
11,711 | public void appendToLog ( String logAppendMessage ) { ProfilingTimerNode currentNode = current . get ( ) ; if ( currentNode != null ) { currentNode . appendToLog ( logAppendMessage ) ; } } | Append the given string to the log message of the current subtask | 49 | 14 |
11,712 | public void mergeTree ( ProfilingTimerNode otherRoot ) { ProfilingTimerNode currentNode = current . get ( ) ; Preconditions . checkNotNull ( currentNode ) ; mergeOrAddNode ( currentNode , otherRoot ) ; } | Merges the specified tree as a child under the current node . | 51 | 13 |
11,713 | private static void writeToLog ( int level , long totalNanos , long count , ProfilingTimerNode parent , String taskName , Log log , String logAppendMessage ) { if ( log == null ) { return ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < level ; i ++ ) { sb . append ( ' ' ) ; } String durationText = ... | Writes one profiling line of information to the log | 220 | 10 |
11,714 | public static < T extends TBase > String serializeJson ( T obj ) throws TException { // Tried having a static final serializer, but it doesn't seem to be thread safe return new TSerializer ( new TJSONProtocol . Factory ( ) ) . toString ( obj , THRIFT_CHARSET ) ; } | Serialize a JSON - encoded thrift object | 71 | 9 |
11,715 | public static < T extends TBase > T deserializeJson ( T dest , String thriftJson ) throws TException { // Tried having a static final deserializer, but it doesn't seem to be thread safe new TDeserializer ( new TJSONProtocol . Factory ( ) ) . deserialize ( dest , thriftJson , THRIFT_CHARSET ) ; return dest ; } | Deserialize a JSON - encoded thrift object | 88 | 10 |
11,716 | public static String sepList ( String sep , Iterable < ? > os , int max ) { return sepList ( sep , null , os , max ) ; } | Same as sepList with no wrapping | 34 | 7 |
11,717 | Word2VecModel train ( Log log , TrainingProgressListener listener , Iterable < List < String > > sentences ) throws InterruptedException { try ( ProfilingTimer timer = ProfilingTimer . createLoggingSubtasks ( log , "Training word2vec" ) ) { final Multiset < String > counts ; try ( AC ac = timer . start ( "Acquiring wor... | Train a model using the given data | 351 | 7 |
11,718 | private void normalize ( ) { for ( int i = 0 ; i < vocab . size ( ) ; ++ i ) { double len = 0 ; for ( int j = i * layerSize ; j < ( i + 1 ) * layerSize ; ++ j ) len += vectors . get ( j ) * vectors . get ( j ) ; len = Math . sqrt ( len ) ; for ( int j = i * layerSize ; j < ( i + 1 ) * layerSize ; ++ j ) vectors . put (... | Normalizes the vectors in this model | 124 | 7 |
11,719 | protected void init ( ) throws IOException { if ( internalIn2 != null ) return ; String encoding ; byte bom [ ] = new byte [ BOM_SIZE ] ; int n , unread ; n = internalIn . read ( bom , 0 , bom . length ) ; if ( ( bom [ 0 ] == ( byte ) 0x00 ) && ( bom [ 1 ] == ( byte ) 0x00 ) && ( bom [ 2 ] == ( byte ) 0xFE ) && ( bom [... | Read - ahead four bytes and check for BOM . Extra bytes are unread back to the stream only BOM bytes are skipped . | 501 | 27 |
11,720 | public static File getDir ( File parent , String item ) { File dir = new File ( parent , item ) ; return ( dir . exists ( ) && dir . isDirectory ( ) ) ? dir : null ; } | Returns a subdirectory of a given directory ; the subdirectory is expected to already exist . | 45 | 18 |
11,721 | public static boolean deleteRecursive ( final File file ) { boolean result = true ; if ( file . isDirectory ( ) ) { for ( final File inner : file . listFiles ( ) ) { result &= deleteRecursive ( inner ) ; } } return result & file . delete ( ) ; } | Deletes a file or directory . If the file is a directory it recursively deletes it . | 63 | 21 |
11,722 | public static File createTempFile ( byte [ ] fileContents , String namePrefix , String extension ) throws IOException { Preconditions . checkNotNull ( fileContents , "file contents missing" ) ; File tempFile = File . createTempFile ( namePrefix , extension ) ; try ( FileOutputStream fos = new FileOutputStream ( tempFil... | Stores the given contents into a temporary file | 93 | 9 |
11,723 | public static void demoWord ( ) throws IOException , TException , InterruptedException , UnknownWordException { File f = new File ( "text8" ) ; if ( ! f . exists ( ) ) throw new IllegalStateException ( "Please download and unzip the text8 example from http://mattmahoney.net/dc/text8.zip" ) ; List < String > read = Comm... | Trains a model and allows user to find similar words demo - word . sh example from the open source C implementation | 461 | 23 |
11,724 | public static void loadModel ( ) throws IOException , TException , UnknownWordException { final Word2VecModel model ; try ( ProfilingTimer timer = ProfilingTimer . create ( LOG , "Loading model" ) ) { String json = Common . readFileToString ( new File ( "text8.model" ) ) ; model = Word2VecModel . fromThrift ( ThriftUti... | Loads a model and allows user to find similar words | 120 | 11 |
11,725 | public static void skipGram ( ) throws IOException , TException , InterruptedException , UnknownWordException { List < String > read = Common . readToList ( new File ( "sents.cleaned.word2vec.txt" ) ) ; List < List < String > > partitioned = Lists . transform ( read , new Function < String , List < String > > ( ) { @ O... | Example using Skip - Gram model | 372 | 6 |
11,726 | private Catalogo copy ( Catalogo catalogo ) throws Exception { DocumentBuilderFactory dbf = DocumentBuilderFactory . newInstance ( ) ; dbf . setNamespaceAware ( true ) ; DocumentBuilder db = dbf . newDocumentBuilder ( ) ; Document doc = db . newDocument ( ) ; Marshaller m = context . createMarshaller ( ) ; m . marshal ... | Defensive deep - copy | 120 | 5 |
11,727 | private String [ ] findFeatureByScenarioName ( String scenarioName ) throws IllegalAccessException { List < Description > testClasses = findTestClassesLevel ( parentDescription . getChildren ( ) ) ; for ( Description testClass : testClasses ) { List < Description > features = findFeaturesLevel ( testClass . getChildren... | Find feature and story for given scenario | 279 | 7 |
11,728 | Stories getStoriesAnnotation ( final String [ ] value ) { return new Stories ( ) { @ Override public String [ ] value ( ) { return value ; } @ Override public Class < Stories > annotationType ( ) { return Stories . class ; } } ; } | Creates Story annotation object | 58 | 5 |
11,729 | Features getFeaturesAnnotation ( final String [ ] value ) { return new Features ( ) { @ Override public String [ ] value ( ) { return value ; } @ Override public Class < Features > annotationType ( ) { return Features . class ; } } ; } | Creates Feature annotation object | 56 | 5 |
11,730 | public < E extends Enum < E > > List < E > getTypeList ( Class < E > clz , E [ ] typeList ) { if ( typeList . length > 0 ) { return new ArrayList <> ( Arrays . asList ( typeList ) ) ; } else { return new ArrayList <> ( EnumSet . allOf ( clz ) ) ; } } | Get a list of the enums passed | 84 | 8 |
11,731 | public ExternalID getPersonExternalIds ( int personId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , personId ) ; URL url = new ApiUrl ( apiKey , MethodBase . PERSON ) . subMethod ( MethodSub . EXTERNAL_IDS ) . buildUrl ( parameters ) ; String webpage = ... | Get the external ids for a specific person id . | 153 | 11 |
11,732 | public ResultList < Artwork > getPersonImages ( int personId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , personId ) ; URL url = new ApiUrl ( apiKey , MethodBase . PERSON ) . subMethod ( MethodSub . IMAGES ) . buildUrl ( parameters ) ; String webpage =... | Get the images for a specific person id . | 196 | 9 |
11,733 | public ResultList < PersonFind > getPersonPopular ( Integer page ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . PAGE , page ) ; URL url = new ApiUrl ( apiKey , MethodBase . PERSON ) . subMethod ( MethodSub . POPULAR ) . buildUrl ( parameters ) ; WrapperGeneri... | Get the list of popular people on The Movie Database . | 120 | 11 |
11,734 | public List < Artwork > getAll ( ArtworkType ... artworkList ) { List < Artwork > artwork = new ArrayList <> ( ) ; List < ArtworkType > types ; if ( artworkList . length > 0 ) { types = new ArrayList <> ( Arrays . asList ( artworkList ) ) ; } else { types = new ArrayList <> ( Arrays . asList ( ArtworkType . values ( ) ... | Return a list of all the artwork with their types . | 297 | 11 |
11,735 | private void updateArtworkType ( List < Artwork > artworkList , ArtworkType type ) { for ( Artwork artwork : artworkList ) { artwork . setArtworkType ( type ) ; } } | Update the artwork type for the artwork list | 43 | 8 |
11,736 | public TokenAuthorisation getAuthorisationToken ( ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; URL url = new ApiUrl ( apiKey , MethodBase . AUTH ) . subMethod ( MethodSub . TOKEN_NEW ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { return MAPPER .... | This method is used to generate a valid request token for user based authentication . | 136 | 15 |
11,737 | public TokenSession getSessionToken ( TokenAuthorisation token ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; if ( ! token . getSuccess ( ) ) { throw new MovieDbException ( ApiExceptionType . AUTH_FAILURE , "Authorisation token was not successful!" ) ; } parameters . add ( Param . TOKE... | This method is used to generate a session id for user based authentication . | 195 | 14 |
11,738 | public TokenSession getGuestSessionToken ( ) throws MovieDbException { URL url = new ApiUrl ( apiKey , MethodBase . AUTH ) . subMethod ( MethodSub . GUEST_SESSION ) . buildUrl ( ) ; String webpage = httpTools . getRequest ( url ) ; try { return MAPPER . readValue ( webpage , TokenSession . class ) ; } catch ( IOExcepti... | This method is used to generate a guest session id . | 122 | 11 |
11,739 | private void initialise ( String apiKey , HttpTools httpTools ) { tmdbAccount = new TmdbAccount ( apiKey , httpTools ) ; tmdbAuth = new TmdbAuthentication ( apiKey , httpTools ) ; tmdbCertifications = new TmdbCertifications ( apiKey , httpTools ) ; tmdbChanges = new TmdbChanges ( apiKey , httpTools ) ; tmdbCollections ... | Initialise the sub - classes once the API key and http client are known | 416 | 15 |
11,740 | public ResultList < MovieBasic > getFavoriteMovies ( String sessionId , int accountId ) throws MovieDbException { return tmdbAccount . getFavoriteMovies ( sessionId , accountId ) ; } | Get the account favourite movies | 44 | 5 |
11,741 | public StatusCode modifyFavoriteStatus ( String sessionId , int accountId , Integer mediaId , MediaType mediaType , boolean isFavorite ) throws MovieDbException { return tmdbAccount . modifyFavoriteStatus ( sessionId , accountId , mediaType , mediaId , isFavorite ) ; } | Add or remove a movie to an accounts favourite list . | 60 | 11 |
11,742 | public ResultList < TVBasic > getWatchListTV ( String sessionId , int accountId , Integer page , String sortBy , String language ) throws MovieDbException { return tmdbAccount . getWatchListTV ( sessionId , accountId , page , sortBy , language ) ; } | Get the list of movies on an accounts watchlist . | 61 | 11 |
11,743 | public StatusCode addToWatchList ( String sessionId , int accountId , MediaType mediaType , Integer mediaId ) throws MovieDbException { return tmdbAccount . modifyWatchList ( sessionId , accountId , mediaType , mediaId , true ) ; } | Add a movie to an accounts watch list . | 56 | 9 |
11,744 | public StatusCode removeFromWatchList ( String sessionId , int accountId , MediaType mediaType , Integer mediaId ) throws MovieDbException { return tmdbAccount . modifyWatchList ( sessionId , accountId , mediaType , mediaId , false ) ; } | Remove a movie from an accounts watch list . | 56 | 9 |
11,745 | public ResultList < TVBasic > getFavoriteTv ( String sessionId , int accountId ) throws MovieDbException { return tmdbAccount . getFavoriteTv ( sessionId , accountId ) ; } | Get the list of favorite TV series for an account . | 44 | 11 |
11,746 | public ResultList < ChangeListItem > getMovieChangeList ( Integer page , String startDate , String endDate ) throws MovieDbException { return tmdbChanges . getChangeList ( MethodBase . MOVIE , page , startDate , endDate ) ; } | Get a list of Movie IDs that have been edited . | 55 | 11 |
11,747 | public ResultList < ChangeListItem > getTvChangeList ( Integer page , String startDate , String endDate ) throws MovieDbException { return tmdbChanges . getChangeList ( MethodBase . TV , page , startDate , endDate ) ; } | Get a list of TV IDs that have been edited . | 55 | 11 |
11,748 | public ResultList < ChangeListItem > getPersonChangeList ( Integer page , String startDate , String endDate ) throws MovieDbException { return tmdbChanges . getChangeList ( MethodBase . PERSON , page , startDate , endDate ) ; } | Get a list of PersonInfo IDs that have been edited . | 54 | 12 |
11,749 | public ResultList < MovieBasic > getGenreMovies ( int genreId , String language , Integer page , Boolean includeAllMovies , Boolean includeAdult ) throws MovieDbException { return tmdbGenre . getGenreMovies ( genreId , language , page , includeAllMovies , includeAdult ) ; } | Get a list of movies per genre . | 68 | 8 |
11,750 | public boolean checkItemStatus ( String listId , Integer mediaId ) throws MovieDbException { return tmdbList . checkItemStatus ( listId , mediaId ) ; } | Check to see if an item is already on a list . | 37 | 12 |
11,751 | public StatusCode removeItemFromList ( String sessionId , String listId , Integer mediaId ) throws MovieDbException { return tmdbList . removeItem ( sessionId , listId , mediaId ) ; } | This method lets users remove items from a list that they created . | 45 | 13 |
11,752 | public ResultList < Video > getMovieVideos ( int movieId , String language ) throws MovieDbException { return tmdbMovies . getMovieVideos ( movieId , language ) ; } | This method is used to retrieve all of the trailers for a particular movie . | 42 | 15 |
11,753 | public ResultList < Review > getMovieReviews ( int movieId , Integer page , String language ) throws MovieDbException { return tmdbMovies . getMovieReviews ( movieId , page , language ) ; } | Get the reviews for a particular movie id . | 47 | 9 |
11,754 | public ResultList < UserList > getMovieLists ( int movieId , Integer page , String language ) throws MovieDbException { return tmdbMovies . getMovieLists ( movieId , page , language ) ; } | Get the lists that the movie belongs to | 48 | 8 |
11,755 | public ResultList < MovieInfo > getTopRatedMovies ( Integer page , String language ) throws MovieDbException { return tmdbMovies . getTopRatedMovies ( page , language ) ; } | This method is used to retrieve the top rated movies that have over 10 votes on TMDb . | 43 | 20 |
11,756 | public PersonCreditList < CreditTVBasic > getPersonTVCredits ( int personId , String language ) throws MovieDbException { return tmdbPeople . getPersonTVCredits ( personId , language ) ; } | Get the TV credits for a specific person id . | 44 | 10 |
11,757 | public ResultList < ChangeKeyItem > getPersonChanges ( int personId , String startDate , String endDate ) throws MovieDbException { return tmdbPeople . getPersonChanges ( personId , startDate , endDate ) ; } | Get the changes for a specific person id . | 50 | 9 |
11,758 | public ResultList < Keyword > searchKeyword ( String query , Integer page ) throws MovieDbException { return tmdbSearch . searchKeyword ( query , page ) ; } | Search for keywords by name | 38 | 5 |
11,759 | public MediaState getTVAccountState ( int tvID , String sessionID ) throws MovieDbException { return tmdbTv . getTVAccountState ( tvID , sessionID ) ; } | This method lets users get the status of whether or not the TV show has been rated or added to their favourite or watch lists . | 41 | 26 |
11,760 | public ExternalID getTVExternalIDs ( int tvID , String language ) throws MovieDbException { return tmdbTv . getTVExternalIDs ( tvID , language ) ; } | Get the external ids that we have stored for a TV series . | 39 | 14 |
11,761 | public StatusCode postTVRating ( int tvID , int rating , String sessionID , String guestSessionID ) throws MovieDbException { return tmdbTv . postTVRating ( tvID , rating , sessionID , guestSessionID ) ; } | This method lets users rate a TV show . | 53 | 9 |
11,762 | public ResultList < TVInfo > getTVSimilar ( int tvID , Integer page , String language ) throws MovieDbException { return tmdbTv . getTVSimilar ( tvID , page , language ) ; } | Get the similar TV shows for a specific tv id . | 46 | 11 |
11,763 | public ResultList < TVInfo > getTVOnTheAir ( Integer page , String language ) throws MovieDbException { return tmdbTv . getTVOnTheAir ( page , language ) ; } | Get the list of TV shows that are currently on the air . | 43 | 13 |
11,764 | public ResultList < TVInfo > getTVAiringToday ( Integer page , String language , String timezone ) throws MovieDbException { return tmdbTv . getTVAiringToday ( page , language , timezone ) ; } | Get the list of TV shows that air today . | 50 | 10 |
11,765 | public ExternalID getSeasonExternalID ( int tvID , int seasonNumber , String language ) throws MovieDbException { return tmdbSeasons . getSeasonExternalID ( tvID , seasonNumber , language ) ; } | Get the external ids that we have stored for a TV season by season number . | 46 | 17 |
11,766 | public ResultList < Artwork > getSeasonImages ( int tvID , int seasonNumber , String language , String ... includeImageLanguage ) throws MovieDbException { return tmdbSeasons . getSeasonImages ( tvID , seasonNumber , language , includeImageLanguage ) ; } | Get the images that we have stored for a TV season by season number . | 58 | 15 |
11,767 | public MediaCreditList getEpisodeCredits ( int tvID , int seasonNumber , int episodeNumber ) throws MovieDbException { return tmdbEpisodes . getEpisodeCredits ( tvID , seasonNumber , episodeNumber ) ; } | Get the TV episode credits by combination of season and episode number . | 47 | 13 |
11,768 | public ExternalID getEpisodeExternalID ( int tvID , int seasonNumber , int episodeNumber , String language ) throws MovieDbException { return tmdbEpisodes . getEpisodeExternalID ( tvID , seasonNumber , episodeNumber , language ) ; } | Get the external ids for a TV episode by comabination of a season and episode number . | 53 | 20 |
11,769 | public ResultsMap < String , List < Certification > > getMoviesCertification ( ) throws MovieDbException { URL url = new ApiUrl ( apiKey , MethodBase . CERTIFICATION ) . subMethod ( MethodSub . MOVIE_LIST ) . buildUrl ( ) ; String webpage = httpTools . getRequest ( url ) ; try { JsonNode node = MAPPER . readTree ( webp... | Get a list of movies certification . | 193 | 7 |
11,770 | private static boolean compareTitles ( String primaryTitle , String firstCompareTitle , String secondCompareTitle , int maxDistance ) { // Compare with the first title if ( compareDistance ( primaryTitle , firstCompareTitle , maxDistance ) ) { return true ; } // Compare with the other title return compareDistance ( pri... | Compare a title with two other titles . | 75 | 8 |
11,771 | public static boolean movies ( final MovieInfo moviedb , final String title , final String year , int maxDistance ) { return Compare . movies ( moviedb , title , year , maxDistance , true ) ; } | Compare the MovieDB object with a title and year case sensitive | 45 | 12 |
11,772 | private static boolean compareDistance ( final String title1 , final String title2 , int distance ) { return StringUtils . getLevenshteinDistance ( title1 , title2 ) <= distance ; } | Compare the Levenshtein Distance between the two strings | 42 | 11 |
11,773 | public MediaCreditList getMovieCredits ( int movieId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , movieId ) ; URL url = new ApiUrl ( apiKey , MethodBase . MOVIE ) . subMethod ( MethodSub . CREDITS ) . buildUrl ( parameters ) ; String webpage = httpTool... | Get the cast and crew information for a specific movie id . | 150 | 12 |
11,774 | public ResultList < Keyword > getMovieKeywords ( int movieId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , movieId ) ; URL url = new ApiUrl ( apiKey , MethodBase . MOVIE ) . subMethod ( MethodSub . KEYWORDS ) . buildUrl ( parameters ) ; String webpage =... | This method is used to retrieve all of the keywords that have been added to a particular movie . | 198 | 19 |
11,775 | public ResultList < MovieInfo > getRecommendations ( int movieId , String language ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , movieId ) ; parameters . add ( Param . LANGUAGE , language ) ; URL url = new ApiUrl ( apiKey , MethodBase . MOVIE ) . subMet... | The recommendations method will let you retrieve the movie recommendations for a particular movie . | 143 | 15 |
11,776 | public ResultList < ReleaseDates > getReleaseDates ( int movieId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , movieId ) ; URL url = new ApiUrl ( apiKey , MethodBase . MOVIE ) . subMethod ( MethodSub . RELEASE_DATES ) . buildUrl ( parameters ) ; Wrapper... | Get the release dates certifications and related information by country for a specific movie id . | 128 | 17 |
11,777 | public ResultList < Translation > getMovieTranslations ( int movieId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , movieId ) ; URL url = new ApiUrl ( apiKey , MethodBase . MOVIE ) . subMethod ( MethodSub . TRANSLATIONS ) . buildUrl ( parameters ) ; Stri... | This method is used to retrieve a list of the available translations for a specific movie . | 194 | 17 |
11,778 | public ResultList < ChangeKeyItem > getMovieChanges ( int movieId , String startDate , String endDate ) throws MovieDbException { return getMediaChanges ( movieId , startDate , endDate ) ; } | Get the changes for a specific movie ID . | 45 | 9 |
11,779 | public MediaCreditList getSeasonCredits ( int tvID , int seasonNumber ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , tvID ) ; parameters . add ( Param . SEASON_NUMBER , seasonNumber ) ; URL url = new ApiUrl ( apiKey , MethodBase . SEASON ) . subMethod ( ... | Get the cast & crew credits for a TV season by season number . | 170 | 14 |
11,780 | public URL buildUrl ( final TmdbParameters params ) { StringBuilder urlString = new StringBuilder ( TMDB_API_BASE ) ; LOG . trace ( "Method: '{}', Sub-method: '{}', Params: {}" , method . getValue ( ) , submethod . getValue ( ) , ToStringBuilder . reflectionToString ( params , ToStringStyle . SHORT_PREFIX_STYLE ) ) ; /... | Build the URL from the pre - created parameters . | 318 | 10 |
11,781 | private StringBuilder queryProcessing ( TmdbParameters params ) { StringBuilder urlString = new StringBuilder ( ) ; // Append the suffix of the API URL if ( submethod != MethodSub . NONE ) { urlString . append ( "/" ) . append ( submethod . getValue ( ) ) ; } // Append the key information urlString . append ( DELIMITER... | Create the query based URL portion | 240 | 6 |
11,782 | private StringBuilder idProcessing ( final TmdbParameters params ) { StringBuilder urlString = new StringBuilder ( ) ; // Append the ID if ( params . has ( Param . ID ) ) { urlString . append ( "/" ) . append ( params . get ( Param . ID ) ) ; } if ( params . has ( Param . SEASON_NUMBER ) ) { urlString . append ( "/seas... | Create the ID based URL portion | 231 | 6 |
11,783 | private StringBuilder otherProcessing ( final TmdbParameters params ) { StringBuilder urlString = new StringBuilder ( ) ; for ( Map . Entry < Param , String > argEntry : params . getEntries ( ) ) { // Skip the ID an QUERY params if ( IGNORE_PARAMS . contains ( argEntry . getKey ( ) ) ) { continue ; } urlString . append... | Create a string of the remaining parameters | 129 | 7 |
11,784 | public Review getReview ( String reviewId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , reviewId ) ; URL url = new ApiUrl ( apiKey , MethodBase . REVIEW ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { return MAPPER ... | Get the full details of a review by ID . | 134 | 10 |
11,785 | private String convertToJson ( Map < String , ? > map ) throws MovieDbException { try { return MAPPER . writeValueAsString ( map ) ; } catch ( JsonProcessingException ex ) { throw new MovieDbException ( ApiExceptionType . MAPPING_FAILED , "JSON conversion failed" , "" , ex ) ; } } | Use Jackson to convert Map to JSON string . | 77 | 9 |
11,786 | public ResultList < ChangeListItem > getChangeList ( MethodBase method , Integer page , String startDate , String endDate ) throws MovieDbException { TmdbParameters params = new TmdbParameters ( ) ; params . add ( Param . PAGE , page ) ; params . add ( Param . START_DATE , startDate ) ; params . add ( Param . END_DATE ... | Get a list of Media IDs that have been edited . | 161 | 11 |
11,787 | public Discover year ( int year ) { if ( checkYear ( year ) ) { params . add ( Param . YEAR , year ) ; } return this ; } | Filter the results release dates to matches that include this value . | 33 | 12 |
11,788 | public Discover primaryReleaseYear ( int primaryReleaseYear ) { if ( checkYear ( primaryReleaseYear ) ) { params . add ( Param . PRIMARY_RELEASE_YEAR , primaryReleaseYear ) ; } return this ; } | Filter the results so that only the primary release date year has this value | 49 | 14 |
11,789 | public Discover firstAirDateYear ( int year ) { if ( checkYear ( year ) ) { params . add ( Param . FIRST_AIR_DATE_YEAR , year ) ; } return this ; } | Filter the air dates that match this year | 44 | 8 |
11,790 | public Discover firstAirDateYearGte ( int year ) { if ( checkYear ( year ) ) { params . add ( Param . FIRST_AIR_DATE_GTE , year ) ; } return this ; } | Filter the air dates to years that are greater than or equal to this year | 46 | 15 |
11,791 | public Discover firstAirDateYearLte ( int year ) { if ( checkYear ( year ) ) { params . add ( Param . FIRST_AIR_DATE_LTE , year ) ; } return this ; } | Filter the air dates to years that are less than or equal to this year | 46 | 15 |
11,792 | public boolean isValidPosterSize ( String posterSize ) { if ( StringUtils . isBlank ( posterSize ) || posterSizes . isEmpty ( ) ) { return false ; } return posterSizes . contains ( posterSize ) ; } | Check that the poster size is valid | 53 | 7 |
11,793 | public boolean isValidBackdropSize ( String backdropSize ) { if ( StringUtils . isBlank ( backdropSize ) || backdropSizes . isEmpty ( ) ) { return false ; } return backdropSizes . contains ( backdropSize ) ; } | Check that the backdrop size is valid | 53 | 7 |
11,794 | public boolean isValidProfileSize ( String profileSize ) { if ( StringUtils . isBlank ( profileSize ) || profileSizes . isEmpty ( ) ) { return false ; } return profileSizes . contains ( profileSize ) ; } | Check that the profile size is valid | 52 | 7 |
11,795 | public boolean isValidLogoSize ( String logoSize ) { if ( StringUtils . isBlank ( logoSize ) || logoSizes . isEmpty ( ) ) { return false ; } return logoSizes . contains ( logoSize ) ; } | Check that the logo size is valid | 53 | 7 |
11,796 | public boolean isValidSize ( String sizeToCheck ) { return isValidPosterSize ( sizeToCheck ) || isValidBackdropSize ( sizeToCheck ) || isValidProfileSize ( sizeToCheck ) || isValidLogoSize ( sizeToCheck ) ; } | Check to see if the size is valid for any of the images types | 57 | 14 |
11,797 | public ListItem < MovieInfo > getList ( String listId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , listId ) ; URL url = new ApiUrl ( apiKey , MethodBase . LIST ) . buildUrl ( parameters ) ; String webpage = httpTools . getRequest ( url ) ; try { return... | Get a list by its ID | 150 | 6 |
11,798 | public boolean checkItemStatus ( String listId , int mediaId ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . ID , listId ) ; parameters . add ( Param . MOVIE_ID , mediaId ) ; URL url = new ApiUrl ( apiKey , MethodBase . LIST ) . subMethod ( MethodSub . ITEM_ST... | Check to see if an ID is already on a list . | 175 | 12 |
11,799 | private StatusCode modifyMovieList ( String sessionId , String listId , int movieId , MethodSub operation ) throws MovieDbException { TmdbParameters parameters = new TmdbParameters ( ) ; parameters . add ( Param . SESSION_ID , sessionId ) ; parameters . add ( Param . ID , listId ) ; String jsonBody = new PostTools ( ) ... | Modify a list | 202 | 4 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.