idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
28,900
public NegateMultiPos < S , String , String > lookup ( String lookups ) { return new NegateMultiPos < S , String , String > ( lookups , null ) { protected S result ( ) { return aQueue ( 'U' , left , right , pos , position , null , plusminus , filltgt ) ; } } ; }
Sets the given lookups string as the search string
28,901
public S setBetn ( int leftIndex , int rightIndex ) { return set ( Indexer . of ( delegate . get ( ) ) . between ( leftIndex , rightIndex ) ) ; }
Sets the substring in given left index and right index as the delegate string
28,902
public S setBefore ( int rightIndex ) { return set ( Indexer . of ( delegate . get ( ) ) . before ( rightIndex ) ) ; }
Sets the substring in beginning and the given right index as the delegate string
28,903
public S setAfter ( int leftIndex ) { return set ( Indexer . of ( delegate . get ( ) ) . after ( leftIndex ) ) ; }
Sets the substring in given left index and ending as the delegate string
28,904
@ SuppressWarnings ( "unchecked" ) private void setCookie ( NativeObject result , HttpServletResponse response ) { Map < String , String > cookieMap = ScriptableObject . getTypedProperty ( result , "cookie" , Map . class ) ; if ( cookieMap == null ) { return ; } Iterator < Entry < String , String > > iterator = cookieM...
set cookie from result of handler to HttpServletResponse
28,905
public void handle ( Object event ) throws EventException { try { this . handler . invoke ( listener , event ) ; } catch ( IllegalAccessException e ) { throw new Error ( "Access level changed, method " + handler + " is no longer accessible!" , e ) ; } catch ( IllegalArgumentException e ) { throw new Error ( "Method " +...
Handles the event calling the handler method in the listener object .
28,906
public static int queryInt ( PreparedStatement stmt , int def ) throws SQLException { ResultSet rs = null ; try { rs = stmt . executeQuery ( ) ; if ( rs . next ( ) ) { int value = rs . getInt ( 1 ) ; if ( ! rs . wasNull ( ) ) { return value ; } } return def ; } finally { close ( rs ) ; } }
Runs a SQL query that returns a single integer value .
28,907
public static int update ( Connection con , String query , Object ... param ) throws SQLException { PreparedStatement stmt = null ; try { stmt = con . prepareStatement ( query ) ; for ( int i = 0 ; i < param . length ; i ++ ) { stmt . setObject ( i + 1 , param [ i ] ) ; } return stmt . executeUpdate ( ) ; } finally { c...
Runs a SQL query that inserts updates or deletes rows .
28,908
public void run ( ) { try { while ( -- expires >= 0 ) { sleep ( sysInterval ) ; synchronized ( ThreadClockImpl . class ) { currentTimeMillis += sysInterval ; } } } catch ( InterruptedException e ) { System . out . println ( "Clock thread interrupted" ) ; } }
Threads run method that increments the clock and resets the generated nano seconds counter .
28,909
private synchronized long getTimeSynchronized ( ) throws OverClockedException { long current = 0 ; synchronized ( ThreadClockImpl . class ) { current = currentTimeMillis ; } if ( current != lastTimeMs ) { generatedThisInterval = 0 ; lastTimeMs = current ; } if ( generatedThisInterval + 1 >= ( INTERVALS_PER_MILLI * sysI...
Returns the current time as described in the clock resolution and timestamp sections of the uuid specification .
28,910
public long getUUIDTime ( ) throws OverClockedException { if ( ! worker . isAlive ( ) ) { synchronized ( SystemClockImpl . class ) { currentTimeMillis = System . currentTimeMillis ( ) ; worker . start ( ) ; } generatedThisInterval = 0 ; } return getTimeSynchronized ( ) ; }
Method returns the clocks current time in 100 - nanosecond intervals since the Gregorian calander change . Calendar . GREGORIAN_OFFSET
28,911
public static String fileKeyToPathName ( final ByteBuffer fileKey , final String digestAlgorithm , final int tokenLength , final String tokenDelimiter ) throws NoSuchAlgorithmException { if ( fileKey == null ) { throw new NullPointerException ( "null fileKey" ) ; } if ( fileKey . remaining ( ) == 0 ) { throw new Illega...
Converts given file key to a path name .
28,912
protected < E > void journalize ( Character l , Collection < E > collection , Decision < E > decision ) { journalize ( collection , decision , l , isLogEnabled ( l ) , null , - 1 ) ; }
Log a collection with special level
28,913
public boolean notifyMeasurementEnding ( Iterable < Measurement > measurements ) throws IOException { println ( controlLogMessageRenderer . render ( new StopMeasurementLogMessage ( measurements ) ) ) ; for ( Measurement measurement : measurements ) { println ( String . format ( "I got a result! %s: %f%s%n" , measuremen...
Report the measurements and wait for it to be ack d by the runner . Returns true if we should keep measuring false otherwise .
28,914
public static long next ( final String name ) { String id = null ; try { id = Locks . lockEntityQuite ( new StorageId ( NumberSequence . class , null , null , name ) , 30 , TimeUnit . SECONDS ) ; long l = getLocalStorage ( ) . read ( name ) ; l ++ ; DDSCluster . call ( new MessageBean ( NumberSequence . class , null , ...
Get next number from sequence if sequence is empty 0L will be returned and sequence will be created
28,915
public static < WorkingType > WorkingType fromBagAsType ( Bag bag , Class type ) { return ( bag != null ) ? ( WorkingType ) deserialize ( type . getName ( ) , bag ) : null ; }
Reconstitute the given BagObject representation back to the object it represents using a best - effort approach to matching the fields of the BagObject to the class being initialized .
28,916
public final void registerTaskExecutor ( TaskExecutor taskExecutor ) { if ( taskExecutor == null ) { throw new TaskExeception ( TaskExecutor . class . getSimpleName ( ) + " NULL" ) ; } this . taskExecutor = taskExecutor ; }
Registers the task executor . DO NOT USE THIS METHOD UNLESS YOU ARE DEVELOPING A NEW TASK EXECUTOR .
28,917
public static AcceptDatetime valueOf ( final String value ) { final Optional < Instant > datetime = parseDatetime ( value ) ; if ( datetime . isPresent ( ) ) { return new AcceptDatetime ( datetime . get ( ) ) ; } return null ; }
Create an Accept - Datetime header object from a string
28,918
@ SuppressWarnings ( "unchecked" ) public static < K , E extends Number > NumberMap < K , E > newNumberMap ( Class < E > elementType ) { if ( elementType == BigDecimal . class ) return ( NumberMap < K , E > ) newBigDecimalMap ( ) ; if ( elementType == BigInteger . class ) return ( NumberMap < K , E > ) newBigIntegerMap...
Creates a NumberMap for instances of a concrete subclass of Number .
28,919
public static < K > NumberMap < K , BigDecimal > newBigDecimalMap ( ) { return new NumberMap < K , BigDecimal > ( ) { public void add ( K key , BigDecimal addend ) { put ( key , containsKey ( key ) ? get ( key ) . add ( addend ) : addend ) ; } public void sub ( K key , BigDecimal subtrahend ) { put ( key , ( containsKe...
Creates a NumberMap for BigDecimals .
28,920
public static < K > NumberMap < K , BigInteger > newBigIntegerMap ( ) { return new NumberMap < K , BigInteger > ( ) { public void add ( K key , BigInteger addend ) { put ( key , containsKey ( key ) ? get ( key ) . add ( addend ) : addend ) ; } public void sub ( K key , BigInteger subtrahend ) { put ( key , ( containsKe...
Creates a NumberMap for BigIntegers .
28,921
public static < K > NumberMap < K , Byte > newByteMap ( ) { return new NumberMap < K , Byte > ( ) { public void add ( K key , Byte addend ) { put ( key , ( byte ) ( containsKey ( key ) ? get ( key ) + addend : addend ) ) ; } public void sub ( K key , Byte subtrahend ) { put ( key , ( byte ) ( ( containsKey ( key ) ? ge...
Creates a NumberMap for Bytes .
28,922
public static < K > NumberMap < K , Double > newDoubleMap ( ) { return new NumberMap < K , Double > ( ) { public void add ( K key , Double addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } public void sub ( K key , Double subtrahend ) { put ( key , ( containsKey ( key ) ? get ( key ) ...
Creates a NumberMap for Doubles .
28,923
public static < K > NumberMap < K , Float > newFloatMap ( ) { return new NumberMap < K , Float > ( ) { public void add ( K key , Float addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } public void sub ( K key , Float subtrahend ) { put ( key , ( containsKey ( key ) ? get ( key ) : 0f ...
Creates a NumberMap for Floats .
28,924
public static < K > NumberMap < K , Integer > newIntegerMap ( ) { return new NumberMap < K , Integer > ( ) { public void add ( K key , Integer addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } public void sub ( K key , Integer subtrahend ) { put ( key , ( containsKey ( key ) ? get ( k...
Creates a NumberMap for Integers .
28,925
public static < K > NumberMap < K , Long > newLongMap ( ) { return new NumberMap < K , Long > ( ) { public void add ( K key , Long addend ) { put ( key , containsKey ( key ) ? ( get ( key ) + addend ) : addend ) ; } public void sub ( K key , Long subtrahend ) { put ( key , ( containsKey ( key ) ? get ( key ) : 0l ) - s...
Creates a NumberMap for Longs .
28,926
public static < K > NumberMap < K , Short > newShortMap ( ) { return new NumberMap < K , Short > ( ) { public void add ( K key , Short addend ) { put ( key , containsKey ( key ) ? ( short ) ( get ( key ) + addend ) : addend ) ; } public void sub ( K key , Short subtrahend ) { put ( key , ( short ) ( ( containsKey ( key...
Creates a NumberMap for Shorts .
28,927
public void addNetwork ( String country , String networkName ) { if ( ! isValidString ( country ) || ! isValidString ( networkName ) ) { return ; } this . network . add ( new CountryDetail ( country , networkName ) ) ; }
Add a single network to the list
28,928
@ SuppressWarnings ( "unchecked" ) public T get ( Object entity ) { Object value = entity ; for ( String name : path ( ) ) { try { Field field = value . getClass ( ) . getDeclaredField ( name ) ; field . setAccessible ( true ) ; value = field . get ( value ) ; } catch ( Exception e ) { throw new UncheckedException ( e ...
Returns the property value which this metamodel property instance represents from the specified entity instance .
28,929
public void set ( E entity , Object value ) { Object object = entity ; for ( int i = 0 ; i < path ( ) . size ( ) - 1 ; i ++ ) { try { Field field = object . getClass ( ) . getDeclaredField ( path ( ) . get ( i ) ) ; field . setAccessible ( true ) ; object = field . get ( object ) ; } catch ( Exception e ) { throw new U...
Sets the property value which this metamodel property instance represents to the specified entity instance .
28,930
private void cleanup ( ) { CacheEntry oldest = null ; _count = 0 ; for ( Map . Entry < String , CacheEntry > e : _cache . entrySet ( ) ) { String key = e . getKey ( ) ; CacheEntry entry = e . getValue ( ) ; if ( entry . isExpired ( ) ) { _cache . remove ( key ) ; } else { _count ++ ; if ( oldest == null || oldest . get...
Clears component state .
28,931
public Object retrieve ( String correlationId , String key ) { synchronized ( _lock ) { CacheEntry entry = _cache . get ( key ) ; if ( entry == null ) { return null ; } if ( entry . isExpired ( ) ) { _cache . remove ( key ) ; _count -- ; return null ; } return entry . getValue ( ) ; } }
Retrieves cached value from the cache using its key . If value is missing in the cache or expired it returns null .
28,932
public void remove ( String correlationId , String key ) { synchronized ( _lock ) { CacheEntry entry = _cache . get ( key ) ; if ( entry != null ) { _cache . remove ( key ) ; _count -- ; } } }
Removes a value from the cache by its key .
28,933
public void add ( int index , E element ) { int idx = getRealIndex ( index ) ; super . add ( idx , element ) ; }
Inserts the specified element at the specified position in this Vector .
28,934
public boolean addAll ( int index , Collection < ? extends E > collection ) { int idx = getRealIndex ( index ) ; return super . addAll ( idx , collection ) ; }
Inserts all of the elements in the specified Collection into this Vector at the specified position .
28,935
public int indexOf ( Object o , int index ) { int idx = getRealIndex ( index ) ; return super . indexOf ( o , idx ) ; }
Returns the index of the first occurrence of the specified element in this vector searching forwards from index or returns - 1 if the element is not found .
28,936
public void insertElementAt ( E obj , int index ) { int idx = getRealIndex ( index ) ; super . insertElementAt ( obj , idx ) ; }
Inserts the specified object as a component in this vector at the specified index .
28,937
public int lastIndexOf ( Object o , int index ) { int idx = getRealIndex ( index ) ; return super . lastIndexOf ( o , idx ) ; }
Returns the index of the last occurrence of the specified element in this vector searching backwards from index or returns - 1 if the element is not found .
28,938
public void setElementAt ( E obj , int index ) { int idx = getRealIndex ( index ) ; super . setElementAt ( obj , idx ) ; }
Sets the component at the specified index of this vector to be the specified object .
28,939
private int getRealIndex ( int index ) { int idx = index ; if ( idx < 0 ) { if ( Math . abs ( idx ) <= this . size ( ) ) { idx = this . size ( ) + idx ; } else { logger . error ( "negative number {} is too large: results size is {}, maximum admitted value is {}" , index , this . size ( ) , - 1 * this . size ( ) + 1 ) ;...
Returns the positive value corresponding to the given positive or negative index value .
28,940
public boolean has ( final K key ) { if ( this . services . containsKey ( key ) ) { final Collection < S > collection = this . services . get ( key ) ; if ( collection == null ) { return false ; } if ( collection . isEmpty ( ) ) { return false ; } return true ; } return false ; }
Determines whether there are any current services that have the given key .
28,941
public Collection < ScalingGroup > listScalingGroups ( AutoScalingGroupFilterOptions options ) throws CloudException , InternalException { APITrace . begin ( getProvider ( ) , "AutoScaling.listScalingGroups" ) ; try { ProviderContext ctx = getProvider ( ) . getContext ( ) ; if ( ctx == null ) { throw new CloudException...
Returns filtered list of auto scaling groups .
28,942
static Map < String , Object > toWire ( Map < String , Object > json ) { return ( Map < String , Object > ) ObjectIterator . iterate ( json , new Closure < ObjectIterator . IterateBean , Object > ( ) { public Object call ( ObjectIterator . IterateBean i ) { try { if ( i . getValue ( ) instanceof Date ) { SimpleDateForm...
Format Java Classes into strings version
28,943
static Map < String , Object > fromWire ( Map < String , Object > json ) { return ( Map < String , Object > ) ObjectIterator . iterate ( json , new Closure < ObjectIterator . IterateBean , Object > ( ) { public Object call ( ObjectIterator . IterateBean i ) { if ( i . getValue ( ) instanceof String ) { String s = ( Str...
Parse simple types into Java Classes
28,944
public static < E > void removeMatcing ( Collection < E > collection , Matcher < ? super E > matcher ) { Iterator < E > iter = collection . iterator ( ) ; while ( iter . hasNext ( ) ) { E item = iter . next ( ) ; if ( matcher . matches ( item ) ) iter . remove ( ) ; } }
Removes matching elements from the supplied Collection .
28,945
final Document createDocument ( List < String > row , DocumentFactory documentFactory ) { String id = StringUtils . EMPTY ; String content = StringUtils . EMPTY ; Language language = documentFactory . getDefaultLanguage ( ) ; Map < AttributeType , Object > attributeMap = new HashMap < > ( ) ; String idField = Config . ...
Create document document .
28,946
public static String getName ( String name , String path ) { logger . trace ( "getting OGNL name for node '{}' at path '{}'" , name , path ) ; StringBuilder buffer = new StringBuilder ( ) ; if ( path != null ) { buffer . append ( path ) ; } if ( buffer . length ( ) != 0 && name != null && ! name . startsWith ( "[" ) ) ...
Returns the OGNL name of the node .
28,947
public static Object getValue ( Object object , Field field ) throws VisitorException { boolean reprotect = false ; if ( object == null ) { return null ; } try { if ( ! field . isAccessible ( ) ) { field . setAccessible ( true ) ; reprotect = true ; } Object value = field . get ( object ) ; logger . trace ( "field '{}'...
Returns the value of the given field on the given object .
28,948
private void insanityCheck ( Element element , Meta meta , Opcode . Type type ) { if ( meta != null ) { throw new TemplateException ( "Invalid operators list on element |%s|. Only one %s operator is allowed." , element , type ) ; } }
Throws template exception if operator of given type is already declared .
28,949
static int toInt ( String input , int offset , int length ) { if ( length == 1 ) { return input . charAt ( offset ) - '0' ; } int out = 0 ; for ( int i = offset + length - 1 , factor = 1 ; i >= offset ; -- i , factor *= 10 ) { out += ( input . charAt ( i ) - '0' ) * factor ; } return out ; }
Converts the given string into an integer using Horner s method . No validation isOneOf done on the input . This method will produce numbers even if the input isOneOf not a valid decimal number .
28,950
public void commit ( ) throws IndoubtException { session . transaction . remove ( ) ; if ( logs . size ( ) == 0 ) { return ; } try { for ( Log log : logs ) { if ( log . operation ( ) != Operation . GET ) { if ( transaction . isActive ( ) ) { transaction . commit ( ) ; } log . state ( State . COMMITTED ) ; } } } catch (...
Commits this transaction with loose commitment protocol .
28,951
protected Object doExec ( Element element , Object scope , String format , Object ... arguments ) throws IOException { Stack < Index > indexes = this . serializer . getIndexes ( ) ; if ( indexes . size ( ) == 0 ) { throw new TemplateException ( "Required ordered collection index is missing. Numbering operator cancel ex...
Insert formatted numbering as element text content . If serializer indexes stack is empty throws templates exception ; anyway validation tool running on build catches numbering operator without surrounding ordered list .
28,952
private static String getNumbering ( Stack < Index > indexes , String format ) { StringBuilder sb = new StringBuilder ( ) ; int i = format . length ( ) ; int j = i ; int indexPosition = indexes . size ( ) - 1 ; for ( ; ; ) { i = format . lastIndexOf ( '%' , i ) ; if ( i == - 1 && j > 0 ) { sb . insert ( 0 , format . su...
Parse numbering format and inject index values . First argument the stack of indexes is global per serializer and format is the operand literal value . For nested numbering format may contain more than one single format code ; this is the reason first argument is the entire indexes stack not only current index . Given ...
28,953
public M sequence ( String sequenceKey , Long initialValue , Boolean increment ) { SequenceConfig cfg = defaultSequenceConfig ( ) ; if ( null != initialValue ) { cfg . setInitialValue ( initialValue ) ; } if ( null != increment ) { cfg . setDecrement ( ! increment ) ; } getSequence ( sequenceKey , cfg ) ; return THIS (...
Configuration a Sequence instance with frequently - used property
28,954
public M sequence ( String sequenceKey , SequenceConfig sequenceConfig ) { getSequence ( sequenceKey , firstNonNull ( sequenceConfig , defaultSequenceConfig ( ) ) ) ; return THIS ( ) ; }
Configuration a Sequence instance
28,955
protected void paintTabBorder ( Graphics g , int tabPlacement , int tabIndex , int x , int y , int w , int h , boolean isSelected ) { if ( isSelected ) { g . setColor ( Color . GRAY ) ; } else { g . setColor ( Color . LIGHT_GRAY ) ; } g . drawRect ( x + 1 , y + 1 , w - 2 , h - 2 ) ; }
this function draws the border around each tab note that this function does now draw the background of the tab . that is done elsewhere
28,956
public void load ( @ OptionArgument ( "filename" ) String filename ) { users . clear ( ) ; try { BufferedReader reader = new BufferedReader ( new FileReader ( filename ) ) ; while ( reader . ready ( ) ) { User user = User . fromString ( reader . readLine ( ) ) ; users . put ( user . username , user ) ; } } catch ( File...
Loads a users file .
28,957
public void save ( @ OptionArgument ( "filename" ) String filename ) { try { PrintStream out = new PrintStream ( new FileOutputStream ( filename ) ) ; for ( User user : users . values ( ) ) { out . println ( user ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Saves a users file .
28,958
public void adduser ( @ OptionArgument ( "username" ) String username , @ OptionArgument ( "password" ) String password , @ OptionArgument ( "roles" ) String roles ) { if ( users . containsKey ( username ) ) { System . err . println ( String . format ( "User '%s' already exists" , username ) ) ; } else { User user = ne...
Adds a new user .
28,959
public void passwd ( @ OptionArgument ( "username" ) String username , @ OptionArgument ( "password" ) String password ) { User user = users . get ( username ) ; if ( user != null ) { user . salt = passwd . generateSalt ( ) ; user . hash = passwd . getEncryptedPassword ( password , user . salt ) ; } else { System . err...
Resets the password of a user .
28,960
public void addroles ( @ OptionArgument ( "username" ) String username , @ OptionArgument ( "roles" ) String roles ) { User user = users . get ( username ) ; if ( user != null ) { user . roles . addAll ( Arrays . asList ( roles . split ( "," ) ) ) ; } else { System . err . println ( String . format ( "User '%s' does no...
Add roles for a user .
28,961
public static WordNetRelation create ( String name , String code , String reciprocal , double weight ) { Preconditions . checkArgument ( ! Strings . isNullOrEmpty ( name ) ) ; Preconditions . checkArgument ( weight >= 0 , "Weight must be >= 0" ) ; name = name . toUpperCase ( ) . trim ( ) . replaceAll ( "\\p{Z}+" , "_" ...
Creates or gets a Metadata with the given name
28,962
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public void setParameter ( String name , Enum value ) { conf . setEnum ( name , value ) ; }
parameter setting .
28,963
public void setValues ( final Collection < ? > values ) { if ( values != _values ) { clear ( ) ; if ( values == null || values . size ( ) == 0 ) { return ; } for ( Object value : values ) { addValue ( value ) ; } } }
Sets the specified values as the matching value list . First the previous list are cleared and all of the specified values are appended to the list .
28,964
public void addValue ( final Object value ) { if ( value == null ) { setNullContained ( true ) ; } else { _values . add ( String . valueOf ( value ) ) ; } }
Appends the value to the matching value list .
28,965
public void runScript ( ) { if ( script . trim ( ) . length ( ) > 0 ) { BufferedReader reader = new BufferedReader ( new StringReader ( script ) ) ; try { List results = runScript ( reader ) ; System . out . println ( new LogEntry ( Level . CRITICAL , "completed run of script in device '\" + this.deviceId + \"'\"" ) ) ...
Runs Iglu - style script .
28,966
public void setProperties ( Properties properties ) { script = properties . getProperty ( "script" , script ) ; pageIntervalInMinutes = Integer . parseInt ( properties . getProperty ( "page_interval_in_minutes" , "" + pageIntervalInMinutes ) ) ; pageOffsetInMinutes = Integer . parseInt ( properties . getProperty ( "pag...
Expects a property script containing the actual script to be run . Specify page_interval_in_minutes and page_offset_in_minutes to have script run periodically .
28,967
public List < SearchResult > search ( String query ) throws MovieMeterException { String url = buildSearchUrl ( query ) ; try { return mapper . readValue ( requestWebPage ( url ) , new TypeReference < List < SearchResult > > ( ) { } ) ; } catch ( IOException ex ) { throw new MovieMeterException ( ApiExceptionType . MAP...
Search for a movie
28,968
private String buildIdUrl ( String id ) { StringBuilder url = new StringBuilder ( MM_URL ) . append ( id ) . append ( MM_PARAM_QST ) . append ( MM_API ) . append ( apiKey ) ; LOG . trace ( "MovieMeter URL: {}" , url ) ; return url . toString ( ) ; }
Build the ID URL
28,969
private String buildSearchUrl ( String query ) { StringBuilder url = new StringBuilder ( MM_URL ) . append ( MM_PARAM_QST ) . append ( MM_QUERY ) . append ( encoder ( query ) ) . append ( MM_PARAM_AMP ) . append ( MM_API ) . append ( apiKey ) ; LOG . trace ( "MovieMeter URL: {}" , url ) ; return url . toString ( ) ; }
Build the Query URL
28,970
private static String encoder ( final String toEncode ) { try { return URLEncoder . encode ( toEncode , URL_ENCODING ) ; } catch ( UnsupportedEncodingException ex ) { LOG . warn ( "Failed to encode: {}" , ex . getMessage ( ) , ex ) ; return "" ; } }
Encode a string for use in the URL
28,971
private < T > T readJsonObject ( final String url , final Class < T > object ) throws MovieMeterException { final String page = requestWebPage ( url ) ; if ( StringUtils . isNotBlank ( page ) ) { try { return mapper . readValue ( page , object ) ; } catch ( IOException ex ) { throw new MovieMeterException ( ApiExceptio...
Get the information for a URL and process into an object
28,972
public static LogLevel toLogLevel ( Object value ) { if ( value == null ) return LogLevel . Info ; value = value . toString ( ) . toUpperCase ( ) ; if ( "0" . equals ( value ) || "NOTHING" . equals ( value ) || "NONE" . equals ( value ) ) return LogLevel . None ; else if ( "1" . equals ( value ) || "FATAL" . equals ( v...
Converts numbers and strings to standard log level values .
28,973
public static int toInteger ( LogLevel level ) { if ( level == LogLevel . Fatal ) return 1 ; if ( level == LogLevel . Error ) return 2 ; if ( level == LogLevel . Warn ) return 3 ; if ( level == LogLevel . Info ) return 4 ; if ( level == LogLevel . Debug ) return 5 ; if ( level == LogLevel . Trace ) return 6 ; return 0 ...
Converts log level to a number .
28,974
private LoadBalancerHealthCheck toLoadBalancerHealthCheck ( JSONObject ob ) throws JSONException , InternalException , CloudException { LoadBalancerHealthCheck . HCProtocol protocol = fromOSProtocol ( ob . getString ( "type" ) ) ; int count = ob . getInt ( "max_retries" ) ; int port = - 1 ; String path = ob . optString...
Convert OpenStack health_monitor object to Dasein LoadBalancerHealthCheck
28,975
public static final void assertProcessActive ( final String processInstanceId ) { Validate . notNull ( processInstanceId ) ; apiCallback . debug ( LogMessage . PROCESS_1 , processInstanceId ) ; try { getProcessInstanceAssertable ( ) . processIsActive ( processInstanceId ) ; } catch ( final AssertionError ae ) { apiCall...
Asserts the process instance with the provided id is active i . e . the process instance is not ended .
28,976
public static final void assertProcessEnded ( final String processInstanceId ) { Validate . notNull ( processInstanceId ) ; apiCallback . debug ( LogMessage . PROCESS_5 , processInstanceId ) ; try { getProcessInstanceAssertable ( ) . processIsEnded ( processInstanceId ) ; } catch ( final AssertionError ae ) { apiCallba...
Asserts the process instance with the provided id is ended .
28,977
public static final void assertTaskUncompleted ( final String taskId ) { Validate . notNull ( taskId ) ; apiCallback . debug ( LogMessage . TASK_2 , taskId ) ; try { getTaskInstanceAssertable ( ) . taskIsUncompleted ( taskId ) ; } catch ( final AssertionError ae ) { apiCallback . fail ( ae , LogMessage . ERROR_TASK_2 ,...
Asserts the task with the provided id is pending completion .
28,978
public static final void assertTaskUncompleted ( final String processInstanceId , final String taskDefinitionKey ) { Validate . notNull ( processInstanceId ) ; Validate . notNull ( taskDefinitionKey ) ; apiCallback . debug ( LogMessage . TASK_1 , taskDefinitionKey , processInstanceId ) ; try { getTaskInstanceAssertable...
Asserts a task with the provided taskDefinitionKey is pending completion in the process instance with the provided processInstanceId .
28,979
protected < T > T _executeTx ( final String operation , final Class < ? extends Persistable < ? > > type , final TransactionCallback < T > action ) { return _executeTx ( operation , type , null , action ) ; }
Executes the specified action in a new transaction .
28,980
private static String unsignedToString ( int value ) { if ( value >= 0 ) { return Integer . toString ( value ) ; } else { return Long . toString ( ( value ) & 0x00000000FFFFFFFFL ) ; } }
Convert an unsigned 32 - bit integer to a string .
28,981
private static StringBuilder toStringBuilder ( Readable input ) throws IOException { StringBuilder text = new StringBuilder ( ) ; CharBuffer buffer = CharBuffer . allocate ( BUFFER_SIZE ) ; while ( true ) { int n = input . read ( buffer ) ; if ( n == - 1 ) { break ; } buffer . flip ( ) ; text . append ( buffer , 0 , n ...
overhead is worthwhile
28,982
public RESTAssignedPropertyTagCollectionV1 getRESTPropertyTagInTopicRevisions ( int id , final Integer revision , final RESTBaseTopicV1 < ? , ? , ? > topic ) { final RESTAssignedPropertyTagCollectionV1 propertyTagRevisions ; if ( topic instanceof RESTTranslatedTopicV1 ) { propertyTagRevisions = getRESTTranslatedTopicPr...
Get the REST Property Tag Revision Collection for a specific Property Tag defined by ID and Revision .
28,983
public CollectionWrapper < PropertyTagInTopicWrapper > getPropertyTagInTopicRevisions ( int id , final Integer revision , final RESTBaseTopicV1 < ? , ? , ? > topic ) { return RESTCollectionWrapperBuilder . < PropertyTagInTopicWrapper > newBuilder ( ) . providerFactory ( getProviderFactory ( ) ) . collection ( getRESTPr...
Get the Wrapped Property Tag Revision Collection for a specific Property Tag defined by ID and Revision .
28,984
public static Message fromString ( String messageFrame ) throws InvalidMessageException { String prefix = null ; String trailing = null ; messageFrame = messageFrame . trim ( ) ; if ( messageFrame . startsWith ( ":" ) ) { int splitPoint = messageFrame . indexOf ( ' ' ) ; prefix = messageFrame . substring ( 1 , splitPoi...
Decode the given IRC message a string into an IRCMessage object
28,985
public static int processResponses ( PushNotificationManager notificationManager ) { List < ResponsePacket > responses = readResponses ( notificationManager . getActiveSocket ( ) ) ; handleResponses ( responses , notificationManager ) ; return responses . size ( ) ; }
Read response packets from the current APNS connection and process them .
28,986
private static List < ResponsePacket > readResponses ( Socket socket ) { List < ResponsePacket > responses = new Vector < ResponsePacket > ( ) ; int previousTimeout = 0 ; try { try { previousTimeout = socket . getSoTimeout ( ) ; socket . setSoTimeout ( TIMEOUT ) ; } catch ( Exception e ) { } InputStream input = socket ...
Read raw response packets from the provided socket .
28,987
public Set < ClassModel > getAllClassDependencies ( ) { HashSet < ClassModel > result = new HashSet < > ( ) ; ClassModel . getAllClassDependencies ( result , this ) ; return result ; }
All classes this class depends upon . Includes all transitive dependencies of this class even if the dependencies are not in a module themselves .
28,988
public void initializeConnection ( AppleNotificationServer server ) throws CommunicationException , KeystoreException { try { this . connectionToAppleServer = new ConnectionToNotificationServer ( server ) ; this . socket = connectionToAppleServer . getSSLSocket ( ) ; if ( heavyDebugMode ) { dumpCertificateChainDescript...
Initialize a connection and create a SSLSocket
28,989
private void restartPreviousConnection ( ) throws CommunicationException , KeystoreException { try { logger . debug ( "Closing connection to restart previous one" ) ; this . socket . close ( ) ; } catch ( Exception e ) { } initializePreviousConnection ( ) ; }
Stop and restart the current connection to the Apple server using server settings from the previous connection .
28,990
public void stopConnection ( ) throws CommunicationException , KeystoreException { processedFailedNotifications ( ) ; try { logger . debug ( "Closing connection" ) ; this . socket . close ( ) ; } catch ( Exception e ) { } }
Read and process any pending error - responses and then close the connection .
28,991
private int processedFailedNotifications ( ) throws CommunicationException , KeystoreException { if ( useEnhancedNotificationFormat ) { logger . debug ( "Reading responses" ) ; int responsesReceived = ResponsePacketReader . processResponses ( this ) ; while ( responsesReceived > 0 ) { PushedNotification skippedNotifica...
Read and process any pending error - responses .
28,992
public PushedNotification sendNotification ( Device device , Payload payload ) throws CommunicationException { return sendNotification ( device , payload , true ) ; }
Send a notification to a single device and close the connection .
28,993
public OutputStream getStreamAt ( int index ) { if ( index < streams . size ( ) ) { int i = 0 ; for ( Entry < OutputStream , Boolean > entry : streams . entrySet ( ) ) { if ( i ++ == index ) { return entry . getKey ( ) ; } } } return null ; }
Returns the stream at the given index .
28,994
public static ArrayList < HashMap < String , String > > computeSoilLayerSize ( ArrayList < HashMap < String , String > > soilsData ) { float deep = 0.0f ; ArrayList < HashMap < String , String > > newSoilsData ; newSoilsData = new ArrayList < HashMap < String , String > > ( ) ; for ( HashMap < String , String > current...
Compute soil layer thickness
28,995
private static synchronized String getFile ( String name ) { if ( Objects . isNullOrEmpty ( baseDirectory ) ) { baseDirectory = Options . getStorage ( ) . getSystem ( "numberSequence.home" , System . getProperty ( "user.home" ) + File . separator + ".s1-sequences" ) ; } File dir = new File ( baseDirectory ) ; if ( ! di...
Get file and ensure dir exists cache directory
28,996
public Betner reset ( String target ) { this . rebuild = ! target4Betn . equals ( target ) ; this . target4Betn = target ; return this ; }
Reset the given target String as delegate String
28,997
public int countMatches ( ) { if ( null != this . positions && this . positions . isPresent ( ) ) { return this . positions . get ( ) . size ( ) ; } if ( Strs . isEmpty ( target4Betn ) ) { return 0 ; } if ( ! region . isPresent ( ) ) { return 0 ; } if ( isEqual ( region . get ( ) [ 0 ] , region . get ( ) [ 1 ] ) ) { in...
Returns the number of matching string found in delegate string
28,998
public String result ( int positionNum ) { Pair < Integer , Integer > kv = null ; if ( null != ( kv = position ( positionNum , false ) ) ) { return doSubstring ( kv ) ; } return EMPTY ; }
Returns the substring in given range with given left position number
28,999
public Map < Integer , String > asMap ( ) { initializePosition ( ) ; final Map < Integer , String > results = Maps . newHashMap ( ) ; Mapper . from ( positions . get ( ) ) . entryLoop ( new Decisional < Map . Entry < Integer , Pair < Integer , Integer > > > ( ) { protected void decision ( Entry < Integer , Pair < Integ...
Returns the substring results in given range as a map left position number as key substring as value