idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
206,466 | public V removeAt(int index) {<NEW_LINE>final Object old = mArray[(index << 1) + 1];<NEW_LINE>if (mSize <= 1) {<NEW_LINE>// Now empty.<NEW_LINE>if (DEBUG)<NEW_LINE>Log.d(TAG, "remove: shrink from " + mHashes.length + " to 0");<NEW_LINE>freeArrays(mHashes, mArray, mSize);<NEW_LINE>mHashes = ContainerHelpers.EMPTY_INTS;<NEW_LINE>mArray = ContainerHelpers.EMPTY_OBJECTS;<NEW_LINE>mSize = 0;<NEW_LINE>} else {<NEW_LINE>if (mHashes.length > (BASE_SIZE * 2) && mSize < mHashes.length / 3) {<NEW_LINE>// Shrunk enough to reduce size of arrays. We don't allow it to<NEW_LINE>// shrink smaller than (BASE_SIZE*2) to avoid flapping between<NEW_LINE>// that and BASE_SIZE.<NEW_LINE>final int n = mSize > (BASE_SIZE * 2) ? (mSize + (mSize >> 1)) : (BASE_SIZE * 2);<NEW_LINE>if (DEBUG)<NEW_LINE>Log.d(TAG, "remove: shrink from " + mHashes.length + " to " + n);<NEW_LINE>final int[] ohashes = mHashes;<NEW_LINE>final Object[] oarray = mArray;<NEW_LINE>allocArrays(n);<NEW_LINE>mSize--;<NEW_LINE>if (index > 0) {<NEW_LINE>if (DEBUG)<NEW_LINE>Log.d(TAG, "remove: copy from 0-" + index + " to 0");<NEW_LINE>System.arraycopy(ohashes, 0, mHashes, 0, index);<NEW_LINE>System.arraycopy(oarray, 0, mArray, 0, index << 1);<NEW_LINE>}<NEW_LINE>if (index < mSize) {<NEW_LINE>if (DEBUG)<NEW_LINE>Log.d(TAG, "remove: copy from " + (index + 1) + "-" + mSize + " to " + index);<NEW_LINE>System.arraycopy(ohashes, index + 1, mHashes, index, mSize - index);<NEW_LINE>System.arraycopy(oarray, (index + 1) << 1, mArray, index << 1, (mSize - index) << 1);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mSize--;<NEW_LINE>if (index < mSize) {<NEW_LINE>if (DEBUG)<NEW_LINE>Log.d(TAG, "remove: move " + (index + 1) + "-" + mSize + " to " + index);<NEW_LINE>System.arraycopy(mHashes, index + 1, mHashes, index, mSize - index);<NEW_LINE>System.arraycopy(mArray, (index + 1) << 1, mArray, index << 1, (mSize - index) << 1);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>mArray[(mSize << 1) + 1] = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return (V) old;<NEW_LINE>} | mArray[mSize << 1] = null; |
1,655,165 | private boolean cmd_save() {<NEW_LINE>KeyNamePair pp = (KeyNamePair) roleField.getSelectedItem();<NEW_LINE>roleField.setBackground(pp == null);<NEW_LINE>if (pp == null)<NEW_LINE>return false;<NEW_LINE>int AD_Role_ID = pp.getKey();<NEW_LINE>//<NEW_LINE>boolean isActive = cbActive.isSelected();<NEW_LINE><MASK><NEW_LINE>boolean isReadOnly = cbReadOnly.isSelected();<NEW_LINE>boolean isDependentEntities = cbDependent.isSelected();<NEW_LINE>//<NEW_LINE>if (m_currentData == null) {<NEW_LINE>m_currentData = new MRecordAccess(Env.getCtx(), AD_Role_ID, m_AD_Table_ID, m_Record_ID, null);<NEW_LINE>m_recordAccesss.add(m_currentData);<NEW_LINE>m_currentRow = m_recordAccesss.size() - 1;<NEW_LINE>}<NEW_LINE>m_currentData.setIsActive(isActive);<NEW_LINE>m_currentData.setIsExclude(isExclude);<NEW_LINE>m_currentData.setIsReadOnly(isReadOnly);<NEW_LINE>m_currentData.setIsDependentEntities(isDependentEntities);<NEW_LINE>boolean success = m_currentData.save();<NEW_LINE>//<NEW_LINE>log.fine("Success=" + success);<NEW_LINE>return success;<NEW_LINE>} | boolean isExclude = cbExclude.isSelected(); |
83,523 | public final boolean eval(ITool tool, TLCState s1, TLCState s2) {<NEW_LINE>if (this.subscript != null) {<NEW_LINE>IValue v1 = tool.eval(this.subscript, con, s1, TLCState.Empty, EvalControl.Clear);<NEW_LINE>IValue v2 = tool.eval(this.subscript, con, s2, null, EvalControl.Clear);<NEW_LINE>boolean <MASK><NEW_LINE>if (this.isBox) {<NEW_LINE>if (isStut) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (isStut) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>IValue val = tool.eval(this.body, con, s1, s2, EvalControl.Clear);<NEW_LINE>if (!(val instanceof IBoolValue)) {<NEW_LINE>Assert.fail(EC.TLC_LIVE_ENCOUNTERED_NONBOOL_PREDICATE);<NEW_LINE>}<NEW_LINE>return ((IBoolValue) val).getVal();<NEW_LINE>} | isStut = v1.equals(v2); |
1,463,670 | String heapHistogram(@BindAgentId String agentId) throws Exception {<NEW_LINE>checkNotNull(liveJvmService);<NEW_LINE>HeapHistogram heapHistogram;<NEW_LINE>try {<NEW_LINE>heapHistogram = liveJvmService.heapHistogram(agentId);<NEW_LINE>} catch (AgentNotConnectedException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>return "{\"agentNotConnected\":true}";<NEW_LINE>} catch (UnavailableDueToRunningInJreException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>return "{\"unavailableDueToRunningInJre\":true}";<NEW_LINE>} catch (UnavailableDueToRunningInJ9JvmException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>return "{\"unavailableDueToRunningInJ9Jvm\":true}";<NEW_LINE>} catch (UnavailableDueToDockerAlpinePidOneException e) {<NEW_LINE>logger.debug(e.getMessage(), e);<NEW_LINE>return "{\"unavailableDueToDockerAlpinePidOne\":true}";<NEW_LINE>} catch (AgentUnsupportedOperationException e) {<NEW_LINE>// this operation introduced in 0.9.2<NEW_LINE>logger.debug(<MASK><NEW_LINE>return getAgentUnsupportedOperationResponse(agentId);<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>JsonGenerator jg = mapper.getFactory().createGenerator(CharStreams.asWriter(sb));<NEW_LINE>try {<NEW_LINE>jg.writeStartObject();<NEW_LINE>jg.writeArrayFieldStart("items");<NEW_LINE>long totalBytes = 0;<NEW_LINE>long totalCount = 0;<NEW_LINE>for (HeapHistogram.ClassInfo classInfo : heapHistogram.getClassInfoList()) {<NEW_LINE>jg.writeStartObject();<NEW_LINE>jg.writeStringField("className", classInfo.getClassName());<NEW_LINE>jg.writeNumberField("bytes", classInfo.getBytes());<NEW_LINE>jg.writeNumberField("count", classInfo.getCount());<NEW_LINE>jg.writeEndObject();<NEW_LINE>totalBytes += classInfo.getBytes();<NEW_LINE>totalCount += classInfo.getCount();<NEW_LINE>}<NEW_LINE>jg.writeEndArray();<NEW_LINE>jg.writeNumberField("totalBytes", totalBytes);<NEW_LINE>jg.writeNumberField("totalCount", totalCount);<NEW_LINE>jg.writeEndObject();<NEW_LINE>} finally {<NEW_LINE>jg.close();<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | e.getMessage(), e); |
1,421,045 | protected CompletableFuture<Void> onClose() {<NEW_LINE>if (!this.getIsClosed()) {<NEW_LINE>try {<NEW_LINE>this.underlyingFactory.unregisterForWatchdog(this);<NEW_LINE>this.activeClientTokenManager.cancel();<NEW_LINE>scheduleLinkCloseTimeout(TimeoutTracker.create(operationTimeout, this.receiveLink.getName()));<NEW_LINE>this.underlyingFactory.scheduleOnReactorThread(new DispatchHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onEvent() {<NEW_LINE>if (receiveLink != null && receiveLink.getLocalState() != EndpointState.CLOSED) {<NEW_LINE>receiveLink.close();<NEW_LINE>} else if (receiveLink == null || receiveLink.getRemoteState() == EndpointState.CLOSED) {<NEW_LINE>if (closeTimer != null && !closeTimer.isCancelled()) {<NEW_LINE>closeTimer.cancel(false);<NEW_LINE>}<NEW_LINE>linkClose.complete(null);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} catch (IOException | RejectedExecutionException schedulerException) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return this.linkClose;<NEW_LINE>} | this.linkClose.completeExceptionally(schedulerException); |
732,267 | private void maybeUpdateExportDeclaration(NodeTraversal t, Node n) {<NEW_LINE>if (!currentScript.isModule || !n.getString().equals("exports") || !isAssignTarget(n)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>Node rhs = assignNode.getLastChild();<NEW_LINE>if (rhs != currentScript.defaultExport.rhs) {<NEW_LINE>// This script has duplicate 'exports = ' assignments. Preserve the rhs as an expression but<NEW_LINE>// don't declare it as a global variable.<NEW_LINE>assignNode.replaceWith(rhs.detach());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!currentScript.declareLegacyNamespace && currentScript.defaultExportLocalName != null) {<NEW_LINE>assignNode.getParent().detach();<NEW_LINE>Node binaryNamespaceName = astFactory.createName(currentScript.getBinaryNamespace(), type(n));<NEW_LINE>this.declareGlobalVariable(binaryNamespaceName, t);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Rewrite "exports = ..." as "var module$exports$foo$Bar = ..."<NEW_LINE>Node jsdocNode;<NEW_LINE>if (currentScript.declareLegacyNamespace) {<NEW_LINE>Node legacyQname = this.astFactory.createQName(this.globalTypedScope, currentScript.namespaceId).srcrefTree(n);<NEW_LINE>legacyQname.setJSType(n.getJSType());<NEW_LINE>n.replaceWith(legacyQname);<NEW_LINE>jsdocNode = assignNode;<NEW_LINE>} else {<NEW_LINE>rhs.detach();<NEW_LINE>Node exprResultNode = assignNode.getParent();<NEW_LINE>Node binaryNamespaceName = astFactory.createName(currentScript.getBinaryNamespace(), type(n));<NEW_LINE>binaryNamespaceName.setOriginalName("exports");<NEW_LINE>this.declareGlobalVariable(binaryNamespaceName, t);<NEW_LINE>Node exportsObjectCreationNode = IR.var(binaryNamespaceName, rhs);<NEW_LINE>exportsObjectCreationNode.srcrefTreeIfMissing(exprResultNode);<NEW_LINE>exportsObjectCreationNode.putBooleanProp(Node.IS_NAMESPACE, true);<NEW_LINE>exprResultNode.replaceWith(exportsObjectCreationNode);<NEW_LINE>jsdocNode = exportsObjectCreationNode;<NEW_LINE>currentScript.hasCreatedExportObject = true;<NEW_LINE>}<NEW_LINE>markConstAndCopyJsDoc(assignNode, jsdocNode);<NEW_LINE>compiler.reportChangeToEnclosingScope(jsdocNode);<NEW_LINE>maybeUpdateExportObjectLiteral(t, rhs);<NEW_LINE>return;<NEW_LINE>} | Node assignNode = n.getParent(); |
1,401,259 | public boolean onCallApi(int page, @Nullable Issue parameter) {<NEW_LINE>if (parameter == null) {<NEW_LINE>sendToView(BaseMvp.FAView::hideProgress);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (page == 1) {<NEW_LINE>lastPage = Integer.MAX_VALUE;<NEW_LINE>sendToView(view -> view.getLoadMore().reset());<NEW_LINE>}<NEW_LINE>if (page > lastPage || lastPage == 0) {<NEW_LINE>sendToView(IssueTimelineMvp.View::hideProgress);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>setCurrentPage(page);<NEW_LINE>String login = parameter.getLogin();<NEW_LINE>String repoId = parameter.getRepoId();<NEW_LINE>if (page == 1) {<NEW_LINE>manageObservable(RestProvider.getRepoService(isEnterprise()).isCollaborator(login, repoId, Login.getUser().getLogin()).doOnNext(booleanResponse -> isCollaborator = booleanResponse.code() == 204));<NEW_LINE>}<NEW_LINE>int number = parameter.getNumber();<NEW_LINE>Observable<List<TimelineModel>> observable = RestProvider.getIssueService(isEnterprise()).getTimeline(login, repoId, number, page).flatMap(response -> {<NEW_LINE>if (response != null) {<NEW_LINE>lastPage = response.getLast();<NEW_LINE>}<NEW_LINE>return TimelineConverter.INSTANCE.convert(response != null ? response.getItems() : null);<NEW_LINE>}).toList().toObservable();<NEW_LINE>makeRestCall(observable, timeline -> {<NEW_LINE>sendToView(view -> view.onNotifyAdapter(timeline, page));<NEW_LINE>loadComment(page, <MASK><NEW_LINE>});<NEW_LINE>return true;<NEW_LINE>} | commentId, login, repoId, timeline); |
1,688,360 | private int lookup(int row, char c) {<NEW_LINE>// If the char is small we can lookup in the index table<NEW_LINE>if (c < 0x80) {<NEW_LINE>int column = _lookup[c];<NEW_LINE>if (column != Integer.MIN_VALUE) {<NEW_LINE>// The char is indexed, so should be in normal row or bigRow<NEW_LINE>if (column >= 0) {<NEW_LINE>// look in the normal row<NEW_LINE>int idx = row * ROW_SIZE + column;<NEW_LINE>row = _table[idx];<NEW_LINE>} else {<NEW_LINE>// Look in the indexed part of the bigRow<NEW_LINE>Node<V> node = _node[row];<NEW_LINE>char[] big = node == null ? <MASK><NEW_LINE>int idx = -column;<NEW_LINE>if (big == null || idx >= big.length)<NEW_LINE>return -1;<NEW_LINE>row = big[idx];<NEW_LINE>}<NEW_LINE>return row == 0 ? -1 : row;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Not an indexed char, so do a linear search through he tail of the bigRow<NEW_LINE>Node<V> node = _node[row];<NEW_LINE>char[] big = node == null ? null : node._bigRow;<NEW_LINE>if (big != null) {<NEW_LINE>for (int i = _bigRowSize; i < big.length; i += 2) if (big[i] == c)<NEW_LINE>return big[i + 1];<NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>} | null : _node[row]._bigRow; |
1,597,664 | public Object encrypt(Object data, String algorithmKey, String algorithm) {<NEW_LINE>if (!jwtDetails.getAlgorithm().equalsIgnoreCase("none")) {<NEW_LINE>try {<NEW_LINE>DefaultJwtEncryptionAndDecryptionService jwtEncryptionService = new DefaultJwtEncryptionAndDecryptionService(jwtDetails.getAlgorithmKey(), jwtDetails.getId() + "_enc", jwtDetails.getAlgorithm());<NEW_LINE>Payload payload;<NEW_LINE>if (jwtToken instanceof SignedJWT) {<NEW_LINE>payload = ((SignedJWT) jwtToken).getPayload();<NEW_LINE>} else {<NEW_LINE>payload = ((PlainJWT) jwtToken).getPayload();<NEW_LINE>}<NEW_LINE>// Example Request JWT encrypted with RSA-OAEP-256 and 128-bit AES/GCM<NEW_LINE>// JWEHeader jweHeader = new JWEHeader(JWEAlgorithm.RSA1_5, EncryptionMethod.A128GCM);<NEW_LINE>JWEHeader jweHeader = new JWEHeader(jwtEncryptionService.getDefaultAlgorithm(jwtDetails.getAlgorithm()), jwtEncryptionService.parseEncryptionMethod(jwtDetails.getEncryptionMethod()));<NEW_LINE>jweObject = new JWEObject(// required to indicate nested JWT<NEW_LINE>new JWEHeader.Builder(jweHeader).// required to indicate nested JWT<NEW_LINE>contentType("JWT"<MASK><NEW_LINE>jwtEncryptionService.encryptJwt(jweObject);<NEW_LINE>} catch (NoSuchAlgorithmException | InvalidKeySpecException | JOSEException e) {<NEW_LINE>_logger.error("Encrypt Exception", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return data;<NEW_LINE>} | ).build(), payload); |
1,852,967 | private AudioInputStream synthesizeUsingF0Modification(int backchannelNumber, double[] pScalesArray, double[] tScalesArray, AudioFileFormat aft) throws SynthesisException {<NEW_LINE>if (backchannelNumber > unitFileReader.getNumberOfUnits()) {<NEW_LINE>throw new IllegalArgumentException("requesting unit should not be more than number of units");<NEW_LINE>}<NEW_LINE>if (!f0ContourImposeSupport) {<NEW_LINE>throw new SynthesisException("Mary configuration of this voice doesn't support intonation contour imposition");<NEW_LINE>}<NEW_LINE>VocalizationUnit bUnit = unitFileReader.getUnit(backchannelNumber);<NEW_LINE>long start = bUnit.startTime;<NEW_LINE>int duration = bUnit.duration;<NEW_LINE>Datagram[] frames = null;<NEW_LINE>try {<NEW_LINE>frames = audioTimeline.getDatagrams(start, duration);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new SynthesisException("cannot get audio frames from timeline file " + e);<NEW_LINE>}<NEW_LINE>assert frames != null : "Cannot generate audio from null frames";<NEW_LINE>pScalesArray = MathUtils.<MASK><NEW_LINE>tScalesArray = MathUtils.arrayResize(tScalesArray, frames.length);<NEW_LINE>assert tScalesArray.length == pScalesArray.length;<NEW_LINE>assert frames.length == tScalesArray.length;<NEW_LINE>AudioFormat af;<NEW_LINE>if (aft == null) {<NEW_LINE>// default audio format<NEW_LINE>// 8000,11025,16000,22050,44100<NEW_LINE>float sampleRate = 16000.0F;<NEW_LINE>// 8,16<NEW_LINE>int sampleSizeInBits = 16;<NEW_LINE>// 1,2<NEW_LINE>int channels = 1;<NEW_LINE>// true,false<NEW_LINE>boolean signed = true;<NEW_LINE>// true,false<NEW_LINE>boolean bigEndian = false;<NEW_LINE>af = new AudioFormat(sampleRate, sampleSizeInBits, channels, signed, bigEndian);<NEW_LINE>} else {<NEW_LINE>af = aft.getFormat();<NEW_LINE>}<NEW_LINE>double[] audio_double = (new FDPSOLAProcessor()).processDatagram(frames, null, af, null, pScalesArray, tScalesArray, false); | arrayResize(pScalesArray, frames.length); |
113,126 | private NetbeansActionMapping findMapAction(Map<String, String> replaceMap, Project project, String actionName) throws XmlPullParserException, IOException {<NEW_LINE>// TODO need some caching really badly here..<NEW_LINE>Reader read = performDynamicSubstitutions(replaceMap, getRawMappingsAsString());<NEW_LINE>ActionToGoalMapping mapping = reader.read(read);<NEW_LINE>Iterator<NetbeansActionMapping> it = mapping.getActions().iterator();<NEW_LINE>NetbeansActionMapping action = null;<NEW_LINE>NbMavenProject mp = project.getLookup().lookup(NbMavenProject.class);<NEW_LINE><MASK><NEW_LINE>while (it.hasNext()) {<NEW_LINE>NetbeansActionMapping elem = it.next();<NEW_LINE>if (actionName.equals(elem.getActionName()) && (elem.getPackagings().contains(prjPack.trim()) || elem.getPackagings().contains("*") || elem.getPackagings().isEmpty())) {<NEW_LINE>// NOI18N<NEW_LINE>action = elem;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return action;<NEW_LINE>} | String prjPack = mp.getPackagingType(); |
554,290 | final DisableVgwRoutePropagationResult executeDisableVgwRoutePropagation(DisableVgwRoutePropagationRequest disableVgwRoutePropagationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disableVgwRoutePropagationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<DisableVgwRoutePropagationRequest> request = null;<NEW_LINE>Response<DisableVgwRoutePropagationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisableVgwRoutePropagationRequestMarshaller().marshall(super.beforeMarshalling(disableVgwRoutePropagationRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisableVgwRoutePropagation");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<DisableVgwRoutePropagationResult> responseHandler = new StaxResponseHandler<DisableVgwRoutePropagationResult>(new DisableVgwRoutePropagationResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
713,341 | boolean execute(CommandSender sender, String label, String[] args, CommandMessages commandMessages) {<NEW_LINE>if (args.length == 1) {<NEW_LINE>sendHelp(sender, label, commandMessages.getResourceBundle());<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>for (int i = 1; i < args.length; i++) {<NEW_LINE>builder.append(args[i] + (i == args.length <MASK><NEW_LINE>}<NEW_LINE>ReflectionProcessor processor = new ReflectionProcessor(builder.toString(), sender instanceof Entity ? sender : ServerProvider.getServer());<NEW_LINE>Object result = processor.process();<NEW_LINE>if (result == null) {<NEW_LINE>new LocalizedStringImpl("glowstone.eval.null", commandMessages.getResourceBundle()).send(sender);<NEW_LINE>} else {<NEW_LINE>new LocalizedStringImpl("glowstone.eval", commandMessages.getResourceBundle()).send(sender, result);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | - 1 ? "" : " ")); |
1,003,850 | public static OemListMenuResponse unmarshall(OemListMenuResponse oemListMenuResponse, UnmarshallerContext _ctx) {<NEW_LINE>oemListMenuResponse.setRequestId(_ctx.stringValue("OemListMenuResponse.RequestId"));<NEW_LINE>oemListMenuResponse.setErrorDesc(_ctx.stringValue("OemListMenuResponse.ErrorDesc"));<NEW_LINE>oemListMenuResponse.setTraceId(_ctx.stringValue("OemListMenuResponse.TraceId"));<NEW_LINE>oemListMenuResponse.setErrorCode(_ctx.stringValue("OemListMenuResponse.ErrorCode"));<NEW_LINE>oemListMenuResponse.setSuccess(_ctx.booleanValue("OemListMenuResponse.Success"));<NEW_LINE>List<DataItem> data = new ArrayList<DataItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("OemListMenuResponse.Data.Length"); i++) {<NEW_LINE>DataItem dataItem = new DataItem();<NEW_LINE>dataItem.setKey(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].Key"));<NEW_LINE>dataItem.setUrl(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].Url"));<NEW_LINE>dataItem.setName(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].Name"));<NEW_LINE>dataItem.setOrder(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].Order"));<NEW_LINE>dataItem.setParentKey(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].ParentKey"));<NEW_LINE>dataItem.setSourceType(_ctx.stringValue("OemListMenuResponse.Data[" + i + "].SourceType"));<NEW_LINE>dataItem.setPermission(_ctx.booleanValue("OemListMenuResponse.Data[" + i + "].Permission"));<NEW_LINE>dataItem.setPurchasePackage(_ctx.booleanValue<MASK><NEW_LINE>List<Map<Object, Object>> children = _ctx.listMapValue("OemListMenuResponse.Data[" + i + "].Children");<NEW_LINE>dataItem.setChildren(children);<NEW_LINE>data.add(dataItem);<NEW_LINE>}<NEW_LINE>oemListMenuResponse.setData(data);<NEW_LINE>return oemListMenuResponse;<NEW_LINE>} | ("OemListMenuResponse.Data[" + i + "].PurchasePackage")); |
1,141,660 | private void verifyAndCachePurchase(Purchase purchase) {<NEW_LINE>String purchaseData = purchase.getOriginalJson();<NEW_LINE>String dataSignature = purchase.getSignature();<NEW_LINE>try {<NEW_LINE>JSONObject purchaseJsonObject = new JSONObject(purchaseData);<NEW_LINE>String productId = purchaseJsonObject.getString(Constants.RESPONSE_PRODUCT_ID);<NEW_LINE>if (verifyPurchaseSignature(productId, purchaseData, dataSignature)) {<NEW_LINE>String purchaseType = detectPurchaseTypeFromPurchaseResponseData(purchaseJsonObject);<NEW_LINE>BillingCache cache = purchaseType.equals(Constants.PRODUCT_TYPE_SUBSCRIPTION) ? cachedSubscriptions : cachedProducts;<NEW_LINE>cache.put(productId, purchaseData, dataSignature);<NEW_LINE>if (eventHandler != null) {<NEW_LINE>PurchaseInfo purchaseInfo = new PurchaseInfo(<MASK><NEW_LINE>reportProductPurchased(productId, purchaseInfo);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Log.e(LOG_TAG, "Public key signature doesn't match!");<NEW_LINE>reportBillingError(Constants.BILLING_ERROR_INVALID_SIGNATURE, null);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>Log.e(LOG_TAG, "Error in verifyAndCachePurchase", e);<NEW_LINE>reportBillingError(Constants.BILLING_ERROR_OTHER_ERROR, e);<NEW_LINE>}<NEW_LINE>savePurchasePayload(null);<NEW_LINE>} | purchaseData, dataSignature, getPurchasePayload()); |
700,026 | void printOptions(Consumer<String> println, boolean extra) {<NEW_LINE>SortedMap<String, List<OptionInfo>> optionInfo = new TreeMap<>();<NEW_LINE>apiOptions.forEach((optionName, option) -> {<NEW_LINE>if (option.isDeprecated() || option.extra != extra) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String groupOrOptionName = option.group != null ? APIOption.Utils.groupName(option.group) : optionName;<NEW_LINE>if (optionInfo.containsKey(groupOrOptionName)) {<NEW_LINE>List<OptionInfo> options = optionInfo.get(groupOrOptionName);<NEW_LINE>if (options.size() == 1) {<NEW_LINE>optionInfo.put(groupOrOptionName, Collections.singletonList(option));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>optionInfo.forEach((optionName, options) -> {<NEW_LINE>if (options.size() == 1) {<NEW_LINE>OptionInfo singleOption = options.get(0);<NEW_LINE>if (singleOption.group == null) {<NEW_LINE>SubstrateOptionsParser.printOption(println, optionName, singleOption.helpText, 4, 22, 66);<NEW_LINE>} else {<NEW_LINE>if (!Arrays.asList(singleOption.variants).contains(singleOption.defaultValue)) {<NEW_LINE>printGroupOption(println, optionName, options);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | printGroupOption(println, optionName, options); |
567,465 | public JsonAdapter<?> create(Type type, Set<? extends Annotation> annotations, Moshi moshi) {<NEW_LINE>if (Types.getRawType(type) != baseType || !annotations.isEmpty()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int size = labelToType.size();<NEW_LINE>Map<String, JsonAdapter<Object>> labelToAdapter = new LinkedHashMap<>(size);<NEW_LINE>Map<Type, String> typeToLabel = new LinkedHashMap<>(size);<NEW_LINE>for (Map.Entry<String, Type> entry : labelToType.entrySet()) {<NEW_LINE>String label = entry.getKey();<NEW_LINE>Type typeValue = entry.getValue();<NEW_LINE>typeToLabel.put(typeValue, label);<NEW_LINE>labelToAdapter.put(label<MASK><NEW_LINE>}<NEW_LINE>final JsonAdapter<Object> fallbackAdapter = moshi.adapter(fallbackType);<NEW_LINE>JsonAdapter<Object> objectJsonAdapter = moshi.adapter(Object.class);<NEW_LINE>return new RuntimeJsonAdapter(labelKey, labelToAdapter, typeToLabel, objectJsonAdapter, fallbackAdapter).nullSafe();<NEW_LINE>} | , moshi.adapter(typeValue)); |
219,917 | public Call<Map<String, Long>> map(List<String> serviceNames) {<NEW_LINE>List<Call<Map<String, Long>>> bucketedTraceIdCalls = new ArrayList<>();<NEW_LINE>for (String service : serviceNames) {<NEW_LINE>// fan out every input for each service name<NEW_LINE>List<SelectTraceIdsFromServiceSpan.Input> <MASK><NEW_LINE>for (SelectTraceIdsFromServiceSpan.Input input : inputTemplates) {<NEW_LINE>scopedInputs.add(input.withService(service));<NEW_LINE>}<NEW_LINE>bucketedTraceIdCalls.add(newCall(scopedInputs));<NEW_LINE>}<NEW_LINE>if (bucketedTraceIdCalls.isEmpty())<NEW_LINE>return Call.create(Collections.emptyMap());<NEW_LINE>if (bucketedTraceIdCalls.size() == 1)<NEW_LINE>return bucketedTraceIdCalls.get(0);<NEW_LINE>return new AggregateIntoMap<>(bucketedTraceIdCalls);<NEW_LINE>} | scopedInputs = new ArrayList<>(); |
1,002,208 | private boolean matchesExclusions(final String fieldVarName) {<NEW_LINE>final ClassLoader classLoader = Thread.currentThread().getContextClassLoader();<NEW_LINE>final URL url = classLoader.getResource("es-content-mapping.json");<NEW_LINE>final String defaultSettings;<NEW_LINE>try {<NEW_LINE>defaultSettings = new String(com.liferay.util.FileUtil.getBytes(new File(<MASK><NEW_LINE>final List<String> matches = JsonPath.read(defaultSettings, "$..match");<NEW_LINE>matches.addAll(JsonPath.read(defaultSettings, "$..path_match"));<NEW_LINE>final Pattern pattern = Pattern.compile(matches.stream().map(match -> match.replaceAll("\\.", "\\\\.").replaceAll("\\*", "\\.*")).collect(Collectors.joining("|")));<NEW_LINE>return pattern.matcher(fieldVarName).matches();<NEW_LINE>} catch (IOException e) {<NEW_LINE>Logger.warnAndDebug(ESMappingUtilHelper.class, "cannot load es-content-mapping.json file, skipping", e);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | url.getPath()))); |
798,556 | private void doLogCatchUpInBatch() throws TException, InterruptedException {<NEW_LINE>List<ByteBuffer> logList = new ArrayList<>();<NEW_LINE>long totalLogSize = 0;<NEW_LINE>int firstLogPos = 0;<NEW_LINE>boolean batchFull;<NEW_LINE>for (int i = 0; i < logs.size() && !abort; i++) {<NEW_LINE>ByteBuffer logData = logs.get(i).serialize();<NEW_LINE>int logSize <MASK><NEW_LINE>if (logSize > IoTDBDescriptor.getInstance().getConfig().getThriftMaxFrameSize() - IoTDBConstant.LEFT_SIZE_IN_REQUEST) {<NEW_LINE>logger.warn("the frame size {} of thrift is too small", IoTDBDescriptor.getInstance().getConfig().getThriftMaxFrameSize());<NEW_LINE>abort = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>totalLogSize += logSize;<NEW_LINE>// we should send logs who's size is smaller than the max frame size of thrift<NEW_LINE>// left 200 byte for other fields of AppendEntriesRequest<NEW_LINE>// send at most 100 logs a time to avoid long latency<NEW_LINE>if (totalLogSize > IoTDBDescriptor.getInstance().getConfig().getThriftMaxFrameSize() - IoTDBConstant.LEFT_SIZE_IN_REQUEST) {<NEW_LINE>// batch oversize, send previous batch and add the log to a new batch<NEW_LINE>sendBatchLogs(logList, firstLogPos);<NEW_LINE>logList.add(logData);<NEW_LINE>firstLogPos = i;<NEW_LINE>totalLogSize = logSize;<NEW_LINE>} else {<NEW_LINE>// just add the log the batch<NEW_LINE>logList.add(logData);<NEW_LINE>}<NEW_LINE>batchFull = logList.size() >= ClusterConstant.LOG_NUM_IN_BATCH;<NEW_LINE>if (batchFull) {<NEW_LINE>sendBatchLogs(logList, firstLogPos);<NEW_LINE>firstLogPos = i + 1;<NEW_LINE>totalLogSize = 0;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!logList.isEmpty()) {<NEW_LINE>sendBatchLogs(logList, firstLogPos);<NEW_LINE>}<NEW_LINE>} | = logData.array().length; |
776,953 | protected Set<Element> evaluateElementTypeExpression(String expr, DslContext context) {<NEW_LINE>Set<Element> elements = new LinkedHashSet<>();<NEW_LINE>String type = expr.substring(ELEMENT_TYPE_EQUALS_EXPRESSION.length());<NEW_LINE>switch(type.toLowerCase()) {<NEW_LINE>case "custom":<NEW_LINE>context.getWorkspace().getModel().getElements().stream().filter(e -> e instanceof CustomElement).forEach(elements::add);<NEW_LINE>break;<NEW_LINE>case "person":<NEW_LINE>context.getWorkspace().getModel().getElements().stream().filter(e -> e instanceof Person).forEach(elements::add);<NEW_LINE>break;<NEW_LINE>case "softwaresystem":<NEW_LINE>context.getWorkspace().getModel().getElements().stream().filter(e -> e instanceof SoftwareSystem).forEach(elements::add);<NEW_LINE>break;<NEW_LINE>case "container":<NEW_LINE>context.getWorkspace().getModel().getElements().stream().filter(e -> e instanceof Container).forEach(elements::add);<NEW_LINE>break;<NEW_LINE>case "component":<NEW_LINE>context.getWorkspace().getModel().getElements().stream().filter(e -> e instanceof Component).forEach(elements::add);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>return elements;<NEW_LINE>} | RuntimeException("The element type of \"" + type + "\" is not valid for this view"); |
682,375 | public void fill(Menu menu, int index) {<NEW_LINE>MenuItem deployMenuItem = new MenuItem(menu, SWT.PUSH);<NEW_LINE>String menuName = null;<NEW_LINE>IContainer selectedContainer = getSelectedContainer();<NEW_LINE>if (selectedContainer != null) {<NEW_LINE>IDeployProvider provider = DeployProviderUtil.getDeployProvider(selectedContainer);<NEW_LINE>if (provider != null) {<NEW_LINE>menuName = provider.getDeployMenuName();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (menuName == null) {<NEW_LINE>// falls back to the name defined for the deploy command<NEW_LINE>ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class);<NEW_LINE>Command command = commandService.getCommand(DEPLOY_COMMAND_ID);<NEW_LINE>try {<NEW_LINE>menuName = command.getName();<NEW_LINE>} catch (NotDefinedException e) {<NEW_LINE>// should not happen, but log it just in case<NEW_LINE>// $NON-NLS-1$<NEW_LINE>IdeLog.logError(DeployUIPlugin.getDefault(), "The name for the deploy command is not defined.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// the default-default for the menu name is "Deploy App"<NEW_LINE>deployMenuItem.setText((menuName == null) ? Messages.DeployAppContributionItem_Text : menuName);<NEW_LINE>deployMenuItem.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>IHandlerService handlerService = (IHandlerService) serviceLocator.getService(IHandlerService.class);<NEW_LINE>try {<NEW_LINE>handlerService.executeCommand(DEPLOY_COMMAND_ID, null);<NEW_LINE>} catch (Exception e1) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>IdeLog.// $NON-NLS-1$<NEW_LINE>logError(// $NON-NLS-1$<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | DeployUIPlugin.getDefault(), "Failed to execute the command to deploy the application."); |
1,154,289 | private static void measureSampledMethodEntryExitCalls() {<NEW_LINE>// NOI18N<NEW_LINE>printResults("\n" + SAMPLED_TIME_MSG);<NEW_LINE>// ProfilerRuntime.resetProfilerCollectors(INSTR_RECURSIVE_SAMPLED); THIS IS NOT NEEDED - will delete our current ThreadInfo<NEW_LINE>// Large number to make the server compiler inline everything<NEW_LINE>int noOfOuterIterations = (nCall == -1) ? 200 : 80;<NEW_LINE>int noOfInnerIterations = 200;<NEW_LINE>ThreadInfo ti = ThreadInfo.getThreadInfo();<NEW_LINE>ti.setEvBuf(buf);<NEW_LINE>minTimePerMethodEntryExitCallInMCS = 100000.0;<NEW_LINE>minTimePerMethodEntryExitCallInCounts = 1000000;<NEW_LINE>for (int i = 0; i < noOfOuterIterations; i++) {<NEW_LINE>ti.evBufPos = 0;<NEW_LINE>ProfilerRuntimeCPUSampledInstr.rootMethodEntry((char) 1);<NEW_LINE>long time = Timers.getCurrentTimeInCounts();<NEW_LINE>for (int j = 0; j < noOfInnerIterations; j++) {<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodEntry((char) 2);<NEW_LINE>ProfilerRuntimeCPUSampledInstr<MASK><NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodEntry((char) 3);<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodExit((char) 3);<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodEntry((char) 2);<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodExit((char) 2);<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodEntry((char) 3);<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodExit((char) 3);<NEW_LINE>}<NEW_LINE>time = Timers.getCurrentTimeInCounts() - time;<NEW_LINE>ProfilerRuntimeCPUSampledInstr.methodExit((char) 1);<NEW_LINE>double timeInCounts = (double) time / (noOfInnerIterations * 4);<NEW_LINE>double timeInMCS = (((double) time * 1000000) / cntInSecond / (noOfInnerIterations * 4));<NEW_LINE>if (timeInCounts < minTimePerMethodEntryExitCallInCounts) {<NEW_LINE>minTimePerMethodEntryExitCallInCounts = timeInCounts;<NEW_LINE>minTimePerMethodEntryExitCallInMCS = timeInMCS;<NEW_LINE>}<NEW_LINE>if (printResults && ((i % 5) == 0)) {<NEW_LINE>// NOI18N<NEW_LINE>System.out.println(MessageFormat.format(TIME_COUNTS_MCS_MSG, new Object[] { "" + timeInCounts, "" + timeInMCS }));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>innerTimeInCounts = outerTimeInCounts = minTimePerMethodEntryExitCallInCounts / 2;<NEW_LINE>} | .methodExit((char) 2); |
1,576,934 | public void resourceResourceIdDelete(String resourceId, String cookie, String ifMatch) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'resourceId' is set<NEW_LINE>if (resourceId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'resourceId' when calling resourceResourceIdDelete");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/resource/{resourceId}".replaceAll("\\{" + "resourceId" + "\\}", apiClient.escapeString<MASK><NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>if (cookie != null)<NEW_LINE>localVarHeaderParams.put("cookie", apiClient.parameterToString(cookie));<NEW_LINE>if (ifMatch != null)<NEW_LINE>localVarHeaderParams.put("If-Match", apiClient.parameterToString(ifMatch));<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "bearerAuth" };<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | (resourceId.toString())); |
1,783,431 | public VAdminProto.RebalanceStateChangeResponse handleRebalanceStateChange(VAdminProto.RebalanceStateChangeRequest request) {<NEW_LINE>VAdminProto.RebalanceStateChangeResponse.Builder response = VAdminProto.RebalanceStateChangeResponse.newBuilder();<NEW_LINE>synchronized (rebalancer) {<NEW_LINE>try {<NEW_LINE>// Retrieve all values first<NEW_LINE>List<RebalanceTaskInfo> rebalanceTaskInfo = Lists.newArrayList();<NEW_LINE>for (RebalanceTaskInfoMap map : request.getRebalanceTaskListList()) {<NEW_LINE>rebalanceTaskInfo.add(ProtoUtils.decodeRebalanceTaskInfoMap(map));<NEW_LINE>}<NEW_LINE>Cluster cluster = new ClusterMapper().readCluster(new StringReader(request.getClusterString()));<NEW_LINE>List<StoreDefinition> storeDefs = new StoreDefinitionsMapper().readStoreList(new StringReader<MASK><NEW_LINE>boolean swapRO = request.getSwapRo();<NEW_LINE>boolean changeClusterMetadata = request.getChangeClusterMetadata();<NEW_LINE>boolean changeRebalanceState = request.getChangeRebalanceState();<NEW_LINE>boolean rollback = request.getRollback();<NEW_LINE>rebalancer.rebalanceStateChange(cluster, storeDefs, rebalanceTaskInfo, swapRO, changeClusterMetadata, changeRebalanceState, rollback);<NEW_LINE>} catch (VoldemortException e) {<NEW_LINE>response.setError(ProtoUtils.encodeError(errorCodeMapper, e));<NEW_LINE>logger.error("handleRebalanceStateChange failed for request(" + request.toString() + ")", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return response.build();<NEW_LINE>} | (request.getStoresString())); |
1,293,098 | private List<Funcotation> determineFuncotations(final VariantContext variant, final ReferenceContext referenceContext, final List<Feature> featureList, final List<GencodeFuncotation> gencodeFuncotations) {<NEW_LINE>// Create our funcotations:<NEW_LINE>final List<Funcotation> outputFuncotations;<NEW_LINE>if (FuncotatorUtils.isSegmentVariantContext(variant, minBasesForValidSegment) && isSupportingSegmentFuncotation()) {<NEW_LINE>outputFuncotations = createFuncotationsOnSegment(variant, referenceContext, featureList);<NEW_LINE>} else {<NEW_LINE>if (gencodeFuncotations == null) {<NEW_LINE>outputFuncotations = <MASK><NEW_LINE>} else {<NEW_LINE>outputFuncotations = createFuncotationsOnVariant(variant, referenceContext, featureList, gencodeFuncotations);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return outputFuncotations;<NEW_LINE>} | createFuncotationsOnVariant(variant, referenceContext, featureList); |
790,111 | public static LibDivideS32 libdivide_s32_gen(@NativeType("int32_t") int denom, @NativeType("struct libdivide_s32_t") LibDivideS32 __result) {<NEW_LINE>if (denom == 0) {<NEW_LINE>throw new IllegalArgumentException("divider must be != 0");<NEW_LINE>}<NEW_LINE>int magic, more;<NEW_LINE>int absD = denom < 0 ? -denom : denom;<NEW_LINE>int floor_log_2_d = 31 - Integer.numberOfLeadingZeros(absD);<NEW_LINE>if ((absD & (absD - 1)) == 0) {<NEW_LINE>magic = 0;<NEW_LINE>more = floor_log_2_d | (denom < 0 ? LIBDIVIDE_NEGATIVE_DIVISOR : 0);<NEW_LINE>} else {<NEW_LINE>long l = 1L << (31 + floor_log_2_d);<NEW_LINE>magic = <MASK><NEW_LINE>int rem = (int) (l % absD);<NEW_LINE>if (absD - rem < 1 << floor_log_2_d) {<NEW_LINE>more = floor_log_2_d - 1;<NEW_LINE>} else {<NEW_LINE>more = floor_log_2_d | LIBDIVIDE_ADD_MARKER;<NEW_LINE>magic <<= 1;<NEW_LINE>}<NEW_LINE>magic++;<NEW_LINE>if (denom < 0) {<NEW_LINE>more |= LIBDIVIDE_NEGATIVE_DIVISOR;<NEW_LINE>magic = -magic;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>__result.magic(magic);<NEW_LINE>__result.more((byte) more);<NEW_LINE>return __result;<NEW_LINE>} | (int) (l / absD); |
1,754,825 | private void populateContextDependencies(JSONArray contextsArray) throws JSONException {<NEW_LINE>// populate LiveBeanContext dependencies<NEW_LINE>for (int i = 0; i < contextsArray.length(); i++) {<NEW_LINE>JSONObject contextJson = contextsArray.optJSONObject(i);<NEW_LINE>if (contextJson != null) {<NEW_LINE>LiveBeansContext context = contextMap<MASK><NEW_LINE>if (!contextJson.isNull(LiveBeansContext.ATTR_PARENT)) {<NEW_LINE>String parent = contextJson.getString(LiveBeansContext.ATTR_PARENT);<NEW_LINE>LiveBeansContext parentContext = contextMap.get(parent);<NEW_LINE>if (parentContext != null) {<NEW_LINE>context.setParent(parentContext);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// PT 164156323 - Extracting beans differs between Boot 1.x and Boot 2.x.<NEW_LINE>// Dependencies was not being populated for Boot 2.x because of a bug<NEW_LINE>// where, when populating the dependencies, beans were being extracted using Boot 1.x structure<NEW_LINE>// even for Boot 2.x. The way to fix this is to delegate to the method below which is<NEW_LINE>// overridden for Boot 2.x and handles the Boot 2.x case correctly<NEW_LINE>// correct way<NEW_LINE>JSONArray beansArray = extractBeans(contextJson);<NEW_LINE>if (beansArray != null) {<NEW_LINE>populateBeanDependencies(beansArray);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .get(getContextId(contextJson)); |
809,936 | public void serialize(final RntbdClientChannelPool value, final JsonGenerator generator, final SerializerProvider provider) throws IOException {<NEW_LINE>final RntbdClientChannelHealthChecker healthChecker = (RntbdClientChannelHealthChecker) value.healthChecker;<NEW_LINE>generator.writeStartObject();<NEW_LINE>generator.writeStringField("remoteAddress", value.remoteAddress().toString());<NEW_LINE>generator.writeBooleanField("isClosed", value.isClosed());<NEW_LINE>generator.writeObjectFieldStart("configuration");<NEW_LINE>generator.writeNumberField("maxChannels", value.maxChannels());<NEW_LINE>generator.writeNumberField("maxRequestsPerChannel", value.maxRequestsPerChannel());<NEW_LINE>generator.writeNumberField("idleConnectionTimeout", healthChecker.idleConnectionTimeoutInNanos());<NEW_LINE>generator.writeNumberField("readDelayLimit", healthChecker.readDelayLimitInNanos());<NEW_LINE>generator.writeNumberField(<MASK><NEW_LINE>generator.writeEndObject();<NEW_LINE>generator.writeObjectFieldStart("state");<NEW_LINE>generator.writeNumberField("channelsAcquired", value.channelsAcquiredMetrics());<NEW_LINE>generator.writeNumberField("channelsAvailable", value.channelsAvailableMetrics());<NEW_LINE>generator.writeNumberField("requestQueueLength", value.requestQueueLength());<NEW_LINE>generator.writeEndObject();<NEW_LINE>generator.writeEndObject();<NEW_LINE>} | "writeDelayLimit", healthChecker.writeDelayLimitInNanos()); |
1,470,712 | public static void main(String[] args) throws Exception {<NEW_LINE>String inputfilepath = <MASK><NEW_LINE>WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.load(new java.io.File(inputfilepath));<NEW_LINE>StyleDefinitionsPart stylesPart = wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart();<NEW_LINE>System.out.println("BEFORE");<NEW_LINE>report(stylesPart.getContents().getStyle());<NEW_LINE>System.out.println("styles which are in use:");<NEW_LINE>Set<String> stylesInUse = wordMLPackage.getMainDocumentPart().getStylesInUse();<NEW_LINE>for (String s : stylesInUse) {<NEW_LINE>System.out.println(s);<NEW_LINE>}<NEW_LINE>// Our style trees usually only cover styles which are in use<NEW_LINE>// To trim unused styles, we're interested in the ones which are NOT is use<NEW_LINE>// Setup<NEW_LINE>Styles styles = wordMLPackage.getMainDocumentPart().getStyleDefinitionsPart(false).getJaxbElement();<NEW_LINE>Set<String> stylesNotInUse = new HashSet<String>();<NEW_LINE>for (org.docx4j.wml.Style s : styles.getStyle()) {<NEW_LINE>if (stylesInUse.contains(s.getStyleId())) {<NEW_LINE>// System.out.println("ignoring " + s.getStyleId() );<NEW_LINE>} else {<NEW_LINE>stylesNotInUse.add(s.getStyleId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<String, Style> allStyles = new HashMap<String, Style>();<NEW_LINE>for (org.docx4j.wml.Style s : styles.getStyle()) {<NEW_LINE>allStyles.put(s.getStyleId(), s);<NEW_LINE>}<NEW_LINE>// For docx4j before 8.1.3|11.1.3<NEW_LINE>// StyleTree st = new StyleTree(stylesNotInUse, allStyles,<NEW_LINE>// styles.getDocDefaults(), allStyles.get("Normal"));<NEW_LINE>// Need docx4j 8.1.3|11.1.3 for this<NEW_LINE>StyleTree st = new StyleTree(stylesNotInUse, allStyles, styles.getDocDefaults(), allStyles.get("Normal"), stylesPart.getDefaultCharacterStyle(), stylesPart.getDefaultTableStyle());<NEW_LINE>System.out.println("PARAGRAPH STYLES");<NEW_LINE>walk(st.getParagraphStylesTree().getRootElement(), "");<NEW_LINE>// You can't use this code to delete character styles unless you have docx4j 8.1.3|11.1.3<NEW_LINE>System.out.println("\nCHARACTER STYLES");<NEW_LINE>walk(st.getCharacterStylesTree().getRootElement(), "");<NEW_LINE>// now delete the deletableStyles<NEW_LINE>Styles stylesClone = XmlUtils.deepCopy(styles);<NEW_LINE>styles.getStyle().clear();<NEW_LINE>for (org.docx4j.wml.Style s : stylesClone.getStyle()) {<NEW_LINE>if (deletableStyles.contains(s.getStyleId())) {<NEW_LINE>// we can drop this one<NEW_LINE>} else {<NEW_LINE>styles.getStyle().add(s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println("AFTER");<NEW_LINE>report(styles.getStyle());<NEW_LINE>// Save the document now if you want<NEW_LINE>} | System.getProperty("user.dir") + "/one.docx"; |
255,368 | public DataOutputX writeDecimal(long v) throws IOException {<NEW_LINE>if (v == 0) {<NEW_LINE>writeByte(0);<NEW_LINE>} else if (Byte.MIN_VALUE <= v && v <= Byte.MAX_VALUE) {<NEW_LINE>byte[] b = new byte[2];<NEW_LINE>b[0] = 1;<NEW_LINE>b[1] = (byte) v;<NEW_LINE>write(b);<NEW_LINE>} else if (Short.MIN_VALUE <= v && v <= Short.MAX_VALUE) {<NEW_LINE>byte[] b = new byte[3];<NEW_LINE>b[0] = 2;<NEW_LINE>toBytes(b, 1, (short) v);<NEW_LINE>write(b);<NEW_LINE>} else if (INT3_MIN_VALUE <= v && v <= INT3_MAX_VALUE) {<NEW_LINE>byte[] b = new byte[4];<NEW_LINE>b[0] = 3;<NEW_LINE>write(toBytes3(b, 1, (int) v), 0, 4);<NEW_LINE>} else if (Integer.MIN_VALUE <= v && v <= Integer.MAX_VALUE) {<NEW_LINE>byte[<MASK><NEW_LINE>b[0] = 4;<NEW_LINE>write(toBytes(b, 1, (int) v), 0, 5);<NEW_LINE>} else if (LONG5_MIN_VALUE <= v && v <= LONG5_MAX_VALUE) {<NEW_LINE>byte[] b = new byte[6];<NEW_LINE>b[0] = 5;<NEW_LINE>write(toBytes5(b, 1, v), 0, 6);<NEW_LINE>} else if (Long.MIN_VALUE <= v && v <= Long.MAX_VALUE) {<NEW_LINE>byte[] b = new byte[9];<NEW_LINE>b[0] = 8;<NEW_LINE>write(toBytes(b, 1, v), 0, 9);<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | ] b = new byte[5]; |
941,502 | private static String buildMsg(final int warehouseId, final boolean maxVolumeExceeded, final boolean maxWeightExceeded) {<NEW_LINE>final StringBuffer sb = new StringBuffer();<NEW_LINE>sb.append(Msg.translate(Env.getCtx(), MSG_NO_SUFFICIENT_CONTAINERS));<NEW_LINE>if (warehouseId > 0) {<NEW_LINE>sb.append("\n@M_Warehouse_ID@ ");<NEW_LINE>sb.append(Services.get(IWarehouseDAO.class).getWarehouseName(WarehouseId.ofRepoId(warehouseId)));<NEW_LINE>}<NEW_LINE>if (maxVolumeExceeded || maxWeightExceeded) {<NEW_LINE>sb.append(Msg.translate(Env.getCtx(), MSG_INSUFFICIENT_FEATURES));<NEW_LINE>}<NEW_LINE>if (maxVolumeExceeded) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (maxWeightExceeded) {<NEW_LINE>appendExceed(sb, I_M_PackagingContainer.COLUMNNAME_MaxWeight);<NEW_LINE>}<NEW_LINE>return sb.toString();<NEW_LINE>} | appendExceed(sb, I_M_PackagingContainer.COLUMNNAME_MaxVolume); |
1,787,132 | public Void execute(CommandContext commandContext) {<NEW_LINE>JobEntity jobToDelete = null;<NEW_LINE>for (String jobId : jobIds) {<NEW_LINE>jobToDelete = jobServiceConfiguration.<MASK><NEW_LINE>FlowableEventDispatcher eventDispatcher = jobServiceConfiguration.getEventDispatcher();<NEW_LINE>if (jobToDelete != null) {<NEW_LINE>// When given job doesn't exist, ignore<NEW_LINE>if (eventDispatcher != null && eventDispatcher.isEnabled()) {<NEW_LINE>eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, jobToDelete), jobServiceConfiguration.getEngineName());<NEW_LINE>}<NEW_LINE>jobServiceConfiguration.getJobEntityManager().delete(jobToDelete);<NEW_LINE>} else {<NEW_LINE>TimerJobEntity timerJobToDelete = jobServiceConfiguration.getTimerJobEntityManager().findById(jobId);<NEW_LINE>if (timerJobToDelete != null) {<NEW_LINE>// When given job doesn't exist, ignore<NEW_LINE>if (eventDispatcher != null && eventDispatcher.isEnabled()) {<NEW_LINE>eventDispatcher.dispatchEvent(FlowableJobEventBuilder.createEntityEvent(FlowableEngineEventType.JOB_CANCELED, timerJobToDelete), jobServiceConfiguration.getEngineName());<NEW_LINE>}<NEW_LINE>jobServiceConfiguration.getTimerJobEntityManager().delete(timerJobToDelete);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | getJobEntityManager().findById(jobId); |
1,454,181 | public static String hashpw(byte[] passwordb, String salt) {<NEW_LINE>BCrypt B;<NEW_LINE>String real_salt;<NEW_LINE>byte[] saltb, hashed;<NEW_LINE>char minor = (char) 0;<NEW_LINE>int rounds, off;<NEW_LINE>StringBuilder rs = new StringBuilder();<NEW_LINE>if (salt == null) {<NEW_LINE>throw new IllegalArgumentException("salt cannot be null");<NEW_LINE>}<NEW_LINE>int saltLength = salt.length();<NEW_LINE>if (saltLength < 28) {<NEW_LINE>throw new IllegalArgumentException("Invalid salt");<NEW_LINE>}<NEW_LINE>if (salt.charAt(0) != '$' || salt.charAt(1) != '2')<NEW_LINE>throw new IllegalArgumentException("Invalid salt version");<NEW_LINE>if (salt.charAt(2) == '$')<NEW_LINE>off = 3;<NEW_LINE>else {<NEW_LINE>minor = salt.charAt(2);<NEW_LINE>if ((minor != 'a' && minor != 'x' && minor != 'y' && minor != 'b') || salt.charAt(3) != '$')<NEW_LINE>throw new IllegalArgumentException("Invalid salt revision");<NEW_LINE>off = 4;<NEW_LINE>}<NEW_LINE>// Extract number of rounds<NEW_LINE>if (salt.charAt(off + 2) > '$')<NEW_LINE>throw new IllegalArgumentException("Missing salt rounds");<NEW_LINE>rounds = Integer.parseInt(salt.substring(off, off + 2));<NEW_LINE>real_salt = salt.substring(off + 3, off + 25);<NEW_LINE>saltb = decode_base64(real_salt, BCRYPT_SALT_LEN);<NEW_LINE>if (// add null terminator<NEW_LINE>minor >= 'a')<NEW_LINE>passwordb = Arrays.copyOf(passwordb, passwordb.length + 1);<NEW_LINE>B = new BCrypt();<NEW_LINE>hashed = B.crypt_raw(passwordb, saltb, rounds, minor == 'x', <MASK><NEW_LINE>rs.append("$2");<NEW_LINE>if (minor >= 'a')<NEW_LINE>rs.append(minor);<NEW_LINE>rs.append("$");<NEW_LINE>if (rounds < 10)<NEW_LINE>rs.append("0");<NEW_LINE>rs.append(rounds);<NEW_LINE>rs.append("$");<NEW_LINE>encode_base64(saltb, saltb.length, rs);<NEW_LINE>encode_base64(hashed, bf_crypt_ciphertext.length * 4 - 1, rs);<NEW_LINE>return rs.toString();<NEW_LINE>} | minor == 'a' ? 0x10000 : 0); |
260,101 | private void applyState(InetAddress endpoint, ApplicationState state, VersionedValue value, EndpointState epState) {<NEW_LINE>final ExecutorService executor = StageManager.getStage(Stage.MUTATION);<NEW_LINE>switch(state) {<NEW_LINE>case RELEASE_VERSION:<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "release_version", value.value, executor);<NEW_LINE>break;<NEW_LINE>case DC:<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "data_center", value.value, executor);<NEW_LINE>break;<NEW_LINE>case RACK:<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "rack", value.value, executor);<NEW_LINE>break;<NEW_LINE>case RPC_ADDRESS:<NEW_LINE>try {<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "rpc_address", InetAddress.getByName<MASK><NEW_LINE>} catch (UnknownHostException e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case SCHEMA:<NEW_LINE>// Use a fix schema version for all peers (always in agreement) because stargate waits<NEW_LINE>// for DDL queries to reach agreement before returning.<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "schema_version", StargateSystemKeyspace.SCHEMA_VERSION, executor);<NEW_LINE>break;<NEW_LINE>case HOST_ID:<NEW_LINE>StargateSystemKeyspace.updatePeerInfo(endpoint, "host_id", UUID.fromString(value.value), executor);<NEW_LINE>break;<NEW_LINE>case RPC_READY:<NEW_LINE>notifyRpcChange(endpoint, epState.isRpcReady());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>}<NEW_LINE>} | (value.value), executor); |
1,006,442 | public Bundle toBundle() {<NEW_LINE>Bundle bundle = new Bundle();<NEW_LINE>bundle.putString(keyForField(FIELD_ID), id);<NEW_LINE>bundle.putString(keyForField(FIELD_LABEL), label);<NEW_LINE>bundle.putString(keyForField(FIELD_LANGUAGE), language);<NEW_LINE>bundle.putInt(keyForField(FIELD_SELECTION_FLAGS), selectionFlags);<NEW_LINE>bundle.putInt(keyForField(FIELD_ROLE_FLAGS), roleFlags);<NEW_LINE>bundle.putInt(keyForField(FIELD_AVERAGE_BITRATE), averageBitrate);<NEW_LINE>bundle.putInt(keyForField(FIELD_PEAK_BITRATE), peakBitrate);<NEW_LINE>bundle.putString<MASK><NEW_LINE>// Metadata is currently not Bundleable because Metadata.Entry is an Interface,<NEW_LINE>// which would be difficult to unbundle in a backward compatible way.<NEW_LINE>// The entries are additionally of limited usefulness to remote processes.<NEW_LINE>bundle.putParcelable(keyForField(FIELD_METADATA), metadata);<NEW_LINE>// Container specific.<NEW_LINE>bundle.putString(keyForField(FIELD_CONTAINER_MIME_TYPE), containerMimeType);<NEW_LINE>// Sample specific.<NEW_LINE>bundle.putString(keyForField(FIELD_SAMPLE_MIME_TYPE), sampleMimeType);<NEW_LINE>bundle.putInt(keyForField(FIELD_MAX_INPUT_SIZE), maxInputSize);<NEW_LINE>for (int i = 0; i < initializationData.size(); i++) {<NEW_LINE>bundle.putByteArray(keyForInitializationData(i), initializationData.get(i));<NEW_LINE>}<NEW_LINE>// DrmInitData doesn't need to be Bundleable as it's only used in the playing process to<NEW_LINE>// initialize the decoder.<NEW_LINE>bundle.putParcelable(keyForField(FIELD_DRM_INIT_DATA), drmInitData);<NEW_LINE>bundle.putLong(keyForField(FIELD_SUBSAMPLE_OFFSET_US), subsampleOffsetUs);<NEW_LINE>// Video specific.<NEW_LINE>bundle.putInt(keyForField(FIELD_WIDTH), width);<NEW_LINE>bundle.putInt(keyForField(FIELD_HEIGHT), height);<NEW_LINE>bundle.putFloat(keyForField(FIELD_FRAME_RATE), frameRate);<NEW_LINE>bundle.putInt(keyForField(FIELD_ROTATION_DEGREES), rotationDegrees);<NEW_LINE>bundle.putFloat(keyForField(FIELD_PIXEL_WIDTH_HEIGHT_RATIO), pixelWidthHeightRatio);<NEW_LINE>bundle.putByteArray(keyForField(FIELD_PROJECTION_DATA), projectionData);<NEW_LINE>bundle.putInt(keyForField(FIELD_STEREO_MODE), stereoMode);<NEW_LINE>bundle.putBundle(keyForField(FIELD_COLOR_INFO), BundleableUtil.toNullableBundle(colorInfo));<NEW_LINE>// Audio specific.<NEW_LINE>bundle.putInt(keyForField(FIELD_CHANNEL_COUNT), channelCount);<NEW_LINE>bundle.putInt(keyForField(FIELD_SAMPLE_RATE), sampleRate);<NEW_LINE>bundle.putInt(keyForField(FIELD_PCM_ENCODING), pcmEncoding);<NEW_LINE>bundle.putInt(keyForField(FIELD_ENCODER_DELAY), encoderDelay);<NEW_LINE>bundle.putInt(keyForField(FIELD_ENCODER_PADDING), encoderPadding);<NEW_LINE>// Text specific.<NEW_LINE>bundle.putInt(keyForField(FIELD_ACCESSIBILITY_CHANNEL), accessibilityChannel);<NEW_LINE>// Source specific.<NEW_LINE>bundle.putInt(keyForField(FIELD_CRYPTO_TYPE), cryptoType);<NEW_LINE>return bundle;<NEW_LINE>} | (keyForField(FIELD_CODECS), codecs); |
371,371 | public static void main(String[] args) {<NEW_LINE>Scanner scanner = new Scanner(System.in);<NEW_LINE>int wins = 0;<NEW_LINE>int losses = 0;<NEW_LINE>System.out.println("Welcome to Rock-Paper-Scissors! Please enter \"rock\", \"paper\", \"scissors\", or \"quit\" to exit.");<NEW_LINE>while (true) {<NEW_LINE>System.out.println("-------------------------");<NEW_LINE>System.out.print("Enter your move: ");<NEW_LINE>String playerMove = scanner.nextLine();<NEW_LINE>if (playerMove.equals("quit")) {<NEW_LINE>System.out.println("You won " + wins + " times and lost " + losses + " times.");<NEW_LINE>System.out.println("Thanks for playing! See you again.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (Arrays.stream(Move.values()).noneMatch(x -> x.getValue().equals(playerMove))) {<NEW_LINE>System.out.println("Your move isn't valid!");<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String computerMove = getComputerMove();<NEW_LINE>if (playerMove.equals(computerMove)) {<NEW_LINE>System.out.println("It's a tie!");<NEW_LINE>} else if (isPlayerWin(playerMove, computerMove)) {<NEW_LINE><MASK><NEW_LINE>wins++;<NEW_LINE>} else {<NEW_LINE>System.out.println("You lost!");<NEW_LINE>losses++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | System.out.println("You won!"); |
1,145,981 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player player = game.getPlayer(source.getControllerId());<NEW_LINE>if (player == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>Cards top7 = new CardsImpl(player.getLibrary().getTopCards(game, 7));<NEW_LINE>Cards toGrave = top7.copy();<NEW_LINE>player.revealCards(source, toGrave, game);<NEW_LINE>Cards toHand = new CardsImpl();<NEW_LINE>if (toGrave.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>for (AbilitySelector abilitySelector : AbilitySelector.values()) {<NEW_LINE>if (toGrave.count(abilitySelector.filter, game) < 1) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>TargetCard target = abilitySelector.makeTarget();<NEW_LINE>player.choose(Outcome.DrawCard, top7, target, game);<NEW_LINE>toHand.add(target.getFirstTarget());<NEW_LINE>toGrave.remove(target.getFirstTarget());<NEW_LINE>}<NEW_LINE>if (toGrave.isEmpty()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (toHand.count(filter, game) > 0) {<NEW_LINE>TargetCard target = new TargetCardInLibrary(filter);<NEW_LINE>player.choose(Outcome.PutCreatureInPlay, toHand, target, game);<NEW_LINE>Card toBattlefield = game.getCard(target.getFirstTarget());<NEW_LINE>if (toBattlefield != null && player.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game) && Zone.BATTLEFIELD.equals(game.getState().getZone(toBattlefield.getId()))) {<NEW_LINE>toHand.remove(toBattlefield);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>player.moveCards(toHand, Zone.HAND, source, game);<NEW_LINE>player.moveCards(toGrave, <MASK><NEW_LINE>return true;<NEW_LINE>} | Zone.GRAVEYARD, source, game); |
1,425,077 | public static void beforeClass() throws Exception {<NEW_LINE>server.installSystemFeature(FEATURE_NAME);<NEW_LINE><MASK><NEW_LINE>Assert.assertTrue(server.fileExistsInLibertyInstallRoot("lib/com.ibm.ws.persistence.consumer.jar"));<NEW_LINE>Path someArchive = Paths.get(server.getInstallRoot() + File.separatorChar + "lib" + File.separatorChar + "com.ibm.ws.persistence.consumer.jar");<NEW_LINE>JakartaEE9Action.transformApp(someArchive);<NEW_LINE>ShrinkHelper.defaultDropinApp(server, APP_NAME, "persistence_fat.consumer.ejb", "persistence_fat.consumer.model", "persistence_fat.consumer.web");<NEW_LINE>Path warArchive = Paths.get(server.getServerRoot() + File.separatorChar + "dropins" + File.separatorChar + APP_NAME + ".war");<NEW_LINE>JakartaEE9Action.transformApp(warArchive);<NEW_LINE>server.startServer();<NEW_LINE>} | server.copyFileToLibertyInstallRoot("lib/", "bundles/com.ibm.ws.persistence.consumer.jar"); |
1,711,689 | public void visitNode(AstNode node) {<NEW_LINE>errors++;<NEW_LINE>if (!LOG.isDebugEnabled()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>List<AstNode> children = node.getChildren();<NEW_LINE>var sb = new StringBuilder(512);<NEW_LINE>int identifierLine = -1;<NEW_LINE>for (var child : children) {<NEW_LINE>sb.append(child.getTokenValue());<NEW_LINE>var type = child.getToken().getType();<NEW_LINE>if (type.equals(GenericTokenType.IDENTIFIER)) {<NEW_LINE>// save position of last identifier for message<NEW_LINE>identifierLine = child.getTokenLine();<NEW_LINE>sb.append(' ');<NEW_LINE>} else if (type.equals(CxxPunctuator.CURLBR_LEFT)) {<NEW_LINE>// part with CURLBR_LEFT is typically an ignored declaration<NEW_LINE>if (identifierLine != -1) {<NEW_LINE>LOG.debug("[{}:{}]: skip declaration: {}", getContext().getFile(), identifierLine, sb.toString());<NEW_LINE>sb.setLength(0);<NEW_LINE>identifierLine = -1;<NEW_LINE>}<NEW_LINE>} else if (type.equals(CxxPunctuator.CURLBR_RIGHT)) {<NEW_LINE>sb.setLength(0);<NEW_LINE>identifierLine = -1;<NEW_LINE>} else {<NEW_LINE>sb.append(' ');<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (identifierLine != -1 && sb.length() > 0) {<NEW_LINE>// part without CURLBR_LEFT is typically a syntax error<NEW_LINE>LOG.debug("[{}:{}]: syntax error: {}", getContext().getFile(), <MASK><NEW_LINE>}<NEW_LINE>} | identifierLine, sb.toString()); |
88,610 | public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {<NEW_LINE>View v = inflater.inflate(R.layout.fragment_rv_media, container, false);<NEW_LINE>ButterKnife.bind(this, v);<NEW_LINE>int spanCount = columnsCount();<NEW_LINE>spacingDecoration = new GridSpacingItemDecoration(spanCount, Measure.pxToDp(3, getContext()), true);<NEW_LINE>rv.setHasFixedSize(true);<NEW_LINE>rv.addItemDecoration(spacingDecoration);<NEW_LINE>rv.setLayoutManager(new GridLayoutManager(getContext(), spanCount));<NEW_LINE>rv.setItemAnimator(AnimationUtils.getItemAnimator(new LandingAnimator(<MASK><NEW_LINE>adapter = new MediaAdapter(getContext(), album.settings.getSortingMode(), album.settings.getSortingOrder(), this);<NEW_LINE>refresh.setOnRefreshListener(this::reload);<NEW_LINE>rv.setAdapter(adapter);<NEW_LINE>return v;<NEW_LINE>} | new OvershootInterpolator(1f)))); |
636,480 | static boolean isOverlapPreventedInOtherDimension(LayoutInterval addingInterval, LayoutInterval existingInterval, int dimension) {<NEW_LINE>int otherDim = dimension ^ 1;<NEW_LINE>Iterator<LayoutInterval> addIt = getComponentIterator(addingInterval);<NEW_LINE>do {<NEW_LINE>LayoutInterval otherDimAdd = addIt.next().getComponent().getLayoutInterval(otherDim);<NEW_LINE>Iterator<LayoutInterval> exIt = getComponentIterator(existingInterval);<NEW_LINE>do {<NEW_LINE>LayoutInterval otherDimEx = exIt.next().getComponent().getLayoutInterval(otherDim);<NEW_LINE>LayoutInterval parent = LayoutInterval.getCommonParent(otherDimAdd, otherDimEx);<NEW_LINE>if (parent == null || parent.isParallel()) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} while (exIt.hasNext());<NEW_LINE>} <MASK><NEW_LINE>// Here we know that all adding component intervals are in a sequence<NEW_LINE>// with the questioned interval in the orthogonal dimension (where<NEW_LINE>// already added), so there can't be an orthogonal overlap.<NEW_LINE>return true;<NEW_LINE>} | while (addIt.hasNext()); |
263,835 | // / Extract unsatisfiable core example<NEW_LINE>public void unsatCoreAndProofExample(Context ctx) {<NEW_LINE>System.out.println("UnsatCoreAndProofExample");<NEW_LINE>Log.append("UnsatCoreAndProofExample");<NEW_LINE>Solver solver = ctx.mkSolver();<NEW_LINE>BoolExpr pa = ctx.mkBoolConst("PredA");<NEW_LINE>BoolExpr pb = ctx.mkBoolConst("PredB");<NEW_LINE>BoolExpr pc = ctx.mkBoolConst("PredC");<NEW_LINE>BoolExpr pd = ctx.mkBoolConst("PredD");<NEW_LINE>BoolExpr p1 = ctx.mkBoolConst("P1");<NEW_LINE>BoolExpr p2 = ctx.mkBoolConst("P2");<NEW_LINE>BoolExpr p3 = ctx.mkBoolConst("P3");<NEW_LINE>BoolExpr p4 = ctx.mkBoolConst("P4");<NEW_LINE>BoolExpr[] assumptions = new BoolExpr[] { ctx.mkNot(p1), ctx.mkNot(p2), ctx.mkNot(p3), ctx.mkNot(p4) };<NEW_LINE>BoolExpr f1 = ctx.mkAnd(pa, pb, pc);<NEW_LINE>BoolExpr f2 = ctx.mkAnd(pa, ctx.mkNot(pb), pc);<NEW_LINE>BoolExpr f3 = ctx.mkOr(ctx.mkNot(pa), ctx.mkNot(pc));<NEW_LINE>BoolExpr f4 = pd;<NEW_LINE>solver.add(ctx<MASK><NEW_LINE>solver.add(ctx.mkOr(f2, p2));<NEW_LINE>solver.add(ctx.mkOr(f3, p3));<NEW_LINE>solver.add(ctx.mkOr(f4, p4));<NEW_LINE>Status result = solver.check(assumptions);<NEW_LINE>if (result == Status.UNSATISFIABLE) {<NEW_LINE>System.out.println("unsat");<NEW_LINE>System.out.printf("proof: %s%n", solver.getProof());<NEW_LINE>System.out.println("core: ");<NEW_LINE>for (Expr<?> c : solver.getUnsatCore()) {<NEW_LINE>System.out.println(c);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .mkOr(f1, p1)); |
1,656,041 | final DescribeBudgetActionsForBudgetResult executeDescribeBudgetActionsForBudget(DescribeBudgetActionsForBudgetRequest describeBudgetActionsForBudgetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeBudgetActionsForBudgetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeBudgetActionsForBudgetRequest> request = null;<NEW_LINE>Response<DescribeBudgetActionsForBudgetResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new DescribeBudgetActionsForBudgetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeBudgetActionsForBudgetRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Budgets");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeBudgetActionsForBudget");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeBudgetActionsForBudgetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeBudgetActionsForBudgetResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
390,119 | public static AlertProxy createAlert(EventProxy event, int minutes) {<NEW_LINE>if (!CalendarProxy.hasCalendarPermissions()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ContentResolver contentResolver = TiApplication.getInstance().getContentResolver();<NEW_LINE>ContentValues values = new ContentValues();<NEW_LINE>Calendar alarmTime = Calendar.getInstance();<NEW_LINE>alarmTime.setTime(event.getBegin());<NEW_LINE>alarmTime.add(Calendar.MINUTE, -minutes);<NEW_LINE>values.put("event_id", event.getId());<NEW_LINE>values.put("begin", event.getBegin().getTime());<NEW_LINE>values.put("end", event.getEnd().getTime());<NEW_LINE>values.put("alarmTime", alarmTime.getTimeInMillis());<NEW_LINE>values.put("state", STATE_SCHEDULED);<NEW_LINE>values.put("minutes", minutes);<NEW_LINE>values.put("creationTime", System.currentTimeMillis());<NEW_LINE>values.put("receivedTime", 0);<NEW_LINE>values.put("notifyTime", 0);<NEW_LINE>Uri alertUri = contentResolver.insert(Uri.parse<MASK><NEW_LINE>String alertId = alertUri.getLastPathSegment();<NEW_LINE>AlertProxy alert = new AlertProxy();<NEW_LINE>alert.id = alertId;<NEW_LINE>alert.begin = event.getBegin();<NEW_LINE>alert.end = event.getEnd();<NEW_LINE>alert.alarmTime = alarmTime.getTime();<NEW_LINE>alert.state = STATE_SCHEDULED;<NEW_LINE>alert.minutes = minutes;<NEW_LINE>// FIXME this needs to be implemented alert.registerAlertIntent();<NEW_LINE>return alert;<NEW_LINE>} | (getAlertsUri()), values); |
975,575 | public static RecommendEvalTask fromJSON(JsonNode json, URI base) throws IOException {<NEW_LINE>RecommendEvalTask task = new RecommendEvalTask();<NEW_LINE>String outFile = json.path("output_file").asText(null);<NEW_LINE>if (outFile != null) {<NEW_LINE>task.setOutputFile(Paths.get(base.resolve(outFile)));<NEW_LINE>}<NEW_LINE>String itemOut = json.path("item_output_file").asText(null);<NEW_LINE>if (itemOut != null) {<NEW_LINE>task.setItemOutputFile(Paths.get(base.resolve(itemOut)));<NEW_LINE>}<NEW_LINE>task.setSeparateItems(json.path("separate_items").asBoolean(false));<NEW_LINE>task.setLabelPrefix(json.path("label_prefix").asText(null));<NEW_LINE>task.setListSize(json.path("list_size").asInt(-1));<NEW_LINE>String sel = json.path("candidates").asText(null);<NEW_LINE>if (sel != null) {<NEW_LINE>task.setCandidateSelector(ItemSelector.compileSelector(sel));<NEW_LINE>}<NEW_LINE>sel = json.path("exclude").asText(null);<NEW_LINE>if (sel != null) {<NEW_LINE>task.setExcludeSelector(ItemSelector.compileSelector(sel));<NEW_LINE>}<NEW_LINE>JsonNode metrics = json.get("metrics");<NEW_LINE>if (metrics != null && !metrics.isNull()) {<NEW_LINE>task.topNMetrics.clear();<NEW_LINE>MetricLoaderHelper mlh = new MetricLoaderHelper(ClassLoaders.inferDefault(PredictEvalTask.class), "topn-metrics");<NEW_LINE>for (JsonNode mn : metrics) {<NEW_LINE>TopNMetric<?> metric = mlh.<MASK><NEW_LINE>if (metric != null) {<NEW_LINE>task.addMetric(metric);<NEW_LINE>} else {<NEW_LINE>throw new VerifyError("cannot build metric for " + mn.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return task;<NEW_LINE>} | createMetric(TopNMetric.class, mn); |
1,672,944 | public ApiResponse<String> eventsGet_1WithHttpInfo(String downloadid) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'downloadid' is set<NEW_LINE>if (downloadid == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'downloadid' when calling eventsGet_1");<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/v4/events/export/{downloadid}".replaceAll("\\{" + "downloadid" + "\\}", apiClient.escapeString(downloadid.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new <MASK><NEW_LINE>final String[] localVarAccepts = { "application/json", "text/json" };<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] { "oauth2" };<NEW_LINE>GenericType<String> localVarReturnType = new GenericType<String>() {<NEW_LINE>};<NEW_LINE>return apiClient.invokeAPI(localVarPath, "GET", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, localVarReturnType);<NEW_LINE>} | HashMap<String, Object>(); |
844,932 | private void runExperiment() throws Exception {<NEW_LINE>// load building<NEW_LINE>CleanBuilding building = new <MASK><NEW_LINE>// load fps from file<NEW_LINE>building.parseFpFile();<NEW_LINE>DatasetCreator dataset = new DatasetCreator(this.dataset, this.buid, 1456737260395L);<NEW_LINE>CreateLookAhead lookahead = new CreateLookAhead(DataConnector.FINGERPRINTS_PATH + this.buid + "/all.pajek", this.maxSignalStrength);<NEW_LINE>// now run<NEW_LINE>AlgorithmBlocks algo = null;<NEW_LINE>if (algorithm == 0) {<NEW_LINE>algo = new RandomBlocks(building.getVertices(), k, dataset.random, probability);<NEW_LINE>} else if (algorithm == 1) {<NEW_LINE>algo = new BFSGlobalBlocks(building.getVertices(), k, dataset.random, probability);<NEW_LINE>} else if (algorithm == 2) {<NEW_LINE>// me1<NEW_LINE>algo = new ME1(building.getVertices(), k, dataset.random, probability);<NEW_LINE>} else if (algorithm == 3) {<NEW_LINE>// cs<NEW_LINE>algo = new CSAlgorithmBlocks(building.getVertices(), k, dataset.random, probability);<NEW_LINE>} else if (algorithm == 4) {<NEW_LINE>// ss<NEW_LINE>algo = new SSAlgorithmBlocks(building.getVertices(), k, dataset.random, probability);<NEW_LINE>} else if (algorithm == 5) {<NEW_LINE>algo = new SimulatedAnnealingBlocks(building.getVertices(), k, dataset.random, probability, 100);<NEW_LINE>} else if (algorithm == 6) {<NEW_LINE>algo = new ME4a(building.getVertices(), k, dataset.random, probability, 3, 3, true, building);<NEW_LINE>// System.out.println("ME3");<NEW_LINE>} else if (algorithm == 7) {<NEW_LINE>algo = new ME3(building.getVertices(), k, dataset.random, probability, 3, 3, true);<NEW_LINE>}<NEW_LINE>SimulationBlocks sim = new SimulationBlocks(k, building, dataset, algo, lookahead.getLookAhead());<NEW_LINE>if (algorithm == 3) {<NEW_LINE>// csalgorithm<NEW_LINE>sim.runCSSimulation();<NEW_LINE>} else if (algorithm == 4) {<NEW_LINE>// ssalgorithm<NEW_LINE>sim.runSSSimulation();<NEW_LINE>} else {<NEW_LINE>sim.runSimulation();<NEW_LINE>}<NEW_LINE>sim.writeToFile();<NEW_LINE>// create downloaded nodes file<NEW_LINE>sim.writeNodesToFile();<NEW_LINE>sim.outResults();<NEW_LINE>} | CleanBuilding(this.buid, false); |
61,826 | private Mono<Response<Flux<ByteBuffer>>> importDataWithResponseAsync(String resourceGroupName, String name, ImportRdbParameters parameters, Context context) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (name == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter name is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (parameters == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter parameters is required and cannot be null."));<NEW_LINE>} else {<NEW_LINE>parameters.validate();<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>context = this.client.mergeContext(context);<NEW_LINE>return service.importData(this.client.getEndpoint(), resourceGroupName, name, this.client.getApiVersion(), this.client.getSubscriptionId(<MASK><NEW_LINE>} | ), parameters, accept, context); |
856,521 | /*<NEW_LINE>* Walk starting from an AST boolean expression<NEW_LINE>*/<NEW_LINE>public void visit(Configuration conf, BooleanExpr e, Consumer<Statement> fs, Consumer<BooleanExpr> fe) {<NEW_LINE>fe.accept(e);<NEW_LINE>if (e instanceof Conjunction) {<NEW_LINE>Conjunction c = (Conjunction) e;<NEW_LINE>for (BooleanExpr be : c.getConjuncts()) {<NEW_LINE>visit(<MASK><NEW_LINE>}<NEW_LINE>} else if (e instanceof Disjunction) {<NEW_LINE>Disjunction d = (Disjunction) e;<NEW_LINE>for (BooleanExpr be : d.getDisjuncts()) {<NEW_LINE>visit(conf, be, fs, fe);<NEW_LINE>}<NEW_LINE>} else if (e instanceof ConjunctionChain) {<NEW_LINE>ConjunctionChain c = (ConjunctionChain) e;<NEW_LINE>for (BooleanExpr be : c.getSubroutines()) {<NEW_LINE>visit(conf, be, fs, fe);<NEW_LINE>}<NEW_LINE>} else if (e instanceof FirstMatchChain) {<NEW_LINE>FirstMatchChain p = (FirstMatchChain) e;<NEW_LINE>for (BooleanExpr be : p.getSubroutines()) {<NEW_LINE>visit(conf, be, fs, fe);<NEW_LINE>}<NEW_LINE>} else if (e instanceof Not) {<NEW_LINE>Not n = (Not) e;<NEW_LINE>visit(conf, n.getExpr(), fs, fe);<NEW_LINE>} else if (e instanceof CallExpr) {<NEW_LINE>CallExpr c = (CallExpr) e;<NEW_LINE>RoutingPolicy rp = conf.getRoutingPolicies().get(c.getCalledPolicyName());<NEW_LINE>visit(conf, rp.getStatements(), fs, fe);<NEW_LINE>}<NEW_LINE>} | conf, be, fs, fe); |
673,236 | // Must init at first<NEW_LINE>public static void allClasses() throws HackAssertionException {<NEW_LINE>if (android.os.Build.VERSION.SDK_INT <= 8) {<NEW_LINE>LoadedApk = Hack.into("android.app.ActivityThread$PackageInfo");<NEW_LINE>} else {<NEW_LINE>LoadedApk = Hack.into("android.app.LoadedApk");<NEW_LINE>}<NEW_LINE>ActivityThread = Hack.into("android.app.ActivityThread");<NEW_LINE>Resources = Hack.into(Resources.class);<NEW_LINE>Application = Hack.into(Application.class);<NEW_LINE>AssetManager = Hack.into(android.content.res.AssetManager.class);<NEW_LINE>IPackageManager = Hack.into("android.content.pm.IPackageManager");<NEW_LINE>Service = Hack.into(android.app.Service.class);<NEW_LINE>ContextImpl = Hack.into("android.app.ContextImpl");<NEW_LINE>ContextThemeWrapper = Hack.into(ContextThemeWrapper.class);<NEW_LINE>ContextWrapper = Hack.into("android.content.ContextWrapper");<NEW_LINE>sIsIgnoreFailure = true;<NEW_LINE>ClassLoader = Hack.into(java.lang.ClassLoader.class);<NEW_LINE>DexClassLoader = Hack.into(dalvik.system.DexClassLoader.class);<NEW_LINE>LexFile = Hack.into("dalvik.system.LexFile");<NEW_LINE>PackageParser$Component = Hack.into("android.content.pm.PackageParser$Component");<NEW_LINE><MASK><NEW_LINE>PackageParser$Service = Hack.into("android.content.pm.PackageParser$Service");<NEW_LINE>PackageParser$Provider = Hack.into("android.content.pm.PackageParser$Provider");<NEW_LINE>PackageParser = Hack.into("android.content.pm.PackageParser");<NEW_LINE>PackageParser$Package = Hack.into("android.content.pm.PackageParser$Package");<NEW_LINE>PackageParser$ActivityIntentInfo = Hack.into("android.content.pm.PackageParser$ActivityIntentInfo");<NEW_LINE>PackageParser$ServiceIntentInfo = Hack.into("android.content.pm.PackageParser$ServiceIntentInfo");<NEW_LINE>PackageParser$ProviderIntentInfo = Hack.into("android.content.pm.PackageParser$ProviderIntentInfo");<NEW_LINE>ActivityManagerNative = Hack.into("android.app.ActivityManagerNative");<NEW_LINE>Singleton = Hack.into("android.util.Singleton");<NEW_LINE>ActivityThread$AppBindData = Hack.into("android.app.ActivityThread$AppBindData");<NEW_LINE>ActivityManager = Hack.into("android.app.ActivityManager");<NEW_LINE>StringBlock = Hack.into("android.content.res.StringBlock");<NEW_LINE>ApplicationLoaders = Hack.into("android.app.ApplicationLoaders");<NEW_LINE>sIsIgnoreFailure = false;<NEW_LINE>} | PackageParser$Activity = Hack.into("android.content.pm.PackageParser$Activity"); |
107,131 | public Object calculate(Context ctx) {<NEW_LINE>if (param == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("attach" + mm.getMessage("function.missingParam"));<NEW_LINE>} else if (param.isLeaf()) {<NEW_LINE>String tableName = param.getLeafExpression().getIdentifierName();<NEW_LINE>ITableMetaData table = this.table;<NEW_LINE>table = table.getAnnexTable(tableName);<NEW_LINE>if (table == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException(tableName + mm.getMessage("dw.tableNotExist"));<NEW_LINE>}<NEW_LINE>return table;<NEW_LINE>}<NEW_LINE>IParam sub0 = param.getSub(0);<NEW_LINE>if (sub0 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("attach" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>String tableName = sub0.getLeafExpression().getIdentifierName();<NEW_LINE>int size = param.getSubSize();<NEW_LINE>String[] fields = new String[size - 1];<NEW_LINE>int[] serialBytesLen = new int[size - 1];<NEW_LINE>for (int i = 1; i < size; ++i) {<NEW_LINE>IParam sub = param.getSub(i);<NEW_LINE>if (sub == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("attach" <MASK><NEW_LINE>} else if (sub.isLeaf()) {<NEW_LINE>fields[i - 1] = sub.getLeafExpression().getIdentifierName();<NEW_LINE>} else {<NEW_LINE>IParam p0 = sub.getSub(0);<NEW_LINE>IParam p1 = sub.getSub(1);<NEW_LINE>if (p0 == null || p1 == null) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("attach" + mm.getMessage("function.invalidParam"));<NEW_LINE>}<NEW_LINE>fields[i - 1] = p0.getLeafExpression().getIdentifierName();<NEW_LINE>Object obj = p1.getLeafExpression().calculate(ctx);<NEW_LINE>if (!(obj instanceof Number)) {<NEW_LINE>MessageManager mm = EngineMessage.get();<NEW_LINE>throw new RQException("attach" + mm.getMessage("function.paramTypeError"));<NEW_LINE>}<NEW_LINE>serialBytesLen[i - 1] = ((Number) obj).intValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>return table.createAnnexTable(fields, serialBytesLen, tableName);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new RQException(e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | + mm.getMessage("function.invalidParam")); |
1,606,069 | protected void drawLeftPen(Graphics2D grx, JRPen topPen, JRPen leftPen, JRPen bottomPen, JRPrintElement element, int offsetX, int offsetY) {<NEW_LINE>Stroke leftStroke = JRPenUtil.getStroke(leftPen, BasicStroke.CAP_BUTT);<NEW_LINE>int height = element.getHeight();<NEW_LINE>float topOffset = topPen.getLineWidth() / 2;<NEW_LINE>float bottomOffset = bottomPen.getLineWidth() / 2;<NEW_LINE>if (leftStroke != null && height > 0) {<NEW_LINE>grx.setStroke(leftStroke);<NEW_LINE>grx.setColor(leftPen.getLineColor());<NEW_LINE>AffineTransform oldTx = grx.getTransform();<NEW_LINE>if (leftPen.getLineStyleValue() == LineStyleEnum.DOUBLE) {<NEW_LINE>float leftPenWidth = leftPen.getLineWidth();<NEW_LINE>grx.translate(element.getX() + offsetX - leftPenWidth / 3, element.getY() + offsetY - topOffset);<NEW_LINE>grx.scale(1, (height + (topOffset + bottomOffset)) / height);<NEW_LINE>grx.drawLine(0, 0, 0, height);<NEW_LINE>grx.setTransform(oldTx);<NEW_LINE>grx.translate(element.getX() + offsetX + leftPenWidth / 3, element.getY() + offsetY + topOffset / 3);<NEW_LINE>if (height > (topOffset + bottomOffset) / 3) {<NEW_LINE>grx.scale(1, (height - (topOffset + bottomOffset) / 3) / height);<NEW_LINE>}<NEW_LINE>grx.drawLine(0, 0, 0, height);<NEW_LINE>} else {<NEW_LINE>grx.translate(element.getX() + offsetX, element.getY() + offsetY - topOffset);<NEW_LINE>grx.scale(1, (height + topOffset + bottomOffset) / height);<NEW_LINE>grx.drawLine(<MASK><NEW_LINE>}<NEW_LINE>grx.setTransform(oldTx);<NEW_LINE>}<NEW_LINE>} | 0, 0, 0, height); |
838,359 | public Single<String> lookupUrl(String url) {<NEW_LINE>Pattern pattern = Pattern.compile(PATTERN_BY_ID);<NEW_LINE>Matcher matcher = pattern.matcher(url);<NEW_LINE>final String lookupUrl = matcher.find() ? ("https://itunes.apple.com/lookup?id=" + matcher.group(1)) : url;<NEW_LINE>return Single.create(emitter -> {<NEW_LINE>OkHttpClient client = AntennapodHttpClient.getHttpClient();<NEW_LINE>Request.Builder httpReq = new Request.Builder().url(lookupUrl);<NEW_LINE>try {<NEW_LINE>Response response = client.newCall(httpReq.build()).execute();<NEW_LINE>if (response.isSuccessful()) {<NEW_LINE>String resultString = response.body().string();<NEW_LINE>JSONObject result = new JSONObject(resultString);<NEW_LINE>JSONObject results = result.getJSONArray("results").getJSONObject(0);<NEW_LINE>String feedUrlName = "feedUrl";<NEW_LINE>if (!results.has(feedUrlName)) {<NEW_LINE>String <MASK><NEW_LINE>String trackName = results.getString("trackName");<NEW_LINE>emitter.onError(new FeedUrlNotFoundException(artistName, trackName));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String feedUrl = results.getString(feedUrlName);<NEW_LINE>emitter.onSuccess(feedUrl);<NEW_LINE>} else {<NEW_LINE>emitter.onError(new IOException(response.toString()));<NEW_LINE>}<NEW_LINE>} catch (IOException | JSONException e) {<NEW_LINE>emitter.onError(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | artistName = results.getString("artistName"); |
82,204 | public void addFile(String subLabel, String table, List<Pair<String, Long>> files, TNetworkAddress fileAddr, Map<String, String> properties, long timestamp) throws DdlException {<NEW_LINE>if (isSubLabelUsed(subLabel, timestamp)) {<NEW_LINE>// sub label is used and this is a retry request.<NEW_LINE>// no need to do further operation, just return<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>TableLoadDesc desc = loadDescByLabel.get(subLabel);<NEW_LINE>if (desc != null) {<NEW_LINE>// Already exists<NEW_LINE>throw new LabelAlreadyUsedException(multiLabel.getLabelName(), subLabel);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (desc == null) {<NEW_LINE>desc = new TableLoadDesc(table, subLabel, files, fileAddr, properties, timestamp);<NEW_LINE>desc.setBackendId(backendId);<NEW_LINE>loadDescByTable.put(table, desc);<NEW_LINE>} else {<NEW_LINE>if (!desc.canMerge(properties)) {<NEW_LINE>throw new DdlException("Same table have different properties in one multi-load." + "new=" + properties + ",old=" + desc.properties);<NEW_LINE>}<NEW_LINE>desc.addFiles(subLabel, files);<NEW_LINE>desc.addTimestamp(timestamp);<NEW_LINE>}<NEW_LINE>loadDescByLabel.put(subLabel, desc);<NEW_LINE>} | desc = loadDescByTable.get(table); |
1,679,499 | public Dimension render(Graphics2D graphics) {<NEW_LINE>if (!plugin.isInMlm()) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>Widget sack = client.getWidget(WidgetInfo.MOTHERLODE_MINE);<NEW_LINE>panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR);<NEW_LINE>if (sack != null) {<NEW_LINE>sack.setHidden(true);<NEW_LINE>if (config.showSack()) {<NEW_LINE>if (plugin.getCurSackSize() >= plugin.getMaxSackSize()) {<NEW_LINE>panelComponent.setBackgroundColor(DANGER);<NEW_LINE>}<NEW_LINE>panelComponent.getChildren().add(LineComponent.builder().left("Pay-dirt in sack:").right(String.valueOf(client.getVar(Varbits.SACK_NUMBER<MASK><NEW_LINE>}<NEW_LINE>if (config.showDepositsLeft()) {<NEW_LINE>final Integer depositsLeft = plugin.getDepositsLeft();<NEW_LINE>Color color = Color.WHITE;<NEW_LINE>if (depositsLeft != null) {<NEW_LINE>if (depositsLeft == 0) {<NEW_LINE>panelComponent.setBackgroundColor(DANGER);<NEW_LINE>} else if (depositsLeft == 1) {<NEW_LINE>color = Color.RED;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>panelComponent.getChildren().add(LineComponent.builder().left("Deposits left:").leftColor(color).right(depositsLeft == null ? "N/A" : String.valueOf(depositsLeft)).rightColor(color).build());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return super.render(graphics);<NEW_LINE>} | ))).build()); |
351,137 | public void copyTo(CommandQueue queue, Image dest, long[] srcOrigin, long[] destOrigin, long[] region) {<NEW_LINE>if (srcOrigin.length != 3 || destOrigin.length != 3 || region.length != 3) {<NEW_LINE>throw new IllegalArgumentException("origin and region must both be arrays of length 3");<NEW_LINE>}<NEW_LINE>Utils.pointerBuffers[0].rewind();<NEW_LINE>Utils.pointerBuffers[1].rewind();<NEW_LINE>Utils.pointerBuffers[2].rewind();<NEW_LINE>Utils.<MASK><NEW_LINE>Utils.pointerBuffers[1].put(srcOrigin).position(0);<NEW_LINE>Utils.pointerBuffers[2].put(destOrigin).position(0);<NEW_LINE>Utils.pointerBuffers[3].put(region).position(0);<NEW_LINE>CLCommandQueue q = ((LwjglCommandQueue) queue).getQueue();<NEW_LINE>int ret = CL10.clEnqueueCopyImage(q, image, ((LwjglImage) dest).getImage(), Utils.pointerBuffers[1], Utils.pointerBuffers[2], Utils.pointerBuffers[3], null, Utils.pointerBuffers[0]);<NEW_LINE>Utils.checkError(ret, "clEnqueueCopyImage");<NEW_LINE>long event = Utils.pointerBuffers[0].get(0);<NEW_LINE>ret = CL10.clWaitForEvents(q.getCLEvent(event));<NEW_LINE>Utils.checkError(ret, "clWaitForEvents");<NEW_LINE>} | pointerBuffers[3].rewind(); |
693,512 | private void onAddClick() {<NEW_LINE>getPanel();<NEW_LINE>LabelsPanel labelsPanel = new LabelsPanel();<NEW_LINE>LabelVariable[] variables = Git.getInstance().getVCSAnnotator().getProjectVariables();<NEW_LINE>labelsPanel.labelsList.setListData(variables);<NEW_LINE>String title = Bundle.GitOptionsPanel_labelVariables_title();<NEW_LINE>String acsd = Bundle.GitOptionsPanel_labelVariables_acsd();<NEW_LINE>DialogDescriptor dialogDescriptor = new DialogDescriptor(labelsPanel, title, true, DialogDescriptor.OK_CANCEL_OPTION, DialogDescriptor.OK_OPTION, null);<NEW_LINE>final Dialog dialog = DialogDisplayer.getDefault().createDialog(dialogDescriptor);<NEW_LINE>dialog.getAccessibleContext().setAccessibleDescription(acsd);<NEW_LINE>labelsPanel.labelsList.addMouseListener(new MouseAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void mouseClicked(MouseEvent e) {<NEW_LINE>if (e.getClickCount() == 2) {<NEW_LINE>dialog.setVisible(false);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>dialog.setVisible(true);<NEW_LINE>if (DialogDescriptor.OK_OPTION == dialogDescriptor.getValue()) {<NEW_LINE>Object[] selection = (Object[]) labelsPanel.labelsList.getSelectedValues();<NEW_LINE>// NOI18N<NEW_LINE>String variable = "";<NEW_LINE>for (Object o : selection) {<NEW_LINE>// NOI18N<NEW_LINE>variable += ((LabelVariable) o).getPattern();<NEW_LINE>}<NEW_LINE>String annotation = panel.txtProjectAnnotation.getText();<NEW_LINE>int pos = panel.txtProjectAnnotation.getCaretPosition();<NEW_LINE>if (pos < 0) {<NEW_LINE>pos = annotation.length();<NEW_LINE>}<NEW_LINE>StringBuilder sb = new StringBuilder(annotation.length() + variable.length());<NEW_LINE>sb.append(annotation.substring(0, pos));<NEW_LINE>sb.append(variable);<NEW_LINE>if (pos < annotation.length()) {<NEW_LINE>sb.append(annotation.substring(pos, annotation.length()));<NEW_LINE>}<NEW_LINE>panel.txtProjectAnnotation.setText(sb.toString());<NEW_LINE>panel.txtProjectAnnotation.requestFocus();<NEW_LINE>panel.txtProjectAnnotation.setCaretPosition(<MASK><NEW_LINE>}<NEW_LINE>} | pos + variable.length()); |
1,525,882 | private void retry(MethodCall call, MethodChannel.Result result) {<NEW_LINE>String taskId = call.argument("task_id");<NEW_LINE>DownloadTask task = taskDao.loadTask(taskId);<NEW_LINE>boolean requiresStorageNotLow = call.argument("requires_storage_not_low");<NEW_LINE>if (task != null) {<NEW_LINE>if (task.status == DownloadStatus.FAILED || task.status == DownloadStatus.CANCELED) {<NEW_LINE>WorkRequest request = buildRequest(task.url, task.savedDir, task.filename, task.headers, task.showNotification, task.openFileFromNotification, false, requiresStorageNotLow, task.saveInPublicStorage);<NEW_LINE>String newTaskId = request.getId().toString();<NEW_LINE>result.success(newTaskId);<NEW_LINE>sendUpdateProgress(newTaskId, DownloadStatus.ENQUEUED, task.progress);<NEW_LINE>taskDao.updateTask(taskId, newTaskId, DownloadStatus.ENQUEUED, task.progress, false);<NEW_LINE>WorkManager.getInstance(context).enqueue(request);<NEW_LINE>} else {<NEW_LINE>result.<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>result.error("invalid_task_id", "not found task corresponding to given task id", null);<NEW_LINE>}<NEW_LINE>} | error("invalid_status", "only failed and canceled task can be retried", null); |
436,086 | private NumberFormat createCurrencyNumberFormat(final I_C_Invoice_Candidate ic) {<NEW_LINE>final IBPartnerDAO bpartnerDAO = Services.get(IBPartnerDAO.class);<NEW_LINE>final ICurrencyDAO currencyDAO = Services.get(ICurrencyDAO.class);<NEW_LINE>final I_C_BPartner_Location billBPLocation = bpartnerDAO.getBPartnerLocationByIdEvenInactive(BPartnerLocationId.ofRepoId(ic.getBill_BPartner_ID(), ic.getBill_Location_ID()));<NEW_LINE>Check.assumeNotNull(billBPLocation, "billBPLocation not null for {}", ic);<NEW_LINE>// We use the language of the bill location to determine the number format.<NEW_LINE>// using the ic's context's language make no sense, because it basically amounts to the login language and can change a lot.<NEW_LINE>final String langInfo = billBPLocation.getC_Location().getC_Country().getAD_Language();<NEW_LINE>final Locale locale = Language.getLanguage(langInfo).getLocale();<NEW_LINE>final NumberFormat <MASK><NEW_LINE>final CurrencyId currencyId = CurrencyId.ofRepoIdOrNull(ic.getC_Currency_ID());<NEW_LINE>if (currencyId != null) {<NEW_LINE>final CurrencyCode currencyCode = currencyDAO.getCurrencyCodeById(currencyId);<NEW_LINE>numberFormat.setCurrency(Currency.getInstance(currencyCode.toThreeLetterCode()));<NEW_LINE>}<NEW_LINE>return numberFormat;<NEW_LINE>} | numberFormat = NumberFormat.getCurrencyInstance(locale); |
1,070,305 | private static void log(Logger logger, Marker marker, HttpLogEntry entry) {<NEW_LINE>Preconditions.checkNotNull(entry.method, "method");<NEW_LINE>Id dimensions = REGISTRY.createId("tags").withTag("mode", marker.getName()).withTag("status", entry.getStatusTag()).withTag("statusCode", entry.getStatusCodeTag()).withTag("method", entry.method);<NEW_LINE>if (entry.clientName != null) {<NEW_LINE>dimensions = dimensions.withTag("client", entry.clientName);<NEW_LINE>}<NEW_LINE>if (marker == SERVER && entry.path != null) {<NEW_LINE>dimensions = dimensions.withTag("endpoint", longestPrefixMatch<MASK><NEW_LINE>}<NEW_LINE>// Update stats for the final attempt after retries are exhausted<NEW_LINE>if (!entry.canRetry || entry.attempt >= entry.maxAttempts) {<NEW_LINE>BucketTimer.get(REGISTRY, COMPLETE.withTags(dimensions.tags()), BUCKETS).record(entry.getOverallLatency(), TimeUnit.MILLISECONDS);<NEW_LINE>}<NEW_LINE>// Update stats for every actual http request<NEW_LINE>BucketTimer.get(REGISTRY, ATTEMPT.withTags(dimensions.tags()), BUCKETS).record(entry.getLatency(), TimeUnit.MILLISECONDS);<NEW_LINE>REGISTRY.distributionSummary(REQ_HEADER_SIZE.withTags(dimensions.tags())).record(entry.getRequestHeadersLength());<NEW_LINE>REGISTRY.distributionSummary(REQ_ENTITY_SIZE.withTags(dimensions.tags())).record(entry.requestContentLength);<NEW_LINE>REGISTRY.distributionSummary(RES_HEADER_SIZE.withTags(dimensions.tags())).record(entry.getResponseHeadersLength());<NEW_LINE>REGISTRY.distributionSummary(RES_ENTITY_SIZE.withTags(dimensions.tags())).record(entry.responseContentLength);<NEW_LINE>// Write data out to logger if enabled. For many monitoring use-cases there tend to be<NEW_LINE>// frequent requests that can be quite noisy so the log level is set to debug. This class is<NEW_LINE>// mostly intended to generate something like an access log so it presumes users who want the<NEW_LINE>// information will configure an appender based on the markers to send the data to a<NEW_LINE>// dedicated file. Others shouldn't have to deal with the spam in the logs, so debug for the<NEW_LINE>// level seems reasonable.<NEW_LINE>if (logger.isDebugEnabled(marker)) {<NEW_LINE>logger.debug(marker, entry.toString());<NEW_LINE>}<NEW_LINE>} | (entry.path, "other")); |
1,680,516 | final CreateBuildResult executeCreateBuild(CreateBuildRequest createBuildRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(createBuildRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<CreateBuildRequest> request = null;<NEW_LINE>Response<CreateBuildResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new CreateBuildRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(createBuildRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "GameLift");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "CreateBuild");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<CreateBuildResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new CreateBuildResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,024,977 | private CompletableFuture<List<Wo>> listFuture(String flag, Integer page, Integer size) {<NEW_LINE>return CompletableFuture.supplyAsync(() -> {<NEW_LINE>List<Wo> wos = new ArrayList<>();<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>String job = business.<MASK><NEW_LINE>if (null != job) {<NEW_LINE>wos = emc.fetchEqualAscPaging(Record.class, Wo.copier, Record.job_FIELDNAME, job, page, size, Record.order_FIELDNAME);<NEW_LINE>} else {<NEW_LINE>job = business.job().findWithWorkCompleted(flag);<NEW_LINE>WorkCompleted workCompleted = emc.firstEqual(WorkCompleted.class, WorkCompleted.job_FIELDNAME, job);<NEW_LINE>if (ListTools.isNotEmpty(workCompleted.getProperties().getRecordList())) {<NEW_LINE>List<Record> os = workCompleted.getProperties().getRecordList();<NEW_LINE>int start = (page - 1) * size;<NEW_LINE>start = Math.min(start, os.size());<NEW_LINE>wos = Wo.copier.copy(os.stream().sorted(Comparator.comparing(Record::getOrder)).skip(start).limit(size).collect(Collectors.toList()));<NEW_LINE>} else {<NEW_LINE>wos = emc.fetchEqualAscPaging(Record.class, Wo.copier, Record.job_FIELDNAME, job, page, size, Record.order_FIELDNAME);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Task task : emc.listEqual(Task.class, Task.job_FIELDNAME, job).stream().sorted(Comparator.comparing(Task::getStartTime)).collect(Collectors.toList())) {<NEW_LINE>Record record = this.taskToRecord(task);<NEW_LINE>wos.add(Wo.copier.copy(record));<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(e);<NEW_LINE>}<NEW_LINE>return wos;<NEW_LINE>});<NEW_LINE>} | job().findWithWork(flag); |
1,103,756 | public Image modifyAlphaWithTranslucency(byte alpha) {<NEW_LINE>int w = getWidth();<NEW_LINE>int h = getHeight();<NEW_LINE>int size = w * h;<NEW_LINE>int[] arr = getRGB();<NEW_LINE>int alphaInt = (((int) alpha) << 24) & 0xff000000;<NEW_LINE>float alphaRatio = (alpha & 0xff);<NEW_LINE>alphaRatio = (alpha & 0xff) / 255.0f;<NEW_LINE>for (int iter = 0; iter < size; iter++) {<NEW_LINE>int currentAlpha = (arr[iter] >> 24) & 0xff;<NEW_LINE>if (currentAlpha != 0) {<NEW_LINE>if (currentAlpha == 0xff) {<NEW_LINE>arr[iter] = (arr[iter] & 0xffffff) | alphaInt;<NEW_LINE>} else {<NEW_LINE>int relative = (int) (currentAlpha * alphaRatio);<NEW_LINE>relative = (relative << 24) & 0xff000000;<NEW_LINE>arr[iter] = (arr[iter] & 0xffffff) | relative;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Image i = new <MASK><NEW_LINE>i.opaqueTested = true;<NEW_LINE>i.opaque = false;<NEW_LINE>return i;<NEW_LINE>} | Image(arr, w, h); |
900,681 | @PutMapping(value = "/cmmn-runtime/case-instances/{caseInstanceId}", produces = "application/json")<NEW_LINE>public CaseInstanceResponse updateCaseInstance(@ApiParam(name = "caseInstanceId") @PathVariable String caseInstanceId, @RequestBody CaseInstanceUpdateRequest updateRequest, HttpServletRequest request, HttpServletResponse response) {<NEW_LINE>CaseInstance caseInstance = getCaseInstanceFromRequest(caseInstanceId);<NEW_LINE>if (StringUtils.isNotEmpty(updateRequest.getAction())) {<NEW_LINE>if (restApiInterceptor != null) {<NEW_LINE>restApiInterceptor.doCaseInstanceAction(caseInstance, updateRequest);<NEW_LINE>}<NEW_LINE>if (RestActionRequest.EVALUATE_CRITERIA.equals(updateRequest.getAction())) {<NEW_LINE>runtimeService.evaluateCriteria(caseInstance.getId());<NEW_LINE>} else {<NEW_LINE>throw new FlowableIllegalArgumentException("Invalid action: '" + <MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// regular update<NEW_LINE>if (restApiInterceptor != null) {<NEW_LINE>restApiInterceptor.updateCaseInstance(caseInstance, updateRequest);<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(updateRequest.getName())) {<NEW_LINE>runtimeService.setCaseInstanceName(caseInstanceId, updateRequest.getName());<NEW_LINE>}<NEW_LINE>if (StringUtils.isNotEmpty(updateRequest.getBusinessKey())) {<NEW_LINE>runtimeService.updateBusinessKey(caseInstanceId, updateRequest.getBusinessKey());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Re-fetch the case instance, could have changed due to action or even completed<NEW_LINE>caseInstance = runtimeService.createCaseInstanceQuery().caseInstanceId(caseInstance.getId()).singleResult();<NEW_LINE>if (caseInstance == null) {<NEW_LINE>// Case instance is finished, return empty body to inform user<NEW_LINE>response.setStatus(HttpStatus.NO_CONTENT.value());<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>return restResponseFactory.createCaseInstanceResponse(caseInstance);<NEW_LINE>}<NEW_LINE>} | updateRequest.getAction() + "'."); |
1,782,372 | protected EnumMap<KeyIndex, String> initContentProviderKeys() {<NEW_LINE>EnumMap<KeyIndex, String> keys = new EnumMap<KeyIndex, String>(KeyIndex.class);<NEW_LINE>keys.put(KeyIndex.CALENDARS_ID, Calendars._ID);<NEW_LINE>keys.put(KeyIndex.IS_PRIMARY, Calendars.IS_PRIMARY);<NEW_LINE>keys.put(KeyIndex.CALENDARS_NAME, Calendars.NAME);<NEW_LINE>keys.put(KeyIndex.CALENDARS_DISPLAY_NAME, Calendars.CALENDAR_DISPLAY_NAME);<NEW_LINE>keys.put(KeyIndex.CALENDARS_VISIBLE, Calendars.VISIBLE);<NEW_LINE>keys.put(KeyIndex.EVENTS_ID, Events._ID);<NEW_LINE>keys.put(KeyIndex.EVENTS_CALENDAR_ID, Events.CALENDAR_ID);<NEW_LINE>keys.put(KeyIndex.EVENTS_DESCRIPTION, Events.DESCRIPTION);<NEW_LINE>keys.put(<MASK><NEW_LINE>keys.put(KeyIndex.EVENTS_SUMMARY, Events.TITLE);<NEW_LINE>keys.put(KeyIndex.EVENTS_START, Events.DTSTART);<NEW_LINE>keys.put(KeyIndex.EVENTS_END, Events.DTEND);<NEW_LINE>keys.put(KeyIndex.EVENTS_RRULE, Events.RRULE);<NEW_LINE>keys.put(KeyIndex.EVENTS_ALL_DAY, Events.ALL_DAY);<NEW_LINE>keys.put(KeyIndex.INSTANCES_ID, Instances._ID);<NEW_LINE>keys.put(KeyIndex.INSTANCES_EVENT_ID, Instances.EVENT_ID);<NEW_LINE>keys.put(KeyIndex.INSTANCES_BEGIN, Instances.BEGIN);<NEW_LINE>keys.put(KeyIndex.INSTANCES_END, Instances.END);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_ID, Attendees._ID);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_EVENT_ID, Attendees.EVENT_ID);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_NAME, Attendees.ATTENDEE_NAME);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_EMAIL, Attendees.ATTENDEE_EMAIL);<NEW_LINE>keys.put(KeyIndex.ATTENDEES_STATUS, Attendees.ATTENDEE_STATUS);<NEW_LINE>return keys;<NEW_LINE>} | KeyIndex.EVENTS_LOCATION, Events.EVENT_LOCATION); |
314,663 | public ResultInterface executeQuery(long maxRows, boolean scrollable) {<NEW_LINE>checkParameters();<NEW_LINE>synchronized (session) {<NEW_LINE>int objectId = session.getNextId();<NEW_LINE>ResultRemote result = null;<NEW_LINE>for (int i = 0, count = 0; i < transferList.size(); i++) {<NEW_LINE>prepareIfRequired();<NEW_LINE>Transfer transfer = transferList.get(i);<NEW_LINE>try {<NEW_LINE>session.traceOperation("COMMAND_EXECUTE_QUERY", id);<NEW_LINE>transfer.writeInt(SessionRemote.COMMAND_EXECUTE_QUERY).writeInt(id).writeInt(objectId);<NEW_LINE>transfer.writeRowCount(maxRows);<NEW_LINE>int fetch;<NEW_LINE>if (session.isClustered() || scrollable) {<NEW_LINE>fetch = Integer.MAX_VALUE;<NEW_LINE>} else {<NEW_LINE>fetch = fetchSize;<NEW_LINE>}<NEW_LINE>transfer.writeInt(fetch);<NEW_LINE>sendParameters(transfer);<NEW_LINE>session.done(transfer);<NEW_LINE>int columnCount = transfer.readInt();<NEW_LINE>if (result != null) {<NEW_LINE>result.close();<NEW_LINE>result = null;<NEW_LINE>}<NEW_LINE>result = new ResultRemote(session, transfer, objectId, columnCount, fetch);<NEW_LINE>if (readonly) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>session.removeServer(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>session.autoCommitIfCluster();<NEW_LINE>session.readSessionState();<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | e, i--, ++count); |
1,256,463 | void exportAuthFile(ServicePrincipalImpl servicePrincipal) {<NEW_LINE>if (authFile == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>AzureEnvironment environment = AzureEnvironment.AZURE;<NEW_LINE>StringBuilder builder = new StringBuilder("{\n");<NEW_LINE>builder.append(" ").append(String.format("\"clientId\": \"%s\",", servicePrincipal.applicationId())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"clientSecret\": \"%s\",", value())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"tenantId\": \"%s\",", servicePrincipal.manager().tenantId())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"subscriptionId\": \"%s\",", servicePrincipal.assignedSubscription)).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"activeDirectoryEndpointUrl\": \"%s\",", environment.getActiveDirectoryEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"resourceManagerEndpointUrl\": \"%s\",", environment.getResourceManagerEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"activeDirectoryGraphResourceId\": \"%s\",", environment.getGraphEndpoint())).append("\n");<NEW_LINE>builder.append(" ").append(String.format("\"managementEndpointUrl\": \"%s\"", environment.getManagementEndpoint())).append("\n");<NEW_LINE>builder.append("}");<NEW_LINE>try {<NEW_LINE>authFile.write(builder.toString().getBytes(StandardCharsets.UTF_8));<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw logger.<MASK><NEW_LINE>}<NEW_LINE>} | logExceptionAsError(new RuntimeException(e)); |
1,130,311 | public ByteBuf encode(ByteBuf buf, UnlockRecipesMessage message) throws IOException {<NEW_LINE>ByteBufUtils.writeVarInt(buf, message.getAction());<NEW_LINE>buf.writeBoolean(message.isBookOpen());<NEW_LINE>buf.writeBoolean(message.isFilterOpen());<NEW_LINE>buf.writeBoolean(message.isSmeltingBookOpen());<NEW_LINE>buf.writeBoolean(message.isSmeltingFilterOpen());<NEW_LINE>ByteBufUtils.writeVarInt(buf, message.getRecipes().length);<NEW_LINE>for (int recipe : message.getRecipes()) {<NEW_LINE>ByteBufUtils.writeVarInt(buf, recipe);<NEW_LINE>}<NEW_LINE>if (message.getAction() == UnlockRecipesMessage.ACTION_INIT && message.getAllRecipes() != null) {<NEW_LINE>ByteBufUtils.writeVarInt(buf, message.getAllRecipes().length);<NEW_LINE>for (int recipe : message.getAllRecipes()) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return buf;<NEW_LINE>} | ByteBufUtils.writeVarInt(buf, recipe); |
104,816 | private void createAllocations(MOrder targetOrder) {<NEW_LINE>List<MPayment> payments = MPayment.getOfOrder(targetOrder);<NEW_LINE>MInvoice[] invoices = targetOrder.getInvoices();<NEW_LINE>BigDecimal totalPay = BigDecimal.ZERO;<NEW_LINE>BigDecimal totalInvoiced = BigDecimal.ZERO;<NEW_LINE>for (MPayment payment : payments) totalPay = totalPay.add(payment.getPayAmt());<NEW_LINE>for (MInvoice invoice : invoices) {<NEW_LINE>totalInvoiced = totalInvoiced.add(invoice.getGrandTotal());<NEW_LINE>}<NEW_LINE>if (totalInvoiced.signum() != 0 && totalPay.signum() != 0 && totalInvoiced.compareTo(totalPay) == 0) {<NEW_LINE>MAllocationHdr allocation = new MAllocationHdr(getCtx(), true, today, targetOrder.getC_Currency_ID(), targetOrder.getDescription(), get_TrxName());<NEW_LINE>allocation.setDocStatus(org.compiere.process.DocAction.STATUS_Drafted);<NEW_LINE>allocation.setDocAction(org.compiere.process.DocAction.ACTION_Complete);<NEW_LINE>allocation.saveEx();<NEW_LINE>addLog(allocation.getDocumentInfo());<NEW_LINE>for (MInvoice invoice : invoices) {<NEW_LINE>MAllocationLine allocationLine = new MAllocationLine(allocation);<NEW_LINE>allocationLine.setDocInfo(targetOrder.getC_BPartner_ID(), targetOrder.getC_Order_ID(), invoice.getC_Invoice_ID());<NEW_LINE>allocationLine.<MASK><NEW_LINE>allocationLine.saveEx();<NEW_LINE>}<NEW_LINE>for (MPayment payment : payments) {<NEW_LINE>MAllocationLine allocationLine = new MAllocationLine(allocation);<NEW_LINE>allocationLine.setPaymentInfo(payment.get_ID(), 0);<NEW_LINE>allocationLine.setAmount(payment.getPayAmt());<NEW_LINE>allocationLine.saveEx();<NEW_LINE>}<NEW_LINE>allocation.processIt(org.compiere.process.DocAction.ACTION_Complete);<NEW_LINE>allocation.saveEx();<NEW_LINE>}<NEW_LINE>} | setAmount(invoice.getGrandTotal()); |
135,654 | protected void removeByC_EA(String companyId, String emailAddress) throws NoSuchUserException, SystemException {<NEW_LINE>Session session = null;<NEW_LINE>User systemUser = null;<NEW_LINE>try {<NEW_LINE>systemUser = APILocator.getUserAPI().getSystemUser();<NEW_LINE>} catch (DotDataException e) {<NEW_LINE>// TODO Auto-generated catch block<NEW_LINE>throw new SystemException("Cannot find System User");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>session = openSession();<NEW_LINE>StringBuffer query = new StringBuffer();<NEW_LINE>query.append("FROM User_ IN CLASS com.liferay.portal.ejb.UserHBM WHERE ");<NEW_LINE>query.append("companyId = ?");<NEW_LINE>query.append(" AND ");<NEW_LINE>query.append("emailAddress = ?");<NEW_LINE>query.append(" AND ");<NEW_LINE>query.append("userId <> ?");<NEW_LINE>query.append(" AND delete_in_progress = ");<NEW_LINE>query.append(DbConnectionFactory.getDBFalse());<NEW_LINE>query.append(" ORDER BY ");<NEW_LINE>query.append("firstName ASC").append(", ");<NEW_LINE>query.append<MASK><NEW_LINE>query.append("lastName ASC");<NEW_LINE>Query q = session.createQuery(query.toString());<NEW_LINE>int queryPos = 0;<NEW_LINE>q.setString(queryPos++, companyId);<NEW_LINE>q.setString(queryPos++, emailAddress);<NEW_LINE>q.setString(queryPos++, systemUser.getUserId());<NEW_LINE>Iterator itr = q.list().iterator();<NEW_LINE>while (itr.hasNext()) {<NEW_LINE>UserHBM userHBM = (UserHBM) itr.next();<NEW_LINE>UserPool.remove((String) userHBM.getPrimaryKey());<NEW_LINE>session.delete(userHBM);<NEW_LINE>}<NEW_LINE>session.flush();<NEW_LINE>} catch (HibernateException he) {<NEW_LINE>if (he instanceof ObjectNotFoundException) {<NEW_LINE>throw new NoSuchUserException();<NEW_LINE>} else {<NEW_LINE>throw new SystemException(he);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ("middleName ASC").append(", "); |
382,606 | private static void applyAnnotationToMethodDecl(JavacNode typeNode, JCMethodDecl mth, String annType, boolean typeUse) {<NEW_LINE>if (annType == null)<NEW_LINE>return;<NEW_LINE>JavacTreeMaker maker = typeNode.getTreeMaker();<NEW_LINE>JCAnnotation m = maker.Annotation(genTypeRef(typeNode, annType), List.<JCExpression>nil());<NEW_LINE>if (typeUse) {<NEW_LINE>JCExpression resType = mth.restype;<NEW_LINE>if (resType instanceof JCTypeApply) {<NEW_LINE>JCTypeApply ta = (JCTypeApply) resType;<NEW_LINE>if (ta.clazz instanceof JCFieldAccess) {<NEW_LINE>mth.restype = maker.TypeApply(maker.AnnotatedType(List.of(m), ta.clazz), ta.arguments);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>resType = ta.clazz;<NEW_LINE>}<NEW_LINE>if (resType instanceof JCFieldAccess || resType instanceof JCArrayTypeTree) {<NEW_LINE>mth.restype = maker.AnnotatedType(List.of(m), resType);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (JCAnnotatedTypeReflect.is(resType)) {<NEW_LINE>List<JCAnnotation> <MASK><NEW_LINE>JCAnnotatedTypeReflect.setAnnotations(resType, annotations.prepend(m));<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (resType instanceof JCPrimitiveTypeTree || resType instanceof JCIdent) {<NEW_LINE>mth.mods.annotations = mth.mods.annotations == null ? List.of(m) : mth.mods.annotations.prepend(m);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mth.mods.annotations = mth.mods.annotations == null ? List.of(m) : mth.mods.annotations.prepend(m);<NEW_LINE>}<NEW_LINE>} | annotations = JCAnnotatedTypeReflect.getAnnotations(resType); |
1,009,241 | public void doAction(ActionContext context) throws Exception {<NEW_LINE>setUpgradePhase(UpgradePhase.PROCESS_START);<NEW_LINE>List<MASK><NEW_LINE>int size = processList.size();<NEW_LINE>float processIndex = 1;<NEW_LINE>for (TargetProcess process : processList) {<NEW_LINE>if (UpgradeUtil.isUAVProcessAlive(process)) {<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.info(this, process + " is already alive, no need to start");<NEW_LINE>}<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>startProcess(process);<NEW_LINE>// Sleep 3 seconds to finish starting<NEW_LINE>ThreadHelper.suspend(3000);<NEW_LINE>if (!UpgradeUtil.isUAVProcessAlive(process)) {<NEW_LINE>throw new UpgradeException("Failed to start profile: " + process.getProfileName());<NEW_LINE>}<NEW_LINE>if (this.upgradeContext.canWriteOperationRecord()) {<NEW_LINE>this.writeProcessRecord(this.cName, process, processIndex / size, UpgradeUtil.getUAVProcessJsonStrList(processList));<NEW_LINE>}<NEW_LINE>if (log.isTraceEnable()) {<NEW_LINE>log.info(this, "Profile: " + process.getProfileName() + " was restarted successfully");<NEW_LINE>}<NEW_LINE>processIndex++;<NEW_LINE>}<NEW_LINE>context.setSucessful(true);<NEW_LINE>} | <TargetProcess> processList = getProcessList(); |
995,878 | private static org.jreleaser.model.Mail convertMail(Mail mail) {<NEW_LINE>org.jreleaser.model.Mail a = new org.jreleaser.model.Mail();<NEW_LINE>convertAnnouncer(mail, a);<NEW_LINE>if (mail.isAuthSet())<NEW_LINE>a.setAuth(mail.isAuth());<NEW_LINE>if (null != mail.getTransport())<NEW_LINE>a.setTransport(mail.getTransport().name());<NEW_LINE>if (null != mail.getMimeType())<NEW_LINE>a.setMimeType(mail.getMimeType().name());<NEW_LINE>a.setPort(mail.getPort());<NEW_LINE>a.setUsername(tr(mail.getUsername()));<NEW_LINE>a.setPassword(tr<MASK><NEW_LINE>a.setFrom(tr(mail.getFrom()));<NEW_LINE>a.setTo(tr(mail.getTo()));<NEW_LINE>a.setCc(tr(mail.getCc()));<NEW_LINE>a.setBcc(tr(mail.getBcc()));<NEW_LINE>a.setSubject(tr(mail.getSubject()));<NEW_LINE>a.setMessage(tr(mail.getMessage()));<NEW_LINE>a.setMessageTemplate(tr(mail.getMessageTemplate()));<NEW_LINE>return a;<NEW_LINE>} | (mail.getPassword())); |
1,364,069 | public String format(double value) {<NEW_LINE>if ((offset < SECONDS && value < CUT_OVER_BELOW_S) || (offset >= SECONDS && value < CUT_OVER_ABOVE_S)) {<NEW_LINE>return String.format("%g%s", value, NAMES[offset]);<NEW_LINE>} else if (offset == NAMES.length - 1) {<NEW_LINE>return String.format("%,gh", value);<NEW_LINE>}<NEW_LINE>int unit = offset;<NEW_LINE>while (unit < SECONDS) {<NEW_LINE>if (value < CUT_OVER_BELOW_S * BASE_BELOW_S) {<NEW_LINE>return String.format("%d.%03d%s", (long) (value / BASE_BELOW_S), (long) value % BASE_BELOW_S, NAMES[unit + 1]);<NEW_LINE>}<NEW_LINE>value /= BASE_BELOW_S;<NEW_LINE>unit++;<NEW_LINE>}<NEW_LINE>switch(unit) {<NEW_LINE>case 3:<NEW_LINE>{<NEW_LINE>// seconds<NEW_LINE>double s = value % BASE_ABOVE_S;<NEW_LINE>long m = ((long) value / BASE_ABOVE_S) % BASE_ABOVE_S;<NEW_LINE>long h = ((long) value / (BASE_ABOVE_S * BASE_ABOVE_S));<NEW_LINE>if (h > 0) {<NEW_LINE>return String.format(<MASK><NEW_LINE>} else if (m > 0) {<NEW_LINE>return String.format("%dm %02gs", m, s);<NEW_LINE>} else {<NEW_LINE>return String.format("%gs", s);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>case 4:<NEW_LINE>{<NEW_LINE>// minutes<NEW_LINE>double m = value % BASE_ABOVE_S;<NEW_LINE>long h = ((long) value / BASE_ABOVE_S);<NEW_LINE>if (h > 0) {<NEW_LINE>return String.format("%dh %02gm", h, m);<NEW_LINE>} else {<NEW_LINE>return String.format("%gm", m);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>return String.format("%,gh", value);<NEW_LINE>}<NEW_LINE>} | "%dh %02dm %02gs", h, m, s); |
81,318 | public boolean apply(Game game, Ability source) {<NEW_LINE>Card card = game.getCard(source.getFirstTarget());<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null || card == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>controller.moveCards(card, Zone.EXILED, source, game);<NEW_LINE>CreateTokenCopyTargetEffect effect = new CreateTokenCopyTargetEffect(source.getControllerId(), null, true, 1, true, true);<NEW_LINE>effect.setTargetPointer(new FixedTarget(card, game));<NEW_LINE>effect.apply(game, source);<NEW_LINE>for (Permanent addedToken : effect.getAddedPermanents()) {<NEW_LINE>Effect exileEffect = new ExileTargetEffect();<NEW_LINE>exileEffect.setTargetPointer(<MASK><NEW_LINE>new CreateDelayedTriggeredAbilityEffect(new AtTheEndOfCombatDelayedTriggeredAbility(exileEffect), false).apply(game, source);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | new FixedTarget(addedToken, game)); |
1,530,101 | public static void drawAcceptIcon(Canvas canvas, RectF targetFrame, ResizingBehavior resizing) {<NEW_LINE>// General Declarations<NEW_LINE>Paint paint = CacheForAcceptIcon.paint;<NEW_LINE>// Local Colors<NEW_LINE>int fillColor103 = Color.argb(255, 32, 183, 128);<NEW_LINE>// Resize to Target Frame<NEW_LINE>canvas.save();<NEW_LINE>RectF resizedFrame = CacheForAcceptIcon.resizedFrame;<NEW_LINE>HabiticaIcons.resizingBehaviorApply(resizing, CacheForAcceptIcon.originalFrame, targetFrame, resizedFrame);<NEW_LINE>canvas.translate(resizedFrame.left, resizedFrame.top);<NEW_LINE>canvas.scale(resizedFrame.width() / 13f, resizedFrame.height() / 13f);<NEW_LINE>// Bezier<NEW_LINE>RectF bezierRect = CacheForAcceptIcon.bezierRect;<NEW_LINE>bezierRect.set(0f, 2f, 13f, 12f);<NEW_LINE>Path bezierPath = CacheForAcceptIcon.bezierPath;<NEW_LINE>bezierPath.reset();<NEW_LINE>bezierPath.moveTo(1.5f, 6.5f);<NEW_LINE>bezierPath.lineTo(0f, 8f);<NEW_LINE>bezierPath.lineTo(4f, 12f);<NEW_LINE>bezierPath.lineTo(13f, 3.5f);<NEW_LINE>bezierPath.lineTo(11.5f, 2f);<NEW_LINE>bezierPath.lineTo(4f, 9f);<NEW_LINE><MASK><NEW_LINE>bezierPath.close();<NEW_LINE>paint.reset();<NEW_LINE>paint.setFlags(Paint.ANTI_ALIAS_FLAG);<NEW_LINE>bezierPath.setFillType(Path.FillType.EVEN_ODD);<NEW_LINE>paint.setStyle(Paint.Style.FILL);<NEW_LINE>paint.setColor(fillColor103);<NEW_LINE>canvas.drawPath(bezierPath, paint);<NEW_LINE>canvas.restore();<NEW_LINE>} | bezierPath.lineTo(1.5f, 6.5f); |
27,075 | public static <T extends ImageGray<T>> void orderBandsIntoRGB(Planar<T> image, BufferedImage input) {<NEW_LINE>boolean swap = swapBandOrder(input);<NEW_LINE>// Output formats are: RGB and RGBA<NEW_LINE>if (swap) {<NEW_LINE>if (image.getNumBands() == 3) {<NEW_LINE>int bufferedImageType = input.getType();<NEW_LINE>if (bufferedImageType == BufferedImage.TYPE_3BYTE_BGR || bufferedImageType == BufferedImage.TYPE_INT_BGR) {<NEW_LINE>T tmp = image.getBand(0);<NEW_LINE>image.bands[0<MASK><NEW_LINE>image.bands[2] = tmp;<NEW_LINE>}<NEW_LINE>} else if (image.getNumBands() == 4) {<NEW_LINE>T[] temp = (T[]) Array.newInstance(image.getBandType(), 4);<NEW_LINE>int bufferedImageType = input.getType();<NEW_LINE>if (bufferedImageType == BufferedImage.TYPE_INT_ARGB || bufferedImageType == BufferedImage.TYPE_INT_ARGB_PRE) {<NEW_LINE>temp[0] = image.getBand(1);<NEW_LINE>temp[1] = image.getBand(2);<NEW_LINE>temp[2] = image.getBand(3);<NEW_LINE>temp[3] = image.getBand(0);<NEW_LINE>} else if (bufferedImageType == BufferedImage.TYPE_4BYTE_ABGR || bufferedImageType == BufferedImage.TYPE_4BYTE_ABGR_PRE) {<NEW_LINE>temp[0] = image.getBand(3);<NEW_LINE>temp[1] = image.getBand(2);<NEW_LINE>temp[2] = image.getBand(1);<NEW_LINE>temp[3] = image.getBand(0);<NEW_LINE>}<NEW_LINE>image.bands[0] = temp[0];<NEW_LINE>image.bands[1] = temp[1];<NEW_LINE>image.bands[2] = temp[2];<NEW_LINE>image.bands[3] = temp[3];<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ] = image.getBand(2); |
671,572 | public void daemonize() {<NEW_LINE>if (isDaemonized()) {<NEW_LINE>throw new IllegalStateException("Already running as a daemon");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>LOGGER.info("Forking...");<NEW_LINE>var args = JavaVMArguments.current();<NEW_LINE>args.setSystemProperty(RESTHeartDaemon.class.getName(), "daemonized");<NEW_LINE>String[] _args = args.toArray(new String[args.size()]);<NEW_LINE>if (isExecutable()) {<NEW_LINE>_args[0] = FileUtils.getFileAbsolutePath(_args[0]).toString();<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// create child process<NEW_LINE>var p = new ProcessBuilder().command(_args).start();<NEW_LINE>LOGGER.info("Forked process: {}", p.pid());<NEW_LINE>// parent exists<NEW_LINE>System.exit(0);<NEW_LINE>} catch (Throwable t) {<NEW_LINE>LOGGER.error("Fork failed", t);<NEW_LINE>System.exit(-4);<NEW_LINE>}<NEW_LINE>} | _args[0] = getCurrentExecutable(); |
175,219 | // Find or create the appropriate entry for a particular key. We assume this method is<NEW_LINE>// called on the zero keylen entry (first in the chain).<NEW_LINE>PartialMatch findOrCreate(char[] key) {<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>tc.entry(this, cclass, "findOrCreate", "key: " + new String(key));<NEW_LINE>for (PartialMatch pm = this; ; pm = pm.next) {<NEW_LINE>if (Arrays.equals(key, pm.key)) {<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>tc.exit(this, cclass, "findOrCreate", "pm: " + pm);<NEW_LINE>return pm;<NEW_LINE>}<NEW_LINE>if (pm.next == null || pm.next.key.length > key.length) {<NEW_LINE>// We didn't get an exact key match, so we need to make a new PartialMatch<NEW_LINE>// structure<NEW_LINE>pm.next = newPartialMatch(key, pm.next);<NEW_LINE>if (tc.isEntryEnabled())<NEW_LINE>tc.exit(this, cclass, <MASK><NEW_LINE>return pm.next;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "findOrCreate", "pm.next: " + pm.next); |
1,055,439 | public static void renderTrack(KernelContext context, ImageByte3 output, ImageFloat3 input) {<NEW_LINE>int x = context.globalIdx;<NEW_LINE>int y = context.globalIdy;<NEW_LINE>Byte3 pixel = null;<NEW_LINE>final int result = (int) input.get(x, y).getS2();<NEW_LINE>switch(result) {<NEW_LINE>case // ok GREY<NEW_LINE>1:<NEW_LINE>pixel = new Byte3((byte) 128, (byte) 128, (byte) 128);<NEW_LINE>break;<NEW_LINE>case // no input BLACK<NEW_LINE>-1:<NEW_LINE>pixel = new Byte3((byte) 0, (byte) 0, (byte) 0);<NEW_LINE>break;<NEW_LINE>case // not in image RED<NEW_LINE>-2:<NEW_LINE>pixel = new Byte3((byte) 255, (byte) 0, (byte) 0);<NEW_LINE>break;<NEW_LINE>case // no correspondence GREEN<NEW_LINE>-3:<NEW_LINE>pixel = new Byte3((byte) 0, (byte) 255, (byte) 0);<NEW_LINE>break;<NEW_LINE>case // too far away BLUE<NEW_LINE>-4:<NEW_LINE>pixel = new Byte3((byte) 0, (byte<MASK><NEW_LINE>break;<NEW_LINE>case // wrong normal YELLOW<NEW_LINE>-5:<NEW_LINE>pixel = new Byte3((byte) 255, (byte) 255, (byte) 0);<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>pixel = new Byte3((byte) 255, (byte) 128, (byte) 128);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>output.set(x, y, pixel);<NEW_LINE>} | ) 0, (byte) 255); |
1,453,733 | private static AnnotationBinding buildTargetAnnotation(long bits, LookupEnvironment env) {<NEW_LINE>ReferenceBinding target = env.getResolvedJavaBaseType(TypeConstants.JAVA_LANG_ANNOTATION_TARGET, null);<NEW_LINE>if ((bits & TagBits.AnnotationTarget) != 0)<NEW_LINE>return new <MASK><NEW_LINE>int arraysize = 0;<NEW_LINE>if ((bits & TagBits.AnnotationForAnnotationType) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForConstructor) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForField) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForLocalVariable) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForMethod) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForPackage) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForParameter) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForType) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForTypeUse) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForTypeParameter) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForModule) != 0)<NEW_LINE>arraysize++;<NEW_LINE>if ((bits & TagBits.AnnotationForRecordComponent) != 0)<NEW_LINE>arraysize++;<NEW_LINE>Object[] value = new Object[arraysize];<NEW_LINE>if (arraysize > 0) {<NEW_LINE>ReferenceBinding elementType = env.getResolvedType(TypeConstants.JAVA_LANG_ANNOTATION_ELEMENTTYPE, null);<NEW_LINE>int index = 0;<NEW_LINE>if ((bits & TagBits.AnnotationForTypeUse) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.TYPE_USE_TARGET, true);<NEW_LINE>if ((bits & TagBits.AnnotationForAnnotationType) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_ANNOTATION_TYPE, true);<NEW_LINE>if ((bits & TagBits.AnnotationForConstructor) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_CONSTRUCTOR, true);<NEW_LINE>if ((bits & TagBits.AnnotationForField) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_FIELD, true);<NEW_LINE>if ((bits & TagBits.AnnotationForRecordComponent) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_RECORD_COMPONENT, true);<NEW_LINE>if ((bits & TagBits.AnnotationForMethod) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_METHOD, true);<NEW_LINE>if ((bits & TagBits.AnnotationForPackage) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_PACKAGE, true);<NEW_LINE>if ((bits & TagBits.AnnotationForParameter) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_PARAMETER, true);<NEW_LINE>if ((bits & TagBits.AnnotationForTypeParameter) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.TYPE_PARAMETER_TARGET, true);<NEW_LINE>if ((bits & TagBits.AnnotationForType) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.TYPE, true);<NEW_LINE>if ((bits & TagBits.AnnotationForLocalVariable) != 0)<NEW_LINE>value[index++] = elementType.getField(TypeConstants.UPPER_LOCAL_VARIABLE, true);<NEW_LINE>}<NEW_LINE>return env.createAnnotation(target, new ElementValuePair[] { new ElementValuePair(TypeConstants.VALUE, value, null) });<NEW_LINE>} | AnnotationBinding(target, Binding.NO_ELEMENT_VALUE_PAIRS); |
326,055 | /*<NEW_LINE>* @see com.sitewhere.grpc.service.AssetManagementGrpc.AssetManagementImplBase#<NEW_LINE>* updateAsset(com.sitewhere.grpc.service.GUpdateAssetRequest,<NEW_LINE>* io.grpc.stub.StreamObserver)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public void updateAsset(GUpdateAssetRequest request, StreamObserver<GUpdateAssetResponse> responseObserver) {<NEW_LINE>try {<NEW_LINE>GrpcUtils.handleServerMethodEntry(this, AssetManagementGrpc.getUpdateAssetMethod());<NEW_LINE>IAssetCreateRequest apiRequest = AssetModelConverter.asApiAssetCreateRequest(request.getRequest());<NEW_LINE>IAsset apiResult = getAssetManagement().updateAsset(CommonModelConverter.asApiUuid(request.getAssetId()), apiRequest);<NEW_LINE>GUpdateAssetResponse.Builder response = GUpdateAssetResponse.newBuilder();<NEW_LINE>response.setAsset(AssetModelConverter.asGrpcAsset(apiResult));<NEW_LINE>responseObserver.onNext(response.build());<NEW_LINE>responseObserver.onCompleted();<NEW_LINE>} catch (Throwable e) {<NEW_LINE>GrpcUtils.handleServerMethodException(AssetManagementGrpc.getUpdateAssetMethod(), e, responseObserver);<NEW_LINE>} finally {<NEW_LINE>GrpcUtils.<MASK><NEW_LINE>}<NEW_LINE>} | handleServerMethodExit(AssetManagementGrpc.getUpdateAssetMethod()); |
1,102,888 | public static void main(String[] args) throws InterruptedException, IllegalArgumentException {<NEW_LINE>// Instantiate a key client that will be used to call the service. Notice that the client is using default Azure<NEW_LINE>// credentials. To make default credentials work, ensure that environment variables 'AZURE_CLIENT_ID',<NEW_LINE>// 'AZURE_CLIENT_KEY' and 'AZURE_TENANT_ID' are set with the service principal credentials.<NEW_LINE>CryptographyClient cryptoClient = new CryptographyClientBuilder().credential(new DefaultAzureCredentialBuilder().build()).keyIdentifier("<Your-Key-Id-From-Keyvault").buildClient();<NEW_LINE>byte[] plaintext = new byte[100];<NEW_LINE>new Random(0x1234567L).nextBytes(plaintext);<NEW_LINE>// Let's encrypt a simple plain text of size 100 bytes.<NEW_LINE>EncryptResult encryptResult = cryptoClient.encrypt(EncryptionAlgorithm.RSA_OAEP, plaintext);<NEW_LINE>System.out.printf("Returned ciphertext size is %d bytes with algorithm %s\n", encryptResult.getCipherText().length, encryptResult.<MASK><NEW_LINE>// Let's decrypt the encrypted response.<NEW_LINE>DecryptResult decryptResult = cryptoClient.decrypt(EncryptionAlgorithm.RSA_OAEP, encryptResult.getCipherText());<NEW_LINE>System.out.printf("Returned plaintext size is %d bytes \n", decryptResult.getPlainText().length);<NEW_LINE>} | getAlgorithm().toString()); |
977,883 | private void sendOffsetCommitRequest(ConsumerNetworkClient consumerNetworkClient, AdminClient adminClient, String consumerGroup) throws ExecutionException, InterruptedException, RuntimeException {<NEW_LINE>LOGGER.trace("Consumer groups available: {}", adminClient.listConsumerGroups().all().get());<NEW_LINE>Node groupCoordinator = adminClient.describeConsumerGroups(Collections.singleton(consumerGroup)).all().get().get(consumerGroup).coordinator();<NEW_LINE>LOGGER.trace("Consumer group {} coordinator {}, consumer group {}", consumerGroup, groupCoordinator, consumerGroup);<NEW_LINE>consumerNetworkClient.tryConnect(groupCoordinator);<NEW_LINE>consumerNetworkClient.maybeTriggerWakeup();<NEW_LINE>OffsetCommitRequestData offsetCommitRequestData = new OffsetCommitRequestData();<NEW_LINE>AbstractRequest.Builder<?> offsetCommitRequestBuilder = new OffsetCommitRequest.Builder(offsetCommitRequestData);<NEW_LINE>LOGGER.debug("pending request count: {}", consumerNetworkClient.pendingRequestCount());<NEW_LINE>RequestFuture<ClientResponse> future = consumerNetworkClient.send(groupCoordinator, offsetCommitRequestBuilder);<NEW_LINE>if (consumerNetworkClient.isUnavailable(groupCoordinator)) {<NEW_LINE>_offsetCommitServiceMetrics.recordUnavailable();<NEW_LINE>throw new RuntimeException("Unavailable consumerNetworkClient for " + groupCoordinator);<NEW_LINE>} else {<NEW_LINE>LOGGER.trace("The consumerNetworkClient is available for {}", groupCoordinator);<NEW_LINE>if (consumerNetworkClient.hasPendingRequests()) {<NEW_LINE>boolean consumerNetworkClientPollResult = consumerNetworkClient.poll(future, _time.timer(Duration.ofSeconds(5).toMillis()));<NEW_LINE>LOGGER.debug("result of poll {}", consumerNetworkClientPollResult);<NEW_LINE>if (future.failed() && !future.isRetriable()) {<NEW_LINE>_offsetCommitServiceMetrics.recordFailed();<NEW_LINE>throw future.exception();<NEW_LINE>}<NEW_LINE>if (future.succeeded() && future.isDone() && consumerNetworkClientPollResult) {<NEW_LINE><MASK><NEW_LINE>_offsetCommitServiceMetrics.recordSuccessful();<NEW_LINE>LOGGER.info("ClientResponseRequestFuture value {} for coordinator {} and consumer group {}", clientResponse, groupCoordinator, consumerGroup);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ClientResponse clientResponse = future.value(); |
793,515 | public void programmaticLoginWithDefaultPrincipalMapping() throws Exception {<NEW_LINE>HashMap map = new HashMap();<NEW_LINE>map.put(com.ibm.wsspi.security.auth.callback.Constants.MAPPING_ALIAS, "myAuthData");<NEW_LINE>CallbackHandler callbackHandler = new WSMappingCallbackHandler(map, null);<NEW_LINE>LoginContext loginContext = new LoginContext("DefaultPrincipalMapping", callbackHandler);<NEW_LINE>loginContext.login();<NEW_LINE><MASK><NEW_LINE>Set<PasswordCredential> creds = subject.getPrivateCredentials(PasswordCredential.class);<NEW_LINE>// Note this assumes there is one, so you would need to write code to protect against there not being one<NEW_LINE>PasswordCredential cred = creds.iterator().next();<NEW_LINE>assertEquals("The user name must be set in the password credential.", "testUser", cred.getUserName());<NEW_LINE>assertEquals("The password must be set in the password credential.", "testPassword", String.valueOf(cred.getPassword()));<NEW_LINE>} | Subject subject = loginContext.getSubject(); |
651,885 | void init() {<NEW_LINE>JythonSupport helper = JythonSupport.get();<NEW_LINE>helper.log(lvl, "SikulixForJython: init: starting");<NEW_LINE>String sikuliStuff = "sikuli/Sikuli";<NEW_LINE>File fSikuliStuff = helper.existsSysPathModule(sikuliStuff);<NEW_LINE>String libSikuli = "/Lib/" + sikuliStuff + ".py";<NEW_LINE>String fpSikuliStuff;<NEW_LINE>if (null == fSikuliStuff) {<NEW_LINE>URL uSikuliStuff = RunTime.resourceLocation(libSikuli);<NEW_LINE>if (uSikuliStuff == null) {<NEW_LINE>throw new SikuliXception(String.format("fatal: " + "Jython: " + "no suitable sikulix...jar on classpath"));<NEW_LINE>}<NEW_LINE>fpSikuliStuff = Commons.getLibFolder().getAbsolutePath();<NEW_LINE>if (!helper.hasSysPath(fpSikuliStuff)) {<NEW_LINE>helper.log(lvl, "sikuli/*.py not found on current Jython::sys.path");<NEW_LINE>helper.addSysPath(fpSikuliStuff);<NEW_LINE>if (!helper.hasSysPath(fpSikuliStuff)) {<NEW_LINE>// helper.terminate(999, "not possible to add to Jython::sys.path: %s", fpSikuliStuff);<NEW_LINE>throw new SikuliXception(String.format("fatal: " + "Jython: " + "not possible to add to Jython::sys.path: %s", fpSikuliStuff));<NEW_LINE>}<NEW_LINE>helper.log(lvl, "added as Jython::sys.path[0]:\n%s", fpSikuliStuff);<NEW_LINE>} else {<NEW_LINE>helper.log(lvl, "sikuli/*.py is on Jython::sys.path at:\n%s", fpSikuliStuff);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>helper.addSitePackages();<NEW_LINE>// TODO default ImagePath???<NEW_LINE><MASK><NEW_LINE>} | helper.log(lvl, "SikulixForJython: init: success"); |
650,465 | public boolean onHoverEvent(MotionEvent event) {<NEW_LINE>if (DEBUG) {<NEW_LINE>int action = event.getAction();<NEW_LINE>switch(action) {<NEW_LINE>case MotionEvent.ACTION_HOVER_ENTER:<NEW_LINE>Log.e(TAG, "ACTION_HOVER_ENTER");<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_HOVER_MOVE:<NEW_LINE>Log.e(TAG, "ACTION_HOVER_MOVE");<NEW_LINE>break;<NEW_LINE>case MotionEvent.ACTION_HOVER_EXIT:<NEW_LINE>Log.e(TAG, "ACTION_HOVER_EXIT");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>Log.e(TAG, "Unknown hover event action. " + event);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Mouse also generates hover events<NEW_LINE>// Send accessibility events if accessibility and exploration are on.<NEW_LINE>if (!mTouchExplorationEnabled) {<NEW_LINE>return super.onHoverEvent(event);<NEW_LINE>}<NEW_LINE>if (event.getAction() != MotionEvent.ACTION_HOVER_EXIT) {<NEW_LINE>setSelectionFromPosition((int) event.getX(), (int) <MASK><NEW_LINE>invalidate();<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | event.getY(), true); |
906,496 | void processAttributes() {<NEW_LINE>String id = pop("id");<NEW_LINE>if (StringUtils.isNotBlank(id)) {<NEW_LINE>id = "#" + id;<NEW_LINE>}<NEW_LINE>String roles = String.join(".", pop("role").split(" "));<NEW_LINE>if (StringUtils.isNotBlank(roles)) {<NEW_LINE>roles = "." + roles;<NEW_LINE>}<NEW_LINE>StringBuilder options = new StringBuilder();<NEW_LINE>List<String> namedAttributes = new ArrayList<>();<NEW_LINE>attributes.forEach((k, v) -> {<NEW_LINE>if (k.equals(TITLE)) {<NEW_LINE>logger.debug("Skipping attribute: " + TITLE);<NEW_LINE>} else if (k.endsWith(OPTION_SUFFIX)) {<NEW_LINE>options.append('%').append(k.replace(OPTION_SUFFIX, ""));<NEW_LINE>} else if (null != v) {<NEW_LINE>if (v.toString().contains(" ") || v.toString().contains(",")) {<NEW_LINE>namedAttributes.add(k + "=\"" + v + "\"");<NEW_LINE>} else {<NEW_LINE>namedAttributes.add(k + "=" + v);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>});<NEW_LINE>String nonNamedAttributes = id + roles + options.toString();<NEW_LINE>if (StringUtils.isNotBlank(nonNamedAttributes)) {<NEW_LINE>attrs.add(nonNamedAttributes);<NEW_LINE>}<NEW_LINE>attrs.addAll(namedAttributes);<NEW_LINE>} | logger.warn("Don't know how to handle key: " + k); |
1,322,835 | private DalGroupDB parseDotNetDBConnString(String connStr) {<NEW_LINE>DalGroupDB db = new DalGroupDB();<NEW_LINE>try {<NEW_LINE>String dbhost = null;<NEW_LINE>Matcher matcher = dbnamePattern.matcher(connStr);<NEW_LINE>if (matcher.find()) {<NEW_LINE>db.setDb_catalog(matcher.group(2));<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (matcher.find()) {<NEW_LINE>String[] dburls = matcher.group(2).split(",");<NEW_LINE>dbhost = dburls[0];<NEW_LINE>if (dburls.length == 2) {<NEW_LINE>db.setDb_address(dbhost);<NEW_LINE>db.setDb_port(dburls[1]);<NEW_LINE>db.setDb_providerName(DatabaseType.SQLServer.getValue());<NEW_LINE>} else {<NEW_LINE>matcher = dbportPattern.matcher(connStr);<NEW_LINE>if (matcher.find()) {<NEW_LINE>db.setDb_address(dbhost);<NEW_LINE>db.setDb_port(matcher.group(2));<NEW_LINE>} else {<NEW_LINE>db.setDb_address(dbhost);<NEW_LINE>db.setDb_port("3306");<NEW_LINE>}<NEW_LINE>db.setDb_providerName(DatabaseType.MySQL.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>matcher = dbuserPattern.matcher(connStr);<NEW_LINE>if (matcher.find()) {<NEW_LINE>db.setDb_user(matcher.group(2));<NEW_LINE>}<NEW_LINE>matcher = dbpasswdPattern.matcher(connStr);<NEW_LINE>if (matcher.find()) {<NEW_LINE>db.setDb_password(matcher.group(2));<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>return db;<NEW_LINE>} | matcher = dburlPattern.matcher(connStr); |
426,412 | public void testInvokeAsynchronousMethodExposedOnNoInterfaceView() throws Exception {<NEW_LINE>long currentThreadId = 0;<NEW_LINE>// Get a no-interface style BeanReference to NoInterfaceBean3<NEW_LINE>NoInterfaceBean3 bean3 = lookupNoInterfaceBean3FromEJBLocalNamespace();<NEW_LINE>// Invoke an asynchronous method<NEW_LINE>// The method has been tagged with @Asynchronous annotation, so the container should invoke it asynchronously.<NEW_LINE>bean3.test_fireAndForget();<NEW_LINE>// wait for async work to complete<NEW_LINE>NoInterfaceBean3.svBeanLatch.await(NoInterfaceBean3.MAX_ASYNC_WAIT, TimeUnit.MILLISECONDS);<NEW_LINE>svLogger.info("Asynchronous method work completed: " + NoInterfaceBean3.asyncWorkDone);<NEW_LINE>// update results for asynchronous work done<NEW_LINE><MASK><NEW_LINE>// get current thread Id for comparison to bean method thread id<NEW_LINE>currentThreadId = Thread.currentThread().getId();<NEW_LINE>svLogger.info("Test threadId = " + currentThreadId);<NEW_LINE>svLogger.info("Bean threadId = " + NoInterfaceBean3.beanThreadId);<NEW_LINE>// update results with current and bean method thread id comparison<NEW_LINE>assertFalse("Async NoInterface Bean method completed on separate thread", (NoInterfaceBean3.beanThreadId == currentThreadId));<NEW_LINE>// Reset the NoInterfaceParent static variables<NEW_LINE>NoInterfaceBean3.asyncWorkDone = false;<NEW_LINE>NoInterfaceBean3.beanThreadId = 0;<NEW_LINE>} | assertTrue("Async NoInterface Bean method completed", NoInterfaceBean3.asyncWorkDone); |
1,406,211 | final ListEndpointConfigsResult executeListEndpointConfigs(ListEndpointConfigsRequest listEndpointConfigsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listEndpointConfigsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListEndpointConfigsRequest> request = null;<NEW_LINE>Response<ListEndpointConfigsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListEndpointConfigsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listEndpointConfigsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "SageMaker");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListEndpointConfigs");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListEndpointConfigsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListEndpointConfigsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
51,868 | public Pipeline createPipeline(final BuildCause buildCause, final PipelineConfig pipelineConfig, final SchedulingContext context, final String md5, final Clock clock) {<NEW_LINE>return (Pipeline) transactionTemplate.execute((TransactionCallback) status -> {<NEW_LINE>Pipeline pipeline = null;<NEW_LINE>if (shouldCancel(buildCause, pipelineConfig.name())) {<NEW_LINE>LOGGER.debug("[Pipeline Schedule] Cancelling scheduling as build cause {} is the same as the most recent schedule", buildCause);<NEW_LINE>cancelSchedule(pipelineConfig.name());<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>Pipeline newPipeline = instanceFactory.createPipelineInstance(pipelineConfig, buildCause, context, md5, clock);<NEW_LINE>pipeline = pipelineService.save(newPipeline);<NEW_LINE>finishSchedule(pipelineConfig.name(), buildCause, pipeline.getBuildCause());<NEW_LINE>LOGGER.debug("[Pipeline Schedule] Successfully scheduled pipeline {}, buildCause:{}, configOrigin: {}", pipelineConfig.name(), buildCause, pipelineConfig.getOrigin());<NEW_LINE>} catch (BuildCauseOutOfDateException e) {<NEW_LINE>cancelSchedule(pipelineConfig.name());<NEW_LINE>LOGGER.info("[Pipeline Schedule] Build cause {} is out of date. Scheduling is cancelled. Go will reschedule this pipeline. configOrigin: {}", <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return pipeline;<NEW_LINE>});<NEW_LINE>} | buildCause, pipelineConfig.getOrigin()); |
1,358,686 | public void addSendMetric(DispatchProfile currentRecord, String bid) {<NEW_LINE>Map<String, String> dimensions = new HashMap<>();<NEW_LINE>dimensions.put(SortMetricItem.KEY_CLUSTER_ID, this.getClusterId());<NEW_LINE>dimensions.put(SortMetricItem.KEY_TASK_NAME, this.getTaskName());<NEW_LINE>// metric<NEW_LINE>fillInlongId(currentRecord, dimensions);<NEW_LINE>dimensions.put(SortMetricItem.<MASK><NEW_LINE>dimensions.put(SortMetricItem.KEY_SINK_DATA_ID, bid);<NEW_LINE>long msgTime = currentRecord.getDispatchTime();<NEW_LINE>long auditFormatTime = msgTime - msgTime % CommonPropertiesHolder.getAuditFormatInterval();<NEW_LINE>dimensions.put(SortMetricItem.KEY_MESSAGE_TIME, String.valueOf(auditFormatTime));<NEW_LINE>SortMetricItem metricItem = this.getMetricItemSet().findMetricItem(dimensions);<NEW_LINE>long count = currentRecord.getCount();<NEW_LINE>long size = currentRecord.getSize();<NEW_LINE>metricItem.sendCount.addAndGet(count);<NEW_LINE>metricItem.sendSize.addAndGet(size);<NEW_LINE>// LOG.info("addSendMetric,bid:{},count:{},metric:{}",<NEW_LINE>// bid, currentRecord.getCount(), JSON.toJSONString(metricItemSet.getItemMap()));<NEW_LINE>} | KEY_SINK_ID, this.getSinkName()); |
999,398 | private void visitBinOperator(final Token<?> token, final OperatorType opType, final String methodName) {<NEW_LINE>visitLineNumber(token);<NEW_LINE>if (!OperationRuntime.hasRuntimeContext(this.compileEnv, opType)) {<NEW_LINE>// swap arguments for regular-expression match operator.<NEW_LINE>if (opType == OperatorType.MATCH) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>loadEnv();<NEW_LINE>this.mv.visitMethodInsn(INVOKEVIRTUAL, OBJECT_OWNER, methodName, "(Lcom/googlecode/aviator/runtime/type/AviatorObject;Ljava/util/Map;)Lcom/googlecode/aviator/runtime/type/AviatorObject;");<NEW_LINE>} else {<NEW_LINE>loadEnv();<NEW_LINE>loadOpType(opType);<NEW_LINE>this.mv.visitMethodInsn(INVOKESTATIC, "com/googlecode/aviator/runtime/op/OperationRuntime", "eval", "(Lcom/googlecode/aviator/runtime/type/AviatorObject;Lcom/googlecode/aviator/runtime/type/AviatorObject;Ljava/util/Map;Lcom/googlecode/aviator/lexer/token/OperatorType;)Lcom/googlecode/aviator/runtime/type/AviatorObject;");<NEW_LINE>this.popOperand();<NEW_LINE>}<NEW_LINE>this.popOperand();<NEW_LINE>this.popOperand();<NEW_LINE>} | this.mv.visitInsn(SWAP); |
111,351 | public void start() {<NEW_LINE>if (current != null) {<NEW_LINE>current.show();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Form hi = new Form("Hi World", BoxLayout.y());<NEW_LINE>hi.add(new Label("Hi World"));<NEW_LINE>Button btn = new Button("Show Dialog");<NEW_LINE>btn.addActionListener(e -> {<NEW_LINE>Dialog dlg = new Dialog("Hello Dialog", new BorderLayout());<NEW_LINE>dlg.add(BorderLayout.CENTER, BoxLayout.encloseY(new Label("Here is some text"), new Label("And Some More"), new Button("Cancel")));<NEW_LINE>int padding = 0;<NEW_LINE>if (!CN.isTablet()) {<NEW_LINE>// If it is a tablet, we just let the dialog keep its preferred size.<NEW_LINE>// If it is a phone then we want the dialog to stretch to the edge of the screen.<NEW_LINE>dlg.getContentPane().setPreferredW(hi.getWidth() - dlg.getStyle().getHorizontalPadding() - dlg.getContentPane().getStyle().getHorizontalMargins());<NEW_LINE>}<NEW_LINE>int w = dlg.getDialogPreferredSize().getWidth();<NEW_LINE>int h = dlg.getDialogPreferredSize().getHeight();<NEW_LINE>// Position the top so that it is just underneath the form's title area.<NEW_LINE>int top = hi.getTitleArea().getAbsoluteY() + hi.getTitleArea().getHeight() + hi.getTitleArea().getStyle().getMarginBottom() + padding;<NEW_LINE>int left = (hi.getWidth() - w) / 2;<NEW_LINE>int right = left;<NEW_LINE>int bottom = hi<MASK><NEW_LINE>System.out.println("bottom=" + bottom);<NEW_LINE>bottom = Math.max(0, bottom);<NEW_LINE>top = Math.max(0, top);<NEW_LINE>dlg.show(top, bottom, left, right);<NEW_LINE>});<NEW_LINE>hi.add(btn);<NEW_LINE>hi.show();<NEW_LINE>} | .getHeight() - top - h; |
1,155,717 | final ListBotLocalesResult executeListBotLocales(ListBotLocalesRequest listBotLocalesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listBotLocalesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<ListBotLocalesRequest> request = null;<NEW_LINE>Response<ListBotLocalesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ListBotLocalesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listBotLocalesRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Lex Models V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListBotLocales");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListBotLocalesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListBotLocalesResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
736,373 | // Handle show encryptkeys<NEW_LINE>private void handleShowEncryptKeys() throws AnalysisException {<NEW_LINE>ShowEncryptKeysStmt showStmt = (ShowEncryptKeysStmt) stmt;<NEW_LINE>Util.prohibitExternalCatalog(ctx.getDefaultCatalog(), stmt.getClass().getSimpleName());<NEW_LINE>DatabaseIf db = ctx.getCurrentCatalog().<MASK><NEW_LINE>List<List<String>> resultRowSet = Lists.newArrayList();<NEW_LINE>if (db instanceof Database) {<NEW_LINE>List<EncryptKey> encryptKeys = ((Database) db).getEncryptKeys();<NEW_LINE>List<List<Comparable>> rowSet = Lists.newArrayList();<NEW_LINE>for (EncryptKey encryptKey : encryptKeys) {<NEW_LINE>List<Comparable> row = encryptKey.getInfo();<NEW_LINE>// like predicate<NEW_LINE>if (showStmt.getWild() == null || showStmt.like(encryptKey.getEncryptKeyName().getKeyName())) {<NEW_LINE>rowSet.add(row);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// sort function rows by first column asc<NEW_LINE>ListComparator<List<Comparable>> comparator = null;<NEW_LINE>OrderByPair orderByPair = new OrderByPair(0, false);<NEW_LINE>comparator = new ListComparator<>(orderByPair);<NEW_LINE>Collections.sort(rowSet, comparator);<NEW_LINE>Set<String> encryptKeyNameSet = new HashSet<>();<NEW_LINE>for (List<Comparable> row : rowSet) {<NEW_LINE>List<String> resultRow = Lists.newArrayList();<NEW_LINE>for (Comparable column : row) {<NEW_LINE>resultRow.add(column.toString());<NEW_LINE>}<NEW_LINE>resultRowSet.add(resultRow);<NEW_LINE>encryptKeyNameSet.add(resultRow.get(0));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>ShowResultSetMetaData showMetaData = showStmt.getMetaData();<NEW_LINE>resultSet = new ShowResultSet(showMetaData, resultRowSet);<NEW_LINE>} | getDbOrAnalysisException(showStmt.getDbName()); |
1,111,996 | public void onClick(View v) {<NEW_LINE>String accName = ((TextView) t.findViewById(R.id.name)).getText().toString();<NEW_LINE>LogUtil.v("Found name is " + accName);<NEW_LINE>if (!accName.equalsIgnoreCase(Authentication.name)) {<NEW_LINE><MASK><NEW_LINE>if (!accounts.get(accName).isEmpty()) {<NEW_LINE>LogUtil.v("Using token " + accounts.get(accName));<NEW_LINE>Authentication.authentication.edit().putString("lasttoken", accounts.get(accName)).remove("backedCreds").apply();<NEW_LINE>} else {<NEW_LINE>ArrayList<String> tokens = new ArrayList<>(Authentication.authentication.getStringSet("tokens", new HashSet<String>()));<NEW_LINE>Authentication.authentication.edit().putString("lasttoken", tokens.get(keys.indexOf(accName))).remove("backedCreds").apply();<NEW_LINE>}<NEW_LINE>Authentication.name = accName;<NEW_LINE>UserSubscriptions.switchAccounts();<NEW_LINE>Reddit.forceRestart(MainActivity.this, true);<NEW_LINE>}<NEW_LINE>} | LogUtil.v("Switching to " + accName); |
541,952 | final GetEbsDefaultKmsKeyIdResult executeGetEbsDefaultKmsKeyId(GetEbsDefaultKmsKeyIdRequest getEbsDefaultKmsKeyIdRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getEbsDefaultKmsKeyIdRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetEbsDefaultKmsKeyIdRequest> request = null;<NEW_LINE>Response<GetEbsDefaultKmsKeyIdResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetEbsDefaultKmsKeyIdRequestMarshaller().marshall(super.beforeMarshalling(getEbsDefaultKmsKeyIdRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetEbsDefaultKmsKeyId");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetEbsDefaultKmsKeyIdResult> responseHandler = new StaxResponseHandler<GetEbsDefaultKmsKeyIdResult>(new GetEbsDefaultKmsKeyIdResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.