idx
int64 0
34.9k
| question
stringlengths 12
26.4k
| target
stringlengths 15
2.3k
|
---|---|---|
0 | @ Override public int runCommand ( boolean mergeErrorIntoOutput , String ... commands ) throws IOException , InterruptedException { return runCommand ( mergeErrorIntoOutput , new ArrayList < String > ( Arrays . asList ( commands ) ) ) ; } | Runs a command on the command line synchronously. |
1 | private int findPLV ( int M_PriceList_ID ) { Timestamp priceDate = null ; String dateStr = Env . getContext ( Env . getCtx ( ) , p_WindowNo , "DateOrdered" ) ; if ( dateStr != null && dateStr . length ( ) > 0 ) priceDate = Env . getContextAsDate ( Env . getCtx ( ) , p_WindowNo , "DateOrdered" ) ; else { dateStr = Env . getContext ( Env . getCtx ( ) , p_WindowNo , "DateInvoiced" ) ; if ( dateStr != null && dateStr . length ( ) > 0 ) priceDate = Env . getContextAsDate ( Env . getCtx ( ) , p_WindowNo , "DateInvoiced" ) ; } if ( priceDate == null ) priceDate = new Timestamp ( System . currentTimeMillis ( ) ) ; log . config ( "M_PriceList_ID=" + M_PriceList_ID + " - " + priceDate ) ; int retValue = 0 ; String sql = "SELECT plv.M_PriceList_Version_ID, plv.ValidFrom " + "FROM M_PriceList pl, M_PriceList_Version plv " + "WHERE pl.M_PriceList_ID=plv.M_PriceList_ID" + " AND plv.IsActive='Y'" + " AND pl.M_PriceList_ID=? " + "ORDER BY plv.ValidFrom DESC" ; try { PreparedStatement pstmt = DB . prepareStatement ( sql , null ) ; pstmt . setInt ( 1 , M_PriceList_ID ) ; ResultSet rs = pstmt . executeQuery ( ) ; while ( rs . next ( ) && retValue == 0 ) { Timestamp plDate = rs . getTimestamp ( 2 ) ; if ( ! priceDate . before ( plDate ) ) retValue = rs . getInt ( 1 ) ; } rs . close ( ) ; pstmt . close ( ) ; } catch ( SQLException e ) { log . log ( Level . SEVERE , sql , e ) ; } Env . setContext ( Env . getCtx ( ) , p_WindowNo , "M_PriceList_Version_ID" , retValue ) ; return retValue ; } | Find Price List Version and update context |
2 | public static boolean memoryIsLow ( ) { return availableMemory ( ) * 100 < RUNTIME . totalMemory ( ) * 5 ; } | Returns true if less then 5% of the available memory is free. |
3 | public String describeAttributes ( ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( "[" ) ; boolean first = true ; for ( Object key : attributes . keySet ( ) ) { if ( first ) { first = false ; } else { sb . append ( ", " ) ; } sb . append ( key ) ; sb . append ( "==" ) ; sb . append ( attributes . get ( key ) ) ; } sb . append ( "]" ) ; return sb . toString ( ) ; } | Returns a string representation of the object's current attributes |
4 | public static byte [ ] nextBytes ( byte [ ] buffer ) { sRandom . nextBytes ( buffer ) ; return buffer ; } | Fill the given buffer with random bytes. |
5 | public void removeAllFromDamaged ( final Collection < Unit > damagedUnits ) { for ( final Unit u : damagedUnits ) { while ( m_damaged . contains ( u ) ) { m_damaged . remove ( u ) ; } } } | Can have multiple of the same unit, to show multiple hits to that unit. |
6 | private IJavaElement [ ] computeChildren ( ArrayList namesWithoutExtension ) { int size = namesWithoutExtension . size ( ) ; if ( size == 0 ) return NO_ELEMENTS ; IJavaElement [ ] children = new IJavaElement [ size ] ; for ( int i = 0 ; i < size ; i ++ ) { String nameWithoutExtension = ( String ) namesWithoutExtension . get ( i ) ; children [ i ] = new ClassFile ( this , manager , nameWithoutExtension ) ; } return children ; } | Compute the children of this package fragment. Children of jar package fragments can only be IClassFile (representing .class files). |
7 | public Object [ ] toArray ( ) { Object [ ] result = new Object [ size ] ; System . arraycopy ( elementData , 0 , result , 0 , size ) ; return result ; } | Returns an array containing all of the elements in this list in the correct order. |
8 | private static int lastIndexOf ( Object o , Object [ ] elements , int index ) { if ( o == null ) { for ( int i = index ; i >= 0 ; i -- ) if ( elements [ i ] == null ) return i ; } else { for ( int i = index ; i >= 0 ; i -- ) if ( o . equals ( elements [ i ] ) ) return i ; } return - 1 ; } | static version of lastIndexOf. |
9 | public static byte [ ] generateMac ( byte [ ] byteCipherText , SecretKey integrityKey ) throws NoSuchAlgorithmException , InvalidKeyException { Mac sha256_HMAC = Mac . getInstance ( HMAC_ALGORITHM ) ; sha256_HMAC . init ( integrityKey ) ; return sha256_HMAC . doFinal ( byteCipherText ) ; } | Generate the mac based on HMAC_ALGORITHM |
10 | @ Override protected void onDeleteComplete ( int token , Object cookie , int result ) { if ( token == mDeleteToken ) { synchronized ( sDeletingThreadsLock ) { sDeletingThreads = false ; if ( DELETEDEBUG ) { Log . v ( TAG , "Conversation onDeleteComplete sDeletingThreads: " + sDeletingThreads ) ; } sDeletingThreadsLock . notifyAll ( ) ; } UnreadBadgeService . update ( mContext ) ; NotificationManager . create ( mContext ) ; } } | Always call this super method from your overridden onDeleteComplete function. |
11 | public static double log10 ( double val ) { if ( val > 0.0 ) return Math . log10 ( val ) ; return HUGE_NEGATIVE ; } | Adjusted log10 to handle values less or equal to zero. <p> The logarithm does not result in real numbers for arguments less or equal to zero, but the plot should still somehow handle such values without crashing. So anything ≤ 0 is mapped to a 'really big negative' number just for the sake of plotting. <p> Note that LogarithmicAxis.java in the JFreeChart has another interesting idea for modifying the log10 of values ≤ 10, resulting in a smooth plot for the full real argument range. Unfortunately that clobbers values like 1e-7, which might be a very real vacuum reading. |
12 | private static ILaunchConfiguration createNewLaunchConfiguration ( IProject project ) throws CoreException , OperationCanceledException { String initialName = calculateLaunchConfigName ( project ) ; ILaunchConfiguration launchConfig = GwtSuperDevModeCodeServerLaunchUtil . createLaunchConfig ( initialName , project ) ; return launchConfig ; } | Create a new launch configuration. |
13 | protected long parseDate ( ) throws IOException { if ( _utcCalendar == null ) _utcCalendar = Calendar . getInstance ( TimeZone . getTimeZone ( "UTC" ) ) ; return parseDate ( _utcCalendar ) ; } | Parses a date value from the stream. |
14 | @ Override public Request < List < BuilderStatus > > builds ( ProjectReference projectReference ) { List < DummyBuilderStatus > current = currentBuilderStatuses . get ( projectReference . name ( ) ) ; List < BuilderStatus > update = new ArrayList < > ( ) ; if ( current != null ) { for ( DummyBuilderStatus dummyBuilderStatus : current ) { update . add ( dummyBuilderStatus ) ; } } return new DummyRequest < > ( update ) ; } | Gets the project builds for the given project |
15 | public String lookahead ( ) { if ( buf != null ) { return new String ( buf , bufPos , buf . length - bufPos ) ; } else { return text . substring ( pos . getIndex ( ) ) ; } } | Returns a string containing the remainder of the characters to be returned by this iterator, without any option processing. If the iterator is currently within a variable expansion, this will only extend to the end of the variable expansion. This method is provided so that iterators may interoperate with string-based APIs. The typical sequence of calls is to call skipIgnored(), then call lookahead(), then parse the string returned by lookahead(), then call jumpahead() to resynchronize the iterator. |
16 | protected int entityIndex ( Entity entity ) { return Arrays . binarySearch ( entities , entity ) ; } | Check whether the device contains the specified entity |
17 | public void runTest ( ) throws Throwable { Document doc ; NodeList elementList ; Node nameNode ; CharacterData child ; doc = ( Document ) load ( "staff" , true ) ; elementList = doc . getElementsByTagName ( "address" ) ; nameNode = elementList . item ( 0 ) ; child = ( CharacterData ) nameNode . getFirstChild ( ) ; { boolean success = false ; try { child . insertData ( - 5 , "ABC" ) ; } catch ( DOMException ex ) { success = ( ex . code == DOMException . INDEX_SIZE_ERR ) ; } assertTrue ( "throws_INDEX_SIZE_ERR" , success ) ; } } | Runs the test case. |
18 | public void testObsoleteDstZoneName ( ) throws Exception { SimpleDateFormat format = new SimpleDateFormat ( "yyyy-MM-dd'T'HH:mm zzzz" , Locale . US ) ; Date normal = format . parse ( "1970-01-01T00:00 EET" ) ; Date dst = format . parse ( "1970-01-01T00:00 EEST" ) ; assertEquals ( 60 * 60 * 1000 , normal . getTime ( ) - dst . getTime ( ) ) ; } | Africa/Cairo standard time is EET and daylight time is EEST. They no longer use their DST zone but we should continue to parse it properly. |
19 | public abstract boolean isLoggable ( Level level ) ; | "logger like" API to be used by RMI implementation |
20 | public String replaceTokens ( String queryString , String replacement , String ... nonReplacementTokenPrefixes ) { Matcher matcher = tokenPattern . matcher ( queryString ) ; StringBuffer buf = new StringBuffer ( ) ; while ( matcher . find ( ) ) { String origToken = matcher . group ( 1 ) ; if ( origToken != null ) { matcher . appendReplacement ( buf , "" ) ; if ( tokenStartsWithPrefix ( origToken , nonReplacementTokenPrefixes ) ) { buf . append ( "${" + origToken + "}" ) ; } else { buf . append ( replacement ) ; } } } matcher . appendTail ( buf ) ; return buf . toString ( ) ; } | Replaces a query string with tokens of format ${token-name} with the specified replacement string for all tokens. |
21 | public boolean isPlural ( ) { return typeString . contains ( SUFFIX_PLURAL ) ; } | Determine if the Expression is in plural form. |
22 | public void insert ( ForceItem item ) { try { insert ( item , root , xMin , yMin , xMax , yMax ) ; } catch ( StackOverflowError e ) { e . printStackTrace ( ) ; } } | Inserts an item into the quadtree. |
23 | private void handleHovering ( int x , int y ) { handleCellHover ( x , y ) ; if ( columnHeadersVisible ) { handleHoverOnColumnHeader ( x , y ) ; } } | Handles the assignment of the correct values to the hover* field variables that let the painting code now what to paint as hovered. |
24 | public static void drawCircledText ( Graphics2D g , Font font , String text , int x , int y ) { Graphics2D g2 = ( Graphics2D ) g . create ( ) ; g2 . setFont ( font ) ; FontMetrics fm = g2 . getFontMetrics ( ) ; int padding = 4 ; Rectangle2D bounds = fm . getStringBounds ( text , g2 ) ; double th = bounds . getHeight ( ) ; double tw = bounds . getWidth ( ) ; float radius = ( float ) ( Math . max ( th , tw ) / 2f + padding ) ; Ellipse2D . Float circle = new Ellipse2D . Float ( x - radius , y - radius , 2 * radius + 1 , 2 * radius + 1 ) ; g2 . fill ( circle ) ; g2 . setColor ( Color . BLACK ) ; g2 . drawString ( text , ( int ) ( x - tw / 2 ) , ( y + fm . getAscent ( ) / 2 ) ) ; if ( DEBUG ) { g2 . setColor ( Color . RED ) ; g2 . drawLine ( x - 50 , y , x + 50 , y ) ; g2 . drawLine ( x , y - 50 , x , y + 50 ) ; } g2 . dispose ( ) ; } | Utility function to draw a circle text centered at coordinates (x, y) |
25 | private void registerEnd ( final String prefixSingular , final String prefixPlural , final String endString ) { prefixEndList . add ( new PrefixEntry ( endString , prefixSingular , prefixPlural ) ) ; registerPrefix ( prefixSingular , prefixPlural ) ; } | Define the singular and plural prefix strings for an item name to be matched at the end, for example "bottle of ... potion". |
26 | public void addObserver ( Observer observer ) { observers . add ( observer ) ; } | Sets the observer, which will observe the iterator returned in the next call to iterator() method. Future calls to iterator() won't be observed, unless an observer is set again. |
27 | public String toString ( ) { return "[PKCS #10 certificate request:\n" + subjectPublicKeyInfo . toString ( ) + " subject: <" + subject + ">" + "\n" + " attributes: " + attributeSet . toString ( ) + "\n]" ; } | Provides a short description of this request. |
28 | public SystemPropertiesTableModel ( ) { columnNames = new String [ 2 ] ; columnNames [ 0 ] = res . getString ( "SystemPropertiesTableModel.NameColumn" ) ; columnNames [ 1 ] = res . getString ( "SystemPropertiesTableModel.ValueColumn" ) ; data = new Object [ 0 ] [ 0 ] ; } | Construct a new SystemPropertiesTableModel. |
29 | public boolean cancelJob ( long id , boolean isPersistent ) { JobHolder holder ; synchronized ( getNextJobLock ) { if ( jobConsumerExecutor . isRunning ( id , isPersistent ) ) return false ; if ( isPersistent ) { synchronized ( persistentJobQueue ) { holder = persistentJobQueue . findJobById ( id ) ; if ( holder == null ) return false ; persistentJobQueue . remove ( holder ) ; } } else { synchronized ( nonPersistentJobQueue ) { holder = nonPersistentJobQueue . findJobById ( id ) ; if ( holder == null ) return false ; nonPersistentJobQueue . remove ( holder ) ; } } } BaseJob baseJob = holder . getBaseJob ( ) ; if ( dependencyInjector != null ) { dependencyInjector . inject ( baseJob ) ; } baseJob . onCancel ( ) ; return true ; } | Cancels job which is waiting to be run. |
30 | public static boolean isSimpleMatchPattern ( String str ) { return str . indexOf ( '*' ) != - 1 ; } | Is the str a simple match pattern. |
31 | public String readScript ( String fname ) throws IOException { StringBuilder sb = new StringBuilder ( ) ; BufferedReader in = null ; try { if ( fname . startsWith ( "hdfs:" ) || fname . startsWith ( "gpfs:" ) ) { FileSystem fs = FileSystem . get ( ConfigurationManager . getCachedJobConf ( ) ) ; Path scriptPath = new Path ( fname ) ; in = new BufferedReader ( new InputStreamReader ( fs . open ( scriptPath ) ) ) ; } else { in = new BufferedReader ( new FileReader ( fname ) ) ; } String tmp = null ; while ( ( tmp = in . readLine ( ) ) != null ) { sb . append ( tmp ) ; sb . append ( "\n" ) ; } } finally { IOUtilFunctions . closeSilently ( in ) ; } return sb . toString ( ) ; } | Read a DML or PyDML file as a string. |
32 | public static BinaryFieldAccessor create ( Field field , int id ) { BinaryWriteMode mode = BinaryUtils . mode ( field . getType ( ) ) ; switch ( mode ) { case P_BYTE : return new BytePrimitiveAccessor ( field , id ) ; case P_BOOLEAN : return new BooleanPrimitiveAccessor ( field , id ) ; case P_SHORT : return new ShortPrimitiveAccessor ( field , id ) ; case P_CHAR : return new CharPrimitiveAccessor ( field , id ) ; case P_INT : return new IntPrimitiveAccessor ( field , id ) ; case P_LONG : return new LongPrimitiveAccessor ( field , id ) ; case P_FLOAT : return new FloatPrimitiveAccessor ( field , id ) ; case P_DOUBLE : return new DoublePrimitiveAccessor ( field , id ) ; case BYTE : case BOOLEAN : case SHORT : case CHAR : case INT : case LONG : case FLOAT : case DOUBLE : case DECIMAL : case STRING : case UUID : case DATE : case TIMESTAMP : case BYTE_ARR : case SHORT_ARR : case INT_ARR : case LONG_ARR : case FLOAT_ARR : case DOUBLE_ARR : case CHAR_ARR : case BOOLEAN_ARR : case DECIMAL_ARR : case STRING_ARR : case UUID_ARR : case DATE_ARR : case TIMESTAMP_ARR : case ENUM_ARR : case OBJECT_ARR : case BINARY_OBJ : case BINARY : return new DefaultFinalClassAccessor ( field , id , mode , false ) ; default : return new DefaultFinalClassAccessor ( field , id , mode , ! U . isFinal ( field . getType ( ) ) ) ; } } | Create accessor for the field. |
33 | private String result ( HttpURLConnection conn , boolean input ) throws IOException { StringBuffer sb = new StringBuffer ( ) ; if ( input ) { InputStream is = conn . getInputStream ( ) ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( is , "utf-8" ) ) ; String line = null ; while ( ( line = reader . readLine ( ) ) != null ) { sb . append ( line ) ; } reader . close ( ) ; is . close ( ) ; } Map < String , Object > result = new HashMap < String , Object > ( ) ; result . put ( "code" , conn . getResponseCode ( ) ) ; result . put ( "mesg" , conn . getResponseMessage ( ) ) ; result . put ( "type" , conn . getContentType ( ) ) ; result . put ( "data" , sb ) ; String output = String . valueOf ( conn . getResponseCode ( ) ) ; setOutputResponseCode ( output ) ; Gson gson = new Gson ( ) ; String json = gson . toJson ( result ) ; logger . info ( "json = " + json ) ; return json ; } | Report the result in JSON way |
34 | public boolean isBannedMethod ( String sig ) { return banned_methods . contains ( sig ) ; } | Used by the specification create to check if a method is legal to put in the spec. Must check the method, and all superclass definitions of the method. |
35 | private SendReturn send ( int messageType , String message ) throws InterruptedException , ExtractorException { String length = String . format ( "%d" , message . length ( ) ) ; String lenlen = String . format ( "%d" , length . length ( ) ) ; String type = String . format ( "%04d" , messageType ) ; String outMessage ; int bytesRead ; String replyString ; int ll ; int t ; SendReturn retval = new SendReturn ( ) ; boolean lengthKnown ; int totalBytesRead = 0 ; int totalBytesNeeded ; boolean longMessageSupport = true ; if ( ! connected ) throw new OracleExtractException ( "Not connected" ) ; outMessage = lenlen + length + type + message ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Sending Message type " + messageType ) ; logger . debug ( " - Message is -> " + message ) ; logger . debug ( " - Therefore sending -> " + outMessage ) ; } out . println ( outMessage ) ; if ( messageType != Const . MessageControl ) { try { if ( longMessageSupport ) { lengthKnown = false ; totalBytesRead = 0 ; totalBytesNeeded = 0 ; for ( ; ; ) { bytesRead = in . read ( replyBuffer , totalBytesRead , replyBufferSize - totalBytesRead - 1 ) ; if ( bytesRead == - 1 ) { throw new OracleExtractException ( "End of Stream" ) ; } totalBytesRead += bytesRead ; logger . debug ( "Read = " + bytesRead + " total = " + totalBytesRead + " needed = " + totalBytesNeeded ) ; if ( lengthKnown ) { if ( totalBytesRead >= totalBytesNeeded ) break ; else continue ; } if ( totalBytesRead <= 9 ) continue ; lengthKnown = true ; replyBuffer [ totalBytesRead ] = '\0' ; lengthBuffer [ 0 ] = replyBuffer [ 0 ] ; lengthBuffer [ 1 ] = replyBuffer [ 1 ] ; lengthBuffer [ 2 ] = replyBuffer [ 2 ] ; lengthBuffer [ 3 ] = replyBuffer [ 3 ] ; lengthBuffer [ 4 ] = replyBuffer [ 4 ] ; lengthBuffer [ 5 ] = replyBuffer [ 5 ] ; lengthBuffer [ 6 ] = replyBuffer [ 6 ] ; lengthBuffer [ 7 ] = replyBuffer [ 7 ] ; lengthBuffer [ 8 ] = replyBuffer [ 8 ] ; lengthBuffer [ 9 ] = replyBuffer [ 9 ] ; lengthBuffer [ 10 ] = '\0' ; String lengthString = new String ( lengthBuffer ) ; totalBytesNeeded = Integer . parseInt ( lengthString . substring ( 1 , 9 ) , 16 ) ; totalBytesNeeded += 13 ; if ( totalBytesNeeded + 1 > replyBufferSize ) increaseReplyBuffer ( totalBytesNeeded + 1 ) ; if ( totalBytesRead >= totalBytesNeeded ) break ; } } else { totalBytesRead = in . read ( replyBuffer ) ; } } catch ( ClosedByInterruptException e ) { throw new InterruptedException ( "Oracle extractor was interrupted" ) ; } catch ( IOException e ) { throw new OracleExtractException ( "End of Stream" ) ; } if ( totalBytesRead == - 1 ) { throw new OracleExtractException ( "End of Stream" ) ; } replyBuffer [ totalBytesRead ] = '\0' ; replyString = new String ( replyBuffer , 0 , totalBytesRead ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Reply = \"" + replyString + "\"\n" ) ; } ll = Integer . parseInt ( replyString . substring ( 0 , 1 ) ) ; t = Integer . parseInt ( replyString . substring ( 1 + ll , 1 + ll + 4 ) ) ; replyString = replyString . substring ( 1 + ll + 4 ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Reply = \"" + replyString + "\"\n" ) ; } retval . type = t ; retval . reply = replyString ; } else { retval . type = Const . ReplyReserved ; retval . reply = new String ( "Empty" ) ; } if ( retval . type == Const . ReplyError ) throw new OracleExtractException ( "Error from C Oracle Extractor" ) ; msgCount ++ ; return retval ; } | Send message to dslisten - typically an extract next change message |
36 | private float interpolate ( ) { long currTime = System . currentTimeMillis ( ) ; float elapsed = ( currTime - startTime ) / ZOOM_TIME ; elapsed = Math . min ( 1f , elapsed ) ; return interpolator . getInterpolation ( elapsed ) ; } | Use interpolator to get t |
37 | private void attachPlot ( SVGPlot newplot ) { this . plot = newplot ; if ( newplot == null ) { super . setSVGDocument ( null ) ; return ; } newplot . synchronizeWith ( synchronizer ) ; super . setSVGDocument ( newplot . getDocument ( ) ) ; super . setDisableInteractions ( newplot . getDisableInteractions ( ) ) ; } | Attach to a new plot, and display. |
38 | void seek ( int position ) throws IOException { mDexFile . seek ( position ) ; } | Seeks the DEX file to the specified absolute position. |
39 | public E take ( ) throws InterruptedException { final ReentrantLock lock = this . lock ; lock . lockInterruptibly ( ) ; try { for ( ; ; ) { E first = q . peek ( ) ; if ( first == null ) available . await ( ) ; else { long delay = first . getDelay ( NANOSECONDS ) ; if ( delay <= 0 ) return q . poll ( ) ; first = null ; if ( leader != null ) available . await ( ) ; else { Thread thisThread = Thread . currentThread ( ) ; leader = thisThread ; try { available . awaitNanos ( delay ) ; } finally { if ( leader == thisThread ) leader = null ; } } } } } finally { if ( leader == null && q . peek ( ) != null ) available . signal ( ) ; lock . unlock ( ) ; } } | Retrieves and removes the head of this queue, waiting if necessary until an element with an expired delay is available on this queue. |
40 | public void shutdown ( ) throws Exception { try { if ( solrClient != null ) solrClient . close ( ) ; List < Callable < JettySolrRunner > > shutdowns = new ArrayList < > ( jettys . size ( ) ) ; for ( final JettySolrRunner jetty : jettys ) { shutdowns . add ( null ) ; } jettys . clear ( ) ; Collection < Future < JettySolrRunner > > futures = executor . invokeAll ( shutdowns ) ; Exception shutdownError = checkForExceptions ( "Error shutting down MiniSolrCloudCluster" , futures ) ; if ( shutdownError != null ) { throw shutdownError ; } } finally { executor . shutdown ( ) ; executor . awaitTermination ( 2 , TimeUnit . SECONDS ) ; try { if ( ! externalZkServer ) { zkServer . shutdown ( ) ; } } finally { System . clearProperty ( "zkHost" ) ; } } } | Shut down the cluster, including all Solr nodes and ZooKeeper |
41 | private static Control createRequestControl ( final Class clazz , final Class [ ] paramTypes , final Object [ ] params ) { Constructor constructor = ClassUtils . getConstructorIfAvailable ( clazz , paramTypes ) ; if ( constructor == null ) { LdapExceptionUtils . generateErrorException ( LdapErrorCodes . ERR_10005_CONTROL_CONTRUCTOR_NOT_FOUND , new String [ ] { clazz . toString ( ) , StringUtils . arrayToCommaDelimitedString ( paramTypes ) } , LOGGER ) ; } Control result = null ; try { result = ( Control ) constructor . newInstance ( params ) ; } catch ( Exception e ) { LdapExceptionUtils . generateErrorException ( LdapErrorCodes . ERR_10006_CONTROL_INSTANCE_FAILED , new String [ ] { clazz . toString ( ) , StringUtils . arrayToCommaDelimitedString ( paramTypes ) , StringUtils . arrayToCommaDelimitedString ( params ) } , LOGGER , e ) ; } return result ; } | Permite crear una instancia de la clase pasada como parametro. |
42 | private static boolean isInCornerTargetZone ( float x , float y , float handleX , float handleY , float targetRadius ) { return Math . abs ( x - handleX ) <= targetRadius && Math . abs ( y - handleY ) <= targetRadius ; } | Determines if the specified coordinate is in the target touch zone for a corner handle. |
43 | public boolean isNewState ( ) { return fileName . equals ( "" ) ; } | Tells whether this session is in a new state or not. A session is in a new state if it was never saved or it was not loaded from an existing session. |
44 | public boolean offer ( E e ) { final ReentrantLock lock = this . lock ; lock . lock ( ) ; try { q . offer ( e ) ; if ( q . peek ( ) == e ) { leader = null ; available . signal ( ) ; } return true ; } finally { lock . unlock ( ) ; } } | Inserts the specified element into this delay queue. |
45 | public void updateLeagueHistory ( ) { Collections . sort ( teamList , new TeamCompPoll ( ) ) ; String [ ] yearTop10 = new String [ 10 ] ; Team tt ; for ( int i = 0 ; i < 10 ; ++ i ) { tt = teamList . get ( i ) ; yearTop10 [ i ] = tt . abbr + " (" + tt . wins + "-" + tt . losses + ")" ; } leagueHistory . add ( yearTop10 ) ; } | At the end of the year, record the top 10 teams for the League's History. |
46 | public SuffixFileFilter ( String [ ] suffixes , IOCase caseSensitivity ) { if ( suffixes == null ) { throw new IllegalArgumentException ( "The array of suffixes must not be null" ) ; } this . suffixes = new String [ suffixes . length ] ; System . arraycopy ( suffixes , 0 , this . suffixes , 0 , suffixes . length ) ; this . caseSensitivity = caseSensitivity == null ? IOCase . SENSITIVE : caseSensitivity ; } | Constructs a new Suffix file filter for an array of suffixs specifying case-sensitivity. <p> The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however. |
47 | private void updateFont ( ) { String fontName = fontList . getValue ( ) ; Integer fontSize = FALLBACK_FONT_SIZE ; try { fontSize = Integer . parseInt ( fontSizeList . getValue ( ) ) ; } catch ( NumberFormatException ex ) { } font = new Font ( fontName , Font . PLAIN , fontSize ) ; preview . setFont ( font ) ; } | Creates a new Font based on the current settings and also updates the preview. The created Font is not only used for the preview, but also to return it when requested from the caller. |
48 | public static Properties readPropertyFileFromFileSystem ( final File propertyFileLocation ) throws ConfigurationException { final Properties fileProperties = new Properties ( ) ; try { final InputStream inputStream = new FileInputStream ( propertyFileLocation ) ; fileProperties . load ( inputStream ) ; inputStream . close ( ) ; } catch ( IOException e ) { throw new ConfigurationException ( "Cannot load the properties file" , e ) ; } return fileProperties ; } | Reads a property file into a Properties object. |
49 | public void addTranslator ( ClassPool cp , Translator t ) throws NotFoundException , CannotCompileException { source = cp ; translator = t ; t . start ( cp ) ; } | Adds a translator, which is called whenever a class is loaded. |
50 | public void test_GetCurve ( ) { assertEquals ( "wrong elliptic curve" , curve , ecps . getCurve ( ) ) ; } | test for getCurve() method |
51 | @ Override public void close ( ) throws IOException { fInputStream . close ( ) ; } | Close the stream. Once a stream has been closed, further read(), ready(), mark(), or reset() invocations will throw an IOException. Closing a previously-closed stream, however, has no effect. |
52 | public static void sleep ( ) { try { Thread . sleep ( TestSettings . RESPONSE_WAIT ) ; } catch ( InterruptedException e ) { } } | Current thread sleeps for a predefined amount of time. If it has been interrupted, the method would be finished and no exception is thrown. |
53 | public void add ( URI uri , HttpCookie cookie ) { if ( cookie == null ) { throw new NullPointerException ( "cookie is null" ) ; } lock . lock ( ) ; try { cookieJar . remove ( cookie ) ; if ( cookie . getMaxAge ( ) != 0 ) { cookieJar . add ( cookie ) ; if ( cookie . getDomain ( ) != null ) { addIndex ( domainIndex , cookie . getDomain ( ) , cookie ) ; } if ( uri != null ) { addIndex ( uriIndex , getEffectiveURI ( uri ) , cookie ) ; } } } finally { lock . unlock ( ) ; } } | Add one cookie into cookie store. |
54 | public void delete ( RandomAccessFile raf , RandomAccessFile tempRaf ) throws IOException , CannotWriteException { FlacTag emptyTag = new FlacTag ( null , new ArrayList < MetadataBlockDataPicture > ( ) ) ; raf . seek ( 0 ) ; tempRaf . seek ( 0 ) ; write ( emptyTag , raf , tempRaf ) ; } | Delete Tag from file |
55 | void show ( Rectangle bounds ) { if ( ! isCreated ( ) ) { return ; } if ( log . isLoggable ( PlatformLogger . Level . FINER ) ) { log . finer ( "showing menu window + " + getWindow ( ) + " at " + bounds ) ; } XToolkit . awtLock ( ) ; try { reshape ( bounds . x , bounds . y , bounds . width , bounds . height ) ; xSetVisible ( true ) ; toFront ( ) ; selectItem ( getFirstSelectableItem ( ) , false ) ; } finally { XToolkit . awtUnlock ( ) ; } } | Init window if it's not inited yet and show it at specified coordinates |
56 | void downcase ( final StringBuffer text , final int leng ) { for ( int i = 0 ; i < leng ; i ++ ) { if ( Character . isUpperCase ( text . charAt ( i ) ) ) { text . setCharAt ( i , Character . toLowerCase ( text . charAt ( i ) ) ) ; } } } | lowercase the characters up to the given length |
57 | public int indexOfKey ( Object key ) { return key == null ? indexOfNull ( ) : indexOf ( key , key . hashCode ( ) ) ; } | Returns the index of a key in the set. |
58 | public void releaseExternalResources ( ) { if ( ! isClosed . get ( ) ) { logger . info ( "Releasing all ParallelClient resources... " ) ; ActorConfig . shutDownActorSystemForce ( ) ; httpClientStore . shutdown ( ) ; tcpSshPingResourceStore . shutdown ( ) ; taskManager . cleanWaitTaskQueue ( ) ; taskManager . cleanInprogressJobMap ( ) ; isClosed . set ( true ) ; logger . info ( "Have released all ParallelClient resources " + "(actor system + async+sync http client + task queue)" + "\nNow safe to stop your application." ) ; } else { logger . debug ( "NO OP. ParallelClient resources have already been released." ) ; } } | Releases the external resources that this object depends on. You should not call this method if you still want to use the external resources (e.g. akka system, async http client store, thread pool for SSH/TCP) are in use by other objects. |
59 | @ Override public Enumeration < Option > listOptions ( ) { Vector < Option > newVector = new Vector < Option > ( 4 ) ; newVector . addElement ( new Option ( "\tSpecify the random number seed (default 1)" , "S" , 1 , "-S <num>" ) ) ; newVector . addElement ( new Option ( "\tThe maximum class distribution spread.\n" + "\t0 = no maximum spread, 1 = uniform distribution, 10 = allow at most\n" + "\ta 10:1 ratio between the classes (default 0)" , "M" , 1 , "-M <num>" ) ) ; newVector . addElement ( new Option ( "\tAdjust weights so that total weight per class is maintained.\n" + "\tIndividual instance weighting is not preserved. (default no\n" + "\tweights adjustment" , "W" , 0 , "-W" ) ) ; newVector . addElement ( new Option ( "\tThe maximum count for any class value (default 0 = unlimited).\n" , "X" , 0 , "-X <num>" ) ) ; return newVector . elements ( ) ; } | Returns an enumeration describing the available options. |
60 | public BatchedImageRequest ( Request < ? > request , ImageContainer container ) { mRequest = request ; mContainers . add ( container ) ; } | Constructs a new BatchedImageRequest object |
61 | @ Override public IScanListIterator < IEntryCacheInfo > establishScan ( K startPos , short relation , K endPos , boolean endPosInclusive , boolean ordered ) { ordered |= FORCE_ORDERED_SCAN ; long startTime = _recentExtendedIndexUpdates != null ? System . currentTimeMillis ( ) : 0 ; IScanListIterator < IEntryCacheInfo > res = ordered ? establishScanOrdered ( startPos , relation , endPos , endPosInclusive ) : establishScanUnOrdered ( startPos , relation , endPos , endPosInclusive ) ; if ( _recentExtendedIndexUpdates != null && ! _recentExtendedIndexUpdates . isEmpty ( ) ) { MultiStoredList < IEntryCacheInfo > msl = new MultiStoredList < IEntryCacheInfo > ( ) ; msl . add ( res ) ; msl . add ( _recentExtendedIndexUpdates . iterator ( startTime , ( ExtendedIndexIterator ) res ) ) ; return msl ; } else return res ; } | establish a scan according to the relation given and startPos : the start-scan object , null means scan all values. The relation is from com.j_spaces.client.TemplateMatchCodes: LT, LE, GT, GE (other codes are not relevant) endPos- key up to (or null if no limit in index) endPosInclusive : is the endPos up to (or down to) and including ? ordered - according to the condition. GT, GE ==> ascending, LT, LE =====> descending. returns an IOrderedIndexScan object which enables scanning the ordered index, Null if no relevant elements to scan |
62 | public static BytesToNameCanonicalizer createRoot ( ) { long now = System . currentTimeMillis ( ) ; int seed = ( ( ( int ) now ) + ( ( int ) now > > > 32 ) ) | 1 ; return createRoot ( seed ) ; } | Factory method to call to create a symbol table instance with a randomized seed value. |
63 | public void fillFieldValues ( List < SynapseUpdateRule > ruleList ) { HebbianRule synapseRef = ( HebbianRule ) ruleList . get ( 0 ) ; if ( ! NetworkUtils . isConsistent ( ruleList , HebbianRule . class , "getLearningRate" ) ) { tfLearningRate . setText ( SimbrainConstants . NULL_STRING ) ; } else { tfLearningRate . setText ( Double . toString ( synapseRef . getLearningRate ( ) ) ) ; } } | Populate fields with current data. |
64 | public static int countArgumentPlaceholders ( final String messagePattern ) { if ( messagePattern == null ) { return 0 ; } final int delim = messagePattern . indexOf ( DELIM_START ) ; if ( delim == - 1 ) { return 0 ; } int result = 0 ; boolean isEscaped = false ; for ( int i = 0 ; i < messagePattern . length ( ) ; i ++ ) { final char curChar = messagePattern . charAt ( i ) ; if ( curChar == ESCAPE_CHAR ) { isEscaped = ! isEscaped ; } else if ( curChar == DELIM_START ) { if ( ! isEscaped && i < messagePattern . length ( ) - 1 && messagePattern . charAt ( i + 1 ) == DELIM_STOP ) { result ++ ; i ++ ; } isEscaped = false ; } else { isEscaped = false ; } } return result ; } | Counts the number of unescaped placeholders in the given messagePattern. |
65 | protected abstract boolean isEndOfChunk ( char currPrefix , String currLabel , char nextPrefix , String nextLabel ) ; | Determines whether the current outcome represents the end of a chunk. Both the current outcome and the following outcome are provided for making this decision. |
66 | public void clear ( ) { set . clear ( ) ; fireContentsChanged ( this , 0 , 0 ) ; } | Clears this list model. |
67 | static String toString ( @ NotNull final Bytes buffer , long position , long len ) throws BufferUnderflowException { final long pos = buffer . readPosition ( ) ; final long limit = buffer . readLimit ( ) ; buffer . readPositionRemaining ( position , len ) ; try { final StringBuilder builder = new StringBuilder ( ) ; while ( buffer . readRemaining ( ) > 0 ) { builder . append ( ( char ) buffer . readByte ( ) ) ; } return builder . toString ( ) ; } finally { buffer . readLimit ( limit ) ; buffer . readPosition ( pos ) ; } } | The buffer is not modified by this call |
68 | void collectUnresponsiveMembers ( Set s ) { if ( stillWaiting ( ) ) { InternalDistributedMember [ ] memberList = getMembers ( ) ; synchronized ( memberList ) { for ( int i = 0 ; i < memberList . length ; i ++ ) { InternalDistributedMember m = memberList [ i ] ; if ( m != null ) { s . add ( m ) ; } } } } } | Adds any unresponsive members to s |
69 | private void initFromAuthHeader ( String authHeader ) { this . authHeader = authHeader ; if ( authHeader == null ) throw new NullPointerException ( "No authentication header information" ) ; Matcher authMatcher = SCHEME_PATTERN . matcher ( authHeader ) ; if ( ! authMatcher . matches ( ) ) { throw new IllegalStateException ( "Unable to parse auth header: " + authHeader ) ; } scheme = authMatcher . group ( 1 ) ; if ( authMatcher . groupCount ( ) > 1 ) { Matcher paramMatcher = PARAM_PATTERN . matcher ( authMatcher . group ( 2 ) ) ; while ( paramMatcher . find ( ) ) { String value = paramMatcher . group ( 2 ) ; if ( value == null ) { value = paramMatcher . group ( 3 ) ; } parameters . put ( paramMatcher . group ( 1 ) , value ) ; } } } | Initializes internal state from the contents of a WWW-Authenticate header. |
70 | public String toString ( ) { String s = "KeyIdentifier [\n" ; HexDumpEncoder encoder = new HexDumpEncoder ( ) ; s += encoder . encodeBuffer ( octetString ) ; s += "]\n" ; return ( s ) ; } | Returns a printable representation of the KeyUsage. |
71 | public static void addStartupListener ( StartUpListener s ) { s_startupListeners . add ( s ) ; } | Add a listener to be notified when startup is complete |
72 | public void testWrite2 ( ) throws Exception { byte [ ] data = new byte [ ] { - 127 , - 100 , - 50 , - 10 , - 1 , 0 , 1 , 10 , 50 , 127 } ; TestOutputStream tos = new TestOutputStream ( ) ; CipherOutputStream cos = new CipherOutputStream ( tos , new NullCipher ( ) ) ; cos . write ( data ) ; cos . flush ( ) ; byte [ ] result = tos . toByteArray ( ) ; if ( ! Arrays . equals ( result , data ) ) { fail ( "CipherOutputStream wrote incorrect data." ) ; } try { cos . write ( null ) ; fail ( "NullPointerException expected" ) ; } catch ( NullPointerException e ) { } } | write(byte[] b) method testing. Tests that method writes correct values to the underlying output stream. |
73 | @ VisibleForTesting static boolean shouldOpenAfterDownload ( DownloadInfo downloadInfo ) { String type = downloadInfo . getMimeType ( ) ; return downloadInfo . hasUserGesture ( ) && ! isAttachment ( downloadInfo . getContentDisposition ( ) ) && MIME_TYPES_TO_OPEN . contains ( type ) ; } | Determines if the download should be immediately opened after downloading. |
74 | @ Transactional public void save ( final List < WorkFlowMatrix > actualWorkFlowMatrixDetails , final String [ ] departments ) { for ( final String dept : departments ) { for ( final WorkFlowMatrix workFlowMatrix : actualWorkFlowMatrixDetails ) { final WorkFlowMatrix wfObj = workFlowMatrix . clone ( ) ; if ( dept . equals ( DEFAULT ) ) { wfObj . setDepartment ( "ANY" ) ; } else { wfObj . setDepartment ( dept ) ; } workflowMatrixRepository . save ( wfObj ) ; } } } | This method saves the workflow matrix details for every department selected |
75 | public void write ( String file ) throws Exception { write ( new File ( file ) ) ; } | writes the current DOM document into the given file. |
76 | private static boolean fieldsEqual ( Object a , Object b ) { return a == b || ( a != null && a . equals ( b ) ) ; } | Checks to see if two objects are equal either as nulls or through their comparator |
77 | private boolean extraEntity ( String outputString , int charToMap ) { boolean extra = false ; if ( charToMap < ASCII_MAX ) { switch ( charToMap ) { case '"' : if ( ! outputString . equals ( """ ) ) extra = true ; break ; case '&' : if ( ! outputString . equals ( "&" ) ) extra = true ; break ; case '<' : if ( ! outputString . equals ( "<" ) ) extra = true ; break ; case '>' : if ( ! outputString . equals ( ">" ) ) extra = true ; break ; default : extra = true ; } } return extra ; } | This method returns true if there are some non-standard mappings to entities other than quot, amp, lt, gt, and its only purpose is for performance. |
78 | public static String quoteIfNeeded ( String s , String delim ) { if ( s == null ) return null ; if ( s . length ( ) == 0 ) return "\"\"" ; for ( int i = 0 ; i < s . length ( ) ; i ++ ) { char c = s . charAt ( i ) ; if ( c == '\\' || c == '"' || c == '\'' || Character . isWhitespace ( c ) || delim . indexOf ( c ) >= 0 ) { StringBuffer b = new StringBuffer ( s . length ( ) + 8 ) ; quote ( b , s ) ; return b . toString ( ) ; } } return s ; } | Quote a string. The string is quoted only if quoting is required due to embedded delimiters, quote characters or the empty string. |
79 | public static void report ( ) { if ( License . isDeveloper ( ) ) { for ( final Object obj : SPIES ) { Diagnostic . developerLog ( obj . toString ( ) ) ; } } } | Generate a report to the log from all the current spies. |
80 | @ Deprecated public void write ( byte b [ ] , int off , int len ) { if ( len < 0 ) throw new ArrayIndexOutOfBoundsException ( len ) ; for ( int i = 0 ; i < len ; ++ i ) write ( b [ off + i ] ) ; } | Write a subarray of bytes. Pass each through write byte method. |
81 | public void or ( Criteria criteria ) { oredCriteria . add ( criteria ) ; } | This method was generated by MyBatis Generator. This method corresponds to the database table todolist |
82 | public final void testNextBytesbyteArray03 ( ) throws NoSuchAlgorithmException , NoSuchProviderException { SecureRandom sr1 ; SecureRandom sr2 ; byte [ ] myBytes1 ; byte [ ] myBytes2 ; for ( int i = 1 ; i < LENGTH / 2 ; i += INCR ) { sr1 = SecureRandom . getInstance ( algorithm , provider ) ; sr2 = SecureRandom . getInstance ( algorithm , provider ) ; boolean flag = true ; myBytes1 = new byte [ i ] ; myBytes2 = new byte [ i ] ; sr1 . nextBytes ( myBytes1 ) ; sr2 . nextBytes ( myBytes2 ) ; for ( int j = 0 ; j < i ; j ++ ) { flag &= myBytes1 [ j ] == myBytes2 [ j ] ; } sr1 . nextBytes ( myBytes1 ) ; sr2 . nextBytes ( myBytes2 ) ; for ( int j = 0 ; j < i ; j ++ ) { flag &= myBytes1 [ j ] == myBytes2 [ j ] ; } if ( flag ) { fail ( "TESTING RANDOM NUMBER GENERATOR QUALITY: IGNORE THIS FAILURE IF INTERMITTENT :: i=" + i ) ; } } } | test against the "void nextBytes(byte[])" method; it checks out that different SecureRandom objects being supplied with seed by themselves return different sequencies of bytes as results of their "nextBytes(byte[])" methods |
83 | public Cursor query ( SQLiteDatabase db , String [ ] projectionIn , String selection , String [ ] selectionArgs , String groupBy , String having , String sortOrder , String limit ) { if ( mTables == null ) { return null ; } if ( mStrict && selection != null && selection . length ( ) > 0 ) { String sqlForValidation = buildQuery ( projectionIn , "(" + selection + ")" , groupBy , having , sortOrder , limit ) ; validateSql ( db , sqlForValidation ) ; } String sql = buildQuery ( projectionIn , selection , groupBy , having , sortOrder , limit ) ; return db . rawQueryWithFactory ( mFactory , sql , selectionArgs , SQLiteDatabase . findEditTable ( mTables ) ) ; } | Perform a query by combining all current settings and the information passed into this method. |
84 | private static String replaceChars ( String str ) { StringBuffer buf = new StringBuffer ( str ) ; int length = buf . length ( ) ; for ( int i = 0 ; i < length ; i ++ ) { char currentChar = buf . charAt ( i ) ; if ( currentChar == ' ' ) { buf . setCharAt ( i , '%' ) ; buf . insert ( i + 1 , "20" ) ; length = length + 2 ; i = i + 2 ; } else if ( currentChar == '\\' ) { buf . setCharAt ( i , '/' ) ; } } return buf . toString ( ) ; } | Replace spaces with "%20" and backslashes with forward slashes in the input string to generate a well-formed URI string. |
85 | public boolean isPaused ( ) { return false ; } | Whether or not the game is paused. |
86 | public Builder trustCertificates ( KeyStore trustStore ) throws GeneralSecurityException { SSLContext sslContext = SslUtils . getTlsSslContext ( ) ; SslUtils . initSslContext ( sslContext , trustStore , SslUtils . getPkixTrustManagerFactory ( ) ) ; return setSslSocketFactory ( sslContext . getSocketFactory ( ) ) ; } | Sets the SSL socket factory based on a root certificate trust store. |
87 | public void rejectReInvite ( int code ) { if ( sLogger . isActivated ( ) ) { sLogger . debug ( "ReInvite has been rejected" ) ; } synchronized ( mWaitUserAnswer ) { mReInviteStatus = InvitationStatus . INVITATION_REJECTED ; mWaitUserAnswer . notifyAll ( ) ; } } | Reject the session invitation |
88 | public static Point parsePoint ( String str , SpatialContext ctx ) throws InvalidShapeException { try { double x , y ; str = str . trim ( ) ; int commaIdx = str . indexOf ( ',' ) ; if ( commaIdx == - 1 ) { int spaceIdx = str . indexOf ( ' ' ) ; if ( spaceIdx == - 1 ) throw new InvalidShapeException ( "Point must be in 'lat, lon' or 'x y' format: " + str ) ; int middleEndIdx = findIndexNotSpace ( str , spaceIdx + 1 , + 1 ) ; x = Double . parseDouble ( str . substring ( 0 , spaceIdx ) ) ; y = Double . parseDouble ( str . substring ( middleEndIdx ) ) ; } else { int middleStartIdx = findIndexNotSpace ( str , commaIdx - 1 , - 1 ) ; int middleEndIdx = findIndexNotSpace ( str , commaIdx + 1 , + 1 ) ; y = Double . parseDouble ( str . substring ( 0 , middleStartIdx + 1 ) ) ; x = Double . parseDouble ( str . substring ( middleEndIdx ) ) ; } x = ctx . normX ( x ) ; y = ctx . normY ( y ) ; return ctx . makePoint ( x , y ) ; } catch ( InvalidShapeException e ) { throw e ; } catch ( Exception e ) { throw new InvalidShapeException ( e . toString ( ) , e ) ; } } | Parses either "lat, lon" (spaces optional on either comma side) or "x y" style formats. Spaces can be basically anywhere. And not any whitespace, just the space char. |
89 | public boolean isPrune ( ) { return prune ; } | Returns the value of the prune attribute. |
90 | public void enqueueNormal ( String methodName , int count ) { Deque < InvocationHandler > handlers = getHandlers ( methodName ) ; for ( int i = 0 ; i < count ; i ++ ) { handlers . add ( delegateHandler ) ; } } | Enqueues the specified number of normal operations. Useful to delay faults. |
91 | @ SuppressWarnings ( "unchecked" ) @ Override protected Object readPostProcess ( Object o ) throws Exception { Enumeration < Object > enm ; Vector < Vector < ? > > deserialized ; Object key ; deserialized = ( Vector < Vector < ? > > ) super . readPostProcess ( o ) ; rebuildBeanConnections ( deserialized , REGULAR_CONNECTION ) ; enm = m_BeanConnectionRelation . keys ( ) ; while ( enm . hasMoreElements ( ) ) { key = enm . nextElement ( ) ; if ( ! ( key instanceof MetaBean ) ) { continue ; } rebuildBeanConnections ( deserialized , key ) ; } if ( getDataType ( ) == DATATYPE_USERCOMPONENTS ) { removeUserToolBarBeans ( deserialized ) ; } return deserialized ; } | additional post-processing can happen in derived classes after reading from XML. re-builds the BeanConnections. |
92 | public static boolean canSee ( IGame game , Entity ae , Targetable target ) { return canSee ( game , ae , target , true , null , null ) ; } | Checks to see if the target is visible to the unit, always considering sensors. |
93 | @ Override void toXML ( StringBuilder xml , int level ) { indent ( xml , level ) ; xml . append ( "<string>" ) ; for ( int i = 0 ; i < bytes . length ; i ++ ) { byte b = bytes [ i ] ; if ( b < 16 ) xml . append ( '0' ) ; xml . append ( Integer . toHexString ( b ) ) ; } xml . append ( "</string>" ) ; } | There is no XML representation specified for UIDs. In this implementation UIDs are represented as strings in the XML output. |
94 | public final int readLine ( char [ ] buf , int length , boolean isChop ) throws IOException { byte [ ] readBuffer = _readBuffer ; int offset = 0 ; while ( true ) { int readOffset = _readOffset ; int sublen = Math . min ( length , _readLength - readOffset ) ; for ( ; sublen > 0 ; sublen -- ) { int ch = readBuffer [ readOffset ++ ] & 0xff ; if ( ch != '\n' ) { } else if ( isChop ) { _readOffset = readOffset ; if ( offset > 0 && buf [ offset - 1 ] == '\r' ) return offset - 1 ; else return offset ; } else { buf [ offset ++ ] = ( char ) ch ; _readOffset = readOffset ; return offset + 1 ; } buf [ offset ++ ] = ( char ) ch ; } _readOffset = readOffset ; if ( readOffset <= _readLength ) { if ( ! readBuffer ( ) ) { return offset ; } } if ( length <= offset ) return length + 1 ; } } | Reads a line into the character buffer. \r\n is converted to \n. |
95 | public static void gotoOffset ( final CDebugPerspectiveModel model , final IAddress offset , final boolean focusMemoryWindow ) { model . setActiveMemoryAddress ( offset , focusMemoryWindow ) ; } | Sets the caret of a hex control to a given offset. |
96 | public List < AbstractCondition > toConditionsList ( ) { List < AbstractCondition > list = new ArrayList < > ( ) ; for ( Node < AbstractCondition > node : toList ( ) ) { list . add ( node . getData ( ) ) ; } return list ; } | Get all conditions as a plain list. |
97 | protected void initBatchBuffer ( ) { try { if ( ! isIncremental ( ) ) { m_BatchBuffer = m_Loader . getDataSet ( ) ; } else { m_BatchBuffer = null ; } } catch ( Exception e ) { e . printStackTrace ( ) ; } } | initializes the batch buffer if necessary, i.e., for non-incremental loaders. |
98 | public BigdataSailRepositoryConnection cxn ( ) { return tlTx . get ( ) ; } | Direct access to the unisolated connection. May return null if the connection has not been opened yet by this thread. |
99 | public void processConnection ( DataInputStream dis , DataOutputStream dosParam ) throws IOException , Exception { GZIPOutputStream gzip = new GZIPOutputStream ( new BufferedOutputStream ( dosParam ) ) ; DataOutputStream dos = new DataOutputStream ( gzip ) ; byte responseStatus = ResponseStatus . STATUS_ERROR ; try { ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; String name = dis . readUTF ( ) ; String pw = dis . readUTF ( ) ; String serializer = dis . readUTF ( ) ; @ SuppressWarnings ( "unused" ) String locale = dis . readUTF ( ) ; byte action = dis . readByte ( ) ; Context . openSession ( ) ; try { Context . authenticate ( name , pw ) ; } catch ( ContextAuthenticationException ex ) { responseStatus = ResponseStatus . STATUS_ACCESS_DENIED ; } if ( responseStatus != ResponseStatus . STATUS_ACCESS_DENIED ) { DataOutputStream dosTemp = new DataOutputStream ( baos ) ; if ( action == ACTION_DOWNLOAD_PATIENTS ) downloadPatients ( String . valueOf ( dis . readInt ( ) ) , dosTemp , serializer , false ) ; else if ( action == ACTION_DOWNLOAD_SS_PATIENTS ) downloadPatients ( String . valueOf ( dis . readInt ( ) ) , dosTemp , serializer , true ) ; else if ( action == ACTION_DOWNLOAD_COHORTS ) PatientDownloadManager . downloadCohorts ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_SAVED_SEARCHES ) PatientDownloadManager . downloadSavesSearches ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_FORMS ) XformDownloadManager . downloadXforms ( dosTemp , serializer ) ; else if ( action == ACTION_UPLOAD_FORMS ) submitXforms ( dis , dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_USERS ) UserDownloadManager . downloadUsers ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_USERS_AND_FORMS ) downloadUsersAndForms ( dosTemp , serializer ) ; else if ( action == ACTION_DOWNLOAD_FILTERED_PATIENTS ) downloadPatients ( dis . readUTF ( ) , dis . readUTF ( ) , dosTemp , serializer ) ; responseStatus = ResponseStatus . STATUS_SUCCESS ; } dos . writeByte ( responseStatus ) ; if ( responseStatus == ResponseStatus . STATUS_SUCCESS ) dos . write ( baos . toByteArray ( ) ) ; dos . close ( ) ; gzip . finish ( ) ; } catch ( Exception ex ) { log . error ( ex . getMessage ( ) , ex ) ; try { dos . writeByte ( responseStatus ) ; dos . flush ( ) ; gzip . finish ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } } finally { Context . closeSession ( ) ; } } | Called when a new connection has been received. Failures are not handled in this class as different servers (BT,SMS, etc) may want to handle them differently. |
End of preview. Expand
in Dataset Viewer.
No dataset card yet
- Downloads last month
- 5