Code_Function
stringlengths
13
13.9k
Message
stringlengths
10
1.46k
private void testServerJoinLate ( Member . Type type , CopycatServer . State state ) throws Throwable { createServers ( 3 ) ; CopycatClient client = createClient ( ) ; submit ( client , 0 , 1000 ) ; await ( 30000 ) ; CopycatServer joiner = createServer ( nextMember ( type ) ) ; joiner . onStateChange ( null ) ; joiner . join ( members . stream ( ) . map ( null ) . collect ( Collectors . toList ( ) ) ) . thenRun ( null ) ; await ( 30000 , 2 ) ; }
Tests joining a server after many entries have been committed .
fun createRadioButton(x: Int, y: Int, diameter: Int): Shape? { return createEllipseInternal(x, y, diameter, diameter) }
Return a path for a radio button 's concentric sections .
@DSComment("From safe class list") @DSSafe(DSCat.SAFE_LIST) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0", generated_on = "2013-12-30 12:57:11.638 -0500", hash_original_method = "3CEC44303CC022BBEC9F119BC403FDBC", hash_generated_method = "FD349EDA389F166F5AB5B32AD7B69928" ) fun size(): Int { return al.size() }
Returns the number of elements in this set .
fun formatRateString(rate: Float): String? { return String.format(Locale.US, "%.2fx", rate) }
Get the formatted current playback speed in the form of 1.00x
@Throws(FileNotFoundException::class) private fun decodeImageForOption(resolver: ContentResolver, uri: Uri): BitmapFactory.Options? { var stream: InputStream? = null return try { stream = resolver.openInputStream(uri) val options = BitmapFactory.Options() options.inJustDecodeBounds = true BitmapFactory.decodeStream(stream, EMPTY_RECT, options) options.inJustDecodeBounds = false options } finally { closeSafe(stream) } }
Decode image from uri using `` inJustDecodeBounds '' to get the image dimensions .
fun FinalSQLString(sqlstring: BasicSQLString) { this.delegate = sqlstring }
Should only be called inside SQLString because this class essentially verifies that we 've checked for updates .
fun loadArgArray() { push(argumentTypes.length) newArray(jdk.internal.org.objectweb.asm.commons.InstructionAdapter.OBJECT_TYPE) for (i in 0 until argumentTypes.length) { dup() push(i) loadArg(i) jdk.internal.vm.compiler.word.impl.WordBoxFactory.box<jdk.internal.vm.compiler.word.WordBase>( argumentTypes.get(i) ) arrayStore(jdk.internal.org.objectweb.asm.commons.InstructionAdapter.OBJECT_TYPE) } }
Generates the instructions to load all the method arguments on the stack , as a single object array .
@Throws(ServletException::class, IOException::class) fun doGet(request: HttpServletRequest?, response: HttpServletResponse?) { WebUtil.createLoginPage(request, response, this, null, null) }
Process the HTTP Get request
private fun DeferredFileOutputStream( threshold: Int, outputFile: File, prefix: String, suffix: String, directory: File ) { super(threshold) outputFile = outputFile memoryOutputStream = ByteArrayOutputStream() currentOutputStream = memoryOutputStream prefix = prefix suffix = suffix directory = directory }
Constructs an instance of this class which will trigger an event at the specified threshold , and save data either to a file beyond that point .
fun testSetSystemScope() { val systemScope: IdentityScope = IdentityScope.getSystemScope() try { `is` = IdentityScopeStub("Aleksei Semenov") IdentityScopeStub.mySetSystemScope(`is`) assertSame(`is`, IdentityScope.getSystemScope()) } finally { IdentityScopeStub.mySetSystemScope(systemScope) } }
check that if permission given - set/get works if permission is denied than SecurityException is thrown
@JvmStatic fun main(args: Array<String>) { runEvaluator(WrapperSubsetEval(), args) }
Main method for testing this class .
fun v(tag: String?, msg: String?, vararg args: Any?) { var msg = msg if (sLevel > LEVEL_VERBOSE) { return } if (args.size > 0) { msg = String.format(msg!!, *args) } Log.v(tag, msg) }
Send a VERBOSE log message .
@DSComment("Package priviledge") @DSBan(DSCat.DEFAULT_MODIFIER) @DSGenerator( tool_name = "Doppelganger", tool_version = "2.0",generated_on = "2013-12-30 12:58:04.267 -0500", hash_original_method = "2CE5F24A4C571BEECB25C40400E44908", hash_generated_method = "A3579B97578194B5EA0183D0F747142C" ) fun computeNextElement() { while (true) { if (currentBits !== 0) { mask = currentBits and -currentBits return } else if (++index < bits.length) { currentBits = bits.get(index) } else { mask = 0 return } } }
Assigns mask and index to the next available value , cycling currentBits as necessary .
fun HierarchyEvent( source: Component?, id: Int, changed: Component, changedParent: Container, changeFlags: Long ) { super(source, id) changed = changed changedParent = changedParent changeFlags = changeFlags }
Constructs an < code > HierarchyEvent < /code > object to identify a change in the < code > Component < /code > hierarchy . < p > This method throws an < code > IllegalArgumentException < /code > if < code > source < /code > is < code > null < /code > .
fun step(state: SimState?) {}
This method is performed when the next step for the agent is computed . This agent does nothing , so nothing is inside the body of the method .
fun resetRuntime() { currentTime = 1392409281320L wasTimeAccessed = false hashKeys.clear() restoreProperties() needToRestoreProperties = false }
Reset runtime to initial state
fun ExpandCaseMultipliersAction(editor: DataEditor?) { super("Expand Case Multipliers") if (editor == null) { throw NullPointerException() } this.dataEditor = editor }
Creates a new action to split by collinear columns .
fun ScaleFake() {}
Creates a new instance of ScaleFake
protected fun ArrayElementImpl() { super() }
< ! -- begin-user-doc -- > < ! -- end-user-doc -- >
fun FilterRowIterator(rows: IntIterator, t: Table, p: Predicate) { this.predicate = p rows = rows t = t next = advance() }
Create a new FilterRowIterator .
@Throws(JasperException::class) private fun scanJar(conn: JarURLConnection, tldNames: List<String>?, isLocal: Boolean) { val resourcePath: String = conn.getJarFileURL().toString() var tldInfos: Array<TldInfo?> = jarTldCacheLocal.get(resourcePath) if (tldInfos != null && tldInfos.size == 0) { try { conn.getJarFile().close() } catch (ex: IOException) { } return } if (tldInfos == null) { var jarFile: JarFile? = null val tldInfoA: ArrayList<TldInfo> = ArrayList<TldInfo>() try { jarFile = conn.getJarFile() if (tldNames != null) { for (tldName in tldNames) { val entry: JarEntry = jarFile.getJarEntry(tldName) val stream: InputStream = jarFile.getInputStream(entry) tldInfoA.add(scanTld(resourcePath, tldName, stream)) } } else { val entries: Enumeration<JarEntry> = jarFile.entries() while (entries.hasMoreElements()) { val entry: JarEntry = entries.nextElement() val name: String = entry.getName() if (!name.startsWith("META-INF/")) continue if (!name.endsWith(".tld")) continue val stream: InputStream = jarFile.getInputStream(entry) tldInfoA.add(scanTld(resourcePath, name, stream)) } } } catch (ex: IOException) { if (resourcePath.startsWith(FILE_PROTOCOL) && !File(resourcePath).exists()) { if (log.isLoggable(Level.WARNING)) { log.log( Level.WARNING, Localizer.getMessage("jsp.warn.nojar", resourcePath), ex ) } } else { throw JasperException( Localizer.getMessage("jsp.error.jar.io", resourcePath), ex ) } } finally { if (jarFile != null) { try { jarFile.close() } catch (t: Throwable) { } } } tldInfos = tldInfoA.toArray(arrayOfNulls<TldInfo>(tldInfoA.size())) jarTldCacheLocal.put(resourcePath, tldInfos) if (!isLocal) { jarTldCache.put(resourcePath, tldInfos) } } for (tldInfo in tldInfos) { if (scanListeners) { addListener(tldInfo, isLocal) } mapTldLocation(resourcePath, tldInfo, isLocal) } }
Scans the given JarURLConnection for TLD files located in META-INF ( or a subdirectory of it ) . If the scanning in is done as part of the ServletContextInitializer , the listeners in the tlds in this jar file are added to the servlet context , and for any TLD that has a < uri > element , an implicit map entry is added to the taglib map .
fun cosft1(y: DoubleArray?) { com.nr.fft.FFT.cosft1(y) }
Calculates the cosine transform of a set y [ 0..n ] of real-valued data points . The transformed data replace the original data in array y. n must be a power of 2 . This program , without changes , also calculates the inverse cosine transform , but in this case the output array should be multiplied by 2/n .
fun stop() { mRunning = false mStop = true }
Stops the animation in place . It does not snap the image to its final translation .
operator fun hasNext(): Boolean { return cursor > 0 }
This is used to determine if the cursor has reached the start of the list . When the cursor reaches the start of the list then this method returns false .
protected fun onFinished(player: Player, successful: Boolean) { if (successful) { val itemName: String = items.get(Rand.rand(items.length)) val item: Item = SingletonRepository.getEntityManager().getItem(itemName) var amount = 1 if (itemName == "dark dagger" || itemName == "horned golden helmet") { item.setBoundTo(player.getName()) } else if (itemName == "money") { amount = Rand.roll1D100() (item as StackableItem).setQuantity(amount) } player.equipOrPutOnGround(item) player.incObtainedForItem(item.getName(), item.getQuantity()) SingletonRepository.getAchievementNotifier().onObtain(player) player.sendPrivateText( "You were lucky and found " + com.sun.org.apache.xerces.internal.xni.grammars.Grammar.quantityplnoun( amount, itemName, "a" ).toString() + "." ) } else { player.sendPrivateText("Your wish didn't come true.") } }
Called when the activity has finished .
fun saveWalletAndWalletInfoSimple( perWalletModelData: WalletData, walletFilename: String?, walletInfoFilename: String? ) { val walletFile = File(walletFilename) val walletInfo: WalletInfoData = perWalletModelData.getWalletInfo() var fileOutputStream: FileOutputStream? = null try { if (perWalletModelData.getWallet() != null) { if (walletInfo != null) { val walletDescriptionInInfoFile: String = walletInfo.getProperty(WalletInfoData.DESCRIPTION_PROPERTY) if (walletDescriptionInInfoFile != null) { perWalletModelData.getWallet().setDescription(walletDescriptionInInfoFile) } } log.debug( "Saving wallet file '" + walletFile.getAbsolutePath().toString() + "' ..." ) if (MultiBitWalletVersion.SERIALIZED === walletInfo.getWalletVersion()) { throw WalletSaveException( "Cannot save wallet '" + walletFile.getAbsolutePath() .toString() + "'. Serialized wallets are no longer supported." ) } else { var walletIsActuallyEncrypted = false val wallet: Wallet = perWalletModelData.getWallet() for (key in wallet.getKeychain()) { if (key.isEncrypted()) { walletIsActuallyEncrypted = true break } } if (walletIsActuallyEncrypted) { walletInfo.setWalletVersion(MultiBitWalletVersion.PROTOBUF_ENCRYPTED) } if (MultiBitWalletVersion.PROTOBUF === walletInfo.getWalletVersion()) { perWalletModelData.getWallet().saveToFile(walletFile) } else if (MultiBitWalletVersion.PROTOBUF_ENCRYPTED === walletInfo.getWalletVersion()) { fileOutputStream = FileOutputStream(walletFile) walletProtobufSerializer.writeWallet( perWalletModelData.getWallet(), fileOutputStream ) } else { throw WalletVersionException( "Cannot save wallet '" + perWalletModelData.getWalletFilename() .toString() + "'. Its wallet version is '" + walletInfo.getWalletVersion() .toString() .toString() + "' but this version of MultiBit does not understand that format." ) } } log.debug("... done saving wallet file.") } } catch (ioe: IOException) { throw WalletSaveException( "Cannot save wallet '" + perWalletModelData.getWalletFilename(), ioe ) } finally { if (fileOutputStream != null) { try { fileOutputStream.flush() fileOutputStream.close() } catch (e: IOException) { throw WalletSaveException( "Cannot save wallet '" + perWalletModelData.getWalletFilename(), e ) } } } walletInfo.writeToFile(walletInfoFilename, walletInfo.getWalletVersion()) }
Simply save the wallet and wallet info files . Used for backup writes .
@Throws(CloneNotSupportedException::class) fun clone(): Any? { val clone: DefaultIntervalXYDataset = super.clone() as DefaultIntervalXYDataset clone.seriesKeys = ArrayList<Any?>(this.seriesKeys) clone.seriesList = ArrayList(this.seriesList.size()) for (i in 0 until this.seriesList.size()) { val data = this.seriesList.get(i) as Array<DoubleArray> val x = data[0] val xStart = data[1] val xEnd = data[2] val y = data[3] val yStart = data[4] val yEnd = data[5] val xx = DoubleArray(x.size) val xxStart = DoubleArray(xStart.size) val xxEnd = DoubleArray(xEnd.size) val yy = DoubleArray(y.size) val yyStart = DoubleArray(yStart.size) val yyEnd = DoubleArray(yEnd.size) System.arraycopy(x, 0, xx, 0, x.size) System.arraycopy(xStart, 0, xxStart, 0, xStart.size) System.arraycopy(xEnd, 0, xxEnd, 0, xEnd.size) System.arraycopy(y, 0, yy, 0, y.size) System.arraycopy(yStart, 0, yyStart, 0, yStart.size) System.arraycopy(yEnd, 0, yyEnd, 0, yEnd.size) clone.seriesList.add(i, arrayOf(xx, xxStart, xxEnd, yy, yyStart, yyEnd)) } return clone }
Returns a clone of this dataset .
fun EveningActivityMovement(settings: Settings) { super(settings) super.backAllowed = false pathFinder = DijkstraPathFinder(null) mode = WALKING_TO_MEETING_SPOT_MODE nrOfMeetingSpots = settings.getInt(NR_OF_MEETING_SPOTS_SETTING) minGroupSize = settings.getInt(MIN_GROUP_SIZE_SETTING) maxGroupSize = settings.getInt(MAX_GROUP_SIZE_SETTING) val mapNodes: Array<MapNode> = jdk.nashorn.internal.objects.Global.getMap().getNodes() .toArray(arrayOfNulls<MapNode>(0)) var shoppingSpotsFile: String? = null try { shoppingSpotsFile = settings.getSetting(MEETING_SPOTS_FILE_SETTING) } catch (t: Throwable) { } var meetingSpotLocations: MutableList<Coord?>? = null if (shoppingSpotsFile == null) { meetingSpotLocations = LinkedList<Coord?>() for (i in mapNodes.indices) { if (i % (mapNodes.size / nrOfMeetingSpots) === 0) { startAtLocation = mapNodes[i].getLocation().clone() meetingSpotLocations!!.add(startAtLocation.clone()) } } } else { try { meetingSpotLocations = LinkedList<Coord?>() val locationsRead: List<Coord> = WKTReader().readPoints(File(shoppingSpotsFile)) for (coord in locationsRead) { val map: SimMap = jdk.nashorn.internal.objects.Global.getMap() val offset: Coord = map.getOffset() if (map.isMirrored()) { coord.setLocation(coord.getX(), -coord.getY()) } coord.translate(offset.getX(), offset.getY()) meetingSpotLocations!!.add(coord) } } catch (e: Exception) { e.printStackTrace() } } this.id = nextID++ val scsID: Int = settings.getInt(EVENING_ACTIVITY_CONTROL_SYSTEM_NR_SETTING) scs = EveningActivityControlSystem.getEveningActivityControlSystem(scsID) scs.setRandomNumberGenerator(rng) scs.addEveningActivityNode(this) scs.setMeetingSpots(meetingSpotLocations) maxPathLength = 100 minPathLength = 10 maxWaitTime = settings.getInt(MAX_WAIT_TIME_SETTING) minWaitTime = settings.getInt(MIN_WAIT_TIME_SETTING) }
Creates a new instance of EveningActivityMovement
protected fun makeHullComplex(pc: Array<DoubleArray?>): java.awt.Polygon? { val hull = GrahamScanConvexHull2D() val diag = doubleArrayOf(0.0, 0.0) for (j in pc.indices) { hull.add(pc[j]) hull.add(javax.management.Query.times(pc[j], -1)) for (k in j + 1 until pc.size) { val q = pc[k] val ppq: DoubleArray = timesEquals( javax.management.Query.plus(pc[j], q), org.graalvm.compiler.loop.MathUtil.SQRTHALF ) val pmq: DoubleArray = timesEquals(minus(pc[j], q), org.graalvm.compiler.loop.MathUtil.SQRTHALF) hull.add(ppq) hull.add(javax.management.Query.times(ppq, -1)) hull.add(pmq) hull.add(javax.management.Query.times(pmq, -1)) for (l in k + 1 until pc.size) { val r = pc[k] val ppqpr: DoubleArray = timesEquals(javax.management.Query.plus(ppq, r), Math.sqrt(1 / 3.0)) val pmqpr: DoubleArray = timesEquals(javax.management.Query.plus(pmq, r), Math.sqrt(1 / 3.0)) val ppqmr: DoubleArray = timesEquals(minus(ppq, r), Math.sqrt(1 / 3.0)) val pmqmr: DoubleArray = timesEquals(minus(pmq, r), Math.sqrt(1 / 3.0)) hull.add(ppqpr) hull.add(javax.management.Query.times(ppqpr, -1)) hull.add(pmqpr) hull.add(javax.management.Query.times(pmqpr, -1)) hull.add(ppqmr) hull.add(javax.management.Query.times(ppqmr, -1)) hull.add(pmqmr) hull.add(javax.management.Query.times(pmqmr, -1)) } } plusEquals(diag, pc[j]) } timesEquals(diag, 1.0 / Math.sqrt(pc.size.toDouble())) hull.add(diag) hull.add(javax.management.Query.times(diag, -1)) return hull.getHull() }
Build a convex hull to approximate the sphere .
fun visitAnnotations(node: AnnotatedNode) { super.visitAnnotations(node) for (annotation in node.getAnnotations()) { if (transforms.containsKey(annotation)) { targetNodes.add(arrayOf<ASTNode>(annotation, node)) } } }
Adds the annotation to the internal target list if a match is found .
fun Node(next: Node<K?, V?>) { this.key = null this.value = this next = next }
Creates a new marker node . A marker is distinguished by having its value field point to itself . Marker nodes also have null keys , a fact that is exploited in a few places , but this does n't distinguish markers from the base-level header node ( head.node ) , which also has a null key .
fun onDrawerClosed(view: View?) { super.onDrawerClosed(view) }
Called when a drawer has settled in a completely closed state .
fun deserializeAddressList(serializedAddresses: String): List<String?>? { return Arrays.asList(serializedAddresses.split(",").toTypedArray()) }
Deserialize a list of IP addresses from a string .
@Throws(IOException::class) fun challengeReceived(challenge: String?) { currentMechanism.challengeReceived(challenge) }
The server is challenging the SASL authentication we just sent . Forward the challenge to the current SASLMechanism we are using . The SASLMechanism will send a response to the server . The length of the challenge-response sequence varies according to the SASLMechanism in use .
fun fitsType(env: Environment?, ctx: Context?, t: Type): Boolean { if (this.type.isType(TC_CHAR)) { return super.fitsType(env, ctx, t) } when (t.getTypeCode()) { TC_BYTE -> return value === value as Byte TC_SHORT -> return value === value as Short TC_CHAR -> return value === value as Char } return super.fitsType(env, ctx, t) }
See if this number fits in the given type .
fun ServiceManager(services: Iterable<Service?>?) { var copy: ImmutableList<Service?> = ImmutableList.copyOf(services) if (copy.isEmpty()) { logger.log( Level.WARNING, "ServiceManager configured with no services. Is your application configured properly?", EmptyServiceManagerWarning() ) copy = ImmutableList.< Service > of < Service ? > NoOpService() } this.state = ServiceManagerState(copy) services = copy val stateReference: WeakReference<ServiceManagerState> = WeakReference<ServiceManagerState>(state) for (service in copy) { service.addListener( ServiceListener(service, stateReference), MoreExecutors.directExecutor() ) checkArgument(service.state() === NEW, "Can only manage NEW services, %s", service) } this.state.markReady() }
Constructs a new instance for managing the given services .
fun hasModule(moduleName: String?): Boolean { return moduleStore.containsKey(moduleName) || moduleStore.containsValue(moduleName) }
Looks up a module
private fun removeUnusedTilesets(map: Map<*, *>) { val sets: MutableIterator<*> = map.getTileSets().iterator() while (sets.hasNext()) { val tileset: TileSet = sets.next() as TileSet if (!isUsedTileset(map, tileset)) { sets.remove() } } }
Remove any tilesets in a map that are not actually in use .
fun transformPoint(v: vec3): vec3? { val result = vec3() result.m.get(0) = this.m.get(0) * v.m.get(0) + this.m.get(4) * v.m.get(1) + this.m.get(8) * v.m.get(2) + this.m.get( 12 ) result.m.get(1) = this.m.get(1) * v.m.get(0) + this.m.get(5) * v.m.get(1) + this.m.get(9) * v.m.get(2) + this.m.get( 13 ) result.m.get(2) = this.m.get(2) * v.m.get(0) + this.m.get(6) * v.m.get(1) + this.m.get(10) * v.m.get(2) + this.m.get( 14 ) return result }
\fn transformPoint \brief Returns a transformed point \param v [ vec3 ]
fun createFromString(str: String?): AttrSessionID? { return AttrSessionID(str) }
Creates a new attribute instance from the provided String .
fun Spinner(model: javax.swing.ListModel, rendererInstance: javax.swing.ListCellRenderer?) { super(model) ios7Mode = javax.swing.UIManager.getInstance().isThemeConstant("ios7SpinnerBool", false) if (ios7Mode) { super.setMinElementHeight(6) } SpinnerRenderer.iOS7Mode = ios7Mode setRenderer(rendererInstance) setUIID("Spinner") setFixedSelection(FIXED_CENTER) setOrientation(VERTICAL) setInputOnFocus(false) setIsScrollVisible(false) InitSpinnerRenderer() quickType.setReplaceMenu(false) quickType.setInputModeOrder(arrayOf("123")) quickType.setFocus(true) quickType.setRTL(false) quickType.setAlignment(LEFT) quickType.setConstraint(java.awt.TextField.NUMERIC) setIgnoreFocusComponentWhenUnfocused(true) setRenderingPrototype(model.getItemAt(model.getSize() - 1)) if (getRenderer() is DateTimeRenderer) { quickType.setColumns(2) } }
Creates a new spinner instance with the given spinner model
fun start() { paused = false log.info("Starting text-only user interface...") log.info("Local address: " + system.getLocalAddress()) log.info("Press Ctrl + C to exit") Thread(null).start() }
Starts the interface .
fun encodeBase64(binaryData: ByteArray?): ByteArray? { return org.apache.commons.codec.binary.Base64.encodeBase64(binaryData) }
Encodes binary data using the base64 algorithm but does not chunk the output .
fun previousNode(): Int { if (!m_cacheNodes) throw RuntimeException( com.sun.org.apache.xalan.internal.res.XSLMessages.createXPATHMessage( com.sun.org.apache.xpath.internal.res.XPATHErrorResources.ER_NODESETDTM_CANNOT_ITERATE, null ) ) return if (m_next - 1 > 0) { m_next-- this.elementAt(m_next) } else com.sun.org.apache.xml.internal.dtm.DTM.NULL }
Returns the previous node in the set and moves the position of the iterator backwards in the set .
@Synchronized fun decrease(bitmap: Bitmap?) { val bitmapSize: Int = BitmapUtil.getSizeInBytes(bitmap) Preconditions.checkArgument(mCount > 0, "No bitmaps registered.") Preconditions.checkArgument( bitmapSize <= mSize, "Bitmap size bigger than the total registered size: %d, %d", bitmapSize, mSize ) mSize -= bitmapSize mCount-- }
Excludes given bitmap from the count .
fun addExcludedName(name: String) { val obj: Any = lookupQualifiedName(scope, name) require(obj is Scriptable) { "Object for excluded name $name not found." } table.put(obj, name) }
Adds a qualified name to the list of objects to be excluded from serialization . Names excluded from serialization are looked up in the new scope and replaced upon deserialization .
fun normalizeExcitatoryFanIn() { var sum = 0.0 var str = 0.0 run { var i = 0 val n: Int = fanIn.size() while (i < n) { str = fanIn.get(i).getStrength() if (str > 0) { sum += str } i++ } } var s: Synapse? = null var i = 0 val n: Int = fanIn.size() while (i < n) { s = fanIn.get(i) str = s.getStrength() if (str > 0) { s.setStrength(s.getStrength() / sum) } i++ } }
Normalizes the excitatory synaptic strengths impinging on this neuron , that is finds the sum of the exctiatory weights and divides each weight value by that sum ;
@MethodDesc(=description = "Configure properties by either rereading them or setting all properties from outside.",usage = "configure <properties>") @Throws( Exception::class)fun configure(@ParamDesc(name = "tp",description = "Optional properties to replace replicator.properties") tp: TungstenProperties?) {handleEventSynchronous(ConfigureEvent(tp)) }
Local wrapper of configure to help with unit testing .
fun isArrayIndex(): Boolean { return true }
Return true if variable is an array
@Throws(Exception::class) fun runSafely(stack: Catbert.FastStack?): Any? { return sun.net.NetworkClient.getConnectedClients() }
Returns a list of all the clients that are currently connected to this server .
fun Debug(filename: String?) { this(filename, 1000000, 1) }
logs the output to the specified file ( and stdout ) . Size is 1,000,000 bytes and 1 file .
private fun createKeywordDisplayName(keyword: TaxonKeyword?): String? { var combined: String? = null if (keyword != null) { val scientificName: String = com.sun.tools.javac.util.StringUtils.trimToNull(keyword.getScientificName()) val commonName: String = com.sun.tools.javac.util.StringUtils.trimToNull(keyword.getCommonName()) if (scientificName != null && commonName != null) { combined = "$scientificName ($commonName)" } else if (scientificName != null) { combined = scientificName } else if (commonName != null) { combined = commonName } } return combined }
Construct display name from TaxonKeyword 's scientific name and common name properties . It will look like : scientific name ( common name ) provided both properties are not null .
fun w(tag: String?, msg: String?) { w(tag, msg, null) }
Prints a message at WARN priority .
fun BehaviorEvent(facesContext: FacesContext?, component: UIComponent?, behavior: Behavior?) { super(facesContext, component) requireNotNull(behavior) { "Behavior agrument cannot be null" } behavior = behavior }
< p class= '' changed_added_2_3 '' > Construct a new event object from the Faces context , specified source component and behavior. < /p >
fun intdiv(left: Number?, right: Char): Number? { return intdiv(left, Integer.valueOf(right.code).toChar()) }
Integer Divide a Number by a Character . The ordinal value of the Character is used in the division ( the ordinal value is the unicode value which for simple character sets is the ASCII value ) .
fun SQLDataException(reason: String?, cause: Throwable?) { super(reason, cause) }
Creates an SQLDataException object . The Reason string is set to the given and the cause Throwable object is set to the given cause Throwable object .
fun isSetHeader(): Boolean { return this.header != null }
Returns true if field header is set ( has been assigned a value ) and false otherwise
fun increment(key: Float): Boolean { return adjustValue(key, 1) }
Increments the primitive value mapped to key by 1
fun finish(): Boolean { if (!started) return false var ok = true started = false try { out.write(0x3b) out.flush() if (closeStream) { out.close() } } catch (e: IOException) { ok = false } transIndex = 0 out = null image = null pixels = null indexedPixels = null colorTab = null closeStream = false firstFrame = true return ok }
Flushes any pending data and closes output file . If writing to an OutputStream , the stream is not closed .
fun initializeDefinition(tableName: String, isUnique: Boolean) { m_table = tableName m_isUnique = isUnique s_logger.log(Level.FINEST, toString()) }
initialize detailed definitions forindex
private fun concatHeirTokens(stn: com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode): String { val heirs: Array<com.sun.org.apache.xalan.internal.xsltc.compiler.SyntaxTreeNode> = stn.getHeirs() if (heirs.size == 0) { return if (stn.getKind() < SyntaxTreeConstants.NULL_ID) { stn.getImage() } else { "" } } var `val` = "" for (i in heirs.indices) { `val` = `val` + concatHeirTokens(heirs[i]) } return `val` }
Returns the concatenation of the images of all leaf nodes of the node stn that correspond to actual tokens
fun jjtAccept(visitor: ParserVisitor, data: Any?): Any? { return visitor.visit(this, data) }
Accept the visitor .
fun createImageThumbnail(filePath: String, kind: Int): Bitmap? { val wantMini = kind == Images.Thumbnails.MINI_KIND val targetSize: Int = If (wantMini) TARGET_SIZE_MINI_THUMBNAIL else TARGET_SIZE_MICRO_THUMBNAIL val maxPixels: Int = if (wantMini) MAX_NUM_PIXELS_THUMBNAIL else MAX_NUM_PIXELS_MICRO_THUMBNAIL val sizedThumbnailBitmap = SizedThumbnailBitmap() var bitmap: Bitmap? = null val fileType: MediaFileType = MediaFile.getFileType(filePath) if (fileType != null && fileType.fileType === MediaFile.FILE_TYPE_JPEG) { createThumbnailFromEXIF(filePath, targetSize, maxPixels, sizedThumbnailBitmap) bitmap = sizedThumbnailBitmap.mBitmap } if (bitmap == null) { var stream: FileInputStream? = null try { stream = FileInputStream(filePath) val fd: FileDescriptor = stream.getFD() val options = BitmapFactory.Options() options.inSampleSize = 1 options.inJustDecodeBounds = true BitmapFactory.decodeFileDescriptor(fd, null, options) if (options.mCancel || options.outWidth == -1 || options.outHeight == -1) { return null } options.inSampleSize = computeSampleSize(options, targetSize, maxPixels) options.inJustDecodeBounds = false options.inDither = false options.inPreferredConfig = Bitmap.Config.ARGB_8888 bitmap = BitmapFactory.decodeFileDescriptor(fd, null, options) } catch (ex: IOException) { Log.e(TAG, "", ex) } catch (oom: OutOfMemoryError) { Log.e(TAG, "Unable to decode file $filePath. OutOfMemoryError.", oom) } finally { try { if (stream != null) { stream.close() } } catch (ex: IOException) { Log.e(TAG, "", ex) } } } if (kind == Images.Thumbnails.MICRO_KIND) { bitmap = extractThumbnail( bitmap, TARGET_SIZE_MICRO_THUMBNAIL, TARGET_SIZE_MICRO_THUMBNAIL, OPTIONS_RECYCLE_INPUT ) } return bitmap }
This method first examines if the thumbnail embedded in EXIF is bigger than our target size . If not , then it 'll create a thumbnail from original image . Due to efficiency consideration , we want to let MediaThumbRequest avoid calling this method twice for both kinds , so it only requests for MICRO_KIND and set saveImage to true . This method always returns a `` square thumbnail '' for MICRO_KIND thumbnail .
fun <T : Annotation?> checkAnnotationPresent( annotatedType: AnnotatedElement?, annotationClass: Class<T>? ): T { return getAnnotation(annotatedType, annotationClass) }
Check if the annotation is present and if not throws an exception , this is just an overload for more clear naming .
fun store(o: Any): Element? { val p: PortalIcon = o as PortalIcon if (!p.isActive()) { return null } val element = Element("PortalIcon") storeCommonAttributes(p, element) element.setAttribute("scale", String.valueOf(p.getScale())) element.setAttribute("rotate", String.valueOf(p.getDegrees())) val portal: Portal = p.getPortal() if (portal == null) { log.info("PortalIcon has no associated Portal.") return null } element.setAttribute("portalName", portal.getName()) if (portal.getToBlock() != null) { element.setAttribute("toBlockName", portal.getToBlockName()) } if (portal.getFromBlockName() != null) { element.setAttribute("fromBlockName", portal.getFromBlockName()) } element.setAttribute("arrowSwitch", "" + if (p.getArrowSwitch()) "yes" else "no") element.setAttribute("arrowHide", "" + if (p.getArrowHide()) "yes" else "no") element.setAttribute( "class", "jmri.jmrit.display.controlPanelEditor.configurexml.PortalIconXml" ) return element }
Default implementation for storing the contents of a PortalIcon
fun __rxor__(rhs: Any?): Address? { return Address(m_value.xor(getBigInteger(rhs))) }
Used to support reverse XOR operations on addresses in Python scripts .
fun SimpleUser( username: String?, userIdentifiers: Collection<String?>?, connectionIdentifiers: Collection<String?>?, connectionGroupIdentifiers: Collection<String?>? ) { this(username) addReadPermissions(userPermissions, userIdentifiers) addReadPermissions(connectionPermissions, connectionIdentifiers) addReadPermissions(connectionGroupPermissions, connectionGroupIdentifiers) }
Creates a new SimpleUser having the given username and READ access to the users , connections , and groups having the given identifiers .
public void startDocument ( ) throws org . xml . sax . SAXException { }
Receive notification of the beginning of a document . < p > The SAX parser will invoke this method only once , before any other methods in this interface or in DTDHandler ( except for setDocumentLocator ) . < /p >
protected fun AbstractIntSpliterator(est: Long, additionalCharacteristics: Int) { est = est this.characteristics = if (additionalCharacteristics and Spliterator.SIZED !== 0) additionalCharacteristics or Spliterator.SUBSIZED else additionalCharacteristics }
Creates a spliterator reporting the given estimated size and characteristics .
private fun preAnalyzeMethods(): Set<DefUseCoverageTestFitness>? { val r: MutableSet<DefUseCoverageTestFitness> = HashSet<DefUseCoverageTestFitness>() val toAnalyze: LinkedList<ClassCallNode> = LinkedList<ClassCallNode>() toAnalyze.addAll(getInitialPreAnalyzeableMethods()) while (!toAnalyze.isEmpty()) { val currentMethod: ClassCallNode = toAnalyze.poll() val analyzeableEntry: CCFGMethodEntryNode = ccfg.getMethodEntryNodeForClassCallNode(currentMethod) if (analyzedMethods.contains(analyzeableEntry)) continue r.addAll(determineIntraInterMethodPairs(analyzeableEntry)) val parents: Set<ClassCallNode> = ccfg.getCcg().getParents(currentMethod) for (parent in parents) { if (toAnalyze.contains(parent)) continue if (analyzedMethods.contains(ccfg.getMethodEntryNodeForClassCallNode(parent))) continue val parentsChildren: Set<ClassCallNode> = ccfg.getCcg().getChildren(parent) var canAnalyzeNow = true for (parentsChild in parentsChildren) { if (parentsChild == null) continue if (!parentsChild.equals(parent) && !(toAnalyze.contains(parentsChild) || analyzedMethods.contains( ccfg.getMethodEntryNodeForClassCallNode(parentsChild) )) ) { canAnalyzeNow = false break } } if (canAnalyzeNow) { toAnalyze.offer(parent) } } } return r }
Checks if there are methods in the CCG that dont call any other methods except for maybe itself . For these we can predetermine free uses and activeDefs prior to looking for inter_method_pairs . After that we can even repeat this process for methods we now have determined free uses and activeDefs ! that way you can save a lot of computation . Map activeDefs and freeUses according to the variable so you can easily determine which defs will be active and which uses are free once you encounter a methodCall to that method without looking at its part of the CCFG
fun createSimpleProjectDescription(): SimpleProjectDescription? { return SimpleProjectDescriptionImpl() }
< ! -- begin-user-doc -- > < ! -- end-user-doc -- >
fun writeAll() { for (row in 0 until _numRows) { writeState.get(row) = WRITE } issueNextOperation() }
Start writing all rows out
fun str(): String? { return if (m_obj != null) m_obj.toString() else "" }
Cast result object to a string .
fun checkThreadIDAllow0(uid: Int): Int { var uid = uid if (uid == 0) { uid = currentThread.uid } if (!threadMap.containsKey(uid)) { log.warn(String.format("checkThreadID not found thread 0x%08X", uid)) throw SceKernelErrorException(ERROR_KERNEL_NOT_FOUND_THREAD) } if (!SceUidManager.checkUidPurpose(uid, "ThreadMan-thread", true)) { throw SceKernelErrorException(ERROR_KERNEL_NOT_FOUND_THREAD) } return uid }
Check the validity of the thread UID . Allow uid=0 .
fun isPowerOfThreeB(n: Int): Boolean { return n > 0 && maxPow3 % n === 0 }
Find the max power of 3 within int range . It should be divisible by all power of 3s .
protected fun addDefinitionRef(defRef: Element) { val ref: String = defRef.getAttributeNS(null, XBL_REF_ATTRIBUTE) val e: Element = ctx.getReferencedElement(defRef, ref) if (!XBL_NAMESPACE_URI.equals(e.getNamespaceURI()) || !XBL_DEFINITION_TAG.equals(e.getLocalName())) { throw BridgeException(ctx, defRef, ErrorConstants.ERR_URI_BAD_TARGET, arrayOf<Any>(ref)) } val ir = ImportRecord(defRef, e) imports.put(defRef, ir) val et: NodeEventTarget = defRef as NodeEventTarget et.addEventListenerNS( XMLConstants.XML_EVENTS_NAMESPACE_URI, "DOMAttrModified", refAttrListener, false, null ) val d: XBLOMDefinitionElement = defRef as XBLOMDefinitionElement val ns: String = d.getElementNamespaceURI() val ln: String = d.getElementLocalName() addDefinition(ns, ln, e as XBLOMDefinitionElement, defRef) }
Adds a definition through its referring definition element ( one with a 'ref ' attribute ) .
fun ActiveMQRATopicSubscriber(consumer: TopicSubscriber, session: ActiveMQRASession) { super(consumer, session) if (ActiveMQRATopicSubscriber.trace) { ActiveMQRALogger.LOGGER.trace("constructor($consumer, $session)") } }
Create a new wrapper
private fun fieldInsn(opcode: Int, ownerType: Type, name: String, fieldType: Type) { mv.visitFieldInsn(opcode, ownerType.getInternalName(), name, fieldType.getDescriptor()) }
Generates a get field or set field instruction .
fun doFrame(frameTimeNanos: Long) { if (isPaused.get()) { return } val frameTimeMillis = frameTimeNanos / 1000000 var timersToCall: WritableArray? = null synchronized(mTimerGuard) { while (!mTimers.isEmpty() && mTimers.peek().mTargetTime < frameTimeMillis) { val timer: Timer = mTimers.poll() if (timersToCall == null) { timersToCall = Arguments.createArray() } timersToCall.pushInt(timer.mCallbackID) if (timer.mRepeat) { timer.mTargetTime = frameTimeMillis + timer.mInterval mTimers.add(timer) } else { mTimerIdsToTimers.remove(timer.mCallbackID) } } } if (timersToCall != null) { org.graalvm.compiler.debug.Assertions.assertNotNull(mJSTimersModule) .callTimers(timersToCall) } org.graalvm.compiler.debug.Assertions.assertNotNull(mReactChoreographer) .postFrameCallback(ReactChoreographer.CallbackType.TIMERS_EVENTS, this) }
Calls all timers that have expired since the last time this frame callback was called .
protected fun executeLogoutCommand() { shoppingCartCommandFactory.execute( ShoppingCartCommand.CMD_LOGIN, cartMixin.getCurrentCart(), object : HashMap<String?, Any?>() { init { javax.swing.UIManager.put( ShoppingCartCommand.CMD_LOGOUT, ShoppingCartCommand.CMD_LOGOUT ) } }) }
Execute logout command .
fun equals(obj: Any): Boolean { if (obj === this) { return true } if (obj is CharSet == false) { return false } val other: CharSet = obj as CharSet return set.equals(other.set) }
< p > Compares two CharSet objects , returning true if they represent exactly the same set of characters defined in the same way. < /p > < p > The two sets < code > abc < /code > and < code > a-c < /code > are < i > not < /i > equal according to this method. < /p >
private fun PlatformUtils() {}
Creates a new PlatformUtils object .
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED) @Throws(APPlatformException::class) fun deleteInstance(instanceId: String?, settings: ProvisioningSettings): InstanceStatus? { val paramHandler = PropertyHandler(settings) paramHandler.setState(Status.DELETION_REQUESTED) val result = InstanceStatus() result.setChangedParameters(settings.getParameters()) return result }
Starts the deletion of an application instance . < p > The internal status < code > DELETION_REQUESTED < /code > is stored as a controller configuration setting . It is evaluated and handled by the status dispatcher , which is invoked at regular intervals by APP through the < code > getInstanceStatus < /code > method .
fun isOnline(): Boolean { val oo: Any = get_Value(COLUMNNAME_IsOnline) return if (oo != null) { if (oo is Boolean) oo.toBoolean() else "Y" == oo } else false }
Get Online Access .
fun EditSensorsAction(visionWorld: VisionWorld?) { super("Edit selected sensor(s)...") requireNotNull(visionWorld) { "visionWorld must not be null" } visionWorld = visionWorld visionWorld.getSensorSelectionModel().addSensorSelectionListener(SelectionListener()) }
Create a new edit sensors action .
fun replace(key: K?, value: V?): V? { var hash: Long var allocIndex: Long var segment: javax.swing.text.Segment<K?, V?> val oldValue: V if (segment(segmentIndex(keyHashCode(key).also { hash = it })).also { segment = it } .find(this, hash, key).also { allocIndex = it } > 0) { oldValue = segment.readValue(allocIndex) segment.writeValue(allocIndex, value) return oldValue } return null }
Replaces the entry for the specified key only if it is currently mapped to some value .
fun user(): UserResource? { return user }
Get the subresource containing all of the commands related to a tenant 's users .
private fun isExportable(step: Step): Boolean { return Exporter::class.java.getResource( String.format( "/edu/wpi/grip/ui/codegeneration/%s/operations/%s.vm", lang.filePath, step.getOperationDescription().name().replace(' ', '_') ) ) != null }
Checks if a step is exportable to this exporter 's language .
fun view(array: LongArray?, length: Int): List<Long?>? { return LongList(array, length) }
Creates and returns a view of the given long array that requires only a small object allocation .
fun insert(index: Int, o: Any): MutableString { return insert(index, o.toString()) }
Inserts the string representation of an object in this mutable string , starting from index < code > index < /code > .
fun checkAttributeValuesChanged( param: BlockVirtualPoolUpdateParam, vpool: VirtualPool ): Boolean { return super.checkAttributeValuesChanged( param, vpool ) || checkPathParameterModified(vpool.getNumPaths(), param.getMaxPaths() ) || checkPathParameterModified( vpool.getMinPaths(), param.getMinPaths() ) || checkPathParameterModified( vpool.getPathsPerInitiator(), param.getPathsPerInitiator() ) || checkPathParameterModified( vpool.getHostIOLimitBandwidth(), param.getHostIOLimitBandwidth() ) || checkPathParameterModified( vpool.getHostIOLimitIOPs(), param.getHostIOLimitIOPs() ) || VirtualPoolUtil.checkRaidLevelsChanged( vpool.getArrayInfo(), param.getRaidLevelChanges() ) || VirtualPoolUtil.checkForVirtualPoolAttributeModification( vpool.getDriveType(), param.getDriveType() ) || VirtualPoolUtil.checkThinVolumePreAllocationChanged( vpool.getThinVolumePreAllocationPercentage(), param.getThinVolumePreAllocationPercentage() ) || VirtualPoolUtil.checkProtectionChanged( vpool, param.getProtection() ) || VirtualPoolUtil.checkHighAvailabilityChanged(vpool, param.getHighAvailability()) }
Check if any VirtualPool attribute values have changed .
fun visitIntersection_Intersection( type1: AnnotatedIntersectionType, type2: AnnotatedIntersectionType, visited: VisitHistory ): Boolean? { if (!arePrimeAnnosEqual(type1, type2)) { return false } visited.add(type1, type2) return areAllEqual(type1.directSuperTypes(), type2.directSuperTypes(), visited) }
//TODO : SHOULD PRIMARY ANNOTATIONS OVERRIDE INDIVIDUAL BOUND ANNOTATIONS ? //TODO : IF SO THEN WE SHOULD REMOVE THE arePrimeAnnosEqual AND FIX AnnotatedIntersectionType Two intersection types are equal if : 1 ) Their sets of primary annotations are equal 2 ) Their sets of bounds ( the types being intersected ) are equal
@Throws(IOException::class) fun writeEnum(fieldNumber: Int, value: Int) { writeTag(fieldNumber, WireFormat.WIRETYPE_VARINT) writeEnumNoTag(value) }
Write an enum field , including tag , to the stream . Caller is responsible for converting the enum value to its numeric value .
@Throws(CRLException::class) fun X509CRLImpl(inStrm: InputStream?) { try { parse(sun.security.util.DerValue(inStrm)) } catch (e: IOException) { signedCRL = null throw CRLException("Parsing error: " + e.getMessage()) } }
Unmarshals an X.509 CRL from an input stream . Only one CRL is expected at the end of the input stream .
protected fun removeTurntable(o: LayoutTurntable): Boolean { if (!noWarnTurntable) { val selectedValue: Int = javax.swing.JOptionPane.showOptionDialog( this, rb.getString("Question4r"), Bundle.getMessage("WarningTitle"), javax.swing.JOptionPane.YES_NO_CANCEL_OPTION, javax.swing.JOptionPane.QUESTION_MESSAGE, null, arrayOf<Any>( Bundle.getMessage("ButtonYes"), Bundle.getMessage("ButtonNo"), rb.getString("ButtonYesPlus") ), Bundle.getMessage("ButtonNo") ) if (selectedValue == 1) { return false } if (selectedValue == 2) { noWarnTurntable = true } } if (selectedObject === o) { selectedObject = null } if (prevSelectedObject === o) { prevSelectedObject = null } for (j in 0 until o.getNumberRays()) { val t: TrackSegment = o.getRayConnectOrdered(j) if (t != null) { substituteAnchor(o.getRayCoordsIndexed(j), o, t) } } for (i in 0 until turntableList.size()) { val lx: LayoutTurntable = turntableList.get(i) if (lx === o) { turntableList.remove(i) o.remove() setDirty(true) repaint() return true } } return false }
Remove a Layout Turntable
@Throws(javax.swing.text.BadLocationException::class, IOException::class) protected fun emptyTag(elem: Element) { if (!inContent && !inPre) { indentSmart() } val attr: AttributeSet = elem.getAttributes() closeOutUnwantedEmbeddedTags(attr) writeEmbeddedTags(attr) if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.CONTENT)) { inContent = true text(elem) } else if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.COMMENT)) { comment(elem) } else { val isBlock: Boolean = isBlockTag(elem.getAttributes()) if (inContent && isBlock) { writeLineSeparator() indentSmart() } val nameTag: Any? = if (attr != null) attr.getAttribute(javax.swing.text.StyleConstants.NameAttribute) else null val endTag: Any? = if (attr != null) attr.getAttribute(javax.swing.text.html.HTML.Attribute.ENDTAG) else null var outputEndTag = false if (nameTag != null && endTag != null && endTag is String && endTag == "true") { outputEndTag = true } if (completeDoc && matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.HEAD)) { if (outputEndTag) { writeStyles((getDocument() as HTMLDocument).getStyleSheet()) } wroteHead = true } write('<') if (outputEndTag) { write('/') } write(elem.getName()) writeAttributes(attr) write('>') if (matchNameAttribute(attr, javax.swing.text.html.HTML.Tag.TITLE) && !outputEndTag) { val doc: Document = elem.getDocument() val title = doc.getProperty(Document.TitleProperty) as String write(title) } else if (!inContent || isBlock) { writeLineSeparator() if (isBlock && inContent) { indentSmart() } } } }
Writes out all empty elements ( all tags that have no corresponding end tag ) .
fun isPending(): Boolean { return getConfidence().getConfidenceType() === TransactionConfidence.ConfidenceType.PENDING }
Convenience wrapper around getConfidence ( ) .getConfidenceType ( )
fun fireSensorMatrixChanged(oldSensorMatrix: SensorMatrix?, sensorMatrix: SensorMatrix?) { requireNotNull(oldSensorMatrix) { "oldSensorMatrix must not be null" } requireNotNull(sensorMatrix) { "sensorMatrix must not be null" } val listeners: Array<Any> = listenerList.getListenerList() var event: VisionWorldModelEvent? = null var i = listeners.size - 2 while (i >= 0) { if (listeners[i] === VisionWorldModelListener::class.java) { if (event == null) { event = VisionWorldModelEvent(source, oldSensorMatrix, sensorMatrix) } (listeners[i + 1] as VisionWorldModelListener).sensorMatrixChanged(event) } i -= 2 } }
Fire a sensor matrix changed event to all registered vision world model listeners .
fun DNameConstraints(parent: javax.swing.JDialog?) { super(parent) setTitle(res.getString("DNameConstraints.Title")) initComponents() }
Creates a new DNameConstraints dialog .
fun visit(v: jdk.nashorn.internal.ir.visitor.NodeVisitor) { v.visit(this) }
Visits this node . There are no children .