idx
int64
0
34.9k
question
stringlengths
12
26.4k
target
stringlengths
15
2.3k
34,700
public static void o ( Zmat A ) { o ( A , Parameters . OutputFieldWidth , Parameters . OutputFracPlaces ) ; }
Prints a <tt>Zmat<tt> in default e format.
34,701
private void calculateMaxValue ( int seriesCount , int catCount ) { double v ; Number nV ; for ( int seriesIndex = 0 ; seriesIndex < seriesCount ; seriesIndex ++ ) { for ( int catIndex = 0 ; catIndex < catCount ; catIndex ++ ) { nV = getPlotValue ( seriesIndex , catIndex ) ; if ( nV != null ) { v = nV . doubleValue ( ) ; if ( v > this . maxValue ) { this . maxValue = v ; } } } } }
loop through each of the series to get the maximum value on each category axis
34,702
private void generateLegalTimesTree ( ) { int k0 = KeyEvent . KEYCODE_0 ; int k1 = KeyEvent . KEYCODE_1 ; int k2 = KeyEvent . KEYCODE_2 ; int k3 = KeyEvent . KEYCODE_3 ; int k4 = KeyEvent . KEYCODE_4 ; int k5 = KeyEvent . KEYCODE_5 ; int k6 = KeyEvent . KEYCODE_6 ; int k7 = KeyEvent . KEYCODE_7 ; int k8 = KeyEvent . KEYCODE_8 ; int k9 = KeyEvent . KEYCODE_9 ; mLegalTimesTree = new Node ( ) ; if ( mIs24HourMode ) { Node minuteFirstDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 ) ; Node minuteSecondDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; minuteFirstDigit . addChild ( minuteSecondDigit ) ; Node firstDigit = new Node ( k0 , k1 ) ; mLegalTimesTree . addChild ( firstDigit ) ; Node secondDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 ) ; firstDigit . addChild ( secondDigit ) ; secondDigit . addChild ( minuteFirstDigit ) ; Node thirdDigit = new Node ( k6 , k7 , k8 , k9 ) ; secondDigit . addChild ( thirdDigit ) ; secondDigit = new Node ( k6 , k7 , k8 , k9 ) ; firstDigit . addChild ( secondDigit ) ; secondDigit . addChild ( minuteFirstDigit ) ; firstDigit = new Node ( k2 ) ; mLegalTimesTree . addChild ( firstDigit ) ; secondDigit = new Node ( k0 , k1 , k2 , k3 ) ; firstDigit . addChild ( secondDigit ) ; secondDigit . addChild ( minuteFirstDigit ) ; secondDigit = new Node ( k4 , k5 ) ; firstDigit . addChild ( secondDigit ) ; secondDigit . addChild ( minuteSecondDigit ) ; firstDigit = new Node ( k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; mLegalTimesTree . addChild ( firstDigit ) ; firstDigit . addChild ( minuteFirstDigit ) ; } else { Node ampm = new Node ( getAmOrPmKeyCode ( HALF_DAY_1 ) , getAmOrPmKeyCode ( HALF_DAY_2 ) ) ; Node firstDigit = new Node ( k1 ) ; mLegalTimesTree . addChild ( firstDigit ) ; firstDigit . addChild ( ampm ) ; Node secondDigit = new Node ( k0 , k1 , k2 ) ; firstDigit . addChild ( secondDigit ) ; secondDigit . addChild ( ampm ) ; Node thirdDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 ) ; secondDigit . addChild ( thirdDigit ) ; thirdDigit . addChild ( ampm ) ; Node fourthDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; thirdDigit . addChild ( fourthDigit ) ; fourthDigit . addChild ( ampm ) ; thirdDigit = new Node ( k6 , k7 , k8 , k9 ) ; secondDigit . addChild ( thirdDigit ) ; thirdDigit . addChild ( ampm ) ; secondDigit = new Node ( k3 , k4 , k5 ) ; firstDigit . addChild ( secondDigit ) ; thirdDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; secondDigit . addChild ( thirdDigit ) ; thirdDigit . addChild ( ampm ) ; firstDigit = new Node ( k2 , k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; mLegalTimesTree . addChild ( firstDigit ) ; firstDigit . addChild ( ampm ) ; secondDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 ) ; firstDigit . addChild ( secondDigit ) ; thirdDigit = new Node ( k0 , k1 , k2 , k3 , k4 , k5 , k6 , k7 , k8 , k9 ) ; secondDigit . addChild ( thirdDigit ) ; thirdDigit . addChild ( ampm ) ; } }
Create a tree for deciding what keys can legally be typed.
34,703
public static void println ( StringBuilder buf , int width , String data , String indent ) { for ( String line : FormatUtil . splitAtLastBlank ( data , width - indent . length ( ) ) ) { buf . append ( indent ) ; buf . append ( line ) ; if ( ! line . endsWith ( FormatUtil . NEWLINE ) ) { buf . append ( FormatUtil . NEWLINE ) ; } } }
Simple writing helper with no indentation.
34,704
public boolean isMuted ( ) { if ( mMuteControl != null ) { return mMuteControl . getValue ( ) ; } return false ; }
Current mute state for this audio output channel
34,705
void extras ( ) { }
Hook to allow sub-types to install more items in GUI
34,706
public Item ( String name , String typeId ) { if ( name != null ) { this . name = name . replaceAll ( "\\s" , " " ) ; } if ( typeId != null && typeId . length ( ) > 0 ) { this . typeId = Integer . valueOf ( typeId ) ; } itemMap = new TreeMap < Integer , IItem > ( ) ; }
Creates an item with the given name and type id. Creates an empty tree map to store items
34,707
public String toString ( ) { StringBuffer result = new StringBuffer ( "CharClasses:" ) ; result . append ( Out . NL ) ; for ( int i = 0 ; i < classes . size ( ) ; i ++ ) result . append ( "class " + i + ":" + Out . NL + classes . elementAt ( i ) + Out . NL ) ; return result . toString ( ) ; }
Return a string representation of the char classes stored in this class. Enumerates the classes by index.
34,708
public static < E extends Enum < E > & BitmapableEnum > EnumSet < E > toEnumSet ( Class < E > type , int bitmap ) { if ( type == null ) throw new NullPointerException ( "Given enum type must not be null" ) ; EnumSet < E > s = EnumSet . noneOf ( type ) ; int allSetBitmap = 0 ; for ( E element : type . getEnumConstants ( ) ) { if ( Integer . bitCount ( element . getValue ( ) ) != 1 ) { String msg = String . format ( "The %s (%x) constant of the " + "enum %s is supposed to represent a bitmap entry but " + "has more than one bit set." , element . toString ( ) , element . getValue ( ) , type . getName ( ) ) ; throw new IllegalArgumentException ( msg ) ; } allSetBitmap |= element . getValue ( ) ; if ( ( bitmap & element . getValue ( ) ) != 0 ) s . add ( element ) ; } if ( ( ( ~ allSetBitmap ) & bitmap ) != 0 ) { String msg = String . format ( "The bitmap %x for enum %s has " + "bits set that are presented by any enum constant" , bitmap , type . getName ( ) ) ; throw new IllegalArgumentException ( msg ) ; } return s ; }
Convert an integer bitmap to an EnumSet. See class description for example
34,709
private List < Tuple2 < Long , BigInteger > > processTupleFromPartitionDataBolt ( Tuple tuple ) { matrixElements . clear ( ) ; int rowIndex = tuple . getIntegerByField ( StormConstants . HASH_FIELD ) ; if ( ! colIndexByRow . containsKey ( rowIndex ) ) { colIndexByRow . put ( rowIndex , 0 ) ; hitsByRow . put ( rowIndex , 0 ) ; } if ( splitPartitions ) { dataArray . add ( ( BigInteger ) tuple . getValueByField ( StormConstants . PARTIONED_DATA_FIELD ) ) ; } else { dataArray = ( ArrayList < BigInteger > ) tuple . getValueByField ( StormConstants . PARTIONED_DATA_FIELD ) ; } logger . debug ( "Retrieving {} elements in EncRowCalcBolt." , dataArray . size ( ) ) ; try { int colIndex = colIndexByRow . get ( rowIndex ) ; int numRecords = hitsByRow . get ( rowIndex ) ; if ( limitHitsPerSelector && numRecords < maxHitsPerSelector ) { logger . debug ( "computing matrix elements." ) ; matrixElements = ComputeEncryptedRow . computeEncRow ( dataArray , query , rowIndex , colIndex ) ; colIndexByRow . put ( rowIndex , colIndex + matrixElements . size ( ) ) ; hitsByRow . put ( rowIndex , numRecords + 1 ) ; } else if ( limitHitsPerSelector ) { logger . info ( "maxHits: rowIndex = " + rowIndex + " elementCounter = " + numRecords ) ; } } catch ( IOException e ) { logger . warn ( "Caught IOException while encrypting row. " , e ) ; } dataArray . clear ( ) ; return matrixElements ; }
Extracts (hash, data partitions) from tuple. Encrypts the data partitions. Returns all of the pairs of (col index, col value). Also advances the colIndexByRow and hitsByRow appropriately.
34,710
public String compress ( String imageUri , boolean deleteSourceImage ) { String compressUri = compressImage ( imageUri ) ; if ( deleteSourceImage ) { File source = new File ( getRealPathFromURI ( imageUri ) ) ; if ( source . exists ( ) ) { boolean isdeleted = source . delete ( ) ; Log . d ( LOG_TAG , ( isdeleted ) ? "SourceImage File deleted" : "SourceImage File not deleted" ) ; } } return compressUri ; }
Compresses the image at the specified Uri String and and return the filepath of the compressed image.
34,711
public static PluginsCollectionConfig fromXml ( final InputStream toConvert ) throws JAXBException { Unmarshaller stringUnmarshaller = getUnmarshaller ( ) ; return ( PluginsCollectionConfig ) stringUnmarshaller . unmarshal ( toConvert ) ; }
Converts XML file to PluginsCollectionConfig,
34,712
public RuleCharacterIterator ( String text , SymbolTable sym , ParsePosition pos ) { if ( text == null || pos . getIndex ( ) > text . length ( ) ) { throw new IllegalArgumentException ( ) ; } this . text = text ; this . sym = sym ; this . pos = pos ; buf = null ; }
Constructs an iterator over the given text, starting at the given position.
34,713
private void ensureCapacity ( int n ) { if ( n <= 0 ) { return ; } int max ; if ( data == null || data . length == 0 ) { max = 25 ; } else if ( data . length >= n * 5 ) { return ; } else { max = data . length ; } while ( max < n * 5 ) { max *= 2 ; } String newData [ ] = new String [ max ] ; if ( length > 0 ) { System . arraycopy ( data , 0 , newData , 0 , length * 5 ) ; } data = newData ; }
Ensure the internal array's capacity.
34,714
public synchronized void flush ( ) throws IOException { checkNotClosed ( ) ; trimToSize ( ) ; journalWriter . flush ( ) ; }
Force buffered operations to the filesystem.
34,715
public void testConstrStringException ( ) { String a = "-238768.787678287a+10" ; try { BigDecimal bd = new BigDecimal ( a ) ; fail ( "NumberFormatException has not been caught: " + bd . toString ( ) ) ; } catch ( NumberFormatException e ) { } }
new BigDecimal(String value) when value is not a valid representation of BigDecimal.
34,716
public Process ( final URL url ) throws IOException , XMLException { initContext ( ) ; Reader in = new InputStreamReader ( WebServiceTools . openStreamFromURL ( url ) , getEncoding ( null ) ) ; readProcess ( in ) ; in . close ( ) ; }
Reads an process configuration from the given URL.
34,717
void firePropertyChange ( PropertyChangeEvent evt ) { for ( PropertyChangeListener l : listenerList . getListeners ( PropertyChangeListener . class ) ) { l . propertyChange ( evt ) ; } }
Fire a property change from this object
34,718
public static PrivateKey privateKeyFromPkcs8 ( String privateKeyPem ) throws IOException { StringReader reader = new StringReader ( privateKeyPem ) ; Section section = PemReader . readFirstSectionAndClose ( reader , PRIVATE_KEY ) ; if ( section == null ) { throw new IOException ( "Invalid PKCS8 data." ) ; } try { byte [ ] decodedKey = section . getBase64DecodedBytes ( ) ; PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec ( decodedKey ) ; KeyFactory keyFactory = SecurityUtils . getRsaKeyFactory ( ) ; return keyFactory . generatePrivate ( keySpec ) ; } catch ( Exception e ) { throw new IOException ( "Unexpected exception reading PKCS data" , e ) ; } }
The method validates an input string of private key and generate a java PrivateKey object. The method is non-blocking.
34,719
public static Set < String > assertValidProtocols ( Set < String > expected , String [ ] protocols ) { assertNotNull ( protocols ) ; assertTrue ( protocols . length != 0 ) ; Set remainingProtocols = new HashSet < String > ( expected ) ; Set unknownProtocols = new HashSet < String > ( ) ; for ( String protocol : protocols ) { if ( ! remainingProtocols . remove ( protocol ) ) { unknownProtocols . add ( protocol ) ; } } assertEquals ( "Unknown protocols" , Collections . EMPTY_SET , unknownProtocols ) ; return remainingProtocols ; }
Asserts that the protocols array is non-null and that it all of its contents are protocols known to this implementation. As a convenience, returns any unenabled protocols in a test for those that want to verify separately that all protocols were included.
34,720
private float [ ] calculatePointerPosition ( float angle ) { float x = ( float ) ( mColorWheelRadius * Math . cos ( angle ) ) ; float y = ( float ) ( mColorWheelRadius * Math . sin ( angle ) ) ; return new float [ ] { x , y } ; }
Calculate the pointer's coordinates on the color wheel using the supplied angle.
34,721
public static void d ( String tag , String msg , Object ... args ) { if ( sLevel > LEVEL_DEBUG ) { return ; } if ( args . length > 0 ) { msg = String . format ( msg , args ) ; } Log . d ( tag , msg ) ; }
Send a DEBUG log message
34,722
String namedForThisSegment ( String file ) { return name + IndexFileNames . stripSegmentName ( file ) ; }
strips any segment name from the file, naming it with this segment this is because "segment names" can change, e.g. by addIndexes(Dir)
34,723
Callbacks tryGetCallbacks ( Callbacks oldCallbacks ) { synchronized ( mLock ) { if ( mStopped ) { return null ; } if ( mCallbacks == null ) { return null ; } final Callbacks callbacks = mCallbacks . get ( ) ; if ( callbacks != oldCallbacks ) { return null ; } if ( callbacks == null ) { Log . w ( TAG , "no mCallbacks" ) ; return null ; } return callbacks ; } }
Gets the callbacks object. If we've been stopped, or if the launcher object has somehow been garbage collected, return null instead. Pass in the Callbacks object that was around when the deferred message was scheduled, and if there's a new Callbacks object around then also return null. This will save us from calling onto it with data that will be ignored.
34,724
public static String arrayCombine ( String [ ] list , char separatorChar ) { StatementBuilder buff = new StatementBuilder ( ) ; for ( String s : list ) { buff . appendExceptFirst ( String . valueOf ( separatorChar ) ) ; if ( s == null ) { s = "" ; } for ( int j = 0 , length = s . length ( ) ; j < length ; j ++ ) { char c = s . charAt ( j ) ; if ( c == '\\' || c == separatorChar ) { buff . append ( '\\' ) ; } buff . append ( c ) ; } } return buff . toString ( ) ; }
Combine an array of strings to one array using the given separator character. A backslash and the separator character and escaped using a backslash.
34,725
protected static final void checkOffset ( int offset , CharacterIterator text ) { if ( offset < text . getBeginIndex ( ) || offset > text . getEndIndex ( ) ) { throw new IllegalArgumentException ( "offset out of bounds" ) ; } }
Throw IllegalArgumentException unless begin <= offset < end.
34,726
private synchronized void pauseTrackDataHub ( ) { if ( trackDataHub != null ) { trackDataHub . unregisterTrackDataListener ( this ) ; } trackDataHub = null ; }
Pauses the trackDataHub. Needs to be synchronized because the trackDataHub can be accessed by multiple threads.
34,727
@ Override public void writeExternal ( ObjectOutput out ) throws IOException { super . writeExternal ( out ) ; out . writeInt ( DBIDUtil . asInteger ( routingObjectID ) ) ; out . writeDouble ( parentDistance ) ; out . writeDouble ( coveringRadius ) ; }
Calls the super method and writes the routingObjectID, the parentDistance and the coveringRadius of this entry to the specified stream.
34,728
public static String termFromResult ( String result ) { String [ ] parts = result . split ( ":" ) ; if ( parts . length != 2 ) return null ; return parts [ 1 ] ; }
Get a term from a search results line.
34,729
@ Nullable private File [ ] listFiles0 ( IgfsPath path ) { File f = fileForPath ( path ) ; if ( ! f . exists ( ) ) throw new IgfsPathNotFoundException ( "Failed to list files (path not found): " + path ) ; else return f . listFiles ( ) ; }
Returns an array of File object. Under the specific path.
34,730
private void step1 ( ) { final SpeakerNPC npc = npcs . get ( "Finn Farmer" ) ; npc . add ( ConversationStates . ATTENDING , ConversationPhrases . QUEST_MESSAGES , new QuestInStateCondition ( QUEST_SLOT , QUEST_INDEX_STATUS , "deliver_to_george" ) , ConversationStates . ATTENDING , "Thank you for agreeing to tell George this message:" , new SayTextAction ( "[quest.coded_message:1]" ) ) ; npc . add ( ConversationStates . ATTENDING , ConversationPhrases . QUEST_MESSAGES , new AndCondition ( new QuestNotActiveCondition ( QUEST_SLOT ) , new NotCondition ( new TimeReachedCondition ( QUEST_SLOT , QUEST_INDEX_TIME ) ) ) , ConversationStates . ATTENDING , "Perhaps, I have another message tomorrow." , null ) ; npc . add ( ConversationStates . ATTENDING , ConversationPhrases . QUEST_MESSAGES , new AndCondition ( new QuestNotActiveCondition ( QUEST_SLOT ) , new TimeReachedCondition ( QUEST_SLOT , QUEST_INDEX_TIME ) ) , ConversationStates . QUEST_OFFERED , "I have an urgent message for #George! It's really important! But my parents don't let me wander around the city alone. As if I were a small kid! Could you please deliver a message to him?" , null ) ; npc . add ( ConversationStates . QUEST_OFFERED , "george" , null , ConversationStates . QUEST_OFFERED , "Just find Tommy. Perhaps in Ados Park. George won't be far away. Could you please deliver a message to him?" , null ) ; npc . add ( ConversationStates . QUEST_OFFERED , ConversationPhrases . NO_MESSAGES , ConversationStates . IDLE , "Okay, then I better don't tell you no secrets." , new MultipleActions ( new DecreaseKarmaAction ( 10 ) , new SetQuestAction ( QUEST_SLOT , QUEST_INDEX_STATUS , "rejected" ) ) ) ; npc . add ( ConversationStates . QUEST_OFFERED , ConversationPhrases . YES_MESSAGES , ConversationStates . ATTENDING , null , new MultipleActions ( new CreateAndSayCodedMessage ( ) , new SetQuestAction ( QUEST_SLOT , QUEST_INDEX_STATUS , "deliver_to_george" ) ) ) ; }
prepare Finn Farmer to start the quest
34,731
private synchronized void block ( boolean tf ) { if ( tf ) { try { if ( m_splitThread . isAlive ( ) ) { wait ( ) ; } } catch ( InterruptedException ex ) { } } else { notifyAll ( ) ; } }
Function used to stop code that calls acceptDataSet. This is needed as split is performed inside a separate thread of execution.
34,732
public void putElements ( K key , Set < E > elements ) { synchronized ( this ) { removeKey ( key ) ; if ( ! elements . isEmpty ( ) ) { for ( E element : elements ) { addElement ( key , element ) ; } } } }
Sets the elements corresponding to a particular key. The existing set for that key (if it exists) is cleared.
34,733
public void comment ( char ch [ ] , int start , int length ) throws org . xml . sax . SAXException { if ( ch == null || start < 0 || length >= ( ch . length - start ) || length < 0 ) return ; append ( m_doc . createComment ( new String ( ch , start , length ) ) ) ; }
Report an XML comment anywhere in the document. This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read).
34,734
private void throttleLoopOnException ( ) { long now = System . currentTimeMillis ( ) ; if ( lastExceptionTime == 0L || ( now - lastExceptionTime ) > 5000 ) { lastExceptionTime = now ; recentExceptionCount = 0 ; } else { if ( ++ recentExceptionCount >= 10 ) { try { Thread . sleep ( 10000 ) ; } catch ( InterruptedException ignore ) { } } } }
Throttles the accept loop after an exception has been caught: if a burst of 10 exceptions in 5 seconds occurs, then wait for 10 seconds to curb busy CPU usage.
34,735
public static boolean createNormal ( Vector3 norm , ReadOnlyVector3 v0 , ReadOnlyVector3 v1 , ReadOnlyVector3 v2 ) { if ( Double . isNaN ( v0 . getZ ( ) ) || Double . isNaN ( v1 . getZ ( ) ) || Double . isNaN ( v2 . getZ ( ) ) ) { norm . set ( 0 , 0 , 0 ) ; return ( false ) ; } Vector3 work = Vector3 . fetchTempInstance ( ) ; norm . set ( v1 ) ; norm . subtractLocal ( v0 ) ; work . set ( v2 ) ; work . subtractLocal ( v0 ) ; norm . crossLocal ( work ) ; norm . normalizeLocal ( ) ; Vector3 . releaseTempInstance ( work ) ; return ( true ) ; }
Given three points, create the normal for the plane they define.
34,736
public ConsoleUser ( ) { this ( new PrintWriter ( System . out ) , new InputStreamReader ( System . in ) , ResourceBundle . getBundle ( LICENSE_PROPERTIES ) ) ; }
Constructs a CLI using the process standard input and output streams and the default license resource bundle for message localisation.
34,737
public static String formatQuantity ( Integer quantity ) { if ( quantity == null ) return "" ; else return formatQuantity ( quantity . doubleValue ( ) ) ; }
Formats an Integer representing a quantity into a string
34,738
public final void onBeforeStart ( ) { if ( ! startedFlag . compareAndSet ( false , true ) ) throw new IllegalStateException ( "SPI has already been started " + "(always create new configuration instance for each starting Ignite instances) " + "[spi=" + this + ']' ) ; }
This method is called by built-in managers implementation to avoid repeating SPI start attempts.
34,739
public void onEvent ( final DisruptorReferringEventEntry eventEntryWrap , final long sequence , final boolean endOfBatch ) throws Exception { EventEntryImpl eventEntry = eventEntryWrap . delegate ; onEvent ( eventEntry , sequence , endOfBatch ) ; }
Consumes the events off the ring buffer
34,740
public static void checkClassSignature ( final String signature ) { int pos = 0 ; if ( getChar ( signature , 0 ) == '<' ) { pos = checkFormalTypeParameters ( signature , pos ) ; } pos = checkClassTypeSignature ( signature , pos ) ; while ( getChar ( signature , pos ) == 'L' ) { pos = checkClassTypeSignature ( signature , pos ) ; } if ( pos != signature . length ( ) ) { throw new IllegalArgumentException ( signature + ": error at index " + pos ) ; } }
Checks a class signature.
34,741
public static Tuple median ( TupleSet tuples , String field , Comparator cmp ) { if ( tuples instanceof Table ) { Table table = ( Table ) tuples ; ColumnMetadata md = table . getMetadata ( field ) ; return table . getTuple ( md . getMedianRow ( ) ) ; } else { return median ( tuples . tuples ( ) , field , cmp ) ; } }
Get the Tuple with the median data field value.
34,742
public void removeEntry ( SSOToken token , String entryDN , int objectType , boolean recursive , boolean softDelete ) throws AMException , SSOException { if ( debug . messageEnabled ( ) ) { debug . message ( "DirectoryServicesImpl.removeEntry(): Removing: " + entryDN + " & recursive: " + recursive ) ; } if ( recursive ) { removeSubtree ( token , entryDN , softDelete ) ; } else { removeSingleEntry ( token , entryDN , objectType , softDelete ) ; } if ( objectType == AMObject . ORGANIZATION && ServiceManager . isCoexistenceMode ( ) && ServiceManager . isRealmEnabled ( ) ) { try { OrganizationConfigManager ocm = new OrganizationConfigManager ( token , entryDN ) ; ocm . deleteSubOrganization ( null , recursive ) ; } catch ( SMSException smse ) { if ( debug . messageEnabled ( ) ) { debug . message ( "DirectoryServicesImpl::removeEntry " + "unable to delete corresponding realm: " + entryDN ) ; } } } }
Remove an entry from the directory.
34,743
public List < Struct > listTraitDefinitions ( final String guid ) throws AtlasServiceException { JSONObject jsonResponse = callAPI ( API . GET_ALL_TRAIT_DEFINITIONS , null , guid , TRAIT_DEFINITIONS ) ; List < JSONObject > traitDefList = extractResults ( jsonResponse , AtlasClient . RESULTS , new ExtractOperation < JSONObject , JSONObject > ( ) ) ; ArrayList < Struct > traitStructList = new ArrayList < > ( ) ; for ( JSONObject traitDef : traitDefList ) { Struct traitStruct = InstanceSerialization . fromJsonStruct ( traitDef . toString ( ) , true ) ; traitStructList . add ( traitStruct ) ; } return traitStructList ; }
Get all trait definitions for an entity
34,744
public final boolean is_connected_on_layer ( int p_layer ) { Collection < BrdItem > contacts_on_layer = get_all_contacts ( p_layer ) ; return ( contacts_on_layer . size ( ) > 0 ) ; }
Checks, if this item is electrically connected to another connectable item on the input layer. Returns false for items, which are not connectable.
34,745
public void showContent ( ) { switchState ( CONTENT , null , null , null , null , null , Collections . < Integer > emptyList ( ) ) ; }
Hide all other states and show content
34,746
protected void addItem ( JPanel p , JComponent c , int x , int y ) { GridBagConstraints gc = new GridBagConstraints ( ) ; gc . gridx = x ; gc . gridy = y ; gc . weightx = 100.0 ; gc . weighty = 100.0 ; p . add ( c , gc ) ; }
add item to a panel
34,747
public static void verify ( final ClassReader cr , final boolean dump , final PrintWriter pw ) { verify ( cr , null , dump , pw ) ; }
Checks a given class
34,748
public SharedDataIteratorSource ( Object identifier , ISourceDataIteratorProvider < T > sourceDataIteratorProvider , long timeToLive ) { if ( sourceDataIteratorProvider == null ) throw new IllegalArgumentException ( "sourceDataIteratorProvider cannot be null" ) ; _identifier = identifier ; _sourceDataIteratorProvider = sourceDataIteratorProvider ; _timeToLive = timeToLive ; _createdTime = SystemTime . timeMillis ( ) ; }
Construct a new source
34,749
private void buildSubgraphs ( List subgraphList , PolygonBuilder polyBuilder ) { List processedGraphs = new ArrayList ( ) ; for ( Iterator i = subgraphList . iterator ( ) ; i . hasNext ( ) ; ) { BufferSubgraph subgraph = ( BufferSubgraph ) i . next ( ) ; Coordinate p = subgraph . getRightmostCoordinate ( ) ; SubgraphDepthLocater locater = new SubgraphDepthLocater ( processedGraphs ) ; int outsideDepth = locater . getDepth ( p ) ; subgraph . computeDepth ( outsideDepth ) ; subgraph . findResultEdges ( ) ; processedGraphs . add ( subgraph ) ; polyBuilder . add ( subgraph . getDirectedEdges ( ) , subgraph . getNodes ( ) ) ; } }
Completes the building of the input subgraphs by depth-labelling them, and adds them to the PolygonBuilder. The subgraph list must be sorted in rightmost-coordinate order.
34,750
public static _Fields findByThriftId ( int fieldId ) { switch ( fieldId ) { case 1 : return TIMESTAMP ; case 2 : return VALUE ; case 3 : return HOST ; default : return null ; } }
Find the _Fields constant that matches fieldId, or null if its not found.
34,751
public static StringBuilder makeWhereStringFromFields ( StringBuilder sb , List < ModelField > modelFields , Map < String , Object > fields , String operator , List < EntityConditionParam > entityConditionParams ) { if ( modelFields . size ( ) < 1 ) { return sb ; } Iterator < ModelField > iter = modelFields . iterator ( ) ; while ( iter . hasNext ( ) ) { Object item = iter . next ( ) ; Object name = null ; ModelField modelField = null ; if ( item instanceof ModelField ) { modelField = ( ModelField ) item ; sb . append ( modelField . getColValue ( ) ) ; name = modelField . getName ( ) ; } else { sb . append ( item ) ; name = item ; } Object fieldValue = fields . get ( name ) ; if ( fieldValue != null && fieldValue != GenericEntity . NULL_FIELD ) { sb . append ( '=' ) ; addValue ( sb , modelField , fieldValue , entityConditionParams ) ; } else { sb . append ( " IS NULL" ) ; } if ( iter . hasNext ( ) ) { sb . append ( ' ' ) ; sb . append ( operator ) ; sb . append ( ' ' ) ; } } return sb ; }
Makes a WHERE clause String with "<col name>=?" if not null or "<col name> IS null" if null, all AND separated
34,752
public static void decodeToString ( byte [ ] from , int location , int precision , int scale , AkibanAppender appender ) { final int intCount = precision - scale ; final int intFull = intCount / DECIMAL_DIGIT_PER ; final int intPartial = intCount % DECIMAL_DIGIT_PER ; final int fracFull = scale / DECIMAL_DIGIT_PER ; final int fracPartial = scale % DECIMAL_DIGIT_PER ; int curOff = location ; final int mask = ( from [ curOff ] & 0x80 ) != 0 ? 0 : - 1 ; from [ curOff ] ^= 0x80 ; if ( mask != 0 ) appender . append ( '-' ) ; boolean hadOutput = false ; if ( intPartial != 0 ) { int count = DECIMAL_BYTE_DIGITS [ intPartial ] ; int x = unpackIntegerByWidth ( count , from , curOff ) ^ mask ; curOff += count ; if ( x != 0 ) { hadOutput = true ; appender . append ( x ) ; } } for ( int i = 0 ; i < intFull ; ++ i ) { int x = unpackIntegerByWidth ( DECIMAL_TYPE_SIZE , from , curOff ) ^ mask ; curOff += DECIMAL_TYPE_SIZE ; if ( hadOutput ) { appender . append ( String . format ( "%09d" , x ) ) ; } else if ( x != 0 ) { hadOutput = true ; appender . append ( x ) ; } } if ( fracFull + fracPartial > 0 ) { if ( hadOutput ) { appender . append ( '.' ) ; } else { appender . append ( "0." ) ; } } else if ( ! hadOutput ) appender . append ( '0' ) ; for ( int i = 0 ; i < fracFull ; ++ i ) { int x = unpackIntegerByWidth ( DECIMAL_TYPE_SIZE , from , curOff ) ^ mask ; curOff += DECIMAL_TYPE_SIZE ; appender . append ( String . format ( "%09d" , x ) ) ; } if ( fracPartial != 0 ) { int count = DECIMAL_BYTE_DIGITS [ fracPartial ] ; int x = unpackIntegerByWidth ( count , from , curOff ) ^ mask ; int width = scale - ( fracFull * DECIMAL_DIGIT_PER ) ; appender . append ( String . format ( "%0" + width + "d" , x ) ) ; } from [ location ] ^= 0x80 ; }
Decodes bytes representing the decimal value into the given AkibanAppender.
34,753
private int assertPivotCountsAreCorrect ( String pivotName , SolrParams baseParams , PivotField constraint ) throws SolrServerException { SolrParams p = SolrParams . wrapAppended ( baseParams , params ( "fq" , buildFilter ( constraint ) ) ) ; List < PivotField > subPivots = null ; try { assertPivotData ( pivotName , constraint , p ) ; subPivots = constraint . getPivot ( ) ; } catch ( Exception e ) { throw new RuntimeException ( pivotName + ": count query failed: " + p + ": " + e . getMessage ( ) , e ) ; } int depth = 0 ; if ( null != subPivots ) { assertTraceOk ( pivotName , baseParams , subPivots ) ; for ( PivotField subPivot : subPivots ) { depth = assertPivotCountsAreCorrect ( pivotName , p , subPivot ) ; } } return depth + 1 ; }
Recursive Helper method for asserting that pivot constraint counts match results when filtering on those constraints. Returns the recursive depth reached (for sanity checking)
34,754
public static long availableMemory ( ) { return RUNTIME . freeMemory ( ) + ( RUNTIME . maxMemory ( ) - RUNTIME . totalMemory ( ) ) ; }
Returns the amount of available memory (free memory plus never allocated memory).
34,755
public void add ( Number number ) { elements . add ( number == null ? JsonNull . INSTANCE : new JsonPrimitive ( number ) ) ; }
Adds the specified number to self.
34,756
public void add ( String feats ) { if ( feats == null ) return ; String key , value ; int idx ; for ( String feat : Splitter . splitPipes ( feats ) ) { idx = feat . indexOf ( DELIM_KEY_VALUE ) ; if ( idx > 0 ) { key = feat . substring ( 0 , idx ) ; value = feat . substring ( idx + 1 ) ; put ( key , value ) ; } } }
Adds the specific features to this map.
34,757
@ Override public int hashCode ( ) { return dateTime . hashCode ( ) ^ offset . hashCode ( ) ^ Integer . rotateLeft ( zone . hashCode ( ) , 3 ) ; }
A hash code for this date-time.
34,758
public void copyInto ( E [ ] array , int offset ) { long finalOffset = offset + count ( ) ; if ( finalOffset > array . length || finalOffset < offset ) { throw new IndexOutOfBoundsException ( "does not fit" ) ; } if ( spineIndex == 0 ) System . arraycopy ( curChunk , 0 , array , offset , elementIndex ) ; else { for ( int i = 0 ; i < spineIndex ; i ++ ) { System . arraycopy ( spine [ i ] , 0 , array , offset , spine [ i ] . length ) ; offset += spine [ i ] . length ; } if ( elementIndex > 0 ) System . arraycopy ( curChunk , 0 , array , offset , elementIndex ) ; } }
Copy the elements, starting at the specified offset, into the specified array.
34,759
public void writeTo ( DataOutput out ) throws IOException { out . writeInt ( typeId ) ; U . writeString ( out , typeName ) ; if ( fields == null ) out . writeInt ( - 1 ) ; else { out . writeInt ( fields . size ( ) ) ; for ( Map . Entry < String , Integer > fieldEntry : fields . entrySet ( ) ) { U . writeString ( out , fieldEntry . getKey ( ) ) ; out . writeInt ( fieldEntry . getValue ( ) ) ; } } U . writeString ( out , affKeyFieldName ) ; if ( schemas == null ) out . writeInt ( - 1 ) ; else { out . writeInt ( schemas . size ( ) ) ; for ( BinarySchema schema : schemas ) schema . writeTo ( out ) ; } out . writeBoolean ( isEnum ) ; }
The object implements the writeTo method to save its contents by calling the methods of DataOutput for its primitive values and strings or calling the writeTo method for other objects.
34,760
public Container ( ) throws Exception { this ( false , null ) ; }
Construct a new, un-started container.
34,761
protected boolean isNumericOrBoxed ( TypeMirror type ) { if ( TypesUtils . isBoxedPrimitive ( type ) ) { type = types . unboxedType ( type ) ; } return TypesUtils . isNumeric ( type ) ; }
Returns true if the argument type is a numeric primitive or a boxed numeric primitive and false otherwise.
34,762
public static boolean isLetterOrDigit ( char c ) { return Character . isLetterOrDigit ( c ) ; }
Returns true if character c is a letter or digit.
34,763
protected void engineInit ( AlgorithmParameterSpec genParamSpec , SecureRandom random ) throws InvalidAlgorithmParameterException { if ( ! ( genParamSpec instanceof DHGenParameterSpec ) ) { throw new InvalidAlgorithmParameterException ( "Inappropriate parameter type" ) ; } DHGenParameterSpec dhParamSpec = ( DHGenParameterSpec ) genParamSpec ; primeSize = dhParamSpec . getPrimeSize ( ) ; try { checkKeySize ( primeSize ) ; } catch ( InvalidParameterException ipe ) { throw new InvalidAlgorithmParameterException ( ipe . getMessage ( ) ) ; } exponentSize = dhParamSpec . getExponentSize ( ) ; if ( exponentSize <= 0 ) { throw new InvalidAlgorithmParameterException ( "Exponent size must be greater than zero" ) ; } if ( exponentSize >= primeSize ) { throw new InvalidAlgorithmParameterException ( "Exponent size must be less than modulus size" ) ; } }
Initializes this parameter generator with a set of parameter generation values, which specify the size of the prime modulus and the size of the random exponent, both in bits.
34,764
public static List < CoreLabel > toCharacterSequence ( Sequence < IString > tokenSequence ) { List < CoreLabel > charSequence = new ArrayList < > ( tokenSequence . size ( ) * 7 ) ; for ( IString token : tokenSequence ) { String tokenStr = token . toString ( ) ; if ( charSequence . size ( ) > 0 ) { CoreLabel charLabel = new CoreLabel ( ) ; charLabel . set ( CoreAnnotations . TextAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . CharAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . ParentAnnotation . class , WHITESPACE ) ; charLabel . set ( CoreAnnotations . CharacterOffsetBeginAnnotation . class , - 1 ) ; charLabel . setIndex ( charSequence . size ( ) ) ; charSequence . add ( charLabel ) ; } for ( int j = 0 , size = tokenStr . length ( ) ; j < size ; ++ j ) { CoreLabel charLabel = new CoreLabel ( ) ; String ch = String . valueOf ( tokenStr . charAt ( j ) ) ; charLabel . set ( CoreAnnotations . TextAnnotation . class , ch ) ; charLabel . set ( CoreAnnotations . CharAnnotation . class , ch ) ; charLabel . set ( CoreAnnotations . ParentAnnotation . class , tokenStr ) ; charLabel . set ( CoreAnnotations . CharacterOffsetBeginAnnotation . class , j ) ; charLabel . setIndex ( charSequence . size ( ) ) ; charSequence . add ( charLabel ) ; } } return charSequence ; }
Convert a tokenized sequence to a character string.
34,765
void addListener ( IndexChangeListener listener ) { listeners . add ( listener ) ; }
Add a new listener for value changes.
34,766
public final CharSequenceTranslator with ( final CharSequenceTranslator ... translators ) { final CharSequenceTranslator [ ] newArray = new CharSequenceTranslator [ translators . length + 1 ] ; newArray [ 0 ] = this ; System . arraycopy ( translators , 0 , newArray , 1 , translators . length ) ; return new AggregateTranslator ( newArray ) ; }
Helper method to create a merger of this translator with another set of translators. Useful in customizing the standard functionality.
34,767
boolean addEventLine ( final EventLine line ) { if ( eventTypes . contains ( line . getType ( ) ) ) { channel . addLine ( line ) ; return true ; } return false ; }
Add an event line to the channel, if it's of type that should be displayed.
34,768
public static VectorStoreRAM readFromFile ( FlagConfig flagConfig , String vectorFile ) throws IOException { if ( vectorFile . isEmpty ( ) ) { throw new IllegalArgumentException ( "vectorFile argument cannot be empty." ) ; } VectorStoreRAM store = new VectorStoreRAM ( flagConfig ) ; store . initFromFile ( vectorFile ) ; return store ; }
Returns a new vector store, initialized from disk with the given vectorFile. Dimension and vector type from store on disk may overwrite any previous values in flagConfig.
34,769
@ Override protected RdKNNNode createNewLeafNode ( ) { return new RdKNNNode ( leafCapacity , true ) ; }
Creates a new leaf node with the specified capacity.
34,770
public void testPreconditions ( ) { StoreRetrieveData dataStorage = getDataStorage ( ) ; ArrayList < ToDoItem > items = null ; try { items = dataStorage . loadFromFile ( ) ; } catch ( Exception e ) { fail ( "Couldn't read from data storage: " + e . getMessage ( ) ) ; } assertEquals ( 0 , items . size ( ) ) ; }
We should have an empty data storage at hand for the starters
34,771
private static double [ ] computeLabels ( final double start , final double end , final int approxNumLabels ) { if ( Math . abs ( start - end ) < 0.0000001f ) { return new double [ ] { start , start , 0 } ; } double s = start ; double e = end ; boolean switched = false ; if ( s > e ) { switched = true ; double tmp = s ; s = e ; e = tmp ; } double xStep = roundUp ( Math . abs ( s - e ) / approxNumLabels ) ; double xStart = xStep * Math . ceil ( s / xStep ) ; double xEnd = xStep * Math . floor ( e / xStep ) ; if ( switched ) { return new double [ ] { xEnd , xStart , - 1.0 * xStep } ; } return new double [ ] { xStart , xEnd , xStep } ; }
Computes a reasonable number of labels for a data range.
34,772
public static IoBuffer wrap ( byte [ ] byteArray ) { return wrap ( ByteBuffer . wrap ( byteArray ) ) ; }
Wraps the specified byte array into MINA heap buffer.
34,773
private void removeListeners ( ) { skinSpecCompList . removeListSelectionListener ( this ) ; enableBorders . removeActionListener ( this ) ; currSkinCombo . removeActionListener ( this ) ; addButton . removeActionListener ( this ) ; addCompButton . removeActionListener ( this ) ; removeCompButton . removeActionListener ( this ) ; saveSkinButton . removeActionListener ( this ) ; resetSkinButton . removeActionListener ( this ) ; }
Remove thsi SkinSpecEditor as a listener from all components.
34,774
public boolean isSubsetOf ( Object obj ) { if ( ! ( obj instanceof AbstractTagFrameBody ) ) { return false ; } ArrayList < AbstractDataType > superset = ( ( AbstractTagFrameBody ) obj ) . objectList ; for ( AbstractDataType anObjectList : objectList ) { if ( anObjectList . getValue ( ) != null ) { if ( ! superset . contains ( anObjectList ) ) { return false ; } } } return true ; }
Returns true if this instance and its entire DataType array list is a subset of the argument. This class is a subset if it is the same class as the argument.
34,775
@ Override public int hashCode ( ) { int result = 1 ; Iterator < ? > it = iterator ( ) ; while ( it . hasNext ( ) ) { Object object = it . next ( ) ; result = ( 31 * result ) + ( object == null ? 0 : object . hashCode ( ) ) ; } return result ; }
Returns the hash code of this list. The hash code is calculated by taking each element's hashcode into account.
34,776
public ByteVector putByteArray ( final byte [ ] b , final int off , final int len ) { if ( length + len > data . length ) { enlarge ( len ) ; } if ( b != null ) { System . arraycopy ( b , off , data , length , len ) ; } length += len ; return this ; }
Puts an array of bytes into this byte vector. The byte vector is automatically enlarged if necessary.
34,777
private Collection < IQuest > findCompletedQuests ( Player player ) { List < IQuest > res = new ArrayList < IQuest > ( ) ; for ( IQuest quest : quests ) { if ( quest . isCompleted ( player ) && quest . isVisibleOnQuestStatus ( ) ) { res . add ( quest ) ; } } return res ; }
Find the quests that a player has completed.
34,778
private void updateSliderState ( int touchX , int touchY ) { int distanceX = touchX - mCircleCenterX ; int distanceY = mCircleCenterY - touchY ; double c = Math . sqrt ( Math . pow ( distanceX , 2 ) + Math . pow ( distanceY , 2 ) ) ; mAngle = Math . acos ( distanceX / c ) ; if ( distanceY < 0 ) { mAngle = - mAngle ; } if ( mListener != null ) { mListener . onSliderMoved ( ( mAngle - mStartAngle ) / ( 2 * Math . PI ) ) ; } }
Invoked when slider starts moving or is currently moving. This method calculates and sets position and angle of the thumb.
34,779
public static int copy ( InputStream in , OutputStream out , long start , long end , boolean closeAfterDone ) throws IOException { try { if ( in == null || out == null ) return 0 ; byte [ ] bb = new byte [ 1024 * 4 ] ; int total = 0 ; in . skip ( start ) ; int ii = ( int ) Math . min ( ( end - start ) , bb . length ) ; int len = in . read ( bb , 0 , ii ) ; while ( len > 0 ) { out . write ( bb , 0 , len ) ; total += len ; ii = ( int ) Math . min ( ( end - start - total ) , bb . length ) ; len = in . read ( bb , 0 , ii ) ; out . flush ( ) ; } return total ; } finally { if ( closeAfterDone ) { if ( in != null ) { in . close ( ) ; } if ( out != null ) { out . close ( ) ; } } } }
copy the data in "inputstream" to "outputstream", from start to end.
34,780
private void openBrowser ( String browserName , String url ) { if ( StringUtilities . isEmpty ( browserName ) ) { findBrowser ( ) ; return ; } if ( browserName . contains ( BROWSER_NAME_EXTENSION ) ) { try { launchExtension ( browserName , url ) ; } catch ( CoreException e ) { CorePluginLog . logError ( "Couldn't use the extension to launch." ) ; } return ; } try { BrowserUtilities . launchBrowser ( browserName , url ) ; } catch ( Throwable t ) { CorePluginLog . logError ( t , "Could not open the browser." ) ; } }
Open browser or launch an extension launcher
34,781
public static void instanceListToArffFile ( File outputFile , FeatureStore instanceList ) throws Exception { instanceListToArffFile ( outputFile , instanceList , false , false ) ; }
Converts a feature store to a list of instances. Single-label case.
34,782
public boolean isRunning ( ) { return mRunning . get ( ) ; }
Indicates if the reader thread is running
34,783
public Outfit ( final int code ) { this . body = ( code % 100 ) ; this . dress = ( code / 100 % 100 ) ; this . head = ( int ) ( code / Math . pow ( 100 , 2 ) % 100 ) ; this . hair = ( int ) ( code / Math . pow ( 100 , 3 ) % 100 ) ; this . detail = ( int ) ( code / Math . pow ( 100 , 4 ) % 100 ) ; this . mouth = 0 ; this . eyes = 0 ; }
Creates a new outfit based on a numeric code.
34,784
public void filledPolygon ( double [ ] x , double [ ] y ) { int n = x . length ; GeneralPath path = new GeneralPath ( ) ; path . moveTo ( ( float ) scaleX ( x [ 0 ] ) , ( float ) scaleY ( y [ 0 ] ) ) ; for ( int i = 0 ; i < n ; i ++ ) path . lineTo ( ( float ) scaleX ( x [ i ] ) , ( float ) scaleY ( y [ i ] ) ) ; path . closePath ( ) ; offscreen . fill ( path ) ; draw ( ) ; }
Draws a filled polygon with the given (x[i], y[i]) coordinates.
34,785
private void smoothScrollToItemView ( int position , boolean pageSelected ) { mCurrentPosition = position ; if ( mCurrentPosition > getChildCount ( ) - 1 ) { mCurrentPosition = getChildCount ( ) - 1 ; } if ( mOnPagerChangeListener != null && pageSelected ) { mOnPagerChangeListener . onPageSelected ( position ) ; } int dx = position * ( getMeasuredWidth ( ) - ( int ) mMarginLeftRight * 2 ) - getScrollX ( ) ; mScroller . startScroll ( getScrollX ( ) , 0 , dx , 0 , Math . min ( Math . abs ( dx ) * 2 , MAX_SETTLE_DURATION ) ) ; invalidate ( ) ; }
scroll to confirmed position of child
34,786
public static void deleteESTestIndex ( String index ) { logger . info ( "Deleting index:" ) ; ProcessBuilder pDelete = new ProcessBuilder ( "curl" , "-XDELETE" , index ) ; try { executeCommand ( pDelete ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
Method to delete an ES index
34,787
void addCommand ( String sql ) { if ( sql == null ) { return ; } sql = sql . trim ( ) ; if ( sql . length ( ) == 0 ) { return ; } if ( commandHistory . size ( ) > MAX_HISTORY ) { commandHistory . remove ( 0 ) ; } int idx = commandHistory . indexOf ( sql ) ; if ( idx >= 0 ) { commandHistory . remove ( idx ) ; } commandHistory . add ( sql ) ; if ( server . isCommandHistoryAllowed ( ) ) { server . saveCommandHistoryList ( commandHistory ) ; } }
Add a SQL statement to the history.
34,788
public static String encodeArray ( String [ ] array ) { StringBuilder buffer = new StringBuilder ( ) ; int nrItems = array . length ; for ( int i = 0 ; i < nrItems ; i ++ ) { String item = array [ i ] ; item = StringUtil . gsub ( "_" , "__" , item ) ; buffer . append ( item ) ; if ( i < nrItems - 1 ) { buffer . append ( "_." ) ; } } return buffer . toString ( ) ; }
Encodes an array of Strings into a single String than can be decoded to the original array using the corresponding decode method. Useful for e.g. storing an array of Strings as a single entry in a Preferences node.
34,789
public void mergeElementsRelations ( final OsmElement mergeInto , final OsmElement mergeFrom ) { ArrayList < Relation > fromRelations = mergeFrom . getParentRelations ( ) != null ? new ArrayList < Relation > ( mergeFrom . getParentRelations ( ) ) : new ArrayList < Relation > ( ) ; ArrayList < Relation > toRelations = mergeInto . getParentRelations ( ) != null ? mergeInto . getParentRelations ( ) : new ArrayList < Relation > ( ) ; try { for ( Relation r : fromRelations ) { if ( ! toRelations . contains ( r ) ) { dirty = true ; undo . save ( r ) ; RelationMember rm = r . getMember ( mergeFrom ) ; RelationMember newRm = new RelationMember ( rm . getRole ( ) , mergeInto ) ; r . replaceMember ( rm , newRm ) ; r . updateState ( OsmElement . STATE_MODIFIED ) ; apiStorage . insertElementSafe ( r ) ; mergeInto . addParentRelation ( r ) ; mergeInto . updateState ( OsmElement . STATE_MODIFIED ) ; apiStorage . insertElementSafe ( mergeInto ) ; } } recordImagery ( ) ; } catch ( StorageException sex ) { } }
Assumes mergeFrom will deleted by caller and doesn't update back refs
34,790
public void add ( Predicate p ) { if ( m_clauses . contains ( p ) ) { throw new IllegalArgumentException ( "Duplicate predicate." ) ; } m_clauses . add ( p ) ; fireExpressionChange ( ) ; }
Add a new clause.
34,791
public void awaitShutdown ( ) throws InterruptedException { lock . lockInterruptibly ( ) ; try { while ( true ) { switch ( runState ) { case Start : case Running : case ShuttingDown : futureReady . await ( ) ; continue ; case Shutdown : return ; default : throw new AssertionError ( ) ; } } } finally { lock . unlock ( ) ; } }
Block until the service is shutdown.
34,792
public static final double nextDouble ( double value ) { if ( value == Double . POSITIVE_INFINITY ) { return value ; } long bits ; if ( value == 0 ) { bits = 0 ; } else { bits = Double . doubleToLongBits ( value ) ; } return Double . longBitsToDouble ( value < 0 ? bits - 1 : bits + 1 ) ; }
Returns the double value which is closest to the specified double but larger.
34,793
private String randomString ( String [ ] values , Object olength ) { int length = FunctionHandler . getInt ( olength ) ; StringBuilder output = new StringBuilder ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { output . append ( values [ rnd . nextInt ( values . length ) ] ) ; } return output . toString ( ) ; }
Get a random, positive whole number
34,794
@ Override public boolean hasCancelSaveButtons ( ) { return false ; }
Only need one close button
34,795
public double end ( ) { assureRightState ( "end" , true ) ; lastTime = elapsed ( ) ; lapped . add ( lastTime ) ; time = - 1 ; return lastTime ; }
Ends current profiling session. Saves result for average calculations.
34,796
protected void check ( ) { checkmark . removeAttribute ( SVGConstants . SVG_STYLE_ATTRIBUTE ) ; checked = true ; fireSwitchEvent ( new ChangeEvent ( SVGCheckbox . this ) ) ; }
Set the checkmark, and fire the event.
34,797
private static void popTransactionStartStamp ( ) { ListOrderedMap map = ( ListOrderedMap ) suspendedTxStartStamps . get ( ) ; if ( map . size ( ) > 0 ) { transactionStartStamp . set ( ( Timestamp ) map . remove ( map . lastKey ( ) ) ) ; } else { Debug . logError ( "Error in transaction handling - no saved start stamp found - using NOW." , module ) ; transactionStartStamp . set ( UtilDateTime . nowTimestamp ( ) ) ; } }
Remove the stamp from stack (when resuming)
34,798
public static Integer stringToInteger ( String s , Integer defaultValue ) { try { return Integer . parseInt ( s ) ; } catch ( NumberFormatException nfe ) { return defaultValue ; } }
Convert a String to an Integer, falling back to a defaultValue if the String cannot be parsed. This is useful because there are issues passing an integer directly through UimaFIT to a component, and currently we need to pass it as a String and convert it.
34,799
public static String cut ( final String version , final int parts ) { int pos = 0 ; for ( int i = 0 ; i < parts ; i ++ ) { final int temp = version . indexOf ( "." , pos + 1 ) ; if ( temp < 0 ) { pos = version . length ( ) ; break ; } pos = temp ; } return version . substring ( 0 , pos ) ; }
Extract the specified number of parts from a version-string.