idx
int64
0
41.2k
question
stringlengths
74
4.21k
target
stringlengths
5
888
29,100
public String store ( Blob blob ) throws IOException { File blobFile = File . createTempFile ( getClass ( ) . getName ( ) , null , strategy . tempDir ( ) ) ; BufferedOutputStream outputStream = new BufferedOutputStream ( new FileOutputStream ( blobFile ) ) ; blob . writeToStream ( outputStream ) ; if ( strategy instanceof FileRepositoryStrategy ) { ( ( FileRepositoryStrategy ) strategy ) . storeFileByRename ( blob . id ( ) , blobFile ) ; } else { strategy . store ( blob . id ( ) , new FileInputStream ( blobFile ) ) ; } return blob . id ( ) ; }
Speichert ein Blob im Repository .
29,101
public static < T > T fromJSON ( String json , Class < T > classOfT ) { return gson . fromJson ( json , classOfT ) ; }
Deserializes the given JSON into an instance of the given class .
29,102
public void load ( Map < String , Object > data ) throws PersistenceException { logger . debug ( "enter - load(Map)" ) ; try { for ( String key : data . keySet ( ) ) { Class < ? > cls = persistent . getClass ( ) ; Object val = data . get ( key ) ; Field f = null ; while ( f == null ) { try { f = cls . getDeclaredField ( key ) ; } catch ( NoSuchFieldException ignore ) { } if ( f == null ) { cls = cls . getSuperclass ( ) ; if ( cls == null || cls . getName ( ) . equals ( Object . class . getName ( ) ) ) { break ; } } } if ( f == null ) { logger . debug ( "No such field: " + key ) ; continue ; } try { f . setAccessible ( true ) ; f . set ( persistent , val ) ; } catch ( IllegalAccessException e ) { String msg = "Error setting value for " + key + ":\n" ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new PersistenceException ( msg + e . getMessage ( ) ) ; } catch ( IllegalArgumentException e ) { String msg = "Error setting value for " + key ; if ( val == null ) { msg = msg + " (null)" ; } else { msg = msg + " (" + val + ":" + val . getClass ( ) . getName ( ) + ")" ; } msg = msg + ":\n" + e . getClass ( ) . getName ( ) + ":\n" ; throw new PersistenceException ( msg + e . getMessage ( ) ) ; } } } finally { logger . debug ( "exit - load(Map)" ) ; } }
Loads the data values into the persistent object .
29,103
public void save ( Map < String , Object > data ) throws PersistenceException { logger . debug ( "enter - save(Map)" ) ; try { Class < ? > cls = persistent . getClass ( ) ; state = new HashMap < String , Object > ( ) ; while ( cls != null && ! cls . getName ( ) . equals ( Object . class . getName ( ) ) ) { Field [ ] fields = cls . getDeclaredFields ( ) ; for ( Field f : fields ) { int m = f . getModifiers ( ) ; if ( Modifier . isTransient ( m ) || Modifier . isStatic ( m ) ) { continue ; } f . setAccessible ( true ) ; state . put ( f . getName ( ) , f . get ( persistent ) ) ; } cls = cls . getSuperclass ( ) ; } for ( String key : data . keySet ( ) ) { state . put ( key , data . get ( key ) ) ; } } catch ( IllegalAccessException e ) { throw new PersistenceException ( e . getMessage ( ) ) ; } finally { logger . debug ( "exit - save(Map)" ) ; } }
Saves the current state of the persistent object .
29,104
@ SuppressWarnings ( "unchecked" ) public T deserialize ( ) throws ClassNotFoundException { try { ByteArrayInputStream byteStream = new ByteArrayInputStream ( data ) ; GZIPInputStream gzipStream = new GZIPInputStream ( byteStream ) ; try { ObjectInputStream objectStream = new ObjectInputStream ( gzipStream ) ; object = ( T ) objectStream . readObject ( ) ; return object ; } finally { gzipStream . close ( ) ; } } catch ( IOException e ) { throw new UnexpectedException ( e ) ; } }
Deserializes the serialized object .
29,105
protected Object doExec ( Element element , Object scope , String booleanExpression , Object ... arguments ) { return ! Boolean . valueOf ( booleanExpression ) ; }
Execute EXCLUDE operator . Returns branch enabled flag that is true to indicate branch is to be included in resulting document . Since exclude operator has opposite logic we need to negate given boolean expression ; so if operand is true meaning the branch should be excluded this method returns false .
29,106
public List < T > all ( Map < String , ? > params ) throws AuthenticationException , ApiException , InvalidRequestException { return all ( params , getAuthenticatedClient ( ) ) ; }
Return all the entities matching the parameters
29,107
public static Num percentOf ( Object percent , Object ofValue ) { Num _x = new Num ( percent ) ; Num _y = new Num ( ofValue ) ; Calculator cPercent = Calculator . builder ( ) . openBracket ( ) . val ( _x ) . div ( 100 ) . closeBracket ( ) . mul ( _y ) ; return cPercent . calculate ( ) ; }
Calculate percent of value
29,108
public static < T > boolean containsNull ( T ... hayStack ) { if ( hayStack == null ) return false ; for ( T hay : hayStack ) if ( hay == null ) return true ; return false ; }
Does an array contain a null value?
29,109
public static < T > boolean contains ( T needle , T ... hayStack ) { if ( needle == null ) return containsNull ( hayStack ) ; if ( hayStack == null ) return false ; for ( T hay : hayStack ) if ( needle . equals ( hay ) ) return true ; return false ; }
Does an array contain a value .
29,110
public static < T > T castOrNull ( Object o , Class < T > cls ) { if ( o == null ) return null ; if ( cls . isInstance ( o ) ) return cls . cast ( o ) ; return null ; }
Cast object to class or return null .
29,111
static long calculateTargetReps ( long reps , long nanos , long targetNanos , double gaussian ) { double targetReps = ( ( ( double ) reps ) / nanos ) * targetNanos ; return Math . max ( 1L , Math . round ( ( gaussian * ( targetReps / 5 ) ) + targetReps ) ) ; }
Returns a random number of reps based on a normal distribution around the estimated number of reps for the timing interval . The distribution used has a standard deviation of one fifth of the estimated number of reps .
29,112
private synchronized void recover ( ) { try { this . close ( ) ; Set < String > loggerNames = this . dataLoggerFactory . findLoggerNames ( ) ; for ( String loggerName : loggerNames ) { IDataLogger dataLogger = this . dataLoggerFactory . instanciateLogger ( loggerName ) ; XADataLogger xaLogger = new XADataLogger ( dataLogger ) ; PhynixxXADataRecorder phynixxXADataRecorder = PhynixxXADataRecorder . recoverDataRecorder ( xaLogger , this ) ; this . addXADataRecorder ( phynixxXADataRecorder ) ; } } catch ( Exception e ) { throw new DelegatedRuntimeException ( e ) ; } }
recovers all dataRecorder of the loggerSystem . All reopen dataRecorders are closed and all dataRecorder that can be recovered are opened for reading
29,113
public static boolean addAudioFile ( final File file ) throws IOException { if ( ! SystemUtils . IS_OS_MAC_OSX ) { LOG . debug ( "Not on OSX, not adding to iTunes" ) ; return false ; } if ( ! isSupported ( file ) ) { LOG . debug ( "iTunes does not support this file type: {}" , file ) ; return false ; } Runtime . getRuntime ( ) . exec ( createOSAScriptCommand ( file ) ) ; return true ; }
Adds the specified audio file to iTunes if we re on OSX .
29,114
private static boolean isSupported ( final File file ) { final String extension = FilenameUtils . getExtension ( file . getName ( ) ) ; if ( StringUtils . isBlank ( extension ) ) { return false ; } final String [ ] types = { "mp3" , "aif" , "aiff" , "wav" , "mp2" , "mp4" , "aac" , "mid" , "m4a" , "m4p" , "ogg" } ; if ( ArrayUtils . contains ( types , extension . toLowerCase ( ) ) ) { return true ; } return false ; }
Returns true if the extension of name is a supported file type .
29,115
private static String [ ] createOSAScriptCommand ( final File file ) { final String path = file . getAbsolutePath ( ) ; final String playlist = "LittleShoot" ; final String [ ] command = new String [ ] { "osascript" , "-e" , "tell application \"Finder\"" , "-e" , "set hfsFile to (POSIX file \"" + path + "\")" , "-e" , "set thePlaylist to \"" + playlist + "\"" , "-e" , "tell application \"iTunes\"" , "-e" , "launch" , "-e" , "if not (exists playlist thePlaylist) then" , "-e" , "set thisPlaylist to make new playlist" , "-e" , "set name of thisPlaylist to thePlaylist" , "-e" , "end if" , "-e" , "add hfsFile to playlist thePlaylist" , "-e" , "end tell" , "-e" , "end tell" } ; return command ; }
Constructs and returns a osascript command .
29,116
public static String getNullAsValue ( String input , String value ) { return ( input == null ) ? value : input ; }
Returns the specified string value if input is null otherwise returns the original input string untouched .
29,117
public static String replaceFirst ( String source , String find , String replace ) { return fastReplaceFirst ( source , find , replace ) ; }
Replaces first occurence of a String with another string
29,118
public static boolean isStringTrue ( String in ) { if ( in == null ) return false ; return in . equalsIgnoreCase ( "TRUE" ) || in . equalsIgnoreCase ( "YES" ) || in . equals ( "1" ) ; }
Returns true if the string is TRUE or YES or 1 case insensitive . False for null empty etc .
29,119
public static String chop ( String source , int length ) { try { return source . substring ( 0 , length ) ; } catch ( StringIndexOutOfBoundsException e ) { return source ; } catch ( NullPointerException e ) { return null ; } }
Chops a string off after a certain number of characters . If the string is shorter than the length then the string is returned untouched . nulls are returned as null .
29,120
public static String compressHexString ( String inString ) { String in = inString + "^" ; StringBuilder out = new StringBuilder ( ) ; char lastChar = ' ' ; int count = 0 ; for ( int i = 0 ; i < in . length ( ) ; i ++ ) { char thisChar = in . charAt ( i ) ; if ( thisChar == lastChar && count < 35 ) { count ++ ; } else { if ( count > 3 ) { out . append ( '^' ) ; out . append ( lastChar ) ; out . append ( "abcdefghijklmnopqrstuvwxyz01234567890" . charAt ( count ) ) ; } else { for ( int j = 0 ; j < count ; j ++ ) out . append ( lastChar ) ; } count = 1 ; lastChar = thisChar ; } } String outString = out . toString ( ) ; return outString ; }
Very simplistic compression method that encodes repeating characters into a smaller character so 0000000000 becomes ^0j where the ^ escapes the next two characters 0 is the repeating character and j encodes 10 repetitions .
29,121
public static String detokenize ( String [ ] values , String delimiter ) { return concat ( values , delimiter , 0 , values . length - 1 ) ; }
Converts a string array into a single string with values delimited by the specified delimiter .
29,122
public static boolean areStringsEqual ( String s1 , String s2 ) { return s1 != null && s1 . equals ( s2 ) || s1 == null && s2 == null ; }
null - safe string equality test . If both s1 and s2 are null returns true .
29,123
public void connectionFreed ( IManagedConnectionEvent < C > event ) { if ( ! event . getManagedConnection ( ) . hasCoreConnection ( ) ) { return ; } C con = event . getManagedConnection ( ) . getCoreConnection ( ) ; if ( con == null || ! ( con instanceof IXADataRecorderAware ) ) { return ; } IXADataRecorderAware messageAwareConnection = ( IXADataRecorderAware ) con ; IXADataRecorder xaDataRecorder = messageAwareConnection . getXADataRecorder ( ) ; if ( xaDataRecorder == null ) { return ; } if ( event . getManagedConnection ( ) . hasTransactionalData ( ) ) { xaRecorderRepository . close ( ) ; } else { xaDataRecorder . destroy ( ) ; } messageAwareConnection . setXADataRecorder ( null ) ; }
Logger will be closed . If a dataRecorder has remaining transactional data an abnormal prgram flow is detected an the data of the logger is not destroy but kept to further recovery
29,124
public void connectionRecovered ( IManagedConnectionEvent < C > event ) { if ( ! event . getManagedConnection ( ) . hasCoreConnection ( ) ) { return ; } IPhynixxConnection con = event . getManagedConnection ( ) . getCoreConnection ( ) ; if ( con == null || ! ( con instanceof IXADataRecorderAware ) ) { return ; } IXADataRecorderAware messageAwareConnection = ( IXADataRecorderAware ) con ; IXADataRecorder xaDataRecorder = messageAwareConnection . getXADataRecorder ( ) ; if ( xaDataRecorder == null ) { return ; } else { xaDataRecorder . destroy ( ) ; messageAwareConnection . setXADataRecorder ( null ) ; } }
destroys the datalogger
29,125
protected String parseObjectToString ( Object object , Locale locale , Arguments args ) { final String string = String . valueOf ( object ) ; if ( args . has ( LOWERCASE_FLAG ) ) { return string . toLowerCase ( locale ) ; } if ( args . has ( UPPERCASE_FLAG ) ) { return string . toUpperCase ( locale ) ; } return string ; }
Parses the given object to a string depending on the context .
29,126
public static String getIP ( final InetAddress inetAddress ) { String ip = "" ; ip = inetAddress . getHostAddress ( ) ; if ( ip . equals ( "" ) ) { final byte [ ] ipAddressInBytes = inetAddress . getAddress ( ) ; for ( int i = 0 ; i < ipAddressInBytes . length ; i ++ ) { if ( i > 0 ) { ip += "." ; } ip += ipAddressInBytes [ i ] & 0xFF ; } } return ip ; }
Gets the ip address from the given InetAddress object as a String .
29,127
public static InetAddress getLocalIPFromServerSocket ( final int port , final int backlog ) throws UnknownHostException , IOException { InetAddress inetAddress = null ; ServerSocket socket = null ; try { socket = new ServerSocket ( port , backlog , InetAddress . getLocalHost ( ) ) ; inetAddress = socket . getInetAddress ( ) ; socket . close ( ) ; } finally { SocketExtensions . closeServerSocket ( socket ) ; } return inetAddress ; }
Gets the InetAddress object from the local host from a ServerSocket object .
29,128
public static String getLocalIPFromServerSocketAsString ( ) throws UnknownHostException , IOException { InetAddress inetAddress = null ; inetAddress = IPResolver . getLocalIPFromServerSocket ( 10000 , 20000 ) ; return IPResolver . getIP ( inetAddress ) ; }
Gets the ip address from the local host as String . It use a ServerSocket object to get it .
29,129
public Object getFieldValue ( String fieldName ) throws ReflectorException { if ( object == null ) { logger . error ( "object is null: did you specify it using the 'inspect()' method?" ) ; throw new ReflectorException ( "object is null: did you specify it using the 'inspect()' method?" ) ; } if ( ! Strings . isValid ( fieldName ) ) { logger . error ( "field name is null or not valid" ) ; throw new ReflectorException ( "field name is null or not valid" ) ; } Object result = null ; String name = fieldName . trim ( ) ; if ( useGetters ) { logger . trace ( "accessing value using getter" ) ; String methodName = "get" + Character . toUpperCase ( name . charAt ( 0 ) ) + name . substring ( 1 ) ; result = invoke ( methodName ) ; } else { logger . trace ( "accessing value through direct field access" ) ; Field field = null ; boolean needReprotect = false ; try { field = object . getClass ( ) . getDeclaredField ( name ) ; if ( accessPrivateMembers ) { needReprotect = unprotect ( field ) ; } result = field . get ( object ) ; } catch ( Exception e ) { String message = "error accessing field '" + fieldName + "'" ; logger . error ( message , e ) ; throw new ReflectorException ( message , e ) ; } finally { if ( needReprotect ) { protect ( field ) ; } } } return result ; }
Retrieves the value of a field .
29,130
@ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public void setElementAtIndex ( int index , Object value ) throws ReflectorException { if ( object == null ) { logger . error ( "object is null: did you specify it using the 'inspect()' method?" ) ; throw new ReflectorException ( "object is null: did you specify it using the 'inspect()' method?" ) ; } if ( object . getClass ( ) . isArray ( ) ) { Array . set ( object , translateArrayIndex ( index , getArrayLength ( ) ) , value ) ; } else if ( object instanceof List < ? > ) { ( ( List ) object ) . set ( index , value ) ; } else { throw new ReflectorException ( "object is not an array or a list" ) ; } }
Sets the value of the n - th element in an array or a list .
29,131
public int getArrayLength ( ) throws ReflectorException { if ( object == null ) { logger . error ( "object is null: did you specify it using the 'inspect()' method?" ) ; throw new ReflectorException ( "object is null: did you specify it using the 'inspect()' method?" ) ; } int length = 0 ; if ( object . getClass ( ) . isArray ( ) ) { length = Array . getLength ( object ) ; } else if ( object instanceof List < ? > ) { length = ( ( List < ? > ) object ) . size ( ) ; } else { throw new ReflectorException ( "object is not an array or a list" ) ; } return length ; }
Returns the number of elements in the array or list object ;
29,132
public Object invoke ( String methodName , Object ... args ) throws ReflectorException { if ( object == null ) { logger . error ( "object is null: did you specify it using the 'inspect()' method?" ) ; throw new ReflectorException ( "object is null: did you specify it using the 'inspect()' method?" ) ; } if ( ! Strings . isValid ( methodName ) ) { logger . error ( "method name is null or not valid" ) ; throw new ReflectorException ( "method name is null or not valid" ) ; } Method method = null ; Object result = null ; boolean needReprotect = false ; try { method = object . getClass ( ) . getMethod ( methodName ) ; if ( accessPrivateMembers ) { needReprotect = unprotect ( method ) ; } result = method . invoke ( object , args ) ; } catch ( Exception e ) { logger . error ( "error invoking method '" + methodName + "'" , e ) ; throw new ReflectorException ( "error invoking method '" + methodName + "'" , e ) ; } finally { if ( needReprotect ) { protect ( method ) ; } } return result ; }
Invokes a method on the object under inspection .
29,133
public boolean unprotect ( AccessibleObject accessible ) { if ( ! accessible . isAccessible ( ) ) { accessible . setAccessible ( true ) ; return true ; } return false ; }
Checks if the given field or method is protected or private and if so makes it publicly accessible .
29,134
public boolean protect ( AccessibleObject accessible ) { if ( accessible . isAccessible ( ) ) { accessible . setAccessible ( false ) ; return true ; } return false ; }
Checks if the given field or method is public and if so makes it unaccessible .
29,135
private int translateArrayIndex ( int index , int length ) throws ReflectorException { if ( ! ( index > 0 ? index < length : Math . abs ( index ) <= Math . abs ( length ) ) ) { logger . error ( "index ({}) must be less than number of elements ({})" , index , length ) ; throw new ReflectorException ( "index must be less than number of elements" ) ; } int translated = index ; if ( ! ( translated > 0 ? translated < length : Math . abs ( translated ) <= Math . abs ( length ) ) ) { logger . error ( "index {} is out of bounds" , translated ) ; throw new ArrayIndexOutOfBoundsException ( ) ; } if ( translated < 0 ) { translated = length + translated ; } return translated ; }
Utility method that translates an array index either positive or negative into its positive representation . The method ensures that the index is within array bounds then it translates negative indexes to their positive counterparts according to the simple rule that element at index - 1 is the last element in the array index - 2 is the one before the last and so on .
29,136
public static void addObserver ( TaskObserver < ? > observer ) { if ( observer != null && tls . get ( ) . observers == null ) { tls . get ( ) . observers = new ArrayList < TaskObserver < ? > > ( ) ; } tls . get ( ) . observers . add ( observer ) ; }
Adds an observer to the current thread s observers of task execution life cycle .
29,137
static < E > ImmutableList < E > unsafeDelegateList ( List < ? extends E > list ) { switch ( list . size ( ) ) { case 0 : return of ( ) ; case 1 : return new SingletonImmutableList < E > ( list . iterator ( ) . next ( ) ) ; default : @ SuppressWarnings ( "unchecked" ) List < E > castedList = ( List < E > ) list ; return new RegularImmutableList < E > ( castedList ) ; } }
are guaranteed to be non - null .
29,138
public static String [ ] subarrayOf ( final String [ ] array , final int start , final int end ) { final int subarraySize = end - start ; final String [ ] subarray = new String [ subarraySize ] ; for ( int i = 0 ; i < subarraySize ; ++ i ) { subarray [ i ] = array [ i + start ] ; } return ( subarray ) ; }
Returns a new array with the elements between [ start end ) .
29,139
public static String asString ( Object object , String otherwise ) { return object != null ? object . toString ( ) : otherwise ; }
Returns the given object as a string if not null otherwise returns null .
29,140
public static boolean areValid ( String ... strings ) { boolean result = false ; if ( strings != null ) { result = true ; for ( String string : strings ) { result = result && isValid ( string ) ; } } return result ; }
Checks whether all the given strings are neither null nor blank .
29,141
public static String [ ] split ( String strings , String separator ) { return split ( strings , separator , DEFAULT_TRIM ) ; }
Splits the input string using the given separator to identify its tokens ; it will also trim the tokens .
29,142
public static String [ ] split ( String strings , String separator , boolean trim ) { StringTokeniser tokeniser = new StringTokeniser ( separator ) ; String [ ] tokens = tokeniser . tokenise ( strings ) ; if ( trim ) { for ( int i = 0 ; i < tokens . length ; ++ i ) { tokens [ i ] = tokens [ i ] != null ? tokens [ i ] . trim ( ) : tokens [ i ] ; } } return tokens ; }
Splits the input string using the given separator to identify its tokens ; it will also trim the tokens depending on the trim parameter .
29,143
public static String centre ( String string , int size , char padding ) { if ( string == null || size <= string . length ( ) ) { return string ; } StringBuilder sb = new StringBuilder ( ) ; for ( int i = 0 ; i < ( size - string . length ( ) ) / 2 ; i ++ ) { sb . append ( padding ) ; } sb . append ( string ) ; while ( sb . length ( ) < size ) { sb . append ( padding ) ; } return sb . toString ( ) ; }
Formats an output string by centering the given input string and padding it with the given character .
29,144
public static String padRight ( String string , int size , char padding ) { if ( string == null || size <= string . length ( ) ) { return string ; } StringBuilder sb = new StringBuilder ( ) ; sb . append ( string ) ; while ( sb . length ( ) < size ) { sb . append ( padding ) ; } return sb . toString ( ) ; }
Formats a string by padding it with the given character to the right until the given length is reached .
29,145
public static String firstValidOf ( String ... strings ) { if ( strings != null ) { for ( int i = 0 ; i < strings . length ; ++ i ) { if ( Strings . isValid ( strings [ i ] ) ) { return strings [ i ] ; } } } return null ; }
Returns the first valid string in the given set .
29,146
public static String reverse ( String string ) { if ( string != null ) { return new StringBuilder ( string ) . reverse ( ) . toString ( ) ; } return null ; }
Reverses the input string .
29,147
public static String fromStream ( InputStream stream ) throws IOException { if ( stream != null ) { try { Writer writer = new StringWriter ( ) ; Reader reader = new BufferedReader ( new InputStreamReader ( stream ) ) ; int read ; while ( ( read = reader . read ( ) ) != - 1 ) { writer . write ( read ) ; } return writer . toString ( ) ; } finally { try { stream . close ( ) ; } catch ( IOException e ) { logger . warn ( "error closing the input stream" , e ) ; } } } return null ; }
Reads from the given input stream into a String and returns it .
29,148
public Object convert ( Object value ) { if ( value instanceof Element ) { return parseXmlElement ( ( Element ) value ) ; } if ( value instanceof CompositeData ) { return toMap ( ( CompositeData ) value ) ; } return value ; }
Returns the value or the converted value if a conversion method is implemented .
29,149
private Map < String , Object > toMap ( CompositeData value ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; for ( String key : value . getCompositeType ( ) . keySet ( ) ) { data . put ( key , value . get ( key ) ) ; } return data ; }
Returns the CompositeData value as a Map .
29,150
private Object parseXmlElement ( Element element ) { if ( element . getFirstChild ( ) instanceof Text ) { Text text = ( Text ) element . getFirstChild ( ) ; return text . getData ( ) ; } return element ; }
Returns the XML Element as a String if it contains a Text as the first child else the element itself is returned .
29,151
public < T > void put ( Descriptor < T > descriptor , T component ) { store . put ( descriptor , component ) ; }
Puts the specified component and descriptor pair into the static global store .
29,152
protected void setField ( Field field , Object object ) throws IllegalAccessException { dataObject . setField ( field , object ) ; }
Implement in inner class in domain class decorator to ensure access to private and protected fields
29,153
public Object call ( Map < String , Object > m ) throws ScriptException { List < Object > args = Objects . newArrayList ( ) ; for ( Object o : m . values ( ) ) { args . add ( o ) ; } return call ( m , args ) ; }
Call with parameters
29,154
public static int optWriteDelimitedTo ( OutputStream out , Object message , Schema schema , LinkedBuffer buffer ) throws IOException { if ( buffer . start != buffer . offset ) throw new IllegalArgumentException ( "Buffer previously used and had not been reset." ) ; final ProtobufOutput output = new ProtobufOutput ( buffer ) ; buffer . offset = buffer . start + 5 ; output . size += 5 ; schema . writeTo ( output , message ) ; final int size = output . size - 5 ; final int delimOffset = IOUtil . putVarInt32AndGetOffset ( size , buffer . buffer , buffer . start ) ; out . write ( buffer . buffer , delimOffset , buffer . offset - delimOffset ) ; if ( buffer . next != null ) LinkedBuffer . writeTo ( out , buffer . next ) ; return size ; }
Optimal writeDelimitedTo - The varint32 prefix is written to the buffer instead of directly writing to outputstream .
29,155
private static boolean isValidDate ( String date , Calendar out , String separator ) { try { String [ ] dates = date . split ( separator ) ; out . set ( Calendar . DATE , Integer . parseInt ( dates [ dates . length - 1 ] ) ) ; out . set ( Calendar . MONTH , Integer . parseInt ( dates [ dates . length - 2 ] ) ) ; if ( dates . length > 2 ) { out . set ( Calendar . YEAR , Integer . parseInt ( dates [ dates . length - 3 ] ) ) ; } } catch ( Exception e ) { try { out . set ( Calendar . DATE , Integer . parseInt ( date . substring ( date . length ( ) - 2 , date . length ( ) ) ) ) ; out . set ( Calendar . MONTH , Integer . parseInt ( date . substring ( date . length ( ) - 4 , date . length ( ) - 2 ) ) - 1 ) ; if ( date . length ( ) > 4 ) { out . set ( Calendar . YEAR , Integer . parseInt ( date . substring ( date . length ( ) - 8 , date . length ( ) - 4 ) ) - 1 ) ; } } catch ( Exception e2 ) { return false ; } } return true ; }
To check if the input date string is valid and match with the required format
29,156
private static boolean isSameDate ( String date1 , String date2 , String separator ) { date2 = date2 . replace ( separator , "" ) ; if ( date2 . equals ( "0229" ) ) { try { int year1 = Integer . parseInt ( date1 . substring ( 2 , 4 ) ) ; if ( year1 % 4 != 0 ) { return date1 . endsWith ( "0228" ) ; } } catch ( Exception e ) { return false ; } } return date1 . endsWith ( date2 ) ; }
To check if two input date string is same date with no matter about 2nd input s separator
29,157
private static int getDailyRecIndex ( ArrayList < Map > dailyData , String findDate , int start , int expectedDiff ) { String date ; if ( start + expectedDiff < dailyData . size ( ) ) { date = getValueOr ( dailyData . get ( start + expectedDiff ) , "w_date" , "" ) ; if ( isSameDate ( date , findDate , "-" ) ) { return start + expectedDiff ; } else { expectedDiff ++ ; date = getValueOr ( dailyData . get ( start + expectedDiff ) , "w_date" , "" ) ; if ( isSameDate ( date , findDate , "-" ) ) { return start + expectedDiff ; } } } for ( int j = start ; j < dailyData . size ( ) ; j ++ ) { date = getValueOr ( dailyData . get ( j ) , "w_date" , "" ) ; if ( isSameDate ( date , findDate , "-" ) ) { return j ; } } return dailyData . size ( ) ; }
Find the index of daily data array for the particular date
29,158
public static ArrayList < HashMap < String , String > > getOMDistribution ( HashMap expData , String offset , String omcd , String omc2n , String omdep , String ominp , String dmr ) { String omamt ; ArrayList < HashMap < String , String > > eventData ; Event events ; String pdate ; String odate ; eventData = new ArrayList ( ) ; ArrayList < HashMap < String , String > > originalEvents = MapUtil . getBucket ( expData , "management" ) . getDataList ( ) ; omamt = getValueOr ( expData , "om_tot" , "" ) ; if ( omamt == null || omamt . equals ( "" ) ) { LOG . debug ( "OM_TOT IS NOT AVAILABLE, USING OMAMT" ) ; Event omEvent = new Event ( originalEvents , "organic_matter" ) ; omamt = ( String ) omEvent . getCurrentEvent ( ) . get ( "omamt" ) ; } if ( omamt == null || omamt . equals ( "" ) ) { LOG . error ( "NEITHER OM_TOT NOR OMAMT ARE AVAILABLE" ) ; return eventData ; } events = new Event ( originalEvents , "planting" ) ; pdate = ( String ) events . getCurrentEvent ( ) . get ( "date" ) ; if ( pdate == null || pdate . equals ( "" ) ) { LOG . error ( "PLANTING DATE IS NOT AVAILABLE" ) ; return eventData ; } odate = dateOffset ( pdate , offset ) ; if ( odate == null ) { LOG . error ( "INVALID OFFSET NUMBER OF DAYS [" + offset + "]" ) ; return eventData ; } String omnpct = divide ( divide ( "100.0" , dmr , 3 ) , omc2n , 2 ) ; if ( omnpct == null ) { LOG . error ( "INVALID VALUES FOR DMR and OMC2N" ) ; return eventData ; } HashMap result = new HashMap ( ) ; AcePathfinderUtil . insertValue ( result , "omdat" , odate ) ; AcePathfinderUtil . insertValue ( result , "omcd" , omcd ) ; AcePathfinderUtil . insertValue ( result , "omamt" , omamt ) ; AcePathfinderUtil . insertValue ( result , "omc2n" , omc2n ) ; AcePathfinderUtil . insertValue ( result , "omdep" , omdep ) ; AcePathfinderUtil . insertValue ( result , "ominp" , ominp ) ; AcePathfinderUtil . insertValue ( result , "omn%" , omnpct ) ; eventData = MapUtil . getBucket ( result , "management" ) . getDataList ( ) ; return eventData ; }
Organic matter applications include manure crop residues etc . As a result the organic matter application event is updated with missing data .
29,159
public static ArrayList < ArrayList < HashMap < String , String > > > getAutoEventDate ( Map data ) { ArrayList < ArrayList < HashMap < String , String > > > results = new ArrayList < ArrayList < HashMap < String , String > > > ( ) ; int expDur ; try { expDur = Integer . parseInt ( getValueOr ( data , "exp_dur" , "1" ) ) ; } catch ( Exception e ) { expDur = 1 ; } if ( expDur <= 1 ) { LOG . warn ( "Experiment duration is not more than 1, AUTO_REPLICATE_EVENTS won't be applied." ) ; return results ; } ArrayList < HashMap < String , String > > events = MapUtil . getBucket ( data , "management" ) . getDataList ( ) ; while ( results . size ( ) < expDur ) { results . add ( new ArrayList ( ) ) ; } for ( HashMap < String , String > event : events ) { String date = getValueOr ( event , "date" , "" ) ; if ( date . equals ( "" ) ) { String eventType = getValueOr ( event , "event" , "unknown" ) ; LOG . warn ( "Original {} event has an invalid date: [{}]." , eventType , date ) ; } String edate = getValueOr ( event , "edate" , "" ) ; for ( int j = 0 ; j < expDur ; j ++ ) { HashMap < String , String > newEvent = new HashMap ( ) ; newEvent . putAll ( event ) ; if ( ! date . equals ( "" ) ) { newEvent . put ( "date" , yearOffset ( date , j + "" ) ) ; } if ( ! edate . equals ( "" ) ) { newEvent . put ( "edate" , yearOffset ( edate , j + "" ) ) ; } results . get ( j ) . add ( newEvent ) ; } } return results ; }
This function will clone the original management events for each year in the experiment duration . Only the date of each event will be increased year by year . If experiment duration is no longer than 1 year no generation will be executed .
29,160
public static String getFstPdate ( Map data , String defValue ) { ArrayList < HashMap < String , String > > events = getBucket ( data , "management" ) . getDataList ( ) ; Event event = new Event ( events , "planting" ) ; return getValueOr ( event . getCurrentEvent ( ) , "date" , defValue ) ; }
Get the first planting date from given data set .
29,161
public CompoundActivity addActivity ( Activity activity ) { if ( activity != null ) { logger . trace ( "adding sub-activity '{}' to list" , activity . getId ( ) ) ; activities . add ( activity ) ; } return this ; }
Adds an activity to the list of sub - activities .
29,162
public boolean find ( ) { start = last ; for ( ; start < tokens . size ( ) ; start ++ ) { match = automaton . matches ( input , start ) ; if ( match . getEndLocation ( ) != - 1 ) { last = match . getEndLocation ( ) ; return true ; } } start = - 1 ; match = new Match ( - 1 , null ) ; return false ; }
Find boolean .
29,163
public int start ( ) { Preconditions . checkState ( match != null , "Have not called find()" ) ; if ( start >= 0 ) { return tokens . get ( start ) . start ( ) ; } return - 1 ; }
Start int .
29,164
public int end ( ) { Preconditions . checkState ( match != null , "Have not called find()" ) ; if ( match . getEndLocation ( ) >= 0 ) { return tokens . get ( match . getEndLocation ( ) - 1 ) . end ( ) ; } return - 1 ; }
End int .
29,165
public List < HString > group ( String groupName ) { return Collections . unmodifiableList ( match . getCaptures ( ) . get ( groupName ) ) ; }
Group list .
29,166
public boolean matches ( String string ) { Matcher matcher = pattern . matcher ( string ) ; boolean result = matcher . matches ( ) ; return result ; }
Checks whether the given string matches the regular expression .
29,167
public List < String [ ] > getAllMatches ( String string ) { Matcher matcher = pattern . matcher ( string ) ; List < String [ ] > matched = new ArrayList < String [ ] > ( ) ; while ( matcher . find ( ) ) { int count = matcher . groupCount ( ) ; String [ ] strings = new String [ count ] ; for ( int i = 0 ; i < count ; ++ i ) { strings [ i ] = matcher . group ( i + 1 ) ; } matched . add ( strings ) ; } return matched ; }
Retrieves a list of tokens in the input string that match this regular expression .
29,168
@ SuppressWarnings ( "unchecked" ) private < T > T execOperator ( Element element , Object scope , Meta meta , Format ... format ) throws IOException { Operator operator = factory . geInstance ( meta . opcode ) ; return ( T ) operator . exec ( element , scope , meta . operand , format . length == 1 ? format [ 0 ] : null ) ; }
Helper method for operator execution .
29,169
private static void addAttribute ( Element element , Set < Attr > attributes , Object value ) { Attr attr = ( Attr ) value ; if ( ! attributes . add ( attr ) ) { throw new TemplateException ( "Invalid element |%s|. It has both static attribute |%s| and attribute operator." , element , attr . getName ( ) ) ; } }
Helper method to add an attribute to a set .
29,170
private Object checkAndProxyReturnValue ( Object retValue ) { if ( retValue != null && retValue instanceof RESTBaseEntityCollectionV1 ) { final RESTBaseEntityV1 < ? > parent = this . parent == null ? getProxyEntity ( ) : this . parent ; return RESTCollectionProxyFactory . create ( getProviderFactory ( ) , ( RESTBaseEntityCollectionV1 ) retValue , isRevision , parent ) ; } else { return retValue ; } }
Checks the return value and creates a proxy for the content if required .
29,171
public void reopen ( AccessMode accessMode ) throws IOException { if ( this . randomAccess == null ) { associatedRandomAccessFile ( ) ; } this . accessMode = accessMode ; switch ( accessMode ) { case READ : maybeRead ( ) ; this . randomAccess . rewind ( ) ; break ; case WRITE : maybeWritten ( ) ; this . randomAccess . reset ( ) ; break ; case APPEND : maybeWritten ( ) ; this . randomAccess . forwardWind ( ) ; break ; default : throw new IllegalArgumentException ( "Invalid AccessMode " + accessMode ) ; } }
reopens the datalogger . It is assumed that the logger is open .
29,172
void handleSubscriberException ( Throwable e , SubscriberExceptionContext context ) { checkNotNull ( e ) ; checkNotNull ( context ) ; try { exceptionHandler . handleException ( e , context ) ; } catch ( Throwable e2 ) { logger . log ( Level . SEVERE , String . format ( "Exception %s thrown while handling exception: %s" , e2 , e ) , e2 ) ; } }
Handles the given exception thrown by a subscriber with the given context .
29,173
public < T > T getValue ( Class < T > type , String parameter , Message message , T uriParameterValue ) { if ( message == null && uriParameterValue != null ) { return uriParameterValue ; } T value = message . getHeader ( parameter , type ) ; if ( value == null ) { value = uriParameterValue ; } return value ; }
Get Header - Parameter or alternative Configured URI Parameter Value
29,174
public Object getValue ( String parameter , Endpoint endpoint ) { return endpoint . getEndpointConfiguration ( ) . getParameter ( parameter ) ; }
Get Configured Endpoint Parameter
29,175
public Object getFunctionsValue ( String parameter , String function ) { Object value = null ; return value ; }
Extract values out from Functions
29,176
public void free ( ) { try { if ( hasCoreConnection ( ) ) { this . getCoreConnection ( ) . close ( ) ; } this . fireConnectionFreed ( ) ; this . boundThreadId = Thread . currentThread ( ) . getId ( ) ; } finally { this . setClosed ( true ) ; setTransactionalData ( false ) ; this . releaseThreadBinding ( ) ; } }
marks a connection a freed . This connection won t be used any more .
29,177
public void release ( ) { try { if ( hasCoreConnection ( ) ) { checkThreadBinding ( ) ; this . setClosed ( true ) ; this . getCoreConnection ( ) . reset ( ) ; this . fireConnectionReleased ( ) ; } } finally { this . setClosed ( true ) ; setTransactionalData ( false ) ; this . releaseThreadBinding ( ) ; } }
Implementation of releasing the connection from transactional context
29,178
public void recover ( ) { if ( this . getCoreConnection ( ) == null || ! ImplementorUtils . isImplementationOf ( getCoreConnection ( ) , IXADataRecorderAware . class ) ) { return ; } IXADataRecorderAware con = ImplementorUtils . cast ( getCoreConnection ( ) , IXADataRecorderAware . class ) ; IXADataRecorder msgLogger = this . getXADataRecorder ( ) ; if ( msgLogger . isEmpty ( ) ) { return ; } this . fireConnectionRecovering ( ) ; IDataRecordReplay dataRecordReplay = con . recoverReplayListener ( ) ; if ( dataRecordReplay == null ) { throw new IllegalStateException ( "IPhynixxConnection.recoverReplayListener() has to provide a IDataRecordReplay to be recovered" ) ; } msgLogger . replayRecords ( dataRecordReplay ) ; this . fireConnectionRecovered ( ) ; }
recovers the data of the dataLogger and provides the recovered data to the connection via the replaylistener
29,179
private < K , T extends Persistable < K > > CastorDao < K , T > _createDao ( final Class < T > type ) { String daoClazzName = _typeMapping . get ( type . getName ( ) ) ; if ( _LOG_ . isDebugEnabled ( ) ) { _LOG_ . debug ( "creating Dao: object type=" + type + ", Dao type=" + daoClazzName ) ; } CastorDao < K , T > dao = null ; if ( daoClazzName == null ) { dao = new CastorDao < K , T > ( type ) ; } else { try { @ SuppressWarnings ( "unchecked" ) Class < CastorDao < K , T > > daoClazz = ( Class < CastorDao < K , T > > ) Class . forName ( daoClazzName ) ; dao = daoClazz . newInstance ( ) ; } catch ( Exception ex ) { throw new PersistenceException ( ex ) ; } } if ( CastorDaoSupport . class . isInstance ( dao ) ) { CastorDaoSupport support = CastorDaoSupport . class . cast ( dao ) ; support . setJDOManager ( _jdoManager ) ; } return dao ; }
Creates a Dao for the specified object type .
29,180
public static boolean isPrintable ( char c ) { Character . UnicodeBlock block = Character . UnicodeBlock . of ( c ) ; return ( ! Character . isISOControl ( c ) ) && c != KeyEvent . CHAR_UNDEFINED && block != null && block != Character . UnicodeBlock . SPECIALS ; }
Checks whether the given character is printable .
29,181
public static TextNormalization configuredInstance ( ) { if ( INSTANCE == null ) { synchronized ( TextNormalization . class ) { if ( INSTANCE == null ) { INSTANCE = new TextNormalization ( ) ; INSTANCE . initConfig ( ) ; } } } return INSTANCE ; }
Configured instance text normalization .
29,182
public String normalize ( String input , Language language ) { if ( input == null ) { return null ; } String finalString = input ; for ( TextNormalizer textNormalizer : preprocessors ) { finalString = textNormalizer . apply ( finalString , language ) ; } return finalString ; }
Normalizes a string with a number of text normalizers .
29,183
public Bus < M > send ( M message ) { logger . trace ( "starting dispatching message '{}' to destinations" , message ) ; for ( Destination < M > destination : destinations ) { logger . trace ( "dispatching to destination {}" , destination ) ; destination . onMessage ( message ) ; } logger . trace ( "done dispatching message '{}' to destinations" , message ) ; return this ; }
Sends a message synchronously to all registered destinations ; message handling code in the destinations will run in the same thread as the sender object s .
29,184
public Bus < M > post ( M message , long timeout , TimeUnit unit ) throws InterruptedException { queue . offer ( message , timeout , unit ) ; return this ; }
Posts a message to all registered destinations waiting up to the specified number of time units if the internal queue is full .
29,185
public String next ( int maxTries ) { for ( int i = 1 ; i <= maxTries ; ++ i ) { val sb = new StringBuilder ( 32 ) . append ( Math . abs ( r . nextLong ( ) ) ) ; val s = Strs . fixedLength ( sb , len ) . toString ( ) ; if ( filter . add ( s ) ) return s ; } throw new RuntimeException ( "try out times" ) ; }
Thread - safe method to get next random voucher no .
29,186
public MapMaker concurrencyLevel ( int concurrencyLevel ) { checkState ( this . concurrencyLevel == UNSET_INT , "concurrency level was already set to %s" , this . concurrencyLevel ) ; checkArgument ( concurrencyLevel > 0 ) ; this . concurrencyLevel = concurrencyLevel ; return this ; }
Guides the allowed concurrency among update operations . Used as a hint for internal sizing . The table is internally partitioned to try to permit the indicated number of concurrent updates without contention . Because assignment of entries to these partitions is not necessarily uniform the actual concurrency observed may vary . Ideally you should choose a value to accommodate as many threads as will ever concurrently modify the table . Using a significantly higher value than you need can waste space and time and a significantly lower value can lead to thread contention . But overestimates and underestimates within an order of magnitude do not usually have much noticeable impact . A value of one permits only one thread to modify the map at a time but since read operations can proceed concurrently this still yields higher concurrency than full synchronization . Defaults to 4 .
29,187
@ GwtIncompatible ( "To be supported" ) MapMaker expireAfterAccess ( long duration , TimeUnit unit ) { checkExpiration ( duration , unit ) ; this . expireAfterAccessNanos = unit . toNanos ( duration ) ; if ( duration == 0 && this . nullRemovalCause == null ) { this . nullRemovalCause = RemovalCause . EXPIRED ; } useCustomMap = true ; return this ; }
Specifies that each entry should be automatically removed from the map once a fixed duration has elapsed after the entry s last read or write access .
29,188
@ GwtIncompatible ( "MapMakerInternalMap" ) < K , V > MapMakerInternalMap < K , V > makeCustomMap ( ) { return new MapMakerInternalMap < K , V > ( this ) ; }
Returns a MapMakerInternalMap for the benefit of internal callers that use features of that class not exposed through ConcurrentMap .
29,189
public void parseFile ( File file ) throws ParserException , IOException { Reader reader = null ; try { reader = new FileReader ( file ) ; nanoElement . parseFromReader ( reader ) ; } catch ( XMLParseException e ) { throw new ParserException ( e . getMessage ( ) ) ; } finally { if ( reader != null ) reader . close ( ) ; } }
Parse a XML file .
29,190
public void parseString ( String xml ) throws ParserException { try { nanoElement . parseString ( xml ) ; } catch ( XMLParseException e ) { throw new ParserException ( e . getMessage ( ) ) ; } }
Parse a XML string .
29,191
public void parseReader ( Reader reader ) throws ParserException , IOException { try { nanoElement . parseFromReader ( reader ) ; } catch ( XMLParseException e ) { throw new ParserException ( e . getMessage ( ) ) ; } }
Parse a XML from Reader .
29,192
public void save ( File file ) throws IOException { Writer writer = null ; try { writer = new Writer ( file ) ; writer . println ( toPrettyString ( ) ) ; } finally { if ( writer != null ) writer . close ( ) ; } }
Save this XML object as a XML file .
29,193
public String toPrettyString ( ) { StringBuilder sb = recursiveToString ( this , 0 , indent , new StringBuilder ( ) ) ; sb . insert ( 0 , XML_DOCTYPE + "\n" ) ; return new String ( sb ) ; }
Returns this XML object as a formatted string using the indent .
29,194
public final < T > T decode ( Object value ) { if ( value == null ) { return null ; } if ( value instanceof Collection ) { List < T > list = new ArrayList < > ( ) ; Cast . < Collection < ? > > as ( value ) . forEach ( o -> list . add ( decode ( o ) ) ) ; return Cast . as ( list ) ; } if ( value instanceof Map ) { Map < String , T > map = new HashMap < > ( ) ; Cast . < Map < ? , ? > > as ( value ) . forEach ( ( k , v ) -> map . put ( k . toString ( ) , decode ( v ) ) ) ; return Cast . as ( map ) ; } if ( value instanceof Val ) { return decodeImpl ( Cast . < Val > as ( value ) . get ( ) ) ; } return decodeImpl ( value ) ; }
Converts an object to desired type
29,195
public static Dimension getDimensions ( String fileName , String mimeType , InputStream input ) throws ImageSizeException , FormatNotSuported , DaoManagerException { if ( isGIF ( mimeType ) ) { try { return getGifDimensions ( input ) ; } catch ( IOException e ) { throw new ImageSizeException ( e , "while getting dimension for file:" + fileName + " mimeType:" + mimeType ) ; } } else if ( isJPEG ( mimeType ) ) { try { Dimension dim = getJpgDimensions ( input ) ; if ( dim != null ) { return dim ; } else { throw new ImageSizeException ( "Illegal size for file:" + fileName + " mimeType:" + mimeType ) ; } } catch ( IOException e ) { throw new ImageSizeException ( e , "while getting dimension for file:" + fileName + " mimeType:" + mimeType ) ; } } else if ( isPNG ( mimeType ) ) { try { Dimension dim = getPngDimensions ( input ) ; if ( dim != null ) { return dim ; } else { throw new ImageSizeException ( "Illegal size for file:" + fileName + " mimeType:" + mimeType ) ; } } catch ( IOException e ) { throw new ImageSizeException ( e , "while getting dimension for file:" + fileName + " mimeType:" + mimeType ) ; } } else { throw new FormatNotSuported ( "Mime type:" + mimeType + " not supported." ) ; } }
ATENCION SE LEEN CARACTERES DEL INPUT STREM POR LO QUE LA POSICION DE LECTURA DENTRO DEL INPUT QUEDA INUTILIZADA
29,196
protected void log ( final String message ) { if ( stringLogger == null ) { stringLogger = new StringPluginLogger ( "TASKS" ) ; } stringLogger . log ( message ) ; }
Logs the specified message .
29,197
@ SuppressWarnings ( "PMD.AvoidThreadGroup" ) private String [ ] findFiles ( final File workspaceRoot ) { FileSet fileSet = new FileSet ( ) ; org . apache . tools . ant . Project project = new org . apache . tools . ant . Project ( ) ; fileSet . setProject ( project ) ; fileSet . setDir ( workspaceRoot ) ; fileSet . setIncludes ( filePattern ) ; if ( StringUtils . isNotBlank ( excludeFilePattern ) ) { fileSet . setExcludes ( excludeFilePattern ) ; } log ( "Scanning folder '" + workspaceRoot + "' for files matching the pattern '" + filePattern + "' - excludes: " + excludeFilePattern ) ; return fileSet . getDirectoryScanner ( project ) . getIncludedFiles ( ) ; }
Returns an array with the filenames of the files that have been found in the workspace .
29,198
public final String apply ( String input , Language inputLanguage ) { if ( input != null && Config . get ( this . getClass ( ) , inputLanguage , "apply" ) . asBoolean ( true ) ) { return performNormalization ( input , inputLanguage ) ; } return input ; }
Performs a pre - processing operation on the input string in the given input language
29,199
public static < K , V > SortedMap < K , V > asMap ( SortedSet < K > set , Function < ? super K , V > function ) { return Platform . mapsAsMapSortedSet ( set , function ) ; }
Returns a view of the sorted set as a map mapping keys from the set according to the specified function .