idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
135,500
public static Date addHours ( Date d , int hours ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . HOUR_OF_DAY , hours ) ; return cal . getTime ( ) ; }
Add hours to a date
135,501
public static Date setHours ( Date d , int hours ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . HOUR_OF_DAY , hours ) ; return cal . getTime ( ) ; }
Set hours to a date
135,502
public static Date addDays ( Date d , int days ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . DAY_OF_YEAR , days ) ; return cal . getTime ( ) ; }
Add days to a date
135,503
public static Date addWeeks ( Date d , int weeks ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . WEEK_OF_YEAR , weeks ) ; return cal . getTime ( ) ; }
Add weeks to a date
135,504
public static Date addMonths ( Date d , int months ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . MONTH , months ) ; return cal . getTime ( ) ; }
Add months to a date
135,505
public static int getLastDayOfMonth ( Date date ) { Calendar c = Calendar . getInstance ( ) ; c . setTime ( date ) ; return c . getActualMaximum ( Calendar . DATE ) ; }
Get last day from a month
135,506
public static Date getFromTimestamp ( Timestamp timestamp ) { if ( timestamp == null ) { return null ; } return new Date ( timestamp . getTime ( ) ) ; }
Get a date from a timestamp
135,507
public static Date getFirstDayFromCurrentWeek ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . DAY_OF_WEEK , Calendar . MONDAY ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calen...
Get first date from current week
135,508
public static Date getLastDayFromCurrentWeek ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; if ( cal . getFirstDayOfWeek ( ) == Calendar . SUNDAY ) { cal . add ( Calendar . WEEK_OF_YEAR , 1 ) ; } cal . set ( Calendar . DAY_OF_WEEK , Calendar . SUNDAY ) ; cal . set ( Calendar . HOUR_OF_DA...
Get last date from current week
135,509
public static Date getFirstDayFromLastMonth ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . MONTH , - 1 ) ; cal . set ( Calendar . DAY_OF_MONTH , 1 ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . SECOND , 0...
Get first date from last month
135,510
public static Date getLastDayFromLastMonth ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . MONTH , - 1 ) ; cal . set ( Calendar . DAY_OF_MONTH , cal . getActualMaximum ( Calendar . DATE ) ) ; cal . set ( Calendar . HOUR_OF_DAY , 23 ) ; cal . set ( Calendar . MINUTE ...
Get last date from last month
135,511
public static Date getFirstDayFromCurrentMonth ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . DAY_OF_MONTH , 1 ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MILLISEC...
Get first date from current month
135,512
public static Date getLastDayFromCurrentMonth ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . DAY_OF_MONTH , cal . getActualMaximum ( Calendar . DATE ) ) ; cal . set ( Calendar . HOUR_OF_DAY , 23 ) ; cal . set ( Calendar . MINUTE , 59 ) ; cal . set ( Calendar . SECO...
Get last date from current month
135,513
public static Date getFirstDayFromLastYear ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( Calendar . YEAR , - 1 ) ; cal . set ( Calendar . MONTH , Calendar . JANUARY ) ; cal . set ( Calendar . DAY_OF_MONTH , 1 ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calenda...
Get first date from last year
135,514
public static Date getFirstDayFromCurrentYear ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . MONTH , Calendar . JANUARY ) ; cal . set ( Calendar . DAY_OF_MONTH , 1 ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Cale...
Get first date from current year
135,515
public static Date getLastDayFromCurrentYear ( Date d ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . set ( Calendar . MONTH , Calendar . DECEMBER ) ; cal . set ( Calendar . DAY_OF_MONTH , 31 ) ; cal . set ( Calendar . HOUR_OF_DAY , 23 ) ; cal . set ( Calendar . MINUTE , 59 ) ; cal . set ( C...
Get last date from current year
135,516
public static Date getLastNDay ( Date d , int n , int unitType ) { Calendar cal = Calendar . getInstance ( ) ; cal . setTime ( d ) ; cal . add ( unitType , - n ) ; cal . set ( Calendar . HOUR_OF_DAY , 0 ) ; cal . set ( Calendar . MINUTE , 0 ) ; cal . set ( Calendar . SECOND , 0 ) ; cal . set ( Calendar . MILLISECOND , ...
Get date with n unitType before
135,517
public void setTriggerContainer ( JComponent comp , JPanel content , boolean collapsed ) { add ( comp ) ; add ( _content = content ) ; _content . addComponentListener ( new ComponentAdapter ( ) { public void componentShown ( ComponentEvent event ) { EventQueue . invokeLater ( new Runnable ( ) { public void run ( ) { Re...
Set a component which contains the trigger button .
135,518
public void setTrigger ( AbstractButton trigger , Icon collapsed , Icon uncollapsed ) { _trigger = trigger ; _trigger . setHorizontalAlignment ( SwingConstants . LEFT ) ; _trigger . setHorizontalTextPosition ( SwingConstants . RIGHT ) ; _downIcon = collapsed ; _upIcon = uncollapsed ; _trigger . addActionListener ( this...
Set the trigger button .
135,519
public void setCollapsed ( boolean collapse ) { if ( collapse ) { _content . setVisible ( false ) ; _trigger . setIcon ( _downIcon ) ; } else { _content . setVisible ( true ) ; _trigger . setIcon ( _upIcon ) ; } SwingUtil . refresh ( this ) ; }
Set the collapsion state .
135,520
public static int [ ] add ( int [ ] list , int value ) { if ( list == null ) { return new int [ ] { value } ; } int llength = list . length ; for ( int i = 0 ; i < llength ; i ++ ) { if ( list [ i ] == value ) { return list ; } } int [ ] nlist = new int [ llength + 1 ] ; System . arraycopy ( list , 0 , nlist , 0 , llen...
Adds the specified value to the list iff it is not already in the list .
135,521
public static boolean contains ( int [ ] list , int value ) { int llength = list . length ; for ( int i = 0 ; i < llength ; i ++ ) { if ( list [ i ] == value ) { return true ; } } return false ; }
Looks for an element that is equal to the supplied value .
135,522
public static int [ ] remove ( int [ ] list , int value ) { if ( list == null ) { return null ; } int llength = list . length ; for ( int i = 0 ; i < llength ; i ++ ) { if ( list [ i ] == value ) { return removeAt ( list , i ) ; } } return list ; }
Removes the first value that is equal to the supplied value . A new array will be created containing all other elements except the located element in the order they existed in the original list .
135,523
public static int [ ] removeAt ( int [ ] list , int index ) { int nlength = list . length - 1 ; int [ ] nlist = new int [ nlength ] ; System . arraycopy ( list , 0 , nlist , 0 , index ) ; System . arraycopy ( list , index + 1 , nlist , index , nlength - index ) ; return nlist ; }
Removes the value at the specified index . A new array will be created containing all other elements except the specified element in the order they existed in the original list .
135,524
public int incrementCount ( K key , int amount ) { int [ ] val = get ( key ) ; if ( val == null ) { put ( key , val = new int [ 1 ] ) ; } val [ 0 ] += amount ; return val [ 0 ] ; }
Increment the value associated with the specified key return the new value .
135,525
public int setCount ( K key , int count ) { int [ ] val = get ( key ) ; if ( val == null ) { put ( key , new int [ ] { count } ) ; return 0 ; } int oldVal = val [ 0 ] ; val [ 0 ] = count ; return oldVal ; }
Set the count for the specified key .
135,526
public void compress ( ) { for ( Iterator < int [ ] > itr = values ( ) . iterator ( ) ; itr . hasNext ( ) ; ) { if ( itr . next ( ) [ 0 ] == 0 ) { itr . remove ( ) ; } } }
Compress the count map - remove entries for which the value is 0 .
135,527
public static JInternalDialog createDialog ( JFrame frame , JPanel content ) { return createDialog ( frame , null , content ) ; }
Creates and shows an internal dialog with the specified panel .
135,528
public static JInternalDialog createDialog ( JFrame frame , String title , JPanel content ) { JInternalDialog dialog = new JInternalDialog ( frame ) ; dialog . setOpaque ( false ) ; if ( title != null ) { dialog . setTitle ( title ) ; } setContent ( dialog , content ) ; SwingUtil . centerComponent ( frame , dialog ) ; ...
Creates and shows an internal dialog with the specified title and panel .
135,529
public static void setContent ( JInternalDialog dialog , JPanel content ) { Container holder = dialog . getContentPane ( ) ; holder . removeAll ( ) ; holder . add ( content , BorderLayout . CENTER ) ; dialog . pack ( ) ; }
Sets the content panel of the supplied internal dialog .
135,530
public static JInternalDialog getInternalDialog ( Component any ) { Component parent = any ; while ( parent != null && ! ( parent instanceof JInternalDialog ) ) { parent = parent . getParent ( ) ; } return ( JInternalDialog ) parent ; }
Returns the internal dialog that is a parent of the specified component .
135,531
public static void invalidateDialog ( Component any ) { JInternalDialog dialog = getInternalDialog ( any ) ; if ( dialog == null ) { return ; } SwingUtil . applyToHierarchy ( dialog , new SwingUtil . ComponentOp ( ) { public void apply ( Component comp ) { comp . invalidate ( ) ; } } ) ; dialog . setSize ( dialog . get...
Invalidates and resizes the entire dialog given any component within the dialog in question .
135,532
public int add ( K key , int amount ) { CountEntry < K > entry = _backing . get ( key ) ; if ( entry == null ) { _backing . put ( key , new CountEntry < K > ( key , amount ) ) ; return amount ; } return ( entry . count += amount ) ; }
Add the specified amount to the count for the specified key return the new count . Adding 0 will ensure that a Map . Entry is created for the specified key .
135,533
public int getCount ( K key ) { CountEntry < K > entry = _backing . get ( key ) ; return ( entry == null ) ? 0 : entry . count ; }
Get the count for the specified key . If the key is not present 0 is returned .
135,534
public void compress ( ) { for ( Iterator < CountEntry < K > > it = _backing . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { if ( it . next ( ) . count == 0 ) { it . remove ( ) ; } } }
Remove any keys for which the count is currently 0 .
135,535
protected < T > T pickPluck ( Iterable < ? extends T > iterable , T ifEmpty , boolean remove ) { if ( iterable instanceof Collection ) { @ SuppressWarnings ( "unchecked" ) Collection < ? extends T > coll = ( Collection < ? extends T > ) iterable ; int size = coll . size ( ) ; if ( size == 0 ) { return ifEmpty ; } if ( ...
Shared code for pick and pluck .
135,536
public void postUnit ( Unit unit ) { if ( shutdownRequested ( ) ) { throw new IllegalStateException ( "Cannot post units to shutdown invoker." ) ; } unit . queueStamp = System . currentTimeMillis ( ) ; _queue . append ( unit ) ; }
Posts a unit to this invoker for subsequent invocation on the invoker s thread .
135,537
public void shutdown ( ) { _shutdownRequested = true ; _queue . append ( new Unit ( ) { public boolean invoke ( ) { _running = false ; return false ; } } ) ; }
Shuts down the invoker thread by queueing up a unit that will cause the thread to exit after all currently queued units are processed .
135,538
protected void didInvokeUnit ( Unit unit , long start ) { if ( PERF_TRACK ) { long duration = System . currentTimeMillis ( ) - start ; Object key = unit . getClass ( ) ; recordMetrics ( key , duration ) ; long thresh = unit . getLongThreshold ( ) ; if ( thresh == 0 ) { thresh = _longThreshold ; } if ( duration > thresh...
Called before we process an invoker unit .
135,539
public int compareTo ( ComparableTuple < L , R > other ) { int rv = ObjectUtil . compareTo ( left , other . left ) ; return ( rv != 0 ) ? rv : ObjectUtil . compareTo ( right , other . right ) ; }
from interface Comparable
135,540
public void parseStream ( InputStream stream ) throws IOException { try { _chars = new StringBuilder ( ) ; XMLUtil . parse ( this , stream ) ; } catch ( ParserConfigurationException pce ) { throw ( IOException ) new IOException ( ) . initCause ( pce ) ; } catch ( SAXException saxe ) { throw ( IOException ) new IOExcept...
Parse the given input stream .
135,541
protected InputStream getInputStream ( String path ) throws IOException { FileInputStream fis = new FileInputStream ( path ) ; return new BufferedInputStream ( fis ) ; }
Returns an input stream to read data from the given file name .
135,542
protected int parseInt ( String val ) { try { return ( val == null ) ? - 1 : Integer . parseInt ( val ) ; } catch ( NumberFormatException nfe ) { log . warning ( "Malformed integer value" , "val" , val ) ; return - 1 ; } }
Parse the given string as an integer and return the integer value or - 1 if the string is malformed .
135,543
public static String truncate ( String s , int maxLength , String append ) { if ( ( s == null ) || ( s . length ( ) <= maxLength ) ) { return s ; } else { return s . substring ( 0 , maxLength - append . length ( ) ) + append ; } }
Truncate the specified String if it is longer than maxLength . The string will be truncated at a position such that it is maxLength chars long after the addition of the append String .
135,544
public static String capitalize ( String s ) { if ( isBlank ( s ) ) { return s ; } char c = s . charAt ( 0 ) ; if ( Character . isUpperCase ( c ) ) { return s ; } else { return String . valueOf ( Character . toUpperCase ( c ) ) + s . substring ( 1 ) ; } }
Returns a version of the supplied string with the first letter capitalized .
135,545
public static String toUSLowerCase ( String s ) { return isBlank ( s ) ? s : s . toLowerCase ( Locale . US ) ; }
Returns a US locale lower case string . Useful when manipulating filenames and resource keys which would not have locale specific characters .
135,546
public static String toUSUpperCase ( String s ) { return isBlank ( s ) ? s : s . toUpperCase ( Locale . US ) ; }
Returns a US locale upper case string . Useful when manipulating filenames and resource keys which would not have locale specific characters .
135,547
public static String sanitize ( String source , CharacterValidator validator ) { if ( source == null ) { return null ; } int nn = source . length ( ) ; StringBuilder buf = new StringBuilder ( nn ) ; for ( int ii = 0 ; ii < nn ; ii ++ ) { char c = source . charAt ( ii ) ; if ( validator . isValid ( c ) ) { buf . append ...
Sanitize the specified String so that only valid characters are in it .
135,548
public static String sanitize ( String source , String charRegex ) { final StringBuilder buf = new StringBuilder ( " " ) ; final Matcher matcher = Pattern . compile ( charRegex ) . matcher ( buf ) ; return sanitize ( source , new CharacterValidator ( ) { public boolean isValid ( char c ) { buf . setCharAt ( 0 , c ) ; r...
Sanitize the specified String such that each character must match against the regex specified .
135,549
public static String pad ( String value , int width , char c ) { if ( width <= 0 ) { throw new IllegalArgumentException ( "Pad width must be greater than zero." ) ; } int l = value . length ( ) ; return ( l >= width ) ? value : value + fill ( c , width - l ) ; }
Pads the supplied string to the requested string width by appending the specified character to the end of the returned string . If the original string is wider than the requested width it is returned unmodified .
135,550
public static String fill ( char c , int count ) { char [ ] sameChars = new char [ count ] ; Arrays . fill ( sameChars , c ) ; return new String ( sameChars ) ; }
Returns a string containing the specified character repeated the specified number of times .
135,551
public static String [ ] split ( String source , String sep ) { if ( isBlank ( source ) ) { return new String [ 0 ] ; } int tcount = 0 , tpos = - 1 , tstart = 0 ; while ( ( tpos = source . indexOf ( sep , tpos + 1 ) ) != - 1 ) { tcount ++ ; } String [ ] tokens = new String [ tcount + 1 ] ; tpos = - 1 ; tcount = 0 ; whi...
Splits the supplied string into components based on the specified separator string .
135,552
public static String wordWrap ( String str , int width ) { int size = str . length ( ) ; StringBuilder buf = new StringBuilder ( size + size / width ) ; int lastidx = 0 ; while ( lastidx < size ) { if ( lastidx + width >= size ) { buf . append ( str . substring ( lastidx ) ) ; break ; } int lastws = lastidx ; for ( int...
Wordwraps a string . Treats any whitespace character as a single character .
135,553
public List < String > getI18nkeys ( ) { if ( i18nkeys == null ) { return new ArrayList < String > ( ) ; } Collections . sort ( i18nkeys , new Comparator < String > ( ) { public int compare ( String o1 , String o2 ) { return Collator . getInstance ( ) . compare ( o1 , o2 ) ; } } ) ; return i18nkeys ; }
Get keys for internationalized strings
135,554
public String xlate ( String key , Object arg ) { return _msgmgr . getMessage ( _req , key , new Object [ ] { arg } ) ; }
Looks up the specified message and creates the translation string using the supplied argument .
135,555
public String xlate ( String key , Object arg1 , Object arg2 ) { return _msgmgr . getMessage ( _req , key , new Object [ ] { arg1 , arg2 } ) ; }
Looks up the specified message and creates the translation string using the supplied arguments .
135,556
protected String date ( int style , Object arg ) { Date when = massageDate ( arg ) ; if ( when == null ) { return "<!" + arg + ">" ; } return DateFormat . getDateInstance ( style , getLocale ( ) ) . format ( when ) ; }
Helper function for formatting dates .
135,557
public boolean export ( ) throws QueryException , NoDataFoundException { start = true ; testForData ( ) ; if ( needsFirstCrossing ( ) && ! ( this instanceof FirstCrossingExporter ) ) { FirstCrossingExporter fe = new FirstCrossingExporter ( bean ) ; fe . export ( ) ; templatesValues = fe . getTemplatesValues ( ) ; group...
header page band and footer page band are written in PDF and RTF exporters
135,558
protected Set < CellElement > getIgnoredCellElements ( Band band ) { Set < CellElement > result = new HashSet < CellElement > ( ) ; int rows = band . getRowCount ( ) ; int cols = band . getColumnCount ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { BandElement element = band . getEleme...
and the other merged cells are null band elements .
135,559
protected Set < CellElement > getIgnoredCellElementsForColSpan ( Band band ) { Set < CellElement > result = new HashSet < CellElement > ( ) ; int rows = band . getRowCount ( ) ; int cols = band . getColumnCount ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { for ( int j = 0 ; j < cols ; j ++ ) { BandElement element = band ...
because there was no support for row span
135,560
void fireExporterEvent ( ExporterEvent evt ) { Object [ ] listeners = listenerList . getListenerList ( ) ; for ( int i = 0 ; i < listeners . length ; i += 2 ) { if ( listeners [ i ] == ExporterEventListener . class ) { ( ( ExporterEventListener ) listeners [ i + 1 ] ) . notify ( evt ) ; } } }
This private class is used to fire ExporterEvents
135,561
private String getFunctionTemplate ( GroupCache gc , FunctionBandElement fbe , boolean previous ) throws QueryException { StringBuilder templateKey = new StringBuilder ( ) ; if ( gc == null ) { templateKey . append ( "F_" ) . append ( fbe . getFunction ( ) ) . append ( "_" ) . append ( fbe . getColumn ( ) ) ; return te...
string template used by functions in header and group header bands
135,562
protected String getCurrentValueForGroup ( String group ) { Object obj = groupValues . get ( group ) ; if ( obj == null ) { return "" ; } return obj . toString ( ) ; }
group is G1 G2 ...
135,563
public static String getValueFromElement ( Element element , String tagName ) { NodeList elementNodeList = element . getElementsByTagName ( tagName ) ; if ( elementNodeList == null ) { return "" ; } else { Element tagElement = ( Element ) elementNodeList . item ( 0 ) ; if ( tagElement == null ) { return "" ; } NodeList...
Gets the string value of the tag element name passed
135,564
public static String convertDocToString ( Document doc ) throws TransformerException { TransformerFactory transfac = TransformerFactory . newInstance ( ) ; Transformer trans = transfac . newTransformer ( ) ; trans . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , YES ) ; trans . setOutputProperty ( OutputKeys ....
Convert a DOM document to a string
135,565
public static boolean writeDocumentToFile ( Document doc , String localFile ) { try { TransformerFactory transfact = TransformerFactory . newInstance ( ) ; Transformer trans = transfact . newTransformer ( ) ; trans . setOutputProperty ( OutputKeys . OMIT_XML_DECLARATION , YES ) ; trans . setOutputProperty ( OutputKeys ...
Write the Document out to a file using nice formatting
135,566
public static void appendChild ( Document doc , Element parentElement , String elementName , String elementValue ) { Element child = doc . createElement ( elementName ) ; Text text = doc . createTextNode ( elementValue ) ; child . appendChild ( text ) ; parentElement . appendChild ( child ) ; }
Add a child element to a parent element
135,567
private static void waiting ( int milliseconds ) { long t0 , t1 ; t0 = System . currentTimeMillis ( ) ; do { t1 = System . currentTimeMillis ( ) ; } while ( ( t1 - t0 ) < milliseconds ) ; }
Wait for a few milliseconds
135,568
public Collection < CompilationUnit > execute ( ) throws IOException { List < CompilationUnit > compiledUnits = new ArrayList < CompilationUnit > ( ) ; logger . debug ( "CompilationTask: execute" ) ; long start = System . currentTimeMillis ( ) ; for ( CompilationUnit unit : compilationUnits ) { if ( compileIfDirty ( un...
Execute the lazy compilation .
135,569
public void startDaemon ( final long interval ) { if ( daemon != null ) { throw new RuntimeException ( "Trying to start daemon while it is still running" ) ; } stopDaemon = false ; daemon = new Thread ( new Runnable ( ) { public void run ( ) { try { while ( ! stopDaemon ) { try { Collection < CompilationUnit > units = ...
Start a daemon thread that will execute this CompilationTask periodically .
135,570
private boolean compileIfDirty ( CompilationUnit unit ) throws IOException { if ( isDirty ( unit ) ) { logger . debug ( "compiling less: {}" , unit ) ; long start = System . currentTimeMillis ( ) ; try { String sourceMapFileName = unit . getSourceMapFile ( ) != null ? unit . getSourceMapFile ( ) . getPath ( ) : null ; ...
Compile a CompilationUnit if dirty .
135,571
public Series getSeries ( String id , String language ) throws TvDbException { StringBuilder urlBuilder = new StringBuilder ( ) ; urlBuilder . append ( BASE_URL ) . append ( apiKey ) . append ( SERIES_URL ) . append ( id ) . append ( "/" ) ; if ( StringUtils . isNotBlank ( language ) ) { urlBuilder . append ( language ...
Get the series information
135,572
public Episode getEpisode ( String seriesId , int seasonNbr , int episodeNbr , String language ) throws TvDbException { return getTVEpisode ( seriesId , seasonNbr , episodeNbr , language , "/default/" ) ; }
Get a specific episode s information
135,573
private Episode getTVEpisode ( String seriesId , int seasonNbr , int episodeNbr , String language , String episodeType ) throws TvDbException { if ( ! isValidNumber ( seriesId ) || ! isValidNumber ( seasonNbr ) || ! isValidNumber ( episodeNbr ) ) { return new Episode ( ) ; } StringBuilder urlBuilder = new StringBuilder...
Generic function to get either the standard TV episode list or the DVD list
135,574
public List < Actor > getActors ( String seriesId ) throws TvDbException { StringBuilder urlBuilder = new StringBuilder ( ) ; urlBuilder . append ( BASE_URL ) . append ( apiKey ) . append ( SERIES_URL ) . append ( seriesId ) . append ( "/actors.xml" ) ; LOG . trace ( URL , urlBuilder . toString ( ) ) ; return TvdbParse...
Get a list of actors from the series id
135,575
public List < Series > searchSeries ( String title , String language ) throws TvDbException { StringBuilder urlBuilder = new StringBuilder ( ) ; try { urlBuilder . append ( BASE_URL ) . append ( "GetSeries.php?seriesname=" ) . append ( URLEncoder . encode ( title , "UTF-8" ) ) ; if ( StringUtils . isNotBlank ( language...
Get a list of series using a title and language
135,576
public Episode getEpisodeById ( String episodeId , String language ) throws TvDbException { StringBuilder urlBuilder = new StringBuilder ( ) ; urlBuilder . append ( BASE_URL ) . append ( apiKey ) . append ( "/episodes/" ) . append ( episodeId ) . append ( "/" ) ; if ( StringUtils . isNotBlank ( language ) ) { urlBuilde...
Get information for a specific episode
135,577
public TVDBUpdates getWeeklyUpdates ( int seriesId ) throws TvDbException { StringBuilder urlBuilder = new StringBuilder ( ) ; urlBuilder . append ( BASE_URL ) . append ( apiKey ) . append ( WEEKLY_UPDATES_URL ) ; LOG . trace ( URL , urlBuilder . toString ( ) ) ; return TvdbParser . getUpdates ( urlBuilder . toString (...
Get the weekly updates limited by Series ID
135,578
public static List < Actor > getActors ( String urlString ) throws TvDbException { List < Actor > results = new ArrayList < > ( ) ; Actor actor ; Document doc ; NodeList nlActor ; Node nActor ; Element eActor ; try { doc = DOMHelper . getEventDocFromUrl ( urlString ) ; if ( doc == null ) { return results ; } } catch ( ...
Get a list of the actors from the URL
135,579
public static List < Episode > getAllEpisodes ( String urlString , int season ) throws TvDbException { List < Episode > episodeList = new ArrayList < > ( ) ; Episode episode ; NodeList nlEpisode ; Node nEpisode ; Element eEpisode ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; nlEpisode = doc . getEleme...
Get all the episodes from the URL
135,580
public static Banners getBanners ( String urlString ) throws TvDbException { Banners banners = new Banners ( ) ; Banner banner ; NodeList nlBanners ; Node nBanner ; Element eBanner ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; if ( doc != null ) { nlBanners = doc . getElementsByTagName ( BANNER ) ; fo...
Get a list of banners from the URL
135,581
public static Episode getEpisode ( String urlString ) throws TvDbException { Episode episode = new Episode ( ) ; NodeList nlEpisode ; Node nEpisode ; Element eEpisode ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; if ( doc == null ) { return new Episode ( ) ; } nlEpisode = doc . getElementsByTagName ( ...
Get the episode information from the URL
135,582
public static List < Series > getSeriesList ( String urlString ) throws TvDbException { List < Series > seriesList = new ArrayList < > ( ) ; Series series ; NodeList nlSeries ; Node nSeries ; Element eSeries ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; if ( doc == null ) { return Collections . emptyL...
Get a list of series from the URL
135,583
public static TVDBUpdates getUpdates ( String urlString , int seriesId ) throws TvDbException { TVDBUpdates updates = new TVDBUpdates ( ) ; Document doc = DOMHelper . getEventDocFromUrl ( urlString ) ; if ( doc != null ) { Node root = doc . getChildNodes ( ) . item ( 0 ) ; List < SeriesUpdate > seriesUpdates = new Arra...
Get a list of updates from the URL
135,584
public static String parseErrorMessage ( String errorMessage ) { StringBuilder response = new StringBuilder ( ) ; Pattern pattern = Pattern . compile ( ".*?/series/(\\d*?)/default/(\\d*?)/(\\d*?)/.*?" ) ; Matcher matcher = pattern . matcher ( errorMessage ) ; if ( matcher . find ( ) && matcher . groupCount ( ) == ERROR...
Parse the error message to return a more user friendly message
135,585
private static List < String > parseList ( String input , String delim ) { List < String > result = new ArrayList < > ( ) ; StringTokenizer st = new StringTokenizer ( input , delim ) ; while ( st . hasMoreTokens ( ) ) { String token = st . nextToken ( ) . trim ( ) ; if ( token . length ( ) > 0 ) { result . add ( token ...
Create a List from a delimited string
135,586
private static Banner parseNextBanner ( Element eBanner ) { Banner banner = new Banner ( ) ; String artwork ; artwork = DOMHelper . getValueFromElement ( eBanner , BANNER_PATH ) ; if ( ! artwork . isEmpty ( ) ) { banner . setUrl ( URL_BANNER + artwork ) ; } artwork = DOMHelper . getValueFromElement ( eBanner , VIGNETTE...
Parse the banner record from the document
135,587
private static Episode parseNextEpisode ( Element eEpisode ) { Episode episode = new Episode ( ) ; episode . setId ( DOMHelper . getValueFromElement ( eEpisode , "id" ) ) ; episode . setCombinedEpisodeNumber ( DOMHelper . getValueFromElement ( eEpisode , "Combined_episodenumber" ) ) ; episode . setCombinedSeason ( DOMH...
Parse the document for episode information
135,588
private static int getEpisodeValue ( Element eEpisode , String key ) { int episodeValue ; try { String value = DOMHelper . getValueFromElement ( eEpisode , key ) ; episodeValue = NumberUtils . toInt ( value , 0 ) ; } catch ( WebServiceException ex ) { LOG . trace ( "Failed to read episode value" , ex ) ; episodeValue =...
Process the key from the element into an integer .
135,589
private static Series parseNextSeries ( Element eSeries ) { Series series = new Series ( ) ; series . setId ( DOMHelper . getValueFromElement ( eSeries , "id" ) ) ; series . setActors ( parseList ( DOMHelper . getValueFromElement ( eSeries , "Actors" ) , "|," ) ) ; series . setAirsDayOfWeek ( DOMHelper . getValueFromEl...
Parse the series record from the document
135,590
private static SeriesUpdate parseNextSeriesUpdate ( Element element ) { SeriesUpdate seriesUpdate = new SeriesUpdate ( ) ; seriesUpdate . setSeriesId ( DOMHelper . getValueFromElement ( element , "id" ) ) ; seriesUpdate . setTime ( DOMHelper . getValueFromElement ( element , TIME ) ) ; return seriesUpdate ; }
Parse the series update record from the document
135,591
private static EpisodeUpdate parseNextEpisodeUpdate ( Element element ) { EpisodeUpdate episodeUpdate = new EpisodeUpdate ( ) ; episodeUpdate . setSeriesId ( DOMHelper . getValueFromElement ( element , "id" ) ) ; episodeUpdate . setEpisodeId ( DOMHelper . getValueFromElement ( element , SERIES ) ) ; episodeUpdate . set...
Parse the episode update record from the document
135,592
private static BannerUpdate parseNextBannerUpdate ( Element element ) { BannerUpdate bannerUpdate = new BannerUpdate ( ) ; bannerUpdate . setSeasonNum ( DOMHelper . getValueFromElement ( element , "SeasonNum" ) ) ; bannerUpdate . setSeriesId ( DOMHelper . getValueFromElement ( element , SERIES ) ) ; bannerUpdate . setF...
Parse the banner update record from the document
135,593
private static Language parseNextLanguage ( Element element ) { Language language = new Language ( ) ; language . setName ( DOMHelper . getValueFromElement ( element , "name" ) ) ; language . setAbbreviation ( DOMHelper . getValueFromElement ( element , "abbreviation" ) ) ; language . setId ( DOMHelper . getValueFromEl...
Parses the next language .
135,594
private void copyBaseDirs ( File [ ] baseDirs ) { this . baseDirs = new File [ baseDirs . length ] ; for ( int i = 0 ; i < baseDirs . length ; i ++ ) { this . baseDirs [ i ] = baseDirs [ i ] . getAbsoluteFile ( ) ; } }
Convert the dirs to absolute paths to prevent that equals returns true for directories with the same name in a different location .
135,595
public Group < E > group ( String name ) { for ( Group < E > group : this . groups ( ) ) { if ( group . expr instanceof Expression . NamedGroup < ? > ) { Expression . NamedGroup < E > namedGroup = ( Expression . NamedGroup < E > ) group . expr ; if ( namedGroup . name . equals ( name ) ) { return group ; } } } return n...
Retrieve a group by name .
135,596
public BindingAssert < T > hasSameValue ( ObservableValue < T > expectedValue ) { new ObservableValueAssertions < > ( actual ) . hasSameValue ( expectedValue ) ; return this ; }
Verifies that the actual binding has the same value as the given observable .
135,597
public static LessCompilationEngine create ( String type , String executable ) { if ( type == null || RHINO . equals ( type ) ) { return create ( ) ; } if ( COMMAND_LINE . equals ( type ) ) { return new CommandLineLesscCompilationEngine ( executable ) ; } return new ScriptEngineLessCompilationEngine ( type ) ; }
Create a new engine of the specified type if available or a default engine .
135,598
public static void configure ( boolean verbose , boolean daemon ) { LoggerContext lc = ( LoggerContext ) LoggerFactory . getILoggerFactory ( ) ; ConsoleAppender < ILoggingEvent > ca = new ConsoleAppender < ILoggingEvent > ( ) ; ca . setContext ( lc ) ; ca . setName ( "less console" ) ; PatternLayoutEncoder pl = new Pat...
Configure the LessCompilerImpl logger with a ConsoleAppender
135,599
public static < E > Automaton < E > build ( List < Expression < E > > exprs ) { Expression . MatchingGroup < E > group = new Expression . MatchingGroup < E > ( exprs ) ; return group . build ( ) ; }
Build an NFA from the list of expressions .