Code_Function
stringlengths
13
13.9k
Message
stringlengths
10
1.46k
public fun banUser( userId: String, reason: String? = null, timeout: Int? = null, ) { chatClient.channel(channelId).banUser(userId, reason, timeout) .enqueue(onError = { chatError -> val errorMessage = chatError.message ?: chatError.cause?.message ?: "Unable to ban the user"  StreamLog.e("MessageListViewModel.banUser") { errorMessage } }) }
Bans the given user inside this channel.
public fun unbanUser(userId: String) { chatClient.channel(channelId).unbanUser(userId).enqueue(onError = { chatError -> val errorMessage = chatError.message ?: chatError.cause?.message ?: "Unable to unban the user"  StreamLog.e("MessageListViewModel.unban") { errorMessage } }) }
Unbans the given user inside this channel.
public fun shadowBanUser( userId: String, reason: String? = null, timeout: Int? = null, ) { chatClient.channel(channelId).shadowBanUser(userId, reason, timeout) .enqueue(onError = { chatError -> val errorMessage = chatError.message ?: chatError.cause?.message ?: "Unable to shadow ban the user"  StreamLog.e("MessageListViewModel.shadowBanUser") { errorMessage } }) }
Shadow bans the given user inside this channel.
public fun removeShadowBanFromUser(userId: String) { chatClient.channel(channelId).removeShadowBan(userId) .enqueue(onError = { chatError -> val errorMessage = chatError.message ?: chatError.cause?.message ?: "Unable to remove the user shadow ban"  StreamLog.e("MessageListViewModel.removeShadowBanFromUser") { errorMessage } }) }
Removes the shaddow ban for the given user inside this channel.
private fun reactToMessage(reaction: Reaction, message: Message) { val channelState = channelState.value ?: return  if (message.ownReactions.any { it.messageId == reaction.messageId && it.type == reaction.type }) { chatClient.deleteReaction( messageId = message.id, reactionType = reaction.type, cid = channelState.cid ).enqueue() } else { chatClient.sendReaction( reaction = reaction, enforceUnique = enforceUniqueReactions, cid = channelState.cid ).enqueue() } }
Triggered when the user chooses the [React] action for the currently selected message. If the message already has that reaction, from the current user, we remove it. Otherwise we add a new reaction.
private fun updateMessagePin(message: Message) { val updateCall = if (message.pinned) { chatClient.unpinMessage(message) } else { chatClient.pinMessage(message = message, expirationDate = null) }  updateCall.enqueue() }
Pins or unpins the message from the current channel based on its state.
public fun leaveThread() { messageMode = MessageMode.Normal messagesState = messagesState.copy(selectedMessageState = null) threadMessagesState = MessagesState() lastSeenThreadMessage = null threadJob?.cancel() }
Leaves the thread we're in and resets the state of the [messageMode] and both of the [MessagesState]s.
public fun removeOverlay() { threadMessagesState = threadMessagesState.copy(selectedMessageState = null) messagesState = messagesState.copy(selectedMessageState = null) }
Resets the [MessagesState]s, to remove the message overlay, by setting 'selectedMessage' to null.
public fun clearNewMessageState() { threadMessagesState = threadMessagesState.copy(newMessageState = null, unreadCount = 0) messagesState = messagesState.copy(newMessageState = null, unreadCount = 0) }
Clears the [NewMessageState] from our UI state, after the user taps on the "Scroll to bottom" or "New Message" actions in the list or simply scrolls to the bottom.
public fun focusMessage(messageId: String) { val messages = currentMessagesState.messageItems.map { if (it is MessageItemState && it.message.id == messageId) { it.copy(focusState = MessageFocused) } else { it } }  viewModelScope.launch { updateMessages(messages) delay(RemoveMessageFocusDelay) removeMessageFocus(messageId) } }
Sets the focused message to be the message with the given ID, after which it removes it from focus with a delay.
private fun removeMessageFocus(messageId: String) { val messages = currentMessagesState.messageItems.map { if (it is MessageItemState && it.message.id == messageId) { it.copy(focusState = MessageFocusRemoved) } else { it } }  if (scrollToMessage?.id == messageId) { scrollToMessage = null }  updateMessages(messages) }
Removes the focus from the message with the given ID.
private fun updateMessages(messages: List<MessageListItemState>) { if (isInThread) { this.threadMessagesState = threadMessagesState.copy(messageItems = messages) } else { this.messagesState = messagesState.copy(messageItems = messages) } }
Updates the current message state with new messages.
public fun getMessageWithId(messageId: String): Message? { val messageItem =currentMessagesState.messageItems.firstOrNull { it is MessageItemState && it.message.id == messageId }  return (messageItem as? MessageItemState)?.message }
Returns a message with the given ID from the [currentMessagesState].
public fun performGiphyAction(action: GiphyAction) { val message = action.message when (action) { is SendGiphy -> chatClient.sendGiphy(message) is ShuffleGiphy -> chatClient.shuffleGiphy(message) is CancelGiphy -> chatClient.cancelEphemeralMessage(message) }.exhaustive.enqueue() }
Executes one of the actions for the given ephemeral giphy message.
public fun scrollToSelectedMessage(message: Message) { val isMessageInList = currentMessagesState.messageItems.firstOrNull { it is MessageItemState && it.message.id == message.id } != null  if (isMessageInList) { focusMessage(message.id) } else { scrollToMessage = message loadMessage(message = message) } }
Scrolls to message if in list otherwise get the message from backend.
fun save(filename: String?): Boolean { try { mOutput = FileOutputStream(filename) val output = ByteArray(BUFFER_SIZE) while (mInput.available() > 0) { val size: Int = read(output) if (size > 0) { mOutput.write(output, 0, size) } else break } mInput.close() mOutput.close() return true } catch (e: Exception) { e.printStackTrace() } try { if (mInput != null) mInput.close() if (mOutput != null) mOutput.close() } catch (e: IOException) { e.printStackTrace() } return false }
Saves an unencrypted copy of the music file as an Mp3
fun isSingleton(): Boolean { return true }
Always returns < code > true < /code > .
fun append(s: String?) { compoundID.append(s) }
Append a new segment to the compound name of the operator
fun eUnset(featureID: Int) { when (featureID) { TypesPackage.TSTRUCT_GETTER__DEFINED_MEMBER -> { setDefinedMember(null as TStructMember?) return } } super.eUnset(featureID) }
< ! -- begin-user-doc -- > < ! -- end-user-doc -- >
private fun doSetRhythmDrawable(@Nullable drawable: RhythmDrawable) { if (mRhythmDrawable != null) { mRhythmDrawable.setCallback(null) } mRhythmDrawable = drawable if (mRhythmDrawable != null) { mRhythmDrawable.setBounds(mBounds) mRhythmDrawable.setCallback(this) } }
Links new drawable to this view
protected fun AbstractSVGFilterPrimitiveElementBridge() {}
Constructs a new bridge for a filter primitive element .
@Pointcut("within(@javax.persistence.Entity *) || " + "within(@javax.persistence.MappedSuperclass *) || " + "within(@javax.persistence.Embeddable *)") fun jpa() { }
Pointcut for jpa entities
fun OMGrid( lat: Double, lon: Double, x: Int, y: Int, vResolution: Double, hResolution: Double, data: Array<IntArray?>? ) { setRenderType(RENDERTYPE_OFFSET) set(lat, lon, x, y, vResolution, hResolution, data) }
Create a OMGrid that covers a x/y screen area , anchored to a lat/lon point . Column major by default . If your data is row major , use null for the data , set the major direction , and then set the data .
operator fun compareTo(other: SpatialObjectPair): Int { return java.lang.Double.compare(this.distance, other.distance) }
Compares this object with the specified object for order . Returns a negative integer , zero , or a positive integer as this object is less than , equal to , or greater than the specified object . < p/ >
fun checkLabel(label: Label?, checkVisited: Boolean, msg: String) { requireNotNull(label) { "Invalid $msg (must not be null)" } require( (checkVisited && labels.get(label) == null)) { "Invalid $msg (must be visited first)" } }
Checks that the given label is not null . This method can also check that the label has been visited .
@Throws(MissingResourceException::class) fun MinecraftlyLogger(core: MinecraftlyCore, parentLogger: Logger) { super("Core " + parentLogger.getName(), parentLogger.getResourceBundleName()) core = core this.debug = File(core.getMinecraftlyDataFolder(), ".debugging").exists() setParent(parentLogger) setUseParentHandlers(true) }
Method to construct a logger for Minecraftly 's Core .
fun cleanIndex( mutator: RowMutator, doType: DataObjectType, listToCleanRef: SoftReference<IndexCleanupList?> ) { val listToClean: IndexCleanupList = listToCleanRef.get() if (listToClean == null) { _log.warn( "clean up list for {} has been recycled by GC, skip it", doType.getClass().getName() ) return } val cleanList: Map<String, List<Column<CompositeColumnName>>> = listToClean.getColumnsToClean() val entryIt: Iterator<Map.Entry<String, List<Column<CompositeColumnName>>>> = cleanList.entries.iterator() val dependentFields: MutableMap<String, ColumnField> = HashMap() while (entryIt.hasNext()) { val (rowKey, cols) = entryIt.next() for (i in cols.indices) { val column: Column<CompositeColumnName> = cols[i] val field: ColumnField = doType.getColumnField(column.getName().getOne()) field.removeColumn(rowKey, column, mutator, listToClean.getAllColumns(rowKey)) for (depField in field.getDependentFields()) { dependentFields[depField.getName()] = depField } } for (depField in dependentFields.values) { depField.removeIndex( rowKey, null, mutator, listToClean.getAllColumns(rowKey), listToClean.getObject(rowKey) ) } } removeIndexOfInactiveObjects(mutator, doType, listToClean as IndexCleanupList, true) mutator.executeIndexFirst() }
Clean out old column / index entries synchronously
@Throws(IOException::class) protected fun onPrepareRequest(request: HttpUriRequest?) { }
Called before the request is executed using the underlying HttpClient . < p > Overwrite in subclasses to augment the request. < /p >
override fun toString(): String? { return super.toString() + "NameConstraints: [" + (if (permitted == null) "" else """ Permitted:${permitted.toString()}""") + (if (excluded == null) "" else """ Excluded:${excluded.toString()}""") + " ]\n" }
Return the printable string .
fun LRUCache(initialSize: Int, maxSize: Int) { this(initialSize, maxSize, 1) }
Create a new LRU cache .
@Throws(Exception::class) fun HarCapabilityContainerTest(testName: String?, testData: EnvironmentTestData?) { super(testName, testData) }
Initializes the test case .
private fun locate(name: String): File? { var prefix = "" var sourceFile: File? = null var idx = 0 while (true) { if (idx == 0 && ToolIO.getUserDir() != null) { sourceFile = File(ToolIO.getUserDir(), name) } else { sourceFile = File(prefix + name) } if (sourceFile.exists()) break if (idx >= libraryPathEntries.size()) break prefix = libraryPathEntries.elementAt(idx++) } return sourceFile }
Searches for the file in current directory ( ToolIO.userDirectory ) and in library paths
@JvmStatic fun main(args: Array<String>) { val timeResolution = TimeResolution() timeResolution.measureTimer() timeResolution.measureTimeFunctions(javax.accessibility.AccessibleAction.INCREMENT, MAX) timeResolution.measureSleep() timeResolution.measureWait() }
Execute the various timer resolution tests .
@Throws(IOException::class, ClassNotFoundException::class) private fun readObject(s: ObjectInputStream) { try { s.defaultReadObject() this.queue = arrayOfNulls<Any>(q.size()) comparator = q.comparator() addAll(q) } finally { q = null } }
Reconstitutes this queue from a stream ( that is , deserializes it ) .
fun createEdge(source: BasicBlock?, dest: BasicBlock?, @Edge.Type type: Int): Edge { val edge: Edge = createEdge(source, dest) edge.setType(type) return edge }
Add a unique edge to the graph . There must be no other edge already in the CFG with the same source and destination blocks .
private fun initialize() { this.setContentPane(getJPanel()) this.pack() }
This method initializes this
fun translate(x: Float, y: Float, z: Float) { val tmp = Matrix4f() tmp.loadTranslate(x, y, z) multiply(tmp) }
Modifies the current matrix by post-multiplying it with a translation matrix of given dimensions
fun AdaptiveJobCountLoadProbe() {}
Initializes active job probe .
fun primeFncName(s: Session?, line: Int) { primeAllFncNames(s) }
Called in order to make sure that we have a function name available at the given location . For AVM+ swfs we do n't need a swd and therefore do n't have access to function names in the same fashion . We need to ask the player for a particular function name .
fun <V> addDistinctEntry(sourceList: MutableList<V>?, entry: V): Boolean { return if (sourceList != null && !sourceList.contains(entry)) sourceList.add(entry) else false }
add distinct entry to list
protected fun initFromJar(file: File) { val jar: JarFile var entry: JarEntry val enm: Enumeration<JarEntry> if (VERBOSE) { println("Analyzing jar: $file") } if (!file.exists()) { println("Jar does not exist: $file") return } try { jar = JarFile(file) enm = jar.entries() while (enm.hasMoreElements()) { entry = enm.nextElement() if (entry.getName().endsWith(".class")) { add(entry.getName()) } } initFromManifest(jar.getManifest()) } catch (e: Exception) { e.printStackTrace() } }
Fills the class cache with classes from the specified jar .
fun build(@Nullable quadConsumer: Consumer<UnpackedBakedQuad.Builder?>?): List<BakedQuad>? { val quads: MutableList<BakedQuad> = ArrayList<BakedQuad>(this.vertices.size() / 4) if (this.vertices.size() % 4 !== 0) throw RuntimeException("Invalid number of vertices") var i = 0 while (i < this.vertices.size()) { val vert1: sun.security.provider.certpath.Vertex = this.vertices.get(i) val vert2: sun.security.provider.certpath.Vertex = this.vertices.get(i + 1)
Builds the quads . Specify a consumer to modify the quads
fun newJdbcExceptionTranslator(): SQLExceptionTranslator? { return SQLStateSQLExceptionTranslator() }
Create an appropriate SQLExceptionTranslator for the given TransactionManager . If a DataSource is found , a SQLErrorCodeSQLExceptionTranslator for the DataSource is created ; else , a SQLStateSQLExceptionTranslator as fallback .
override fun onSaveInstanceState(outState: Bundle) { outState.putBoolean("SlidingActivityHelper.open", mSlidingMenu.isMenuShowing()) outState.putBoolean( "SlidingActivityHelper.secondary", mSlidingMenu.isSecondaryMenuShowing() ) }
Called to retrieve per-instance state from an activity before being killed so that the state can be restored in onCreate ( Bundle ) or onRestoreInstanceState ( Bundle ) ( the Bundle populated by this method will be passed to both ) .
fun `steFor_$fieldInit`(): SymbolTableEntryInternal? { return getSymbolTableEntryInternal("\$fieldInit", true) }
`` $ fieldInit '' - retrieve the internal symbol table entry for the symbol `` $ fieldInit ''
fun isProcessing(): Boolean { val oo: Any = get_Value(COLUMNNAME_Processing) return if (oo != null) { if (oo is Boolean) oo.toBoolean() else "Y" == oo } else false }
Get Process Now .
fun createFromCommandline(args: Array<String>): Profile? { val profile = Profile() var i = 0 while (i != args.size) { if (args[i] == "-u") { profile.setUser(args[i + 1])} else if (args[i] == "-p") { profile.setPassword(args[i + 1]) } else if (args[i] == "-c") { profile.setCharacter(args[i + 1]) } else if (args[i] == "-h") { profile.setHost(args[i + 1]) } else if (args[i] == "-P") { profile.setPort(args[i + 1].toInt()) } else if (args[i] == "-S") { profile.setSeed(args[i + 1]) } i++ } if (profile.getCharacter() == null) { profile.setCharacter(profile.getUser()) } return profile }
create a profile based on command line arguments < ul > < li > -u : username < /li > < li > -p : password < /li > < li > -c : character name ( defaults to username ) < /li > < li > -h : hostname < /li > < li > -P : port < /li > < li > -S : pre authentication seed < /li > < /ul >
fun MainWindow() { super("Main Window") settings = Settings() update = UpdateWindow() blocksWindow = BlockListWindow() consoleLog = GUIConsoleLog() if (settings.getPreferences().getBoolean("OPEN_CONSOLE_ON_START", true)) { consoleLog.setVisible(true) } export = ExportWindow() main = this setSize(1000, 800) setMinimumSize(Dimension(400, 400)) setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) setTitle("jMC2Obj") setLocationRelativeTo(null) panel = MainPanel() add(panel) setVisible(true) }
Window contructor .
fun findAndInit(it: Iterator<*>) { while (it.hasNext()) { findAndInit(it.next()) } }
Eventually gets called when the MouseDelegator is added to the BeanContext , and when other objects are added to the BeanContext anytime after that . The MouseDelegator looks for a MapBean to manage MouseEvents for , and MouseModes to use to manage those events . If a MapBean is added to the BeanContext while another already is in use , the second MapBean will take the place of the first .
fun wantsFutureVariantBases(): Boolean { return mHaplotypeA.wantsFutureVariantBases() || mHaplotypeB.wantsFutureVariantBases() }
Test whether a deficit of variant bases are upstream in the queue in order to perform a step .
fun createPotentialProducer(baseObject: Any?,methodName: String?,dataType: Class<*>?): PotentialProducer? {val description: String = getDescriptionString(baseObject, methodName, dataType) return PotentialProducer(parentComponent,baseObject,methodName,dataType,null,null,description)}
Create a potential producer ( without auxiliary arguments ) . This is probably the main method to use in a script .
fun Hashtable() { this(11, 0.75f) }
Constructs a new , empty hashtable with a default initial capacity ( 11 ) and load factor , which is < tt > 0.75 < /tt > .
private fun runRoutesDistance(runNr: String, sc: Scenario) { val ug: UserGroup = UserGroup.URBAN val lastIteration: Int = sc.getConfig().controler().getLastIteration() val eventsFile: String = sc.getConfig().controler() .getOutputDirectory() + "/ITERS/it." + lastIteration + "/" + lastIteration + ".events.xml.gz" val lmdfed = LegModeRouteDistanceDistributionAnalyzer() lmdfed.init(sc, eventsFile) lmdfed.preProcessData() lmdfed.postProcessData() File(RUN_DIR + "/analysis/legModeDistributions/").mkdirs() lmdfed.writeResults(RUN_DIR + "/analysis/legModeDistributions/" + runNr + "_it." + lastIteration + "_") }
It will write route distance distribution from events and take the beeline distance for teleported modes
@Throws(IOException::class) fun findAvailableStrings(uri: String): List<String>? { _resourcesNotLoaded.clear() val fulluri: String = _path + uri val strings: MutableList<String> = ArrayList() val resources: Enumeration<URL> = getResources(fulluri) while (resources.hasMoreElements()) { val url: URL = resources.nextElement() try { val string: String = readContents(url) strings.add(string) } catch (notAvailable: IOException) { _resourcesNotLoaded.add(url.toExternalForm()) } } return strings }
Reads the contents of the found URLs as a Strings and returns them . Individual URLs that can not be read are skipped and added to the list of 'resourcesNotLoaded '
fun computeInPlace(vararg dataset: Double): Double { checkArgument(dataset.size > 0, "Cannot calculate quantiles of an empty dataset")if (containsNaN(dataset)) return NaN } val numerator = index as Long * (dataset.size - 1) val quotient = LongMath.divide(numerator, scale, RoundingMode.DOWN) as Int val remainder = (numerator - quotient.toLong() * scale) as Int selectInPlace(quotient, dataset, 0, dataset.size - 1) return if (remainder == 0) { dataset[quotient] } else { selectInPlace(quotient + 1, dataset, quotient + 1, dataset.size - 1) interpolate(dataset[quotient], dataset[quotient + 1], remainder, scale) } }
Computes the quantile value of the given dataset , performing the computation in-place .
fun scale(factor: Double): Ellipse? { val r: RotatedRect = rect.clone() r.size = Size(factor * rect.size.width, factor * rect.size.height) return Ellipse(r) v }
Scale this ellipse by a scaling factor about its center
@Throws(Exception::class) private fun waitForReportRunCompletion( reporting: Dfareporting, userProfileId: Long, file: File ): File? { var file: File = file var interval: Int for (i in 0..MAX_POLLING_ATTEMPTS) { if (!file.getStatus().equals("PROCESSING")) { break } interval = (POLL_TIME_INCREMENT * Math.pow(1.6, i.toDouble())) System.out.printf("Polling again in %s ms.%n", interval) Thread.sleep(interval.toLong()) file = reporting.reports().files().get(userProfileId, file.getReportId(), file.getId()) .execute() } return file }
Waits for a report file to generate with exponential back-off .
private fun showFeedback(message: String) { if (myHost != null) { myHost.showFeedback(message) } else { println(message) } }
Used to communicate feedback pop-up messages between a plugin tool and the main Whitebox user-interface .
fun AllocationSite() { this(0, 0) }
An anonymous allocation site
@Synchronized override fun equals(o: Any?): Boolean { return super.equals(o) }
Compares the specified Object with this Vector for equality . Returns true if and only if the specified Object is also a List , both Lists have the same size , and all corresponding pairs of elements in the two Lists are < em > equal < /em > . ( Two elements < code > e1 < /code > and < code > e2 < /code > are < em > equal < /em > if < code > ( e1==null ? e2==null : e1.equals ( e2 ) ) < /code > . ) In other words , two Lists are defined to be equal if they contain the same elements in the same order .
protected fun makeConverter(): DateTimeConverter? { return jdk.internal.joptsimple.util.DateConverter() }
Create the Converter with no default value .
fun skip(str: String, csq: CharSequence?): Boolean { return if (this.at(str, csq)) { index += str.length true } else { false } }
Moves this cursor forward only if at the specified string . This method is equivalent to : [ code ] if ( at ( str , csq ) ) increment ( str.length ( ) ) ; [ /code ]
fun deleteExpectedPartitionValues(expectedPartitionValuesDeleteRequest: ExpectedPartitionValuesDeleteRequest): ExpectedPartitionValuesInformation? { validateExpectedPartitionValuesDeleteRequest(expectedPartitionValuesDeleteRequest) val partitionKeyGroupEntity: PartitionKeyGroupEntity = partitionKeyGroupDaoHelper.getPartitionKeyGroupEntity( expectedPartitionValuesDeleteRequest.getPartitionKeyGroupKey() ) val expectedPartitionValueEntityMap: Map<String, ExpectedPartitionValueEntity> = getExpectedPartitionValueEntityMap(partitionKeyGroupEntity.getExpectedPartitionValues()) val deletedExpectedPartitionValueEntities: MutableCollection<ExpectedPartitionValueEntity> = ArrayList() for (expectedPartitionValue in expectedPartitionValuesDeleteRequest.getExpectedPartitionValues()) { val expectedPartitionValueEntity: ExpectedPartitionValueEntity? = expectedPartitionValueEntityMap[expectedPartitionValue] if (expectedPartitionValueEntity != null) { deletedExpectedPartitionValueEntities.add(expectedPartitionValueEntity) } else { throw ObjectNotFoundException( java.lang.String.format( "Expected partition value \"%s\" doesn't exist in \"%s\" partition key group.", expectedPartitionValue, partitionKeyGroupEntity.getPartitionKeyGroupName() ) ) } } for (expectedPartitionValueEntity in deletedExpectedPartitionValueEntities) { partitionKeyGroupEntity.getExpectedPartitionValues() .remove(expectedPartitionValueEntity) } expectedPartitionValueDao.saveAndRefresh(partitionKeyGroupEntity) return createExpectedPartitionValuesInformationFromEntities( partitionKeyGroupEntity, deletedExpectedPartitionValueEntities ) }
Deletes specified expected partition values from an existing partition key group which is identified by name .
@JvmStatic fun main(args: Array<String>) { DOMTestCase.doMain(hasAttribute01::class.java, args) }
Runs this test from the command line .
fun launch() { val parentActivity: Activity = ActivityDelegate.getActivityForTabId(mParentId) mLaunchedId = ChromeLauncherActivity.launchDocumentInstance( parentActivity, mIsIncognito, mAsyncParams ) mLaunchTimestamp = SystemClock.elapsedRealtime() run()}
Starts an Activity to with the stored parameters .
fun unlink(succ: Index<V?>): Boolean { return !indexesDeletedNode() && casRight(succ, succ.right) }
Tries to CAS right field to skip over apparent successor succ . Fails ( forcing a retraversal by caller ) if this node is known to be deleted .
@Throws(IOException::class) fun wrap(reader: LeafReader?, sort: Sort?): LeafReader? { return wrap(reader, org.junit.runner.manipulation.Sorter(sort).sort(reader)) }
Return a sorted view of < code > reader < /code > according to the order defined by < code > sort < /code > . If the reader is already sorted , this method might return the reader as-is .
private fun fillPomsFromChildren( poms: MutableCollection<ArtifactInformation>, art: ArtifactInformation, artifacts: Map<String, ArtifactInformation> ): Int { var cnt = 0 for (childId in art.getChildIds()) { val child: ArtifactInformation? = artifacts[childId] if (child != null) { val childName: String = child.getName() if (isPomFileName(childName)) { poms.add(child) ++cnt } } } return cnt }
Fill a collection with all POMs for the children of an artifact .
fun AxisSpace() { this.top = 0.0 this.bottom = 0.0 this.left = 0.0 this.right = 0.0 }
Creates a new axis space record .
fun FontConverter(mapper: jdk.internal.module.ModuleLoaderMap.Mapper) { mapper = mapper if (mapper == null) { textAttributeConverter = null } else { textAttributeConverter = TextAttributeConverter() } }
Constructs a FontConverter .
fun typeName(): String? { return "long" }
Returns a String description of what kind of entry this is .
fun d(tag: String?, s: String?) { if (LOG.DEBUG >= LOGLEVEL) Log.d(tag, s) }
Debug log message .
fun EdgeInfo(start: Int, end: Int, cap: Int) { this(start, end, cap, 0) }
Construct EdgeInfo from ( start , end ) vertices with given capacity .
private fun isSessionPaused(session: FileSharingSession?): Boolean { if (session == null) { throw ServerApiGenericException("Unable to check if transfer is paused since session with file transfer ID '$mFileTransferId' not available!") } return session.isFileTransferPaused() }
Is session paused ( only for HTTP transfer )
private fun processProtein(){}
Implementation of Rob Finn 's algorithm for post processing , translated from Perl to Java . < p/ > Also includes additional code to ensure seed alignments are included as matches , regardless of score .
fun execute(timeSeries: MetricTimeSeries, functionValueMap: FunctionValueMap) { if (timeSeries.size() <= 0) { functionValueMap.add(this, Double.NaN) return } val values: DoubleArray = timeSeries.getValuesAsArray() var min = values[0] var max = values[0] for (i in 1 until values.size) { val current = values[i] if (current < min) { min = current } if (current > max) { max = current } } functionValueMap.add(this, Math.abs(max - min)) }
Gets difference between the maximum and the minimum value . It is always a positive value .
private fun returnData(ret: Any) { if (myHost != null) { myHost.returnData(ret) } }
Used to communicate a return object from a plugin tool to the main Whitebox user-interface .
fun ImpliedCovTable(wrapper: SemImWrapper, measured: Boolean, correlations: Boolean) { wrapper = wrapper measured = measured correlations = correlations this.nf = NumberFormatUtil.getInstance().getNumberFormat() if (measured() && covariances()) { matrix = getSemIm().getImplCovarMeas().toArray() } else if (measured() && !covariances()) { matrix = corr(getSemIm().getImplCovarMeas().toArray()) } else if (!measured() && covariances()) { val implCovarC: TetradMatrix = getSemIm().getImplCovar(false) matrix = implCovarC.toArray() } else if (!measured() && !covariances()) { val implCovarC: TetradMatrix = getSemIm().getImplCovar(false) matrix = corr(implCovarC.toArray()) }
Constructs a new table for the given covariance matrix , the nodes for which are as specified ( in the order they appear in the matrix ) .
fun create(): Graphics? { return PSPathGraphics( getDelegate().create() as Graphics2D, java.awt.print.PrinterJob.getPrinterJob(), sun.swing.text.TextComponentPrintable.getPrintable(), getPageFormat(), getPageIndex(), canDoRedraws() ) }
Creates a new < code > Graphics < /code > object that is a copy of this < code > Graphics < /code > object .
fun deriveThisOrNextChildKey(parent: DeterministicKey?, childNumber: Int): DeterministicKey? { var nAttempts = 0 var child = ChildNumber(childNumber) val isHardened: Boolean = child.isHardened() while (nAttempts < MAX_CHILD_DERIVATION_ATTEMPTS) { try { child = ChildNumber(child.num() + nAttempts, isHardened) return deriveChildKey(parent, child) } catch (ignore: HDDerivationException) { } nAttempts++ } throw HDDerivationException("Maximum number of child derivation attempts reached, this is probably an indication of a bug.") }
Derives a key of the `` extended '' child number , ie . with the 0x80000000 bit specifying whether to use hardened derivation or not . If derivation fails , tries a next child .
fun merge(state: LR1State): LR1State? { val items: HashSet<LR1Item> = HashSet<LR1Item>() for (item1 in items) { var newItem: LR1Item = item1 val item2: LR1Item = state.getItemByLR0Kernel(item1.getLR0Kernel()) newItem = newItem.merge(item2) items.add(newItem) } return LR1State(items) }
Merges this state with the given one and returns the result . Only works , if both states have equal LR ( 0 ) kernels .
@DSComment("constructor") @DSSafe(DSCat.SAFE_OTHERS) @DSGenerator( tool_name = "Doppelganger",tool_version = "2.0", generated_on = "2013-12-30 12:34:15.039 -0500", hash_original_method = "5474E95C495E2BDEA7848B2F1051B5AB", hash_generated_method = "1FFFECB7616C84868E8040908FCDEBA5" ) @Deprecated("") fun BitmapDrawable(`is`: InputStream) { this(BitmapState(BitmapFactory.decodeStream(`is`)), null) if (mBitmap == null) { Log.w("BitmapDrawable", "BitmapDrawable cannot decode $`is`") } }
Create a drawable by decoding a bitmap from the given input stream .
fun <T> toString(cls: Class<T>?,obj: T?,name0: String?,val0: Any,name1: String?,val1: Any,name2: String?,val2: Any): String? {}
Produces auto-generated output of string presentation for given object and its declaration class .
fun AsyncHttpClient(fixNoHttpResponseException: Boolean, httpPort: Int, httpsPort: Int) { this(getDefaultSchemeRegistry(fixNoHttpResponseException, httpPort, httpsPort)) }
Creates new AsyncHttpClient using given params
private void extractExtensionHeader ( byte [ ] data , int length , int dataId , RtpPacket packet ) { byte [ ] extensionHeaderData = new byte [ length * 4 ] ; System . arraycopy ( data , ++ dataId , extensionHeaderData , 0 , extensionHeaderData . length ) ; packet . extensionHeader = new RtpExtensionHeader ( ) ; int i = 0 ; while ( packet . extensionHeader . elementsCount ( ) < length ) { byte idAndLength = extensionHeaderData [ i ] ; if ( idAndLength == 0x00 ) { i = i + 1 ; continue ; } int elementId = ( idAndLength & 0xf0 ) > > > 4 ; if ( elementId > 0 && elementId < 15 ) { int elementLength = ( idAndLength & 0x0f ) ; byte [ ] elementData = new byte [ elementLength + 1 ] ; System . arraycopy ( extensionHeaderData , i + 1 , elementData , 0 , elementData . length ) ; packet . extensionHeader . addElement ( elementId , elementData ) ; i = i + elementData . length + 1 ; } else { break ; } } }
Extract Extension Header
fun showConfirmDialog( ctx: Context?, message: String?, yesListener: DialogInterface.OnClickListener?, noListener: DialogInterface.OnClickListener? ) { showConfirmDialog(ctx, message, yesListener, noListener, R.string.yes, R.string.no) }
Creates a confirmation dialog with Yes-No Button . By default the buttons just dismiss the dialog .
fun TelefoneTextWatcher(callbackErros: EventoDeValidacao?) { setEventoDeValidacao(callbackErros) }
TODO Javadoc pendente
fun RenameResourceProcessor(resource: IResource?) { require(!(resource == null || !resource.exists())) { "resource must not be null and must exist" } fResource = resource fRenameArguments = null fUpdateReferences = true setNewResourceName(resource.getName()) }
Creates a new rename resource processor .
fun perform() { }
Perform the operation by calling a function in the Python script . This method adapts each of the inputs into Python objects , calls the Python function , and then converts the outputs of the function back into Java objects and assigns them to the outputs array . The Python function should return a tuple , list , or other sequence containing the outputs . If there is only one output , it can just return a value . Either way , the number of inputs and outputs should match up with the number of parameters and return values of the function .
@Throws(JMSException::class) fun createConnectionConsumer( connection: Connection, destination: Destination?, ssp: ServerSessionPool? ): ConnectionConsumer? { return connection.createConnectionConsumer(destination, null, ssp, 1) }
Creates a connection for a consumer .
fun covarianceMatrix( data1: Array<DoubleArray?>, data2: Array<DoubleArray?>, delay: Int ): Array<DoubleArray>? { }
Compute the covariance matrix between all column pairs ( variables ) in the multivariate data set , which consists of two separate multivariate vectors .
fun isProcessed(): Boolean { val oo: Any = get_Value(COLUMNNAME_Processed) return if (oo != null) { if (oo is Boolean) oo.toBoolean() else "Y" == oo } else false }
Get Processed .
private fun quickSort1(x: CharArray, off: Int, len: Int, comp: CharComparator) { }
Sorts the specified sub-array of chars into ascending order .
@Throws(NullPointerException::class) fun Sound(@Nonnull path: String?) { this(FileUtil.findURL(path)) }
Create a Sound object using the media file at path
fun hasGwtFacet(project: IProject?): Boolean { var hasFacet = false try { hasFacet = FacetedProjectFramework.hasProjectFacet(project, "com.gwtplugins.gwt.facet") } catch (e: CoreException) { CorePluginLog.logInfo("hasGetFacet: Error, can't figure GWT facet.", e) } return hasFacet }
Returns if this project has a GWT facet . TODO use extension point to get query GwtWtpPlugin ...
public Yytoken yylex ( ) throws java . io . IOException , ParseException { int zzInput ; int zzAction ; int zzCurrentPosL ; int zzMarkedPosL ; int zzEndReadL = zzEndRead ; char [ ] zzBufferL = zzBuffer ; char [ ] zzCMapL = ZZ_CMAP ; int [ ] zzTransL = ZZ_TRANS ; int [ ] zzRowMapL = ZZ_ROWMAP ; int [ ] zzAttrL = ZZ_ATTRIBUTE ; while ( true ) { zzMarkedPosL = zzMarkedPos ; yychar += zzMarkedPosL - zzStartRead ; zzAction = - 1 ; zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL ; zzState = ZZ_LEXSTATE [ zzLexicalState ] ; zzForAction : { while ( true ) { if ( zzCurrentPosL < zzEndReadL ) zzInput = zzBufferL [ zzCurrentPosL ++ ] ; else if ( zzAtEOF ) { zzInput = YYEOF ; break zzForAction ; } else { zzCurrentPos = zzCurrentPosL ; zzMarkedPos = zzMarkedPosL ; boolean eof = zzRefill ( ) ; zzCurrentPosL = zzCurrentPos ; zzMarkedPosL = zzMarkedPos ; zzBufferL = zzBuffer ; zzEndReadL = zzEndRead ; if ( eof ) { zzInput = YYEOF ; break zzForAction ; } else { zzInput = zzBufferL [ zzCurrentPosL ++ ] ; } } int zzNext = zzTransL [ zzRowMapL [ zzState ] + zzCMapL [ zzInput ] ] ; if ( zzNext == - 1 ) break zzForAction ; zzState = zzNext ; int zzAttributes = zzAttrL [ zzState ] ; if ( ( zzAttributes & 1 ) == 1 ) { zzAction = zzState ; zzMarkedPosL = zzCurrentPosL ; if ( ( zzAttributes & 8 ) == 8 ) break zzForAction ; } } } zzMarkedPos = zzMarkedPosL ; switch ( zzAction < 0 ? zzAction : ZZ_ACTION [ zzAction ] ) { case 11 : { sb . append ( yytext ( ) ) ; } case 25 : break ; case 4 : { sb . delete ( 0 , sb . length ( ) ) ; yybegin ( STRING_BEGIN ) ; } case 26 : break ; case 16 : { sb . append ( '\b' ) ; } case 27 : break ; case 6 : { return new Yytoken ( Yytoken . TYPE_RIGHT_BRACE , null ) ; } case 28 : break ; case 23 : { Boolean val = Boolean . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 29 : break ; case 22 : { return new Yytoken ( Yytoken . TYPE_VALUE , null ) ; } case 30 : break ; case 13 : { yybegin ( YYINITIAL ) ; return new Yytoken ( Yytoken . TYPE_VALUE , sb . toString ( ) ) ; } case 31 : break ; case 12 : { sb . append ( '\\' ) ; } case 32 : break ; case 21 : { Double val = Double . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 33 : break ; case 1 : { throw new ParseException ( yychar , ParseException . ERROR_UNEXPECTED_CHAR , new Character ( yycharat ( 0 ) ) ) ; } case 34 : break ; case 8 : { return new Yytoken ( Yytoken . TYPE_RIGHT_SQUARE , null ) ; } case 35 : break ; case 19 : { sb . append ( '\r' ) ; } case 36 : break ; case 15 : { sb . append ( '/' ) ; } case 37 : break ; case 10 : { return new Yytoken ( Yytoken . TYPE_COLON , null ) ; } case 38 : break ; case 14 : { sb . append ( '"' ) ; } case 39 : break ; case 5 : { return new Yytoken ( Yytoken . TYPE_LEFT_BRACE , null ) ; } case 40 : break ; case 17 : { sb . append ( '\f' ) ; } case 41 : break ; case 24 : { try { int ch = Integer . parseInt ( yytext ( ) . substring ( 2 ) , 16 ) ; sb . append ( ( char ) ch ) ; } catch ( Exception e ) { throw new ParseException ( yychar , ParseException . ERROR_UNEXPECTED_EXCEPTION , e ) ; } } case 42 : break ; case 20 : { sb . append ( '\t' ) ; } case 43 : break ; case 7 : { return new Yytoken ( Yytoken . TYPE_LEFT_SQUARE , null ) ; } case 44 : break ; case 2 : { Long val = Long . valueOf ( yytext ( ) ) ; return new Yytoken ( Yytoken . TYPE_VALUE , val ) ; } case 45 : break ; case 18 : { sb . append ( '\n' ) ; } case 46 : break ; case 9 : { return new Yytoken ( Yytoken . TYPE_COMMA , null ) ; } case 47 : break ; case 3 : { } case 48 : break ; default : if ( zzInput == YYEOF && zzStartRead == zzCurrentPos ) { zzAtEOF = true ; return null ; } else { zzScanError ( ZZ_NO_MATCH ) ; } } } }
Resumes scanning until the next regular expression is matched , the end of input is encountered or an I/O-Error occurs .
@Throws(IOException::class) fun encode(out: OutputStream) { val tmp: sun.security.util.DerOutputStream = sun.security.util.DerOutputStream() if (extensionValue == null) { extensionId = sun.security.x509.PKIXExtensions.PolicyConstraints_Id critical = false encodeThis() } super.encode(tmp) out.write(tmp.toByteArray()) }
Write the extension to the DerOutputStream .
fun <T : Comparable<T>?> introSort(a: Array<T>?, fromIndex: Int, toIndex: Int) { if (toIndex - fromIndex <= 1) return introSort(a, fromIndex, toIndex, Comparator.naturalOrder()) }
Sorts the given array slice in natural order . This method uses the intro sort algorithm , but falls back to insertion sort for small arrays .
@Throws(IOException::class) fun deleteLabel(projectId: Serializable?, label: GitlabLabel) { deleteLabel(projectId, label.getName()) }
Deletes an existing label .
@Throws(ServiceException::class, IOException::class) private fun createSingleEvent( service: CalendarService, eventTitle: String, eventContent: String ): CalendarEventEntry? { return createEvent(service, eventTitle, eventContent, null, false.toInt(), null) }
Creates a single-occurrence event .