idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
244,300 | final DescribeScriptResult executeDescribeScript(DescribeScriptRequest describeScriptRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeScriptRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeScriptRequest> request = null;<NEW_LINE>Response<DescribeScriptResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeScriptRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeScriptRequest));<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, "GameLift");<NEW_LINE>request.<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeScriptResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeScriptResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeScript"); |
95,314 | public StoredWorkflowDefinitionWithProject map(int index, ResultSet r, StatementContext ctx) throws SQLException {<NEW_LINE>String projName = r.getString("proj_name");<NEW_LINE>Optional<Instant<MASK><NEW_LINE>if (r.wasNull()) {<NEW_LINE>projName = r.getString("proj_deleted_name");<NEW_LINE>projDeletedAt = Optional.of(getTimestampInstant(r, "proj_deleted_at"));<NEW_LINE>}<NEW_LINE>return ImmutableStoredWorkflowDefinitionWithProject.builder().id(r.getLong("id")).revisionId(r.getInt("revision_id")).timeZone(ZoneId.of(r.getString("timezone"))).name(r.getString("name")).config(cfm.fromResultSetOrEmpty(r, "config")).project(ImmutableStoredProject.builder().id(r.getInt("proj_id")).name(projName).siteId(r.getInt("site_id")).createdAt(getTimestampInstant(r, "proj_created_at")).deletedAt(projDeletedAt).build()).revisionName(r.getString("rev_name")).revisionDefaultParams(cfm.fromResultSetOrEmpty(r, "rev_default_params")).build();<NEW_LINE>} | > projDeletedAt = Optional.absent(); |
788,232 | private // /////////////////////////////////////////////////////////////////////////////////////////<NEW_LINE>void addBindings() {<NEW_LINE>amountTextField.textProperty().bindBidirectional(model.amount);<NEW_LINE>volumeTextField.textProperty().bindBidirectional(model.volume);<NEW_LINE>totalToPayTextField.textProperty().bind(model.totalToPay);<NEW_LINE>addressTextField.amountAsCoinProperty().bind(model.dataModel.getMissingCoin());<NEW_LINE>amountTextField.validationResultProperty().bind(model.amountValidationResult);<NEW_LINE>priceCurrencyLabel.textProperty().bind(createStringBinding(() -> CurrencyUtil.getCounterCurrency(model.dataModel.getCurrencyCode())));<NEW_LINE>priceAsPercentageLabel.prefWidthProperty().bind(priceCurrencyLabel.widthProperty());<NEW_LINE>nextButton.disableProperty().bind(model.isNextButtonDisabled);<NEW_LINE>tradeFeeInBtcLabel.textProperty().bind(model.tradeFeeInBtcWithFiat);<NEW_LINE>tradeFeeInBsqLabel.textProperty().bind(model.tradeFeeInBsqWithFiat);<NEW_LINE>tradeFeeDescriptionLabel.textProperty().bind(model.tradeFeeDescription);<NEW_LINE>tradeFeeInBtcLabel.visibleProperty().bind(model.isTradeFeeVisible);<NEW_LINE>tradeFeeInBsqLabel.visibleProperty().bind(model.isTradeFeeVisible);<NEW_LINE>tradeFeeDescriptionLabel.visibleProperty().bind(model.isTradeFeeVisible);<NEW_LINE>tradeFeeDescriptionLabel.managedProperty().bind(tradeFeeDescriptionLabel.visibleProperty());<NEW_LINE>// funding<NEW_LINE>fundingHBox.visibleProperty().bind(model.dataModel.getIsBtcWalletFunded().not()<MASK><NEW_LINE>fundingHBox.managedProperty().bind(model.dataModel.getIsBtcWalletFunded().not().and(model.showPayFundsScreenDisplayed));<NEW_LINE>waitingForFundsLabel.textProperty().bind(model.spinnerInfoText);<NEW_LINE>takeOfferBox.visibleProperty().bind(model.dataModel.getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));<NEW_LINE>takeOfferBox.managedProperty().bind(model.dataModel.getIsBtcWalletFunded().and(model.showPayFundsScreenDisplayed));<NEW_LINE>takeOfferButton.disableProperty().bind(model.isTakeOfferButtonDisabled);<NEW_LINE>} | .and(model.showPayFundsScreenDisplayed)); |
140,041 | public com.amazonaws.services.memorydb.model.SubnetInUseException unmarshallFromContext(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>com.amazonaws.services.memorydb.model.SubnetInUseException subnetInUseException = new com.amazonaws.services.memorydb.model.SubnetInUseException(null);<NEW_LINE>int originalDepth = context.getCurrentDepth();<NEW_LINE><MASK><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>} 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 subnetInUseException;<NEW_LINE>} | String currentParentElement = context.getCurrentParentElement(); |
1,530,871 | public void read(org.apache.thrift.protocol.TProtocol prot, cancel_args struct) throws org.apache.thrift.TException {<NEW_LINE>org.apache.thrift.protocol.TTupleProtocol iprot = (org.apache.thrift.protocol.TTupleProtocol) prot;<NEW_LINE>java.util.BitSet incoming = iprot.readBitSet(3);<NEW_LINE>if (incoming.get(0)) {<NEW_LINE>struct.tinfo = new org.apache.accumulo.core.trace.thrift.TInfo();<NEW_LINE><MASK><NEW_LINE>struct.setTinfoIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(1)) {<NEW_LINE>struct.credentials = new org.apache.accumulo.core.securityImpl.thrift.TCredentials();<NEW_LINE>struct.credentials.read(iprot);<NEW_LINE>struct.setCredentialsIsSet(true);<NEW_LINE>}<NEW_LINE>if (incoming.get(2)) {<NEW_LINE>struct.externalCompactionId = iprot.readString();<NEW_LINE>struct.setExternalCompactionIdIsSet(true);<NEW_LINE>}<NEW_LINE>} | struct.tinfo.read(iprot); |
1,090,101 | public Product addOnCatalog(ProductSupplier productSupplier) throws AxelorException {<NEW_LINE>ProductRepository productRepo = <MASK><NEW_LINE>if (productSupplier.getProductCode() == null) {<NEW_LINE>throw new AxelorException(productSupplier, TraceBackRepository.CATEGORY_NO_VALUE, I18n.get(IExceptionMessage.PRODUCT_SUPPLIER_NO_CODE));<NEW_LINE>}<NEW_LINE>if (productSupplier.getProductName() == null) {<NEW_LINE>throw new AxelorException(productSupplier, TraceBackRepository.CATEGORY_NO_VALUE, I18n.get(IExceptionMessage.PRODUCT_SUPPLIER_NO_NAME), productSupplier.getProductCode());<NEW_LINE>}<NEW_LINE>if (productRepo.findByCode(productSupplier.getProductCode()) != null) {<NEW_LINE>throw new AxelorException(productSupplier, TraceBackRepository.CATEGORY_CONFIGURATION_ERROR, I18n.get(IExceptionMessage.PRODUCT_SUPPLIER_SAME_CODE));<NEW_LINE>}<NEW_LINE>Product productCreated = createProductFromProductSupplier(productSupplier);<NEW_LINE>productSupplier.setProductCreated(productCreated);<NEW_LINE>Beans.get(ProductSupplierRepository.class).save(productSupplier);<NEW_LINE>return productCreated;<NEW_LINE>} | Beans.get(ProductRepository.class); |
331,980 | public static void main(String[] args) throws Exception {<NEW_LINE>WordprocessingMLPackage wordMLPackage = Docx4J.load(new java.io.File("manyFootnotes.docx"));<NEW_LINE>MainDocumentPart mdp = wordMLPackage.getMainDocumentPart();<NEW_LINE>// Setup FootnotesPart if necessary,<NEW_LINE>// along with DocumentSettings<NEW_LINE>FootnotesPart footnotesPart = mdp.getFootnotesPart();<NEW_LINE>if (footnotesPart == null) {<NEW_LINE>System.out.println("No FootnotesPart, so nothing to do. ");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Delete the footnotes part.<NEW_LINE>mdp.getRelationshipsPart().removePart(footnotesPart.getPartName());<NEW_LINE>// Now go through the document, deleting...<NEW_LINE>Body body = mdp.getJaxbElement().getBody();<NEW_LINE>ClassFinder finder = new ClassFinder(CTFtnEdnRef.class);<NEW_LINE>try {<NEW_LINE>new TraversalUtil(wordMLPackage.getMainDocumentPart().getContents(), finder);<NEW_LINE>} catch (Docx4JException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>List results = finder.results;<NEW_LINE>System.out.println("Found " + results.size());<NEW_LINE>int i = 1;<NEW_LINE>for (Object o : results) {<NEW_LINE>CTFtnEdnRef result1 = (CTFtnEdnRef) o;<NEW_LINE>// System.out.println(result1.getParent().getClass().getName());<NEW_LINE>R r = (R) result1.getParent();<NEW_LINE>// Its actually wrapped in JAXBEelement, so won't work<NEW_LINE>// System.out.println(r.getContent().remove(result1));<NEW_LINE>if (r.getContent().size() == 1) {<NEW_LINE>r.getContent().clear();<NEW_LINE>} else {<NEW_LINE>System.out.println("Cowardly keeping " + i);<NEW_LINE>}<NEW_LINE>i++;<NEW_LINE>if ((i % 100) == 0)<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>if (mdp.getDocumentSettingsPart() != null && mdp.getDocumentSettingsPart().getJaxbElement().getFootnotePr() != null) {<NEW_LINE>// Word 2016 can't open the document if this is still present!<NEW_LINE>mdp.getDocumentSettingsPart().getJaxbElement().setFootnotePr(null);<NEW_LINE>}<NEW_LINE>// Save it<NEW_LINE>String filename = System.getProperty("user.dir") + "/OUT_FootnotesRemove.docx";<NEW_LINE>wordMLPackage.save(new java.io.File(filename));<NEW_LINE>System.out.println("Saved " + filename);<NEW_LINE>} | System.out.println(i); |
1,029,810 | protected boolean classNamePresentInJavaLang(CtTypeReference<?> ref) {<NEW_LINE>Boolean presentInJavaLang = namesPresentInJavaLang.get(ref.getSimpleName());<NEW_LINE>if (presentInJavaLang == null) {<NEW_LINE>// The following procedure of determining if the handle is present in Java Lang or<NEW_LINE>// not produces "false positives" if the analyzed source complianceLevel is > 6.<NEW_LINE>// For example, it reports that FunctionalInterface is present in java.lang even<NEW_LINE>// for compliance levels 6, 7. But this is not considered a bad thing, in opposite,<NEW_LINE>// it makes generated code a little more compatible with future versions of Java.<NEW_LINE>if (namesPresentInJavaLang8.contains(ref.getSimpleName()) || namesPresentInJavaLang9.contains(ref.getSimpleName())) {<NEW_LINE>presentInJavaLang = true;<NEW_LINE>} else {<NEW_LINE>// Assuming Spoon's own runtime environment is Java 7+<NEW_LINE>try {<NEW_LINE>Class.forName(<MASK><NEW_LINE>presentInJavaLang = true;<NEW_LINE>} catch (NoClassDefFoundError | ClassNotFoundException e) {<NEW_LINE>presentInJavaLang = false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>namesPresentInJavaLang.put(ref.getSimpleName(), presentInJavaLang);<NEW_LINE>}<NEW_LINE>return presentInJavaLang;<NEW_LINE>} | "java.lang." + ref.getSimpleName()); |
467,880 | public boolean contains(final double aLatitude, final double aLongitude) {<NEW_LINE>boolean latMatch = false;<NEW_LINE>boolean lonMatch = false;<NEW_LINE>// FIXME there's still issues when there's multiple wrap arounds<NEW_LINE>if (mLatNorth < mLatSouth) {<NEW_LINE>// either more than one world/wrapping or the bounding box is wrongish<NEW_LINE>latMatch = true;<NEW_LINE>} else {<NEW_LINE>// normal case<NEW_LINE>latMatch = ((aLatitude < this.mLatNorth) && <MASK><NEW_LINE>}<NEW_LINE>if (mLonEast < mLonWest) {<NEW_LINE>// check longitude bounds with consideration for date line with wrapping<NEW_LINE>lonMatch = aLongitude <= mLonEast && aLongitude >= mLonWest;<NEW_LINE>// lonMatch = (aLongitude >= mLonEast || aLongitude <= mLonWest);<NEW_LINE>} else {<NEW_LINE>lonMatch = ((aLongitude < this.mLonEast) && (aLongitude > this.mLonWest));<NEW_LINE>}<NEW_LINE>return latMatch && lonMatch;<NEW_LINE>} | (aLatitude > this.mLatSouth)); |
177,685 | public ChangeStatus checkStatus(Database database) {<NEW_LINE>ChangeStatus result = new ChangeStatus();<NEW_LINE>Column example = new Column(Table.class, getCatalogName(), getSchemaName(), getTableName(), getColumnName());<NEW_LINE>try {<NEW_LINE>Column column = SnapshotGeneratorFactory.getInstance().createSnapshot(example, database);<NEW_LINE>if (column == null) {<NEW_LINE>return result.unknown("Column does not exist");<NEW_LINE>}<NEW_LINE>result.assertComplete(<MASK><NEW_LINE>if ((getStartWith() != null) && (column.getAutoIncrementInformation().getStartWith() != null)) {<NEW_LINE>result.assertCorrect(getStartWith().equals(column.getAutoIncrementInformation().getStartWith()), "startsWith incorrect");<NEW_LINE>}<NEW_LINE>if ((getIncrementBy() != null) && (column.getAutoIncrementInformation().getIncrementBy() != null)) {<NEW_LINE>result.assertCorrect(getIncrementBy().equals(column.getAutoIncrementInformation().getIncrementBy()), "Increment by incorrect");<NEW_LINE>}<NEW_LINE>if (getGenerationType() != null && column.getAutoIncrementInformation().getGenerationType() != null) {<NEW_LINE>result.assertCorrect(getGenerationType().equals(column.getAutoIncrementInformation().getGenerationType()), "Generation type is incorrect");<NEW_LINE>}<NEW_LINE>if (getDefaultOnNull() != null && column.getAutoIncrementInformation().getDefaultOnNull() != null) {<NEW_LINE>result.assertCorrect(getDefaultOnNull().equals(column.getAutoIncrementInformation().getDefaultOnNull()), "Default on null is incorrect");<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} catch (DatabaseException | InvalidExampleException e) {<NEW_LINE>return result.unknown(e);<NEW_LINE>}<NEW_LINE>} | column.isAutoIncrement(), "Column is not auto-increment"); |
975,317 | public void buildModel() {<NEW_LINE>model = new Model();<NEW_LINE>out.println("The CycloHexan problem consists in finding the 3D configuration of a cyclohexane molecule.\n" + "It is decribed with a system of three non linear equations : \n" + " y^2 * (1 + z^2) + z * (z - 24 * y) = -13 \n" + " x^2 * (1 + y^2) + y * (y - 24 * x) = -13 \n" + " z^2 * (1 + x^2) + x * (x - 24 * z) = -13 \n" + "This example comes from the Elisa project (LINA) examples. \n");<NEW_LINE>double precision = 1.0e-6;<NEW_LINE>x = model.realVar(<MASK><NEW_LINE>y = model.realVar("y", -1.0e8, 1.0e8, precision);<NEW_LINE>z = model.realVar("z", -1.0e8, 1.0e8, precision);<NEW_LINE>vars = new RealVar[] { x, y, z };<NEW_LINE>model.realIbexGenericConstraint("{1}^2 * (1 + {2}^2) + {2} * ({2} - 24 * {1}) = -13;" + "{0}^2 * (1 + {1}^2) + {1} * ({1} - 24 * {0}) = -13;" + "{2}^2 * (1 + {0}^2) + {0} * ({0} - 24 * {2}) = -13", vars).post();<NEW_LINE>} | "x", NEGATIVE_INFINITY, POSITIVE_INFINITY, precision); |
999,189 | final StartTargetedSentimentDetectionJobResult executeStartTargetedSentimentDetectionJob(StartTargetedSentimentDetectionJobRequest startTargetedSentimentDetectionJobRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(startTargetedSentimentDetectionJobRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<StartTargetedSentimentDetectionJobRequest> request = null;<NEW_LINE>Response<StartTargetedSentimentDetectionJobResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new StartTargetedSentimentDetectionJobRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(startTargetedSentimentDetectionJobRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(<MASK><NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "Comprehend");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "StartTargetedSentimentDetectionJob");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<StartTargetedSentimentDetectionJobResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new StartTargetedSentimentDetectionJobResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | HandlerContextKey.SIGNING_REGION, getSigningRegion()); |
1,279,537 | public Flux<CommandResponse<XClaimCommand, Flux<ByteBufferRecord>>> xClaim(Publisher<XClaimCommand> commands) {<NEW_LINE>return connection.execute(cmd -> Flux.from(commands).map(command -> {<NEW_LINE>String[] ids = command<MASK><NEW_LINE>io.lettuce.core.Consumer<ByteBuffer> from = io.lettuce.core.Consumer.from(ByteUtils.getByteBuffer(command.getGroupName()), ByteUtils.getByteBuffer(command.getNewOwner()));<NEW_LINE>XClaimArgs args = StreamConverters.toXClaimArgs(command.getOptions());<NEW_LINE>Flux<ByteBufferRecord> result = cmd.xclaim(command.getKey(), from, args, ids).map(it -> StreamRecords.newRecord().in(it.getStream()).withId(it.getId()).ofBuffer(it.getBody()));<NEW_LINE>return new CommandResponse<>(command, result);<NEW_LINE>}));<NEW_LINE>} | .getOptions().getIdsAsStringArray(); |
1,023,912 | final ListProtectionGroupsResult executeListProtectionGroups(ListProtectionGroupsRequest listProtectionGroupsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(listProtectionGroupsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ListProtectionGroupsRequest> request = null;<NEW_LINE>Response<ListProtectionGroupsResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new ListProtectionGroupsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(listProtectionGroupsRequest));<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, "Shield");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "ListProtectionGroups");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ListProtectionGroupsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ListProtectionGroupsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
224,926 | public List<IamPolicySearchResult> searchAllIamPolicies(String scope, String query) throws IOException {<NEW_LINE>logger.atInfo().log("Searching all IAM policies.");<NEW_LINE>List<IamPolicySearchResult> iamPolicySearchResults = new ArrayList<IamPolicySearchResult>();<NEW_LINE>int pageSize = 0;<NEW_LINE>String pageToken = "";<NEW_LINE>Builder builder = SearchAllIamPoliciesRequest.newBuilder().setScope(scope).setQuery(query).setPageSize(pageSize).setPageToken(pageToken);<NEW_LINE>SearchAllIamPoliciesRequest request = builder.build();<NEW_LINE>AssetServiceClient client = getAssetServiceClient();<NEW_LINE>SearchAllIamPoliciesPagedResponse response = null;<NEW_LINE>do {<NEW_LINE><MASK><NEW_LINE>Iterable<IamPolicySearchResult> iterable = response.iterateAll();<NEW_LINE>Iterator<IamPolicySearchResult> iterator = iterable.iterator();<NEW_LINE>while (iterator.hasNext()) {<NEW_LINE>IamPolicySearchResult iamPolicySearchResult = iterator.next();<NEW_LINE>iamPolicySearchResults.add(iamPolicySearchResult);<NEW_LINE>}<NEW_LINE>builder = SearchAllIamPoliciesRequest.newBuilder().setScope(scope).setQuery(query).setPageSize(pageSize).setPageToken(response.getNextPageToken());<NEW_LINE>request = builder.build();<NEW_LINE>} while (!response.getNextPageToken().equals(""));<NEW_LINE>return iamPolicySearchResults;<NEW_LINE>} | response = client.searchAllIamPolicies(request); |
1,225,039 | private void restorePosition(Video item) {<NEW_LINE>State state = mStateService.getByVideoId(item.videoId);<NEW_LINE>// Ignore up to 10% watched because the video might be opened on phone and closed immediately.<NEW_LINE>boolean containsWebPosition = item.percentWatched >= RESTORE_POSITION_PERCENTS;<NEW_LINE>boolean stateIsOutdated = state == null || state.timestamp < item.timestamp;<NEW_LINE>if (containsWebPosition && stateIsOutdated) {<NEW_LINE>// Web state is buggy on short videos (e.g. video clips)<NEW_LINE>boolean isLongVideo = getController().getLengthMs() > VideoStateService.MUSIC_VIDEO_LENGTH_MS;<NEW_LINE>if (isLongVideo) {<NEW_LINE>state = new State(item.videoId, convertToMs(item.percentWatched));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Do I need to check that item isn't live? (state != null && !item.isLive)<NEW_LINE>if (state != null) {<NEW_LINE>long remainsMs = getController().getLengthMs() - state.positionMs;<NEW_LINE>// Url list videos at this stage has undefined (-1) length. So, we need to ensure that remains is positive.<NEW_LINE>boolean isVideoEnded = remainsMs >= 0 && remainsMs < 1_000;<NEW_LINE>if (!isVideoEnded || !getPlayEnabled()) {<NEW_LINE>getController().setPositionMs(state.positionMs);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!mIsPlayBlocked) {<NEW_LINE>getController(<MASK><NEW_LINE>}<NEW_LINE>} | ).setPlay(getPlayEnabled()); |
87,428 | public static VespaChangeRequest fromSlime(Slime slime) {<NEW_LINE>var inspector = slime.get();<NEW_LINE>var id = inspector.field(ID_FIELD).asString();<NEW_LINE>var zoneId = ZoneId.from(inspector.field(ZONE_FIELD).asString());<NEW_LINE>var changeRequestSource = readChangeRequestSource(inspector.field(SOURCE_FIELD));<NEW_LINE>var actionPlan = readHostActionPlan<MASK><NEW_LINE>var status = VespaChangeRequest.Status.valueOf(inspector.field(STATUS_FIELD).asString());<NEW_LINE>var impact = ChangeRequest.Impact.valueOf(inspector.field(IMPACT_FIELD).asString());<NEW_LINE>var approval = ChangeRequest.Approval.valueOf(inspector.field(APPROVAL_FIELD).asString());<NEW_LINE>var impactedHosts = new ArrayList<String>();<NEW_LINE>inspector.field(IMPACTED_HOSTS_FIELD).traverse((ArrayTraverser) (i, hostname) -> impactedHosts.add(hostname.asString()));<NEW_LINE>var impactedSwitches = new ArrayList<String>();<NEW_LINE>inspector.field(IMPACTED_SWITCHES_FIELD).traverse((ArrayTraverser) (i, switchName) -> impactedSwitches.add(switchName.asString()));<NEW_LINE>return new VespaChangeRequest(id, changeRequestSource, impactedSwitches, impactedHosts, approval, impact, status, actionPlan, zoneId);<NEW_LINE>} | (inspector.field(ACTION_PLAN_FIELD)); |
478,722 | protected final void registerBean(final String prefix, final Class<T> algorithmClass, final BeanDefinitionRegistry registry) {<NEW_LINE>boolean existPrefix = PropertyUtil.containPropertyPrefix(environment, prefix);<NEW_LINE>if (existPrefix) {<NEW_LINE>Map<String, Object> paramMap = PropertyUtil.handle(environment, prefix, Map.class);<NEW_LINE>Set<String> keys = paramMap.keySet().stream().map(key -> key.contains(POINT) ? key.substring(0, key.indexOf(POINT)) : key).collect(Collectors.toSet());<NEW_LINE>Map<String, YamlShardingSphereAlgorithmConfiguration> shardingAlgorithmMap = new LinkedHashMap<>();<NEW_LINE>keys.forEach(each -> {<NEW_LINE>YamlShardingSphereAlgorithmConfiguration config = new YamlShardingSphereAlgorithmConfiguration();<NEW_LINE>String propsPrefix = String.join("", prefix, each, PROPS_SUFFIX);<NEW_LINE>boolean existProps = PropertyUtil.containPropertyPrefix(environment, propsPrefix);<NEW_LINE>if (existProps) {<NEW_LINE>Map<String, Object> propsMap = PropertyUtil.handle(<MASK><NEW_LINE>config.getProps().putAll(propsMap);<NEW_LINE>}<NEW_LINE>String typePrefix = String.join("", prefix, each, TYPE_SUFFIX);<NEW_LINE>String algorithmType = environment.getProperty(typePrefix);<NEW_LINE>config.setType(algorithmType);<NEW_LINE>shardingAlgorithmMap.put(each, config);<NEW_LINE>});<NEW_LINE>ShardingSphereServiceLoader.register(algorithmClass);<NEW_LINE>shardingAlgorithmMap.forEach((key, algorithmConfiguration) -> {<NEW_LINE>ShardingSphereAlgorithm algorithm = TypedSPIRegistry.getRegisteredService(algorithmClass, algorithmConfiguration.getType(), algorithmConfiguration.getProps());<NEW_LINE>BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(algorithm.getClass());<NEW_LINE>builder.addPropertyValue(PROPS, algorithmConfiguration.getProps());<NEW_LINE>registry.registerBeanDefinition(key, builder.getBeanDefinition());<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | environment, propsPrefix, Map.class); |
462,344 | public void writeDateTime19(int year, int month, int dayOfMonth, int hour, int minute, int second) {<NEW_LINE>ensureCapacity(off + 21);<NEW_LINE>bytes[off++] = '"';<NEW_LINE>bytes[off++] = (byte) (year / 1000 + '0');<NEW_LINE>bytes[off++] = (byte) ((year / 100) % 10 + '0');<NEW_LINE>bytes[off++] = (byte) ((year / 10) % 10 + '0');<NEW_LINE>bytes[off++] = (byte) (year % 10 + '0');<NEW_LINE>bytes[off++] = '-';<NEW_LINE>bytes[off++] = (byte) (month / 10 + '0');<NEW_LINE>bytes[off++] = (byte<MASK><NEW_LINE>bytes[off++] = '-';<NEW_LINE>bytes[off++] = (byte) (dayOfMonth / 10 + '0');<NEW_LINE>bytes[off++] = (byte) (dayOfMonth % 10 + '0');<NEW_LINE>bytes[off++] = ' ';<NEW_LINE>bytes[off++] = (byte) (hour / 10 + '0');<NEW_LINE>bytes[off++] = (byte) (hour % 10 + '0');<NEW_LINE>bytes[off++] = ':';<NEW_LINE>bytes[off++] = (byte) (minute / 10 + '0');<NEW_LINE>bytes[off++] = (byte) (minute % 10 + '0');<NEW_LINE>bytes[off++] = ':';<NEW_LINE>bytes[off++] = (byte) (second / 10 + '0');<NEW_LINE>bytes[off++] = (byte) (second % 10 + '0');<NEW_LINE>bytes[off++] = '"';<NEW_LINE>} | ) (month % 10 + '0'); |
1,568,374 | public void run() {<NEW_LINE>int offset = fContentAssistSubjectControlAdapter.getSelectedRange().x;<NEW_LINE>IContextInformation[] contexts = computeContextInformation(offset);<NEW_LINE>int count = (contexts == null ? 0 : contexts.length);<NEW_LINE>if (count == 1) {<NEW_LINE>ContextFrame frame = createContextFrame(contexts[0], offset);<NEW_LINE>if (isDuplicate(frame)) {<NEW_LINE>validateContextInformation();<NEW_LINE>} else {<NEW_LINE>// Show context information directly<NEW_LINE>internalShowContextInfo(frame);<NEW_LINE>}<NEW_LINE>} else if (count > 0) {<NEW_LINE>// if any of the proposed context matches any of the contexts on the stack,<NEW_LINE>// assume that one (so, if context info is invoked repeatedly, the current<NEW_LINE>// info is kept)<NEW_LINE>for (int i = 0; i < contexts.length; i++) {<NEW_LINE>IContextInformation info = contexts[i];<NEW_LINE>ContextFrame frame = createContextFrame(info, offset);<NEW_LINE>// check top of stack and stored context<NEW_LINE>if (isDuplicate(frame)) {<NEW_LINE>validateContextInformation();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (isLastFrame(frame)) {<NEW_LINE>internalShowContextInfo(frame);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// also check all other contexts<NEW_LINE>for (Iterator<ContextFrame> it = fContextFrameStack.iterator(); it.hasNext(); ) {<NEW_LINE><MASK><NEW_LINE>if (stackFrame.equals(frame)) {<NEW_LINE>validateContextInformation();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// otherwise:<NEW_LINE>// Precise context must be selected<NEW_LINE>if (fLineDelimiter == null) {<NEW_LINE>fLineDelimiter = fContentAssistSubjectControlAdapter.getLineDelimiter();<NEW_LINE>}<NEW_LINE>createContextSelector();<NEW_LINE>setContexts(contexts);<NEW_LINE>displayContextSelector();<NEW_LINE>}<NEW_LINE>} | ContextFrame stackFrame = it.next(); |
1,506,649 | public void onMatch(RelOptRuleCall call) {<NEW_LINE>final HashGroupJoin hashGroupJoin = call.rel(0);<NEW_LINE>RelTraitSet emptyTraitSet = hashGroupJoin.getCluster().getPlanner().emptyTraitSet();<NEW_LINE>RelNode left = convert(hashGroupJoin.getLeft(), emptyTraitSet.replace(MppConvention.INSTANCE));<NEW_LINE>RelNode right = convert(hashGroupJoin.getRight(), emptyTraitSet.replace(MppConvention.INSTANCE));<NEW_LINE>List<Pair<RelDistribution, Pair<RelNode, RelNode>>> implementationList = new ArrayList<>();<NEW_LINE>JoinInfo joinInfo = JoinInfo.of(left, right, hashGroupJoin.getEqualCondition());<NEW_LINE>RelDataType keyDataType = CalciteUtils.getJoinKeyDataType(hashGroupJoin.getCluster().getTypeFactory(), hashGroupJoin, joinInfo.leftKeys, joinInfo.rightKeys);<NEW_LINE>// Hash Shuffle<NEW_LINE>RelNode hashLeft = RuleUtils.ensureKeyDataTypeDistribution(<MASK><NEW_LINE>RelNode hashRight = RuleUtils.ensureKeyDataTypeDistribution(right, keyDataType, joinInfo.rightKeys);<NEW_LINE>implementationList.add(Pair.of(RelDistributions.ANY, Pair.of(hashLeft, hashRight)));<NEW_LINE>if (PlannerContext.getPlannerContext(call).getParamManager().getBoolean(ConnectionParams.ENABLE_BROADCAST_JOIN)) {<NEW_LINE>// Broadcast Shuffle<NEW_LINE>RelNode broadCostLeft = convert(left, left.getTraitSet().replace(RelDistributions.BROADCAST_DISTRIBUTED));<NEW_LINE>implementationList.add(Pair.of(RelDistributions.ANY, Pair.of(broadCostLeft, right)));<NEW_LINE>RelNode broadcastRight = convert(right, right.getTraitSet().replace(RelDistributions.BROADCAST_DISTRIBUTED));<NEW_LINE>implementationList.add(Pair.of(RelDistributions.ANY, Pair.of(left, broadcastRight)));<NEW_LINE>}<NEW_LINE>for (Pair<RelDistribution, Pair<RelNode, RelNode>> implementation : implementationList) {<NEW_LINE>HashGroupJoin newHashGroupJoin = hashGroupJoin.copy(hashGroupJoin.getTraitSet().replace(MppConvention.INSTANCE).replace(implementation.left), hashGroupJoin.getCondition(), implementation.right.left, implementation.right.right, hashGroupJoin.getJoinType(), hashGroupJoin.isSemiJoinDone());<NEW_LINE>call.transformTo(newHashGroupJoin);<NEW_LINE>}<NEW_LINE>} | left, keyDataType, joinInfo.leftKeys); |
360,340 | private void bindValue(PreparedStatement ps, int col, Value n) throws SQLException {<NEW_LINE>if (n == null)<NEW_LINE>return;<NEW_LINE>if (n instanceof URI) {<NEW_LINE>ps.setInt(col, 1);<NEW_LINE>ps.setString(col + 1, n.toString());<NEW_LINE>ps.setNull(col + 2, java.sql.Types.VARCHAR);<NEW_LINE>} else if (n instanceof BNode) {<NEW_LINE>// must be 1 for search<NEW_LINE>ps.setInt(col, 1);<NEW_LINE>ps.setString(col + 1, BNode2String((BNode) n));<NEW_LINE>ps.setNull(col + 2, java.sql.Types.VARCHAR);<NEW_LINE>} else if (n instanceof Literal) {<NEW_LINE>Literal lit = (Literal) n;<NEW_LINE>if (lit.getLanguage() != null) {<NEW_LINE>ps.setInt(col, 5);<NEW_LINE>ps.setString(col + 1, lit.getLabel());<NEW_LINE>ps.setString(col + <MASK><NEW_LINE>} else if (lit.getDatatype() != null) {<NEW_LINE>ps.setInt(col, 4);<NEW_LINE>ps.setString(col + 1, lit.getLabel());<NEW_LINE>ps.setString(col + 2, lit.getDatatype().toString());<NEW_LINE>} else {<NEW_LINE>ps.setInt(col, 3);<NEW_LINE>ps.setString(col + 1, lit.getLabel());<NEW_LINE>ps.setNull(col + 2, java.sql.Types.VARCHAR);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>ps.setInt(col, 3);<NEW_LINE>ps.setString(col + 1, n.toString());<NEW_LINE>ps.setNull(col + 2, java.sql.Types.VARCHAR);<NEW_LINE>}<NEW_LINE>} | 2, lit.getLanguage()); |
1,392,744 | protected void loadTileLayer(TiledMap map, MapLayers parentLayers, Element element) {<NEW_LINE>if (element.getName().equals("layer")) {<NEW_LINE>int width = element.getIntAttribute("width", 0);<NEW_LINE>int height = element.getIntAttribute("height", 0);<NEW_LINE>int tileWidth = map.getProperties().get("tilewidth", Integer.class);<NEW_LINE>int tileHeight = map.getProperties().get("tileheight", Integer.class);<NEW_LINE>TiledMapTileLayer layer = new TiledMapTileLayer(width, height, tileWidth, tileHeight);<NEW_LINE>loadBasicLayerInfo(layer, element);<NEW_LINE>int[] ids = <MASK><NEW_LINE>TiledMapTileSets tilesets = map.getTileSets();<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int id = ids[y * width + x];<NEW_LINE>boolean flipHorizontally = ((id & FLAG_FLIP_HORIZONTALLY) != 0);<NEW_LINE>boolean flipVertically = ((id & FLAG_FLIP_VERTICALLY) != 0);<NEW_LINE>boolean flipDiagonally = ((id & FLAG_FLIP_DIAGONALLY) != 0);<NEW_LINE>TiledMapTile tile = tilesets.getTile(id & ~MASK_CLEAR);<NEW_LINE>if (tile != null) {<NEW_LINE>Cell cell = createTileLayerCell(flipHorizontally, flipVertically, flipDiagonally);<NEW_LINE>cell.setTile(tile);<NEW_LINE>layer.setCell(x, flipY ? height - 1 - y : y, cell);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Element properties = element.getChildByName("properties");<NEW_LINE>if (properties != null) {<NEW_LINE>loadProperties(layer.getProperties(), properties);<NEW_LINE>}<NEW_LINE>parentLayers.add(layer);<NEW_LINE>}<NEW_LINE>} | getTileIds(element, width, height); |
550,293 | public static Memory fseek(Environment env, TraceInfo trace, Memory stream, long offset, int whence) {<NEW_LINE>if (stream.instanceOf(Stream.CLASS_NAME)) {<NEW_LINE>try {<NEW_LINE>switch(whence) {<NEW_LINE>case SEEK_CUR:<NEW_LINE>offset += env.invokeMethod(trace, stream, "getPosition").toLong();<NEW_LINE>break;<NEW_LINE>case SEEK_END:<NEW_LINE>env.error(trace, "fseek(): flag SEEK_END is not supported.");<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>case SEEK_SET:<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>env.invokeMethod(trace, stream, "seek", LongMemory.valueOf(offset));<NEW_LINE>return Memory.CONST_INT_0;<NEW_LINE>} catch (Throwable throwable) {<NEW_LINE>env.warning(trace, "fseek(): " + throwable.getMessage());<NEW_LINE>return Memory.CONST_INT_M1;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>return Memory.CONST_INT_M1;<NEW_LINE>} | env.warning(trace, "fseek(): unable to seek in a non-stream"); |
325,281 | public Object userGetExecutionHistory(String symbol, Date timestamp) throws TimeoutException, ExecutionException, InterruptedException, ApiException {<NEW_LINE>Object postBody = null;<NEW_LINE>// verify the required parameter 'symbol' is set<NEW_LINE>if (symbol == null) {<NEW_LINE>VolleyError error = new VolleyError("Missing the required parameter 'symbol' when calling userGetExecutionHistory", new ApiException(400, "Missing the required parameter 'symbol' when calling userGetExecutionHistory"));<NEW_LINE>}<NEW_LINE>// verify the required parameter 'timestamp' is set<NEW_LINE>if (timestamp == null) {<NEW_LINE>VolleyError error = new VolleyError("Missing the required parameter 'timestamp' when calling userGetExecutionHistory", new ApiException(400, "Missing the required parameter 'timestamp' when calling userGetExecutionHistory"));<NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String path = "/user/executionHistory";<NEW_LINE>// query params<NEW_LINE>List<Pair> queryParams = new ArrayList<Pair>();<NEW_LINE>// header params<NEW_LINE>Map<String, String> headerParams = new HashMap<String, String>();<NEW_LINE>// form params<NEW_LINE>Map<String, String> formParams = new HashMap<String, String>();<NEW_LINE>queryParams.addAll(ApiInvoker.parameterToPairs<MASK><NEW_LINE>queryParams.addAll(ApiInvoker.parameterToPairs("", "timestamp", timestamp));<NEW_LINE>String[] contentTypes = { "application/json", "application/x-www-form-urlencoded" };<NEW_LINE>String contentType = contentTypes.length > 0 ? contentTypes[0] : "application/json";<NEW_LINE>if (contentType.startsWith("multipart/form-data")) {<NEW_LINE>// file uploading<NEW_LINE>MultipartEntityBuilder localVarBuilder = MultipartEntityBuilder.create();<NEW_LINE>HttpEntity httpEntity = localVarBuilder.build();<NEW_LINE>postBody = httpEntity;<NEW_LINE>} else {<NEW_LINE>// normal form params<NEW_LINE>}<NEW_LINE>String[] authNames = new String[] { "apiExpires", "apiKey", "apiSignature" };<NEW_LINE>try {<NEW_LINE>String localVarResponse = apiInvoker.invokeAPI(basePath, path, "GET", queryParams, postBody, headerParams, formParams, contentType, authNames);<NEW_LINE>if (localVarResponse != null) {<NEW_LINE>return (Object) ApiInvoker.deserialize(localVarResponse, "", Object.class);<NEW_LINE>} else {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} catch (ApiException ex) {<NEW_LINE>throw ex;<NEW_LINE>} catch (InterruptedException ex) {<NEW_LINE>throw ex;<NEW_LINE>} catch (ExecutionException ex) {<NEW_LINE>if (ex.getCause() instanceof VolleyError) {<NEW_LINE>VolleyError volleyError = (VolleyError) ex.getCause();<NEW_LINE>if (volleyError.networkResponse != null) {<NEW_LINE>throw new ApiException(volleyError.networkResponse.statusCode, volleyError.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>throw ex;<NEW_LINE>} catch (TimeoutException ex) {<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>} | ("", "symbol", symbol)); |
272,515 | // CPU-Scheduling with Stride<NEW_LINE>private void replacePerBlock(StructuredGraph graph, ParallelRangeNode range) {<NEW_LINE>buildBlockSize(graph, range);<NEW_LINE>final GlobalThreadIdNode threadId = graph.addOrUnique(new GlobalThreadIdNode(ConstantNode.forInt(range.index(), graph)));<NEW_LINE>final MulNode newOffset = graph.addOrUnique(new MulNode(threadId, blockSize));<NEW_LINE>final AddNode newRange = graph.addOrUnique(new AddNode(newOffset, blockSize));<NEW_LINE>// Stride of 2<NEW_LINE>final MulNode stride = graph.addOrUnique(new MulNode(newRange, range.stride().value()));<NEW_LINE>final ValueNode adjustedRange = graph.addOrUnique(OCLIntBinaryIntrinsicNode.create(stride, range.value(), OCLIntBinaryIntrinsicNode.Operation<MASK><NEW_LINE>range.replaceAtUsages(adjustedRange);<NEW_LINE>range.safeDelete();<NEW_LINE>} | .MIN, JavaKind.Int)); |
1,037,262 | /*<NEW_LINE>* @see<NEW_LINE>* com.sitewhere.microservice.api.device.IDeviceManagement#searchDeviceAlarms(<NEW_LINE>* com.sitewhere.spi.search.device.IDeviceAlarmSearchCriteria)<NEW_LINE>*/<NEW_LINE>@Override<NEW_LINE>public ISearchResults<RdbDeviceAlarm> searchDeviceAlarms(IDeviceAlarmSearchCriteria criteria) throws SiteWhereException {<NEW_LINE>return getEntityManagerProvider().findWithCriteria(criteria, new IRdbQueryProvider<RdbDeviceAlarm>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void addPredicates(CriteriaBuilder cb, List<Predicate> predicates, Root<RdbDeviceAlarm> root) throws SiteWhereException {<NEW_LINE>if (criteria.getDeviceId() != null) {<NEW_LINE>Path<UUID> path = root.get("deviceId");<NEW_LINE>predicates.add(cb.equal(path, criteria.getDeviceId()));<NEW_LINE>}<NEW_LINE>if (criteria.getDeviceAssignmentId() != null) {<NEW_LINE>Path<UUID> path = root.get("deviceAssignmentId");<NEW_LINE>predicates.add(cb.equal(path, criteria.getDeviceAssignmentId()));<NEW_LINE>}<NEW_LINE>if (criteria.getCustomerId() != null) {<NEW_LINE>Path<UUID> path = root.get("customerId");<NEW_LINE>predicates.add(cb.equal(path, criteria.getCustomerId()));<NEW_LINE>}<NEW_LINE>if (criteria.getAreaId() != null) {<NEW_LINE>Path<UUID> path = root.get("areaId");<NEW_LINE>predicates.add(cb.equal(path, criteria.getAreaId()));<NEW_LINE>}<NEW_LINE>if (criteria.getAssetId() != null) {<NEW_LINE>Path<UUID> path = root.get("assetId");<NEW_LINE>predicates.add(cb.equal(path, criteria.getAssetId()));<NEW_LINE>}<NEW_LINE>if (criteria.getState() != null) {<NEW_LINE>Path<DeviceAlarmState> path = root.get("state");<NEW_LINE>predicates.add(cb.equal(path, criteria.getState()));<NEW_LINE>}<NEW_LINE>if (criteria.getTriggeringEventId() != null) {<NEW_LINE>Path<UUID> <MASK><NEW_LINE>predicates.add(cb.equal(path, criteria.getTriggeringEventId()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public CriteriaQuery<RdbDeviceAlarm> addSort(CriteriaBuilder cb, Root<RdbDeviceAlarm> root, CriteriaQuery<RdbDeviceAlarm> query) {<NEW_LINE>return query.orderBy(cb.desc(root.get("createdDate")));<NEW_LINE>}<NEW_LINE>}, RdbDeviceAlarm.class);<NEW_LINE>} | path = root.get("triggeringEventId"); |
703,388 | private ExternallyReferencedCandidate forRecord(@NonNull final I_C_Invoice_Candidate icRecord) {<NEW_LINE>final ExternallyReferencedCandidateBuilder candidate = ExternallyReferencedCandidate.builder();<NEW_LINE>candidate.orgId(OrgId.ofRepoId(icRecord.getAD_Org_ID())).id(InvoiceCandidateId.ofRepoId(icRecord.getC_Invoice_Candidate_ID())).externalHeaderId(ExternalId.ofOrNull(icRecord.getExternalHeaderId())).externalLineId(ExternalId.ofOrNull(icRecord.getExternalLineId()));<NEW_LINE>candidate.poReference(icRecord.getPOReference());<NEW_LINE>final BPartnerId bpartnerId = BPartnerId.ofRepoId(icRecord.getBill_BPartner_ID());<NEW_LINE>final BPartnerInfo bpartnerInfo = BPartnerInfo.builder().bpartnerId(bpartnerId).bpartnerLocationId(BPartnerLocationId.ofRepoId(bpartnerId, icRecord.getBill_Location_ID())).contactId(BPartnerContactId.ofRepoIdOrNull(bpartnerId, icRecord.getBill_User_ID())).build();<NEW_LINE>candidate.billPartnerInfo(bpartnerInfo);<NEW_LINE>candidate.dateOrdered(TimeUtil.asLocalDate(icRecord.getDateOrdered()));<NEW_LINE>candidate.presetDateInvoiced(TimeUtil.asLocalDate(icRecord.getPresetDateInvoiced()));<NEW_LINE>candidate.invoiceRule(InvoiceRule.ofCode(icRecord.getInvoiceRule())).invoiceRuleOverride(InvoiceRule.ofNullableCode(icRecord.getInvoiceRule_Override()));<NEW_LINE>// the column is not mandatory in the DB, but still<NEW_LINE>final ProductId productId = ProductId.ofRepoId(icRecord.getM_Product_ID());<NEW_LINE>candidate.productId(productId);<NEW_LINE>candidate.pricingSystemId(PricingSystemId.ofRepoId(icRecord.getM_PricingSystem_ID())).priceListVersionId(PriceListVersionId.ofRepoIdOrNull(icRecord.getM_PriceList_Version_ID()));<NEW_LINE>final ProductPrice priceEntered = invoiceCandBL.getPriceEntered(icRecord);<NEW_LINE>candidate.priceEntered(priceEntered);<NEW_LINE>final ProductPrice priceEnteredOverride = invoiceCandBL.getPriceEnteredOverride(icRecord).orElse(null);<NEW_LINE>candidate.priceEnteredOverride(priceEnteredOverride);<NEW_LINE>candidate.discount(Percent.ofNullable(icRecord.getDiscount())).discountOverride(Percent.ofNullable(icRecord.getDiscount_Override()));<NEW_LINE>candidate.priceActual(invoiceCandBL.getPriceActual(icRecord));<NEW_LINE>final StockQtyAndUOMQty qtyDelivered = StockQtyAndUOMQtys.create(icRecord.getQtyDelivered(), productId, icRecord.getQtyDeliveredInUOM(), UomId.ofRepoId(icRecord.getC_UOM_ID()));<NEW_LINE>candidate.qtyDelivered(qtyDelivered);<NEW_LINE>final StockQtyAndUOMQty qtyOrdered = StockQtyAndUOMQtys.create(icRecord.getQtyOrdered(), productId, icRecord.getQtyEntered(), UomId.ofRepoId<MASK><NEW_LINE>candidate.qtyOrdered(qtyOrdered);<NEW_LINE>candidate.soTrx(SOTrx.ofBoolean(icRecord.isSOTrx()));<NEW_LINE>candidate.invoiceDocTypeId(DocTypeId.ofRepoIdOrNull(icRecord.getC_DocTypeInvoice_ID()));<NEW_LINE>candidate.invoicingUomId(UomId.ofRepoId(icRecord.getC_UOM_ID()));<NEW_LINE>candidate.lineDescription(icRecord.getDescription());<NEW_LINE>candidate.taxId(TaxId.ofRepoId(icRecord.getC_Tax_ID()));<NEW_LINE>return candidate.build();<NEW_LINE>} | (icRecord.getC_UOM_ID())); |
1,250,094 | public PropertySource<?> locate(Environment environment) {<NEW_LINE>if (!(environment instanceof ConfigurableEnvironment)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ConfigurableEnvironment env = (ConfigurableEnvironment) environment;<NEW_LINE>String applicationName = this.properties.getName();<NEW_LINE>if (!StringUtils.hasText(applicationName)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>List<String> profiles = Arrays.asList(env.getActiveProfiles());<NEW_LINE>CompositePropertySource composite = new CompositePropertySource(PROPERTY_SOURCE_NAME);<NEW_LINE>// Last store has highest precedence<NEW_LINE>Collections.reverse(configStores);<NEW_LINE>Iterator<ConfigStore> configStoreIterator = configStores.iterator();<NEW_LINE>// Feature Management needs to be set in the last config store.<NEW_LINE>while (configStoreIterator.hasNext()) {<NEW_LINE>ConfigStore configStore = configStoreIterator.next();<NEW_LINE>if (startup.get() || StateHolder.getLoadState(configStore.getEndpoint())) {<NEW_LINE>addPropertySource(composite, configStore, applicationName, profiles, storeContextsMap, !configStoreIterator.hasNext());<NEW_LINE>} else {<NEW_LINE>LOGGER.warn("Not loading configurations from {} as it failed on startup.", configStore.getEndpoint());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>startup.set(false);<NEW_LINE>return composite;<NEW_LINE>} | applicationName = env.getProperty(SPRING_APP_NAME_PROP); |
633,147 | // MRI: rb_str_rindex<NEW_LINE>public static int rindex(ByteList source, int sourceChars, int subChars, int pos, CodeRangeable subStringCodeRangeable, Encoding enc) {<NEW_LINE>if (subStringCodeRangeable.scanForCodeRange() == CR_BROKEN)<NEW_LINE>return -1;<NEW_LINE>final ByteList subString = subStringCodeRangeable.getByteList();<NEW_LINE>final int srcLen = source.getRealSize();<NEW_LINE>final int subLen = subString.getRealSize();<NEW_LINE>if (sourceChars < subChars || srcLen < subLen)<NEW_LINE>return -1;<NEW_LINE>if (sourceChars - pos < subChars)<NEW_LINE>pos = sourceChars - subChars;<NEW_LINE>if (sourceChars == 0)<NEW_LINE>return pos;<NEW_LINE>byte[] srcBytes = source.getUnsafeBytes();<NEW_LINE>final <MASK><NEW_LINE>if (pos == 0) {<NEW_LINE>if (ByteList.memcmp(srcBytes, srcBeg, subString.getUnsafeBytes(), subString.getBegin(), subLen) == 0) {<NEW_LINE>return 0;<NEW_LINE>}<NEW_LINE>return -1;<NEW_LINE>}<NEW_LINE>int s = nth(enc, srcBytes, srcBeg, srcBeg + srcLen, pos);<NEW_LINE>return strRindex(srcBytes, srcBeg, srcLen, subString.getUnsafeBytes(), subString.getBegin(), subLen, s, pos, enc);<NEW_LINE>} | int srcBeg = source.getBegin(); |
1,406,521 | void read(WizardDescriptor settings) {<NEW_LINE>this.wizardDescriptor = settings;<NEW_LINE>// NOI18N<NEW_LINE>File projectLocation = (File) settings.getProperty("projdir");<NEW_LINE>((FolderList) this.sourcePanel).setProjectFolder(projectLocation);<NEW_LINE>((FolderList) this.testsPanel).setProjectFolder(projectLocation);<NEW_LINE>// NOI18N<NEW_LINE>File[] srcRoot = (File[]) settings.getProperty("sourceRoot");<NEW_LINE>// NOI18N<NEW_LINE>assert srcRoot != null : "sourceRoot property must be initialized!";<NEW_LINE>((FolderList) this.sourcePanel).setFiles(srcRoot);<NEW_LINE>// NOI18N<NEW_LINE>File[] testRoot = (File[]) settings.getProperty("testRoot");<NEW_LINE>// NOI18N<NEW_LINE>assert testRoot != null : "testRoot property must be initialized!";<NEW_LINE>((FolderList) this.testsPanel).setFiles(testRoot);<NEW_LINE>// #58489 honor existing source folder<NEW_LINE>File currentDirectory = null;<NEW_LINE>FileObject folder = Templates.getExistingSourcesFolder(wizardDescriptor);<NEW_LINE>if (folder != null) {<NEW_LINE>currentDirectory = FileUtil.toFile(folder);<NEW_LINE>}<NEW_LINE>if (currentDirectory != null && currentDirectory.isDirectory()) {<NEW_LINE>((FolderList) sourcePanel).setLastUsedDir(currentDirectory);<NEW_LINE>((FolderList<MASK><NEW_LINE>}<NEW_LINE>} | ) testsPanel).setLastUsedDir(currentDirectory); |
1,703,627 | final ResendContactReachabilityEmailResult executeResendContactReachabilityEmail(ResendContactReachabilityEmailRequest resendContactReachabilityEmailRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(resendContactReachabilityEmailRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<ResendContactReachabilityEmailRequest> request = null;<NEW_LINE>Response<ResendContactReachabilityEmailResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new ResendContactReachabilityEmailRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(resendContactReachabilityEmailRequest));<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, "ResendContactReachabilityEmail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<ResendContactReachabilityEmailResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new ResendContactReachabilityEmailResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "Route 53 Domains"); |
1,846,582 | public Request<ListHostedZonesRequest> marshall(ListHostedZonesRequest listHostedZonesRequest) {<NEW_LINE>if (listHostedZonesRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>Request<ListHostedZonesRequest> request = new DefaultRequest<ListHostedZonesRequest>(listHostedZonesRequest, "AmazonRoute53");<NEW_LINE>request.setHttpMethod(HttpMethodName.GET);<NEW_LINE>String uriResourcePath = "/2013-04-01/hostedzone";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>if (listHostedZonesRequest.getMarker() != null) {<NEW_LINE>request.addParameter("marker", StringUtils.fromString(listHostedZonesRequest.getMarker()));<NEW_LINE>}<NEW_LINE>if (listHostedZonesRequest.getMaxItems() != null) {<NEW_LINE>request.addParameter("maxitems", StringUtils.fromString<MASK><NEW_LINE>}<NEW_LINE>if (listHostedZonesRequest.getDelegationSetId() != null) {<NEW_LINE>request.addParameter("delegationsetid", StringUtils.fromString(listHostedZonesRequest.getDelegationSetId()));<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (listHostedZonesRequest.getMaxItems())); |
472,294 | private void handleFacesBehaviorRenderer(FacesConfigImpl facesConfig, Set<Class<?>> classes) {<NEW_LINE>for (Class<?> clazz : classes) {<NEW_LINE>FacesBehaviorRenderer facesBehaviorRenderer = (FacesBehaviorRenderer) clazz.getAnnotation(FacesBehaviorRenderer.class);<NEW_LINE>if (facesBehaviorRenderer != null) {<NEW_LINE>String renderKitId = facesBehaviorRenderer.renderKitId();<NEW_LINE>// RenderKit renderKit;<NEW_LINE>if (log.isLoggable(Level.FINEST)) {<NEW_LINE>log.finest("addClientBehaviorRenderer(" + renderKitId + ", " + facesBehaviorRenderer.rendererType() + ", " + <MASK><NEW_LINE>}<NEW_LINE>org.apache.myfaces.config.impl.digester.elements.RenderKitImpl renderKit = (org.apache.myfaces.config.impl.digester.elements.RenderKitImpl) facesConfig.getRenderKit(renderKitId);<NEW_LINE>if (renderKit == null) {<NEW_LINE>renderKit = new org.apache.myfaces.config.impl.digester.elements.RenderKitImpl();<NEW_LINE>renderKit.setId(renderKitId);<NEW_LINE>facesConfig.addRenderKit(renderKit);<NEW_LINE>}<NEW_LINE>org.apache.myfaces.config.impl.digester.elements.ClientBehaviorRendererImpl cbr = new org.apache.myfaces.config.impl.digester.elements.ClientBehaviorRendererImpl();<NEW_LINE>cbr.setRendererType(facesBehaviorRenderer.rendererType());<NEW_LINE>cbr.setRendererClass(clazz.getName());<NEW_LINE>renderKit.addClientBehaviorRenderer(cbr);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | clazz.getName() + ")"); |
1,149,054 | public void marshall(CreateBotLocaleRequest createBotLocaleRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createBotLocaleRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createBotLocaleRequest.getBotId(), BOTID_BINDING);<NEW_LINE>protocolMarshaller.marshall(createBotLocaleRequest.getBotVersion(), BOTVERSION_BINDING);<NEW_LINE>protocolMarshaller.marshall(createBotLocaleRequest.getLocaleId(), LOCALEID_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createBotLocaleRequest.getNluIntentConfidenceThreshold(), NLUINTENTCONFIDENCETHRESHOLD_BINDING);<NEW_LINE>protocolMarshaller.marshall(createBotLocaleRequest.getVoiceSettings(), VOICESETTINGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createBotLocaleRequest.getDescription(), DESCRIPTION_BINDING); |
174,510 | protected Control createDialogArea(Composite parent) {<NEW_LINE>getShell().setText("Choose content editor");<NEW_LINE>Composite group = (Composite) super.createDialogArea(parent);<NEW_LINE>GridData gd = new GridData(GridData.FILL_BOTH);<NEW_LINE>group.setLayoutData(gd);<NEW_LINE>Label infoLabel = new Label(group, SWT.NONE);<NEW_LINE>infoLabel.setText("Content was modified in mutliple editors. Choose correct one:");<NEW_LINE>gd = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>infoLabel.setLayoutData(gd);<NEW_LINE>final Combo combo = new Combo(group, SWT.READ_ONLY | SWT.DROP_DOWN);<NEW_LINE>gd = new GridData(GridData.FILL_HORIZONTAL);<NEW_LINE>combo.setLayoutData(gd);<NEW_LINE>combo.add("");<NEW_LINE>for (IEditorPart part : dirtyParts) {<NEW_LINE>combo.<MASK><NEW_LINE>}<NEW_LINE>combo.addSelectionListener(new SelectionAdapter() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void widgetSelected(SelectionEvent e) {<NEW_LINE>if (combo.getSelectionIndex() >= 1) {<NEW_LINE>selectedPart = dirtyParts.get(combo.getSelectionIndex() - 1);<NEW_LINE>} else {<NEW_LINE>selectedPart = null;<NEW_LINE>}<NEW_LINE>getButton(IDialogConstants.OK_ID).setEnabled(selectedPart != null);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return group;<NEW_LINE>} | add(part.getTitle()); |
220,631 | private static void closeConnection(@NotNull final ClientConnection clientConnection, final boolean withReasonCode, final boolean withReasonString, @Nullable Mqtt5DisconnectReasonCode reasonCode, @Nullable String reasonString, @NotNull final Mqtt5UserProperties userProperties, final boolean forceClose) {<NEW_LINE>if (reasonCode == Mqtt5DisconnectReasonCode.SESSION_TAKEN_OVER) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>clientConnection.proposeClientState(ClientState.DISCONNECTED_BY_SERVER);<NEW_LINE>}<NEW_LINE>if (forceClose) {<NEW_LINE>clientConnection.getChannel().close();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final ProtocolVersion version = clientConnection.getProtocolVersion();<NEW_LINE>if (withReasonCode) {<NEW_LINE>if (version == ProtocolVersion.MQTTv5) {<NEW_LINE>Preconditions.checkNotNull(reasonCode, "Reason code must never be null for Mqtt 5");<NEW_LINE>}<NEW_LINE>if (!withReasonString) {<NEW_LINE>reasonString = null;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>reasonCode = null;<NEW_LINE>reasonString = null;<NEW_LINE>}<NEW_LINE>if (reasonCode != null && version == ProtocolVersion.MQTTv5) {<NEW_LINE>final DISCONNECT disconnect = new DISCONNECT(reasonCode, reasonString, userProperties, null, SESSION_EXPIRY_NOT_SET);<NEW_LINE>clientConnection.getChannel().writeAndFlush(disconnect).addListener(ChannelFutureListener.CLOSE);<NEW_LINE>} else {<NEW_LINE>// close channel without sending DISCONNECT (Mqtt 3)<NEW_LINE>clientConnection.getChannel().close();<NEW_LINE>}<NEW_LINE>} | clientConnection.proposeClientState(ClientState.DISCONNECTED_TAKEN_OVER); |
266,893 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player player = game.getPlayer(source.getControllerId());<NEW_LINE>if (player == null) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>TargetCardInLibrary target = new TargetCardInLibrary();<NEW_LINE>player.searchLibrary(target, source, game);<NEW_LINE>Card card = player.getLibrary().getCard(target.getFirstTarget(), game);<NEW_LINE>if (card == null) {<NEW_LINE><MASK><NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>if (CardType.ARTIFACT.getPredicate().apply(card, game) && player.chooseUse(Outcome.PlayForFree, "Put it onto the battlefield or your hand?", null, "Battlefield", "Hand", source, game)) {<NEW_LINE>player.moveCards(card, Zone.BATTLEFIELD, source, game);<NEW_LINE>} else {<NEW_LINE>player.moveCards(card, Zone.HAND, source, game);<NEW_LINE>}<NEW_LINE>player.shuffleLibrary(source, game);<NEW_LINE>return true;<NEW_LINE>} | player.shuffleLibrary(source, game); |
1,351,532 | public static void unzip(final GATKPath path, final File dest, final String... files) {<NEW_LINE>Utils.nonNull(path, "the path provided cannot be null");<NEW_LINE>Utils.nonNull(dest, "the destination directory provided cannot be null");<NEW_LINE>Utils.validateArg((dest.isDirectory() || dest.mkdirs()) && dest.canWrite(), "could not create destination directory");<NEW_LINE>final Predicate<File> selected = composeSelectPredicate(files);<NEW_LINE>try (final ZipInputStream in = new ZipInputStream(path.getInputStream())) {<NEW_LINE>ZipEntry entry;<NEW_LINE>while ((entry = in.getNextEntry()) != null) {<NEW_LINE>if (selected.test(new File(entry.getName()))) {<NEW_LINE>final File entryDest = new File(<MASK><NEW_LINE>if (entry.isDirectory()) {<NEW_LINE>entryDest.mkdirs();<NEW_LINE>} else {<NEW_LINE>final File parent = entryDest.getParentFile();<NEW_LINE>if (!parent.exists()) {<NEW_LINE>parent.mkdirs();<NEW_LINE>}<NEW_LINE>try (final FileOutputStream fos = new FileOutputStream(entryDest)) {<NEW_LINE>IOUtils.copy(in, fos);<NEW_LINE>} catch (final IOException e) {<NEW_LINE>throw new GATKException("problems unzipping entry", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (final IOException ex) {<NEW_LINE>throw new UserException.CouldNotReadInputFile(path.toString(), ex);<NEW_LINE>}<NEW_LINE>} | dest, entry.getName()); |
323,086 | public void visitNodeCount(int labelId, long count) {<NEW_LINE>if (isValidLabelId(labelId)) {<NEW_LINE>long pos = labelIdArrayPos(labelId);<NEW_LINE>long expected = unmarkCountVisited(nodeCounts.get(pos));<NEW_LINE>if (expected != count) {<NEW_LINE>reporter.forCounts(new CountsEntry(nodeKey(labelId), count)).inconsistentNodeCount(expected);<NEW_LINE>}<NEW_LINE>nodeCounts.set(pos, markCountVisited(expected));<NEW_LINE>} else {<NEW_LINE>AtomicLong expected = nodeCountsStray.remove(nodeKey(labelId));<NEW_LINE>if (expected != null) {<NEW_LINE>if (expected.longValue() != count) {<NEW_LINE>reporter.forCounts(new CountsEntry(nodeKey(labelId), count)).inconsistentNodeCount(expected.longValue());<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>reporter.forCounts(new CountsEntry(nodeKey(labelId), <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | count)).inconsistentNodeCount(0); |
1,231,316 | public long writeSeeds(Path sampleSeedPath) throws Exception {<NEW_LINE>int fileNo = 0;<NEW_LINE>// total number of samples<NEW_LINE>long numTotal = this.numSamples;<NEW_LINE>// number of initial centroids<NEW_LINE>int centriodNum = genParams.length;<NEW_LINE>long numPerCluster = (long) Math.ceil(numTotal / (double) centriodNum);<NEW_LINE>// num of files per cluster<NEW_LINE>long numFiles = (long) Math.ceil(numPerCluster / (double) SAMPLES_PER_FILE);<NEW_LINE>for (int k = 0; k < genParams.length; k++) {<NEW_LINE>if (genParams[k].length != dimension)<NEW_LINE>throw new Exception("The dimension of mean vector or std vector does not match desired dimension!");<NEW_LINE>StringBuilder sb = new StringBuilder();<NEW_LINE>for (int d = 0; d < dimension; d++) {<NEW_LINE>if (genParams[k][d].length != 2)<NEW_LINE>throw new Exception("The dimension of mean vector or std vector does not match desired dimension");<NEW_LINE>sb.append("\t" + Double.toString(genParams[k][d][0]) + "\t" + Double.toString(genParams[k][d][1]));<NEW_LINE>}<NEW_LINE>for (long i = 0; i < numFiles; i++) {<NEW_LINE>SequenceFile.Writer out = createNewFile(new Path(sampleSeedPath, "seed" + (fileNo++)), IntWritable.class, Text.class);<NEW_LINE>out.append(new IntWritable(k), new Text(Long.toString(SAMPLES_PER_FILE) + sb.toString()));<NEW_LINE>out.close();<NEW_LINE>}<NEW_LINE>if (numFiles * SAMPLES_PER_FILE < numPerCluster) {<NEW_LINE>long left = numPerCluster - numFiles * SAMPLES_PER_FILE;<NEW_LINE>SequenceFile.Writer out = createNewFile(new Path(sampleSeedPath, "seed" + (fileNo++)), IntWritable.class, Text.class);<NEW_LINE>out.append(new IntWritable(k), new Text(Long.toString(left) <MASK><NEW_LINE>out.close();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return numPerCluster * centriodNum;<NEW_LINE>} | + sb.toString())); |
269,877 | public PublicDnsNamespacePropertiesChange unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>PublicDnsNamespacePropertiesChange publicDnsNamespacePropertiesChange = new PublicDnsNamespacePropertiesChange();<NEW_LINE>int originalDepth = context.getCurrentDepth();<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("DnsProperties", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>publicDnsNamespacePropertiesChange.setDnsProperties(PublicDnsPropertiesMutableChangeJsonUnmarshaller.getInstance<MASK><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 publicDnsNamespacePropertiesChange;<NEW_LINE>} | ().unmarshall(context)); |
715,141 | public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer mavContainer, NativeWebRequest webRequest, WebDataBinderFactory binderFactory) {<NEW_LINE>User currentUser <MASK><NEW_LINE>String userParam = webRequest.getParameter("ownerId");<NEW_LINE>if (StringUtils.isNotBlank(userParam) && currentUser.getRole().hasPermission(Permission.SWITCH_TO_ANYONE)) {<NEW_LINE>return getUserService().getOne(userParam);<NEW_LINE>}<NEW_LINE>// User want to do something through other User status and this<NEW_LINE>// switchUser is other user Id<NEW_LINE>String switchUser = null;<NEW_LINE>Cookie[] cookies = getCookies(webRequest);<NEW_LINE>if (cookies != null) {<NEW_LINE>for (Cookie cookie : cookies) {<NEW_LINE>if ("switchUser".equals(cookie.getName()) && cookie.getMaxAge() != 0) {<NEW_LINE>switchUser = cookie.getValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Let this can be done with parameter as well.<NEW_LINE>switchUser = StringUtils.defaultIfBlank(webRequest.getParameter("switchUser"), switchUser);<NEW_LINE>if (currentUser.getUserId().equals(switchUser)) {<NEW_LINE>currentUser.setOwnerUser(null);<NEW_LINE>} else if (StringUtils.isNotEmpty(switchUser)) {<NEW_LINE>User ownerUser = getUserService().getOneWithEagerFetch(switchUser);<NEW_LINE>// CurrentUser should remember whose status he used<NEW_LINE>if (currentUser.getRole().hasPermission(Permission.SWITCH_TO_ANYONE) || (ownerUser.getFollowers() != null && ownerUser.getFollowers().contains(currentUser))) {<NEW_LINE>currentUser.setOwnerUser(ownerUser);<NEW_LINE>return ownerUser;<NEW_LINE>}<NEW_LINE>} else if (StringUtils.isEmpty(switchUser)) {<NEW_LINE>currentUser.setOwnerUser(null);<NEW_LINE>}<NEW_LINE>return currentUser.getFactualUser();<NEW_LINE>} | = getUserContext().getCurrentUser(); |
1,619,389 | private void processStatus() {<NEW_LINE>int count = 0;<NEW_LINE>// Requests with status with after timeout<NEW_LINE>String sql = "SELECT * FROM R_Request r WHERE EXISTS (" + "SELECT * FROM R_Status s " + "WHERE r.R_Status_ID=s.R_Status_ID" + " AND s.TimeoutDays > 0 AND s.Next_Status_ID > 0" + " AND r.DateLastAction+s.TimeoutDays < now()" + ") " + "ORDER BY R_Status_ID";<NEW_LINE>PreparedStatement pstmt = null;<NEW_LINE>MStatus status = null;<NEW_LINE>MStatus next = null;<NEW_LINE>try {<NEW_LINE>pstmt = DB.prepareStatement(sql, null);<NEW_LINE><MASK><NEW_LINE>while (rs.next()) {<NEW_LINE>MRequest r = new MRequest(getCtx(), rs, null);<NEW_LINE>// Get/Check Status<NEW_LINE>if (status == null || status.getR_Status_ID() != r.getR_Status_ID()) {<NEW_LINE>status = MStatus.get(getCtx(), r.getR_Status_ID());<NEW_LINE>}<NEW_LINE>if (status.getTimeoutDays() <= 0 || status.getNext_Status_ID() == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Next Status<NEW_LINE>if (next == null || next.getR_Status_ID() != status.getNext_Status_ID()) {<NEW_LINE>next = MStatus.get(getCtx(), status.getNext_Status_ID());<NEW_LINE>}<NEW_LINE>//<NEW_LINE>String result = Msg.getMsg(getCtx(), "RequestStatusTimeout") + ": " + status.getName() + " -> " + next.getName();<NEW_LINE>r.setResult(result);<NEW_LINE>r.setR_Status_ID(status.getNext_Status_ID());<NEW_LINE>if (r.save()) {<NEW_LINE>count++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>rs.close();<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.error(sql, e);<NEW_LINE>} finally {<NEW_LINE>DB.close(pstmt);<NEW_LINE>}<NEW_LINE>m_summary.append("Status Timeout #").append(count).append(" - ");<NEW_LINE>} | ResultSet rs = pstmt.executeQuery(); |
634,291 | public void growIfNeeded() {<NEW_LINE>// Vertices<NEW_LINE>if ((vertexI + 1) * primitiveVerticesSize >= vertices.capacity()) {<NEW_LINE>int offset = getVerticesOffset();<NEW_LINE>int newSize <MASK><NEW_LINE>if (newSize % primitiveVerticesSize != 0)<NEW_LINE>newSize += newSize % primitiveVerticesSize;<NEW_LINE>ByteBuffer newVertices = BufferUtils.createByteBuffer(newSize);<NEW_LINE>memCopy(memAddress0(vertices), memAddress0(newVertices), offset);<NEW_LINE>vertices = newVertices;<NEW_LINE>verticesPointerStart = memAddress0(vertices);<NEW_LINE>verticesPointer = verticesPointerStart + offset;<NEW_LINE>}<NEW_LINE>// Indices<NEW_LINE>if (indicesCount * 4 >= indices.capacity()) {<NEW_LINE>int newSize = indices.capacity() * 2;<NEW_LINE>if (newSize % drawMode.indicesCount != 0)<NEW_LINE>newSize += newSize % (drawMode.indicesCount * 4);<NEW_LINE>ByteBuffer newIndices = BufferUtils.createByteBuffer(newSize);<NEW_LINE>memCopy(memAddress0(indices), memAddress0(newIndices), indicesCount * 4L);<NEW_LINE>indices = newIndices;<NEW_LINE>indicesPointer = memAddress0(indices);<NEW_LINE>}<NEW_LINE>} | = vertices.capacity() * 2; |
167,374 | public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise) throws Exception {<NEW_LINE>try {<NEW_LINE>CurrentPassport passport = passport(ctx);<NEW_LINE>if (msg instanceof HttpRequest) {<NEW_LINE>passport.add(PassportState.OUT_REQ_HEADERS_SENDING);<NEW_LINE>promise.addListener(new PassportStateListener(passport, PassportState<MASK><NEW_LINE>}<NEW_LINE>if (msg instanceof LastHttpContent) {<NEW_LINE>passport.add(PassportState.OUT_REQ_LAST_CONTENT_SENDING);<NEW_LINE>promise.addListener(new PassportStateListener(passport, PassportState.OUT_REQ_LAST_CONTENT_SENT, PassportState.OUT_REQ_LAST_CONTENT_ERROR_SENDING));<NEW_LINE>} else if (msg instanceof HttpContent) {<NEW_LINE>passport.add(PassportState.OUT_REQ_CONTENT_SENDING);<NEW_LINE>promise.addListener(new PassportStateListener(passport, PassportState.OUT_REQ_CONTENT_SENT, PassportState.OUT_REQ_CONTENT_ERROR_SENDING));<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>super.write(ctx, msg, promise);<NEW_LINE>}<NEW_LINE>} | .OUT_REQ_HEADERS_SENT, PassportState.OUT_REQ_HEADERS_ERROR_SENDING)); |
558,139 | public void startMoving(final double finalLat, final double finalLon, final Pair<Integer, Double> finalZoom, final boolean pendingRotation, final Float finalRotation, final boolean notifyListener) {<NEW_LINE>stopAnimatingSync();<NEW_LINE>final RotatedTileBox rb = tileView.getCurrentRotatedTileBox().copy();<NEW_LINE>double startLat = rb.getLatitude();<NEW_LINE>double startLon = rb.getLongitude();<NEW_LINE>final int startZoom = rb.getZoom();<NEW_LINE>final double startZoomFP = rb.getZoomFloatPart();<NEW_LINE>final float startRotation = rb.getRotate();<NEW_LINE>final int zoom;<NEW_LINE>final double zoomFP;<NEW_LINE>final float rotation;<NEW_LINE>if (finalZoom != null && finalZoom.first != null && finalZoom.second != null) {<NEW_LINE>zoom = finalZoom.first;<NEW_LINE>zoomFP = finalZoom.second;<NEW_LINE>} else {<NEW_LINE>zoom = startZoom;<NEW_LINE>zoomFP = startZoomFP;<NEW_LINE>}<NEW_LINE>if (finalRotation != null) {<NEW_LINE>rotation = finalRotation;<NEW_LINE>} else {<NEW_LINE>rotation = startRotation;<NEW_LINE>}<NEW_LINE>final float mMoveX = rb.getPixXFromLatLon(startLat, startLon) - rb.getPixXFromLatLon(finalLat, finalLon);<NEW_LINE>final float mMoveY = rb.getPixYFromLatLon(startLat, startLon) - rb.getPixYFromLatLon(finalLat, finalLon);<NEW_LINE>boolean skipAnimation = !rb.containsLatLon(finalLat, finalLon);<NEW_LINE>if (skipAnimation) {<NEW_LINE>tileView.<MASK><NEW_LINE>tileView.setFractionalZoom(zoom, zoomFP, notifyListener);<NEW_LINE>tileView.rotateToAnimate(rotation);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>startThreadAnimating(() -> {<NEW_LINE>isAnimatingMapMove = true;<NEW_LINE>setTargetValues(zoom, zoomFP, finalLat, finalLon);<NEW_LINE>boolean animateZoom = finalZoom != null && (zoom != startZoom || startZoomFP != 0);<NEW_LINE>if (animateZoom) {<NEW_LINE>animatingZoomInThread(startZoom, startZoomFP, zoom, zoomFP, NAV_ANIMATION_TIME, notifyListener);<NEW_LINE>}<NEW_LINE>boolean animateRotation = rotation != startRotation;<NEW_LINE>if (pendingRotation) {<NEW_LINE>pendingRotateAnimation();<NEW_LINE>} else if (animateRotation) {<NEW_LINE>animatingRotateInThread(rotation, 500f, notifyListener);<NEW_LINE>}<NEW_LINE>animatingMoveInThread(mMoveX, mMoveY, NAV_ANIMATION_TIME, notifyListener, null);<NEW_LINE>isAnimatingMapMove = false;<NEW_LINE>});<NEW_LINE>} | setLatLonAnimate(finalLat, finalLon, notifyListener); |
1,164,393 | public Parent createContent() {<NEW_LINE>final NumberAxis xAxis = new NumberAxis(0, 128, 8);<NEW_LINE>final NumberAxis yAxis = new <MASK><NEW_LINE>final AreaChart<Number, Number> ac = new AreaChart<>(xAxis, yAxis);<NEW_LINE>final String audioAreaChartCss = getClass().getResource("AudioAreaChart.css").toExternalForm();<NEW_LINE>// setup media<NEW_LINE>final Media audioMedia = new Media(AUDIO_URI);<NEW_LINE>audioMediaPlayer = new MediaPlayer(audioMedia);<NEW_LINE>audioMediaPlayer.setCycleCount(MediaPlayer.INDEFINITE);<NEW_LINE>audioMediaPlayer.setAudioSpectrumListener(audioSpectrumListener);<NEW_LINE>// setup chart<NEW_LINE>ac.getStylesheets().add(audioAreaChartCss);<NEW_LINE>ac.setLegendVisible(false);<NEW_LINE>ac.setTitle("Live Audio Spectrum Data");<NEW_LINE>ac.setAnimated(false);<NEW_LINE>xAxis.setLabel("Frequency Bands");<NEW_LINE>yAxis.setLabel("Magnitudes");<NEW_LINE>yAxis.setTickLabelFormatter(new DefaultFormatter(yAxis, null, "dB"));<NEW_LINE>// add starting data<NEW_LINE>XYChart.Series<Number, Number> series = new XYChart.Series<>();<NEW_LINE>series.setName("Audio Spectrum");<NEW_LINE>// noinspection unchecked<NEW_LINE>series1Data = new XYChart.Data[(int) xAxis.getUpperBound()];<NEW_LINE>for (int i = 0; i < series1Data.length; i++) {<NEW_LINE>series1Data[i] = new XYChart.Data<Number, Number>(i, 50);<NEW_LINE>series.getData().add(series1Data[i]);<NEW_LINE>}<NEW_LINE>ac.getData().add(series);<NEW_LINE>return ac;<NEW_LINE>} | NumberAxis(0, 50, 10); |
436,305 | public void validate() throws ValidationException {<NEW_LINE>if (hasValidationError()) {<NEW_LINE>setValidationError(null);<NEW_LINE>}<NEW_LINE>if (!isVisibleRecursive() || !isEditableWithParent() || !isEnabledRecursive()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Messages messages = beanLocator.get(Messages.NAME);<NEW_LINE>V value = constructModelValue();<NEW_LINE>if (!checkRange(value, false)) {<NEW_LINE>LoggerFactory.getLogger(WebDateField.class).trace("DateField value is out of range");<NEW_LINE>String dateOutOfRangeMessage = messages.getMainMessage("datePicker.dateOutOfRangeMessage");<NEW_LINE>setValidationError(dateOutOfRangeMessage);<NEW_LINE>throw new ValidationException(dateOutOfRangeMessage);<NEW_LINE>}<NEW_LINE>if (isEmpty() && isRequired()) {<NEW_LINE>String requiredMessage = getRequiredMessage();<NEW_LINE>if (requiredMessage == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>throw new RequiredValueMissingException(requiredMessage, this);<NEW_LINE>}<NEW_LINE>value = getValue();<NEW_LINE>triggerValidators(value);<NEW_LINE>} | requiredMessage = messages.getMainMessage("validationFail.defaultRequiredMessage"); |
1,661,135 | public static // private static int counter = 1;<NEW_LINE>List<Project> mock(int projectId, String methodName, String pattern, String account) {<NEW_LINE>Date now = new Date();<NEW_LINE>List<Project> resultList = new ArrayList<Project>();<NEW_LINE>if (!DateUtils.compWorkAndCurrByDate(mockTotalNumDate, now)) {<NEW_LINE>// clear real time log data per night<NEW_LINE>resultList = SystemVisitorLog.clear();<NEW_LINE>}<NEW_LINE>mockTotalNum++;<NEW_LINE>Integer mockNum = mockMap.get(projectId);<NEW_LINE>if (mockNum == null) {<NEW_LINE>mockNum = 0;<NEW_LINE>}<NEW_LINE>mockMap.put(projectId, mockNum + 1);<NEW_LINE>Map<String, String> mockInfo = new HashMap<String, String>();<NEW_LINE>mockInfo.put("methodName", methodName);<NEW_LINE>mockInfo.put("userAccount", account);<NEW_LINE><MASK><NEW_LINE>mockMapList.add(mockInfo);<NEW_LINE>return resultList;<NEW_LINE>} | mockInfo.put("pattern", pattern); |
488,629 | // init when needed<NEW_LINE>void init() throws SocialLoginException {<NEW_LINE>if (sslSupport != null) {<NEW_LINE>Properties sslProps = null;<NEW_LINE>this.jsseHelper = sslSupport.getJSSEHelper();<NEW_LINE>if (this.jsseHelper != null) {<NEW_LINE>try {<NEW_LINE>if (sslRef != null) {<NEW_LINE>// SSLConfig<NEW_LINE>sslProps = this.jsseHelper.getProperties(sslRef);<NEW_LINE>} else {<NEW_LINE>Map<String, Object> connectionInfo = new HashMap<String, Object>();<NEW_LINE>connectionInfo.put(Constants.CONNECTION_INFO_DIRECTION, Constants.DIRECTION_INBOUND);<NEW_LINE>// default<NEW_LINE>sslProps = this.jsseHelper.getProperties(null, connectionInfo, null, true);<NEW_LINE>// SSL<NEW_LINE>}<NEW_LINE>} catch (SSLException e) {<NEW_LINE>throw new SocialLoginException("ERROR_LOADING_SSL_PROPS", e, new Object[] { e.getLocalizedMessage() });<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "sslConfig (" + sslRef + ") get: " + sslProps);<NEW_LINE>}<NEW_LINE>if (sslProps != null) {<NEW_LINE>this.sslKeyStoreName = sslProps.getProperty(com.ibm.<MASK><NEW_LINE>this.sslTrustStoreName = sslProps.getProperty(com.ibm.websphere.ssl.Constants.SSLPROP_TRUST_STORE_NAME);<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {<NEW_LINE>Tr.debug(tc, "sslTrustStoreName: " + this.sslTrustStoreName);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | websphere.ssl.Constants.SSLPROP_KEY_STORE_NAME); |
979,653 | public synchronized /*<NEW_LINE>* (non-Javadoc)<NEW_LINE>*<NEW_LINE>* @see com.ibm.ws.objectManager.ObjectStore#close()<NEW_LINE>*/<NEW_LINE>void close() throws ObjectManagerException {<NEW_LINE>final String methodName = "close";<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.entry(this, cclass, methodName);<NEW_LINE>super.close();<NEW_LINE>// Close the storeFile.<NEW_LINE>try {<NEW_LINE>if (storeFile != null)<NEW_LINE>storeFile.close();<NEW_LINE>} catch (java.io.IOException exception) {<NEW_LINE>// No FFDC Code Needed.<NEW_LINE>ObjectManager.ffdc.processException(this, <MASK><NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, "close", "via PermanentIOException");<NEW_LINE>throw new PermanentIOException(this, exception);<NEW_LINE>}<NEW_LINE>// catch (java.io.IOException exception).<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, methodName);<NEW_LINE>} | cclass, "close", exception, "1:1082:1.57"); |
1,066,525 | protected void encodeHiddenSelect(FacesContext context, AutoComplete ac, String clientId, List<String> values) throws IOException {<NEW_LINE>ResponseWriter writer = context.getResponseWriter();<NEW_LINE>String id = clientId + "_hinput";<NEW_LINE>writer.startElement("select", null);<NEW_LINE>writer.writeAttribute("id", id, null);<NEW_LINE>writer.writeAttribute("name", id, null);<NEW_LINE>writer.<MASK><NEW_LINE>writer.writeAttribute("class", "ui-helper-hidden-accessible", null);<NEW_LINE>writer.writeAttribute("tabindex", "-1", null);<NEW_LINE>writer.writeAttribute(HTML.ARIA_HIDDEN, "true", null);<NEW_LINE>if (ac.isDisabled()) {<NEW_LINE>writer.writeAttribute("disabled", "disabled", "disabled");<NEW_LINE>}<NEW_LINE>renderValidationMetadata(context, ac);<NEW_LINE>for (int i = 0; i < values.size(); i++) {<NEW_LINE>String value = values.get(i);<NEW_LINE>writer.startElement("option", null);<NEW_LINE>writer.writeAttribute("value", value, null);<NEW_LINE>writer.writeAttribute("selected", "selected", null);<NEW_LINE>writer.endElement("option");<NEW_LINE>}<NEW_LINE>writer.endElement("select");<NEW_LINE>} | writeAttribute("multiple", "multiple", null); |
1,067,334 | protected void launchGroovy(final IType runType, final IJavaProject javaProject, final String mode) {<NEW_LINE>try {<NEW_LINE>boolean excludeTestCode = (runType != null && !hasTestAttribute(runType));<NEW_LINE>Map<String, String> launchProperties = createLaunchProperties(runType, javaProject);<NEW_LINE>String launchName = (runType != null ? runType.getElementName(<MASK><NEW_LINE>ILaunchConfigurationWorkingCopy workingCopy = findOrCreateLaunchConfig(launchProperties, launchName);<NEW_LINE>List<String> classpath = new ArrayList<>();<NEW_LINE>classpath.add(newArchiveRuntimeClasspathEntry(getExportedGroovyAllJar()).getMemento());<NEW_LINE>for (IPath jarPath : getExtraJarsForClasspath()) {<NEW_LINE>classpath.add(newArchiveRuntimeClasspathEntry(jarPath).getMemento());<NEW_LINE>}<NEW_LINE>Enumeration<URL> jarUrls = getActiveGroovyBundle().findEntries("lib/" + applicationOrConsole().toLowerCase(), "*.jar", false);<NEW_LINE>if (jarUrls != null) {<NEW_LINE>for (URL jarUrl : Collections.list(jarUrls)) {<NEW_LINE>classpath.add(newArchiveRuntimeClasspathEntry(new Path(FileLocator.toFileURL(jarUrl).getPath())).getMemento());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>List<String> sourcepath = new ArrayList<>();<NEW_LINE>for (IRuntimeClasspathEntry entry : computeUnresolvedRuntimeClasspath(javaProject, excludeTestCode)) {<NEW_LINE>sourcepath.add(entry.getMemento());<NEW_LINE>}<NEW_LINE>workingCopy.setAttribute(ATTR_CLASSPATH, classpath);<NEW_LINE>workingCopy.setAttribute(ATTR_SOURCE_PATH, sourcepath);<NEW_LINE>workingCopy.setAttribute(ATTR_DEFAULT_CLASSPATH, false);<NEW_LINE>workingCopy.setAttribute(ATTR_DEFAULT_SOURCE_PATH, false);<NEW_LINE>workingCopy.setAttribute(ATTR_EXCLUDE_TEST_CODE, excludeTestCode);<NEW_LINE>ILaunchConfiguration config = workingCopy.doSave();<NEW_LINE>DebugUITools.launch(config, mode);<NEW_LINE>} catch (Exception e) {<NEW_LINE>GroovyCore.logException(LaunchShortcutHelper.bind(LaunchShortcutHelper.GroovyLaunchShortcut_failureToLaunch, applicationOrConsole()), e);<NEW_LINE>}<NEW_LINE>} | ) : javaProject.getElementName()); |
817,318 | private // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents<NEW_LINE>void initComponents() {<NEW_LINE>requireCertificateChBox = new javax.swing.JCheckBox();<NEW_LINE>// NOI18N<NEW_LINE>org.openide.awt.Mnemonics.setLocalizedText(requireCertificateChBox, org.openide.util.NbBundle.getMessage<MASK><NEW_LINE>requireCertificateChBox.setMargin(new java.awt.Insets(0, 0, 0, 0));<NEW_LINE>requireCertificateChBox.addActionListener(new java.awt.event.ActionListener() {<NEW_LINE><NEW_LINE>public void actionPerformed(java.awt.event.ActionEvent evt) {<NEW_LINE>requireCertificateChBoxActionPerformed(evt);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);<NEW_LINE>this.setLayout(layout);<NEW_LINE>layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(requireCertificateChBox).addContainerGap(40, Short.MAX_VALUE)));<NEW_LINE>layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(layout.createSequentialGroup().addContainerGap().addComponent(requireCertificateChBox).addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));<NEW_LINE>} | (TransportSecurity.class, "LBL_RequireClientCertificate")); |
638,443 | private JComponent createColorButtonsPanel(final FileColorConfiguration configuration) {<NEW_LINE>final JPanel result = new JPanel(new BorderLayout());<NEW_LINE>result.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));<NEW_LINE>final JPanel inner = new JPanel();<NEW_LINE>inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS));<NEW_LINE>inner.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1), BorderFactory.createEmptyBorder(5, <MASK><NEW_LINE>if (!UIUtil.isUnderDarcula()) {<NEW_LINE>inner.setBackground(Color.WHITE);<NEW_LINE>}<NEW_LINE>result.add(inner, BorderLayout.CENTER);<NEW_LINE>final ButtonGroup group = new ButtonGroup();<NEW_LINE>myColorToButtonMap = new HashMap<String, AbstractButton>();<NEW_LINE>final Collection<String> names = myManager.getColorNames();<NEW_LINE>for (final String name : names) {<NEW_LINE>final ColorButton colorButton = new ColorButton(name, myManager.getColor(name));<NEW_LINE>group.add(colorButton);<NEW_LINE>inner.add(colorButton);<NEW_LINE>myColorToButtonMap.put(name, colorButton);<NEW_LINE>inner.add(Box.createHorizontalStrut(5));<NEW_LINE>}<NEW_LINE>final CustomColorButton customButton = new CustomColorButton();<NEW_LINE>group.add(customButton);<NEW_LINE>inner.add(customButton);<NEW_LINE>myColorToButtonMap.put(customButton.getText(), customButton);<NEW_LINE>inner.add(Box.createHorizontalStrut(5));<NEW_LINE>if (configuration != null) {<NEW_LINE>final AbstractButton button = myColorToButtonMap.get(configuration.getColorName());<NEW_LINE>if (button != null) {<NEW_LINE>button.setSelected(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | 5, 5, 5))); |
728,329 | private void init() {<NEW_LINE>exceptionUnmarshallers.add(new InvalidFirehoseDestinationExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidS3ConfigurationExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidDeliveryOptionsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidSNSDestinationExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidRenderingParameterExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new MessageRejectedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidCloudWatchDestinationExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new AccountSendingPausedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new RuleSetDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidSnsTopicExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new LimitExceededExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new ConfigurationSetSendingPausedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new EventDestinationDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidLambdaFunctionExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new TemplateDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new MissingRenderingAttributeExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new AlreadyExistsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new CannotDeleteExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new TrackingOptionsAlreadyExistsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new ConfigurationSetAlreadyExistsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new CustomVerificationEmailInvalidContentExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidTemplateExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new MailFromDomainNotVerifiedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new ConfigurationSetDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new ProductionAccessNotGrantedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidTrackingOptionsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new TrackingOptionsDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new EventDestinationAlreadyExistsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new FromEmailAddressNotVerifiedExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new RuleDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidConfigurationSetExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new CustomVerificationEmailTemplateDoesNotExistExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new InvalidPolicyExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new CustomVerificationEmailTemplateAlreadyExistsExceptionUnmarshaller());<NEW_LINE>exceptionUnmarshallers.add(new StandardErrorUnmarshaller(com.amazonaws.services.simpleemail.model.AmazonSimpleEmailServiceException.class));<NEW_LINE>setServiceNameIntern(DEFAULT_SIGNING_NAME);<NEW_LINE>setEndpointPrefix(ENDPOINT_PREFIX);<NEW_LINE>// calling this.setEndPoint(...) will also modify the signer accordingly<NEW_LINE>this.setEndpoint("https://email.us-east-1.amazonaws.com");<NEW_LINE>HandlerChainFactory chainFactory = new HandlerChainFactory();<NEW_LINE>requestHandler2s.addAll<MASK><NEW_LINE>requestHandler2s.addAll(chainFactory.newRequestHandler2Chain("/com/amazonaws/services/simpleemail/request.handler2s"));<NEW_LINE>requestHandler2s.addAll(chainFactory.getGlobalHandlers());<NEW_LINE>} | (chainFactory.newRequestHandlerChain("/com/amazonaws/services/simpleemail/request.handlers")); |
1,198,371 | private void doExecute() {<NEW_LINE>assert enabled_ : "AppCommand executed when it was not enabled";<NEW_LINE>if (!enabled_)<NEW_LINE>return;<NEW_LINE>assert visible_ : "AppCommand executed when it was not visible";<NEW_LINE>if (!visible_)<NEW_LINE>return;<NEW_LINE>// if this window is a satellite but the command only wants to be handled<NEW_LINE>// in the a different window, execute the command there instead<NEW_LINE>Satellite satellite = RStudioGinjector.INSTANCE.getSatellite();<NEW_LINE>if (getWindowMode() != WINDOW_MODE_ANY && Satellite.isCurrentWindowSatellite() && satellite.getSatelliteName() != getWindowMode()) {<NEW_LINE>if (getWindowMode() == WINDOW_MODE_MAIN) {<NEW_LINE>// raise the main window if it's not a background command<NEW_LINE>satellite.focusMainWindow();<NEW_LINE>} else if (getWindowMode() == WINDOW_MODE_BACKGROUND && Desktop.hasDesktopFrame()) {<NEW_LINE>// for background commands, we still want the main window to be<NEW_LINE>// as visible as possible, so bring it up behind the current window<NEW_LINE>// (this is of course only possible in desktop mode)<NEW_LINE>Desktop.getFrame().bringMainFrameBehindActive();<NEW_LINE>}<NEW_LINE>// satellites don't fire commands peer-to-peer--route it to the main<NEW_LINE>// window for processing<NEW_LINE>SatelliteManager mgr = RStudioGinjector.INSTANCE.getSatelliteManager();<NEW_LINE>mgr.dispatchCommand(this, null);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (enableNoHandlerAssertions_) {<NEW_LINE>assert handlers_.getHandlerCount(CommandEvent.TYPE) <MASK><NEW_LINE>}<NEW_LINE>CommandEvent event = new CommandEvent(this);<NEW_LINE>RStudioGinjector.INSTANCE.getEventBus().fireEvent(event);<NEW_LINE>handlers_.fireEvent(event);<NEW_LINE>} | > 0 : "AppCommand executed but nobody was listening: " + getId(); |
135,121 | public void drawUI(@NonNull final ViewGroup parent, @NonNull final MapActivity mapActivity) {<NEW_LINE>FavouritesHelper helper = mapActivity.getMyApplication().getFavoritesHelper();<NEW_LINE>final View root = LayoutInflater.from(parent.getContext()).inflate(R.layout.quick_action_add_favorite, parent, false);<NEW_LINE>parent.addView(root);<NEW_LINE>AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) root.findViewById(R.id.category_edit);<NEW_LINE>SwitchCompat showDialog = (SwitchCompat) root.findViewById(R.id.saveButton);<NEW_LINE>ImageView categoryImage = (ImageView) root.findViewById(R.id.category_image);<NEW_LINE>EditText name = (EditText) root.findViewById(R.id.name_edit);<NEW_LINE>if (!getParams().isEmpty()) {<NEW_LINE>showDialog.setChecked(Boolean.valueOf(getParams().get(KEY_DIALOG)));<NEW_LINE>categoryImage.setColorFilter(Integer.valueOf(getParams().get(KEY_CATEGORY_COLOR)));<NEW_LINE>name.setText(getParams().get(KEY_NAME));<NEW_LINE>categoryEdit.setText(getParams().get(KEY_CATEGORY_NAME));<NEW_LINE>if (getParams().get(KEY_NAME).isEmpty() && Integer.valueOf(getParams().get(KEY_CATEGORY_COLOR)) == 0) {<NEW_LINE>categoryEdit.setText(mapActivity.getString(R.string.shared_string_favorites));<NEW_LINE>categoryImage.setColorFilter(mapActivity.getResources().getColor(R.color.color_favorite));<NEW_LINE>}<NEW_LINE>} else if (helper.getFavoriteGroups().size() > 0) {<NEW_LINE>FavoriteGroup group = helper.getFavoriteGroups().get(0);<NEW_LINE>int color = group.getColor() == 0 ? mapActivity.getResources().getColor(R.color.color_favorite) : group.getColor();<NEW_LINE>categoryEdit.setText(group.getDisplayName(mapActivity));<NEW_LINE>categoryImage.setColorFilter(color);<NEW_LINE>getParams().put(KEY_CATEGORY_NAME, group.getName());<NEW_LINE>getParams().put(KEY_CATEGORY_COLOR, String.valueOf(group.getColor()));<NEW_LINE>} else {<NEW_LINE>categoryEdit.setText(mapActivity.getString(R.string.shared_string_favorites));<NEW_LINE>categoryImage.setColorFilter(mapActivity.getResources().getColor(R.color.color_favorite));<NEW_LINE>getParams(<MASK><NEW_LINE>getParams().put(KEY_CATEGORY_COLOR, "0");<NEW_LINE>}<NEW_LINE>categoryEdit.setOnClickListener(view -> {<NEW_LINE>FragmentManager fragmentManager = mapActivity.getSupportFragmentManager();<NEW_LINE>CategorySelectionListener listener = (category, color) -> fillGroupParams(root, category, color);<NEW_LINE>SelectPointsCategoryBottomSheet.showSelectFavoriteCategoryFragment(fragmentManager, listener, "");<NEW_LINE>});<NEW_LINE>SelectPointsCategoryBottomSheet dialogFragment = (SelectPointsCategoryBottomSheet) mapActivity.getSupportFragmentManager().findFragmentByTag(SelectPointsCategoryBottomSheet.TAG);<NEW_LINE>if (dialogFragment != null) {<NEW_LINE>dialogFragment.setSelectionListener((category, color) -> fillGroupParams(root, category, color));<NEW_LINE>}<NEW_LINE>} | ).put(KEY_CATEGORY_NAME, ""); |
719,590 | private void jsonError(final JsonParseException ex, final HttpServletRequest request, final HttpServletResponse response) throws IOException {<NEW_LINE>Map<String, Object> root = new HashMap<String, Object>();<NEW_LINE>Map<String, Object> error = new HashMap<String, Object>();<NEW_LINE>String filename = jsonFilename(request);<NEW_LINE>JsonLocation location = ex.getLocation();<NEW_LINE>String reason = ex.getMessage();<NEW_LINE>int atIdx = reason.lastIndexOf(" at ");<NEW_LINE>if (atIdx > 0) {<NEW_LINE>reason = reason.substring(0, atIdx);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>error.put("line", location.getLineNr());<NEW_LINE>error.put("column", location.getColumnNr());<NEW_LINE>error.put("reason", reason);<NEW_LINE>error.put("type", "JSON error");<NEW_LINE>String json = read(filename);<NEW_LINE>StringBuilder evidence = new StringBuilder();<NEW_LINE>int i = (int) location.getCharOffset();<NEW_LINE>int nl = 0;<NEW_LINE>while (i >= 0 && nl < 2) {<NEW_LINE>char ch = json.charAt(i);<NEW_LINE>if (ch == '\n') {<NEW_LINE>nl++;<NEW_LINE>}<NEW_LINE>evidence.insert(0, ch);<NEW_LINE>i--;<NEW_LINE>}<NEW_LINE>i = (int) location.getCharOffset() + 1;<NEW_LINE>nl = 0;<NEW_LINE>while (i < json.length() && nl < 2) {<NEW_LINE>char ch = json.charAt(i);<NEW_LINE>if (ch == '\n') {<NEW_LINE>nl++;<NEW_LINE>}<NEW_LINE>evidence.append(ch);<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>error.put("evidence", evidence);<NEW_LINE>root.put("error", error);<NEW_LINE>int firstLine = Math.max(1, ex.getLocation().getLineNr() - 1);<NEW_LINE>fancyError(root, firstLine, "JScript", response);<NEW_LINE>} | error.put("filename", filename); |
1,684,432 | private void moveClassInstanceMethodWithStub(String className, Node methodDefinition, Node destinationParent) {<NEW_LINE>checkArgument(methodDefinition.isMemberFunctionDef(), methodDefinition);<NEW_LINE>Node classMembers = checkNotNull(methodDefinition.getParent());<NEW_LINE>checkState(<MASK><NEW_LINE>Node classNode = classMembers.getParent();<NEW_LINE>checkState(classNode.isClass(), classNode);<NEW_LINE>int stubId = idGenerator.newId();<NEW_LINE>// Put a stub definition after the class<NEW_LINE>// ClassName.prototype.propertyName = JSCompiler_stubMethod(id);<NEW_LINE>Node classNameDotPrototypeDotPropName = astFactory.createGetProp(astFactory.createPrototypeAccess(astFactory.createName(className, type(classNode))), methodDefinition.getString(), type(methodDefinition));<NEW_LINE>Node stubCall = createStubCall(methodDefinition, stubId);<NEW_LINE>Node stubDefinitionStatement = astFactory.createAssignStatement(classNameDotPrototypeDotPropName, stubCall).srcrefTreeIfMissing(methodDefinition);<NEW_LINE>Node classDefiningStatement = NodeUtil.getEnclosingStatement(classMembers);<NEW_LINE>stubDefinitionStatement.insertAfter(classDefiningStatement);<NEW_LINE>// remove the definition from the class<NEW_LINE>methodDefinition.detach();<NEW_LINE>compiler.reportChangeToEnclosingScope(classMembers);<NEW_LINE>// Prepend unstub definition to the new location.<NEW_LINE>// ClassName.prototype.propertyName = JSCompiler_unstubMethod(id, function(...) {...});<NEW_LINE>Node classNameDotPrototypeDotPropName2 = classNameDotPrototypeDotPropName.cloneTree();<NEW_LINE>Node functionNode = checkNotNull(methodDefinition.getOnlyChild());<NEW_LINE>functionNode.detach();<NEW_LINE>Node unstubCall = createUnstubCall(functionNode, stubId);<NEW_LINE>Node statementNode = astFactory.createAssignStatement(classNameDotPrototypeDotPropName2, unstubCall).srcrefTreeIfMissing(methodDefinition);<NEW_LINE>destinationParent.addChildToFront(statementNode);<NEW_LINE>compiler.reportChangeToEnclosingScope(destinationParent);<NEW_LINE>} | classMembers.isClassMembers(), classMembers); |
781,778 | protected void dispatchDraw(Canvas canvas) {<NEW_LINE>super.dispatchDraw(canvas);<NEW_LINE>if (mColors == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int pl = getPaddingLeft();<NEW_LINE>int pr = getPaddingRight();<NEW_LINE>int pt = getPaddingTop();<NEW_LINE>int pb = getPaddingBottom();<NEW_LINE>int horizontalSpacing = (mBadgesPerRow - 1) * mBadgeSpacing;<NEW_LINE>int verticalSpacing = (getBadgeRows() - 1) * mBadgeSpacing;<NEW_LINE>float availableHorizontal = canvas.getWidth() - pl - pr - horizontalSpacing;<NEW_LINE>float availableVertical = canvas.getHeight() - pt - pb - verticalSpacing;<NEW_LINE>float badgeSize = Math.min(availableHorizontal / <MASK><NEW_LINE>for (int row = 0, col = 0, i = 0; i < mColors.length; i++) {<NEW_LINE>float centerX = pl + col * (mBadgeSpacing + badgeSize) + (badgeSize / 2);<NEW_LINE>float centerY = pt + row * (mBadgeSpacing + badgeSize) + (badgeSize / 2);<NEW_LINE>mBadgePaint.setColor(mColors[i]);<NEW_LINE>canvas.drawCircle(centerX, centerY, badgeSize / 2, mBadgePaint);<NEW_LINE>col++;<NEW_LINE>if (col == mBadgesPerRow) {<NEW_LINE>col = 0;<NEW_LINE>row++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | mBadgesPerRow, availableVertical / getBadgeRows()); |
687,217 | private PsiReference resolveFieldDefinition(GraphQLReferenceMixin element, GraphQLFieldDefinition fieldDefinition) {<NEW_LINE>final String name = fieldDefinition.getName();<NEW_LINE>if (name != null) {<NEW_LINE>final GraphQLTypeSystemDefinition typeSystemDefinition = PsiTreeUtil.getParentOfType(element, GraphQLTypeSystemDefinition.class);<NEW_LINE>if (typeSystemDefinition != null) {<NEW_LINE>final GraphQLImplementsInterfaces implementsInterfaces = PsiTreeUtil.<MASK><NEW_LINE>if (implementsInterfaces != null) {<NEW_LINE>for (GraphQLTypeName implementedType : implementsInterfaces.getTypeNameList()) {<NEW_LINE>final PsiReference typeReference = implementedType.getNameIdentifier().getReference();<NEW_LINE>if (typeReference != null) {<NEW_LINE>final PsiElement interfaceIdentifier = typeReference.resolve();<NEW_LINE>if (interfaceIdentifier != null) {<NEW_LINE>final GraphQLTypeSystemDefinition interfaceDefinition = PsiTreeUtil.getParentOfType(interfaceIdentifier, GraphQLTypeSystemDefinition.class);<NEW_LINE>final Collection<GraphQLFieldDefinition> interfaceFieldDefinitions = PsiTreeUtil.findChildrenOfType(interfaceDefinition, GraphQLFieldDefinition.class);<NEW_LINE>for (GraphQLFieldDefinition interfaceFieldDefinition : interfaceFieldDefinitions) {<NEW_LINE>if (name.equals(interfaceFieldDefinition.getName())) {<NEW_LINE>return createReference(element, interfaceFieldDefinition.getNameIdentifier());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | findChildOfType(typeSystemDefinition, GraphQLImplementsInterfaces.class); |
246,186 | private AndroidManifest parse(File androidManifestFile, boolean libraryProject) throws AndroidManifestNotFoundException {<NEW_LINE>DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();<NEW_LINE>Document doc;<NEW_LINE>try {<NEW_LINE>DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();<NEW_LINE>doc = docBuilder.parse(androidManifestFile);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOGGER.error("Could not parse the AndroidManifest.xml file at path {}", androidManifestFile, e);<NEW_LINE>throw new AndroidManifestNotFoundException("Could not parse the AndroidManifest.xml file at path {}" + androidManifestFile, e);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>documentElement.normalize();<NEW_LINE>String applicationPackage = documentElement.getAttribute("package");<NEW_LINE>int minSdkVersion = -1;<NEW_LINE>int maxSdkVersion = -1;<NEW_LINE>int targetSdkVersion = -1;<NEW_LINE>NodeList sdkNodes = documentElement.getElementsByTagName("uses-sdk");<NEW_LINE>if (sdkNodes.getLength() > 0) {<NEW_LINE>Node sdkNode = sdkNodes.item(0);<NEW_LINE>minSdkVersion = extractAttributeIntValue(sdkNode, "android:minSdkVersion", -1);<NEW_LINE>maxSdkVersion = extractAttributeIntValue(sdkNode, "android:maxSdkVersion", -1);<NEW_LINE>targetSdkVersion = extractAttributeIntValue(sdkNode, "android:targetSdkVersion", -1);<NEW_LINE>}<NEW_LINE>if (libraryProject) {<NEW_LINE>return AndroidManifest.createLibraryManifest(applicationPackage, minSdkVersion, maxSdkVersion, targetSdkVersion);<NEW_LINE>}<NEW_LINE>NodeList applicationNodes = documentElement.getElementsByTagName("application");<NEW_LINE>String applicationClassQualifiedName = null;<NEW_LINE>boolean applicationDebuggableMode = false;<NEW_LINE>if (applicationNodes.getLength() > 0) {<NEW_LINE>Node applicationNode = applicationNodes.item(0);<NEW_LINE>Node nameAttribute = applicationNode.getAttributes().getNamedItem("android:name");<NEW_LINE>applicationClassQualifiedName = manifestNameToValidQualifiedName(applicationPackage, nameAttribute);<NEW_LINE>if (applicationClassQualifiedName == null) {<NEW_LINE>if (nameAttribute != null) {<NEW_LINE>LOGGER.warn("The class application declared in the AndroidManifest.xml cannot be found in the compile path: [{}]", nameAttribute.getNodeValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Node debuggableAttribute = applicationNode.getAttributes().getNamedItem("android:debuggable");<NEW_LINE>if (debuggableAttribute != null) {<NEW_LINE>applicationDebuggableMode = debuggableAttribute.getNodeValue().equalsIgnoreCase("true");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>NodeList activityNodes = documentElement.getElementsByTagName("activity");<NEW_LINE>List<String> activityQualifiedNames = extractComponentNames(applicationPackage, activityNodes);<NEW_LINE>NodeList serviceNodes = documentElement.getElementsByTagName("service");<NEW_LINE>List<String> serviceQualifiedNames = extractComponentNames(applicationPackage, serviceNodes);<NEW_LINE>NodeList receiverNodes = documentElement.getElementsByTagName("receiver");<NEW_LINE>List<String> receiverQualifiedNames = extractComponentNames(applicationPackage, receiverNodes);<NEW_LINE>NodeList providerNodes = documentElement.getElementsByTagName("provider");<NEW_LINE>List<String> providerQualifiedNames = extractComponentNames(applicationPackage, providerNodes);<NEW_LINE>List<String> componentQualifiedNames = new ArrayList<>();<NEW_LINE>componentQualifiedNames.addAll(activityQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(serviceQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(receiverQualifiedNames);<NEW_LINE>componentQualifiedNames.addAll(providerQualifiedNames);<NEW_LINE>NodeList metaDataNodes = documentElement.getElementsByTagName("meta-data");<NEW_LINE>Map<String, AndroidManifest.MetaDataInfo> metaDataQualifiedNames = extractMetaDataQualifiedNames(metaDataNodes);<NEW_LINE>NodeList usesPermissionNodes = documentElement.getElementsByTagName("uses-permission");<NEW_LINE>List<String> usesPermissionQualifiedNames = extractUsesPermissionNames(usesPermissionNodes);<NEW_LINE>List<String> permissionQualifiedNames = new ArrayList<>();<NEW_LINE>permissionQualifiedNames.addAll(usesPermissionQualifiedNames);<NEW_LINE>return AndroidManifest.createManifest(applicationPackage, applicationClassQualifiedName, componentQualifiedNames, metaDataQualifiedNames, permissionQualifiedNames, minSdkVersion, maxSdkVersion, targetSdkVersion, applicationDebuggableMode);<NEW_LINE>} | Element documentElement = doc.getDocumentElement(); |
1,288,203 | public <R> CompletableFuture<R> handleAsync(BiFunction<? super T, Throwable, ? extends R> action, Executor executor) {<NEW_LINE>rejectManagedTask(action);<NEW_LINE>FutureRefExecutor futureExecutor = supportsAsync(executor);<NEW_LINE>if (!(action instanceof ContextualBiFunction)) {<NEW_LINE>ThreadContextDescriptor contextDescriptor = captureThreadContext(executor);<NEW_LINE>if (contextDescriptor != null)<NEW_LINE>action = new ContextualBiFunction<>(contextDescriptor, action);<NEW_LINE>}<NEW_LINE>if (JAVA8) {<NEW_LINE>CompletableFuture<R> dependentStage = completableFuture.handleAsync(action, futureExecutor == null ? executor : futureExecutor);<NEW_LINE>return newInstance(dependentStage, defaultExecutor, futureExecutor);<NEW_LINE>} else {<NEW_LINE>futureRefLocal.set(futureExecutor);<NEW_LINE>try {<NEW_LINE>return super.handleAsync(action, <MASK><NEW_LINE>} finally {<NEW_LINE>futureRefLocal.remove();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | futureExecutor == null ? executor : futureExecutor); |
624,324 | public void genTokenStrings() {<NEW_LINE>// Generate a string for each token. This creates a static<NEW_LINE>// array of Strings indexed by token type.<NEW_LINE>println("");<NEW_LINE>println("public static final tokenNames_ = (");<NEW_LINE>tabs++;<NEW_LINE>// Walk the token vocabulary and generate a Vector of strings<NEW_LINE>// from the tokens.<NEW_LINE>Vector v = grammar.tokenManager.getVocabulary();<NEW_LINE>for (int i = 0; i < v.size(); i++) {<NEW_LINE>String s = (<MASK><NEW_LINE>if (s == null) {<NEW_LINE>s = "<" + String.valueOf(i) + ">";<NEW_LINE>}<NEW_LINE>if (!s.startsWith("\"") && !s.startsWith("<")) {<NEW_LINE>TokenSymbol ts = (TokenSymbol) grammar.tokenManager.getTokenSymbol(s);<NEW_LINE>if (ts != null && ts.getParaphrase() != null) {<NEW_LINE>s = StringUtils.stripFrontBack(ts.getParaphrase(), "\"", "\"");<NEW_LINE>}<NEW_LINE>} else if (s.startsWith("\"")) {<NEW_LINE>s = StringUtils.stripFrontBack(s, "\"", "\"");<NEW_LINE>}<NEW_LINE>print(charFormatter.literalString(s));<NEW_LINE>_print(",");<NEW_LINE>_println("");<NEW_LINE>}<NEW_LINE>// Close the string array initailizer<NEW_LINE>tabs--;<NEW_LINE>println(")");<NEW_LINE>} | String) v.elementAt(i); |
1,192,044 | public void handleEvent(Event event) {<NEW_LINE>if (list.getSelectionCount() == 0 || list.isSelected(list.getItemCount() - 1)) {<NEW_LINE>// do not move anything if either nothing is selected or only the last item is selected<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>int[] selectedItems = list.getSelectionIndices();<NEW_LINE>for (int i = selectedItems.length - 1; i >= 0; i--) {<NEW_LINE>// here, index is always < getItemCount()<NEW_LINE>int index = selectedItems[i];<NEW_LINE>list.deselect(index);<NEW_LINE>String oldItem = list.getItem(index + 1);<NEW_LINE>list.setItem(index + 1, list.getItem(index));<NEW_LINE><MASK><NEW_LINE>list.select(index + 1);<NEW_LINE>}<NEW_LINE>if (!Platform.MAC_OS) {<NEW_LINE>// this doesn't look good on Mac<NEW_LINE>list.setTopIndex(selectedItems[0]);<NEW_LINE>}<NEW_LINE>} | list.setItem(index, oldItem); |
609,723 | public void registerService(String serviceName, String groupName, Instance instance) throws NacosException {<NEW_LINE>NAMING_LOGGER.info("[REGISTER-SERVICE] {} registering service {} with instance: {}", namespaceId, serviceName, instance);<NEW_LINE>String groupedServiceName = NamingUtils.getGroupedName(serviceName, groupName);<NEW_LINE>if (instance.isEphemeral()) {<NEW_LINE>BeatInfo beatInfo = beatReactor.buildBeatInfo(groupedServiceName, instance);<NEW_LINE>beatReactor.addBeatInfo(groupedServiceName, beatInfo);<NEW_LINE>}<NEW_LINE>final Map<String, String> params = new HashMap<String, String>(32);<NEW_LINE>params.put(CommonParams.NAMESPACE_ID, namespaceId);<NEW_LINE>params.put(CommonParams.SERVICE_NAME, groupedServiceName);<NEW_LINE>params.put(CommonParams.GROUP_NAME, groupName);<NEW_LINE>params.put(CommonParams.CLUSTER_NAME, instance.getClusterName());<NEW_LINE>params.put(IP_PARAM, instance.getIp());<NEW_LINE>params.put(PORT_PARAM, String.valueOf(instance.getPort()));<NEW_LINE>params.put(WEIGHT_PARAM, String.valueOf(instance.getWeight()));<NEW_LINE>params.put(REGISTER_ENABLE_PARAM, String.valueOf(instance.isEnabled()));<NEW_LINE>params.put(HEALTHY_PARAM, String.valueOf(instance.isHealthy()));<NEW_LINE>params.put(EPHEMERAL_PARAM, String.valueOf(instance.isEphemeral()));<NEW_LINE>params.put(META_PARAM, JacksonUtils.toJson(instance.getMetadata()));<NEW_LINE>reqApi(UtilAndComs.<MASK><NEW_LINE>} | nacosUrlInstance, params, HttpMethod.POST); |
890,729 | private ObjectInstance dumpSource(InteropLibrary iop, HeapDump seg, Object source) throws IOException, UnsupportedMessageException {<NEW_LINE>String srcName = readMember(iop, source, "name", iop::asString);<NEW_LINE>String mimeType = asStringOrNull(iop, source, "mimeType");<NEW_LINE>String uri = asStringOrNull(iop, source, "uri");<NEW_LINE>String characters = <MASK><NEW_LINE>SourceKey key = new SourceKey(srcName, uri, mimeType, characters);<NEW_LINE>ObjectInstance prevId = sources.get(key);<NEW_LINE>if (prevId != null) {<NEW_LINE>return prevId;<NEW_LINE>}<NEW_LINE>if (sourceClass == null) {<NEW_LINE>keyClass = seg.newClass("com.oracle.truffle.api.source.SourceImpl$Key").field("uri", String.class).field("content", String.class).field("mimeType", String.class).field("name", String.class).dumpClass();<NEW_LINE>sourceClass = seg.newClass("com.oracle.truffle.api.source.Source").field("key", Object.class).dumpClass();<NEW_LINE>}<NEW_LINE>ObjectInstance keyId = seg.newInstance(keyClass).put("uri", seg.dumpString(uri)).put("mimeType", seg.dumpString(mimeType)).put("content", seg.dumpString(characters)).put("name", seg.dumpString(srcName)).dumpInstance();<NEW_LINE>ObjectInstance srcId = seg.newInstance(sourceClass).put("key", keyId).dumpInstance();<NEW_LINE>sources.put(key, srcId);<NEW_LINE>return srcId;<NEW_LINE>} | asStringOrNull(iop, source, "characters"); |
252,390 | public static String nanoSecToString(final long nS) {<NEW_LINE>final long rem_nS = (long) (nS % 1000.0);<NEW_LINE>final long rem_uS = (long) (nS / 1000.0 % 1000.0);<NEW_LINE>final long rem_mS = (long) (nS / 1000000.0 % 1000.0);<NEW_LINE>final long sec = (long) (nS / 1000000000.0);<NEW_LINE>final String nSstr = zeroPad(Long.toString(rem_nS), 3);<NEW_LINE>final String uSstr = zeroPad(Long.toString(rem_uS), 3);<NEW_LINE>final String mSstr = zeroPad(Long<MASK><NEW_LINE>return String.format("%d.%3s_%3s_%3s", sec, mSstr, uSstr, nSstr);<NEW_LINE>} | .toString(rem_mS), 3); |
130,135 | protected void addObjectCreateActions(DBRProgressMonitor monitor, DBCExecutionContext executionContext, List<DBEPersistAction> actions, ObjectCreateCommand command, Map<String, Object> options) {<NEW_LINE>final ExasolConnection con = command.getObject();<NEW_LINE>StringBuilder script = new StringBuilder(String.format("CREATE CONNECTION %s TO ", <MASK><NEW_LINE>script.append(" '" + ExasolUtils.quoteString(con.getConnectionString()) + "' ");<NEW_LINE>if (!(con.getUserName().isEmpty() | con.getPassword().isEmpty())) {<NEW_LINE>script.append(String.format("USER '%s' IDENTIFIED BY '%s'", ExasolUtils.quoteString(con.getUserName()), ExasolUtils.quoteString(con.getPassword())));<NEW_LINE>}<NEW_LINE>actions.add(new SQLDatabasePersistAction("Create Connection", script.toString()));<NEW_LINE>if (!con.getDescription().isEmpty()) {<NEW_LINE>actions.add(getCommentCommand(con));<NEW_LINE>}<NEW_LINE>} | DBUtils.getQuotedIdentifier(con))); |
575,973 | public void onTextAvailable(ProcessEvent event, Key outputType) {<NEW_LINE>String text = StringUtil.notNullize(event.getText());<NEW_LINE>if (outputType == ProcessOutputTypes.STDERR) {<NEW_LINE>LOG.warn(text.trim());<NEW_LINE>} else {<NEW_LINE>LOG.<MASK><NEW_LINE>}<NEW_LINE>RunningInfo result = null;<NEW_LINE>PendingInfo info;<NEW_LINE>synchronized (myProcMap) {<NEW_LINE>Info o = myProcMap.get(key);<NEW_LINE>logText(key.second, event, outputType, o);<NEW_LINE>if (o instanceof PendingInfo) {<NEW_LINE>info = (PendingInfo) o;<NEW_LINE>if (outputType == ProcessOutputTypes.STDOUT) {<NEW_LINE>String prefix = "Port/ID:";<NEW_LINE>if (text.startsWith(prefix)) {<NEW_LINE>String pair = text.substring(prefix.length()).trim();<NEW_LINE>int idx = pair.indexOf("/");<NEW_LINE>result = new RunningInfo(info.handler, Integer.parseInt(pair.substring(0, idx)), pair.substring(idx + 1));<NEW_LINE>myProcMap.put(key, result);<NEW_LINE>myProcMap.notifyAll();<NEW_LINE>}<NEW_LINE>} else if (outputType == ProcessOutputTypes.STDERR) {<NEW_LINE>info.stderr.append(text);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>info = null;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result != null) {<NEW_LINE>synchronized (info.ref) {<NEW_LINE>info.ref.set(result);<NEW_LINE>info.ref.notifyAll();<NEW_LINE>}<NEW_LINE>fireModificationCountChanged();<NEW_LINE>try {<NEW_LINE>RemoteDeadHand.TwoMinutesTurkish.startCooking("localhost", result.port);<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.warn("The cook failed to start due to " + ExceptionUtil.getRootCause(e));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | info(text.trim()); |
1,319,506 | public View onCreateDemoView(LayoutInflater layoutInflater, @Nullable ViewGroup viewGroup, @Nullable Bundle bundle) {<NEW_LINE>View view = layoutInflater.inflate(R.layout.cat_menu_fragment, viewGroup, false);<NEW_LINE>Button button = view.<MASK><NEW_LINE>Button iconMenuButton = view.findViewById(R.id.menu_button_with_icons);<NEW_LINE>button.setOnClickListener(v -> showMenu(v, R.menu.popup_menu));<NEW_LINE>iconMenuButton.setOnClickListener(v -> showMenu(v, R.menu.menu_with_icons));<NEW_LINE>TextView contextMenuTextView = view.findViewById(R.id.context_menu_tv);<NEW_LINE>registerForContextMenu(contextMenuTextView);<NEW_LINE>Button listPopupWindowButton = view.findViewById(R.id.list_popup_window);<NEW_LINE>ListPopupWindow listPopupWindow = initializeListPopupMenu(listPopupWindowButton);<NEW_LINE>listPopupWindowButton.setOnClickListener(v -> listPopupWindow.show());<NEW_LINE>return view;<NEW_LINE>} | findViewById(R.id.menu_button); |
36,965 | private void parseBindingConfig(SonosBindingConfig config, Item item, String bindingConfig) throws BindingConfigParseException {<NEW_LINE>String sonosID = null;<NEW_LINE>String commandAsString = null;<NEW_LINE>String sonosCommand = null;<NEW_LINE>if (bindingConfig != null) {<NEW_LINE>Matcher actionMatcher = ACTION_CONFIG_PATTERN.matcher(bindingConfig);<NEW_LINE>Matcher statusMatcher = STATUS_CONFIG_PATTERN.matcher(bindingConfig);<NEW_LINE>if (!actionMatcher.matches() && !statusMatcher.matches()) {<NEW_LINE>throw new BindingConfigParseException("Sonos binding configuration must consist of either two [config=" + <MASK><NEW_LINE>} else {<NEW_LINE>if (actionMatcher.matches()) {<NEW_LINE>commandAsString = actionMatcher.group(1);<NEW_LINE>sonosID = actionMatcher.group(2);<NEW_LINE>sonosCommand = actionMatcher.group(3);<NEW_LINE>} else if (statusMatcher.matches()) {<NEW_LINE>commandAsString = null;<NEW_LINE>sonosID = statusMatcher.group(1);<NEW_LINE>sonosCommand = statusMatcher.group(2);<NEW_LINE>}<NEW_LINE>SonosBindingConfigElement newElement = new SonosBindingConfigElement(sonosCommand, sonosID, item.getAcceptedDataTypes());<NEW_LINE>Command command = null;<NEW_LINE>if (commandAsString == null) {<NEW_LINE>command = createCommandFromString(null, Integer.toString(counter));<NEW_LINE>counter++;<NEW_LINE>config.put(command, newElement);<NEW_LINE>} else {<NEW_LINE>command = createCommandFromString(item, commandAsString);<NEW_LINE>config.put(command, newElement);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | statusMatcher + "] or three parts [config=" + actionMatcher + "]"); |
303,074 | public static RedisConnection doGetConnection(RedisConnectionFactory factory, boolean allowCreate, boolean bind, boolean transactionSupport) {<NEW_LINE>Assert.notNull(factory, "No RedisConnectionFactory specified");<NEW_LINE>RedisConnectionHolder conHolder = (RedisConnectionHolder) TransactionSynchronizationManager.getResource(factory);<NEW_LINE>if (conHolder != null && (conHolder.hasConnection() || conHolder.isSynchronizedWithTransaction())) {<NEW_LINE>conHolder.requested();<NEW_LINE>if (!conHolder.hasConnection()) {<NEW_LINE>log.debug("Fetching resumed Redis Connection from RedisConnectionFactory");<NEW_LINE>conHolder.setConnection(fetchConnection(factory));<NEW_LINE>}<NEW_LINE>return conHolder.getRequiredConnection();<NEW_LINE>}<NEW_LINE>// Else we either got no holder or an empty thread-bound holder here.<NEW_LINE>if (!allowCreate) {<NEW_LINE>throw new IllegalArgumentException("No connection found and allowCreate = false");<NEW_LINE>}<NEW_LINE>log.debug("Fetching Redis Connection from RedisConnectionFactory");<NEW_LINE>RedisConnection connection = fetchConnection(factory);<NEW_LINE>boolean bindSynchronization = TransactionSynchronizationManager.isActualTransactionActive() && transactionSupport;<NEW_LINE>if (bind || bindSynchronization) {<NEW_LINE>if (bindSynchronization && isActualNonReadonlyTransactionActive()) {<NEW_LINE>connection = createConnectionSplittingProxy(connection, factory);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// Use same RedisConnection for further Redis actions within the transaction.<NEW_LINE>// Thread-bound object will get removed by synchronization at transaction completion.<NEW_LINE>RedisConnectionHolder holderToUse = conHolder;<NEW_LINE>if (holderToUse == null) {<NEW_LINE>holderToUse = new RedisConnectionHolder(connection);<NEW_LINE>} else {<NEW_LINE>holderToUse.setConnection(connection);<NEW_LINE>}<NEW_LINE>holderToUse.requested();<NEW_LINE>// Consider callback-scope connection binding vs. transaction scope binding<NEW_LINE>if (bindSynchronization) {<NEW_LINE>potentiallyRegisterTransactionSynchronisation(holderToUse, factory);<NEW_LINE>}<NEW_LINE>if (holderToUse != conHolder) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>} catch (RuntimeException ex) {<NEW_LINE>// Unexpected exception from external delegation call -> close Connection and rethrow.<NEW_LINE>releaseConnection(connection, factory);<NEW_LINE>throw ex;<NEW_LINE>}<NEW_LINE>return connection;<NEW_LINE>}<NEW_LINE>return connection;<NEW_LINE>} | TransactionSynchronizationManager.bindResource(factory, holderToUse); |
1,532,697 | public void warn(String format, /*@Nullable*/<NEW_LINE>Object... args) {<NEW_LINE>int countSinceLastWarning = 0;<NEW_LINE>boolean logWarning = false;<NEW_LINE>synchronized (warningRateLimiter) {<NEW_LINE>if (warningRateLimiter.tryAcquire()) {<NEW_LINE>logWarning = true;<NEW_LINE>countSinceLastWarning = this.countSinceLastWarning;<NEW_LINE>this.countSinceLastWarning = 0;<NEW_LINE>} else {<NEW_LINE>this.countSinceLastWarning++;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (logWarning) {<NEW_LINE>// it is important not to perform logging under the above synchronized lock in order to<NEW_LINE>// eliminate possibility of deadlock<NEW_LINE>if (countSinceLastWarning == 0) {<NEW_LINE>logger.warn(format + " (this warning will be logged at most once a minute)", args);<NEW_LINE>} else {<NEW_LINE>@Nullable<NEW_LINE>Object[] argsPlus = newArgsWithCountSinceLastWarning(args, countSinceLastWarning);<NEW_LINE>logger.warn(<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | format + " (this warning will be logged at most once a minute, {}" + " warnings were suppressed since it was last logged)", argsPlus); |
1,594,311 | public void execute(final Map<String, Object> attributes) throws FrameworkException {<NEW_LINE>final DatabaseService graphDb = Services.getInstance().getDatabaseService();<NEW_LINE>final String mode = (String) attributes.get("mode");<NEW_LINE>final String fileName = (String) attributes.get("file");<NEW_LINE>final Boolean validate = toStringOrBoolean(attributes.get("validate"));<NEW_LINE>final String query = (String) attributes.get("query");<NEW_LINE>final Long batchSize = (Long) attributes.get("batchSize");<NEW_LINE>boolean doValidation = true;<NEW_LINE>// should we validate imported nodes?<NEW_LINE>if (validate != null) {<NEW_LINE>doValidation = validate;<NEW_LINE>}<NEW_LINE>if (fileName == null) {<NEW_LINE>throw new FrameworkException(400, "Please specify sync file.");<NEW_LINE>}<NEW_LINE>if ("export".equals(mode)) {<NEW_LINE>exportToFile(graphDb, fileName, query, true);<NEW_LINE>} else if ("exportDb".equals(mode)) {<NEW_LINE>exportToFile(graphDb, fileName, query, false);<NEW_LINE>} else if ("import".equals(mode)) {<NEW_LINE>importFromFile(graphDb, <MASK><NEW_LINE>} else {<NEW_LINE>throw new FrameworkException(400, "Please specify sync mode (import|export).");<NEW_LINE>}<NEW_LINE>} | securityContext, fileName, doValidation, batchSize); |
1,478,474 | public static void convert(GrayS64 input, GrayI16 output) {<NEW_LINE>if (input.isSubimage() || output.isSubimage()) {<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopFor(0, input.height, y -> {<NEW_LINE>for (int y = 0; y < input.height; y++) {<NEW_LINE>int indexSrc = input.getIndex(0, y);<NEW_LINE>int indexDst = <MASK><NEW_LINE>for (int x = 0; x < input.width; x++) {<NEW_LINE>output.data[indexDst++] = (short) (input.data[indexSrc++]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// CONCURRENT_ABOVE });<NEW_LINE>} else {<NEW_LINE>final int N = input.width * input.height;<NEW_LINE>// CONCURRENT_BELOW BoofConcurrency.loopBlocks(0,N,(i0,i1)->{<NEW_LINE>int i0 = 0, i1 = N;<NEW_LINE>for (int i = i0; i < i1; i++) {<NEW_LINE>output.data[i] = (short) (input.data[i]);<NEW_LINE>}<NEW_LINE>// CONCURRENT_INLINE });<NEW_LINE>}<NEW_LINE>} | output.getIndex(0, y); |
1,642,068 | private synchronized void initiateProcessing(ProcessedFiles previousWork) {<NEW_LINE>try {<NEW_LINE>Predicate<TabletFile> fileSelector = file -> Math.abs(Hashing.murmur3_32_fixed().hashString(file.getPathStr(), UTF_8).asInt()) % modulus == remainder;<NEW_LINE>if (previousWork != null) {<NEW_LINE>fileSelector = fileSelector.and(previousWork.failedFiles::contains);<NEW_LINE>}<NEW_LINE>Map<String, Map<TabletFile, List<TRowRange>>> filesGBL;<NEW_LINE>filesGBL = getFilesGroupedByLocation(fileSelector);<NEW_LINE>List<CompletableFuture<ProcessedFiles>> futures = new ArrayList<>();<NEW_LINE>if (previousWork != null) {<NEW_LINE>futures.add(CompletableFuture.completedFuture(new ProcessedFiles(previousWork.summaries, factory)));<NEW_LINE>}<NEW_LINE>for (Entry<String, Map<TabletFile, List<TRowRange>>> entry : filesGBL.entrySet()) {<NEW_LINE>HostAndPort location = HostAndPort.fromString(entry.getKey());<NEW_LINE>Map<TabletFile, List<TRowRange>> allFiles = entry.getValue();<NEW_LINE>futures.add(CompletableFuture.supplyAsync(new FilesProcessor(tinfo, location, allFiles, cancelFlag), execSrv));<NEW_LINE>}<NEW_LINE>future = CompletableFutureUtil.merge(futures, (pf1, pf2) -> ProcessedFiles.merge(pf1, pf2<MASK><NEW_LINE>// when all processing is done, check for failed files... and if found starting processing<NEW_LINE>// again<NEW_LINE>@SuppressWarnings("unused")<NEW_LINE>CompletableFuture<Void> unused = future.thenRun(() -> {<NEW_LINE>CompletableFuture<ProcessedFiles> unused2 = this.updateFuture();<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>future = CompletableFuture.completedFuture(new ProcessedFiles());<NEW_LINE>// force future to have this exception<NEW_LINE>future.obtrudeException(e);<NEW_LINE>}<NEW_LINE>} | , factory), ProcessedFiles::new); |
803,815 | private String[] checkSignatures(String sigs) {<NEW_LINE>if (sigs == null || sigs.length() == 0)<NEW_LINE>return null;<NEW_LINE>if (JSch.getLogger().isEnabled(Logger.INFO)) {<NEW_LINE>JSch.getLogger().log(Logger.INFO, "CheckSignatures: " + sigs);<NEW_LINE>}<NEW_LINE>java.util.Vector result = new java.util.Vector();<NEW_LINE>String[] _sigs = Util.split(sigs, ",");<NEW_LINE>for (int i = 0; i < _sigs.length; i++) {<NEW_LINE>try {<NEW_LINE>Class c = Class.forName((String) jsch.getConfig(_sigs[i]));<NEW_LINE>final Signature sig = (Signature) (c.newInstance());<NEW_LINE>sig.init();<NEW_LINE>} catch (Exception e) {<NEW_LINE>result.addElement(_sigs[i]);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (result.size() == 0)<NEW_LINE>return null;<NEW_LINE>String[] foo = new String[result.size()];<NEW_LINE>System.arraycopy(result.toArray(), 0, foo, <MASK><NEW_LINE>if (JSch.getLogger().isEnabled(Logger.INFO)) {<NEW_LINE>for (int i = 0; i < foo.length; i++) {<NEW_LINE>JSch.getLogger().log(Logger.INFO, foo[i] + " is not available.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return foo;<NEW_LINE>} | 0, result.size()); |
649,542 | protected WsByteBuffer[] marshallBinaryHeader(WsByteBuffer[] inBuffers, HeaderElement elem) {<NEW_LINE>if (elem.wasRemoved()) {<NEW_LINE>return inBuffers;<NEW_LINE>}<NEW_LINE>WsByteBuffer[] buffers = inBuffers;<NEW_LINE>final byte[] value = elem.asRawBytes();<NEW_LINE>if (null != value) {<NEW_LINE>HeaderKeys key = elem.getKey();<NEW_LINE>if (!key.isUndefined()) {<NEW_LINE>buffers = putInt(GenericConstants.KNOWN_HEADER, buffers);<NEW_LINE>buffers = putInt(elem.getKey().getOrdinal(), buffers);<NEW_LINE>} else {<NEW_LINE>buffers = putInt(GenericConstants.UNKNOWN_HEADER, buffers);<NEW_LINE>buffers = putInt(key.getByteArray().length, buffers);<NEW_LINE>buffers = putBytes(key.getByteArray(), buffers);<NEW_LINE>}<NEW_LINE>buffers = putInt(<MASK><NEW_LINE>buffers = putBytes(value, elem.getOffset(), elem.getValueLength(), buffers);<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {<NEW_LINE>Tr.event(tc, "Marshalling: " + elem.getName() + " [" + elem.getDebugValue() + "]");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return buffers;<NEW_LINE>} | elem.getValueLength(), buffers); |
175,018 | public <T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T> Join<T> createJoin(final List<Stage<?>> stages, final Function10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T> constructor, final TableIdentifier<T0> t0, final TableIdentifier<T1> t1, final TableIdentifier<T2> t2, final TableIdentifier<T3> t3, final TableIdentifier<T4> t4, final TableIdentifier<T5> t5, final TableIdentifier<T6> t6, final TableIdentifier<T7> t7, final TableIdentifier<T8> t8, final TableIdentifier<T9> t9) {<NEW_LINE>final SqlFunction<ResultSet, T0> rsMapper0 = rsMapper(stages, 0, t0);<NEW_LINE>final SqlFunction<ResultSet, T1> rsMapper1 = rsMapper(stages, 1, t1);<NEW_LINE>final SqlFunction<ResultSet, T2> rsMapper2 = rsMapper(stages, 2, t2);<NEW_LINE>final SqlFunction<ResultSet, T3> rsMapper3 = rsMapper(stages, 3, t3);<NEW_LINE>final SqlFunction<ResultSet, T4> rsMapper4 = rsMapper(stages, 4, t4);<NEW_LINE>final SqlFunction<ResultSet, T5> rsMapper5 = rsMapper(stages, 5, t5);<NEW_LINE>final SqlFunction<ResultSet, T6> rsMapper6 = <MASK><NEW_LINE>final SqlFunction<ResultSet, T7> rsMapper7 = rsMapper(stages, 7, t7);<NEW_LINE>final SqlFunction<ResultSet, T8> rsMapper8 = rsMapper(stages, 8, t8);<NEW_LINE>final SqlFunction<ResultSet, T9> rsMapper9 = rsMapper(stages, 9, t9);<NEW_LINE>final SqlFunction<ResultSet, T> rsMapper = rs -> constructor.apply(rsMapper0.apply(rs), rsMapper1.apply(rs), rsMapper2.apply(rs), rsMapper3.apply(rs), rsMapper4.apply(rs), rsMapper5.apply(rs), rsMapper6.apply(rs), rsMapper7.apply(rs), rsMapper8.apply(rs), rsMapper9.apply(rs));<NEW_LINE>return newJoin(stages, rsMapper);<NEW_LINE>} | rsMapper(stages, 6, t6); |
1,330,638 | private ObjectNode buildSchema(ApiVersion crApiVersion, Property property, boolean description) {<NEW_LINE>PropertyType propertyType = property.getType();<NEW_LINE>Class<?> returnType = propertyType.getType();<NEW_LINE>final ObjectNode schema;<NEW_LINE>if (propertyType.getGenericType() instanceof ParameterizedType && ((ParameterizedType) propertyType.getGenericType()).getRawType().equals(Map.class) && ((ParameterizedType) propertyType.getGenericType()).getActualTypeArguments()[0].equals(Integer.class)) {<NEW_LINE>System.err.println("It's OK");<NEW_LINE>schema = nf.objectNode();<NEW_LINE><MASK><NEW_LINE>schema.putObject("patternProperties").set("-?[0-9]+", buildArraySchema(crApiVersion, property, new PropertyType(null, ((ParameterizedType) propertyType.getGenericType()).getActualTypeArguments()[1]), description));<NEW_LINE>} else if (Schema.isJsonScalarType(returnType) || Map.class.equals(returnType)) {<NEW_LINE>schema = addSimpleTypeConstraints(crApiVersion, buildBasicTypeSchema(property, returnType), property);<NEW_LINE>} else if (returnType.isArray() || List.class.equals(returnType)) {<NEW_LINE>schema = buildArraySchema(crApiVersion, property, property.getType(), description);<NEW_LINE>} else {<NEW_LINE>schema = buildObjectSchema(crApiVersion, property, returnType, description);<NEW_LINE>}<NEW_LINE>if (description) {<NEW_LINE>addDescription(crApiVersion, schema, property);<NEW_LINE>}<NEW_LINE>return schema;<NEW_LINE>} | schema.put("type", "object"); |
943,003 | final TagResourceResult executeTagResource(TagResourceRequest tagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(tagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<TagResourceRequest> request = null;<NEW_LINE>Response<TagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new TagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(tagResourceRequest));<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, "Service Catalog AppRegistry");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "TagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<TagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new TagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,216,306 | public Observable<VectorSchemaRoot> execute(RootContext rootContext) {<NEW_LINE>return input.execute(rootContext).reduce((root, root2) -> {<NEW_LINE>NLJoinPlan.merge(root, root2);<NEW_LINE>root2.close();<NEW_LINE>return root;<NEW_LINE>}).map(input -> {<NEW_LINE>int rowCount = input.getRowCount();<NEW_LINE>int columnCount = schema().getFields().size();<NEW_LINE>BufferAllocator rootAllocator = rootContext.getRootAllocator();<NEW_LINE>try {<NEW_LINE>List<SortColumn> collect = physicalSortProperties.stream().map(i -> i.evaluateToSortColumn(input)).collect(Collectors.toList());<NEW_LINE>int[] indexes = <MASK><NEW_LINE>VectorSchemaRoot output = rootContext.getVectorSchemaRoot(schema(), rowCount);<NEW_LINE>for (int targetIndex = 0; targetIndex < rowCount; targetIndex++) {<NEW_LINE>int sourceIndex = indexes[targetIndex];<NEW_LINE>for (int columnIndex = 0; columnIndex < columnCount; columnIndex++) {<NEW_LINE>FieldVector from = input.getFieldVectors().get(columnIndex);<NEW_LINE>FieldVector to = output.getFieldVectors().get(columnIndex);<NEW_LINE>to.copyFrom(sourceIndex, targetIndex, from);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>output.setRowCount(rowCount);<NEW_LINE>return output;<NEW_LINE>} finally {<NEW_LINE>input.close();<NEW_LINE>}<NEW_LINE>}).toObservable();<NEW_LINE>} | lexQuickSort(rootAllocator, input, collect); |
627,360 | final GetCloudFrontOriginAccessIdentityConfigResult executeGetCloudFrontOriginAccessIdentityConfig(GetCloudFrontOriginAccessIdentityConfigRequest getCloudFrontOriginAccessIdentityConfigRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getCloudFrontOriginAccessIdentityConfigRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetCloudFrontOriginAccessIdentityConfigRequest> request = null;<NEW_LINE>Response<GetCloudFrontOriginAccessIdentityConfigResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetCloudFrontOriginAccessIdentityConfigRequestMarshaller().marshall(super.beforeMarshalling(getCloudFrontOriginAccessIdentityConfigRequest));<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, "GetCloudFrontOriginAccessIdentityConfig");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult> responseHandler = new StaxResponseHandler<GetCloudFrontOriginAccessIdentityConfigResult>(new GetCloudFrontOriginAccessIdentityConfigResultStaxUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | addHandlerContext(HandlerContextKey.SERVICE_ID, "CloudFront"); |
1,261,421 | public void marshall(MonitoringJobDefinition monitoringJobDefinition, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (monitoringJobDefinition == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getBaselineConfig(), BASELINECONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getMonitoringOutputConfig(), MONITORINGOUTPUTCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getMonitoringResources(), MONITORINGRESOURCES_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getMonitoringAppSpecification(), MONITORINGAPPSPECIFICATION_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getStoppingCondition(), STOPPINGCONDITION_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getEnvironment(), ENVIRONMENT_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getNetworkConfig(), NETWORKCONFIG_BINDING);<NEW_LINE>protocolMarshaller.marshall(monitoringJobDefinition.getRoleArn(), ROLEARN_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | monitoringJobDefinition.getMonitoringInputs(), MONITORINGINPUTS_BINDING); |
1,026,207 | private Throwable validateInjectionPoint(InjectionPoint injectionPoint, Type conversionType, Type injectionType, ClassLoader classLoader, boolean optional, Claim claim) {<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>Tr.entry(tc, "validateInjectionPoint", injectionPoint, conversionType, injectionType, classLoader, optional, claim);<NEW_LINE>}<NEW_LINE>Throwable configException = null;<NEW_LINE>Type rawInjectionType = injectionType;<NEW_LINE>if (injectionType instanceof ParameterizedType) {<NEW_LINE>rawInjectionType = ((ParameterizedType) injectionType).getRawType();<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>Set<Type> <MASK><NEW_LINE>if (injectionTypesForQualifier == null) {<NEW_LINE>injectionTypesForQualifier = new HashSet<Type>();<NEW_LINE>injectionTypes.put(claim, injectionTypesForQualifier);<NEW_LINE>}<NEW_LINE>injectionTypesForQualifier.add(injectionType);<NEW_LINE>} catch (Throwable e) {<NEW_LINE>configException = e;<NEW_LINE>}<NEW_LINE>if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {<NEW_LINE>Tr.exit(tc, "validateInjectionPoint", configException);<NEW_LINE>}<NEW_LINE>return configException;<NEW_LINE>} | injectionTypesForQualifier = injectionTypes.get(claim); |
1,749,851 | private void handleIrChildren(GraphNode topNode, Set<GraphNode> set) throws DFANodeSplitBailoutException {<NEW_LINE>ArrayDeque<GraphNode> dfsList = new ArrayDeque<>();<NEW_LINE>ArrayList<Set<GraphNode>> sccList = new ArrayList<>();<NEW_LINE>for (GraphNode child : topNode.getDomChildren(this)) {<NEW_LINE>if (!isDone(child) && (set.isEmpty() || set.contains(child))) {<NEW_LINE>scc1(dfsList, child, <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (GraphNode n : dfsList) {<NEW_LINE>if (isDone(n)) {<NEW_LINE>Set<GraphNode> scc = StateSet.create(this);<NEW_LINE>scc2(scc, n, topNode.getDomTreeDepth());<NEW_LINE>sccList.add(scc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Set<GraphNode> scc : sccList) {<NEW_LINE>if (scc.size() > 1) {<NEW_LINE>handleScc(topNode, scc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | set, topNode.getDomTreeDepth()); |
256,365 | private void mapRequestMatchersUrl(YamlContract.Request yamlContractRequest, Request request) {<NEW_LINE>Object url = Optional.ofNullable(request.getUrl()).map(Url::getClientValue).orElse(null);<NEW_LINE>YamlContract.KeyValueMatcher keyValueMatcher = new YamlContract.KeyValueMatcher();<NEW_LINE>if (url instanceof RegexProperty) {<NEW_LINE>keyValueMatcher.regex = ((<MASK><NEW_LINE>yamlContractRequest.matchers.url = keyValueMatcher;<NEW_LINE>} else if (url instanceof ExecutionProperty) {<NEW_LINE>keyValueMatcher.command = url.toString();<NEW_LINE>yamlContractRequest.matchers.url = keyValueMatcher;<NEW_LINE>} else {<NEW_LINE>yamlContractRequest.matchers.url = null;<NEW_LINE>}<NEW_LINE>Object urlPath = Optional.ofNullable(request.getUrlPath()).map(Url::getClientValue).orElse(null);<NEW_LINE>if (urlPath instanceof RegexProperty) {<NEW_LINE>keyValueMatcher.regex = ((RegexProperty) urlPath).pattern();<NEW_LINE>yamlContractRequest.matchers.url = keyValueMatcher;<NEW_LINE>} else if (urlPath instanceof ExecutionProperty) {<NEW_LINE>keyValueMatcher.command = urlPath.toString();<NEW_LINE>yamlContractRequest.matchers.url = keyValueMatcher;<NEW_LINE>} else {<NEW_LINE>yamlContractRequest.matchers.url = null;<NEW_LINE>}<NEW_LINE>} | RegexProperty) url).pattern(); |
1,398,326 | protected void populateComponents() {<NEW_LINE>JPanel workPanel = new JPanel(new BorderLayout());<NEW_LINE>{<NEW_LINE>Box hbox = Box.createHorizontalBox();<NEW_LINE>hbox.setBorder(BorderFactory.createTitledBorder("Schedule"));<NEW_LINE>hbox.add(new JLabel("Expression: "));<NEW_LINE>scheduleText = new JTextField();<NEW_LINE>hbox.add(scheduleText);<NEW_LINE>hbox.add(new JLabel("Ticks: "));<NEW_LINE>hbox.add(tickBack = new JButton(DebuggerResources.ICON_STEP_BACK));<NEW_LINE>hbox.add(tickStep = new JButton(DebuggerResources.ICON_STEP_INTO));<NEW_LINE>hbox.add(new JLabel("Ops: "));<NEW_LINE>hbox.add(opBack = new JButton(DebuggerResources.ICON_STEP_BACK));<NEW_LINE>hbox.add(opStep = new JButton(DebuggerResources.ICON_STEP_INTO));<NEW_LINE>workPanel.add(hbox, BorderLayout.NORTH);<NEW_LINE>}<NEW_LINE>tickBack.addActionListener(evt -> doStep(s -> s.steppedBackward(getTrace(), 1)));<NEW_LINE>tickStep.addActionListener(evt -> doStep(s -> s.steppedForward(null, 1)));<NEW_LINE>opBack.addActionListener(evt -> doStep(s -> s.steppedPcodeBackward(1)));<NEW_LINE>opStep.addActionListener(evt -> doStep(s -> s.steppedPcodeForward(null, 1)));<NEW_LINE>{<NEW_LINE>snapshotPanel = new DebuggerSnapshotTablePanel();<NEW_LINE>workPanel.add(snapshotPanel, BorderLayout.CENTER);<NEW_LINE>}<NEW_LINE>snapshotPanel.getSelectionModel().addListSelectionListener(evt -> {<NEW_LINE>Long snap = snapshotPanel.getSelectedSnapshot();<NEW_LINE>if (snap == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (schedule.getSnap() == snap.longValue()) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>scheduleText.<MASK><NEW_LINE>});<NEW_LINE>scheduleText.getDocument().addDocumentListener(new DocumentListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void insertUpdate(DocumentEvent e) {<NEW_LINE>scheduleTextChanged();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void removeUpdate(DocumentEvent e) {<NEW_LINE>scheduleTextChanged();<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void changedUpdate(DocumentEvent e) {<NEW_LINE>scheduleTextChanged();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>addWorkPanel(workPanel);<NEW_LINE>addOKButton();<NEW_LINE>addCancelButton();<NEW_LINE>setMinimumSize(600, 600);<NEW_LINE>} | setText(snap.toString()); |
813,896 | public boolean apply(Game game, Ability source) {<NEW_LINE>Player controller = game.getPlayer(source.getControllerId());<NEW_LINE>Set<Card> toBattlefield = new HashSet<>();<NEW_LINE>if (controller != null) {<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player <MASK><NEW_LINE>if (player != null) {<NEW_LINE>TargetCardInLibrary target = new TargetCardInLibrary(0, 2, StaticFilters.FILTER_CARD_BASIC_LAND);<NEW_LINE>if (player.searchLibrary(target, source, game)) {<NEW_LINE>if (!target.getTargets().isEmpty()) {<NEW_LINE>toBattlefield.addAll(new CardsImpl(target.getTargets()).getCards(game));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// must happen simultaneously Rule 101.4<NEW_LINE>controller.moveCards(toBattlefield, Zone.BATTLEFIELD, source, game, false, false, true, null);<NEW_LINE>for (UUID playerId : game.getState().getPlayersInRange(controller.getId(), game)) {<NEW_LINE>Player player = game.getPlayer(playerId);<NEW_LINE>if (player != null) {<NEW_LINE>player.shuffleLibrary(source, game);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | player = game.getPlayer(playerId); |
1,693,217 | final PutStorageConfigurationResult executePutStorageConfiguration(PutStorageConfigurationRequest putStorageConfigurationRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(putStorageConfigurationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<PutStorageConfigurationRequest> request = null;<NEW_LINE>Response<PutStorageConfigurationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new PutStorageConfigurationRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(putStorageConfigurationRequest));<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, "IoTSiteWise");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "PutStorageConfiguration");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>URI endpointTraitHost = null;<NEW_LINE>if (!clientConfiguration.isDisableHostPrefixInjection()) {<NEW_LINE>String hostPrefix = "api.";<NEW_LINE>String resolvedHostPrefix = String.format("api.");<NEW_LINE>endpointTraitHost = UriResourcePathUtils.updateUriHost(endpoint, resolvedHostPrefix);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<PutStorageConfigurationResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new PutStorageConfigurationResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | responseHandler, executionContext, null, endpointTraitHost); |
1,579,722 | private void createComponents() {<NEW_LINE>constraints.fill = GridBagConstraints.BOTH;<NEW_LINE>constraints.weightx = 1;<NEW_LINE>int x = 0;<NEW_LINE>int y = 0;<NEW_LINE>add(new JLabel("Symbol"), x, y);<NEW_LINE>add(new JLabel("Quantity"), ++x, y);<NEW_LINE>add(new JLabel("Side"), ++x, y);<NEW_LINE>add(new JLabel("Type"), ++x, y);<NEW_LINE>constraints.ipadx = 30;<NEW_LINE>add(limitPriceLabel, ++x, y);<NEW_LINE>add(stopPriceLabel, ++x, y);<NEW_LINE>constraints.ipadx = 0;<NEW_LINE>add(new JLabel("TIF"), ++x, y);<NEW_LINE>constraints.ipadx = 30;<NEW_LINE>symbolTextField.setName("SymbolTextField");<NEW_LINE>add(symbolTextField, x = 0, ++y);<NEW_LINE>constraints.ipadx = 0;<NEW_LINE>quantityTextField.setName("QuantityTextField");<NEW_LINE>add(quantityTextField, ++x, y);<NEW_LINE>sideComboBox.setName("SideComboBox");<NEW_LINE>add(sideComboBox, ++x, y);<NEW_LINE>typeComboBox.setName("TypeComboBox");<NEW_LINE>add(typeComboBox, ++x, y);<NEW_LINE>limitPriceTextField.setName("LimitPriceTextField");<NEW_LINE>add(limitPriceTextField, ++x, y);<NEW_LINE>stopPriceTextField.setName("StopPriceTextField");<NEW_LINE>add(stopPriceTextField, ++x, y);<NEW_LINE>tifComboBox.setName("TifComboBox");<NEW_LINE>add(tifComboBox, ++x, y);<NEW_LINE>constraints.insets = new Insets(3, 0, 0, 0);<NEW_LINE>constraints.gridwidth = GridBagConstraints.RELATIVE;<NEW_LINE>sessionComboBox.setName("SessionComboBox");<NEW_LINE>add(sessionComboBox, 0, ++y);<NEW_LINE>constraints.gridwidth = GridBagConstraints.REMAINDER;<NEW_LINE>submitButton.setName("SubmitButton");<NEW_LINE>add(submitButton, x, y);<NEW_LINE>constraints.gridwidth = 0;<NEW_LINE>add(messageLabel, 0, ++y);<NEW_LINE>typeComboBox.addItemListener(new PriceListener());<NEW_LINE>typeComboBox.setSelectedItem(OrderType.STOP);<NEW_LINE>typeComboBox.setSelectedItem(OrderType.MARKET);<NEW_LINE>Font font = new Font(messageLabel.getFont().getFontName(), Font.BOLD, 12);<NEW_LINE>messageLabel.setFont(font);<NEW_LINE>messageLabel.setForeground(Color.red);<NEW_LINE><MASK><NEW_LINE>submitButton.setEnabled(false);<NEW_LINE>submitButton.addActionListener(new SubmitListener());<NEW_LINE>activateSubmit();<NEW_LINE>} | messageLabel.setHorizontalAlignment(JLabel.CENTER); |
951,895 | public void deleteLocksPath(String path, String token) throws ApiException {<NEW_LINE>Object localVarPostBody = null;<NEW_LINE>// verify the required parameter 'path' is set<NEW_LINE>if (path == null) {<NEW_LINE>throw new ApiException(400, "Missing the required parameter 'path' when calling deleteLocksPath");<NEW_LINE>}<NEW_LINE>// verify the required parameter 'token' is set<NEW_LINE>if (token == null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>// create path and map variables<NEW_LINE>String localVarPath = "/locks/{path}".replaceAll("\\{" + "path" + "\\}", apiClient.escapeString(path.toString()));<NEW_LINE>// query params<NEW_LINE>List<Pair> localVarQueryParams = new ArrayList<Pair>();<NEW_LINE>Map<String, String> localVarHeaderParams = new HashMap<String, String>();<NEW_LINE>Map<String, Object> localVarFormParams = new HashMap<String, Object>();<NEW_LINE>localVarQueryParams.addAll(apiClient.parameterToPairs("", "token", token));<NEW_LINE>final String[] localVarAccepts = {};<NEW_LINE>final String localVarAccept = apiClient.selectHeaderAccept(localVarAccepts);<NEW_LINE>final String[] localVarContentTypes = {};<NEW_LINE>final String localVarContentType = apiClient.selectHeaderContentType(localVarContentTypes);<NEW_LINE>String[] localVarAuthNames = new String[] {};<NEW_LINE>apiClient.invokeAPI(localVarPath, "DELETE", localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarAccept, localVarContentType, localVarAuthNames, null);<NEW_LINE>} | throw new ApiException(400, "Missing the required parameter 'token' when calling deleteLocksPath"); |
16,389 | private static boolean promptToAddTMARowOrColumn(final ImageData<?> imageData, final TMAAddType type) {<NEW_LINE>String NAME = type.commandName();<NEW_LINE>if (imageData == null) {<NEW_LINE>Dialogs.showNoImageError(NAME);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>if (imageData.getHierarchy().getTMAGrid() == null) {<NEW_LINE>Dialogs.showErrorMessage(NAME, "No image with dearrayed TMA cores selected!");<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>PathObjectHierarchy hierarchy = imageData.getHierarchy();<NEW_LINE>PathObject selected = hierarchy.getSelectionModel().getSelectedObject();<NEW_LINE>TMACoreObject selectedCore = null;<NEW_LINE>if (selected != null)<NEW_LINE>selectedCore = PathObjectTools.getAncestorTMACore(selected);<NEW_LINE>TMAGrid gridNew = createAugmentedTMAGrid(hierarchy, selectedCore, type);<NEW_LINE>double w = imageData.getServer().getWidth();<NEW_LINE>double h = imageData.getServer().getHeight();<NEW_LINE>// Check if the core centroids all fall within the image or not<NEW_LINE>int outsideCores = 0;<NEW_LINE>for (TMACoreObject core : gridNew.getTMACoreList()) {<NEW_LINE>// Shouldn't happen...<NEW_LINE>if (!core.hasROI())<NEW_LINE>continue;<NEW_LINE>// Check if the centroid for any *new* core falls within the image<NEW_LINE>// (don't fail if an existing core is outside)<NEW_LINE>double x = core.getROI().getCentroidX();<NEW_LINE>double y = core<MASK><NEW_LINE>if (x < 0 || x >= w || y < 0 || y >= h) {<NEW_LINE>if (!hierarchy.getTMAGrid().getTMACoreList().contains(core)) {<NEW_LINE>outsideCores++;<NEW_LINE>}<NEW_LINE>// throw new IllegalArgumentException("Cannot update TMA grid - not enough space within image");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (outsideCores > 0) {<NEW_LINE>String label = outsideCores == 1 ? "core" : "cores";<NEW_LINE>if (!Dialogs.showConfirmDialog("Add to TMA Grid", "Not enough space within image to store " + outsideCores + " new " + label + " - proceed anyway?"))<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>// If we got this far, update the grid<NEW_LINE>hierarchy.setTMAGrid(gridNew);<NEW_LINE>// Prompt for relabelling<NEW_LINE>TMACommands.promptToRelabelTMAGrid(imageData);<NEW_LINE>return true;<NEW_LINE>} | .getROI().getCentroidY(); |
94,342 | float[] computeDowngradePointList(final int pSize) {<NEW_LINE>if (pSize == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (mDowngradePixelSize == pSize) {<NEW_LINE>return mDowngradePointList;<NEW_LINE>}<NEW_LINE>computeProjected();<NEW_LINE>final long projectedSize = mProjectedWidth > mProjectedHeight ? mProjectedWidth : mProjectedHeight;<NEW_LINE>if (projectedSize == 0) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final ListPointAccepter listPointAccepter = new ListPointAccepter(true);<NEW_LINE>final <MASK><NEW_LINE>final double factor = (projectedSize * 1.) / pSize;<NEW_LINE>for (int i = 0; i < mProjectedPoints.length; ) {<NEW_LINE>final long x = mProjectedPoints[i++];<NEW_LINE>final long y = mProjectedPoints[i++];<NEW_LINE>final long squareX = Math.round((x - mProjectedCenter.x) / factor);<NEW_LINE>final long squareY = Math.round((y - mProjectedCenter.y) / factor);<NEW_LINE>pointAccepter.add(squareX, squareY);<NEW_LINE>}<NEW_LINE>mDowngradePixelSize = pSize;<NEW_LINE>mDowngradePointList = new float[listPointAccepter.getList().size()];<NEW_LINE>for (int i = 0; i < mDowngradePointList.length; i++) {<NEW_LINE>mDowngradePointList[i] = listPointAccepter.getList().get(i);<NEW_LINE>}<NEW_LINE>return mDowngradePointList;<NEW_LINE>} | PointAccepter pointAccepter = new SideOptimizationPointAccepter(listPointAccepter); |
274,387 | public void analyze(Analyzer analyzer) throws AnalysisException {<NEW_LINE>if (userIdent != null) {<NEW_LINE>userIdent.analyze(analyzer.getClusterName());<NEW_LINE>} else {<NEW_LINE>FeNameFormat.checkRoleName(role, false, /* can not be superuser */<NEW_LINE>"Can not revoke from role");<NEW_LINE>role = ClusterNamespace.getFullName(<MASK><NEW_LINE>}<NEW_LINE>if (tblPattern != null) {<NEW_LINE>tblPattern.analyze(analyzer.getClusterName());<NEW_LINE>} else {<NEW_LINE>resourcePattern.analyze();<NEW_LINE>}<NEW_LINE>if (privileges == null || privileges.isEmpty()) {<NEW_LINE>throw new AnalysisException("No privileges in revoke statement.");<NEW_LINE>}<NEW_LINE>// Revoke operation obey the same rule as Grant operation. reuse the same method<NEW_LINE>if (tblPattern != null) {<NEW_LINE>GrantStmt.checkPrivileges(analyzer, privileges, role, tblPattern);<NEW_LINE>} else {<NEW_LINE>GrantStmt.checkPrivileges(analyzer, privileges, role, resourcePattern);<NEW_LINE>}<NEW_LINE>} | analyzer.getClusterName(), role); |
1,044,203 | // cm, em, ex, in, mm, pc, pt, px<NEW_LINE>private static float parseLength(String s, String defaultString) {<NEW_LINE>if (s == null) {<NEW_LINE>s = defaultString;<NEW_LINE>}<NEW_LINE>if (s.endsWith("%")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new UnsupportedOperationException("TODO parseLength: %");<NEW_LINE>} else if (s.endsWith("cm")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final Point dpi = new Point(0, 0);<NEW_LINE>Display.getDefault().syncExec(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>dpi.x = Display.getDefault().getDPI().x;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return Float.parseFloat(s.substring(0, s.length() - 2)) * dpi.x * 0.393700787f;<NEW_LINE>} else if (s.endsWith("em")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new UnsupportedOperationException("TODO parseLength: em");<NEW_LINE>} else if (s.endsWith("ex")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new UnsupportedOperationException("TODO parseLength: ex");<NEW_LINE>} else if (s.endsWith("in")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final Point dpi = new Point(0, 0);<NEW_LINE>Display.getDefault().syncExec(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>dpi.x = Display.getDefault().getDPI().x;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return Float.parseFloat(s.substring(0, s.length() - 2)) * dpi.x;<NEW_LINE>} else if (s.endsWith("mm")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>final Point dpi = new Point(0, 0);<NEW_LINE>Display.getDefault().syncExec(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>dpi.x = Display.getDefault().getDPI().x;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>return Float.parseFloat(s.substring(0, s.length() - 2<MASK><NEW_LINE>} else if (s.endsWith("pc")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new UnsupportedOperationException("TODO parseLength: pc");<NEW_LINE>} else if (s.endsWith("pt")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>// $NON-NLS-1$<NEW_LINE>throw new UnsupportedOperationException("TODO parseLength: pt");<NEW_LINE>} else if (s.endsWith("px")) {<NEW_LINE>// $NON-NLS-1$<NEW_LINE>return Float.parseFloat(s.substring(0, s.length() - 2));<NEW_LINE>} else {<NEW_LINE>return Float.parseFloat(s);<NEW_LINE>}<NEW_LINE>} | )) * dpi.x * 0.0393700787f; |
384,665 | private static RunFontSelector createRunFontSelector(WordprocessingMLPackage wmlPackage) {<NEW_LINE>return new RunFontSelector(wmlPackage, new RunFontCharacterVisitor() {<NEW_LINE><NEW_LINE>DocumentFragment df;<NEW_LINE><NEW_LINE>StringBuilder sb = new StringBuilder(1024);<NEW_LINE><NEW_LINE>Element span;<NEW_LINE><NEW_LINE>String lastFont;<NEW_LINE><NEW_LINE>String fallbackFontName;<NEW_LINE><NEW_LINE>private Document document;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setDocument(Document document) {<NEW_LINE>this.document = document;<NEW_LINE>df = document.createDocumentFragment();<NEW_LINE>}<NEW_LINE><NEW_LINE>private boolean spanReusable = true;<NEW_LINE><NEW_LINE>public boolean isReusable() {<NEW_LINE>return spanReusable;<NEW_LINE>}<NEW_LINE><NEW_LINE>public void addCharacterToCurrent(char c) {<NEW_LINE>sb.append(c);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void addCodePointToCurrent(int cp) {<NEW_LINE>sb.append(new String(Character.toChars(cp)));<NEW_LINE>}<NEW_LINE><NEW_LINE>public void finishPrevious() {<NEW_LINE>if (sb.length() > 0) {<NEW_LINE>if (span == null) {<NEW_LINE>// init<NEW_LINE>span = runFontSelector.createElement(document);<NEW_LINE>// so that spaces have correct font set<NEW_LINE>if (lastFont != null) {<NEW_LINE>runFontSelector.setAttribute(span, lastFont);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>df.appendChild(span);<NEW_LINE>span.setTextContent(sb.toString());<NEW_LINE>// log.info("span: " + sb.toString());<NEW_LINE>sb.setLength(0);<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>public void createNew() {<NEW_LINE>span = runFontSelector.createElement(document);<NEW_LINE>}<NEW_LINE><NEW_LINE>public void setMustCreateNewFlag(boolean val) {<NEW_LINE>spanReusable = !val;<NEW_LINE>}<NEW_LINE><NEW_LINE>public void fontAction(String fontname) {<NEW_LINE>if (fontname == null) {<NEW_LINE>runFontSelector.setAttribute(span, fallbackFontName);<NEW_LINE>} else {<NEW_LINE><MASK><NEW_LINE>lastFont = fontname;<NEW_LINE>}<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Object getResult() {<NEW_LINE>// ready for next time<NEW_LINE>span = null;<NEW_LINE>return df;<NEW_LINE>}<NEW_LINE><NEW_LINE>private RunFontSelector runFontSelector;<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setRunFontSelector(RunFontSelector runFontSelector) {<NEW_LINE>this.runFontSelector = runFontSelector;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void setFallbackFont(String fontname) {<NEW_LINE>fallbackFontName = fontname;<NEW_LINE>}<NEW_LINE>}, RunFontActionType.XHTML);<NEW_LINE>} | runFontSelector.setAttribute(span, fontname); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.