idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,196,729 | public static boolean deleteRealm(String canonicalPath, File realmFolder, String realmFileName) {<NEW_LINE>final String management = ".management";<NEW_LINE>File managementFolder = new File(realmFolder, realmFileName + management);<NEW_LINE>File realmFile = new File(canonicalPath);<NEW_LINE>// This file is not always stored here, but if it is we want to delete it.<NEW_LINE>// If it isn't found it is placed in a temporary folder, so no reason to delete it.<NEW_LINE>File fifoFile = new File(canonicalPath + ".note");<NEW_LINE>// Deletes files in management directory and the directory.<NEW_LINE>// There is no subfolders in the management directory.<NEW_LINE>File[] files = managementFolder.listFiles();<NEW_LINE>if (files != null) {<NEW_LINE>for (File file : files) {<NEW_LINE>boolean deleteResult = file.delete();<NEW_LINE>if (!deleteResult) {<NEW_LINE>RealmLog.warn(String.format(Locale.ENGLISH, "Realm temporary file at %s cannot be deleted", file.getAbsolutePath()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (managementFolder.exists() && !managementFolder.delete()) {<NEW_LINE>RealmLog.warn(String.format(Locale.ENGLISH, "Realm temporary folder at %s cannot be deleted", managementFolder.getAbsolutePath()));<NEW_LINE>}<NEW_LINE>boolean realmDeleted;<NEW_LINE>if (realmFile.exists()) {<NEW_LINE>realmDeleted = realmFile.delete();<NEW_LINE>if (!realmDeleted) {<NEW_LINE>RealmLog.warn(String.format(Locale.ENGLISH, "Realm file at %s cannot be deleted"<MASK><NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>realmDeleted = true;<NEW_LINE>}<NEW_LINE>if (fifoFile.exists() && !fifoFile.delete()) {<NEW_LINE>RealmLog.warn(String.format(Locale.ENGLISH, ".note file at %s cannot be deleted", fifoFile.getAbsolutePath()));<NEW_LINE>}<NEW_LINE>return realmDeleted;<NEW_LINE>} | , realmFile.getAbsolutePath())); |
521,664 | private void drawText(Canvas canvas, CharSequence text, int start, int end, int textWidth) {<NEW_LINE>if (end <= start || end > text.length() || start >= text.length()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (mIsInDrawSpan && mCurrentDrawSpan != null) {<NEW_LINE>@ColorInt<NEW_LINE>int color = mCurrentDrawSpan.isPressed() ? mCurrentDrawSpan.getPressedBackgroundColor() : mCurrentDrawSpan.getNormalBackgroundColor();<NEW_LINE>if (color != Color.TRANSPARENT) {<NEW_LINE>mDecorationPaint.setColor(color);<NEW_LINE>mDecorationPaint.setStyle(Paint.Style.FILL);<NEW_LINE>canvas.drawRect(mCurrentDrawUsedWidth, mCurrentDrawBaseLine - mFirstBaseLine, mCurrentDrawUsedWidth + textWidth, mCurrentDrawBaseLine - mFirstBaseLine + mFontHeight, mDecorationPaint);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>canvas.drawText(text, start, end, mCurrentDrawUsedWidth, mCurrentDrawBaseLine, mPaint);<NEW_LINE>if (mIsInDrawSpan && mCurrentDrawSpan != null && mCurrentDrawSpan.isNeedUnderline() && mLinkUnderLineHeight > 0) {<NEW_LINE>ColorStateList underLineColors = mLinkUnderLineColor == null ? mTextColor : mLinkUnderLineColor;<NEW_LINE>if (underLineColors != null) {<NEW_LINE>int underLineColor = underLineColors.getDefaultColor();<NEW_LINE>if (mCurrentDrawSpan.isPressed()) {<NEW_LINE>underLineColor = underLineColors.getColorForState(mPressedState, underLineColor);<NEW_LINE>}<NEW_LINE>mDecorationPaint.setColor(underLineColor);<NEW_LINE>mDecorationPaint.setStyle(Paint.Style.STROKE);<NEW_LINE>mDecorationPaint.setStrokeWidth(mLinkUnderLineHeight);<NEW_LINE>int bottom = mCurrentDrawBaseLine - mFirstBaseLine + mFontHeight;<NEW_LINE>canvas.drawLine(mCurrentDrawUsedWidth, bottom, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mCurrentDrawUsedWidth + textWidth, bottom, mDecorationPaint); |
1,013,765 | public ConfigManager putObject(@NonNull String key, @NonNull Object v) {<NEW_LINE>if (v == null || key == null) {<NEW_LINE>throw new NullPointerException("null key/value not allowed");<NEW_LINE>}<NEW_LINE>if (v instanceof Float || v instanceof Double) {<NEW_LINE>putFloat(key, ((Number) v).floatValue());<NEW_LINE>} else if (v instanceof Long) {<NEW_LINE>putLong(key, (long) v);<NEW_LINE>} else if (v instanceof Integer) {<NEW_LINE>putInt(key, (int) v);<NEW_LINE>} else if (v instanceof Boolean) {<NEW_LINE>putBoolean(key, (boolean) v);<NEW_LINE>} else if (v instanceof String) {<NEW_LINE>putString(key, (String) v);<NEW_LINE>} else if (v instanceof Set) {<NEW_LINE>putStringSet(key, (Set<String>) v);<NEW_LINE>} else if (v instanceof byte[]) {<NEW_LINE>putBytes(key<MASK><NEW_LINE>} else if (v instanceof String[]) {<NEW_LINE>HashSet<String> set = new HashSet<>(((String[]) v).length);<NEW_LINE>Collections.addAll(set, (String[]) v);<NEW_LINE>putStringSet(key, set);<NEW_LINE>} else if (v instanceof Serializable) {<NEW_LINE>try {<NEW_LINE>ByteArrayOutputStream outputStream = new ByteArrayOutputStream();<NEW_LINE>ObjectOutputStream objectOutputStream = new ObjectOutputStream(outputStream);<NEW_LINE>objectOutputStream.writeObject(v);<NEW_LINE>mmkv.putBytes(key, outputStream.toByteArray());<NEW_LINE>mmkv.putInt(key.concat(TYPE_SUFFIX), TYPE_SERIALIZABLE);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>mmkv.putString(key, new Gson().toJson(v));<NEW_LINE>mmkv.putInt(key.concat(TYPE_SUFFIX), TYPE_JSON);<NEW_LINE>mmkv.putString(key.concat(CLASS_SUFFIX), v.getClass().getName());<NEW_LINE>}<NEW_LINE>return this;<NEW_LINE>} | , (byte[]) v); |
219,409 | public static void main(String[] args) throws ParseException {<NEW_LINE>String date = LocalDate.now().toString();<NEW_LINE><MASK><NEW_LINE>String incrementedDateJava8 = DateIncrementer.addOneDay(date);<NEW_LINE>log.info("Date incremented by one day using (Java 8): " + incrementedDateJava8);<NEW_LINE>String incrementedDateJodaTime = DateIncrementer.addOneDayJodaTime(date);<NEW_LINE>log.info("Date incremented by one day using (Joda-Time): " + incrementedDateJodaTime);<NEW_LINE>String incrementedDateCalendar = addOneDayCalendar(date);<NEW_LINE>log.info("Date incremented by one day using (java.util.Calendar): " + incrementedDateCalendar);<NEW_LINE>String incrementedDateApacheCommons = addOneDayApacheCommons(date);<NEW_LINE>log.info("Date incremented by one day using (Apache Commons DateUtils): " + incrementedDateApacheCommons);<NEW_LINE>} | log.info("Current date = " + date); |
845,902 | protected List<? extends JComponent> createPreviewElements() {<NEW_LINE>final AsyncTreeDataProvider<SampleNode> leftDataProvider = SampleData.createDelayingAsyncDataProvider();<NEW_LINE>final WebAsyncTree left = new WebAsyncTree(getStyleId(), leftDataProvider, new SampleTreeCellEditor());<NEW_LINE>left.setVisibleRowCount(8);<NEW_LINE>left.setDragEnabled(true);<NEW_LINE>left.setDropMode(DropMode.ON_OR_INSERT);<NEW_LINE>left.setTransferHandler(createTransferHandler());<NEW_LINE>final WebScrollPane leftScroll = new WebScrollPane(left).setPreferredWidth(200);<NEW_LINE>final AsyncTreeDataProvider<SampleNode> rightDataProvider = SampleData.createDelayingAsyncDataProvider();<NEW_LINE>final WebAsyncTree right = new WebAsyncTree(getStyleId(), rightDataProvider, new SampleTreeCellEditor());<NEW_LINE>right.setVisibleRowCount(8);<NEW_LINE>right.setDragEnabled(true);<NEW_LINE>right.setDropMode(DropMode.ON_OR_INSERT);<NEW_LINE><MASK><NEW_LINE>final WebScrollPane rightScroll = new WebScrollPane(right).setPreferredWidth(200);<NEW_LINE>return CollectionUtils.asList(leftScroll, rightScroll);<NEW_LINE>} | right.setTransferHandler(createTransferHandler()); |
755,598 | public void rectInCamera() {<NEW_LINE>rectToWorld.concat(worldToCamera, rectToCamera);<NEW_LINE>// surface normal in world frame<NEW_LINE>normal.setTo(0, 0, 1);<NEW_LINE>GeometryMath_F64.mult(rectToCamera.R, normal, normal);<NEW_LINE>visible = normal.z < 0;<NEW_LINE>if (!visible) {<NEW_LINE>pixelRect.x0 = pixelRect.y0 = pixelRect.x1 = pixelRect.y1 = 0;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>double imageRatio = texture.height / (double) texture.width;<NEW_LINE>height3D = width3D * imageRatio;<NEW_LINE>rect2D.vertexes.resize(4);<NEW_LINE>rect2D.set(0, -width3D / 2, -height3D / 2);<NEW_LINE>rect2D.set(1, -width3D / 2, height3D / 2);<NEW_LINE>rect2D.set(2, width3D / 2, height3D / 2);<NEW_LINE>rect2D.set(3, width3D / 2, -height3D / 2);<NEW_LINE>UtilShape3D_F64.polygon2Dto3D(rect2D, rectToCamera, rect3D);<NEW_LINE>pixelRect.setTo(Integer.MAX_VALUE, Integer.MAX_VALUE, Integer.MIN_VALUE, Integer.MIN_VALUE);<NEW_LINE>for (int i = 0, j = 3; i < 4; j = i, i++) {<NEW_LINE>Point3D_F64 a = rect3D.get(j);<NEW_LINE>Point3D_F64 b = rect3D.get(i);<NEW_LINE>for (int k = 0; k < 50; k++) {<NEW_LINE>double w = k / 50.0;<NEW_LINE>p3.x = a.x * (1 - <MASK><NEW_LINE>p3.y = a.y * (1 - w) + b.y * w;<NEW_LINE>p3.z = a.z * (1 - w) + b.z * w;<NEW_LINE>p3.divideIP(p3.norm());<NEW_LINE>sphereToPixel.compute(p3.x, p3.y, p3.z, pixel);<NEW_LINE>int x = (int) Math.round(pixel.x);<NEW_LINE>int y = (int) Math.round(pixel.y);<NEW_LINE>pixelRect.x0 = Math.min(pixelRect.x0, x);<NEW_LINE>pixelRect.y0 = Math.min(pixelRect.y0, y);<NEW_LINE>pixelRect.x1 = Math.max(pixelRect.x1, x + 1);<NEW_LINE>pixelRect.y1 = Math.max(pixelRect.y1, y + 1);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// it's an approximation so add in some fudge room<NEW_LINE>pixelRect.x0 -= 2;<NEW_LINE>pixelRect.x1 += 2;<NEW_LINE>pixelRect.y0 -= 2;<NEW_LINE>pixelRect.y1 += 2;<NEW_LINE>// System.out.println("PixelRect "+pixelRect);<NEW_LINE>} | w) + b.x * w; |
542,333 | final GetIntegrationResult executeGetIntegration(GetIntegrationRequest getIntegrationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getIntegrationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetIntegrationRequest> request = null;<NEW_LINE>Response<GetIntegrationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetIntegrationRequestProtocolMarshaller(protocolFactory).marshall<MASK><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, "ApiGatewayV2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetIntegration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetIntegrationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetIntegrationResultJsonUnmarshaller());<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>} | (super.beforeMarshalling(getIntegrationRequest)); |
489,774 | public void marshall(DescribeEvaluationsRequest describeEvaluationsRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (describeEvaluationsRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getFilterVariable(), FILTERVARIABLE_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getEQ(), EQ_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getGT(), GT_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getLT(), LT_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getGE(), GE_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getNE(), NE_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getPrefix(), PREFIX_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getSortOrder(), SORTORDER_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getNextToken(), NEXTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(describeEvaluationsRequest.getLimit(), LIMIT_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | describeEvaluationsRequest.getLE(), LE_BINDING); |
1,691,224 | public void close(String namespace) {<NEW_LINE>byte[] idBytes;<NEW_LINE>synchronized (namespaceId) {<NEW_LINE>idBytes = getNamespaceId(namespace);<NEW_LINE>if (idBytes == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>namespaceId.remove(namespace);<NEW_LINE>}<NEW_LINE>synchronized (clearLock) {<NEW_LINE>Iterator<ByteBuffer> iter = baseMap.keySet().iterator();<NEW_LINE>List<ByteBuffer> toRemove = new ArrayList<>();<NEW_LINE>while (iter.hasNext()) {<NEW_LINE><MASK><NEW_LINE>if (next.get(0) == idBytes[0] && next.get(1) == idBytes[1] && next.get(2) == idBytes[2] && next.get(3) == idBytes[3]) {<NEW_LINE>toRemove.add(next);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (ByteBuffer key : toRemove) {<NEW_LINE>baseMap.remove(key);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ByteBuffer next = iter.next(); |
1,598,739 | /* package */<NEW_LINE>Optional<IPair<StockQtyAndUOMQty, Money>> sumupQtyInvoicedAndNetAmtInvoiced(final I_C_Invoice_Candidate ic) {<NEW_LINE>if (ic.getC_Currency_ID() <= 0 || ic.getC_UOM_ID() <= 0) {<NEW_LINE>// if those two columns are not yet set, then for sure nothing is invoiced yet either<NEW_LINE>return Optional.empty();<NEW_LINE>}<NEW_LINE>final List<I_C_Invoice_Line_Alloc> ilas = invoiceCandDAO.retrieveIlaForIc(InvoiceCandidateIds.ofRecord(ic));<NEW_LINE>final ProductId productId = ProductId.ofRepoId(ic.getM_Product_ID());<NEW_LINE>final UomId icUomId = UomId.<MASK><NEW_LINE>StockQtyAndUOMQty qtyInvoicedSum = StockQtyAndUOMQtys.createZero(productId, icUomId);<NEW_LINE>final CurrencyId icCurrencyId = CurrencyId.ofRepoId(ic.getC_Currency_ID());<NEW_LINE>Money netAmtInvoiced = Money.zero(icCurrencyId);<NEW_LINE>for (final I_C_Invoice_Line_Alloc ila : ilas) {<NEW_LINE>// we don't need to check the invoice's DocStatus. If the ila is there, we count it.<NEW_LINE>// @formatter:off<NEW_LINE>// final I_C_InvoiceLine invoiceLine = InterfaceWrapperHelper.create(ila.getC_InvoiceLine(), I_C_InvoiceLine.class);<NEW_LINE>// final IDocActionBL docActionBL = Services.get(IDocActionBL.class);<NEW_LINE>//<NEW_LINE>// if (docActionBL.isStatusOneOf(invoiceLine.getC_Invoice(),<NEW_LINE>// DocAction.STATUS_Completed,<NEW_LINE>// DocAction.STATUS_Closed,<NEW_LINE>// DocAction.STATUS_Reversed,<NEW_LINE>// DocAction.STATUS_InProgress)) // 06162 InProgress invoices shall also be processed<NEW_LINE>// {<NEW_LINE>// @formatter:on<NEW_LINE>final StockQtyAndUOMQty ilaQtysInvoiced = StockQtyAndUOMQtys.create(ila.getQtyInvoiced(), productId, ila.getQtyInvoicedInUOM(), UomId.ofRepoIdOrNull(ila.getC_UOM_ID()));<NEW_LINE>qtyInvoicedSum = StockQtyAndUOMQtys.add(qtyInvoicedSum, ilaQtysInvoiced);<NEW_LINE>//<NEW_LINE>// 07202: We update the net amount invoice according to price UOM.<NEW_LINE>// final BigDecimal priceActual = ic.getPriceActual();<NEW_LINE>final ProductPrice priceActual = ProductPrice.builder().money(Money.of(ic.getPriceActual(), icCurrencyId)).productId(productId).uomId(icUomId).build();<NEW_LINE>final Quantity qtyInvoicedInUOM = extractQtyInvoiced(ila);<NEW_LINE>final Money amountInvoiced = SpringContextHolder.instance.getBean(MoneyService.class).multiply(qtyInvoicedInUOM, priceActual);<NEW_LINE>if (amountInvoiced == null) {<NEW_LINE>netAmtInvoiced = null;<NEW_LINE>}<NEW_LINE>if (netAmtInvoiced != null) {<NEW_LINE>netAmtInvoiced = netAmtInvoiced.add(amountInvoiced);<NEW_LINE>}<NEW_LINE>// @formatter:off<NEW_LINE>// }<NEW_LINE>// @formatter:on<NEW_LINE>}<NEW_LINE>final IPair<StockQtyAndUOMQty, Money> qtyAndNetAmtInvoiced = ImmutablePair.of(qtyInvoicedSum, netAmtInvoiced);<NEW_LINE>return Optional.of(qtyAndNetAmtInvoiced);<NEW_LINE>} | ofRepoId(ic.getC_UOM_ID()); |
1,592,673 | private void loadTable(Connection conn) throws SQLException {<NEW_LINE>String insertDml = "INSERT INTO SQLXML_JDBC_SAMPLE (DOCUMENT, ID) VALUES (?, ?)";<NEW_LINE>try (PreparedStatement prepStmt = conn.prepareStatement(insertDml)) {<NEW_LINE>SQLXML xml = conn.createSQLXML();<NEW_LINE>xml.setString("<?xml version=\"1.0\"?>\n" + <MASK><NEW_LINE>prepStmt.setObject(1, xml, JDBCType.SQLXML);<NEW_LINE>prepStmt.setObject(2, 221, JDBCType.NUMERIC);<NEW_LINE>prepStmt.executeUpdate();<NEW_LINE>xml = conn.createSQLXML();<NEW_LINE>Writer w = xml.setCharacterStream();<NEW_LINE>w.write("<?xml version=\"1.0\"?>\n");<NEW_LINE>w.write(" <EMP>\n");<NEW_LINE>w.write(" <EMPNO>222</EMPNO>\n");<NEW_LINE>w.write(" <ENAME>Mary</ENAME>\n");<NEW_LINE>w.write(" </EMP>\n");<NEW_LINE>w.close();<NEW_LINE>prepStmt.setObject(1, xml, JDBCType.SQLXML);<NEW_LINE>prepStmt.setObject(2, 222, JDBCType.NUMERIC);<NEW_LINE>prepStmt.executeUpdate();<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new SQLException(ex);<NEW_LINE>}<NEW_LINE>} | " <EMP>\n" + " <EMPNO>221</EMPNO>\n" + " <ENAME>John</ENAME>\n" + " </EMP>"); |
238,802 | private AnchorPane createBisqDAOContent() {<NEW_LINE>AnchorPane anchorPane = new AnchorPane();<NEW_LINE>anchorPane.setMinWidth(373);<NEW_LINE>GridPane bisqDAOPane = new GridPane();<NEW_LINE>AnchorPane.setTopAnchor(bisqDAOPane, 0d);<NEW_LINE>bisqDAOPane.setVgap(5);<NEW_LINE>bisqDAOPane.setMaxWidth(373);<NEW_LINE>int rowIndex = 0;<NEW_LINE>TitledGroupBg theBisqDaoTitledGroup = addTitledGroupBg(bisqDAOPane, rowIndex, 3, Res.get("dao.news.bisqDAO.title"));<NEW_LINE>theBisqDaoTitledGroup.getStyleClass().addAll("last", "dao-news-titled-group");<NEW_LINE>Label daoTeaserContent = addMultilineLabel(bisqDAOPane, ++rowIndex, Res.get("dao.news.bisqDAO.description"));<NEW_LINE>daoTeaserContent.getStyleClass().add("dao-news-teaser");<NEW_LINE>Hyperlink hyperlink = addHyperlinkWithIcon(bisqDAOPane, ++rowIndex, Res.get("dao.news.bisqDAO.readMoreLink"), "https://bisq.network/docs/dao");<NEW_LINE>hyperlink.getStyleClass().add("dao-news-link");<NEW_LINE>anchorPane.<MASK><NEW_LINE>return anchorPane;<NEW_LINE>} | getChildren().add(bisqDAOPane); |
1,597,644 | public static void registerType(ModelBuilder modelBuilder) {<NEW_LINE>ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Collaboration.class, BPMN_ELEMENT_COLLABORATION).namespaceUri(BPMN20_NS).extendsType(RootElement.class).instanceProvider(new ModelTypeInstanceProvider<Collaboration>() {<NEW_LINE><NEW_LINE>public Collaboration newInstance(ModelTypeInstanceContext instanceContext) {<NEW_LINE>return new CollaborationImpl(instanceContext);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>nameAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_NAME).build();<NEW_LINE>isClosedAttribute = typeBuilder.booleanAttribute(BPMN_ATTRIBUTE_IS_CLOSED).defaultValue(false).build();<NEW_LINE>SequenceBuilder sequenceBuilder = typeBuilder.sequence();<NEW_LINE>participantCollection = sequenceBuilder.elementCollection(Participant.class).build();<NEW_LINE>messageFlowCollection = sequenceBuilder.elementCollection(MessageFlow.class).build();<NEW_LINE>artifactCollection = sequenceBuilder.elementCollection(Artifact.class).build();<NEW_LINE>conversationNodeCollection = sequenceBuilder.elementCollection(ConversationNode.class).build();<NEW_LINE>conversationAssociationCollection = sequenceBuilder.elementCollection(ConversationAssociation.class).build();<NEW_LINE>participantAssociationCollection = sequenceBuilder.elementCollection(ParticipantAssociation.class).build();<NEW_LINE>messageFlowAssociationCollection = sequenceBuilder.elementCollection(MessageFlowAssociation.class).build();<NEW_LINE>correlationKeyCollection = sequenceBuilder.elementCollection(CorrelationKey.class).build();<NEW_LINE>conversationLinkCollection = sequenceBuilder.elementCollection(<MASK><NEW_LINE>typeBuilder.build();<NEW_LINE>} | ConversationLink.class).build(); |
997,027 | protected void configure() {<NEW_LINE>if (retainedPersistenceType == PersistenceType.FILE) {<NEW_LINE>bind(RetainedMessageLocalPersistence.class).to(RetainedMessageXodusLocalPersistence.class).in(Singleton.class);<NEW_LINE>}<NEW_LINE>if (payloadPersistenceType == PersistenceType.FILE) {<NEW_LINE>bind(PublishPayloadLocalPersistence.class).to(PublishPayloadXodusLocalPersistence.class<MASK><NEW_LINE>}<NEW_LINE>if (retainedPersistenceType == PersistenceType.FILE_NATIVE || payloadPersistenceType == PersistenceType.FILE_NATIVE) {<NEW_LINE>install(new PersistenceMigrationRocksDBModule());<NEW_LINE>}<NEW_LINE>bind(ClientSessionLocalPersistence.class).toProvider(ClientSessionLocalProvider.class).in(Singleton.class);<NEW_LINE>bind(ClientSessionSubscriptionLocalPersistence.class).toProvider(ClientSessionSubscriptionLocalProvider.class).in(Singleton.class);<NEW_LINE>bind(ClientQueueLocalPersistence.class).to(ClientQueueXodusLocalPersistence.class).in(Singleton.class);<NEW_LINE>} | ).in(Singleton.class); |
1,382,136 | public void startVM(final Connection conn, final Host host, final VM vm, final String vmName) throws Exception {<NEW_LINE>Task task = null;<NEW_LINE>try {<NEW_LINE>task = vm.startOnAsync(<MASK><NEW_LINE>try {<NEW_LINE>// poll every 1 seconds , timeout after 10 minutes<NEW_LINE>waitForTask(conn, task, 1000, 10 * 60 * 1000);<NEW_LINE>checkForSuccess(conn, task);<NEW_LINE>} catch (final Types.HandleInvalid e) {<NEW_LINE>if (vm.getPowerState(conn) == VmPowerState.RUNNING) {<NEW_LINE>s_logger.debug("VM " + vmName + " is in Running status", e);<NEW_LINE>task = null;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>throw new CloudRuntimeException("Start VM " + vmName + " catch HandleInvalid and VM is not in RUNNING state");<NEW_LINE>} catch (final TimeoutException e) {<NEW_LINE>if (vm.getPowerState(conn) == VmPowerState.RUNNING) {<NEW_LINE>s_logger.debug("VM " + vmName + " is in Running status", e);<NEW_LINE>task = null;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>throw new CloudRuntimeException("Start VM " + vmName + " catch BadAsyncResult and VM is not in RUNNING state");<NEW_LINE>}<NEW_LINE>} catch (final XenAPIException e) {<NEW_LINE>final String msg = "Unable to start VM(" + vmName + ") on host(" + _host.getUuid() + ") due to " + e.toString();<NEW_LINE>s_logger.warn(msg, e);<NEW_LINE>throw new CloudRuntimeException(msg);<NEW_LINE>} finally {<NEW_LINE>if (task != null) {<NEW_LINE>try {<NEW_LINE>task.destroy(conn);<NEW_LINE>} catch (final Exception e1) {<NEW_LINE>s_logger.debug("unable to destroy task(" + task.toString() + ") on host(" + _host.getUuid() + ") due to " + e1.toString());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | conn, host, false, true); |
1,339,429 | public PhoneNumberSummary unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsJsonReader reader = context.getReader();<NEW_LINE>if (!reader.isContainer()) {<NEW_LINE>reader.skipValue();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>PhoneNumberSummary phoneNumberSummary = new PhoneNumberSummary();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("Id")) {<NEW_LINE>phoneNumberSummary.setId(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("Arn")) {<NEW_LINE>phoneNumberSummary.setArn(StringJsonUnmarshaller.getInstance<MASK><NEW_LINE>} else if (name.equals("PhoneNumber")) {<NEW_LINE>phoneNumberSummary.setPhoneNumber(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("PhoneNumberType")) {<NEW_LINE>phoneNumberSummary.setPhoneNumberType(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("PhoneNumberCountryCode")) {<NEW_LINE>phoneNumberSummary.setPhoneNumberCountryCode(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return phoneNumberSummary;<NEW_LINE>} | ().unmarshall(context)); |
100,137 | public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra, DataImportIssueStore issueStore) {<NEW_LINE>this.issueStore = issueStore;<NEW_LINE>OSMDatabase osmdb = new OSMDatabase(issueStore);<NEW_LINE>Handler handler = new Handler(graph, osmdb);<NEW_LINE>for (BinaryOpenStreetMapProvider provider : providers) {<NEW_LINE>LOG.info("Gathering OSM from provider: " + provider);<NEW_LINE>provider.readOSM(osmdb);<NEW_LINE>}<NEW_LINE>osmdb.postLoad();<NEW_LINE>LOG.info("Using OSM way configuration from {}. Setting driving direction of the graph to {}.", wayPropertySetSource.getClass().getSimpleName(), wayPropertySetSource.drivingDirection());<NEW_LINE>graph.setDrivingDirection(wayPropertySetSource.drivingDirection());<NEW_LINE>graph.<MASK><NEW_LINE>LOG.info("Building street graph from OSM");<NEW_LINE>handler.buildGraph(extra);<NEW_LINE>graph.hasStreets = true;<NEW_LINE>// Calculates envelope for OSM<NEW_LINE>graph.calculateEnvelope();<NEW_LINE>} | setIntersectionTraversalCostModel(wayPropertySetSource.getIntersectionTraversalCostModel()); |
1,780,655 | public void run(RegressionEnvironment env) {<NEW_LINE>// test for JIRA ESPER-332<NEW_LINE>sendTimer(0, env);<NEW_LINE>RegressionPath path = new RegressionPath();<NEW_LINE><MASK><NEW_LINE>env.compileDeploy(stmtTextCreate, path);<NEW_LINE>String stmtCount = "on pattern[every timer:interval(10 sec)] select count(eve), eve from MyInfraPTS as eve";<NEW_LINE>env.compileDeploy(stmtCount, path);<NEW_LINE>String stmtTextOnSelect = "@name('select') on pattern [every timer:interval(10 sec)] select theString from MyInfraPTS having count(theString) > 0";<NEW_LINE>env.compileDeploy(stmtTextOnSelect, path).addListener("select");<NEW_LINE>String stmtTextInsertOne = namedWindow ? "insert into MyInfraPTS select * from SupportBean" : "insert into MyInfraPTS select theString from SupportBean";<NEW_LINE>env.compileDeploy(stmtTextInsertOne, path);<NEW_LINE>sendTimer(11000, env);<NEW_LINE>env.assertListenerNotInvoked("select");<NEW_LINE>env.milestone(0);<NEW_LINE>sendTimer(21000, env);<NEW_LINE>env.assertListenerNotInvoked("select");<NEW_LINE>sendSupportBean(env, "E1", 1);<NEW_LINE>sendTimer(31000, env);<NEW_LINE>env.assertEqualsNew("select", "theString", "E1");<NEW_LINE>env.undeployAll();<NEW_LINE>} | String stmtTextCreate = namedWindow ? "@public create window MyInfraPTS#keepall as select * from SupportBean" : "@public create table MyInfraPTS as (theString string)"; |
388,054 | private GeneralPath createShape(GeneralPath out, double x, double y, double width, double height) {<NEW_LINE>if (hasBorderRadius()) {<NEW_LINE>out.reset();<NEW_LINE>out.moveTo(borderRadius.topLeftRadiusX(), 0);<NEW_LINE>out.lineTo(width - <MASK><NEW_LINE>// out.arcTo(width-borderRadius.topRightRadiusX(), borderRadius.topRightRadiusY(), width, borderRadius.topRightRadiusY(), true);<NEW_LINE>out.quadTo(width, 0, width, borderRadius.topRightRadiusY());<NEW_LINE>out.lineTo(width, height - borderRadius.bottomRightY());<NEW_LINE>// out.arcTo(width-borderRadius.bottomRightX(), height-borderRadius.bottomRightY(), width-borderRadius.bottomRightX(), height, true);<NEW_LINE>out.quadTo(width, height, width - borderRadius.bottomRightX(), height);<NEW_LINE>out.lineTo(borderRadius.bottomLeftX(), height);<NEW_LINE>// out.arcTo(borderRadius.bottomLeftX(), height-borderRadius.bottomLeftY(), 0, height-borderRadius.bottomLeftY(), true);<NEW_LINE>out.quadTo(0, height, 0, height - borderRadius.bottomLeftY());<NEW_LINE>out.lineTo(0, borderRadius.topLeftRadiusY());<NEW_LINE>// out.arcTo(borderRadius.topLeftRadiusX(), borderRadius.topLeftRadiusY(), borderRadius.topLeftRadiusX(), 0, true);<NEW_LINE>out.quadTo(0, 0, borderRadius.topLeftRadiusX(), 0);<NEW_LINE>out.closePath();<NEW_LINE>} else {<NEW_LINE>out.reset();<NEW_LINE>out.moveTo(0, 0);<NEW_LINE>out.lineTo(width, 0);<NEW_LINE>out.lineTo(width, height);<NEW_LINE>out.lineTo(0, height);<NEW_LINE>out.closePath();<NEW_LINE>}<NEW_LINE>out.transform(Transform.makeTranslation((float) x, (float) y));<NEW_LINE>return out;<NEW_LINE>} | borderRadius.topRightRadiusX(), 0); |
357,629 | private Collection<Particle> findNearest(Particle target, Collection<Particle> particles, int k, double maxDist) {<NEW_LINE>List<Particle> result <MASK><NEW_LINE>double[] tempDist = new double[k];<NEW_LINE>int worstIndex = -1;<NEW_LINE>for (Particle particle : particles) {<NEW_LINE>if (particle == target) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>double d = this.distanceCalc.calculate(particle.getLocation(), target.getLocation());<NEW_LINE>if (d > maxDist) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (result.size() < k) {<NEW_LINE>tempDist[result.size()] = d;<NEW_LINE>result.add(particle);<NEW_LINE>worstIndex = maxIndex(tempDist);<NEW_LINE>} else if (d < tempDist[worstIndex]) {<NEW_LINE>tempDist[worstIndex] = d;<NEW_LINE>result.set(worstIndex, particle);<NEW_LINE>worstIndex = maxIndex(tempDist);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | = new ArrayList<Particle>(); |
1,097,734 | public <T> T toJava(Class<T> type) {<NEW_LINE>final Object object = getObject();<NEW_LINE>if (object == null) {<NEW_LINE>throw getRuntime().newRuntimeError("Java proxy not initialized. Did you call super() yet?");<NEW_LINE>}<NEW_LINE>final Class clazz = object.getClass();<NEW_LINE>if (type.isPrimitive()) {<NEW_LINE>if (type == Void.TYPE)<NEW_LINE>return null;<NEW_LINE>if (object instanceof Number && type != Boolean.TYPE || object instanceof Character && type == Character.TYPE || object instanceof Boolean && type == Boolean.TYPE) {<NEW_LINE>// FIXME in more permissive call paths, like invokedynamic, this can allow<NEW_LINE>// precision-loading downcasts to happen silently<NEW_LINE>return (T) object;<NEW_LINE>}<NEW_LINE>} else if (type.isAssignableFrom(clazz)) {<NEW_LINE>if (Java.OBJECT_PROXY_CACHE || metaClass.getCacheProxy()) {<NEW_LINE>getRuntime().getJavaSupport().getObjectProxyCache().put(object, this);<NEW_LINE>}<NEW_LINE>return type.cast(object);<NEW_LINE>} else // e.g. IRubyObject.class<NEW_LINE>if (type.isAssignableFrom(getClass()))<NEW_LINE>return type.cast(this);<NEW_LINE>throw getRuntime().newTypeError("failed to coerce " + clazz.getName() + <MASK><NEW_LINE>} | " to " + type.getName()); |
1,080,703 | final void executeRequestCancelWorkflowExecution(RequestCancelWorkflowExecutionRequest requestCancelWorkflowExecutionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(requestCancelWorkflowExecutionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RequestCancelWorkflowExecutionRequest> request = null;<NEW_LINE>Response<Void> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RequestCancelWorkflowExecutionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(requestCancelWorkflowExecutionRequest));<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.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "RequestCancelWorkflowExecution");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<Void>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), null);<NEW_LINE>invoke(request, responseHandler, executionContext);<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "SWF"); |
1,501,412 | public Tuple2<Double, Double> calcHessianGradientLoss(Iterable<Tuple3<Double, Double, Vector>> labelVectors, DenseVector coefVector, DenseMatrix hessian, DenseVector grad) {<NEW_LINE>if (this.hasSecondDerivative()) {<NEW_LINE>int size = grad.size();<NEW_LINE>for (int i = 0; i < size; ++i) {<NEW_LINE>grad.set(i, 0.0);<NEW_LINE>for (int j = 0; j < size; ++j) {<NEW_LINE>hessian.set(i, j, 0.0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>double weightSum = 0.0;<NEW_LINE>double loss = 0.0;<NEW_LINE>for (Tuple3<Double, Double, Vector> labledVector : labelVectors) {<NEW_LINE><MASK><NEW_LINE>weightSum += 1.0;<NEW_LINE>updateGradient(labledVector, coefVector, grad);<NEW_LINE>loss += calcLoss(labledVector, coefVector);<NEW_LINE>}<NEW_LINE>if (0.0 != this.l2) {<NEW_LINE>double tmpVal = this.l2 * 2 * weightSum;<NEW_LINE>grad.plusScaleEqual(coefVector, tmpVal);<NEW_LINE>for (int i = 0; i < hessian.numRows(); ++i) {<NEW_LINE>hessian.add(i, i, tmpVal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (0.0 != this.l1) {<NEW_LINE>double tmpVal = this.l1 * weightSum;<NEW_LINE>double[] coefArray = coefVector.getData();<NEW_LINE>for (int i = 0; i < coefVector.size(); i++) {<NEW_LINE>grad.add(i, Math.signum(coefArray[i]) * tmpVal);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Tuple2.of(weightSum, loss);<NEW_LINE>} else {<NEW_LINE>throw new UnsupportedOperationException("loss function can't support second derivative, newton precondition can not work.");<NEW_LINE>}<NEW_LINE>} | updateHessian(labledVector, coefVector, hessian); |
29,722 | private Response invoke(final RequestProcessingContext context, final Object resource) {<NEW_LINE>Response jaxrsResponse;<NEW_LINE>context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_START);<NEW_LINE>context.push(response -> {<NEW_LINE>// Need to check whether the response is null or mapped from exception. In these cases we don't want to modify<NEW_LINE>// response with resource method metadata.<NEW_LINE>if (response == null || response.isMappedFromException()) {<NEW_LINE>return response;<NEW_LINE>}<NEW_LINE>final Annotation[] entityAnn = response.getEntityAnnotations();<NEW_LINE>if (methodAnnotations.length > 0) {<NEW_LINE>if (entityAnn.length == 0) {<NEW_LINE>response.setEntityAnnotations(methodAnnotations);<NEW_LINE>} else {<NEW_LINE>final Annotation[] mergedAnn = Arrays.copyOf(methodAnnotations, methodAnnotations.length + entityAnn.length);<NEW_LINE>System.arraycopy(entityAnn, 0, mergedAnn, methodAnnotations.length, entityAnn.length);<NEW_LINE>response.setEntityAnnotations(mergedAnn);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (canUseInvocableResponseType && response.hasEntity() && !(response.getEntityType() instanceof ParameterizedType)) {<NEW_LINE>response.setEntityType(unwrapInvocableResponseType(context.request()));<NEW_LINE>}<NEW_LINE>return response;<NEW_LINE>});<NEW_LINE>try {<NEW_LINE>jaxrsResponse = dispatcher.dispatch(<MASK><NEW_LINE>} finally {<NEW_LINE>context.triggerEvent(RequestEvent.Type.RESOURCE_METHOD_FINISHED);<NEW_LINE>}<NEW_LINE>if (jaxrsResponse == null) {<NEW_LINE>jaxrsResponse = Response.noContent().build();<NEW_LINE>}<NEW_LINE>return jaxrsResponse;<NEW_LINE>} | resource, context.request()); |
1,852,128 | public static void main(String[] args) {<NEW_LINE>Scanner s = new Scanner(System.in);<NEW_LINE>System.out.println("Of First Matrix");<NEW_LINE>System.out.println(" Enter number of rows ");<NEW_LINE>int rows_first = s.nextInt();<NEW_LINE>System.out.println(" Enter number of columns ");<NEW_LINE>int columns_first = s.nextInt();<NEW_LINE>int[][] matrix1 = new int[rows_first][columns_first];<NEW_LINE>System.out.println("Of Second Matrix");<NEW_LINE>System.out.println(" Enter number of rows ");<NEW_LINE>int rows_second = s.nextInt();<NEW_LINE>System.out.println(" Enter number of columns ");<NEW_LINE>int columns_second = s.nextInt();<NEW_LINE>int[][] matrix2 = new int[rows_second][columns_second];<NEW_LINE>if (columns_first != rows_second) {<NEW_LINE>System.out.println(" Multiplication of matrix is not possible ");<NEW_LINE>} else {<NEW_LINE>System.out.println(" Enter elements of 1st matrix ");<NEW_LINE>for (int i = 0; i < rows_first; i++) {<NEW_LINE>for (int j = 0; j < columns_first; j++) {<NEW_LINE>matrix1[i][<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>System.out.println(" Enter elements of 2nd matrix ");<NEW_LINE>for (int i = 0; i < rows_first; i++) {<NEW_LINE>for (int j = 0; j < columns_first; j++) {<NEW_LINE>matrix2[i][j] = s.nextInt();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>multiply_matrices(matrix1, matrix2);<NEW_LINE>}<NEW_LINE>} | j] = s.nextInt(); |
364,650 | private TreeSet<AspectRatio> findCommonAspectRatios(List<Camera.Size> previewSizes, List<Camera.Size> pictureSizes) {<NEW_LINE>Set<AspectRatio> previewAspectRatios = new HashSet<>();<NEW_LINE>for (Camera.Size size : previewSizes) {<NEW_LINE>AspectRatio deviceRatio = AspectRatio.of(CameraKit.Internal.screenHeight, CameraKit.Internal.screenWidth);<NEW_LINE>AspectRatio previewRatio = AspectRatio.of(size.width, size.height);<NEW_LINE>if (deviceRatio.equals(previewRatio)) {<NEW_LINE>previewAspectRatios.add(previewRatio);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Set<AspectRatio> captureAspectRatios = new HashSet<>();<NEW_LINE>for (Camera.Size size : pictureSizes) {<NEW_LINE>captureAspectRatios.add(AspectRatio.of(size.width, size.height));<NEW_LINE>}<NEW_LINE>TreeSet<AspectRatio> output = new TreeSet<>();<NEW_LINE>if (previewAspectRatios.size() == 0) {<NEW_LINE>// if no common aspect ratios<NEW_LINE>Camera.Size <MASK><NEW_LINE>AspectRatio maxPreviewAspectRatio = AspectRatio.of(maxSize.width, maxSize.height);<NEW_LINE>for (AspectRatio aspectRatio : captureAspectRatios) {<NEW_LINE>if (aspectRatio.equals(maxPreviewAspectRatio)) {<NEW_LINE>output.add(aspectRatio);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// if common aspect ratios exist<NEW_LINE>for (AspectRatio aspectRatio : previewAspectRatios) {<NEW_LINE>if (captureAspectRatios.contains(aspectRatio)) {<NEW_LINE>output.add(aspectRatio);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return output;<NEW_LINE>} | maxSize = previewSizes.get(0); |
232,947 | public Vector<ContentValues> parse() {<NEW_LINE>commentsList.clear();<NEW_LINE>Elements tableRows = document.select("table tr table tr:has(table)");<NEW_LINE>storesQuestion();<NEW_LINE>for (int row = 0; row < tableRows.size(); row++) {<NEW_LINE>Element mainRowElement = tableRows.get(row).<MASK><NEW_LINE>Element rowLevelElement = tableRows.get(row).select("td:eq(0)").first();<NEW_LINE>if (mainRowElement == null) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>String text = parseText(mainRowElement);<NEW_LINE>String commentId = parseCommentId(mainRowElement);<NEW_LINE>String author = parseAuthor(mainRowElement);<NEW_LINE>String timeAgo = parseTimeAgo(mainRowElement);<NEW_LINE>int level = parseLevel(rowLevelElement);<NEW_LINE>ContentValues commentValues = new ContentValues();<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.BY, author);<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.ITEM_ID, storyId);<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.TEXT, text);<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.LEVEL, level);<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.TIME_AGO, timeAgo);<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.HEADER, System.currentTimeMillis());<NEW_LINE>commentValues.put(HNewsContract.CommentsEntry.COMMENT_ID, commentId);<NEW_LINE>commentsList.add(commentValues);<NEW_LINE>}<NEW_LINE>return commentsList;<NEW_LINE>} | select("td:eq(2)").first(); |
545,009 | void scanElement_file(org.w3c.dom.Element element, Version version) {<NEW_LINE>// <file><NEW_LINE>ModuleFile file = new ModuleFile();<NEW_LINE>org.w3c.dom.NamedNodeMap attrs = element.getAttributes();<NEW_LINE>for (int i = 0; i < attrs.getLength(); i++) {<NEW_LINE>org.w3c.dom.Attr attr = (org.w3c.dom.Attr) attrs.item(i);<NEW_LINE>if (attr.getName().equals(ATTR_FILE_NAME)) {<NEW_LINE>// <file name="???"><NEW_LINE>file.<MASK><NEW_LINE>}<NEW_LINE>if (attr.getName().equals(ATTR_CRC)) {<NEW_LINE>// <file crc="???"><NEW_LINE>file.setCrc(attr.getValue());<NEW_LINE>}<NEW_LINE>if (attr.getName().equals(ATTR_VERSION)) {<NEW_LINE>file.setLocaleversion(attr.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>version.addFile(file);<NEW_LINE>} | setName(attr.getValue()); |
680,437 | public void read(JmeImporter im) throws IOException {<NEW_LINE>InputCapsule ic = im.getCapsule(this);<NEW_LINE>name = <MASK><NEW_LINE>worldBound = (BoundingVolume) ic.readSavable("world_bound", null);<NEW_LINE>cullHint = ic.readEnum("cull_mode", CullHint.class, CullHint.Inherit);<NEW_LINE>batchHint = ic.readEnum("batch_hint", BatchHint.class, BatchHint.Inherit);<NEW_LINE>queueBucket = ic.readEnum("queue", RenderQueue.Bucket.class, RenderQueue.Bucket.Inherit);<NEW_LINE>shadowMode = ic.readEnum("shadow_mode", ShadowMode.class, ShadowMode.Inherit);<NEW_LINE>localTransform = (Transform) ic.readSavable("transform", Transform.IDENTITY);<NEW_LINE>localLights = (LightList) ic.readSavable("lights", null);<NEW_LINE>localLights.setOwner(this);<NEW_LINE>ArrayList<MatParamOverride> localOverridesList = ic.readSavableArrayList("overrides", null);<NEW_LINE>if (localOverridesList == null) {<NEW_LINE>localOverrides = new SafeArrayList<>(MatParamOverride.class);<NEW_LINE>} else {<NEW_LINE>localOverrides = new SafeArrayList(MatParamOverride.class, localOverridesList);<NEW_LINE>}<NEW_LINE>worldOverrides = new SafeArrayList<>(MatParamOverride.class);<NEW_LINE>// changed for backward compatibility with j3o files<NEW_LINE>// generated before the AnimControl/SkeletonControl split<NEW_LINE>// the AnimControl creates the SkeletonControl for old files and add it to the spatial.<NEW_LINE>// The SkeletonControl must be the last in the stack,<NEW_LINE>// so we add the list of all other controls before it.<NEW_LINE>// When backward compatibility won't be needed anymore this can be replaced by :<NEW_LINE>// controls = ic.readSavableArrayList("controlsList", null));<NEW_LINE>controls.addAll(0, ic.readSavableArrayList("controlsList", null));<NEW_LINE>userData = (HashMap<String, Savable>) ic.readStringSavableMap("user_data", null);<NEW_LINE>} | ic.readString("name", null); |
1,277,307 | public ECPoint twice() {<NEW_LINE>if (this.isInfinity()) {<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>ECCurve curve = this.getCurve();<NEW_LINE>ECFieldElement X1 = this.x;<NEW_LINE>if (X1.isZero()) {<NEW_LINE>// A point with X == 0 is its own additive inverse<NEW_LINE>return curve.getInfinity();<NEW_LINE>}<NEW_LINE>ECFieldElement L1 = this.y, Z1 = this.zs[0];<NEW_LINE>boolean Z1IsOne = Z1.isOne();<NEW_LINE>ECFieldElement L1Z1 = Z1IsOne ? L1 : L1.multiply(Z1);<NEW_LINE>ECFieldElement Z1Sq = Z1IsOne ? Z1 : Z1.square();<NEW_LINE>ECFieldElement a = curve.getA();<NEW_LINE>ECFieldElement aZ1Sq = Z1IsOne ? a : a.multiply(Z1Sq);<NEW_LINE>ECFieldElement T = L1.square().add(L1Z1).add(aZ1Sq);<NEW_LINE>if (T.isZero()) {<NEW_LINE>return new SecT113R1Point(curve, T, curve.getB().sqrt());<NEW_LINE>}<NEW_LINE>ECFieldElement X3 = T.square();<NEW_LINE>ECFieldElement Z3 = Z1IsOne ? T : T.multiply(Z1Sq);<NEW_LINE>ECFieldElement X1Z1 = Z1IsOne ? X1 : X1.multiply(Z1);<NEW_LINE>ECFieldElement L3 = X1Z1.squarePlusProduct(T, L1Z1).add<MASK><NEW_LINE>return new SecT113R1Point(curve, X3, L3, new ECFieldElement[] { Z3 });<NEW_LINE>} | (X3).add(Z3); |
1,696,629 | public void inviteGroupMembers(GroupInfo groupInfo, List<String> addMembers, final IUIKitCallback callBack) {<NEW_LINE>if (addMembers == null || addMembers.size() == 0) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>V2TIMManager.getGroupManager().inviteUserToGroup(groupInfo.getId(), addMembers, new V2TIMValueCallback<List<V2TIMGroupMemberOperationResult>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onError(int code, String desc) {<NEW_LINE>TUIGroupLog.e(TAG, "addGroupMembers failed, code: " + code + "|desc: " + ErrorMessageConverter.convertIMError(code, desc));<NEW_LINE>callBack.onError(TAG, code, ErrorMessageConverter.convertIMError(code, desc));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(List<V2TIMGroupMemberOperationResult> v2TIMGroupMemberOperationResults) {<NEW_LINE>final List<String> adds = new ArrayList<>();<NEW_LINE>if (v2TIMGroupMemberOperationResults.size() > 0) {<NEW_LINE>for (int i = 0; i < v2TIMGroupMemberOperationResults.size(); i++) {<NEW_LINE>V2TIMGroupMemberOperationResult res = v2TIMGroupMemberOperationResults.get(i);<NEW_LINE>if (res.getResult() == V2TIMGroupMemberOperationResult.OPERATION_RESULT_PENDING) {<NEW_LINE>callBack.onSuccess(TUIGroupService.getAppContext().getString<MASK><NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (res.getResult() > 0) {<NEW_LINE>adds.add(res.getMemberID());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (adds.size() > 0) {<NEW_LINE>groupInfo.getMemberDetails().clear();<NEW_LINE>loadGroupMembers(groupInfo, 0, callBack);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | (R.string.request_wait)); |
540,868 | private void processMessage(IPresentationCompletionMessage msg) {<NEW_LINE>if (msg instanceof PresentationConvertMessage) {<NEW_LINE>PresentationConvertMessage m = (PresentationConvertMessage) msg;<NEW_LINE>PresentationToConvert p = new PresentationToConvert(m.pres);<NEW_LINE>String presentationToConvertKey = p.getKey() + "_" + m.pres.getMeetingId();<NEW_LINE>presentationsToConvert.put(presentationToConvertKey, p);<NEW_LINE>} else if (msg instanceof PageConvertProgressMessage) {<NEW_LINE>PageConvertProgressMessage m = (PageConvertProgressMessage) msg;<NEW_LINE>String presentationToConvertKey = m.presId + "_" + m.meetingId;<NEW_LINE>PresentationToConvert <MASK><NEW_LINE>if (p != null) {<NEW_LINE>p.incrementPagesCompleted();<NEW_LINE>notifier.sendConversionUpdateMessage(p.getPagesCompleted(), p.pres, m.page);<NEW_LINE>if (p.getPagesCompleted() == p.pres.getNumberOfPages()) {<NEW_LINE>handleEndProcessing(p);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | p = presentationsToConvert.get(presentationToConvertKey); |
1,554,660 | public VoiceChannel createVoiceChannel(GuildImpl guild, DataObject json, long guildId) {<NEW_LINE>boolean playbackCache = false;<NEW_LINE>final long id = json.getLong("id");<NEW_LINE>VoiceChannelImpl channel = ((VoiceChannelImpl) getJDA().getVoiceChannelsView().get(id));<NEW_LINE>if (channel == null) {<NEW_LINE>if (guild == null)<NEW_LINE>guild = (GuildImpl) getJDA().getGuildsView().get(guildId);<NEW_LINE>SnowflakeCacheViewImpl<VoiceChannel> guildVoiceView = guild.getVoiceChannelsView(), voiceView = getJDA().getVoiceChannelsView();<NEW_LINE>try (UnlockHook vlock = guildVoiceView.writeLock();<NEW_LINE>UnlockHook jlock = voiceView.writeLock()) {<NEW_LINE>channel <MASK><NEW_LINE>guildVoiceView.getMap().put(id, channel);<NEW_LINE>playbackCache = voiceView.getMap().put(id, channel) == null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>channel.setParentCategory(json.getLong("parent_id", 0)).setName(json.getString("name")).setPosition(json.getInt("position")).setUserLimit(json.getInt("user_limit")).setBitrate(json.getInt("bitrate")).setRegion(json.getString("rtc_region", null));<NEW_LINE>createOverridesPass(channel, json.getArray("permission_overwrites"));<NEW_LINE>if (playbackCache)<NEW_LINE>getJDA().getEventCache().playbackCache(EventCache.Type.CHANNEL, id);<NEW_LINE>return channel;<NEW_LINE>} | = new VoiceChannelImpl(id, guild); |
1,488,074 | public Secret generateBrokersSecret(ClusterCa clusterCa, ClientsCa clientsCa) {<NEW_LINE>Map<String, String> data = new HashMap<>(replicas * 4);<NEW_LINE>for (int i = 0; i < replicas; i++) {<NEW_LINE>CertAndKey cert = brokerCerts.get(KafkaCluster.kafkaPodName(cluster, i));<NEW_LINE>data.put(KafkaCluster.kafkaPodName(cluster, i) + ".key", cert.keyAsBase64String());<NEW_LINE>data.put(KafkaCluster.kafkaPodName(cluster, i) + <MASK><NEW_LINE>data.put(KafkaCluster.kafkaPodName(cluster, i) + ".p12", cert.keyStoreAsBase64String());<NEW_LINE>data.put(KafkaCluster.kafkaPodName(cluster, i) + ".password", cert.storePasswordAsBase64String());<NEW_LINE>}<NEW_LINE>Map<String, String> annotations = Map.of(clusterCa.caCertGenerationAnnotation(), String.valueOf(clusterCa.certGeneration()), clientsCa.caCertGenerationAnnotation(), String.valueOf(clientsCa.certGeneration()));<NEW_LINE>return createSecret(KafkaCluster.brokersSecretName(cluster), data, annotations);<NEW_LINE>} | ".crt", cert.certAsBase64String()); |
1,608,362 | public List<Graph> generate(List<? extends Summary> results) {<NEW_LINE>List<Graph> graphs = new ArrayList<>();<NEW_LINE>List<IOTaskSummary> summaries = results.stream().map(x -> (IOTaskSummary) x).collect(Collectors.toList());<NEW_LINE>if (summaries.isEmpty()) {<NEW_LINE>LOG.info("No summaries to generate.");<NEW_LINE>return graphs;<NEW_LINE>}<NEW_LINE>// first() is the list of common field names, second() is the list of unique field names<NEW_LINE>Pair<List<String>, List<String>> fieldNames = Parameters.partitionFieldNames(summaries.stream().map(x -> x.mParameters).collect(Collectors.toList()));<NEW_LINE>// Split up common description into 100 character chunks, for the sub title<NEW_LINE>List<String> subTitle = new ArrayList<>(Splitter.fixedLength(100).splitToList(summaries.get(0).mParameters.getDescription(fieldNames.getFirst())));<NEW_LINE>for (IOTaskSummary summary : summaries) {<NEW_LINE>String series = summary.mParameters.<MASK><NEW_LINE>subTitle.add(series);<NEW_LINE>}<NEW_LINE>BarGraph speedGraph = new BarGraph("Read/Write speed", subTitle, "Avg speed in MB/s");<NEW_LINE>BarGraph stdDevGraph = new BarGraph("Read/Write speed standard deviation", subTitle, "Standard deviation in speed");<NEW_LINE>for (IOTaskSummary summary : summaries) {<NEW_LINE>String series = summary.mParameters.getDescription(fieldNames.getSecond());<NEW_LINE>// read stat<NEW_LINE>BarGraph.Data readSpeed = new BarGraph.Data();<NEW_LINE>BarGraph.Data readStdDev = new BarGraph.Data();<NEW_LINE>SpeedStat readStat = summary.getReadSpeedStat();<NEW_LINE>readSpeed.addData(readStat.mAvgSpeedMbps);<NEW_LINE>readStdDev.addData(readStat.mStdDev);<NEW_LINE>speedGraph.addDataSeries("Read " + series, readSpeed);<NEW_LINE>stdDevGraph.addDataSeries("Read " + series, readStdDev);<NEW_LINE>// write stat<NEW_LINE>BarGraph.Data writeSpeed = new BarGraph.Data();<NEW_LINE>BarGraph.Data writeStdDev = new BarGraph.Data();<NEW_LINE>SpeedStat writeStat = summary.getWriteSpeedStat();<NEW_LINE>writeSpeed.addData(writeStat.mAvgSpeedMbps);<NEW_LINE>writeStdDev.addData(writeStat.mStdDev);<NEW_LINE>speedGraph.addDataSeries("Write " + series, writeSpeed);<NEW_LINE>stdDevGraph.addDataSeries("Write " + series, writeStdDev);<NEW_LINE>}<NEW_LINE>graphs.add(speedGraph);<NEW_LINE>graphs.add(stdDevGraph);<NEW_LINE>return graphs;<NEW_LINE>} | getDescription(fieldNames.getSecond()); |
1,714,103 | protected static void death(Person person, long time) {<NEW_LINE>if (ENABLE_DEATH_BY_NATURAL_CAUSES) {<NEW_LINE>double roll = person.rand();<NEW_LINE>double likelihoodOfDeath = likelihoodOfDeath(person.ageInYears(time));<NEW_LINE>if (roll < likelihoodOfDeath) {<NEW_LINE>person.recordDeath(time, NATURAL_CAUSES);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ENABLE_DEATH_BY_LOSS_OF_CARE && deathFromLossOfCare(person)) {<NEW_LINE>person.recordDeath(time, LOSS_OF_CARE);<NEW_LINE>}<NEW_LINE>if (person.attributes.containsKey(Person.DEATHDATE)) {<NEW_LINE>Long deathDate = (Long) person.<MASK><NEW_LINE>long diff = deathDate - time;<NEW_LINE>long days = TimeUnit.MILLISECONDS.toDays(diff);<NEW_LINE>person.attributes.put(DAYS_UNTIL_DEATH, Long.valueOf(days));<NEW_LINE>}<NEW_LINE>} | attributes.get(Person.DEATHDATE); |
1,287,039 | private static Object evalNumeric(Number left, Number right, QueryDataTypeFamily family) {<NEW_LINE>switch(family) {<NEW_LINE>case TINYINT:<NEW_LINE>return (byte) (left.byteValue(<MASK><NEW_LINE>case SMALLINT:<NEW_LINE>return (short) (left.shortValue() - right.shortValue());<NEW_LINE>case INTEGER:<NEW_LINE>return left.intValue() - right.intValue();<NEW_LINE>case BIGINT:<NEW_LINE>try {<NEW_LINE>return Math.subtractExact(left.longValue(), right.longValue());<NEW_LINE>} catch (ArithmeticException e) {<NEW_LINE>throw QueryException.error(SqlErrorCode.DATA_EXCEPTION, "BIGINT overflow in '-' operator (consider adding explicit CAST to DECIMAL)");<NEW_LINE>}<NEW_LINE>case REAL:<NEW_LINE>return left.floatValue() - right.floatValue();<NEW_LINE>case DOUBLE:<NEW_LINE>return left.doubleValue() - right.doubleValue();<NEW_LINE>case DECIMAL:<NEW_LINE>return ((BigDecimal) left).subtract((BigDecimal) right, DECIMAL_MATH_CONTEXT);<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("unexpected result family: " + family);<NEW_LINE>}<NEW_LINE>} | ) - right.byteValue()); |
86,692 | public List<Step> toSteps(Client client, String phase, StepKey nextStepKey) {<NEW_LINE>StepKey preUnfollowKey = new StepKey(phase, NAME, CONDITIONAL_UNFOLLOW_STEP);<NEW_LINE>StepKey indexingComplete = new StepKey(phase, NAME, WaitForIndexingCompleteStep.NAME);<NEW_LINE>StepKey waitForFollowShardTasks = new StepKey(phase, NAME, WaitForFollowShardTasksStep.NAME);<NEW_LINE>StepKey pauseFollowerIndex = new StepKey(phase, NAME, PauseFollowerIndexStep.NAME);<NEW_LINE>StepKey closeFollowerIndex = new StepKey(phase, NAME, CloseFollowerIndexStep.NAME);<NEW_LINE>StepKey unfollowFollowerIndex = new StepKey(phase, NAME, UnfollowFollowerIndexStep.NAME);<NEW_LINE>// maintaining the `open-follower-index` here (as opposed to {@link OpenIndexStep#NAME}) for BWC reasons (in case any managed<NEW_LINE>// index is in the `open-follower-index` step at upgrade time<NEW_LINE>StepKey openFollowerIndex = new StepKey(phase, NAME, OPEN_FOLLOWER_INDEX_STEP_NAME);<NEW_LINE>StepKey waitForYellowStep = new StepKey(<MASK><NEW_LINE>BranchingStep conditionalSkipUnfollowStep = new BranchingStep(preUnfollowKey, indexingComplete, nextStepKey, (index, clusterState) -> {<NEW_LINE>IndexMetadata followerIndex = clusterState.metadata().index(index);<NEW_LINE>Map<String, String> customIndexMetadata = followerIndex.getCustomData(CCR_METADATA_KEY);<NEW_LINE>// if the index has no CCR metadata we'll skip the unfollow action completely<NEW_LINE>return customIndexMetadata == null;<NEW_LINE>});<NEW_LINE>WaitForIndexingCompleteStep step1 = new WaitForIndexingCompleteStep(indexingComplete, waitForFollowShardTasks);<NEW_LINE>WaitForFollowShardTasksStep step2 = new WaitForFollowShardTasksStep(waitForFollowShardTasks, pauseFollowerIndex, client);<NEW_LINE>PauseFollowerIndexStep step3 = new PauseFollowerIndexStep(pauseFollowerIndex, closeFollowerIndex, client);<NEW_LINE>CloseFollowerIndexStep step4 = new CloseFollowerIndexStep(closeFollowerIndex, unfollowFollowerIndex, client);<NEW_LINE>UnfollowFollowerIndexStep step5 = new UnfollowFollowerIndexStep(unfollowFollowerIndex, openFollowerIndex, client);<NEW_LINE>OpenIndexStep step6 = new OpenIndexStep(openFollowerIndex, waitForYellowStep, client);<NEW_LINE>WaitForIndexColorStep step7 = new WaitForIndexColorStep(waitForYellowStep, nextStepKey, ClusterHealthStatus.YELLOW);<NEW_LINE>return Arrays.asList(conditionalSkipUnfollowStep, step1, step2, step3, step4, step5, step6, step7);<NEW_LINE>} | phase, NAME, WaitForIndexColorStep.NAME); |
1,116,424 | private HttpRequest.Builder uploadFileRequestBuilder(Long petId, String additionalMetadata, File file) throws ApiException {<NEW_LINE>// verify the required parameter 'petId' is set<NEW_LINE>if (petId == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'petId' when calling uploadFile");<NEW_LINE>}<NEW_LINE>HttpRequest.Builder localVarRequestBuilder = HttpRequest.newBuilder();<NEW_LINE>String localVarPath = "/pet/{petId}/uploadImage".replace("{petId}", ApiClient.urlEncode<MASK><NEW_LINE>localVarRequestBuilder.uri(URI.create(memberVarBaseUri + localVarPath));<NEW_LINE>localVarRequestBuilder.header("Accept", "application/json");<NEW_LINE>localVarRequestBuilder.method("POST", HttpRequest.BodyPublishers.noBody());<NEW_LINE>if (memberVarReadTimeout != null) {<NEW_LINE>localVarRequestBuilder.timeout(memberVarReadTimeout);<NEW_LINE>}<NEW_LINE>if (memberVarInterceptor != null) {<NEW_LINE>memberVarInterceptor.accept(localVarRequestBuilder);<NEW_LINE>}<NEW_LINE>return localVarRequestBuilder;<NEW_LINE>} | (petId.toString())); |
1,809,992 | public void draw(@NonNull Canvas canvas, @NonNull Value value, int coordinateX, int coordinateY) {<NEW_LINE>if (!(value instanceof ThinWormAnimationValue)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>ThinWormAnimationValue v = (ThinWormAnimationValue) value;<NEW_LINE><MASK><NEW_LINE>int rectEnd = v.getRectEnd();<NEW_LINE>int height = v.getHeight() / 2;<NEW_LINE>int radius = indicator.getRadius();<NEW_LINE>int unselectedColor = indicator.getUnselectedColor();<NEW_LINE>int selectedColor = indicator.getSelectedColor();<NEW_LINE>if (indicator.getOrientation() == Orientation.HORIZONTAL) {<NEW_LINE>rect.left = rectStart;<NEW_LINE>rect.right = rectEnd;<NEW_LINE>rect.top = coordinateY - height;<NEW_LINE>rect.bottom = coordinateY + height;<NEW_LINE>} else {<NEW_LINE>rect.left = coordinateX - height;<NEW_LINE>rect.right = coordinateX + height;<NEW_LINE>rect.top = rectStart;<NEW_LINE>rect.bottom = rectEnd;<NEW_LINE>}<NEW_LINE>paint.setColor(unselectedColor);<NEW_LINE>canvas.drawCircle(coordinateX, coordinateY, radius, paint);<NEW_LINE>paint.setColor(selectedColor);<NEW_LINE>canvas.drawRoundRect(rect, radius, radius, paint);<NEW_LINE>} | int rectStart = v.getRectStart(); |
998,998 | public final VariableDeclaratorContext variableDeclarator() throws RecognitionException {<NEW_LINE>VariableDeclaratorContext _localctx = new <MASK><NEW_LINE>enterRule(_localctx, 60, RULE_variableDeclarator);<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(624);<NEW_LINE>variableDeclaratorId();<NEW_LINE>setState(630);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(getInterpreter().adaptivePredict(_input, 46, _ctx)) {<NEW_LINE>case 1:<NEW_LINE>{<NEW_LINE>setState(625);<NEW_LINE>nls();<NEW_LINE>setState(626);<NEW_LINE>match(ASSIGN);<NEW_LINE>setState(627);<NEW_LINE>nls();<NEW_LINE>setState(628);<NEW_LINE>variableInitializer();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | VariableDeclaratorContext(_ctx, getState()); |
910,591 | public RegistryCenterClient connect(final String nameAndNameSpace) {<NEW_LINE>final RegistryCenterClient registryCenterClient = new RegistryCenterClient();<NEW_LINE>registryCenterClient.setNameAndNamespace(nameAndNameSpace);<NEW_LINE>if (nameAndNameSpace == null) {<NEW_LINE>return registryCenterClient;<NEW_LINE>}<NEW_LINE>synchronized (getNnsLock(nameAndNameSpace)) {<NEW_LINE>if (!registryCenterClientMap.containsKey(nameAndNameSpace)) {<NEW_LINE>RegistryCenterConfiguration registryCenterConfiguration = findConfig(nameAndNameSpace);<NEW_LINE>if (registryCenterConfiguration == null) {<NEW_LINE>return registryCenterClient;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>String namespace = registryCenterConfiguration.getNamespace();<NEW_LINE>String digest = registryCenterConfiguration.getDigest();<NEW_LINE>registryCenterClient.setZkAddr(zkAddressList);<NEW_LINE>CuratorFramework client = curatorRepository.connect(zkAddressList, namespace, digest);<NEW_LINE>if (client == null) {<NEW_LINE>return registryCenterClient;<NEW_LINE>}<NEW_LINE>registryCenterClient.setConnected(client.getZookeeperClient().isConnected());<NEW_LINE>registryCenterClient.setCuratorClient(client);<NEW_LINE>registryCenterClientMap.put(nameAndNameSpace, registryCenterClient);<NEW_LINE>return registryCenterClient;<NEW_LINE>} else {<NEW_LINE>RegistryCenterClient registryCenterClient2 = registryCenterClientMap.get(nameAndNameSpace);<NEW_LINE>if (registryCenterClient2 != null) {<NEW_LINE>if (registryCenterClient2.getCuratorClient() != null) {<NEW_LINE>registryCenterClient2.setConnected(registryCenterClient2.getCuratorClient().getZookeeperClient().isConnected());<NEW_LINE>} else {<NEW_LINE>registryCenterClient2.setConnected(false);<NEW_LINE>}<NEW_LINE>return registryCenterClient2;<NEW_LINE>}<NEW_LINE>return registryCenterClient;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | String zkAddressList = registryCenterConfiguration.getZkAddressList(); |
1,011,532 | public Optional<FileResource> resolveUri(final ResourceRequestContext resourceRequestContext) throws PwmUnrecoverableException {<NEW_LINE>final String effectiveUri = resourceRequestContext.getUri();<NEW_LINE>final ResourceServletConfiguration resourceServletConfiguration = resourceRequestContext.getResourceServletConfiguration();<NEW_LINE>// check files system zip files.<NEW_LINE>final Map<String, ZipFile> zipResources = resourceServletConfiguration.getZipResources();<NEW_LINE>for (final Map.Entry<String, ZipFile> entry : zipResources.entrySet()) {<NEW_LINE>final String path = entry.getKey();<NEW_LINE>if (effectiveUri.startsWith(path)) {<NEW_LINE>final String zipSubPath = effectiveUri.substring(<MASK><NEW_LINE>final ZipFile zipFile = entry.getValue();<NEW_LINE>final ZipEntry zipEntry = zipFile.getEntry(zipSubPath);<NEW_LINE>if (zipEntry != null) {<NEW_LINE>return Optional.of(new ZipFileResource(zipFile, zipEntry));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (effectiveUri.startsWith(zipResources.get(path).getName())) {<NEW_LINE>LOGGER.warn(() -> "illegal url request to " + effectiveUri + " zip resource");<NEW_LINE>throw new PwmUnrecoverableException(new ErrorInformation(PwmError.ERROR_SERVICE_NOT_AVAILABLE, "illegal url request"));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return Optional.empty();<NEW_LINE>} | path.length() + 1); |
1,301,311 | private void addColumnFamilyToTable(String tableName, String columnFamilyName) throws IOException {<NEW_LINE>HColumnDescriptor cfDesciptor = new HColumnDescriptor(columnFamilyName);<NEW_LINE>try {<NEW_LINE>if (admin.tableExists(tableName)) {<NEW_LINE>// Before any modification to table schema, it's necessary to<NEW_LINE>// disable it<NEW_LINE>if (!admin.isTableEnabled(tableName)) {<NEW_LINE>admin.enableTable(tableName);<NEW_LINE>}<NEW_LINE>HTableDescriptor descriptor = admin.getTableDescriptor(tableName.getBytes());<NEW_LINE>boolean found = false;<NEW_LINE>for (HColumnDescriptor hColumnDescriptor : descriptor.getColumnFamilies()) {<NEW_LINE>if (hColumnDescriptor.getNameAsString().equalsIgnoreCase(columnFamilyName))<NEW_LINE>found = true;<NEW_LINE>}<NEW_LINE>if (!found) {<NEW_LINE>if (admin.isTableEnabled(tableName)) {<NEW_LINE>admin.disableTable(tableName);<NEW_LINE>}<NEW_LINE>admin.addColumn(tableName, cfDesciptor);<NEW_LINE>// Enable table once done<NEW_LINE>admin.enableTable(tableName);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>log.warn("Table {} doesn't exist, so no question of adding column family {} to it!", tableName, columnFamilyName);<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>log.<MASK><NEW_LINE>throw e;<NEW_LINE>}<NEW_LINE>} | error("Error while adding column family {}, to table{} . ", columnFamilyName, tableName); |
559,705 | public Dialog onCreateDialog(Bundle savedInstanceState) {<NEW_LINE>LayoutInflater inflater = (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE);<NEW_LINE>View view = inflater.inflate(R.layout.number_picker_dialog, null);<NEW_LINE>final NumberPicker numberPicker = view.findViewById(R.id.number_picker);<NEW_LINE>numberPicker.setMaxValue(((String[]) getArguments().getSerializable(DISPLAYED_VALUES)).length - 1);<NEW_LINE>numberPicker.setMinValue(0);<NEW_LINE>numberPicker.setWrapSelectorWheel(false);<NEW_LINE>numberPicker.setDisplayedValues((String[]) getArguments().getSerializable(DISPLAYED_VALUES));<NEW_LINE>numberPicker.setValue(((String[]) getArguments().getSerializable(DISPLAYED_VALUES)).length - 1 - getArguments().getInt(PROGRESS));<NEW_LINE>return new MaterialAlertDialogBuilder(getActivity()).setTitle(R.string.number_picker_title).setView(view).setPositiveButton(R.string.ok, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>public void onClick(DialogInterface dialog, int whichButton) {<NEW_LINE>listener.onNumberPickerValueSelected(getArguments().getInt(WIDGET_ID<MASK><NEW_LINE>}<NEW_LINE>}).setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {<NEW_LINE><NEW_LINE>public void onClick(DialogInterface dialog, int whichButton) {<NEW_LINE>}<NEW_LINE>}).create();<NEW_LINE>} | ), numberPicker.getValue()); |
1,086,111 | public void submitTicket(LotteryService service, Scanner scanner) {<NEW_LINE>logger.info("What is your email address?");<NEW_LINE>var email = readString(scanner);<NEW_LINE>logger.info("What is your bank account number?");<NEW_LINE>var account = readString(scanner);<NEW_LINE>logger.info("What is your phone number?");<NEW_LINE>var phone = readString(scanner);<NEW_LINE>var details = new <MASK><NEW_LINE>logger.info("Give 4 comma separated lottery numbers?");<NEW_LINE>var numbers = readString(scanner);<NEW_LINE>try {<NEW_LINE>var chosen = Arrays.stream(numbers.split(",")).map(Integer::parseInt).collect(Collectors.toSet());<NEW_LINE>var lotteryNumbers = LotteryNumbers.create(chosen);<NEW_LINE>var lotteryTicket = new LotteryTicket(new LotteryTicketId(), details, lotteryNumbers);<NEW_LINE>service.submitTicket(lotteryTicket).ifPresentOrElse((id) -> logger.info("Submitted lottery ticket with id: {}", id), () -> logger.info("Failed submitting lottery ticket - please try again."));<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.info("Failed submitting lottery ticket - please try again.");<NEW_LINE>}<NEW_LINE>} | PlayerDetails(email, account, phone); |
697,783 | public static void foldKeyboard() {<NEW_LINE>if (instance.isAsyncEditMode()) {<NEW_LINE>Form f = Display.getInstance().getCurrent();<NEW_LINE>final Component cmp = f == null ? null : f.getFocused();<NEW_LINE>instance.callHideTextEditor();<NEW_LINE>nativeInstance.foldVKB();<NEW_LINE>// after folding the keyboard the screen layout might shift<NEW_LINE>Display.getInstance().callSerially(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>if (cmp != null) {<NEW_LINE>Form f = Display.getInstance().getCurrent();<NEW_LINE>if (f == cmp.getComponentForm()) {<NEW_LINE>cmp.requestFocus();<NEW_LINE>}<NEW_LINE>if (nativeInstance.isAsyncEditMode() && f.isFormBottomPaddingEditingMode() && getRootPane(f).getUnselectedStyle().getPaddingBottom() > 0) {<NEW_LINE>getRootPane(f).getUnselectedStyle().<MASK><NEW_LINE>f.forceRevalidate();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// revalidate even if we transition to a different form since the<NEW_LINE>// spacing might have remained during the transition<NEW_LINE>f.revalidate();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | setPadding(Component.BOTTOM, 0); |
1,699,113 | boolean processVoteRequest(boolean isUpvote, ParaObject votable, HttpServletRequest req) {<NEW_LINE>Profile author = null;<NEW_LINE>Profile authUser = utils.getAuthUser(req);<NEW_LINE>boolean result = false;<NEW_LINE>boolean update = false;<NEW_LINE>if (votable == null || authUser == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>List<ParaObject> voteObjects = pc.readAll(Arrays.asList(votable.getCreatorid(), new Vote(authUser.getId(), votable.getId(), Votable.VoteValue.UP).getId(), new Vote(authUser.getId(), votable.getId(), Votable.VoteValue.<MASK><NEW_LINE>author = (Profile) voteObjects.stream().filter((p) -> p instanceof Profile).findFirst().orElse(null);<NEW_LINE>Integer votes = votable.getVotes() != null ? votable.getVotes() : 0;<NEW_LINE>boolean upvoteExists = voteObjects.stream().anyMatch((v) -> v instanceof Vote && ((Vote) v).isUpvote());<NEW_LINE>boolean downvoteExists = voteObjects.stream().anyMatch((v) -> v instanceof Vote && ((Vote) v).isDownvote());<NEW_LINE>boolean isVoteCorrection = (isUpvote && downvoteExists) || (!isUpvote && upvoteExists);<NEW_LINE>if (isUpvote && voteUp(votable, authUser.getId())) {<NEW_LINE>votes++;<NEW_LINE>result = true;<NEW_LINE>update = updateReputationOnUpvote(votable, votes, authUser, author, isVoteCorrection);<NEW_LINE>} else if (!isUpvote && voteDown(votable, authUser.getId())) {<NEW_LINE>votes--;<NEW_LINE>result = true;<NEW_LINE>hideCommentAndReport(votable, votes, votable.getId(), req);<NEW_LINE>update = updateReputationOnDownvote(votable, votes, authUser, author, isVoteCorrection);<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>logger.error(null, ex);<NEW_LINE>result = false;<NEW_LINE>}<NEW_LINE>utils.addBadgeOnce(authUser, SUPPORTER, authUser.getUpvotes() >= CONF.supporterIfHasRep());<NEW_LINE>utils.addBadgeOnce(authUser, CRITIC, authUser.getDownvotes() >= CONF.criticIfHasRep());<NEW_LINE>utils.addBadgeOnce(authUser, VOTER, authUser.getTotalVotes() >= CONF.voterIfHasRep());<NEW_LINE>if (update) {<NEW_LINE>pc.updateAll(Arrays.asList(author, authUser));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | DOWN).getId())); |
1,618,371 | public void enterSid_trunk_group(A10Parser.Sid_trunk_groupContext ctx) {<NEW_LINE>TrunkGroup.Type type = ctx.trunk_type() != null ? toType(<MASK><NEW_LINE>Optional<Integer> maybeNum = toInteger(ctx, ctx.trunk_number());<NEW_LINE>if (!maybeNum.isPresent()) {<NEW_LINE>// dummy<NEW_LINE>_currentTrunkGroup = new TrunkGroup(-1, type);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int num = maybeNum.get();<NEW_LINE>Optional<String> maybeInvalidReason = isTrunkValidForCurrentIface(num, type);<NEW_LINE>if (maybeInvalidReason.isPresent()) {<NEW_LINE>warn(ctx, maybeInvalidReason.get());<NEW_LINE>// dummy<NEW_LINE>_currentTrunkGroup = new TrunkGroup(-1, type);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>setCurrentTrunkGroupAndReferences(num, type, ctx);<NEW_LINE>} | ctx.trunk_type()) : null; |
2,791 | public static MemorySize parse(String value, MemoryUnit defaultUnit) {<NEW_LINE>if (value == null || value.length() == 0) {<NEW_LINE>return new MemorySize(0, MemoryUnit.BYTES);<NEW_LINE>}<NEW_LINE>MemoryUnit unit = defaultUnit;<NEW_LINE>final char last = value.charAt(value.length() - 1);<NEW_LINE>if (!Character.isDigit(last)) {<NEW_LINE>value = value.substring(0, value.length() - 1);<NEW_LINE>switch(last) {<NEW_LINE>case 'g':<NEW_LINE>case 'G':<NEW_LINE>unit = MemoryUnit.GIGABYTES;<NEW_LINE>break;<NEW_LINE>case 'm':<NEW_LINE>case 'M':<NEW_LINE>unit = MemoryUnit.MEGABYTES;<NEW_LINE>break;<NEW_LINE>case 'k':<NEW_LINE>case 'K':<NEW_LINE>unit = MemoryUnit.KILOBYTES;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalArgumentException("Could not determine memory unit of " + value + last);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new MemorySize(Long<MASK><NEW_LINE>} | .parseLong(value), unit); |
1,012,613 | public void read(JmeImporter im) throws IOException {<NEW_LINE>super.read(im);<NEW_LINE>InputCapsule ic = im.getCapsule(this);<NEW_LINE>size = ic.readInt("size", 16);<NEW_LINE>totalSize = <MASK><NEW_LINE>quadrant = ic.readShort("quadrant", (short) 0);<NEW_LINE>stepScale = (Vector3f) ic.readSavable("stepScale", Vector3f.UNIT_XYZ);<NEW_LINE>offset = (Vector2f) ic.readSavable("offset", Vector3f.UNIT_XYZ);<NEW_LINE>offsetAmount = ic.readFloat("offsetAmount", 0);<NEW_LINE>// lodCalculator = (LodCalculator) ic.readSavable("lodCalculator", new DistanceLodCalculator());<NEW_LINE>// lodCalculator.setTerrainPatch(this);<NEW_LINE>// lodCalculatorFactory = (LodCalculatorFactory) ic.readSavable("lodCalculatorFactory", null);<NEW_LINE>lodEntropy = ic.readFloatArray("lodEntropy", null);<NEW_LINE>geomap = (LODGeomap) ic.readSavable("geomap", null);<NEW_LINE>Mesh regen = geomap.createMesh(stepScale, new Vector2f(1, 1), offset, offsetAmount, totalSize, false);<NEW_LINE>setMesh(regen);<NEW_LINE>// TangentBinormalGenerator.generate(this); // note that this will be removed<NEW_LINE>ensurePositiveVolumeBBox();<NEW_LINE>} | ic.readInt("totalSize", 16); |
381,781 | public void debugPrint(StringBuilder sb, int indent) {<NEW_LINE>indent(sb, indent);<NEW_LINE>sb.append("Scope: ").append(scopeId).append("\n");<NEW_LINE>indent(sb, indent + 1);<NEW_LINE>sb.append("Kind: ").append(scopeKind).append("\n");<NEW_LINE>Set<String> names = new HashSet<>();<NEW_LINE>for (Object id : getFrameIdentifiers()) {<NEW_LINE>names.add(id.toString());<NEW_LINE>}<NEW_LINE>indent(sb, indent + 1);<NEW_LINE>sb.append("FrameDescriptor: ");<NEW_LINE>printSet(sb, new TreeSet<>(names));<NEW_LINE>sb.append("\n");<NEW_LINE>indent(sb, indent + 1);<NEW_LINE>sb.append("CellVars: ");<NEW_LINE>printSet(sb, cellVars);<NEW_LINE>sb.append("\n");<NEW_LINE>indent(sb, indent + 1);<NEW_LINE>sb.append("FreeVars: ");<NEW_LINE>printSet(sb, freeVars);<NEW_LINE>sb.append("\n");<NEW_LINE>ScopeInfo child = firstChildScope;<NEW_LINE>while (child != null) {<NEW_LINE>child.<MASK><NEW_LINE>child = child.nextChildScope;<NEW_LINE>}<NEW_LINE>} | debugPrint(sb, indent + 1); |
449,360 | private List<LookupElement> fillModelByRelevance(LookupElementListPresenter lookup, Set<? extends LookupElement> items, Iterable<? extends LookupElement> sortedElements, @Nullable LookupElement relevantSelection) {<NEW_LINE>if (!sortedElements.iterator().hasNext()) {<NEW_LINE>return Collections.emptyList();<NEW_LINE>}<NEW_LINE>Iterator<? extends LookupElement> byRelevance = myFinalSorter.sort(sortedElements, Objects.requireNonNull(myProcess.getParameters())).iterator();<NEW_LINE>final LinkedHashSet<LookupElement> model = new LinkedHashSet<>();<NEW_LINE>addPrefixItems(model);<NEW_LINE>addFrozenItems(items, model);<NEW_LINE>if (model.size() < MAX_PREFERRED_COUNT) {<NEW_LINE>addSomeItems(model, byRelevance, lastAdded -> model.size() >= MAX_PREFERRED_COUNT);<NEW_LINE>}<NEW_LINE>addCurrentlySelectedItemToTop(lookup, items, model);<NEW_LINE>freezeTopItems(lookup, model);<NEW_LINE>ensureItemAdded(items, model, <MASK><NEW_LINE>ensureItemAdded(items, model, byRelevance, relevantSelection);<NEW_LINE>ContainerUtil.addAll(model, byRelevance);<NEW_LINE>return new ArrayList<>(model);<NEW_LINE>} | byRelevance, lookup.getCurrentItem()); |
875,440 | public static HistoricDecisionInputInstanceDto fromHistoricDecisionInputInstance(HistoricDecisionInputInstance historicDecisionInputInstance) {<NEW_LINE>HistoricDecisionInputInstanceDto dto = new HistoricDecisionInputInstanceDto();<NEW_LINE>dto.id = historicDecisionInputInstance.getId();<NEW_LINE>dto.decisionInstanceId = historicDecisionInputInstance.getDecisionInstanceId();<NEW_LINE>dto.clauseId = historicDecisionInputInstance.getClauseId();<NEW_LINE>dto.clauseName = historicDecisionInputInstance.getClauseName();<NEW_LINE>dto.createTime = historicDecisionInputInstance.getCreateTime();<NEW_LINE>dto<MASK><NEW_LINE>dto.rootProcessInstanceId = historicDecisionInputInstance.getRootProcessInstanceId();<NEW_LINE>if (historicDecisionInputInstance.getErrorMessage() == null) {<NEW_LINE>VariableValueDto.fromTypedValue(dto, historicDecisionInputInstance.getTypedValue());<NEW_LINE>} else {<NEW_LINE>dto.errorMessage = historicDecisionInputInstance.getErrorMessage();<NEW_LINE>dto.type = VariableValueDto.toRestApiTypeName(historicDecisionInputInstance.getTypeName());<NEW_LINE>}<NEW_LINE>return dto;<NEW_LINE>} | .removalTime = historicDecisionInputInstance.getRemovalTime(); |
993,041 | private static byte[] transformByteArray(@NonNull byte[] data, @Nullable Rect cropRect, int rotation, boolean flip) throws IOException {<NEW_LINE>Stopwatch stopwatch = new Stopwatch("transform");<NEW_LINE>Bitmap in;<NEW_LINE>if (cropRect != null) {<NEW_LINE>BitmapRegionDecoder decoder = BitmapRegionDecoder.newInstance(data, <MASK><NEW_LINE>in = decoder.decodeRegion(cropRect, new BitmapFactory.Options());<NEW_LINE>decoder.recycle();<NEW_LINE>stopwatch.split("crop");<NEW_LINE>} else {<NEW_LINE>in = BitmapFactory.decodeByteArray(data, 0, data.length);<NEW_LINE>}<NEW_LINE>Bitmap out = in;<NEW_LINE>if (rotation != 0 || flip) {<NEW_LINE>Matrix matrix = new Matrix();<NEW_LINE>matrix.postRotate(rotation);<NEW_LINE>if (flip) {<NEW_LINE>matrix.postScale(-1, 1);<NEW_LINE>matrix.postTranslate(in.getWidth(), 0);<NEW_LINE>}<NEW_LINE>out = Bitmap.createBitmap(in, 0, 0, in.getWidth(), in.getHeight(), matrix, true);<NEW_LINE>}<NEW_LINE>byte[] transformedData = toJpegBytes(out);<NEW_LINE>stopwatch.split("transcode");<NEW_LINE>in.recycle();<NEW_LINE>out.recycle();<NEW_LINE>stopwatch.stop(TAG);<NEW_LINE>return transformedData;<NEW_LINE>} | 0, data.length, false); |
63,736 | public ResultSet deserialize(JsonParser jsonParser, DeserializationContext ctx) throws IOException {<NEW_LINE>JsonNode node = jsonParser.getCodec().readTree(jsonParser);<NEW_LINE>ResultKind resultKind;<NEW_LINE>List<ColumnInfo> columns;<NEW_LINE>List<Boolean> changeFlags = null;<NEW_LINE>List<Row> data;<NEW_LINE>JsonNode resultKindNode = node.get(FIELD_NAME_RESULT_KIND);<NEW_LINE>if (resultKindNode != null) {<NEW_LINE>JsonParser resultKindParser = node.get(FIELD_NAME_RESULT_KIND).traverse();<NEW_LINE>resultKindParser.nextToken();<NEW_LINE>resultKind = ctx.readValue(resultKindParser, ResultKind.class);<NEW_LINE>} else {<NEW_LINE>throw new JsonParseException(jsonParser, "Field resultKind must be provided");<NEW_LINE>}<NEW_LINE>JsonNode columnNode = node.get(FIELD_NAME_COLUMNS);<NEW_LINE>if (columnNode != null) {<NEW_LINE>JsonParser columnParser = node.get(FIELD_NAME_COLUMNS).traverse();<NEW_LINE>columnParser.nextToken();<NEW_LINE>columns = Arrays.asList(ctx.readValue(columnParser, ColumnInfo[].class));<NEW_LINE>} else {<NEW_LINE>throw new JsonParseException(jsonParser, "Field column must be provided");<NEW_LINE>}<NEW_LINE>JsonNode <MASK><NEW_LINE>if (changeFlagNode != null) {<NEW_LINE>JsonParser changeFlagParser = changeFlagNode.traverse();<NEW_LINE>changeFlagParser.nextToken();<NEW_LINE>changeFlags = Arrays.asList(ctx.readValue(changeFlagParser, Boolean[].class));<NEW_LINE>}<NEW_LINE>JsonNode dataNode = node.get(FIELD_NAME_DATA);<NEW_LINE>if (dataNode != null) {<NEW_LINE>data = deserializeRows(columns, dataNode, ctx);<NEW_LINE>} else {<NEW_LINE>throw new JsonParseException(jsonParser, "Field data must be provided");<NEW_LINE>}<NEW_LINE>return ResultSet.builder().resultKind(resultKind).columns(columns).data(data).changeFlags(changeFlags).build();<NEW_LINE>} | changeFlagNode = node.get(FIELD_NAME_CHANGE_FLAGS); |
1,270,111 | public double evaluate(RecommendedList groundTruthList, RecommendedList recommendedList) {<NEW_LINE><MASK><NEW_LINE>int numItems = conf.getInt("rec.eval.item.num");<NEW_LINE>// First collect item counts needed for estimating probabilities of the items<NEW_LINE>// We want to calculate the probability of each item to be in the recommendation list.<NEW_LINE>// (This differs from the probability of the item purchased!)<NEW_LINE>int[] itemCounts = new int[numItems];<NEW_LINE>for (int contextIdx = 0; contextIdx < numUsers; contextIdx++) {<NEW_LINE>List<KeyValue<Integer, Double>> recoList = recommendedList.getKeyValueListByContext(contextIdx);<NEW_LINE>int topK = this.topN <= recoList.size() ? this.topN : recoList.size();<NEW_LINE>for (int recoIdx = 0; recoIdx < topK; recoIdx++) {<NEW_LINE>itemCounts[recoList.get(recoIdx).getKey()]++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>double sumEntropy = 0;<NEW_LINE>for (int count : itemCounts) {<NEW_LINE>if (count > 0) {<NEW_LINE>double estmProbability = ((double) count) / numUsers;<NEW_LINE>sumEntropy += estmProbability * (-Math.log(estmProbability));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// You can scale the unit of entropy to the well known 'Bit'-Unit by dividing by log(2)<NEW_LINE>// (Above we have used the natural logarithm instead of the logarithm with base 2)<NEW_LINE>return sumEntropy / Math.log(2);<NEW_LINE>} | int numUsers = groundTruthList.size(); |
913,586 | public JComponent createComponent() {<NEW_LINE>JBList list = new JBList(myModel);<NEW_LINE>ToolbarDecorator decorator = ToolbarDecorator.createDecorator(list);<NEW_LINE>decorator.disableUpDownActions();<NEW_LINE>decorator.setAddAction(new AnActionButtonRunnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(AnActionButton anActionButton) {<NEW_LINE>showAddOrChangeDialog(null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>decorator.setEditAction(new AnActionButtonRunnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run(AnActionButton anActionButton) {<NEW_LINE>JBList contextComponent = (JBList) anActionButton.getContextComponent();<NEW_LINE>showAddOrChangeDialog((String) contextComponent.getSelectedValue());<NEW_LINE>}<NEW_LINE>});<NEW_LINE>JPanel panel = new JPanel(new BorderLayout());<NEW_LINE>panel.add(decorator.createPanel(), BorderLayout.CENTER);<NEW_LINE>JTextPane textPane = new JTextPane();<NEW_LINE>textPane.setContentType("text/html");<NEW_LINE>textPane.setEditable(false);<NEW_LINE>textPane.setText("<html><body>" + "Use <b>!</b> to negate a pattern. " + "Accepted wildcards: <b>?</b> — exactly one symbol; <b>*</b> — zero or more symbols; " + "<b>/</b> — path separator; <b>/**/</b> — any number of directories; " + "<i><dir_name></i>:<i><pattern></i> — restrict to source roots with the specified name" + "</body></html>");<NEW_LINE>textPane.setForeground(new JBColor(Gray<MASK><NEW_LINE>panel.add(textPane, BorderLayout.SOUTH);<NEW_LINE>return panel;<NEW_LINE>} | ._50, Gray._130)); |
1,845,079 | static Errno writeToStream(Node node, WasmMemory memory, OutputStream stream, int iovecArrayAddress, int iovecCount, int sizeAddress) {<NEW_LINE>if (stream == null) {<NEW_LINE>return Errno.Acces;<NEW_LINE>}<NEW_LINE>int totalBytesWritten = 0;<NEW_LINE>try {<NEW_LINE>for (int i = 0; i < iovecCount; i++) {<NEW_LINE>final int iovecAddress <MASK><NEW_LINE>final int start = Iovec.readBuf(node, memory, iovecAddress);<NEW_LINE>final int len = Iovec.readBufLen(node, memory, iovecAddress);<NEW_LINE>for (int j = 0; j < len; j++) {<NEW_LINE>stream.write(memory.load_i32_8u(node, start + j));<NEW_LINE>++totalBytesWritten;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException e) {<NEW_LINE>return Errno.Io;<NEW_LINE>}<NEW_LINE>memory.store_i32(null, sizeAddress, totalBytesWritten);<NEW_LINE>return Errno.Success;<NEW_LINE>} | = iovecArrayAddress + i * Iovec.BYTES; |
620,676 | public void checkParentContract() {<NEW_LINE>_rootPackage.filterChildren(null).forEach((CtElement elem) -> {<NEW_LINE>// there is always one parent<NEW_LINE>assertTrue("no parent for " + elem.getClass() + "-" + elem.getPosition(), elem.isParentInitialized());<NEW_LINE>});<NEW_LINE>// the scanner and the parent are in correspondence<NEW_LINE>new CtScanner() {<NEW_LINE><NEW_LINE>Deque<CtElement> elementStack = new ArrayDeque<>();<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void scan(CtElement e) {<NEW_LINE>if (e == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (e instanceof CtReference) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!elementStack.isEmpty()) {<NEW_LINE>assertEquals(elementStack.peek(<MASK><NEW_LINE>}<NEW_LINE>elementStack.push(e);<NEW_LINE>e.accept(this);<NEW_LINE>elementStack.pop();<NEW_LINE>}<NEW_LINE>}.scan(_rootPackage);<NEW_LINE>} | ), e.getParent()); |
1,786,864 | protected final SuspendedResourcesHolder suspend(@Nullable Object transaction) throws TransactionException {<NEW_LINE>if (TransactionSynchronizationManager.isSynchronizationActive()) {<NEW_LINE>List<TransactionSynchronization> suspendedSynchronizations = doSuspendSynchronization();<NEW_LINE>try {<NEW_LINE>Object suspendedResources = null;<NEW_LINE>if (transaction != null) {<NEW_LINE>suspendedResources = doSuspend(transaction);<NEW_LINE>}<NEW_LINE>String name = TransactionSynchronizationManager.getCurrentTransactionName();<NEW_LINE>TransactionSynchronizationManager.setCurrentTransactionName(null);<NEW_LINE><MASK><NEW_LINE>TransactionSynchronizationManager.setCurrentTransactionReadOnly(false);<NEW_LINE>Integer isolationLevel = TransactionSynchronizationManager.getCurrentTransactionIsolationLevel();<NEW_LINE>TransactionSynchronizationManager.setCurrentTransactionIsolationLevel(null);<NEW_LINE>boolean wasActive = TransactionSynchronizationManager.isActualTransactionActive();<NEW_LINE>TransactionSynchronizationManager.setActualTransactionActive(false);<NEW_LINE>return new SuspendedResourcesHolder(suspendedResources, suspendedSynchronizations, name, readOnly, isolationLevel, wasActive);<NEW_LINE>} catch (RuntimeException | Error ex) {<NEW_LINE>// doSuspend failed - original transaction is still active...<NEW_LINE>doResumeSynchronization(suspendedSynchronizations);<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>} else if (transaction != null) {<NEW_LINE>// Transaction active but no synchronization active.<NEW_LINE>Object suspendedResources = doSuspend(transaction);<NEW_LINE>return new SuspendedResourcesHolder(suspendedResources);<NEW_LINE>} else {<NEW_LINE>// Neither transaction nor synchronization active.<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | boolean readOnly = TransactionSynchronizationManager.isCurrentTransactionReadOnly(); |
914,226 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>if (controller == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Exile all nontoken permanents.<NEW_LINE>Cards exiledCards = new CardsImpl();<NEW_LINE>for (Permanent permanent : game.getBattlefield().getActivePermanents(filter, source.getControllerId(), source, game)) {<NEW_LINE>exiledCards.add(permanent);<NEW_LINE>controller.moveCardsToExile(permanent, source, game, true, CardUtil.getCardExileZoneId(game, source.getSourceId()), "Thieves' Auction");<NEW_LINE>}<NEW_LINE>// Starting with you, each player<NEW_LINE>PlayerList playerList = game.getState().getPlayersInRange(controller.getId(), game);<NEW_LINE>Player player = playerList.getCurrent(game);<NEW_LINE>while (player != null && !exiledCards.isEmpty() && !game.hasEnded()) {<NEW_LINE>if (!player.canRespond()) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// chooses one of the exiled cards<NEW_LINE>TargetCard target = new TargetCardInExile(new FilterCard());<NEW_LINE>if (player.choose(Outcome.PutCardInPlay, exiledCards, target, game)) {<NEW_LINE>// and puts it onto the battlefield tapped under their control.<NEW_LINE>Card chosenCard = exiledCards.get(target.getFirstTarget(), game);<NEW_LINE>if (chosenCard != null) {<NEW_LINE>player.moveCards(chosenCard, Zone.BATTLEFIELD, source, game, true, false, false, null);<NEW_LINE>}<NEW_LINE>exiledCards.remove(chosenCard);<NEW_LINE>} else {<NEW_LINE>// TODO Why does this break?<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>// Repeat this process until all cards exiled this way have been chosen.<NEW_LINE>player = <MASK><NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | playerList.getNext(game, false); |
610,197 | private Map<String, Object> initMagicVariables() {<NEW_LINE>Map<String, Object> map = new HashMap();<NEW_LINE>if (!caller.isNone()) {<NEW_LINE>// karate principle: parent variables are always "visible"<NEW_LINE>// so we inject the parent variables<NEW_LINE>// but they will be over-written by what is local to this scenario<NEW_LINE>if (!caller.isSharedScope()) {<NEW_LINE>caller.parentRuntime.engine.vars.forEach((k, v) -> map.put(k, v == null ? null : v.getValue()));<NEW_LINE>}<NEW_LINE>map.putAll(caller.parentRuntime.magicVariables);<NEW_LINE>map.put("__arg", caller.arg == null ? null : caller.arg.getValue());<NEW_LINE>map.put("__loop", caller.getLoopIndex());<NEW_LINE>}<NEW_LINE>if (scenario.isOutlineExample() && !this.isDynamicBackground()) {<NEW_LINE>// init examples row magic variables<NEW_LINE>Map<String, Object> exampleData = scenario.getExampleData();<NEW_LINE>map.putAll(exampleData);<NEW_LINE><MASK><NEW_LINE>map.put("__num", scenario.getExampleIndex());<NEW_LINE>}<NEW_LINE>return map;<NEW_LINE>} | map.put("__row", exampleData); |
1,153,354 | public AggregationConfig unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AggregationConfig aggregationConfig = new AggregationConfig();<NEW_LINE><MASK><NEW_LINE>String currentParentElement = context.getCurrentParentElement();<NEW_LINE>int targetDepth = originalDepth + 1;<NEW_LINE>JsonToken token = context.getCurrentToken();<NEW_LINE>if (token == null)<NEW_LINE>token = context.nextToken();<NEW_LINE>if (token == VALUE_NULL) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>while (true) {<NEW_LINE>if (token == null)<NEW_LINE>break;<NEW_LINE>if (token == FIELD_NAME || token == START_OBJECT) {<NEW_LINE>if (context.testExpression("aggregationType", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>aggregationConfig.setAggregationType(context.getUnmarshaller(String.class).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return aggregationConfig;<NEW_LINE>} | int originalDepth = context.getCurrentDepth(); |
632,662 | public void rejectCertificateTransfer(RejectCertificateTransferRequest rejectCertificateTransferRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(rejectCertificateTransferRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<RejectCertificateTransferRequest> request = null;<NEW_LINE>Response<Void> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new RejectCertificateTransferRequestMarshaller().marshall(rejectCertificateTransferRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>JsonResponseHandler<Void> responseHandler = <MASK><NEW_LINE>invoke(request, responseHandler, executionContext);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC);<NEW_LINE>}<NEW_LINE>} | new JsonResponseHandler<Void>(null); |
121,631 | public List<OptExpression> transform(OptExpression input, OptimizerContext context) {<NEW_LINE>OptExpression aggOptExpression = input.getInputs().get(1);<NEW_LINE>OptExpression projectExpression = aggOptExpression.getInputs().get(0);<NEW_LINE>OptExpression filterExpression = projectExpression.getInputs().get(0);<NEW_LINE>LogicalApplyOperator apply = (LogicalApplyOperator) input.getOp();<NEW_LINE>LogicalAggregationOperator aggregate = (LogicalAggregationOperator) aggOptExpression.getOp();<NEW_LINE>LogicalProjectOperator lpo = (LogicalProjectOperator) projectExpression.getOp();<NEW_LINE>LogicalFilterOperator lfo = (LogicalFilterOperator) filterExpression.getOp();<NEW_LINE>List<ColumnRefOperator> filterInput = Utils.extractColumnRef(lfo.getPredicate());<NEW_LINE>filterInput.<MASK><NEW_LINE>Map<ColumnRefOperator, ScalarOperator> newProjectMap = Maps.newHashMap();<NEW_LINE>newProjectMap.putAll(lpo.getColumnRefMap());<NEW_LINE>filterInput.forEach(d -> newProjectMap.putIfAbsent(d, d));<NEW_LINE>projectExpression.getInputs().clear();<NEW_LINE>projectExpression.getInputs().addAll(filterExpression.getInputs());<NEW_LINE>OptExpression newProjectOptExpression = OptExpression.create(new LogicalProjectOperator(newProjectMap), filterExpression.getInputs());<NEW_LINE>OptExpression newFilterOptExpression = OptExpression.create(new LogicalFilterOperator(lfo.getPredicate()), newProjectOptExpression);<NEW_LINE>OptExpression newAggOptExpression = OptExpression.create(new LogicalAggregationOperator(aggregate.getType(), aggregate.getGroupingKeys(), aggregate.getAggregations()), newFilterOptExpression);<NEW_LINE>OptExpression newApplyOptExpression = OptExpression.create(new LogicalApplyOperator(apply.getOutput(), apply.getSubqueryOperator(), apply.getCorrelationColumnRefs(), apply.getCorrelationConjuncts(), apply.getPredicate(), apply.isNeedCheckMaxRows(), apply.isUseSemiAnti()), input.getInputs().get(0), newAggOptExpression);<NEW_LINE>return Lists.newArrayList(newApplyOptExpression);<NEW_LINE>} | removeAll(apply.getCorrelationColumnRefs()); |
751,082 | private void doFinish() {<NEW_LINE>CvsInstallerModuleConfig.getInstance().setCvsInstalled(true);<NEW_LINE>if (listener != null) {<NEW_LINE>OpenProjects.getDefault().removePropertyChangeListener(listener);<NEW_LINE>listener = null;<NEW_LINE>}<NEW_LINE>assert !EventQueue.isDispatchThread();<NEW_LINE>for (UpdateUnit u : UpdateManager.getDefault().getUpdateUnits()) {<NEW_LINE>if (INSTALLER_CODENAME.equals(u.getCodeName()) && u.getInstalled() != null && !u.isPending()) {<NEW_LINE>OperationContainer<OperationSupport> container = OperationContainer.createForUninstall();<NEW_LINE>if (container.canBeAdded(u, u.getInstalled())) {<NEW_LINE>container.add(u, u.getInstalled());<NEW_LINE>try {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.INFO, "doFinish: uninstalling");<NEW_LINE>OperationSupport support = container.getSupport();<NEW_LINE>Restarter <MASK><NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.INFO, "doFinish: uninstalled");<NEW_LINE>if (restarter != null) {<NEW_LINE>// NOI18N<NEW_LINE>LOG.log(Level.INFO, "doFinish: restart scheduled");<NEW_LINE>support.doRestartLater(restarter);<NEW_LINE>}<NEW_LINE>} catch (OperationException ex) {<NEW_LINE>LOG.log(Level.INFO, null, ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | restarter = support.doOperation(null); |
1,626,142 | protected void addSubElements(JRPrintElementContainer printContainer, JRFillElement element, Collection<? extends JRPrintElement> printElements) {<NEW_LINE>if (printContainer instanceof OffsetElementsContainer) {<NEW_LINE>// adding the subelements as whole lists to bands so that we don't need<NEW_LINE>// another virtualized list at print band level<NEW_LINE>((OffsetElementsContainer) printContainer).addOffsetElements(printElements, element.getX(<MASK><NEW_LINE>} else {<NEW_LINE>if (printElements != null && printElements.size() > 0) {<NEW_LINE>for (Iterator<? extends JRPrintElement> it = printElements.iterator(); it.hasNext(); ) {<NEW_LINE>JRPrintElement printElement = it.next();<NEW_LINE>printElement.setX(element.getX() + printElement.getX());<NEW_LINE>printElement.setY(element.getRelativeY() + printElement.getY());<NEW_LINE>printContainer.addElement(printElement);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ), element.getRelativeY()); |
895,707 | public void discoverChildren() {<NEW_LINE>try {<NEW_LINE>ArrayList<SubtitleItem> subtitleItems = OpenSubtitle.findSubtitles(originalResource, getDefaultRenderer());<NEW_LINE>if (subtitleItems == null || subtitleItems.isEmpty()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Collections.sort(subtitleItems, new SubSort(getDefaultRenderer()));<NEW_LINE>reduceSubtitles(subtitleItems, configuration.getLiveSubtitlesLimit());<NEW_LINE>LOGGER.trace("Discovery of OpenSubtitles subtitles for \"{}\" resulted in the following after sorting and reduction:\n{}", getName(), OpenSubtitle.toLogString(subtitleItems, 2));<NEW_LINE>for (SubtitleItem subtitleItem : subtitleItems) {<NEW_LINE>LOGGER.debug("Adding live subtitles child \"{}\" for {}", subtitleItem.getSubFileName(), originalResource);<NEW_LINE>DLNAMediaOpenSubtitle subtitle = new DLNAMediaOpenSubtitle(subtitleItem);<NEW_LINE><MASK><NEW_LINE>if (liveResource.getMedia() != null) {<NEW_LINE>liveResource.getMedia().setSubtitlesTracks(new ArrayList<>());<NEW_LINE>liveResource.getMedia().addSubtitlesTrack(subtitle);<NEW_LINE>}<NEW_LINE>liveResource.setMediaSubtitle(subtitle);<NEW_LINE>liveResource.resetSubtitlesStatus();<NEW_LINE>addChild(liveResource);<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("An unhandled error occurred during OpenSubtitles subtitles lookup for \"{}\": {}", getName(), e.getMessage());<NEW_LINE>LOGGER.trace("", e);<NEW_LINE>}<NEW_LINE>} | DLNAResource liveResource = originalResource.clone(); |
293,225 | public TreeSet<byte[]> /* peer-b64-hashes/ipport */<NEW_LINE>clusterHashes(final String clusterdefinition) {<NEW_LINE>// collects seeds according to cluster definition string, which consists of<NEW_LINE>// comma-separated .yacy or .yacyh-domains<NEW_LINE>// the domain may be extended by an alternative address specification of the form<NEW_LINE>// <ip> or <ip>:<port>. The port must be identical to the port specified in the peer seed,<NEW_LINE>// therefore it is optional. The address specification is separated by a '='; the complete<NEW_LINE>// address has therefore the form<NEW_LINE>// address ::= (<peername>'.yacy'|<peerhexhash>'.yacyh'){'='<ip>{':'<port}}<NEW_LINE>// clusterdef ::= {address}{','address}*<NEW_LINE>final String[] addresses = (clusterdefinition.isEmpty()) ? new String[0] : CommonPattern.COMMA.split(clusterdefinition);<NEW_LINE>final TreeSet<byte[]> clustermap = new TreeSet<>(Base64Order.enhancedCoder);<NEW_LINE>Seed seed;<NEW_LINE>String hash, yacydom;<NEW_LINE>int p;<NEW_LINE>for (final String addresse : addresses) {<NEW_LINE>p = addresse.indexOf('=');<NEW_LINE>if (p >= 0) {<NEW_LINE>yacydom = <MASK><NEW_LINE>} else {<NEW_LINE>yacydom = addresse;<NEW_LINE>}<NEW_LINE>if (yacydom.endsWith(".yacyh")) {<NEW_LINE>// find a peer with its hexhash<NEW_LINE>hash = Seed.hexHash2b64Hash(yacydom.substring(0, yacydom.length() - 6));<NEW_LINE>seed = get(hash);<NEW_LINE>if (seed == null) {<NEW_LINE>Network.log.warn("cluster peer '" + yacydom + "' was not found.");<NEW_LINE>} else {<NEW_LINE>clustermap.add(ASCII.getBytes(hash));<NEW_LINE>}<NEW_LINE>} else if (yacydom.endsWith(".yacy")) {<NEW_LINE>// find a peer with its name<NEW_LINE>seed = lookupByName(yacydom.substring(0, yacydom.length() - 5));<NEW_LINE>if (seed == null) {<NEW_LINE>Network.log.warn("cluster peer '" + yacydom + "' was not found.");<NEW_LINE>} else {<NEW_LINE>clustermap.add(ASCII.getBytes(seed.hash));<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Network.log.warn("cluster peer '" + addresse + "' has wrong syntax. the name must end with .yacy or .yacyh");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return clustermap;<NEW_LINE>} | addresse.substring(0, p); |
264,406 | public static void initGeneratedColumn(final Table table, final String fileProperty) {<NEW_LINE>final ComponentsFactory componentsFactory = AppBeans.get(ComponentsFactory.NAME);<NEW_LINE>final ExportDisplay exportDisplay = <MASK><NEW_LINE>table.addGeneratedColumn(fileProperty + ".name", new Table.ColumnGenerator() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Component generateCell(final Entity entity) {<NEW_LINE>final FileDescriptor fd = entity.getValueEx(fileProperty);<NEW_LINE>if (fd == null) {<NEW_LINE>return componentsFactory.createComponent(Label.class);<NEW_LINE>}<NEW_LINE>if (PersistenceHelper.isNew(fd)) {<NEW_LINE>Label label = componentsFactory.createComponent(Label.class);<NEW_LINE>label.setValue(fd.getName());<NEW_LINE>return label;<NEW_LINE>} else {<NEW_LINE>Button button = componentsFactory.createComponent(Button.class);<NEW_LINE>button.setStyleName("link");<NEW_LINE>button.setAction(new AbstractAction("download") {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void actionPerform(Component component) {<NEW_LINE>exportDisplay.show(fd);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String getCaption() {<NEW_LINE>return fd.getName();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return button;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | AppBeans.get(ExportDisplay.NAME); |
828,373 | private void updateTaskCleanupTimeout(Set<String> topologies) {<NEW_LINE>Map topologyConf = null;<NEW_LINE>Map<String, Integer> taskCleanupTimeouts = new HashMap<>();<NEW_LINE>for (String topologyId : topologies) {<NEW_LINE>try {<NEW_LINE>topologyConf = StormConfig.read_supervisor_topology_conf(conf, topologyId);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.info("Failed to read conf for " + topologyId);<NEW_LINE>}<NEW_LINE>Integer cleanupTimeout = null;<NEW_LINE>if (topologyConf != null) {<NEW_LINE>cleanupTimeout = JStormUtils.parseInt(topologyConf.get(ConfigExtension.TASK_CLEANUP_TIMEOUT_SEC));<NEW_LINE>}<NEW_LINE>if (cleanupTimeout == null) {<NEW_LINE>cleanupTimeout = ConfigExtension.getTaskCleanupTimeoutSec(conf);<NEW_LINE>}<NEW_LINE>taskCleanupTimeouts.put(topologyId, cleanupTimeout);<NEW_LINE>}<NEW_LINE>Map<String, Integer> localTaskCleanupTimeouts = null;<NEW_LINE>try {<NEW_LINE>localTaskCleanupTimeouts = (Map<String, Integer>) localState.get(Common.LS_TASK_CLEANUP_TIMEOUT);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.error("Failed to read local task cleanup timeout map", e);<NEW_LINE>}<NEW_LINE>if (localTaskCleanupTimeouts == null)<NEW_LINE>localTaskCleanupTimeouts = taskCleanupTimeouts;<NEW_LINE>else<NEW_LINE>localTaskCleanupTimeouts.putAll(taskCleanupTimeouts);<NEW_LINE>try {<NEW_LINE>localState.put(Common.LS_TASK_CLEANUP_TIMEOUT, localTaskCleanupTimeouts);<NEW_LINE>} catch (IOException e) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} | LOG.error("Failed to write local task cleanup timeout map", e); |
959,922 | public static DescribeAccessPointsResponse unmarshall(DescribeAccessPointsResponse describeAccessPointsResponse, UnmarshallerContext _ctx) {<NEW_LINE>describeAccessPointsResponse.setRequestId(_ctx.stringValue("DescribeAccessPointsResponse.RequestId"));<NEW_LINE>describeAccessPointsResponse.setPageNumber(_ctx.integerValue("DescribeAccessPointsResponse.PageNumber"));<NEW_LINE>describeAccessPointsResponse.setPageSize(_ctx.integerValue("DescribeAccessPointsResponse.PageSize"));<NEW_LINE>describeAccessPointsResponse.setTotalCount<MASK><NEW_LINE>List<AccessPointType> accessPointSet = new ArrayList<AccessPointType>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("DescribeAccessPointsResponse.AccessPointSet.Length"); i++) {<NEW_LINE>AccessPointType accessPointType = new AccessPointType();<NEW_LINE>accessPointType.setStatus(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].Status"));<NEW_LINE>accessPointType.setType(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].Type"));<NEW_LINE>accessPointType.setHostOperator(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].HostOperator"));<NEW_LINE>accessPointType.setDescription(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].Description"));<NEW_LINE>accessPointType.setAttachedRegionNo(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].AttachedRegionNo"));<NEW_LINE>accessPointType.setName(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].Name"));<NEW_LINE>accessPointType.setAccessPointId(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].AccessPointId"));<NEW_LINE>accessPointType.setLocation(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].Location"));<NEW_LINE>List<AccessPointFeatureModel> accessPointFeatureModels = new ArrayList<AccessPointFeatureModel>();<NEW_LINE>for (int j = 0; j < _ctx.lengthValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].AccessPointFeatureModels.Length"); j++) {<NEW_LINE>AccessPointFeatureModel accessPointFeatureModel = new AccessPointFeatureModel();<NEW_LINE>accessPointFeatureModel.setFeatureValue(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].AccessPointFeatureModels[" + j + "].FeatureValue"));<NEW_LINE>accessPointFeatureModel.setFeatureKey(_ctx.stringValue("DescribeAccessPointsResponse.AccessPointSet[" + i + "].AccessPointFeatureModels[" + j + "].FeatureKey"));<NEW_LINE>accessPointFeatureModels.add(accessPointFeatureModel);<NEW_LINE>}<NEW_LINE>accessPointType.setAccessPointFeatureModels(accessPointFeatureModels);<NEW_LINE>accessPointSet.add(accessPointType);<NEW_LINE>}<NEW_LINE>describeAccessPointsResponse.setAccessPointSet(accessPointSet);<NEW_LINE>return describeAccessPointsResponse;<NEW_LINE>} | (_ctx.integerValue("DescribeAccessPointsResponse.TotalCount")); |
532,518 | private void createEntries(YearMonth month) {<NEW_LINE>for (int i = 1; i < 28; i++) {<NEW_LINE>LocalDate date = month.atDay(i);<NEW_LINE>for (int j = 0; j < (int) (Math.random() * 7); j++) {<NEW_LINE>Entry<?> entry = new Entry<>();<NEW_LINE>entry.setTitle("Entry " + (j + 1));<NEW_LINE>int hour = (int) (Math.random() * 21);<NEW_LINE>int durationInHours = Math.min(24 - hour, (int) (Math.random() * 4));<NEW_LINE>LocalTime startTime = LocalTime.of(hour, 0);<NEW_LINE>LocalTime endTime = startTime.plusHours(durationInHours);<NEW_LINE>entry.setInterval(date, startTime, date.plusDays((int) (Math.random(<MASK><NEW_LINE>if (Math.random() < .3) {<NEW_LINE>entry.setFullDay(true);<NEW_LINE>}<NEW_LINE>entry.setCalendar(this);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ) * 4)), endTime); |
1,658,280 | public static void main(String[] argv) {<NEW_LINE>Random ran = new Random();<NEW_LINE>int len = 102;<NEW_LINE>int numBits = 4;<NEW_LINE>double[] dArr = new double[len];<NEW_LINE>float[] fArr = new float[len];<NEW_LINE>for (int i = 0; i < dArr.length; i++) {<NEW_LINE>dArr[i] = ran.nextDouble() - 0.5;<NEW_LINE>}<NEW_LINE>ByteBuf <MASK><NEW_LINE>JCompressUtils.Quantification.serializeDouble(buf1, dArr, numBits);<NEW_LINE>JCompressUtils.Quantification.deserializeDouble(buf1);<NEW_LINE>for (int i = 0; i < dArr.length; i++) {<NEW_LINE>fArr[i] = (float) dArr[i];<NEW_LINE>}<NEW_LINE>ByteBuf buf2 = Unpooled.buffer(1000);<NEW_LINE>JCompressUtils.Quantification.serializeFloat(buf2, fArr, numBits);<NEW_LINE>JCompressUtils.Quantification.deserializeFloat(buf2);<NEW_LINE>} | buf1 = Unpooled.buffer(1000); |
130,907 | private <T extends JpaObject> String idleNameWithPortal(Business business, String portalId, String name, Class<T> cls, String excludeId) throws Exception {<NEW_LINE>if (StringUtils.isEmpty(name)) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>List<String> list = new ArrayList<>();<NEW_LINE>list.add(name);<NEW_LINE>for (int i = 1; i < 99; i++) {<NEW_LINE>list.add(name + String.format("%02d", i));<NEW_LINE>}<NEW_LINE>list.add(StringTools.uniqueToken());<NEW_LINE>EntityManager em = business.entityManagerContainer().get(cls);<NEW_LINE><MASK><NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<T> root = cq.from(cls);<NEW_LINE>Predicate p = root.get("name").in(list);<NEW_LINE>p = cb.and(p, cb.equal(root.get("portal"), portalId));<NEW_LINE>if (StringUtils.isNotEmpty(excludeId)) {<NEW_LINE>p = cb.and(p, cb.notEqual(root.get(JpaObject.id_FIELDNAME), excludeId));<NEW_LINE>}<NEW_LINE>cq.select(root.get("name")).where(p);<NEW_LINE>List<String> os = em.createQuery(cq).getResultList();<NEW_LINE>list = ListUtils.subtract(list, os);<NEW_LINE>return list.get(0);<NEW_LINE>} | CriteriaBuilder cb = em.getCriteriaBuilder(); |
538,174 | public Callable<ResponseEntity<String>> elidePatch(@RequestHeader HttpHeaders requestHeaders, @RequestParam MultiValueMap<String, String> allRequestParams, @RequestBody String body, HttpServletRequest request, Authentication authentication) {<NEW_LINE>final String apiVersion = HeaderUtils.resolveApiVersion(requestHeaders);<NEW_LINE>final Map<String, List<String>> requestHeadersCleaned = HeaderUtils.lowercaseAndRemoveAuthHeaders(requestHeaders);<NEW_LINE>final String pathname = getJsonApiPath(request, settings.getJsonApi().getPath());<NEW_LINE>final <MASK><NEW_LINE>final String baseUrl = getBaseUrlEndpoint();<NEW_LINE>return new Callable<ResponseEntity<String>>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ResponseEntity<String> call() throws Exception {<NEW_LINE>ElideResponse response = elide.patch(baseUrl, request.getContentType(), request.getContentType(), pathname, body, convert(allRequestParams), requestHeadersCleaned, user, apiVersion, UUID.randomUUID());<NEW_LINE>return ResponseEntity.status(response.getResponseCode()).body(response.getBody());<NEW_LINE>}<NEW_LINE>};<NEW_LINE>} | User user = new AuthenticationUser(authentication); |
847,049 | public void testTaskSchedulesAnotherTask(PrintWriter out) throws Exception {<NEW_LINE>SchedulingTask task = new SchedulingTask();<NEW_LINE>task.getExecutionProperties().put(AutoPurge.PROPERTY_NAME, AutoPurge.NEVER.toString());<NEW_LINE>TaskStatus<Long> status = scheduler.schedule(task, 26, TimeUnit.MICROSECONDS);<NEW_LINE>for (long start = System.nanoTime(); !status.hasResult() && System.nanoTime() - start < TIMEOUT_NS; Thread.sleep(POLL_INTERVAL)) status = scheduler.getStatus(status.getTaskId());<NEW_LINE>if (!status.isDone() || status.isCancelled())<NEW_LINE><MASK><NEW_LINE>Long idOfTaskScheduledByTask = status.get();<NEW_LINE>TaskStatus<Integer> status2 = scheduler.getStatus(idOfTaskScheduledByTask);<NEW_LINE>for (long start = System.nanoTime(); !status2.hasResult() && System.nanoTime() - start < TIMEOUT_NS; Thread.sleep(POLL_INTERVAL)) status2 = scheduler.getStatus(status2.getTaskId());<NEW_LINE>if (!status2.isDone() || status2.isCancelled())<NEW_LINE>throw new Exception("Second task did not complete successfully in allotted interval. " + status2);<NEW_LINE>Integer result = status2.get();<NEW_LINE>if (!Integer.valueOf(1).equals(result))<NEW_LINE>throw new Exception("Unexpected result for task scheduled by task. " + result);<NEW_LINE>} | throw new Exception("Task did not complete successfully in allotted interval. " + status); |
146,552 | public StringBuilder append(long value, int minLength, char prefix) {<NEW_LINE>if (value == Long.MIN_VALUE) {<NEW_LINE>append0("-9223372036854775808");<NEW_LINE>return this;<NEW_LINE>}<NEW_LINE>if (value < 0L) {<NEW_LINE>append0('-');<NEW_LINE>value = -value;<NEW_LINE>}<NEW_LINE>if (minLength > 1) {<NEW_LINE>for (int j = minLength - numChars(value, 10); j > 0; --j) append(prefix);<NEW_LINE>}<NEW_LINE>if (value >= 10000) {<NEW_LINE>if (value >= 1000000000000000000L)<NEW_LINE>append0(digits[(int) (value % 10000000000000000000D / 1000000000000000000L)]);<NEW_LINE>if (value >= 100000000000000000L)<NEW_LINE>append0(digits[(int) (value % 1000000000000000000L / 100000000000000000L)]);<NEW_LINE>if (value >= 10000000000000000L)<NEW_LINE>append0(digits[(int) (value % 100000000000000000L / 10000000000000000L)]);<NEW_LINE>if (value >= 1000000000000000L)<NEW_LINE>append0(digits[(int) (value % 10000000000000000L / 1000000000000000L)]);<NEW_LINE>if (value >= 100000000000000L)<NEW_LINE>append0(digits[(int) (value % 1000000000000000L / 100000000000000L)]);<NEW_LINE>if (value >= 10000000000000L)<NEW_LINE>append0(digits[(int) (<MASK><NEW_LINE>if (value >= 1000000000000L)<NEW_LINE>append0(digits[(int) (value % 10000000000000L / 1000000000000L)]);<NEW_LINE>if (value >= 100000000000L)<NEW_LINE>append0(digits[(int) (value % 1000000000000L / 100000000000L)]);<NEW_LINE>if (value >= 10000000000L)<NEW_LINE>append0(digits[(int) (value % 100000000000L / 10000000000L)]);<NEW_LINE>if (value >= 1000000000L)<NEW_LINE>append0(digits[(int) (value % 10000000000L / 1000000000L)]);<NEW_LINE>if (value >= 100000000L)<NEW_LINE>append0(digits[(int) (value % 1000000000L / 100000000L)]);<NEW_LINE>if (value >= 10000000L)<NEW_LINE>append0(digits[(int) (value % 100000000L / 10000000L)]);<NEW_LINE>if (value >= 1000000L)<NEW_LINE>append0(digits[(int) (value % 10000000L / 1000000L)]);<NEW_LINE>if (value >= 100000L)<NEW_LINE>append0(digits[(int) (value % 1000000L / 100000L)]);<NEW_LINE>append0(digits[(int) (value % 100000L / 10000L)]);<NEW_LINE>}<NEW_LINE>if (value >= 1000L)<NEW_LINE>append0(digits[(int) (value % 10000L / 1000L)]);<NEW_LINE>if (value >= 100L)<NEW_LINE>append0(digits[(int) (value % 1000L / 100L)]);<NEW_LINE>if (value >= 10L)<NEW_LINE>append0(digits[(int) (value % 100L / 10L)]);<NEW_LINE>append0(digits[(int) (value % 10L)]);<NEW_LINE>return this;<NEW_LINE>} | value % 100000000000000L / 10000000000000L)]); |
1,299,203 | public boolean shouldOverrideUrlLoading(WebView view, String url) {<NEW_LINE><MASK><NEW_LINE>boolean isWebPage = url.startsWith(PAGE_PREFIX_HTTP) || url.startsWith(PAGE_PREFIX_HTTPS);<NEW_LINE>if (url.contains(WIKIVOYAGE_DOMAIN) && isWebPage) {<NEW_LINE>WikivoyageUtils.processWikivoyageDomain(activity, url, nightMode);<NEW_LINE>return true;<NEW_LINE>} else if (url.contains(WIKI_DOMAIN) && isWebPage && article != null) {<NEW_LINE>LatLon defaultCoordinates = new LatLon(article.getLat(), article.getLon());<NEW_LINE>WikivoyageUtils.processWikipediaDomain(wikiArticleHelper, defaultCoordinates, url);<NEW_LINE>} else if (isWebPage) {<NEW_LINE>WikiArticleHelper.warnAboutExternalLoad(url, activity, nightMode);<NEW_LINE>} else if (url.startsWith(PREFIX_GEO)) {<NEW_LINE>if (article != null && article.getGpxFile() != null) {<NEW_LINE>GPXFile gpxFile = article.getGpxFile();<NEW_LINE>List<WptPt> points = gpxFile.getPoints();<NEW_LINE>String coordinates = url.replace(PREFIX_GEO, "");<NEW_LINE>WptPt gpxPoint = WikivoyageUtils.findNearestPoint(points, coordinates);<NEW_LINE>if (gpxPoint != null) {<NEW_LINE>OsmandSettings settings = app.getSettings();<NEW_LINE>settings.setMapLocationToShow(gpxPoint.getLatitude(), gpxPoint.getLongitude(), settings.getLastKnownMapZoom(), new PointDescription(PointDescription.POINT_TYPE_WPT, gpxPoint.name), false, gpxPoint);<NEW_LINE>if (activity instanceof WikivoyageExploreActivity) {<NEW_LINE>WikivoyageExploreActivity exploreActivity = (WikivoyageExploreActivity) activity;<NEW_LINE>exploreActivity.setArticle(article);<NEW_LINE>}<NEW_LINE>fragmentManager.popBackStackImmediate();<NEW_LINE>File path = app.getTravelHelper().createGpxFile(article);<NEW_LINE>gpxFile.path = path.getAbsolutePath();<NEW_LINE>app.getSelectedGpxHelper().setGpxFileToDisplay(gpxFile);<NEW_LINE>MapActivity.launchMapActivityMoveToTop(activity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));<NEW_LINE>AndroidUtils.startActivityIfSafe(activity, intent);<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | url = WikiArticleHelper.normalizeFileUrl(url); |
1,086,556 | public static AlternateMailbox loadFromXml(final EwsXmlReader reader) throws Exception {<NEW_LINE>final AlternateMailbox altMailbox = new AlternateMailbox();<NEW_LINE>do {<NEW_LINE>reader.read();<NEW_LINE>if (reader.getNodeType().getNodeType() == XmlNodeType.START_ELEMENT) {<NEW_LINE>if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Type)) {<NEW_LINE>altMailbox.setType(reader.readElementValue(String.class));<NEW_LINE>} else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.DisplayName)) {<NEW_LINE>altMailbox.setDisplayName(reader.readElementValue(String.class));<NEW_LINE>} else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.LegacyDN)) {<NEW_LINE>altMailbox.setLegacyDN(reader.readElementValue(String.class));<NEW_LINE>} else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.Server)) {<NEW_LINE>altMailbox.setServer(reader.readElementValue(String.class));<NEW_LINE>} else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.SmtpAddress)) {<NEW_LINE>altMailbox.setSmtpAddress(reader<MASK><NEW_LINE>} else if (reader.getLocalName().equalsIgnoreCase(XmlElementNames.OwnerSmtpAddress)) {<NEW_LINE>altMailbox.setOwnerSmtpAddress(reader.readElementValue(String.class));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} while (!reader.isEndElement(XmlNamespace.Autodiscover, XmlElementNames.AlternateMailbox));<NEW_LINE>return altMailbox;<NEW_LINE>} | .readElementValue(String.class)); |
254,878 | private boolean updateTooltip() {<NEW_LINE>String displayName = getDisplayName();<NEW_LINE>if (displayName.startsWith("#")) {<NEW_LINE>// NOI18N<NEW_LINE>// NOI18N<NEW_LINE>displayName = displayName.replaceFirst("#", "");<NEW_LINE>}<NEW_LINE>String oldTooltip = tooltip;<NEW_LINE>String status = isFinished() ? Bundle.LBL_Task_tooltip_status_completed() : Bundle.LBL_Task_tooltip_status_open();<NEW_LINE>String scheduledLabel = Bundle.CTL_Issue_Scheduled_Title();<NEW_LINE>String scheduled = getScheduleDisplayString();<NEW_LINE>String dueLabel = Bundle.CTL_Issue_Due_Title();<NEW_LINE>String due = getDueDisplayString();<NEW_LINE>String estimateLabel = Bundle.CTL_Issue_Estimate_Title();<NEW_LINE>String estimate = getEstimateDisplayString();<NEW_LINE>// NOI18N<NEW_LINE>String // NOI18N<NEW_LINE>fieldTable = // NOI18N<NEW_LINE>"<table>" + "<tr><td><b>" + Bundle.LBL_Task_tooltip_statusLabel() + ":</b></td><td>" + status + "</td></tr>";<NEW_LINE>if (!scheduled.isEmpty()) {<NEW_LINE>// NOI18N<NEW_LINE>fieldTable += "<tr><td><b>" + scheduledLabel + ":</b></td><td>" + scheduled + "</td></tr>";<NEW_LINE>}<NEW_LINE>if (!due.isEmpty()) {<NEW_LINE>// NOI18N<NEW_LINE>fieldTable += "<tr><td><b>" + dueLabel + ":</b></td><td>" + due + "</td></tr>";<NEW_LINE>}<NEW_LINE>if (!estimate.isEmpty()) {<NEW_LINE>// NOI18N<NEW_LINE>fieldTable += "<tr><td><b>" <MASK><NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>fieldTable += "</table>";<NEW_LINE>// NOI18N<NEW_LINE>StringBuilder sb = new StringBuilder("<html>");<NEW_LINE>// NOI18N<NEW_LINE>sb.append("<b>").append(displayName).append("</b>");<NEW_LINE>// NOI18N<NEW_LINE>sb.append("<hr>");<NEW_LINE>sb.append(fieldTable);<NEW_LINE>// NOI18N<NEW_LINE>sb.append("</html>");<NEW_LINE>tooltip = sb.toString();<NEW_LINE>return !oldTooltip.equals(tooltip);<NEW_LINE>} | + estimateLabel + ":</b></td><td>" + estimate + "</td></tr>"; |
780,383 | protected void processMessage(CharSequence methodName, MessageHistory history) {<NEW_LINE>CharSequence extraHistoId = histosByMethod ? ("_" + methodName) : "";<NEW_LINE>long lastTime = 0;<NEW_LINE>// if the tailer has recordHistory(true) then the MessageHistory will be<NEW_LINE>// written with a single timing and nothing else. This is then carried through<NEW_LINE>int firstWriteOffset = history.timings() - (history.sources() * 2);<NEW_LINE>if (!(firstWriteOffset == 0 || firstWriteOffset == 1)) {<NEW_LINE>Jvm.warn().on(getClass(), "firstWriteOffset is not 0 or 1 for " + history);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (int sourceIndex = 0; sourceIndex < history.sources(); sourceIndex++) {<NEW_LINE>String histoId = Integer.toString(history.sourceId(sourceIndex)) + extraHistoId;<NEW_LINE>Histogram histo = histos.computeIfAbsent(histoId, s -> histogram());<NEW_LINE>long receivedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset);<NEW_LINE>long processedByThisComponent = history.timing((2 * sourceIndex) + firstWriteOffset + 1);<NEW_LINE>histo.sample((double) (processedByThisComponent - receivedByThisComponent));<NEW_LINE>if (lastTime == 0 && firstWriteOffset > 0) {<NEW_LINE>Histogram histo1 = histos.computeIfAbsent("startTo" + histoId, s -> histogram());<NEW_LINE>histo1.sample((double) (receivedByThisComponent - history.timing(0)));<NEW_LINE>} else if (lastTime != 0) {<NEW_LINE>Histogram histo1 = histos.computeIfAbsent(history.sourceId(sourceIndex - 1) + "to" + <MASK><NEW_LINE>// here we are comparing System.nanoTime across processes. YMMV<NEW_LINE>histo1.sample((double) (receivedByThisComponent - lastTime));<NEW_LINE>}<NEW_LINE>lastTime = processedByThisComponent;<NEW_LINE>}<NEW_LINE>if (history.sources() > 1) {<NEW_LINE>Histogram histoE2E = histos.computeIfAbsent("endToEnd", s -> histogram());<NEW_LINE>histoE2E.sample((double) (history.timing(history.timings() - 1) - history.timing(0)));<NEW_LINE>}<NEW_LINE>} | histoId, s -> histogram()); |
424,261 | public int compare(NodeResources a, NodeResources b) {<NEW_LINE>if (a.memoryGb() > b.memoryGb())<NEW_LINE>return 1;<NEW_LINE>if (a.memoryGb() < b.memoryGb())<NEW_LINE>return -1;<NEW_LINE>if (a.diskGb() > b.diskGb())<NEW_LINE>return 1;<NEW_LINE>if (a.diskGb() < b.diskGb())<NEW_LINE>return -1;<NEW_LINE>if (a.vcpu() > b.vcpu())<NEW_LINE>return 1;<NEW_LINE>if (a.vcpu() < b.vcpu())<NEW_LINE>return -1;<NEW_LINE>int storageTypeComparison = NodeResources.StorageType.compare(a.storageType(), b.storageType());<NEW_LINE>if (storageTypeComparison != 0)<NEW_LINE>return storageTypeComparison;<NEW_LINE>return compare(a.diskSpeed(<MASK><NEW_LINE>} | ), b.diskSpeed()); |
1,043,605 | protected ExtendedIterator<Triple> graphBaseFind(String _gName, TripleMatch tm) {<NEW_LINE>StringBuilder sb = new StringBuilder("sparql ");<NEW_LINE>Node nS, nP, nO;<NEW_LINE>checkOpen();<NEW_LINE>appendSparqlPrefixes(sb);<NEW_LINE>if (readFromAllGraphs && _gName == null)<NEW_LINE>sb.append(" select * where { ");<NEW_LINE>else<NEW_LINE>sb.append(" select * from <" + (_gName != null ? _gName : graphName) + "> where { ");<NEW_LINE>nS = tm.getMatchSubject();<NEW_LINE>nP = tm.getMatchPredicate();<NEW_LINE>nO = tm.getMatchObject();<NEW_LINE>if (nP != null && nP.isBlank())<NEW_LINE>throw new JenaException("BNode could not be used as Predicate");<NEW_LINE>sb.append(' ');<NEW_LINE>if (nS != null)<NEW_LINE>sb.append("`iri(??)`");<NEW_LINE>else<NEW_LINE>sb.append("?s");<NEW_LINE>sb.append(' ');<NEW_LINE>if (nP != null)<NEW_LINE>sb.append("`iri(??)`");<NEW_LINE>else<NEW_LINE>sb.append("?p");<NEW_LINE>sb.append(' ');<NEW_LINE>if (nO != null)<NEW_LINE>sb.append("`bif:__rdf_long_from_batch_params(??,??,??)`");<NEW_LINE>else<NEW_LINE>sb.append("?o");<NEW_LINE>sb.append(" }");<NEW_LINE>try {<NEW_LINE>java.sql.PreparedStatement ps = prepareStatement(sb.toString());<NEW_LINE>int col = 1;<NEW_LINE>if (nS != null)<NEW_LINE>bindSubject(ps, col++, nS);<NEW_LINE>if (nP != null)<NEW_LINE>bindPredicate(ps, col++, nP);<NEW_LINE>if (nO != null)<NEW_LINE><MASK><NEW_LINE>return new VirtResSetIter(this, ps, ps.executeQuery(), tm);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new JenaException(e);<NEW_LINE>}<NEW_LINE>} | bindObject(ps, col, nO); |
1,598,201 | private String generateClass(TypeElement type, String className, String ifaceToImpl, boolean isFinal) {<NEW_LINE>if (type == null) {<NEW_LINE>mErrorReporter.abortWithError("generateClass was invoked with null type", null);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (className == null) {<NEW_LINE>mErrorReporter.abortWithError("generateClass was invoked with null class name", type);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (ifaceToImpl == null) {<NEW_LINE>mErrorReporter.abortWithError("generateClass was invoked with null iface", type);<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>String pkg = CompilerUtil.packageNameOf(type);<NEW_LINE>ClassName strClz = ClassName.get("java.lang", "Runnable");<NEW_LINE>ClassName intClz = <MASK><NEW_LINE>ClassName mapClz = ClassName.get("java.util", "Map");<NEW_LINE>TypeName mapOfString = ParameterizedTypeName.get(mapClz, intClz, strClz);<NEW_LINE>FieldSpec onGrantMethodsMap = FieldSpec.builder(mapOfString, "ON_GRANT_METHODS_MAP").addModifiers(Modifier.STATIC, Modifier.FINAL, Modifier.PRIVATE).build();<NEW_LINE>FieldSpec onDenyMethodsMap = FieldSpec.builder(mapOfString, "ON_DENY_METHODS_MAP").addModifiers(Modifier.STATIC, Modifier.FINAL, Modifier.PRIVATE).build();<NEW_LINE>TypeSpec.Builder subClass = TypeSpec.classBuilder(className).addField(boolean.class, "DEBUG", Modifier.STATIC, Modifier.FINAL, Modifier.PRIVATE).addStaticBlock(CodeBlock.of("DEBUG = " + DEBUG + ";\n")).addField(onGrantMethodsMap).addField(onDenyMethodsMap).addStaticBlock(CodeBlock.of("ON_GRANT_METHODS_MAP = new $T<>();\n", HashMap.class)).addStaticBlock(CodeBlock.of("ON_DENY_METHODS_MAP = new $T<>();\n", HashMap.class)).addMethods(createMethodSpecs(type));<NEW_LINE>// Add type params.<NEW_LINE>List l = type.getTypeParameters();<NEW_LINE>Collections.consumeRemaining(l, o -> {<NEW_LINE>TypeParameterElement typeParameterElement = (TypeParameterElement) o;<NEW_LINE>subClass.addTypeVariable(TypeVariableName.get(typeParameterElement.toString()));<NEW_LINE>});<NEW_LINE>if (isFinal)<NEW_LINE>subClass.addModifiers(FINAL);<NEW_LINE>JavaFile javaFile = JavaFile.builder(pkg, subClass.build()).addFileComment(SettingsProvider.FILE_COMMENT).skipJavaLangImports(true).build();<NEW_LINE>return javaFile.toString();<NEW_LINE>} | ClassName.get("java.lang", "Integer"); |
1,222,515 | private List<List<K>> prepareKeysForParallelism() {<NEW_LINE>// Calculate the number of row keys to be queried at a time.<NEW_LINE>// Consider whether parallelism is enabled or not.<NEW_LINE>// When numThreads is calculated, the int truncation<NEW_LINE>// causes one fewer thread to be used if numKeys isn't evenly divided<NEW_LINE>// into maxRowCountPerQuery. Thus,<NEW_LINE>// the keys are divided among threads/ calls evenly with each thread<NEW_LINE>// getting up to maxRowCountPerQuery<NEW_LINE>List<List<K>> returnKeys = new LinkedList<List<K>>();<NEW_LINE>int numKeys = rowKeys.size();<NEW_LINE>// Calculate how many thread are required based on input # keys and each<NEW_LINE>// time rowkeys limit of maxRowCountPerQuery<NEW_LINE>int numThreads = 1;<NEW_LINE>if (maxRowCountPerQuery > 0) {<NEW_LINE>numThreads = (int) Math.ceil((numKeys / (double) maxRowCountPerQuery));<NEW_LINE>numThreads = Math.max(numThreads, 1);<NEW_LINE>}<NEW_LINE>// if number of threads required is more than the maximum limit of<NEW_LINE>// allowable threads then cap the number of threads<NEW_LINE>threadCount = Math.min(numThreads, maxThreads);<NEW_LINE>// We get the ceiling of numKeys/numThreads in order to spread out the<NEW_LINE>// row keys evenly.<NEW_LINE>// e.g. if numKeys=101 and maxRowCountPerQuery=50, it makes set of 34<NEW_LINE>// keys to be queried at a time. numThreads= Ceil(101/50)=>3<NEW_LINE>numKeysPerThread = (int) Math.ceil(numKeys / (double) numThreads);<NEW_LINE>// Default it to 1, so that all keys will be passed once, instead of breaking it<NEW_LINE>numKeysPerThread = <MASK><NEW_LINE>// Check if there are any rowkeys<NEW_LINE>if (this.rowKeys != null && this.rowKeys.size() > 0) {<NEW_LINE>// split keys into subsets based on the above calculation<NEW_LINE>returnKeys = Lists.partition(rowKeys, numKeysPerThread);<NEW_LINE>}<NEW_LINE>return returnKeys;<NEW_LINE>} | Math.max(numKeysPerThread, 1); |
1,741,185 | public void finalizar_sessao() {<NEW_LINE>if (pode_enviar_dados) {<NEW_LINE>for (String url : URL_LIST) {<NEW_LINE>InetAddress ip;<NEW_LINE>try {<NEW_LINE>ip = InetAddress.getLocalHost();<NEW_LINE>String username;<NEW_LINE>if (Configuracoes.getInstancia().getUserMac().equals("nao")) {<NEW_LINE>username = searchForMac();<NEW_LINE>Configuracoes.getInstancia().setUserMac(username);<NEW_LINE>} else {<NEW_LINE>username = Configuracoes<MASK><NEW_LINE>}<NEW_LINE>if (getHTML(url + "/api/users/" + username).equals("[]")) {<NEW_LINE>} else {<NEW_LINE>editar_usuario_servidor(url, Configuracoes.getInstancia().getUserAnalyticsID(), false, ip);<NEW_LINE>}<NEW_LINE>System.out.println("Enviou ao servidor " + url);<NEW_LINE>break;<NEW_LINE>} catch (Exception ex) {<NEW_LINE>System.out.println("Erro no envio ao servidor " + url);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getInstancia().getUserMac(); |
656,032 | public void onDataConnectionStateChanged(int state) {<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "START"));<NEW_LINE>if (state == TelephonyManager.DATA_CONNECTED) {<NEW_LINE>NetworkConnectionStatus.Network_Connection_Available = NetworkConnectionStatus.NETWORK_CONNECTED;<NEW_LINE>wanStatus.connectionManagerMessage = Common.mainActivity.getString(RhoExtManager.getResourceId("string", "network_connman_connected"));<NEW_LINE>} else if (state == TelephonyManager.DATA_DISCONNECTED) {<NEW_LINE>NetworkConnectionStatus.Network_Connection_Available = NetworkConnectionStatus.NETWORK_DISCONNECTED;<NEW_LINE>wanStatus.connectionManagerMessage = Common.mainActivity.getString(RhoExtManager.getResourceId("string", "network_connman_notconnected"));<NEW_LINE>} else if (state == TelephonyManager.DATA_CONNECTING) {<NEW_LINE>NetworkConnectionStatus.Network_Connection_Available = NetworkConnectionStatus.NETWORK_DISCONNECTED;<NEW_LINE>wanStatus.connectionManagerMessage = Common.mainActivity.getString(RhoExtManager<MASK><NEW_LINE>}<NEW_LINE>mHandler.sendMessage(mHandler.obtainMessage(0, 1, 0));<NEW_LINE>Common.logger.add(new LogEntry(LogEntry.PB_LOG_DEBUG, "END"));<NEW_LINE>} | .getResourceId("string", "network_connman_connecting")); |
1,773,526 | public static TableMetadata metadata(boolean differential) {<NEW_LINE>List<ColumnMetadata> columnMetadata;<NEW_LINE>if (differential) {<NEW_LINE>columnMetadata = ImmutableList.of(new ColumnMetadata(COL_FLOW, Schema.FLOW, "The flow", true, false), new ColumnMetadata(TableDiff.baseColumnName(COL_TRACES), Schema.set(Schema.TRACE), "The traces in the BASE snapshot", false, true), new ColumnMetadata(TableDiff.baseColumnName(COL_TRACE_COUNT), Schema.INTEGER, "The total number traces in the BASE snapshot", false, true), new ColumnMetadata(TableDiff.deltaColumnName(COL_TRACES), Schema.set(Schema.TRACE), "The traces in the DELTA snapshot", false, true), new ColumnMetadata(TableDiff.deltaColumnName(COL_TRACE_COUNT), Schema.INTEGER, "The total number traces in the DELTA snapshot", false, true));<NEW_LINE>} else {<NEW_LINE>columnMetadata = ImmutableList.of(new ColumnMetadata(COL_FLOW, Schema.FLOW, "The flow", true, false), new ColumnMetadata(COL_TRACES, Schema.set(Schema.TRACE), "The traces for this flow", false, true), new ColumnMetadata(COL_TRACE_COUNT, Schema.INTEGER, "The total number traces for this flow", false, true));<NEW_LINE>}<NEW_LINE>return new TableMetadata(columnMetadata, String<MASK><NEW_LINE>} | .format("Paths for flow ${%s}", COL_FLOW)); |
1,062,002 | public void execute(@Nonnull Editor originalEditor, char charTyped, @Nonnull DataContext dataContext) {<NEW_LINE>final Project project = dataContext.getData(CommonDataKeys.PROJECT);<NEW_LINE>PsiFile file = project == null ? null : PsiUtilBase.getPsiFileInEditor(originalEditor, project);<NEW_LINE>if (file == null) {<NEW_LINE>if (myOriginalHandler != null) {<NEW_LINE>myOriginalHandler.execute(originalEditor, charTyped, dataContext);<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (!EditorModificationUtil.checkModificationAllowed(originalEditor)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>CompletionPhase oldPhase = CompletionServiceImpl.getCompletionPhase();<NEW_LINE>if (oldPhase instanceof CompletionPhase.CommittingDocuments && oldPhase.indicator != null) {<NEW_LINE>oldPhase.indicator.scheduleRestart();<NEW_LINE>}<NEW_LINE>Editor editor = TypedHandler.<MASK><NEW_LINE>if (editor != originalEditor) {<NEW_LINE>file = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());<NEW_LINE>}<NEW_LINE>if (originalEditor.isInsertMode() && beforeCharTyped(charTyped, project, originalEditor, editor, file)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (myOriginalHandler != null) {<NEW_LINE>myOriginalHandler.execute(originalEditor, charTyped, dataContext);<NEW_LINE>}<NEW_LINE>} | injectedEditorIfCharTypedIsSignificant(charTyped, originalEditor, file); |
395,437 | private boolean checkForAzPodAppContainerStarting() {<NEW_LINE>if (isPodCompleted()) {<NEW_LINE>logger.debug("ContainerStarting is false as podPhase is in completion state");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// Pod must have been initialized<NEW_LINE>if (!this.initializedConditionStatus.isPresent() || this.initializedConditionStatus.get() != PodConditionStatus.True) {<NEW_LINE>logger.debug("ContainerStarting false as initialized condition is not present or not true");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// ContainersReady condition will not be True and all application containers should be waiting<NEW_LINE>List<V1ContainerStatus> containerStatuses <MASK><NEW_LINE>if (containerStatuses == null || containerStatuses.isEmpty()) {<NEW_LINE>logger.debug("ContainerStarting false as container status is null or empty");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>boolean allContainersWaiting = containerStatuses.stream().allMatch(status -> status.getState().getWaiting() != null && status.getStarted() == false);<NEW_LINE>if (!allContainersWaiting) {<NEW_LINE>logger.debug("ContainerStarting false as all containers are not waiting");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>logger.debug("ContainerStarting is true");<NEW_LINE>return true;<NEW_LINE>} | = this.v1PodStatus.getContainerStatuses(); |
1,009,048 | CodeTypeElement createAOTExportProvider(ExportsLibrary libraryExports, CodeTypeElement genClass) {<NEW_LINE>String libraryName = libraryExports.getLibrary().getTemplateType().getSimpleName().toString();<NEW_LINE>CodeTypeElement providerClass = createClass(libraryExports, null, modifiers(PUBLIC, STATIC, FINAL), libraryName + "EagerProvider", null);<NEW_LINE>providerClass.getImplements().add(context.getTypes().EagerExportProvider);<NEW_LINE>ExecutableElement init = ElementUtils.findMethod((DeclaredType) genClass.asType(), "init");<NEW_LINE>if (init == null) {<NEW_LINE>CodeExecutableElement genInit = genClass.add(new CodeExecutableElement(modifiers(PRIVATE, STATIC), context.getType(void.class), "init"));<NEW_LINE>genInit.createBuilder().lineComment("This method is intended to ensure class initialization.");<NEW_LINE>init = genInit;<NEW_LINE>}<NEW_LINE>for (ExecutableElement method : ElementFilter.methodsIn(context.getTypes().EagerExportProvider.asElement().getEnclosedElements())) {<NEW_LINE>CodeExecutableElement m = null;<NEW_LINE>switch(method.getSimpleName().toString()) {<NEW_LINE>case "ensureRegistered":<NEW_LINE><MASK><NEW_LINE>m.createBuilder().startStatement().startStaticCall(init).end().end();<NEW_LINE>break;<NEW_LINE>case "getLibraryClassName":<NEW_LINE>m = CodeExecutableElement.cloneNoAnnotations(method);<NEW_LINE>m.createBuilder().startReturn().doubleQuote(context.getEnvironment().getElementUtils().getBinaryName(libraryExports.getLibrary().getTemplateType()).toString()).end();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>if (m != null) {<NEW_LINE>m.getModifiers().remove(Modifier.ABSTRACT);<NEW_LINE>providerClass.add(m);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (providerClass.getEnclosedElements().size() != 2) {<NEW_LINE>throw new AssertionError();<NEW_LINE>}<NEW_LINE>return providerClass;<NEW_LINE>} | m = CodeExecutableElement.cloneNoAnnotations(method); |
1,454,155 | private void visitSetConstVar(Node node, Node child, boolean needValue) {<NEW_LINE>if (!hasVarsInRegs)<NEW_LINE>Kit.codeBug();<NEW_LINE>int varIndex = fnCurrent.getVarIndex(node);<NEW_LINE>generateExpression(child.getNext(), node);<NEW_LINE>boolean isNumber = (node.getIntProp(Node.ISNUMBER_PROP, -1) != -1);<NEW_LINE>short reg = varRegisters[varIndex];<NEW_LINE>int beyond = cfw.acquireLabel();<NEW_LINE>int noAssign = cfw.acquireLabel();<NEW_LINE>if (isNumber) {<NEW_LINE>cfw.addILoad(reg + 2);<NEW_LINE>cfw.add(ByteCode.IFNE, noAssign);<NEW_LINE>short stack = cfw.getStackTop();<NEW_LINE>cfw.addPush(1);<NEW_LINE>cfw.addIStore(reg + 2);<NEW_LINE>cfw.addDStore(reg);<NEW_LINE>if (needValue) {<NEW_LINE>cfw.addDLoad(reg);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>} else {<NEW_LINE>cfw.add(ByteCode.GOTO, beyond);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>cfw.add(ByteCode.POP2);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>cfw.addILoad(reg + 1);<NEW_LINE>cfw.add(ByteCode.IFNE, noAssign);<NEW_LINE><MASK><NEW_LINE>cfw.addPush(1);<NEW_LINE>cfw.addIStore(reg + 1);<NEW_LINE>cfw.addAStore(reg);<NEW_LINE>if (needValue) {<NEW_LINE>cfw.addALoad(reg);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>} else {<NEW_LINE>cfw.add(ByteCode.GOTO, beyond);<NEW_LINE>cfw.markLabel(noAssign, stack);<NEW_LINE>cfw.add(ByteCode.POP);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cfw.markLabel(beyond);<NEW_LINE>} | short stack = cfw.getStackTop(); |
999,168 | public void run(RegressionEnvironment env) {<NEW_LINE>String epl = "@name('s0') select cast(item?,java.lang.String) as t0 from SupportBeanDynRoot";<NEW_LINE>env.eplToModelCompileDeploy(epl).addListener("s0");<NEW_LINE>env.assertStmtType("s0", "t0", EPTypePremade.STRING.getEPType());<NEW_LINE>env.sendEventBean(new SupportBeanDynRoot(100));<NEW_LINE>env.assertEqualsNew("s0", "t0", "100");<NEW_LINE>env.sendEventBean(new SupportBeanDynRoot((byte) 2));<NEW_LINE>env.<MASK><NEW_LINE>env.sendEventBean(new SupportBeanDynRoot(77.7777));<NEW_LINE>env.assertEqualsNew("s0", "t0", "77.7777");<NEW_LINE>env.sendEventBean(new SupportBeanDynRoot(6L));<NEW_LINE>env.assertEqualsNew("s0", "t0", "6");<NEW_LINE>env.sendEventBean(new SupportBeanDynRoot(null));<NEW_LINE>env.assertEqualsNew("s0", "t0", null);<NEW_LINE>env.sendEventBean(new SupportBeanDynRoot("abc"));<NEW_LINE>env.assertEqualsNew("s0", "t0", "abc");<NEW_LINE>env.undeployAll();<NEW_LINE>} | assertEqualsNew("s0", "t0", "2"); |
806,308 | static Authority fromString(String authority) {<NEW_LINE>if (authority == null || authority.length() == 0) {<NEW_LINE>return NoAuthority.INSTANCE;<NEW_LINE>}<NEW_LINE>Matcher matcher = ZOOKEEPER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new ZookeeperAuthority(matcher.group(1).replaceAll("[;+]", ","));<NEW_LINE>}<NEW_LINE>matcher = SINGLE_MASTER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new SingleMasterAuthority(matcher.group(1), Integer.parseInt(matcher.group(2)));<NEW_LINE>}<NEW_LINE>matcher = MULTI_MASTERS_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new MultiMasterAuthority(authority.replaceAll("[;+]", ","));<NEW_LINE>}<NEW_LINE>matcher = LOGICAL_ZOOKEEPER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new ZookeeperLogicalAuthority(matcher.group(1));<NEW_LINE>}<NEW_LINE>matcher = LOGICAL_MASTER_AUTH.matcher(authority);<NEW_LINE>if (matcher.matches()) {<NEW_LINE>return new EmbeddedLogicalAuthority<MASK><NEW_LINE>}<NEW_LINE>return new UnknownAuthority(authority);<NEW_LINE>} | (matcher.group(1)); |
1,180,484 | private void listBadLinks() throws Exception {<NEW_LINE>ArrayList<String> errors = new ArrayList<>();<NEW_LINE>for (String link : links.keySet()) {<NEW_LINE>if (!link.startsWith("http") && !link.endsWith("h2.pdf") && /* For Javadoc 8 */<NEW_LINE>!link.startsWith("docs/javadoc")) {<NEW_LINE>if (targets.get(link) == null) {<NEW_LINE>errors.add(links.get<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String link : links.keySet()) {<NEW_LINE>if (!link.startsWith("http")) {<NEW_LINE>targets.remove(link);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (String name : targets.keySet()) {<NEW_LINE>if (targets.get(name) == TargetKind.ID) {<NEW_LINE>boolean ignore = false;<NEW_LINE>for (String to : IGNORE_MISSING_LINKS_TO) {<NEW_LINE>if (name.contains(to)) {<NEW_LINE>ignore = true;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!ignore) {<NEW_LINE>errors.add("No link to " + name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Collections.sort(errors);<NEW_LINE>for (String error : errors) {<NEW_LINE>System.out.println(error);<NEW_LINE>}<NEW_LINE>if (!errors.isEmpty()) {<NEW_LINE>throw new Exception("Problems where found by the Link Checker");<NEW_LINE>}<NEW_LINE>} | (link) + ": Link missing " + link); |
520,486 | public void serialize(StringBuilder builder) {<NEW_LINE>builder.append<MASK><NEW_LINE>builder.append(mDeviceType).append("\n");<NEW_LINE>builder.append(mDeviceOS).append("\n");<NEW_LINE>builder.append(mAlias).append("\n");<NEW_LINE>// a network can't be saved in a session file<NEW_LINE>if (mType == Type.NETWORK) {<NEW_LINE>return;<NEW_LINE>} else if (mType == Type.ENDPOINT) {<NEW_LINE>mEndpoint.serialize(builder);<NEW_LINE>} else if (mType == Type.REMOTE) {<NEW_LINE>builder.append(mHostname).append("\n");<NEW_LINE>}<NEW_LINE>synchronized (mPorts) {<NEW_LINE>builder.append(mPorts.size()).append("\n");<NEW_LINE>for (Port p : mPorts) {<NEW_LINE>builder.append(p.getProtocol().toString());<NEW_LINE>builder.append("|");<NEW_LINE>builder.append(p.getNumber());<NEW_LINE>builder.append("|");<NEW_LINE>if (p.haveService())<NEW_LINE>builder.append(p.getService());<NEW_LINE>builder.append("|");<NEW_LINE>if (p.haveVersion())<NEW_LINE>builder.append(p.getVersion());<NEW_LINE>builder.append("\n");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (mType).append("\n"); |
131,436 | public static /*<NEW_LINE>@Deprecated<NEW_LINE>public static JsonArrayBuilder harvestingConfigsAsJsonArray(List<Dataverse> harvestingDataverses) {<NEW_LINE>JsonArrayBuilder hdArr = Json.createArrayBuilder();<NEW_LINE><NEW_LINE>for (Dataverse hd : harvestingDataverses) {<NEW_LINE>hdArr.add(harvestingConfigAsJson(hd.getHarvestingClientConfig()));<NEW_LINE>}<NEW_LINE>return hdArr;<NEW_LINE>}*/<NEW_LINE>JsonObjectBuilder harvestingConfigAsJson(HarvestingClient harvestingConfig) {<NEW_LINE>if (harvestingConfig == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return jsonObjectBuilder().add("nickName", harvestingConfig.getName()).add("dataverseAlias", harvestingConfig.getDataverse().getAlias()).add("type", harvestingConfig.getHarvestType()).add("harvestUrl", harvestingConfig.getHarvestingUrl()).add("archiveUrl", harvestingConfig.getArchiveUrl()).add("archiveDescription", harvestingConfig.getArchiveDescription()).add("metadataFormat", harvestingConfig.getMetadataPrefix()).add("set", harvestingConfig.getHarvestingSet() == null ? "N/A" : harvestingConfig.getHarvestingSet()).add("schedule", harvestingConfig.isScheduled() ? harvestingConfig.getScheduleDescription() : "none").add("status", harvestingConfig.isHarvestingNow() ? "inProgress" : "inActive").add("lastHarvest", harvestingConfig.getLastHarvestTime() == null ? "N/A" : harvestingConfig.getLastHarvestTime().toString()).add("lastResult", harvestingConfig.getLastResult()).add("lastSuccessful", harvestingConfig.getLastSuccessfulHarvestTime() == null ? "N/A" : harvestingConfig.getLastSuccessfulHarvestTime().toString()).add("lastNonEmpty", harvestingConfig.getLastNonEmptyHarvestTime() == null ? "N/A" : harvestingConfig.getLastNonEmptyHarvestTime().toString()).add("lastDatasetsHarvested", harvestingConfig.getLastHarvestedDatasetCount() == null ? "N/A" : harvestingConfig.getLastHarvestedDatasetCount().toString()).add("lastDatasetsDeleted", harvestingConfig.getLastDeletedDatasetCount() == null ? "N/A" : harvestingConfig.getLastDeletedDatasetCount().toString()).add("lastDatasetsFailed", harvestingConfig.getLastFailedDatasetCount() == null ? "N/A" : harvestingConfig.<MASK><NEW_LINE>} | getLastFailedDatasetCount().toString()); |
370,856 | public <T extends Parcelable> T decodeParcelable(String key, Class<T> tClass, @Nullable T defaultValue) {<NEW_LINE>if (tClass == null) {<NEW_LINE>return defaultValue;<NEW_LINE>}<NEW_LINE>byte[] bytes = decodeBytes(nativeHandle, key);<NEW_LINE>if (bytes == null) {<NEW_LINE>return defaultValue;<NEW_LINE>}<NEW_LINE>Parcel source = Parcel.obtain();<NEW_LINE>source.unmarshall(bytes, 0, bytes.length);<NEW_LINE>source.setDataPosition(0);<NEW_LINE>try {<NEW_LINE>String name = tClass.toString();<NEW_LINE>Parcelable.Creator<T> creator;<NEW_LINE>synchronized (mCreators) {<NEW_LINE>creator = (Parcelable.Creator<T>) mCreators.get(name);<NEW_LINE>if (creator == null) {<NEW_LINE>Field f = tClass.getField("CREATOR");<NEW_LINE>creator = (Parcelable.Creator<T>) f.get(null);<NEW_LINE>if (creator != null) {<NEW_LINE>mCreators.put(name, creator);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (creator != null) {<NEW_LINE>return creator.createFromParcel(source);<NEW_LINE>} else {<NEW_LINE>throw new Exception(<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>} finally {<NEW_LINE>source.recycle();<NEW_LINE>}<NEW_LINE>return defaultValue;<NEW_LINE>} | "Parcelable protocol requires a " + "non-null static Parcelable.Creator object called " + "CREATOR on class " + name); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.