idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
24,000
public static LocalDocument findLocalDocumentByParentAndUrlName ( Folder parentFolder , String urlName ) { ResourceDAO resourceDAO = new ResourceDAO ( ) ; Resource resource = resourceDAO . findByUrlNameAndParentFolder ( urlName , parentFolder ) ; if ( resource instanceof LocalDocument ) { return ( LocalDocument ) resource ; } return null ; }
Returns local document by parent folder and URL name
24,001
protected OffsetDateTime translateDate ( Date date ) { if ( date == null ) { return null ; } return OffsetDateTime . ofInstant ( date . toInstant ( ) , ZoneId . systemDefault ( ) ) ; }
Translates date into offset date time
24,002
protected UUID translateUserId ( User user ) { if ( user == null ) { return null ; } return userController . getUserKeycloakId ( user ) ; }
Translates user into user id
24,003
public String getCommentLabel ( Long id ) { Map < String , String > valueMap = answers . get ( id ) ; if ( valueMap != null && ! valueMap . isEmpty ( ) ) { Set < Entry < String , String > > entrySet = valueMap . entrySet ( ) ; List < String > labels = entrySet . stream ( ) . map ( entry -> String . format ( "%s / %s" , entry . getKey ( ) , entry . getValue ( ) ) ) . collect ( Collectors . toList ( ) ) ; return StringUtils . join ( labels , " - " ) ; } return null ; }
Returns comment label as string
24,004
protected void setCommentLabel ( Long id , String caption , String value ) { Map < String , String > valueMap = answers . get ( id ) ; if ( valueMap == null ) { valueMap = new LinkedHashMap < > ( ) ; } valueMap . put ( caption , value ) ; answers . put ( id , valueMap ) ; }
Sets a label for a specified comment
24,005
private List < QueryQuestionComment > listRootComments ( ) { QueryQuestionCommentDAO queryQuestionCommentDAO = new QueryQuestionCommentDAO ( ) ; return queryQuestionCommentDAO . listRootCommentsByQueryPageAndStampOrderByCreated ( queryPage , panelStamp ) ; }
Lists page s root comments
24,006
private boolean isPanelUser ( JdbcConnection connection , Long panelId , String email ) throws CustomChangeException { try ( PreparedStatement statement = connection . prepareStatement ( "SELECT id FROM PANELUSER WHERE panel_id = ? AND user_id = (SELECT id FROM USEREMAIL WHERE address = ?)" ) ) { statement . setLong ( 1 , panelId ) ; statement . setString ( 2 , email ) ; try ( ResultSet resultSet = statement . executeQuery ( ) ) { return resultSet . next ( ) ; } } catch ( Exception e ) { throw new CustomChangeException ( e ) ; } }
Returns whether user by email is a PanelUser or not
24,007
private void deleteInvitation ( JdbcConnection connection , Long id ) throws CustomChangeException { try ( PreparedStatement statement = connection . prepareStatement ( "DELETE FROM PANELINVITATION WHERE id = ?" ) ) { statement . setLong ( 1 , id ) ; statement . execute ( ) ; } catch ( Exception e ) { throw new CustomChangeException ( e ) ; } }
Deletes an invitation
24,008
public Double getQuantile ( int quantile , int base ) { if ( getCount ( ) == 0 ) return null ; if ( ( quantile > base ) || ( quantile <= 0 ) || ( base <= 0 ) ) throw new IllegalArgumentException ( "Incorrect quantile/base specified." ) ; double quantileFraq = ( double ) quantile / base ; int index = ( int ) Math . round ( quantileFraq * ( getCount ( ) - 1 ) ) ; return ( double ) data . get ( index ) + shift ; }
Returns quantile over base value .
24,009
private QueryFieldDataStatistics createStatistics ( List < Double > data , double min , double max , double step ) { Map < Double , String > dataNames = new HashMap < > ( ) ; for ( double d = min ; d <= max ; d += step ) { String caption = step % 1 == 0 ? Long . toString ( Math . round ( d ) ) : Double . toString ( d ) ; dataNames . put ( d , caption ) ; } return ReportUtils . getStatistics ( data , dataNames ) ; }
Creates statistics object
24,010
public List < List < String > > getParsedArgs ( String [ ] args ) throws InvalidFormatException { for ( int i = 0 ; i < args . length ; i ++ ) { if ( ! args [ i ] . startsWith ( "-" ) ) { if ( this . params . size ( ) > 0 ) { List < String > option = new ArrayList < String > ( ) ; option . add ( this . params . get ( 0 ) . longOption ) ; this . params . remove ( 0 ) ; option . add ( args [ i ] ) ; sortedArgs . add ( option ) ; } else { throw new InvalidFormatException ( "Expected command line option, found " + args [ i ] + " instead." ) ; } } else { for ( Argument option : this . args ) { if ( option . matchesFlag ( args [ i ] ) ) { List < String > command = new ArrayList < String > ( ) ; command . add ( noDashes ( args [ i ] ) ) ; if ( option . takesValue ) { try { if ( args [ i + 1 ] . startsWith ( "-" ) ) { if ( option . valueRequired ) throw new InvalidFormatException ( "Invalid command line format: -" + option . option + " or --" + option . longOption + " requires a parameter, found " + args [ i + 1 ] + " instead." ) ; } else { command . add ( args [ ++ i ] ) ; } } catch ( ArrayIndexOutOfBoundsException e ) { } } sortedArgs . add ( command ) ; break ; } } } } return sortedArgs ; }
Get the parsed and checked command line arguments for this parser
24,011
public void addArguments ( String [ ] argList ) throws DuplicateOptionException , InvalidFormatException { for ( String arg : argList ) { Argument f = new Argument ( ) ; String [ ] breakdown = arg . split ( "," ) ; for ( String s : breakdown ) { s = s . trim ( ) ; if ( s . startsWith ( "--" ) ) { f . longOption = noDashes ( s ) ; } else if ( s . startsWith ( "-h" ) ) { f . helpText = s . substring ( 2 ) ; } else if ( s . startsWith ( "-" ) ) { f . option = noDashes ( s ) ; } else if ( s . equals ( "+" ) ) { f . takesValue = true ; f . valueRequired = true ; } else if ( s . equals ( "?" ) ) { f . isParam = true ; f . takesValue = true ; params . add ( f ) ; } else if ( s . equals ( "*" ) ) { f . takesValue = true ; } else { throw new InvalidFormatException ( s + " in " + arg + " is not formatted correctly." ) ; } } addArgument ( f ) ; } }
adds options for this command line parser
24,012
public void addArgument ( char shortForm , String longForm , String helpText , boolean isParameter , boolean takesValue , boolean valueRequired ) throws DuplicateOptionException { Argument f = new Argument ( ) ; f . option = "" + shortForm ; f . longOption = longForm ; f . takesValue = takesValue ; f . valueRequired = valueRequired ; f . helpText = helpText ; f . isParam = isParameter ; if ( isParameter ) params . add ( f ) ; addArgument ( f ) ; }
Add an argument for this command line parser . Options should not be prepended by dashes .
24,013
public void add ( JDesktopPaneLayout child , Object constraints , int index ) { if ( child . parent != this ) { throw new IllegalArgumentException ( "Layout is not a child of this layout" ) ; } container . add ( child . container , constraints , index ) ; }
Add the given desktop pane layout as a child to this one
24,014
public void remove ( JDesktopPaneLayout child ) { if ( child . parent != this ) { throw new IllegalArgumentException ( "Layout is not a child of this layout" ) ; } container . remove ( child . container ) ; }
Remove the given child layout
24,015
public void validate ( ) { Dimension size = desktopPane . getSize ( ) ; size . height -= computeDesktopIconsSpace ( ) ; layoutInternalFrames ( size ) ; }
Validate the layout after internal frames have been added or removed
24,016
private int computeDesktopIconsSpace ( ) { for ( JInternalFrame f : frameToComponent . keySet ( ) ) { if ( f . isIcon ( ) ) { JDesktopIcon desktopIcon = f . getDesktopIcon ( ) ; return desktopIcon . getPreferredSize ( ) . height ; } } return 0 ; }
Compute the space for iconified desktop icons
24,017
private void callDoLayout ( Container container ) { container . doLayout ( ) ; int n = container . getComponentCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Component component = container . getComponent ( i ) ; if ( component instanceof Container ) { Container subContainer = ( Container ) component ; callDoLayout ( subContainer ) ; } } }
Recursively call doLayout on the container and all its sub - containers
24,018
private void applyLayout ( ) { int n = container . getComponentCount ( ) ; for ( int i = 0 ; i < n ; i ++ ) { Component component = container . getComponent ( i ) ; if ( component instanceof FrameComponent ) { FrameComponent frameComponent = ( FrameComponent ) component ; JInternalFrame internalFrame = frameComponent . getInternalFrame ( ) ; Rectangle bounds = SwingUtilities . convertRectangle ( container , component . getBounds ( ) , rootContainer ) ; internalFrame . setBounds ( bounds ) ; } else { LayoutContainer childLayoutContainer = ( LayoutContainer ) component ; childLayoutContainer . owner . applyLayout ( ) ; } } }
Apply the current layout to the internal frames
24,019
public void addData ( final BenchmarkMethod meth , final AbstractMeter meter , final double data ) { final Class < ? > clazz = meth . getMethodToBench ( ) . getDeclaringClass ( ) ; if ( ! elements . containsKey ( clazz ) ) { elements . put ( clazz , new ClassResult ( clazz ) ) ; } final ClassResult clazzResult = elements . get ( clazz ) ; if ( ! clazzResult . elements . containsKey ( meth ) ) { clazzResult . elements . put ( meth , new MethodResult ( meth ) ) ; } final MethodResult methodResult = clazzResult . elements . get ( meth ) ; methodResult . addData ( meter , data ) ; clazzResult . addData ( meter , data ) ; this . addData ( meter , data ) ; for ( final AbstractOutput output : outputs ) { output . listenToResultSet ( meth , meter , data ) ; } }
Adding a dataset to a given meter and adapting the underlaying result model .
24,020
public void addException ( final AbstractPerfidixMethodException exec ) { this . getExceptions ( ) . add ( exec ) ; for ( final AbstractOutput output : outputs ) { output . listenToException ( exec ) ; } }
Adding an exception to this result .
24,021
static Action create ( Runnable command ) { Objects . requireNonNull ( command , "The command may not be null" ) ; return new AbstractAction ( ) { private static final long serialVersionUID = 8693271079128413874L ; public void actionPerformed ( ActionEvent e ) { command . run ( ) ; } } ; }
Create a new action that simply executes the given command
24,022
public void doAESEncryption ( ) throws Exception { if ( ! initAESDone ) initAES ( ) ; cipher = Cipher . getInstance ( "AES/CBC/PKCS5Padding" ) ; cipher . init ( Cipher . ENCRYPT_MODE , secretKey ) ; AlgorithmParameters params = cipher . getParameters ( ) ; iv = params . getParameterSpec ( IvParameterSpec . class ) . getIV ( ) ; secretCipher = cipher . doFinal ( secretPlain ) ; clearPlain ( ) ; }
clears all plaintext passwords and secrets . password secret and initAES must all be set before re - using
24,023
public static JPanel wrapTitled ( String title , JComponent component ) { JPanel p = new JPanel ( new GridLayout ( 1 , 1 ) ) ; p . setBorder ( BorderFactory . createTitledBorder ( title ) ) ; p . add ( component ) ; return p ; }
Wrap the given component into a panel with a titled border with the given title
24,024
public static JPanel wrapFlow ( JComponent component ) { JPanel p = new JPanel ( new FlowLayout ( FlowLayout . CENTER , 0 , 0 ) ) ; p . add ( component ) ; return p ; }
Wrap the given component into a panel with flow layout
24,025
public static void setDeepEnabled ( Component component , boolean enabled ) { component . setEnabled ( enabled ) ; if ( component instanceof Container ) { Container container = ( Container ) component ; for ( Component c : container . getComponents ( ) ) { setDeepEnabled ( c , enabled ) ; } } }
Enables or disables the given component and all its children recursively
24,026
static int indexOf ( String source , String target , int startIndex , boolean ignoreCase ) { if ( ignoreCase ) { return indexOf ( source , target , startIndex , IGNORING_CASE ) ; } return indexOf ( source , target , startIndex , ( c0 , c1 ) -> Integer . compare ( c0 , c1 ) ) ; }
Returns the index of the first appearance of the given target in the given source starting at the given index . Returns - 1 if the target string is not found .
24,027
private static int indexOf ( String source , String target , int startIndex , IntBinaryOperator comparator ) { return indexOf ( source , 0 , source . length ( ) , target , 0 , target . length ( ) , startIndex , comparator ) ; }
Returns the index of the first appearance of the given target in the given source starting at the given index using the given comparator for characters . Returns - 1 if the target string is not found .
24,028
private static int indexOf ( String source , int sourceOffset , int sourceCount , String target , int targetOffset , int targetCount , int startIndex , IntBinaryOperator comparator ) { int fromIndex = startIndex ; if ( fromIndex >= sourceCount ) { return ( targetCount == 0 ? sourceCount : - 1 ) ; } if ( fromIndex < 0 ) { fromIndex = 0 ; } if ( targetCount == 0 ) { return fromIndex ; } char first = target . charAt ( targetOffset ) ; int max = sourceOffset + ( sourceCount - targetCount ) ; for ( int i = sourceOffset + fromIndex ; i <= max ; i ++ ) { if ( comparator . applyAsInt ( source . charAt ( i ) , first ) != 0 ) { while ( ++ i <= max && comparator . applyAsInt ( source . charAt ( i ) , first ) != 0 ) { } } if ( i <= max ) { int j = i + 1 ; int end = j + targetCount - 1 ; for ( int k = targetOffset + 1 ; j < end && comparator . applyAsInt ( source . charAt ( j ) , target . charAt ( k ) ) == 0 ; j ++ , k ++ ) { } if ( j == end ) { return i - sourceOffset ; } } } return - 1 ; }
Returns the index of the first appearance of the given range of the target in the given range of the source source starting at the given index using the given comparator for characters . Returns - 1 if the target string is not found .
24,029
private static int lastIndexOf ( String source , String target , int startIndex , IntBinaryOperator comparator ) { return lastIndexOf ( source , 0 , source . length ( ) , target , 0 , target . length ( ) , startIndex , comparator ) ; }
Returns the index of the previous appearance of the given target in the given source starting at the given index using the given comparator for characters . Returns - 1 if the target string is not found .
24,030
static int lastIndexOf ( String source , int sourceOffset , int sourceCount , String target , int targetOffset , int targetCount , int startIndex , IntBinaryOperator comparator ) { int fromIndex = startIndex ; int rightIndex = sourceCount - targetCount ; if ( fromIndex < 0 ) { return - 1 ; } if ( fromIndex > rightIndex ) { fromIndex = rightIndex ; } if ( targetCount == 0 ) { return fromIndex ; } int strLastIndex = targetOffset + targetCount - 1 ; char strLastChar = target . charAt ( strLastIndex ) ; int min = sourceOffset + targetCount - 1 ; int i = min + fromIndex ; startSearchForLastChar : while ( true ) { while ( i >= min && comparator . applyAsInt ( source . charAt ( i ) , strLastChar ) != 0 ) { i -- ; } if ( i < min ) { return - 1 ; } int j = i - 1 ; int start = j - ( targetCount - 1 ) ; int k = strLastIndex - 1 ; while ( j > start ) { if ( comparator . applyAsInt ( source . charAt ( j -- ) , target . charAt ( k -- ) ) != 0 ) { i -- ; continue startSearchForLastChar ; } } return start - sourceOffset + 1 ; } }
Returns the index of the previous appearance of the given range of the target in the given range of the source source starting at the given index using the given comparator for characters . Returns - 1 if the target string is not found .
24,031
Observable < ComapiResult < MessagesQueryResponse > > doQueryMessages ( final String token , final String conversationId , final Long from , final Integer limit ) { return wrapObservable ( service . queryMessages ( AuthManager . addAuthPrefix ( token ) , apiSpaceId , conversationId , from , limit ) . map ( mapToComapiResult ( ) ) , log , "Querying messages in " + conversationId ) ; }
Query messages in a conversation .
24,032
Observable < ComapiResult < Void > > doIsTyping ( final String token , final String conversationId , final boolean isTyping ) { if ( isTyping ) { return wrapObservable ( service . isTyping ( AuthManager . addAuthPrefix ( token ) , apiSpaceId , conversationId ) . map ( mapToComapiResult ( ) ) , log , "Sending is typing." ) ; } else { return wrapObservable ( service . isNotTyping ( AuthManager . addAuthPrefix ( token ) , apiSpaceId , conversationId ) . map ( mapToComapiResult ( ) ) , log , "Sending is not typing" ) ; } }
Send information if user started or stopped typing message in a conversation .
24,033
public void init ( Key key , IvParameterSpec iv ) throws InvalidKeyException { if ( ! ( key instanceof SecretKey ) ) throw new InvalidKeyException ( ) ; int ivLength = iv . getIV ( ) . length ; if ( key . getEncoded ( ) . length < MIN_KEY_SIZE || key . getEncoded ( ) . length < ivLength ) throw new InvalidKeyException ( "Key must be longer than " + MIN_KEY_SIZE + " bytes and key must be longer than IV." ) ; this . key = key . getEncoded ( ) ; this . iv = iv ; prehash = Misc . XORintoA ( this . key . length == ivLength ? iv . getIV ( ) : Arrays . copyOf ( iv . getIV ( ) , this . key . length ) , this . key ) ; blockNo = 0 ; buffer = new ByteQueue ( getBlockSize ( ) * 2 ) ; buffer . setResizable ( true ) ; cfg = true ; }
Initializes the cipher with key and iv
24,034
private void onParticipantIsTyping ( ParticipantTypingEvent event ) { handler . post ( ( ) -> listener . onParticipantIsTyping ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation participant is typing event .
24,035
private void onParticipantTypingOff ( ParticipantTypingOffEvent event ) { handler . post ( ( ) -> listener . onParticipantTypingOff ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation participant stopped typing event .
24,036
private void onProfileUpdate ( ProfileUpdateEvent event ) { handler . post ( ( ) -> listener . onProfileUpdate ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch profile update event .
24,037
private void onMessageSent ( MessageSentEvent event ) { handler . post ( ( ) -> listener . onMessageSent ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation message event .
24,038
private void onSocketStarted ( SocketStartEvent event ) { handler . post ( ( ) -> listener . onSocketStarted ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch socket info event .
24,039
private void onParticipantAdded ( ParticipantAddedEvent event ) { handler . post ( ( ) -> listener . onParticipantAdded ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch participant added to a conversation event .
24,040
private void onParticipantUpdated ( ParticipantUpdatedEvent event ) { handler . post ( ( ) -> listener . onParticipantUpdated ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch participant updated event .
24,041
private void onParticipantRemoved ( ParticipantRemovedEvent event ) { handler . post ( ( ) -> listener . onParticipantRemoved ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch participant removed event .
24,042
private void onConversationUpdated ( ConversationUpdateEvent event ) { handler . post ( ( ) -> listener . onConversationUpdated ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation updated event .
24,043
private void onConversationDeleted ( ConversationDeleteEvent event ) { handler . post ( ( ) -> listener . onConversationDeleted ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation deleted event .
24,044
private void onConversationUndeleted ( ConversationUndeleteEvent event ) { handler . post ( ( ) -> listener . onConversationUndeleted ( event ) ) ; log ( "Event published " + event . toString ( ) ) ; }
Dispatch conversation restored event .
24,045
protected String getToken ( ) { return dataMgr . getSessionDAO ( ) . session ( ) != null ? dataMgr . getSessionDAO ( ) . session ( ) . getAccessToken ( ) : null ; }
Gets session access token .
24,046
public void init ( final Context context , final String suffix , final Logger log ) { deviceDAO = new DeviceDAO ( context , suffix ) ; onetimeDeviceSetup ( context ) ; logInfo ( log ) ; sessionDAO = new SessionDAO ( context , suffix ) ; }
Initialise Session Manager .
24,047
private void logInfo ( final Logger log ) { log . i ( "App ver. = " + deviceDAO . device ( ) . getAppVer ( ) ) ; log . i ( "Comapi device ID = " + deviceDAO . device ( ) . getDeviceId ( ) ) ; log . d ( "Firebase ID = " + deviceDAO . device ( ) . getInstanceId ( ) ) ; }
Log basic information about initialisation environment .
24,048
private static < T > Stream < T > enumerationAsStream ( Enumeration < ? extends T > e ) { Iterator < T > iterator = new Iterator < T > ( ) { public T next ( ) { return e . nextElement ( ) ; } public boolean hasNext ( ) { return e . hasMoreElements ( ) ; } } ; return StreamSupport . stream ( Spliterators . spliteratorUnknownSize ( iterator , Spliterator . ORDERED ) , false ) ; }
Returns a new stream that has the same contents as the given enumeration
24,049
public int getRowWidth ( ) { int overallWidth = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { overallWidth += getTable ( ) . getColumnWidth ( i ) ; } return overallWidth ; }
Returns the row s total width .
24,050
public static byte [ ] shuffle ( byte [ ] input ) { for ( int i = 0 ; i < input . length ; i ++ ) { int i2 = input [ i ] ; if ( i2 < 0 ) i2 = 127 + Math . abs ( i2 ) ; input [ i ] = shuffle [ i2 ] ; } return input ; }
a minimal perfect hash function for a 32 byte input
24,051
public static byte [ ] getSHA256 ( byte [ ] input , boolean asSingleton ) { if ( SHA256_INSTANCE == null ) { if ( asSingleton ) { try { SHA256_INSTANCE = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { e . printStackTrace ( ) ; } } else { return getHash ( "SHA-256" , input ) ; } } return SHA256_INSTANCE . digest ( input ) ; }
Get the SHA256 Hash of input
24,052
SocketInterface createSocket ( final String token , final WeakReference < SocketStateListener > stateListenerWeakReference ) { WebSocket socket = null ; WebSocketFactory factory = new WebSocketFactory ( ) ; if ( proxyAddress != null ) { ProxySettings settings = factory . getProxySettings ( ) ; settings . setServer ( proxyAddress ) ; } try { socket = factory . createSocket ( uri , TIMEOUT ) ; } catch ( IOException e ) { log . f ( "Creating socket failed" , e ) ; } if ( socket != null ) { String header = AuthManager . AUTH_PREFIX + token ; socket . addHeader ( "Authorization" , header ) ; socket . addListener ( createWebSocketAdapter ( stateListenerWeakReference ) ) ; socket . setPingInterval ( PING_INTERVAL ) ; return new SocketWrapperImpl ( socket ) ; } return null ; }
Creates and configures web socket instance .
24,053
protected WebSocketAdapter createWebSocketAdapter ( final WeakReference < SocketStateListener > stateListenerWeakReference ) { return new WebSocketAdapter ( ) { public void onConnected ( WebSocket websocket , Map < String , List < String > > headers ) throws Exception { super . onConnected ( websocket , headers ) ; final SocketStateListener stateListener = stateListenerWeakReference . get ( ) ; if ( stateListener != null ) { stateListener . onConnected ( ) ; } } public void onConnectError ( WebSocket websocket , WebSocketException exception ) throws Exception { super . onConnectError ( websocket , exception ) ; final SocketStateListener stateListener = stateListenerWeakReference . get ( ) ; if ( stateListener != null ) { stateListener . onError ( uri . getRawPath ( ) , proxyAddress , exception ) ; } } public void onDisconnected ( WebSocket websocket , WebSocketFrame serverCloseFrame , WebSocketFrame clientCloseFrame , boolean closedByServer ) throws Exception { super . onDisconnected ( websocket , serverCloseFrame , clientCloseFrame , closedByServer ) ; final SocketStateListener stateListener = stateListenerWeakReference . get ( ) ; if ( stateListener != null ) { stateListener . onDisconnected ( ) ; } } public void onTextMessage ( WebSocket websocket , String text ) throws Exception { super . onTextMessage ( websocket , text ) ; log . d ( "Socket message received = " + text ) ; messageListener . onMessage ( text ) ; } public void onBinaryMessage ( WebSocket websocket , byte [ ] binary ) throws Exception { super . onBinaryMessage ( websocket , binary ) ; log . d ( "Socket binary message received." ) ; } } ; }
Create adapter for websocket library events .
24,054
public static int getNumberOfAnnotatedRuns ( final Method meth ) { if ( ! isBenchmarkable ( meth ) ) { throw new IllegalArgumentException ( "Method " + meth + " must be a benchmarkable method." ) ; } final Bench benchAnno = meth . getAnnotation ( Bench . class ) ; final BenchClass benchClassAnno = meth . getDeclaringClass ( ) . getAnnotation ( BenchClass . class ) ; int returnVal ; if ( benchAnno == null ) { returnVal = benchClassAnno . runs ( ) ; } else { returnVal = benchAnno . runs ( ) ; if ( ( returnVal == Bench . NONE_RUN ) && ( benchClassAnno != null ) ) { returnVal = benchClassAnno . runs ( ) ; } } return returnVal ; }
Getting the number of runs corresponding to a given method . The method MUST be a benchmarkable method otherwise an IllegalStateException exception arises . The number of runs of an annotated method is more powerful than the number of runs as denoted by the benchclass annotation .
24,055
public static Method findAndCheckAnyMethodByAnnotation ( final Class < ? > clazz , final Class < ? extends Annotation > anno ) throws PerfidixMethodCheckException { Method anyMethod = null ; final Method [ ] possAnnoMethods = clazz . getDeclaredMethods ( ) ; for ( final Method meth : possAnnoMethods ) { if ( meth . getAnnotation ( anno ) != null ) { if ( anyMethod == null ) { if ( isReflectedExecutable ( meth , anno ) ) { anyMethod = meth ; } else { throw new PerfidixMethodCheckException ( new IllegalAccessException ( anno . toString ( ) + "-annotated method " + meth + " is not executable." ) , meth , anno ) ; } } else { throw new PerfidixMethodCheckException ( new IllegalAccessException ( "Please use only one " + anno . toString ( ) + "-annotation in one class." ) , meth , anno ) ; } } } return anyMethod ; }
This class finds any method with a given annotation . The method is allowed to occur only once in the class and should match the requirements for Perfidix for an execution by reflection .
24,056
public static boolean isBenchmarkable ( final Method meth ) { boolean returnVal = true ; final Bench benchAnno = meth . getAnnotation ( Bench . class ) ; final SkipBench skipBenchAnno = meth . getAnnotation ( SkipBench . class ) ; if ( skipBenchAnno != null ) { returnVal = false ; } final BeforeBenchClass beforeClass = meth . getAnnotation ( BeforeBenchClass . class ) ; if ( beforeClass != null && benchAnno == null ) { returnVal = false ; } final BeforeFirstRun beforeFirstRun = meth . getAnnotation ( BeforeFirstRun . class ) ; if ( beforeFirstRun != null && benchAnno == null ) { returnVal = false ; } final BeforeEachRun beforeEachRun = meth . getAnnotation ( BeforeEachRun . class ) ; if ( beforeEachRun != null && benchAnno == null ) { returnVal = false ; } final AfterEachRun afterEachRun = meth . getAnnotation ( AfterEachRun . class ) ; if ( afterEachRun != null && benchAnno == null ) { returnVal = false ; } final AfterLastRun afterLastRun = meth . getAnnotation ( AfterLastRun . class ) ; if ( afterLastRun != null && benchAnno == null ) { returnVal = false ; } final AfterBenchClass afterClass = meth . getAnnotation ( AfterBenchClass . class ) ; if ( afterClass != null && benchAnno == null ) { returnVal = false ; } final BenchClass classBenchAnno = meth . getDeclaringClass ( ) . getAnnotation ( BenchClass . class ) ; if ( benchAnno == null && classBenchAnno == null ) { returnVal = false ; } if ( ! isReflectedExecutable ( meth , Bench . class ) ) { returnVal = false ; } return returnVal ; }
This method should act as a check to guarantee that only specific Benchmarkables are used for benching .
24,057
public static boolean isReflectedExecutable ( final Method meth , final Class < ? extends Annotation > anno ) { boolean returnVal = true ; if ( anno . equals ( DataProvider . class ) && ! meth . getReturnType ( ) . isAssignableFrom ( Object [ ] [ ] . class ) ) { returnVal = false ; } if ( ! anno . equals ( DataProvider . class ) && ! meth . getGenericReturnType ( ) . equals ( Void . TYPE ) ) { returnVal = false ; } if ( ! ( anno . equals ( BeforeBenchClass . class ) ) && Modifier . isStatic ( meth . getModifiers ( ) ) ) { returnVal = false ; } if ( ! Modifier . isPublic ( meth . getModifiers ( ) ) ) { returnVal = false ; } return returnVal ; }
Checks if this method is executable via reflection for perfidix purposes . That means that the method has no parameters ( except for no return - value is non - static is public and throws no exceptions .
24,058
private Method findDataProvider ( ) throws PerfidixMethodCheckException { final Bench benchAnno = getMethodToBench ( ) . getAnnotation ( Bench . class ) ; Method dataProvider = null ; if ( benchAnno != null && ! benchAnno . dataProvider ( ) . equals ( "" ) ) { try { final String dataProviderIdentifier = benchAnno . dataProvider ( ) ; for ( final Method eachMeth : getMethodToBench ( ) . getDeclaringClass ( ) . getMethods ( ) ) { DataProvider anno = eachMeth . getAnnotation ( DataProvider . class ) ; if ( anno != null && anno . name ( ) . equals ( dataProviderIdentifier ) ) { if ( dataProvider == null ) { dataProvider = eachMeth ; } else { throw new PerfidixMethodCheckException ( new RuntimeException ( "Only one Dataprovider allowed, but found " + dataProvider + " and " + eachMeth ) , eachMeth , DataProvider . class ) ; } } } if ( dataProvider == null ) { dataProvider = getMethodToBench ( ) . getDeclaringClass ( ) . getDeclaredMethod ( dataProviderIdentifier ) ; } final Class < ? > returnType = dataProvider . getReturnType ( ) ; if ( Object [ ] [ ] . class . isAssignableFrom ( returnType ) ) { } } catch ( NoSuchMethodException | SecurityException e ) { } } return dataProvider ; }
This method checks whether a method uses a data provider for dynamic input
24,059
public static void setDividerLocation ( final JSplitPane splitPane , final double location ) { SwingUtilities . invokeLater ( new Runnable ( ) { public void run ( ) { splitPane . setDividerLocation ( location ) ; splitPane . validate ( ) ; } } ) ; }
Set the location of the the given split pane to the given value later on the EDT and validate the split pane
24,060
private SessionData loadSession ( ) { synchronized ( sharedLock ) { SharedPreferences sharedPreferences = getSharedPreferences ( ) ; String id = sharedPreferences . getString ( KEY_PROFILE_ID , null ) ; if ( ! TextUtils . isEmpty ( id ) ) { sharedLock . notifyAll ( ) ; return new SessionData ( ) . setProfileId ( id ) . setSessionId ( sharedPreferences . getString ( KEY_SESSION_ID , null ) ) . setAccessToken ( sharedPreferences . getString ( KEY_ACCESS_TOKEN , null ) ) . setExpiresOn ( sharedPreferences . getLong ( KEY_EXPIRES_ON , 0 ) ) ; } sharedLock . notifyAll ( ) ; } return null ; }
Loads active session details from internal storage .
24,061
public String clearSession ( ) { synchronized ( sharedLock ) { SessionData session = loadSession ( ) ; String id = session != null ? session . getSessionId ( ) : null ; clearAll ( ) ; sharedLock . notifyAll ( ) ; return id ; } }
Deletes currently saved session .
24,062
public boolean startSession ( ) { synchronized ( sharedLock ) { SessionData session = loadSession ( ) ; if ( isSessionActive ( session ) ) { sharedLock . notifyAll ( ) ; return false ; } else { clearAll ( ) ; } sharedLock . notifyAll ( ) ; } return true ; }
Creates session if no session is active .
24,063
public boolean updateSessionDetails ( final SessionData session ) { synchronized ( sharedLock ) { if ( session != null ) { SharedPreferences . Editor editor = getSharedPreferences ( ) . edit ( ) ; editor . putString ( KEY_PROFILE_ID , session . getProfileId ( ) ) ; editor . putString ( KEY_SESSION_ID , session . getSessionId ( ) ) ; editor . putString ( KEY_ACCESS_TOKEN , session . getAccessToken ( ) ) ; editor . putLong ( KEY_EXPIRES_ON , session . getExpiresOn ( ) ) ; boolean isUpdated = editor . commit ( ) ; sharedLock . notifyAll ( ) ; return isUpdated ; } sharedLock . notifyAll ( ) ; } return false ; }
Updates session details obtained frm the services .
24,064
public static Object fromJSON ( String jsonString ) { List < Token > tokens = Derulo . toTokens ( jsonString ) ; return fromJSON ( tokens ) ; }
Get a java object from a JSON value
24,065
final void add ( final int e ) { if ( size == list . length ) list = Arrays . copyOf ( list , newSize ( ) ) ; list [ size ++ ] = e ; }
Adds an entry to the array .
24,066
public final boolean contains ( final int e ) { for ( int i = 0 ; i < size ; ++ i ) if ( list [ i ] == e ) return true ; return false ; }
Checks if the specified element is found in the list .
24,067
public final void insert ( final int i , final int [ ] e ) { final int l = e . length ; if ( l == 0 ) return ; if ( size + l > list . length ) list = Arrays . copyOf ( list , newSize ( size + l ) ) ; Array . move ( list , i , l , size - i ) ; System . arraycopy ( e , 0 , list , i , l ) ; size += l ; }
Inserts elements at the specified index position .
24,068
public static void expandAllFixedHeight ( JTree tree ) { TreeCellRenderer cellRenderer = tree . getCellRenderer ( ) ; Component treeCellRendererComponent = cellRenderer . getTreeCellRendererComponent ( tree , tree . getModel ( ) . getRoot ( ) , false , false , false , 1 , false ) ; int rowHeight = treeCellRendererComponent . getPreferredSize ( ) . height + 2 ; tree . setRowHeight ( rowHeight ) ; List < TreeExpansionListener > expansionListeners = Arrays . asList ( tree . getTreeExpansionListeners ( ) ) ; for ( TreeExpansionListener expansionListener : expansionListeners ) { tree . removeTreeExpansionListener ( expansionListener ) ; } TreePath rootPath = new TreePath ( tree . getModel ( ) . getRoot ( ) ) ; expandAllRecursively ( tree , rootPath ) ; for ( TreeExpansionListener expansionListener : expansionListeners ) { tree . addTreeExpansionListener ( expansionListener ) ; } tree . collapsePath ( rootPath ) ; tree . expandPath ( rootPath ) ; }
Expand all rows of the given tree assuming a fixed height for the rows .
24,069
private static void expandAllRecursively ( JTree tree , TreePath treePath ) { TreeModel model = tree . getModel ( ) ; Object lastPathComponent = treePath . getLastPathComponent ( ) ; int childCount = model . getChildCount ( lastPathComponent ) ; if ( childCount == 0 ) { return ; } tree . expandPath ( treePath ) ; for ( int i = 0 ; i < childCount ; i ++ ) { Object child = model . getChild ( lastPathComponent , i ) ; int grandChildCount = model . getChildCount ( child ) ; if ( grandChildCount > 0 ) { class LocalTreePath extends TreePath { private static final long serialVersionUID = 0 ; public LocalTreePath ( TreePath parent , Object lastPathComponent ) { super ( parent , lastPathComponent ) ; } } TreePath nextTreePath = new LocalTreePath ( treePath , child ) ; expandAllRecursively ( tree , nextTreePath ) ; } } }
Recursively expand all paths in the given tree starting with the given path
24,070
public static void collapseAll ( JTree tree , boolean omitRoot ) { int rows = tree . getRowCount ( ) ; int limit = ( omitRoot ? 1 : 0 ) ; for ( int i = rows - 1 ; i >= limit ; i -- ) { tree . collapseRow ( i ) ; } }
Collapse all rows of the given tree
24,071
private static int countNodes ( TreeModel treeModel , Object node ) { int sum = 1 ; int n = treeModel . getChildCount ( node ) ; for ( int i = 0 ; i < n ; i ++ ) { sum += countNodes ( treeModel , treeModel . getChild ( node , i ) ) ; } return sum ; }
Recursively count the number of nodes in the given tree model starting with the given node
24,072
public static List < Object > getChildren ( TreeModel treeModel , Object node ) { List < Object > children = new ArrayList < Object > ( ) ; int n = treeModel . getChildCount ( node ) ; for ( int i = 0 ; i < n ; i ++ ) { Object child = treeModel . getChild ( node , i ) ; children . add ( child ) ; } return children ; }
Returns the children of the given node in the given tree model
24,073
public static List < Object > getAllNodes ( TreeModel treeModel ) { List < Object > result = new ArrayList < Object > ( ) ; getAllDescendants ( treeModel , treeModel . getRoot ( ) , result ) ; result . add ( 0 , treeModel . getRoot ( ) ) ; return result ; }
Return all nodes of the given tree model
24,074
private static void getAllDescendants ( TreeModel treeModel , Object node , List < Object > result ) { if ( node == null ) { return ; } result . add ( node ) ; List < Object > children = getChildren ( treeModel , node ) ; for ( Object child : children ) { getAllDescendants ( treeModel , child , result ) ; } }
Compute all descendants of the given node in the given tree model
24,075
public static List < Object > getLeafNodes ( TreeModel treeModel , Object node ) { List < Object > leafNodes = new ArrayList < Object > ( ) ; getLeafNodes ( treeModel , node , leafNodes ) ; return leafNodes ; }
Returns a list containing all leaf nodes from the given tree model that are descendants of the given node . These are the nodes that have 0 children .
24,076
private static void getLeafNodes ( TreeModel treeModel , Object node , Collection < Object > leafNodes ) { if ( node == null ) { return ; } int childCount = treeModel . getChildCount ( node ) ; if ( childCount == 0 ) { leafNodes . add ( node ) ; } else { for ( int i = 0 ; i < childCount ; i ++ ) { Object child = treeModel . getChild ( node , i ) ; getLeafNodes ( treeModel , child , leafNodes ) ; } } }
Recursively collect all leaf nodes in the given tree model that are descendants of the given node .
24,077
public static TreePath createTreePathToRoot ( TreeModel treeModel , Object node ) { List < Object > nodes = new ArrayList < Object > ( ) ; nodes . add ( node ) ; Object current = node ; while ( true ) { Object parent = getParent ( treeModel , current ) ; if ( parent == null ) { break ; } nodes . add ( 0 , parent ) ; current = parent ; } TreePath treePath = new TreePath ( nodes . toArray ( ) ) ; return treePath ; }
Returns the tree path from the given node to the root in the given tree model
24,078
public static List < TreePath > computeExpandedPaths ( JTree tree ) { List < TreePath > treePaths = new ArrayList < TreePath > ( ) ; int rows = tree . getRowCount ( ) ; for ( int i = 0 ; i < rows ; i ++ ) { TreePath treePath = tree . getPathForRow ( i ) ; treePaths . add ( treePath ) ; } return treePaths ; }
Compute the list of all tree paths in the given tree that are currently expanded
24,079
public static TreePath translatePath ( TreeModel newTreeModel , TreePath oldPath ) { return translatePath ( newTreeModel , oldPath , Objects :: equals ) ; }
Translates one TreePath to a new TreeModel . This methods assumes DefaultMutableTreeNodes .
24,080
public static TreePath translatePath ( TreeModel newTreeModel , TreePath oldPath , BiPredicate < Object , Object > equality ) { Object newRoot = newTreeModel . getRoot ( ) ; List < Object > newPath = new ArrayList < Object > ( ) ; newPath . add ( newRoot ) ; Object newPreviousElement = newRoot ; for ( int i = 1 ; i < oldPath . getPathCount ( ) ; i ++ ) { Object oldElement = oldPath . getPathComponent ( i ) ; Object oldUserObject = getUserObjectFromTreeNode ( oldElement ) ; Object newElement = getChildWith ( newPreviousElement , oldUserObject , equality ) ; if ( newElement == null ) { return null ; } newPath . add ( newElement ) ; newPreviousElement = newElement ; } return new TreePath ( newPath . toArray ( ) ) ; }
Translates one TreePath to a new TreeModel . This methods assumes DefaultMutableTreeNodes and identifies the path based on the equality of user objects using the given equality predicate .
24,081
private static Object getChildWith ( Object node , Object userObject , BiPredicate < Object , Object > equality ) { DefaultMutableTreeNode treeNode = ( DefaultMutableTreeNode ) node ; for ( int j = 0 ; j < treeNode . getChildCount ( ) ; j ++ ) { TreeNode child = treeNode . getChildAt ( j ) ; Object childUserObject = getUserObjectFromTreeNode ( child ) ; if ( equality . test ( userObject , childUserObject ) ) { return child ; } } return null ; }
Returns the child of the given tree node that has a user object that is equal to the given one based on the given equality predicate . Assumes DefaultMutableTreeNodes .
24,082
public static int computeIndexInParent ( Object nodeObject ) { if ( nodeObject instanceof DefaultMutableTreeNode ) { DefaultMutableTreeNode node = ( DefaultMutableTreeNode ) nodeObject ; TreeNode parent = node . getParent ( ) ; if ( parent == null ) { return - 1 ; } int childCount = parent . getChildCount ( ) ; for ( int i = 0 ; i < childCount ; i ++ ) { TreeNode child = parent . getChildAt ( i ) ; if ( child == nodeObject ) { return i ; } } } return - 1 ; }
Computes the index that the given node has in its parent node . Returns - 1 if the given node does not have a parent or the node is not a DefaultMutableTreeNode .
24,083
private void layoutChild ( Component component , int cellX , int cellY , int cellSizeX , int cellSizeY ) { int maxAspectW = ( int ) ( cellSizeY * aspect ) ; int maxAspectH = ( int ) ( cellSizeX / aspect ) ; if ( maxAspectW > cellSizeX ) { int w = cellSizeX ; int h = maxAspectH ; int space = cellSizeY - h ; int offset = ( int ) ( alignment * space ) ; component . setBounds ( cellX , cellY + offset , w , h ) ; } else { int w = maxAspectW ; int h = cellSizeY ; int space = cellSizeX - w ; int offset = ( int ) ( alignment * space ) ; component . setBounds ( cellX + offset , cellY , w , h ) ; } }
Lay out the given child component inside its parent obeying the aspect ratio and alignment constraints of this layout .
24,084
private static double computeWastedSpace ( double maxSizeX , double maxSizeY , double aspect ) { int maxAspectX = ( int ) ( maxSizeY * aspect ) ; int maxAspectY = ( int ) ( maxSizeX / aspect ) ; if ( maxAspectX > maxSizeX ) { double sizeX = maxSizeX ; double sizeY = maxAspectY ; double waste = maxSizeY - sizeY ; return waste * sizeX ; } double sizeX = maxAspectX ; double sizeY = maxSizeY ; double waste = maxSizeX - sizeX ; return waste * sizeY ; }
Compute the wasted space that is implied by the specified layout
24,085
String formatMessage ( int msgLogLevel , String tag , String msg , Throwable exception ) { if ( exception != null ) { return DateHelper . getUTC ( System . currentTimeMillis ( ) ) + "/" + getLevelTag ( msgLogLevel ) + tag + ": " + msg + "\n" + getStackTrace ( exception ) + "\n" ; } else { return DateHelper . getUTC ( System . currentTimeMillis ( ) ) + "/" + getLevelTag ( msgLogLevel ) + tag + ": " + msg + "\n" ; } }
Format log data into a log entry String .
24,086
private String getStackTrace ( final Throwable exception ) { if ( exception != null ) { StringBuilder sb = new StringBuilder ( ) ; StackTraceElement [ ] stackTrace = exception . getStackTrace ( ) ; for ( StackTraceElement element : stackTrace ) { sb . append ( element . toString ( ) ) ; sb . append ( '\n' ) ; } if ( exception . getCause ( ) != null ) { StackTraceElement [ ] stackTraceCause = exception . getCause ( ) . getStackTrace ( ) ; for ( StackTraceElement element : stackTraceCause ) { sb . append ( element . toString ( ) ) ; sb . append ( '\n' ) ; } } return sb . toString ( ) ; } return null ; }
Gets stacktrace as a String .
24,087
private void doSearch ( ) { setSearchPanelVisible ( true ) ; String selectedText = textComponent . getSelectedText ( ) ; if ( selectedText != null ) { searchPanel . setQuery ( selectedText ) ; } searchPanel . requestFocusForTextField ( ) ; }
Called to initiate the search . Will show the search panel and set the currently selected text as the query
24,088
void setSearchPanelVisible ( boolean b ) { if ( ! searchPanelVisible && b ) { add ( searchPanel , BorderLayout . NORTH ) ; revalidate ( ) ; } else if ( searchPanelVisible && ! b ) { remove ( searchPanel ) ; revalidate ( ) ; } searchPanelVisible = b ; }
Set whether the search panel is currently visible
24,089
void doFindNext ( ) { String query = searchPanel . getQuery ( ) ; if ( query . isEmpty ( ) ) { return ; } String text = getDocumentText ( ) ; boolean ignoreCase = ! searchPanel . isCaseSensitive ( ) ; int caretPosition = textComponent . getCaretPosition ( ) ; int textLength = text . length ( ) ; int newCaretPosition = ( caretPosition + 1 ) % textLength ; Point match = JTextComponents . findNext ( text , query , newCaretPosition , ignoreCase ) ; if ( match == null ) { match = JTextComponents . findNext ( text , query , 0 , ignoreCase ) ; } handleMatch ( match ) ; }
Find the next appearance of the search panel query
24,090
private String getDocumentText ( ) { try { Document document = textComponent . getDocument ( ) ; String text = document . getText ( 0 , document . getLength ( ) ) ; return text ; } catch ( BadLocationException e ) { logger . warning ( e . toString ( ) ) ; return textComponent . getText ( ) ; } }
Return the text of the document of the text component
24,091
private void addHighlights ( Collection < ? extends Point > points , Color color ) { removeHighlights ( points ) ; Map < Point , Object > newHighlights = JTextComponents . addHighlights ( textComponent , points , color ) ; highlights . putAll ( newHighlights ) ; }
Add highlights with the given color to the text component for all the given points
24,092
private void removeHighlights ( Collection < ? extends Point > points ) { Set < Object > highlightsToRemove = new LinkedHashSet < Object > ( ) ; for ( Point point : points ) { Object oldHighlight = highlights . remove ( point ) ; if ( oldHighlight != null ) { highlightsToRemove . add ( oldHighlight ) ; } } JTextComponents . removeHighlights ( textComponent , highlightsToRemove ) ; }
Remove the highlights that are associated with the given points
24,093
public final Collection < Double > getResultSet ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; return this . meterResults . get ( meter ) ; }
an array of all data items in the structure .
24,094
public final double squareSum ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic sqrSum = new SumOfSquares ( ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return sqrSum . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the square sum of the elements .
24,095
public final double getStandardDeviation ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic stdDev = new StandardDeviation ( ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return stdDev . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the standard deviation .
24,096
public final double sum ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic sum = new Sum ( ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return sum . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the sum over all data items .
24,097
public final double min ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic min = new Min ( ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return min . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the minimum .
24,098
public final double getConf05 ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic conf05 = new Percentile ( 5.0 ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return conf05 . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the confidence 05 interval - factor . This value has to be combined with the mean to get the confidence - interval .
24,099
public final double getConf95 ( final AbstractMeter meter ) { checkIfMeterExists ( meter ) ; final AbstractUnivariateStatistic conf95 = new Percentile ( 95.0 ) ; final CollectionDoubleCollection doubleColl = new CollectionDoubleCollection ( this . meterResults . get ( meter ) ) ; return conf95 . evaluate ( doubleColl . toArray ( ) , 0 , doubleColl . toArray ( ) . length ) ; }
Computes the confidence 95 interval - factor . This value has to be combined with the mean to get the confidence - interval .