idx
int64
0
34.9k
question
stringlengths
12
26.4k
target
stringlengths
15
2.3k
500
@ Override public void reset ( ) throws IOException { fInputStream . reset ( ) ; }
Reset the stream. If the stream has been marked, then attempt to reposition it at the mark. If the stream has not been marked, then attempt to reset it in some way appropriate to the particular stream, for example by repositioning it to its starting point. Not all character-input streams support the reset() operation, and some support reset() without supporting mark().
501
public byte [ ] encode ( ) { char type = getAttributeType ( ) ; byte binValue [ ] = new byte [ HEADER_LENGTH + getDataLength ( ) + ( 4 - getDataLength ( ) % 4 ) % 4 ] ; binValue [ 0 ] = ( byte ) ( type > > 8 ) ; binValue [ 1 ] = ( byte ) ( type & 0x00FF ) ; binValue [ 2 ] = ( byte ) ( getDataLength ( ) > > 8 ) ; binValue [ 3 ] = ( byte ) ( getDataLength ( ) & 0x00FF ) ; System . arraycopy ( username , 0 , binValue , 4 , getDataLength ( ) ) ; return binValue ; }
Returns a binary representation of this attribute.
502
public LongStreamEx prepend ( LongStream other ) { return new LongStreamEx ( LongStream . concat ( other , stream ( ) ) , context . combine ( other ) ) ; }
Creates a lazily concatenated stream whose elements are all the elements of the other stream followed by all the elements of this stream. The resulting stream is ordered if both of the input streams are ordered, and parallel if either of the input streams is parallel. When the resulting stream is closed, the close handlers for both input streams are invoked.
503
public void disconnect ( ) { connected = false ; synchronized ( connLostWait ) { connLostWait . notify ( ) ; } if ( mqtt != null ) { try { mqtt . disconnect ( ) ; } catch ( Exception ex ) { setTitleText ( "MQTT disconnect error !" ) ; ex . printStackTrace ( ) ; System . exit ( 1 ) ; } } if ( led . isFlashing ( ) ) { led . setFlash ( ) ; } led . setRed ( ) ; setConnected ( false ) ; synchronized ( this ) { writeLogln ( "WebSphere MQ Telemetry transport disconnected" ) ; } }
A wrapper for the MQTT disconnect method. As well as disconnecting the protocol this method enables / disables buttons as appropriate when in disconnected state. It also sets the correct colour of the indicator LED.
504
private void addCdataSectionElement ( String URI_and_localName , Vector v ) { StringTokenizer tokenizer = new StringTokenizer ( URI_and_localName , "{}" , false ) ; String s1 = tokenizer . nextToken ( ) ; String s2 = tokenizer . hasMoreTokens ( ) ? tokenizer . nextToken ( ) : null ; if ( null == s2 ) { v . addElement ( null ) ; v . addElement ( s1 ) ; } else { v . addElement ( s1 ) ; v . addElement ( s2 ) ; } }
Adds a URI/LocalName pair of strings to the list.
505
private void checkPermissions ( ) { SecurityManager sm = System . getSecurityManager ( ) ; if ( sm != null ) { Enumeration < Permission > enum_ = permissions . elements ( ) ; while ( enum_ . hasMoreElements ( ) ) { sm . checkPermission ( enum_ . nextElement ( ) ) ; } } }
Check that the current access control context has all of the permissions necessary to load classes from this loader.
506
public SpanManager delete ( int start , int end ) { sb . delete ( start , end ) ; adjustLists ( start , start - end ) ; if ( calculateSrcPositions ) for ( int i = 0 ; i < end - start ; i ++ ) ib . remove ( start ) ; return this ; }
Deletes the content between start (included) and end (excluded).
507
@ OnError public void onError ( Session session , Throwable t ) { callInternal ( "onError" , session , t . getMessage ( ) ) ; logger . error ( t . getMessage ( ) , t ) ; }
On error raised handler
508
public void removeStrategy ( final WeightingStrategy strategy ) { strategies_ . remove ( strategy ) ; }
Removes the strategy from the weighting strategies collection.
509
public static GeneralPath cardinalSpline ( GeneralPath p , float pts [ ] , int start , int npoints , float slack , boolean closed , float tx , float ty ) { try { int len = 2 * npoints ; int end = start + len ; if ( len < 6 ) { throw new IllegalArgumentException ( "To create spline requires at least 3 points" ) ; } float dx1 , dy1 , dx2 , dy2 ; if ( closed ) { dx2 = pts [ start + 2 ] - pts [ end - 2 ] ; dy2 = pts [ start + 3 ] - pts [ end - 1 ] ; } else { dx2 = pts [ start + 4 ] - pts [ start ] ; dy2 = pts [ start + 5 ] - pts [ start + 1 ] ; } int i ; for ( i = start + 2 ; i < end - 2 ; i += 2 ) { dx1 = dx2 ; dy1 = dy2 ; dx2 = pts [ i + 2 ] - pts [ i - 2 ] ; dy2 = pts [ i + 3 ] - pts [ i - 1 ] ; p . curveTo ( tx + pts [ i - 2 ] + slack * dx1 , ty + pts [ i - 1 ] + slack * dy1 , tx + pts [ i ] - slack * dx2 , ty + pts [ i + 1 ] - slack * dy2 , tx + pts [ i ] , ty + pts [ i + 1 ] ) ; } if ( closed ) { dx1 = dx2 ; dy1 = dy2 ; dx2 = pts [ start ] - pts [ i - 2 ] ; dy2 = pts [ start + 1 ] - pts [ i - 1 ] ; p . curveTo ( tx + pts [ i - 2 ] + slack * dx1 , ty + pts [ i - 1 ] + slack * dy1 , tx + pts [ i ] - slack * dx2 , ty + pts [ i + 1 ] - slack * dy2 , tx + pts [ i ] , ty + pts [ i + 1 ] ) ; dx1 = dx2 ; dy1 = dy2 ; dx2 = pts [ start + 2 ] - pts [ end - 2 ] ; dy2 = pts [ start + 3 ] - pts [ end - 1 ] ; p . curveTo ( tx + pts [ end - 2 ] + slack * dx1 , ty + pts [ end - 1 ] + slack * dy1 , tx + pts [ 0 ] - slack * dx2 , ty + pts [ 1 ] - slack * dy2 , tx + pts [ 0 ] , ty + pts [ 1 ] ) ; p . closePath ( ) ; } else { p . curveTo ( tx + pts [ i - 2 ] + slack * dx2 , ty + pts [ i - 1 ] + slack * dy2 , tx + pts [ i ] - slack * dx2 , ty + pts [ i + 1 ] - slack * dy2 , tx + pts [ i ] , ty + pts [ i + 1 ] ) ; } } catch ( IllegalPathStateException ex ) { } return p ; }
Compute a cardinal spline, a series of cubic Bezier splines smoothly connecting a set of points. Cardinal splines maintain C(1) continuity, ensuring the connected spline segments form a differentiable curve, ensuring at least a minimum level of smoothness.
510
public WildcardFileFilter ( String [ ] wildcards , IOCase caseSensitivity ) { if ( wildcards == null ) { throw new IllegalArgumentException ( "The wildcard array must not be null" ) ; } this . wildcards = new String [ wildcards . length ] ; System . arraycopy ( wildcards , 0 , this . wildcards , 0 , wildcards . length ) ; this . caseSensitivity = caseSensitivity == null ? IOCase . SENSITIVE : caseSensitivity ; }
Construct a new wildcard filter for an array of wildcards specifying case-sensitivity. <p> The array is not cloned, so could be changed after constructing the instance. This would be inadvisable however.
511
public static Pair < Integer , Boolean > parseInfoFromFilename ( String name ) { try { if ( name . startsWith ( SAVED_TAB_STATE_FILE_PREFIX_INCOGNITO ) ) { int id = Integer . parseInt ( name . substring ( SAVED_TAB_STATE_FILE_PREFIX_INCOGNITO . length ( ) ) ) ; return Pair . create ( id , true ) ; } else if ( name . startsWith ( SAVED_TAB_STATE_FILE_PREFIX ) ) { int id = Integer . parseInt ( name . substring ( SAVED_TAB_STATE_FILE_PREFIX . length ( ) ) ) ; return Pair . create ( id , false ) ; } } catch ( NumberFormatException ex ) { } return null ; }
Parse the tab id and whether the tab is incognito from the tab state filename.
512
public byte [ ] decode ( String s ) { byte [ ] b = new byte [ ( s . length ( ) / 4 ) * 3 ] ; int cycle = 0 ; int combined = 0 ; int j = 0 ; int len = s . length ( ) ; int dummies = 0 ; for ( int i = 0 ; i < len ; i ++ ) { int c = s . charAt ( i ) ; int value = ( c <= 255 ) ? charToValue [ c ] : IGNORE ; switch ( value ) { case IGNORE : break ; case PAD : value = 0 ; dummies ++ ; default : switch ( cycle ) { case 0 : combined = value ; cycle = 1 ; break ; case 1 : combined <<= 6 ; combined |= value ; cycle = 2 ; break ; case 2 : combined <<= 6 ; combined |= value ; cycle = 3 ; break ; case 3 : combined <<= 6 ; combined |= value ; b [ j + 2 ] = ( byte ) combined ; combined >>>= 8 ; b [ j + 1 ] = ( byte ) combined ; combined >>>= 8 ; b [ j ] = ( byte ) combined ; j += 3 ; cycle = 0 ; break ; } break ; } } if ( cycle != 0 ) { throw new ArrayIndexOutOfBoundsException ( "Input to decode not an even multiple of 4 characters; pad with =." ) ; } j -= dummies ; if ( b . length != j ) { byte [ ] b2 = new byte [ j ] ; System . arraycopy ( b , 0 , b2 , 0 , j ) ; b = b2 ; } return b ; }
decode a well-formed complete Base64 string back into an array of bytes. It must have an even multiple of 4 data characters (not counting \n), padded out with = as needed.
513
protected void initializeConnection ( MQTTClientProvider provider ) throws Exception { if ( ! isUseSSL ( ) ) { provider . connect ( "tcp://localhost:" + port ) ; } else { SSLContext ctx = SSLContext . getInstance ( "TLS" ) ; ctx . init ( new KeyManager [ 0 ] , new TrustManager [ ] { new DefaultTrustManager ( ) } , new SecureRandom ( ) ) ; provider . setSslContext ( ctx ) ; provider . connect ( "ssl://localhost:" + port ) ; } }
Initialize an MQTTClientProvider instance. By default this method uses the port that's assigned to be the TCP based port using the base version of addMQTTConnector. A subclass can either change the value of port or override this method to assign the correct port.
514
public void filterRows ( ) { if ( m_parent == null ) return ; CascadedRowManager rowman = ( CascadedRowManager ) m_rows ; IntIterator crows = m_rows . rows ( ) ; while ( crows . hasNext ( ) ) { int crow = crows . nextInt ( ) ; if ( ! m_rowFilter . getBoolean ( m_parent . getTuple ( rowman . getParentRow ( crow ) ) ) ) { removeCascadedRow ( crow ) ; } } Iterator ptuples = m_parent . tuples ( m_rowFilter ) ; while ( ptuples . hasNext ( ) ) { Tuple pt = ( Tuple ) ptuples . next ( ) ; int prow = pt . getRow ( ) ; if ( rowman . getChildRow ( prow ) == - 1 ) addCascadedRow ( prow ) ; } }
Manually trigger a re-filtering of the rows of this table. If the filtering predicate concerns only items within this table, calling this method should be unnecessary. It is only when the filtering predicate references data outside of this table that a manual re-filtering request may be necessary. For example, filtering valid edges of a graph from a pool of candidate edges will depend on the available nodes.
515
public int versionPointNumber ( ) { return Integer . valueOf ( properties . getProperty ( "version.point" ) ) ; }
Returns the point version number for the Directory Server.
516
private String [ ] splitSeparator ( String sep , String s ) { Vector v = new Vector ( ) ; int tokenStart = 0 ; int tokenEnd = 0 ; while ( ( tokenEnd = s . indexOf ( sep , tokenStart ) ) != - 1 ) { v . addElement ( s . substring ( tokenStart , tokenEnd ) ) ; tokenStart = tokenEnd + 1 ; } v . addElement ( s . substring ( tokenStart ) ) ; String [ ] retVal = new String [ v . size ( ) ] ; v . copyInto ( retVal ) ; return retVal ; }
Split a string based on the presence of a specified separator. Returns an array of arbitrary length. The end of each element in the array is indicated by the separator of the end of the string. If there is a separator immediately before the end of the string, the final element will be empty. None of the strings will contain the separator. Useful when separating strings such as "foo/bar/bas" using separator "/".
517
static boolean advanceToFirstFont ( AttributedCharacterIterator aci ) { for ( char ch = aci . first ( ) ; ch != CharacterIterator . DONE ; ch = aci . setIndex ( aci . getRunLimit ( ) ) ) { if ( aci . getAttribute ( TextAttribute . CHAR_REPLACEMENT ) == null ) { return true ; } } return false ; }
When this returns, the ACI's current position will be at the start of the first run which does NOT contain a GraphicAttribute. If no such run exists the ACI's position will be at the end, and this method will return false.
518
private static int count ( String pattern , String [ ] possibleValues ) { int count = 0 ; for ( String r : possibleValues ) { if ( pattern . contains ( r ) ) { count ++ ; } } return count ; }
Count the amount of renamer tokens per group
519
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
520
public static Module load ( int id ) { return modules . get ( id ) ; }
load the module by id
521
public Future < Void > updateTableEntityAsync ( TableEntity tableEntity , boolean commit ) { updateTableEntity ( tableEntity , commit ) ; return new AsyncResult < Void > ( null ) ; }
Updates the Solr document for the given table entity asynchronly
522
boolean hasNextSFeature ( ) { return ( sFeatureIdx < sFeatures . size ( ) ) ; }
Checks for next s feature.
523
public void testValueOfLongPositive2 ( ) { long longVal = 58930018L ; BigInteger aNumber = BigInteger . valueOf ( longVal ) ; byte rBytes [ ] = { 3 , - 125 , 51 , 98 } ; byte resBytes [ ] = new byte [ rBytes . length ] ; resBytes = aNumber . toByteArray ( ) ; for ( int i = 0 ; i < resBytes . length ; i ++ ) { assertTrue ( resBytes [ i ] == rBytes [ i ] ) ; } assertEquals ( "incorrect sign" , 1 , aNumber . signum ( ) ) ; }
valueOf (long val): convert a positive long value to a BigInteger. The long value fits in integer.
524
private boolean processSingleEvent ( ) { if ( eventBuffer . remaining ( ) < 20 ) { return false ; } try { eventBuffer . getInt ( ) ; final int bufferLength = eventBuffer . getInt ( ) ; final int padding = ( 4 - bufferLength ) & 3 ; if ( eventBuffer . remaining ( ) < bufferLength + padding + 12 ) return false ; final byte [ ] buffer = new byte [ bufferLength ] ; eventBuffer . get ( buffer ) ; eventBuffer . position ( eventBuffer . position ( ) + padding ) ; int eventCount = 0 ; if ( bufferLength > 4 ) { eventCount = iscVaxInteger ( buffer , bufferLength - 4 , 4 ) ; } eventBuffer . getLong ( ) ; int eventId = eventBuffer . getInt ( ) ; log . debug ( String . format ( "Received event id %d, eventCount %d" , eventId , eventCount ) ) ; channelListenerDispatcher . eventReceived ( this , new AsynchronousChannelListener . Event ( eventId , eventCount ) ) ; return true ; } catch ( BufferUnderflowException ex ) { return false ; } }
Processes the event buffer for a single event.
525
@ Override public String toString ( ) { return name ; }
The String representation of this object.
526
public static < T > GitNoteWriter < T > createNoteWriter ( String reviewCommitHash , final Repository db , PersonIdent author , String ref ) { return new GitNoteWriter < T > ( reviewCommitHash , db , ref , author ) ; }
Creates a writer to write comments to a given review.
527
private Element toElement ( ScheduleTask task ) { Element el = doc . createElement ( "task" ) ; setAttributes ( el , task ) ; return el ; }
translate a schedule task object to a XML Element
528
public static int intHash ( String ipString ) { int val = 0 ; String [ ] strs = ipString . split ( "[^\\p{XDigit}]" ) ; int len = strs . length ; if ( len >= 4 ) { val = intVal ( strs [ 0 ] ) ; val <<= 8 ; val |= intVal ( strs [ 1 ] ) ; val <<= 8 ; val |= intVal ( strs [ 2 ] ) ; val <<= 8 ; val |= intVal ( strs [ 3 ] ) ; } return val ; }
This should be suitable for ipv6 as well but we will have to accommodate for the extra bytes later. Expects four integers 0-255 separated by some non-numeric character.
529
public FluentJdbcBuilder connectionProvider ( ConnectionProvider connectionProvider ) { checkNotNull ( connectionProvider , "connectionProvider" ) ; this . connectionProvider = Optional . of ( connectionProvider ) ; return this ; }
Sets the ConnectionProvider for FluentJdbc. Queries created by fluentJdbc.query() will use Connections returned by this provider
530
public static void register ( String modelName , IWindModel model , int awesomeness ) { models . put ( modelName , model ) ; if ( modelName . equalsIgnoreCase ( userModelChoice ) ) { awesomeness = Integer . MAX_VALUE ; } if ( awesomeness > best ) { best = awesomeness ; activeModel = model ; } }
Registers a wind model. Might change activeModel, but of course this should be done during load time.
531
public void notifyTransactionTerminated ( CompositeTransaction ct ) { boolean notifyOfTerminatedEvent = false ; synchronized ( this ) { boolean alreadyTerminated = isTerminated ( ) ; Iterator < TransactionContext > it = allContexts . iterator ( ) ; while ( it . hasNext ( ) ) { TransactionContext b = it . next ( ) ; b . transactionTerminated ( ct ) ; } if ( isTerminated ( ) && ! alreadyTerminated ) notifyOfTerminatedEvent = true ; } if ( notifyOfTerminatedEvent ) { if ( LOGGER . isTraceEnabled ( ) ) LOGGER . logTrace ( this + ": all contexts terminated, firing TerminatedEvent for " + this ) ; fireTerminatedEvent ( ) ; } }
Notifies the session that the transaction was terminated.
532
public JCDiagnostic create ( DiagnosticType kind , DiagnosticSource source , DiagnosticPosition pos , String key , Object ... args ) { return create ( kind , null , EnumSet . noneOf ( DiagnosticFlag . class ) , source , pos , key , args ) ; }
Create a new diagnostic of the given kind, which is not mandatory and which has no lint category.
533
public void exportTree ( Tree tree ) { Map < String , Integer > idMap = writeNexusHeader ( tree ) ; out . println ( "\t\t;" ) ; writeNexusTree ( tree , treePrefix + 1 , true , idMap ) ; out . println ( "End;" ) ; }
Export a tree with all its attributes.
534
ArchivedDesktopComponent addDesktopComponent ( final org . simbrain . workspace . gui . GuiComponent < ? > dc ) { return desktopComponent = new ArchivedDesktopComponent ( this , dc ) ; }
Adds a desktop component to this component entry.
535
public static File createTempDir ( ) { return createTempDir ( new File ( System . getProperty ( "java.io.tmpdir" ) ) ) ; }
Create a temporary directory in the directory given by java.io.tmpdir
536
private void extendColourMap ( int highest ) { for ( int i = m_colorList . size ( ) ; i < highest ; i ++ ) { Color pc = m_DefaultColors [ i % 10 ] ; int ija = i / 10 ; ija *= 2 ; for ( int j = 0 ; j < ija ; j ++ ) { pc = pc . brighter ( ) ; } m_colorList . add ( pc ) ; } }
Add more colours to the colour map
537
protected void processResult ( final Operation operation , final Object result , final Command commandObj ) throws BaseCollectionException { Processor _processor = null ; _processor = operation . getProcessor ( ) ; if ( null != _processor ) { List < Object > argsList = new ArrayList < Object > ( ) ; argsList . add ( Util . normalizedReadArgs ( _keyMap , commandObj . retreiveArguments ( ) ) ) ; argsList . add ( commandObj . getCommandIndex ( ) ) ; _processor . setPrerequisiteObjects ( argsList ) ; _processor . processResult ( operation , result , _keyMap ) ; } else { _LOGGER . debug ( "No Processors found to execute. " ) ; } }
Move the result to Processor. Processor can be of type CIMProcessor, DirectorMetrics Apply different types of Decorators above the processed Result Multiple Decorators can be applied on the processed Result. Multiple Processors can be applied on the result got from Executor.
538
public static String stringFilterStrict ( String searchText ) { return searchText . replaceAll ( "[^ a-zA-Z0-9\\u4e00-\\u9fa5]" , "" ) ; }
Remove useless and unsafe characters. Only Chinese, numbers, English characters and space are allowed.
539
public Enumeration enumurateQueue ( ) { Vector elements = new Vector ( ) ; synchronized ( LOCK ) { Enumeration e = pending . elements ( ) ; while ( e . hasMoreElements ( ) ) { elements . addElement ( e . nextElement ( ) ) ; } } return elements . elements ( ) ; }
This method returns all pending ConnectioRequest connections.
540
public boolean hasPrevious ( ) { return iterator . hasPrevious ( ) ; }
Similar to getting the iterator and calling hasPrevious on it
541
private void captionPut ( int value , String text ) { captionMap . put ( new Integer ( value ) , text ) ; }
Caption put. Save a mouse caption (string) corresponding to a character value. Do not include a character number in the caption; that is added by captionGet().
542
public void sortLocations ( ) { if ( l_locations . isEmpty ( ) ) return ; Collections . sort ( l_locations ) ; PBLocation fst = l_locations . get ( 0 ) , loc ; if ( ! fst . isType ( StringConst . EMPTY ) ) { for ( int i = 1 ; i < l_locations . size ( ) ; i ++ ) { loc = l_locations . get ( i ) ; if ( loc . isType ( StringConst . EMPTY ) ) { loc . setType ( fst . getType ( ) ) ; break ; } } fst . setType ( StringConst . EMPTY ) ; } }
Sorts the locations of this argument by their terminal IDs and heights.
543
private static int uarimaxGt ( double value , double [ ] bv , int bvi [ ] , BinaryOperator bOp ) throws DMLRuntimeException { int ixMax = bv . length ; if ( value <= bv [ 0 ] || value > bv [ bv . length - 1 ] ) return ixMax ; int ix = Arrays . binarySearch ( bv , value ) ; ix = Math . abs ( ix ) - 1 ; ixMax = bvi [ ix - 1 ] + 1 ; return ixMax ; }
Find out rowIndexMax for GreaterThan operator.
544
private void persistVolumeNativeID ( DbClient dbClient , URI volumeId , String nativeID , Calendar creationTime ) throws IOException { Volume volume = dbClient . queryObject ( Volume . class , volumeId ) ; volume . setCreationTime ( creationTime ) ; volume . setNativeId ( nativeID ) ; volume . setNativeGuid ( NativeGUIDGenerator . generateNativeGuid ( dbClient , volume ) ) ; dbClient . updateObject ( volume ) ; }
This method saves the native ID info and creation time for the volume object. The native ID is the key identifier for the volume instance on the SMI-S side. We need to immediately persist it, so that if when further post-processing of the volume encounters some error, we would be able to have some reference to the volume and we could attempt to delete it.
545
public Whitelist ( ) { this . patterns = Collections . emptyList ( ) ; this . statusCode = - 1 ; this . enabled = false ; }
Creates an empty, disabled Whitelist.
546
protected Node conditionalExprPromotion ( Node node , TypeMirror destType ) { TypeMirror nodeType = node . getType ( ) ; if ( types . isSameType ( nodeType , destType ) ) { return node ; } if ( TypesUtils . isPrimitive ( nodeType ) && TypesUtils . isBoxedPrimitive ( destType ) ) { return box ( node ) ; } boolean isBoxedPrimitive = TypesUtils . isBoxedPrimitive ( nodeType ) ; TypeMirror unboxedNodeType = isBoxedPrimitive ? types . unboxedType ( nodeType ) : nodeType ; TypeMirror unboxedDestType = TypesUtils . isBoxedPrimitive ( destType ) ? types . unboxedType ( destType ) : destType ; if ( TypesUtils . isNumeric ( unboxedNodeType ) && TypesUtils . isNumeric ( unboxedDestType ) ) { if ( unboxedNodeType . getKind ( ) == TypeKind . BYTE && destType . getKind ( ) == TypeKind . SHORT ) { if ( isBoxedPrimitive ) { node = unbox ( node ) ; } return widen ( node , destType ) ; } TypeKind destKind = destType . getKind ( ) ; if ( destKind == TypeKind . BYTE || destKind == TypeKind . CHAR || destKind == TypeKind . SHORT ) { if ( isBoxedPrimitive ) { return unbox ( node ) ; } else if ( nodeType . getKind ( ) == TypeKind . INT ) { return narrow ( node , destType ) ; } } return binaryNumericPromotion ( node , destType ) ; } if ( TypesUtils . isPrimitive ( nodeType ) && ( destType . getKind ( ) == TypeKind . DECLARED || destType . getKind ( ) == TypeKind . UNION || destType . getKind ( ) == TypeKind . INTERSECTION ) ) { return box ( node ) ; } return node ; }
Convert an operand of a conditional expression to the type of the whole expression.
547
public void removeConnection ( Connection conn ) { int removalIndex = findConnection ( conn ) ; if ( removalIndex != - 1 ) { mConnections . remove ( removalIndex ) ; } }
Remove the given connection from this list.
548
public AttrSet read ( java . security . Principal principal , Guid guid , String attrNames [ ] ) throws UMSException { String id = guid . getDn ( ) ; ConnectionEntryReader entryReader ; SearchRequest request = LDAPRequests . newSearchRequest ( id , SearchScope . BASE_OBJECT , "(objectclass=*)" , attrNames ) ; entryReader = readLDAPEntry ( principal , request ) ; if ( entryReader == null ) { throw new AccessRightsException ( id ) ; } Collection < Attribute > attrs = new ArrayList < > ( ) ; try ( ConnectionEntryReader reader = entryReader ) { while ( reader . hasNext ( ) ) { if ( reader . isReference ( ) ) { reader . readReference ( ) ; } SearchResultEntry entry = entryReader . readEntry ( ) ; for ( Attribute attr : entry . getAllAttributes ( ) ) { attrs . add ( attr ) ; } } if ( attrs . isEmpty ( ) ) { throw new EntryNotFoundException ( i18n . getString ( IUMSConstants . ENTRY_NOT_FOUND , new String [ ] { id } ) ) ; } return new AttrSet ( attrs ) ; } catch ( IOException e ) { throw new UMSException ( i18n . getString ( IUMSConstants . UNABLE_TO_READ_ENTRY , new String [ ] { id } ) , e ) ; } }
Reads an ldap entry.
549
protected int selectOperator ( ) { lastUpdate ++ ; if ( ( lastUpdate >= UPDATE_WINDOW ) || ( probabilities == null ) ) { lastUpdate = 0 ; probabilities = getOperatorProbabilities ( ) ; } double rand = PRNG . nextDouble ( ) ; double sum = 0.0 ; for ( int i = 0 ; i < operators . size ( ) ; i ++ ) { sum += probabilities [ i ] ; if ( sum > rand ) { return i ; } } throw new IllegalStateException ( ) ; }
Returns the index of one of the available operators randomly selected using the probabilities.
550
private Function < String , TagState > newTagRetriever ( TaggingClient client ) { return null ; }
Builds a function to retrieve tags given and endpoint.
551
public static Map < String , List < DataFileFooter > > createDataFileFooterMappingForSegments ( List < TableBlockInfo > tableBlockInfoList ) throws IndexBuilderException { Map < String , List < DataFileFooter > > segmentBlockInfoMapping = new HashMap < > ( ) ; for ( TableBlockInfo blockInfo : tableBlockInfoList ) { List < DataFileFooter > eachSegmentBlocks = new ArrayList < > ( ) ; String segId = blockInfo . getSegmentId ( ) ; DataFileFooter dataFileMatadata = null ; List < DataFileFooter > metadataList = segmentBlockInfoMapping . get ( segId ) ; try { dataFileMatadata = CarbonUtil . readMetadatFile ( blockInfo . getFilePath ( ) , blockInfo . getBlockOffset ( ) , blockInfo . getBlockLength ( ) ) ; } catch ( CarbonUtilException e ) { throw new IndexBuilderException ( e ) ; } if ( null == metadataList ) { eachSegmentBlocks . add ( dataFileMatadata ) ; segmentBlockInfoMapping . put ( segId , eachSegmentBlocks ) ; } else { metadataList . add ( dataFileMatadata ) ; } } return segmentBlockInfoMapping ; }
To create a mapping of Segment Id and DataFileFooter.
552
public T add ( T e ) { T oldE = null ; while ( ! buffer . offerLast ( e ) ) { oldE = buffer . poll ( ) ; } return oldE ; }
Adding an element to the circular buffer implies adding the element to the tail of the deque. In doing so, if the capacity of the buffer has been exhausted, then the deque's head should be removed to preserve the circular nature of the buffer. A LinkedBlockingDeque is used because of its concurrent nature and the fact that adding to tail and removing from head are both O(1) operations. The removed head is returned to the caller for reuse.
553
static ArrayList < String > loadImage ( File file ) throws FileNotFoundException , RuntimeException { if ( file == null ) return null ; Scanner sc ; sc = new Scanner ( file ) ; ArrayList < String > rows = new ArrayList < String > ( ) ; String s = sc . nextLine ( ) ; int len = s . length ( ) ; int idx = 1 ; rows . add ( s ) ; while ( sc . hasNext ( ) ) { idx ++ ; s = sc . nextLine ( ) ; if ( s . length ( ) != len ) { sc . close ( ) ; throw new RuntimeException ( "Line " + idx + " only has " + s . length ( ) + " characters (should have " + len + ")" ) ; } rows . add ( s ) ; } sc . close ( ) ; return rows ; }
Helper function to load up images.
554
public static String cutpointsToString ( double [ ] cutPoints , boolean [ ] cutAndLeft ) { StringBuffer text = new StringBuffer ( "" ) ; if ( cutPoints == null ) { text . append ( "\n# no cutpoints found - attribute \n" ) ; } else { text . append ( "\n#* " + cutPoints . length + " cutpoint(s) -\n" ) ; for ( int i = 0 ; i < cutPoints . length ; i ++ ) { text . append ( "# " + cutPoints [ i ] + " " ) ; text . append ( "" + cutAndLeft [ i ] + "\n" ) ; } text . append ( "# end\n" ) ; } return text . toString ( ) ; }
Returns a string representing the cutpoints
555
private static int capacity ( int expectedMaxSize ) { return ( expectedMaxSize > MAXIMUM_CAPACITY / 3 ) ? MAXIMUM_CAPACITY : ( expectedMaxSize <= 2 * MINIMUM_CAPACITY / 3 ) ? MINIMUM_CAPACITY : Integer . highestOneBit ( expectedMaxSize + ( expectedMaxSize << 1 ) ) ; }
Returns the appropriate capacity for the given expected maximum size. Returns the smallest power of two between MINIMUM_CAPACITY and MAXIMUM_CAPACITY, inclusive, that is greater than (3 expectedMaxSize)/2, if such a number exists. Otherwise returns MAXIMUM_CAPACITY.
556
private void resizeNameColumn ( int diff , boolean resizeStatisticPanels ) { if ( diff != 0 ) { if ( nameDim == null ) { nameDim = new Dimension ( DIMENSION_HEADER_ATTRIBUTE_NAME . width + diff , DIMENSION_HEADER_ATTRIBUTE_NAME . height ) ; } else { int newWidth = nameDim . width + diff ; int minWidth = RESIZE_MARGIN_SHRINK ; int maxWidth = columnHeaderPanel . getWidth ( ) - ( DIMENSION_HEADER_MISSINGS . width + DIMENSION_HEADER_TYPE . width + DIMENSION_SEARCH_FIELD . width + RESIZE_MARGIN_ENLARGE ) ; if ( newWidth > maxWidth ) { newWidth = maxWidth ; } if ( newWidth < minWidth ) { newWidth = minWidth ; } nameDim = new Dimension ( newWidth , nameDim . height ) ; } sortingLabelAttName . setMinimumSize ( nameDim ) ; sortingLabelAttName . setPreferredSize ( nameDim ) ; columnHeaderPanel . revalidate ( ) ; columnHeaderPanel . repaint ( ) ; } if ( resizeStatisticPanels ) { revalidateAttributePanels ( ) ; } }
Called when resizing event occurs to resize the attribute name column. Resizing is restricted to a mininmum and a maximum amount depending on the actual size of the header panel.
557
public void copyCheckpointsFromInstallationDirectory ( String destinationCheckpointsFilename ) throws IOException { if ( destinationCheckpointsFilename == null ) { return ; } File destinationCheckpoints = new File ( destinationCheckpointsFilename ) ; if ( ! destinationCheckpoints . exists ( ) ) { File directory = new File ( "." ) ; String currentWorkingDirectory = directory . getCanonicalPath ( ) ; String filePrefix = MultiBitService . getFilePrefix ( ) ; String checkpointsFilename = filePrefix + MultiBitService . CHECKPOINTS_SUFFIX ; String sourceCheckpointsFilename = currentWorkingDirectory + File . separator + checkpointsFilename ; File sourceBlockcheckpoints = new File ( sourceCheckpointsFilename ) ; if ( sourceBlockcheckpoints . exists ( ) && ! destinationCheckpointsFilename . equals ( sourceCheckpointsFilename ) ) { log . info ( "Copying checkpoints from '" + sourceCheckpointsFilename + "' to '" + destinationCheckpointsFilename + "'" ) ; copyFile ( sourceBlockcheckpoints , destinationCheckpoints ) ; long sourceLength = sourceBlockcheckpoints . length ( ) ; long destinationLength = destinationCheckpoints . length ( ) ; if ( sourceLength != destinationLength ) { String errorText = "Checkpoints were not copied to user's application data directory correctly.\nThe source checkpoints '" + sourceCheckpointsFilename + "' is of length " + sourceLength + "\nbut the destination checkpoints '" + destinationCheckpointsFilename + "' is of length " + destinationLength ; log . error ( errorText ) ; throw new FileHandlerException ( errorText ) ; } } } }
To support multiple users on the same machine, the checkpoints file is installed into the program installation directory and is then copied to the user's application data directory when MultiBit is first used. Thus each user has their own copy of the blockchain.
558
public static boolean isValidBedGraphLine ( String line ) { String [ ] bdg = line . split ( "\t" ) ; if ( bdg . length < 4 ) { return false ; } try { Integer . parseInt ( bdg [ 1 ] ) ; Integer . parseInt ( bdg [ 2 ] ) ; } catch ( NumberFormatException e ) { return false ; } return true ; }
Return true if line looks like a valid bedgraph record
559
public boolean checkArguments ( List arguments ) { boolean validArgs = true ; if ( arguments != null && arguments . size ( ) > 0 ) { String specifiedArgs = formatArgs ( arguments ) ; Debug . log ( "MigrateHandler: invalid argument(s) specified - " + specifiedArgs ) ; printConsoleMessage ( LOC_HR_MSG_INVALID_OPTION , new Object [ ] { specifiedArgs } ) ; validArgs = false ; } return validArgs ; }
to make sure that migrate has no additional parameter.
560
public static final void initZK ( ZooKeeper zkc , String selfBrokerUrl ) { try { LocalZooKeeperConnectionService . checkAndCreatePersistNode ( zkc , OWNER_INFO_ROOT ) ; cleanupNamespaceNodes ( zkc , OWNER_INFO_ROOT , selfBrokerUrl ) ; } catch ( Exception e ) { LOG . error ( e . getMessage ( ) , e ) ; throw new RuntimeException ( e ) ; } }
initZK is only called when the NamespaceService is initialized. So, no need for synchronization.
561
public E peekForward ( ) { int nextPos = ( pos + 1 ) % size ; if ( nextPos >= data . size ( ) || pos == end ) { return null ; } return data . get ( nextPos ) ; }
Return the next element (if present), without moving the position in the history.
562
public boolean addAll ( int index , Collection c ) { int numNew = c . size ( ) ; synchronized ( this ) { Object [ ] elements = getArray ( ) ; int len = elements . length ; if ( index > len || index < 0 ) throw new IndexOutOfBoundsException ( "Index: " + index + ", Size: " + len ) ; if ( numNew == 0 ) return false ; int numMoved = len - index ; Object [ ] newElements ; if ( numMoved == 0 ) newElements = copyOf ( elements , len + numNew ) ; else { newElements = new Object [ len + numNew ] ; System . arraycopy ( elements , 0 , newElements , 0 , index ) ; System . arraycopy ( elements , index , newElements , index + numNew , numMoved ) ; } for ( Iterator itr = c . iterator ( ) ; itr . hasNext ( ) ; ) { Object e = itr . next ( ) ; newElements [ index ++ ] = e ; } setArray ( newElements ) ; return true ; } }
Inserts all of the elements in the specified collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in this list in the order that they are returned by the specified collection's iterator.
563
public boolean isCellEditable ( EventObject e ) { if ( e instanceof MouseEvent ) { for ( int counter = getColumnCount ( ) - 1 ; counter >= 0 ; counter -- ) { if ( getColumnClass ( counter ) == TreeTableModel . class ) { MouseEvent me = ( MouseEvent ) e ; MouseEvent newME = new MouseEvent ( tree , me . getID ( ) , me . getWhen ( ) , me . getModifiers ( ) , me . getX ( ) - getCellRect ( 0 , counter , true ) . x , me . getY ( ) , me . getClickCount ( ) , me . isPopupTrigger ( ) ) ; tree . dispatchEvent ( newME ) ; break ; } } } return false ; }
Overridden to return false, and if the event is a mouse event it is forwarded to the tree.<p> The behavior for this is debatable, and should really be offered as a property. By returning false, all keyboard actions are implemented in terms of the table. By returning true, the tree would get a chance to do something with the keyboard events. For the most part this is ok. But for certain keys, such as left/right, the tree will expand/collapse where as the table focus should really move to a different column. Page up/down should also be implemented in terms of the table. By returning false this also has the added benefit that clicking outside of the bounds of the tree node, but still in the tree column will select the row, whereas if this returned true that wouldn't be the case. <p>By returning false we are also enforcing the policy that the tree will never be editable (at least by a key sequence).
564
protected static boolean isValidClassname ( String classname ) { return ( classname . indexOf ( "$" ) == - 1 ) ; }
checks whether the classname is a valid one, i.e., from a public class
565
public static InternalDistributedMember readEssentialData ( DataInput in ) throws IOException , ClassNotFoundException { final InternalDistributedMember mbr = new InternalDistributedMember ( ) ; mbr . _readEssentialData ( in ) ; return mbr ; }
this writes just the parts of the ID that are needed for comparisons and communications
566
private boolean eval ( final int value , final int threshold ) { LOGGER . debug ( "eval: " + value + ", " + threshold ) ; if ( threshold < 0 ) { LOGGER . debug ( value < Math . abs ( threshold ) ) ; return value < Math . abs ( threshold ) ; } else { LOGGER . debug ( value >= Math . abs ( threshold ) ) ; return value >= threshold ; } }
Evaluates the given value against the provided threshold.
567
public String toString ( ) { long ncompleted ; int nworkers , nactive ; final ReentrantLock mainLock = this . mainLock ; mainLock . lock ( ) ; try { ncompleted = completedTaskCount ; nactive = 0 ; nworkers = workers . size ( ) ; for ( Worker w : workers ) { ncompleted += w . completedTasks ; if ( w . isLocked ( ) ) ++ nactive ; } } finally { mainLock . unlock ( ) ; } int c = ctl . get ( ) ; String rs = ( runStateLessThan ( c , SHUTDOWN ) ? "Running" : ( runStateAtLeast ( c , TERMINATED ) ? "Terminated" : "Shutting down" ) ) ; return super . toString ( ) + "[" + rs + ", pool size = " + nworkers + ", active threads = " + nactive + ", queued tasks = " + workQueue . size ( ) + ", completed tasks = " + ncompleted + "]" ; }
Returns a string identifying this pool, as well as its state, including indications of run state and estimated worker and task counts.
568
public static String hex ( float f ) { return Integer . toHexString ( Float . floatToIntBits ( f ) ) ; }
Print a float type's internal bit representation in hex
569
public synchronized Object remove ( int index ) { Object [ ] elements = getArray ( ) ; int len = elements . length ; Object oldValue = elements [ index ] ; int numMoved = len - index - 1 ; if ( numMoved == 0 ) setArray ( copyOf ( elements , len - 1 ) ) ; else { Object [ ] newElements = new Object [ len - 1 ] ; System . arraycopy ( elements , 0 , newElements , 0 , index ) ; System . arraycopy ( elements , index + 1 , newElements , index , numMoved ) ; setArray ( newElements ) ; } return oldValue ; }
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices). Returns the element that was removed from the list.
570
public void testCompositeAttributeCanBeNull ( ) throws Exception { HtmlPage page = getPage ( "/faces/composite/defaultAttributeValueExpression_1986.xhtml" ) ; assertElementAttributeEquals ( page , "WithValueNull:Input" , "value" , "" ) ; assertElementAttributeEquals ( page , "WithValueEmpty:Input" , "value" , "" ) ; }
Test for Issue #1986
571
public static String doubleToString ( double d ) { if ( Double . isInfinite ( d ) || Double . isNaN ( d ) ) { return "null" ; } String string = Double . toString ( d ) ; if ( string . indexOf ( '.' ) > 0 && string . indexOf ( 'e' ) < 0 && string . indexOf ( 'E' ) < 0 ) { while ( string . endsWith ( "0" ) ) { string = string . substring ( 0 , string . length ( ) - 1 ) ; } if ( string . endsWith ( "." ) ) { string = string . substring ( 0 , string . length ( ) - 1 ) ; } } return string ; }
Produce a string from a double. The string "null" will be returned if the number is not finite.
572
@ Override public Enumeration < Option > listOptions ( ) { Vector < Option > result = new Vector < Option > ( 11 ) ; result . addElement ( new Option ( "\tThe minimum threshold. (default -Double.MAX_VALUE)" , "min" , 1 , "-min <double>" ) ) ; result . addElement ( new Option ( "\tThe replacement for values smaller than the minimum threshold.\n" + "\t(default -Double.MAX_VALUE)" , "min-default" , 1 , "-min-default <double>" ) ) ; result . addElement ( new Option ( "\tThe maximum threshold. (default Double.MAX_VALUE)" , "max" , 1 , "-max <double>" ) ) ; result . addElement ( new Option ( "\tThe replacement for values larger than the maximum threshold.\n" + "\t(default Double.MAX_VALUE)" , "max-default" , 1 , "-max-default <double>" ) ) ; result . addElement ( new Option ( "\tThe number values are checked for closeness. (default 0)" , "closeto" , 1 , "-closeto <double>" ) ) ; result . addElement ( new Option ( "\tThe replacement for values that are close to '-closeto'.\n" + "\t(default 0)" , "closeto-default" , 1 , "-closeto-default <double>" ) ) ; result . addElement ( new Option ( "\tThe tolerance below which numbers are considered being close to \n" + "\tto each other. (default 1E-6)" , "closeto-tolerance" , 1 , "-closeto-tolerance <double>" ) ) ; result . addElement ( new Option ( "\tThe number of decimals to round to, -1 means no rounding at all.\n" + "\t(default -1)" , "decimals" , 1 , "-decimals <int>" ) ) ; result . addElement ( new Option ( "\tThe list of columns to cleanse, e.g., first-last or first-3,5-last.\n" + "\t(default first-last)" , "R" , 1 , "-R <col1,col2,...>" ) ) ; result . addElement ( new Option ( "\tInverts the matching sense." , "V" , 0 , "-V" ) ) ; result . addElement ( new Option ( "\tWhether to include the class in the cleansing.\n" + "\tThe class column will always be skipped, if this flag is not\n" + "\tpresent. (default no)" , "include-class" , 0 , "-include-class" ) ) ; result . addAll ( Collections . list ( super . listOptions ( ) ) ) ; return result . elements ( ) ; }
Returns an enumeration describing the available options.
573
public static Vector3 ceil ( Vector3 o ) { return new Vector3 ( Math . ceil ( o . x ) , Math . ceil ( o . y ) , Math . ceil ( o . z ) ) ; }
Rounds the X, Y, and Z values of the given Vector3 up to the nearest integer value.
574
static void importMap ( InputStream is , Map < String , String > m ) throws IOException , InvalidPreferencesFormatException { try { Document doc = loadPrefsDoc ( is ) ; Element xmlMap = doc . getDocumentElement ( ) ; String mapVersion = xmlMap . getAttribute ( "MAP_XML_VERSION" ) ; if ( mapVersion . compareTo ( MAP_XML_VERSION ) > 0 ) throw new InvalidPreferencesFormatException ( "Preferences map file format version " + mapVersion + " is not supported. This java installation can read" + " versions " + MAP_XML_VERSION + " or older. You may need" + " to install a newer version of JDK." ) ; NodeList entries = xmlMap . getChildNodes ( ) ; for ( int i = 0 , numEntries = entries . getLength ( ) ; i < numEntries ; i ++ ) { Element entry = ( Element ) entries . item ( i ) ; m . put ( entry . getAttribute ( "key" ) , entry . getAttribute ( "value" ) ) ; } } catch ( SAXException e ) { throw new InvalidPreferencesFormatException ( e ) ; } }
Import Map from the specified input stream, which is assumed to contain a map document as per the prefs DTD. This is used as the internal (undocumented) format for FileSystemPrefs. The key-value pairs specified in the XML document will be put into the specified Map. (If this Map is empty, it will contain exactly the key-value pairs int the XML-document when this method returns.)
575
public boolean merge ( final Frame < ? extends V > frame , final Interpreter < V > interpreter ) throws AnalyzerException { if ( top != frame . top ) { throw new AnalyzerException ( null , "Incompatible stack heights" ) ; } boolean changes = false ; for ( int i = 0 ; i < locals + top ; ++ i ) { V v = interpreter . merge ( values [ i ] , frame . values [ i ] ) ; if ( ! v . equals ( values [ i ] ) ) { values [ i ] = v ; changes = true ; } } return changes ; }
Merges this frame with the given frame.
576
@ Deprecated protected void wait ( int duration , Runnable callBack ) { executor . schedule ( callBack , duration , TimeUnit . MILLISECONDS ) ; }
Unsafe method since not interruptible. Use at own risk
577
public synchronized void removeOFChannelHandler ( OFChannelHandler h ) { connectedChannelHandlers . remove ( h ) ; }
Remove OFChannelHandler. E.g., due do disconnect.
578
public void clearPieSegments ( ) { mPieSegmentList . clear ( ) ; }
Clears the pie segments list.
579
public void clearCache ( ) { clearMemoryCache ( ) ; clearDiskCache ( ) ; }
Clears both the memory and disk cache associated with this ImageCache object. Note that this includes disk access so this should not be executed on the main/UI thread.
580
public static boolean isBookSearchUrl ( String url ) { return url . startsWith ( "http://google.com/books" ) || url . startsWith ( "http://books.google." ) ; }
Does a given URL point to Google Book Search, regardless of domain.
581
public void removePropertyChangeListener ( PropertyChangeListener pcl ) { m_pcSupport . removePropertyChangeListener ( pcl ) ; }
Remove a property change listener
582
@ SuppressWarnings ( "deprecation" ) protected boolean isFastClockTimeGE ( int hr , int min ) { Date now = fastClock . getTime ( ) ; nowHours = now . getHours ( ) ; nowMinutes = now . getMinutes ( ) ; if ( ( ( nowHours * 60 ) + nowMinutes ) >= ( ( hr * 60 ) + min ) ) { return true ; } return false ; }
This method tests time assuming both times are on the same day (ignoring midnight) It also sets nowMinutes and nowHours to the latest fast clock values
583
private ListResourceBundle loadResourceBundle ( String resourceBundle ) throws MissingResourceException { m_resourceBundleName = resourceBundle ; Locale locale = getLocale ( ) ; ListResourceBundle lrb ; try { ResourceBundle rb = ResourceBundle . getBundle ( m_resourceBundleName , locale ) ; lrb = ( ListResourceBundle ) rb ; } catch ( MissingResourceException e ) { try { lrb = ( ListResourceBundle ) ResourceBundle . getBundle ( m_resourceBundleName , new Locale ( "en" , "US" ) ) ; } catch ( MissingResourceException e2 ) { throw new MissingResourceException ( "Could not load any resource bundles." + m_resourceBundleName , m_resourceBundleName , "" ) ; } } m_resourceBundle = lrb ; return lrb ; }
Return a named ResourceBundle for a particular locale. This method mimics the behavior of ResourceBundle.getBundle().
584
public void testNegPosSameLength ( ) { String numA = "-283746278342837476784564875684767" ; String numB = "293478573489347658763745839457637" ; String res = "-71412358434940908477702819237628" ; BigInteger aNumber = new BigInteger ( numA ) ; BigInteger bNumber = new BigInteger ( numB ) ; BigInteger result = aNumber . xor ( bNumber ) ; assertTrue ( res . equals ( result . toString ( ) ) ) ; }
Xor for two numbers of different signs and the same length
585
public void removeRenamingCallback ( OneSheeldRenamingCallback renamingCallback ) { if ( renamingCallback != null && renamingCallbacks . contains ( renamingCallback ) ) renamingCallbacks . remove ( renamingCallback ) ; }
Remove a renaming callback.
586
public void dispose ( ) { logDebug ( "Disposing." ) ; mSetupDone = false ; if ( mServiceConn != null ) { logDebug ( "Unbinding from service." ) ; if ( mContext != null ) mContext . unbindService ( mServiceConn ) ; } mDisposed = true ; mContext = null ; mServiceConn = null ; mService = null ; mPurchaseListener = null ; }
Dispose of object, releasing resources. It's very important to call this method when you are done with this object. It will release any resources used by it such as service connections. Naturally, once the object is disposed of, it can't be used again.
587
public boolean fillIfLive ( long timeout ) throws IOException { StreamImpl source = _source ; byte [ ] readBuffer = _readBuffer ; if ( readBuffer == null || source == null ) { _readOffset = 0 ; _readLength = 0 ; return false ; } if ( _readOffset > 0 ) { System . arraycopy ( readBuffer , _readOffset , readBuffer , 0 , _readLength - _readOffset ) ; _readLength -= _readOffset ; _readOffset = 0 ; } if ( _readLength == readBuffer . length ) return true ; int readLength = source . readTimeout ( _readBuffer , _readLength , _readBuffer . length - _readLength , timeout ) ; if ( readLength >= 0 ) { _readLength += readLength ; _position += readLength ; if ( _isEnableReadTime ) _readTime = CurrentTime . currentTime ( ) ; return true ; } else if ( readLength == READ_TIMEOUT ) { return true ; } else { return false ; } }
Fills the buffer with a timed read, testing for the end of file. Used for cases like comet to test if the read stream has closed.
588
public ThreadData ( String threadName , String threadState , long cpuTimeInNanoSeconds ) { this . threadName = threadName ; this . threadState = threadState ; this . cpuTimeInNanoSeconds = cpuTimeInNanoSeconds ; }
Instantiates a new thread data.
589
private List < int [ ] > prepareExpectedData ( ) { List < int [ ] > indexList = new ArrayList < > ( 2 ) ; int [ ] sortIndex = { 0 , 3 , 2 , 4 , 1 } ; int [ ] sortIndexInverted = { 0 , 2 , 4 , 1 , 2 } ; indexList . add ( 0 , sortIndex ) ; indexList . add ( 1 , sortIndexInverted ) ; return indexList ; }
Method return the list of sortIndex and sortIndexInverted array
590
protected JFreeChart createChart ( CategoryDataset dataset , String title , MUOM uom ) { JFreeChart chart = ChartFactory . createBarChart3D ( title , " " , " " , dataset , PlotOrientation . VERTICAL , true , true , false ) ; if ( uom == null || uom . isHour ( ) ) { chart = ChartFactory . createBarChart3D ( title , Msg . translate ( Env . getCtx ( ) , "Days" ) , Msg . translate ( Env . getCtx ( ) , "Hours" ) , dataset , PlotOrientation . VERTICAL , true , true , false ) ; } else { chart = ChartFactory . createBarChart3D ( title , Msg . translate ( Env . getCtx ( ) , "Days" ) , Msg . translate ( Env . getCtx ( ) , "Kilo" ) , dataset , PlotOrientation . VERTICAL , true , true , false ) ; } return chart ; }
create Chart using the data set and UOM
591
private ValueGraphVertex findOrCreateVertex ( Register r ) { ValueGraphVertex v = getVertex ( r ) ; if ( v == null ) { v = new ValueGraphVertex ( r ) ; v . setLabel ( r , 0 ) ; graph . addGraphNode ( v ) ; nameMap . put ( r , v ) ; } return v ; }
Find or create an ValueGraphVertex corresponding to a given register
592
public RadiusGraphElementAccessor ( ) { this ( Math . sqrt ( Double . MAX_VALUE - 1000 ) ) ; }
Creates an instance with an effectively infinite default maximum distance.
593
public void removeLatestUpdate ( Password password ) throws PageException { _removeUpdate ( password , true ) ; }
run update from cfml engine
594
public void notifyQueryRunning ( final BoundEntity song ) { synchronized ( mRunningQueries ) { mRunningQueries . add ( song ) ; } }
Notifies an async task has started processing the art for the provided entity
595
public void testBooleanOptions ( ) throws Exception { DatabaseMetaData dbmd = con . getMetaData ( ) ; assertTrue ( "locatorsUpdateCopy" , dbmd . locatorsUpdateCopy ( ) ) ; assertTrue ( "supportsGetGeneratedKeys" , dbmd . supportsGetGeneratedKeys ( ) ) ; assertTrue ( "supportsMultipleOpenResults" , dbmd . supportsMultipleOpenResults ( ) ) ; assertTrue ( "supportsNamedParameters" , dbmd . supportsNamedParameters ( ) ) ; assertFalse ( "supportsResultSetHoldability" , dbmd . supportsResultSetHoldability ( ResultSet . HOLD_CURSORS_OVER_COMMIT ) ) ; assertFalse ( "supportsResultSetHoldability" , dbmd . supportsResultSetHoldability ( ResultSet . CLOSE_CURSORS_AT_COMMIT ) ) ; assertTrue ( "supportsSavepoints" , dbmd . supportsSavepoints ( ) ) ; assertTrue ( "supportsStatementPooling" , dbmd . supportsStatementPooling ( ) ) ; }
Test meta data functions that return boolean values.
596
private static Properties createProperties1 ( ) { Properties props = new Properties ( ) ; props . setProperty ( MCAST_PORT , "0" ) ; props . setProperty ( LOCATORS , "" ) ; return props ; }
create properties for a loner VM
597
public void connected ( ) { final String methodName = "connected" ; log . fine ( CLASS_NAME , methodName , "631" ) ; this . connected = true ; pingSender . start ( ) ; }
Called when the client has successfully connected to the broker
598
protected final boolean tryAcquire ( int acquires ) { final Thread current = Thread . currentThread ( ) ; int c = getState ( ) ; if ( c == 0 ) { if ( ! hasQueuedPredecessors ( ) && compareAndSetState ( 0 , acquires ) ) { setExclusiveOwnerThread ( current ) ; return true ; } } else if ( current == getExclusiveOwnerThread ( ) ) { int nextc = c + acquires ; if ( nextc < 0 ) throw new Error ( "Maximum lock count exceeded" ) ; setState ( nextc ) ; return true ; } return false ; }
Fair version of tryAcquire. Don't grant access unless recursive call or no waiters or is first.
599
static float rotateX ( float pX , float pY , float cX , float cY , float angleInDegrees ) { double angle = Math . toRadians ( angleInDegrees ) ; return ( float ) ( Math . cos ( angle ) * ( pX - cX ) - Math . sin ( angle ) * ( pY - cY ) + cX ) ; }
Rotate point P around center point C.