idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,547,580 | public static <K> KTableHolder<K> build(final KTableHolder<K> left, final KTableHolder<K> right, final TableTableJoin<K> join) {<NEW_LINE>final LogicalSchema leftSchema;<NEW_LINE>final LogicalSchema rightSchema;<NEW_LINE>if (join.getJoinType().equals(RIGHT)) {<NEW_LINE>leftSchema = right.getSchema();<NEW_LINE>rightSchema = left.getSchema();<NEW_LINE>} else {<NEW_LINE>leftSchema = left.getSchema();<NEW_LINE>rightSchema = right.getSchema();<NEW_LINE>}<NEW_LINE>final JoinParams joinParams = JoinParamsFactory.create(join.getKeyColName(), leftSchema, rightSchema);<NEW_LINE>final KTable<K, GenericRow> result;<NEW_LINE>switch(join.getJoinType()) {<NEW_LINE>case INNER:<NEW_LINE>result = left.getTable().join(right.getTable(<MASK><NEW_LINE>break;<NEW_LINE>case LEFT:<NEW_LINE>result = left.getTable().leftJoin(right.getTable(), joinParams.getJoiner());<NEW_LINE>break;<NEW_LINE>case RIGHT:<NEW_LINE>result = right.getTable().leftJoin(left.getTable(), joinParams.getJoiner());<NEW_LINE>break;<NEW_LINE>case OUTER:<NEW_LINE>result = left.getTable().outerJoin(right.getTable(), joinParams.getJoiner());<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new IllegalStateException("invalid join type: " + join.getJoinType());<NEW_LINE>}<NEW_LINE>return KTableHolder.unmaterialized(result, joinParams.getSchema(), left.getExecutionKeyFactory());<NEW_LINE>} | ), joinParams.getJoiner()); |
953,764 | public void run(RegressionEnvironment env) {<NEW_LINE>try {<NEW_LINE>XPathNamespaceContext ctx = new XPathNamespaceContext();<NEW_LINE><MASK><NEW_LINE>Node node = SupportXML.getDocument().getDocumentElement();<NEW_LINE>XPath pathOne = XPathFactory.newInstance().newXPath();<NEW_LINE>pathOne.setNamespaceContext(ctx);<NEW_LINE>XPathExpression pathExprOne = pathOne.compile("/n0:simpleEvent/n0:nested1");<NEW_LINE>Node result = (Node) pathExprOne.evaluate(node, XPathConstants.NODE);<NEW_LINE>// System.out.println("Result:\n" + SchemaUtil.serialize(result));<NEW_LINE>XPath pathTwo = XPathFactory.newInstance().newXPath();<NEW_LINE>pathTwo.setNamespaceContext(ctx);<NEW_LINE>XPathExpression pathExprTwo = pathTwo.compile("/n0:simpleEvent/n0:nested1/n0:prop1");<NEW_LINE>String resultTwo = (String) pathExprTwo.evaluate(result, XPathConstants.STRING);<NEW_LINE>// System.out.println("Result 2: <" + resultTwo + ">");<NEW_LINE>XPath pathThree = XPathFactory.newInstance().newXPath();<NEW_LINE>pathThree.setNamespaceContext(ctx);<NEW_LINE>XPathExpression pathExprThree = pathThree.compile("/n0:simpleEvent/n0:nested3");<NEW_LINE>String resultThress = (String) pathExprThree.evaluate(result, XPathConstants.STRING);<NEW_LINE>// System.out.println("Result 3: <" + resultThress + ">");<NEW_LINE>} catch (Throwable t) {<NEW_LINE>fail();<NEW_LINE>}<NEW_LINE>} | ctx.addPrefix("n0", "samples:schemas:simpleSchema"); |
1,288,349 | public EncryptedDataEncryptionKey wrap(byte[] secretKey) {<NEW_LINE>try {<NEW_LINE>Cipher etsiKem = helper.createCipher("ETSIKEMwithSHA256");<NEW_LINE>etsiKem.init(Cipher.WRAP_MODE, recipientKey, new IESKEMParameterSpec(recipientHash, true));<NEW_LINE>byte[] wrappedKey = etsiKem.wrap(new SecretKeySpec(secretKey, "AES"));<NEW_LINE>int size = (recipientKey.getParams().getCurve().getField().getFieldSize() + 7) / 8;<NEW_LINE>if (wrappedKey[0] == 0x04) {<NEW_LINE>size = 2 * size + 1;<NEW_LINE>} else {<NEW_LINE>size = size + 1;<NEW_LINE>}<NEW_LINE>SubjectPublicKeyInfo pkInfo = SubjectPublicKeyInfo.getInstance(recipientKey.getEncoded());<NEW_LINE>ASN1ObjectIdentifier curveID = ASN1ObjectIdentifier.getInstance(pkInfo.getAlgorithm().getParameters());<NEW_LINE>EciesP256EncryptedKey key = EciesP256EncryptedKey.builder().setV(EccP256CurvePoint.createEncodedPoint(Arrays.copyOfRange(wrappedKey, 0, size))).setC(Arrays.copyOfRange(wrappedKey, size, size + secretKey.length)).setT(Arrays.copyOfRange(wrappedKey, size + secretKey.length, wrappedKey.length)).createEciesP256EncryptedKey();<NEW_LINE>if (curveID.equals(SECObjectIdentifiers.secp256r1)) {<NEW_LINE>return EncryptedDataEncryptionKey.eciesNistP256(key);<NEW_LINE>} else if (curveID.equals(TeleTrusTObjectIdentifiers.brainpoolP256r1)) {<NEW_LINE>return EncryptedDataEncryptionKey.eciesBrainpoolP256r1(key);<NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("recipient key curve is not P-256 or Brainpool P256r1");<NEW_LINE>}<NEW_LINE>} catch (Exception ex) {<NEW_LINE>throw new RuntimeException(<MASK><NEW_LINE>}<NEW_LINE>} | ex.getMessage(), ex); |
673,971 | public static GetAggregateResourceComplianceTimelineResponse unmarshall(GetAggregateResourceComplianceTimelineResponse getAggregateResourceComplianceTimelineResponse, UnmarshallerContext _ctx) {<NEW_LINE>getAggregateResourceComplianceTimelineResponse.setRequestId<MASK><NEW_LINE>ResourceComplianceTimeline resourceComplianceTimeline = new ResourceComplianceTimeline();<NEW_LINE>resourceComplianceTimeline.setNextToken(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.NextToken"));<NEW_LINE>resourceComplianceTimeline.setMaxResults(_ctx.integerValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.MaxResults"));<NEW_LINE>List<ComplianceListItem> complianceList = new ArrayList<ComplianceListItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList.Length"); i++) {<NEW_LINE>ComplianceListItem complianceListItem = new ComplianceListItem();<NEW_LINE>complianceListItem.setTags(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].Tags"));<NEW_LINE>complianceListItem.setAccountId(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].AccountId"));<NEW_LINE>complianceListItem.setAvailabilityZone(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].AvailabilityZone"));<NEW_LINE>complianceListItem.setResourceType(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ResourceType"));<NEW_LINE>complianceListItem.setResourceCreateTime(_ctx.longValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ResourceCreateTime"));<NEW_LINE>complianceListItem.setRegion(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].Region"));<NEW_LINE>complianceListItem.setConfiguration(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].Configuration"));<NEW_LINE>complianceListItem.setCaptureTime(_ctx.longValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].CaptureTime"));<NEW_LINE>complianceListItem.setConfigurationDiff(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ConfigurationDiff"));<NEW_LINE>complianceListItem.setResourceId(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ResourceId"));<NEW_LINE>complianceListItem.setResourceName(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ResourceName"));<NEW_LINE>complianceListItem.setResourceStatus(_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.ResourceComplianceTimeline.ComplianceList[" + i + "].ResourceStatus"));<NEW_LINE>complianceList.add(complianceListItem);<NEW_LINE>}<NEW_LINE>resourceComplianceTimeline.setComplianceList(complianceList);<NEW_LINE>getAggregateResourceComplianceTimelineResponse.setResourceComplianceTimeline(resourceComplianceTimeline);<NEW_LINE>return getAggregateResourceComplianceTimelineResponse;<NEW_LINE>} | (_ctx.stringValue("GetAggregateResourceComplianceTimelineResponse.RequestId")); |
1,291,292 | public Optional<Long> createSyncJob(final SourceConnection source, final DestinationConnection destination, final StandardSync standardSync, final String sourceDockerImageName, final String destinationDockerImageName, final List<StandardSyncOperation> standardSyncOperations, @Nullable final ActorDefinitionResourceRequirements sourceResourceReqs, @Nullable final ActorDefinitionResourceRequirements destinationResourceReqs) throws IOException {<NEW_LINE>// reusing this isn't going to quite work.<NEW_LINE>final JobSyncConfig jobSyncConfig = new JobSyncConfig().withNamespaceDefinition(standardSync.getNamespaceDefinition()).withNamespaceFormat(standardSync.getNamespaceFormat()).withPrefix(standardSync.getPrefix()).withSourceDockerImage(sourceDockerImageName).withSourceConfiguration(source.getConfiguration()).withDestinationDockerImage(destinationDockerImageName).withDestinationConfiguration(destination.getConfiguration()).withOperationSequence(standardSyncOperations).withConfiguredAirbyteCatalog(standardSync.getCatalog()).withState(null).withResourceRequirements(ResourceRequirementsUtils.getResourceRequirements(standardSync.getResourceRequirements(), workerResourceRequirements)).withSourceResourceRequirements(ResourceRequirementsUtils.getResourceRequirements(standardSync.getResourceRequirements(), sourceResourceReqs, workerResourceRequirements, JobType.SYNC)).withDestinationResourceRequirements(ResourceRequirementsUtils.getResourceRequirements(standardSync.getResourceRequirements(), destinationResourceReqs, workerResourceRequirements, JobType.SYNC));<NEW_LINE>configRepository.getConnectionState(standardSync.getConnectionId()).ifPresent(jobSyncConfig::withState);<NEW_LINE>final JobConfig jobConfig = new JobConfig().withConfigType(ConfigType.SYNC).withSync(jobSyncConfig);<NEW_LINE>return jobPersistence.enqueueJob(standardSync.getConnectionId(<MASK><NEW_LINE>} | ).toString(), jobConfig); |
995,527 | private void startGenerate() throws IOException {<NEW_LINE>String s;<NEW_LINE>int n;<NEW_LINE>// The first field is of the form start-end[/step]<NEW_LINE>// Regexes would be useful here.<NEW_LINE>s = st.getIdentifier();<NEW_LINE>n = s.indexOf("-");<NEW_LINE>if (n < 0) {<NEW_LINE>throw st.exception("Invalid $GENERATE range specifier: " + s);<NEW_LINE>}<NEW_LINE>String startstr = s.substring(0, n);<NEW_LINE>String endstr = s.substring(n + 1);<NEW_LINE>String stepstr = null;<NEW_LINE>n = endstr.indexOf("/");<NEW_LINE>if (n >= 0) {<NEW_LINE>stepstr = endstr.substring(n + 1);<NEW_LINE>endstr = endstr.substring(0, n);<NEW_LINE>}<NEW_LINE>long start = parseUInt32(startstr);<NEW_LINE>long end = parseUInt32(endstr);<NEW_LINE>long step;<NEW_LINE>if (stepstr != null) {<NEW_LINE>step = parseUInt32(stepstr);<NEW_LINE>} else {<NEW_LINE>step = 1;<NEW_LINE>}<NEW_LINE>if (start < 0 || end < 0 || start > end || step <= 0) {<NEW_LINE>throw st.exception("Invalid $GENERATE range specifier: " + s);<NEW_LINE>}<NEW_LINE>// The next field is the name specification.<NEW_LINE>String nameSpec = st.getIdentifier();<NEW_LINE>// Then the ttl/class/type, in the same form as a normal record.<NEW_LINE>// Only some types are supported.<NEW_LINE>parseTTLClassAndType();<NEW_LINE>if (!Generator.supportedType(currentType)) {<NEW_LINE>throw st.exception("$GENERATE does not support " + Type.string(currentType) + " records");<NEW_LINE>}<NEW_LINE>// Next comes the rdata specification.<NEW_LINE><MASK><NEW_LINE>// That should be the end. However, we don't want to move past the<NEW_LINE>// line yet, so put back the EOL after reading it.<NEW_LINE>st.getEOL();<NEW_LINE>st.unget();<NEW_LINE>generator = new Generator(start, end, step, nameSpec, currentType, currentDClass, currentTTL, rdataSpec, origin);<NEW_LINE>if (generators == null) {<NEW_LINE>generators = new ArrayList<>(1);<NEW_LINE>}<NEW_LINE>generators.add(generator);<NEW_LINE>} | String rdataSpec = st.getIdentifier(); |
211,314 | final UnclaimDeviceResult executeUnclaimDevice(UnclaimDeviceRequest unclaimDeviceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(unclaimDeviceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UnclaimDeviceRequest> request = null;<NEW_LINE>Response<UnclaimDeviceResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UnclaimDeviceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(unclaimDeviceRequest));<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, "IoT 1Click Devices Service");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UnclaimDevice");<NEW_LINE>request.<MASK><NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UnclaimDeviceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UnclaimDeviceResultJsonUnmarshaller());<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.ADVANCED_CONFIG, advancedConfig); |
1,029,519 | public void error(String s) {<NEW_LINE>if (len <= 1) {<NEW_LINE>addNormalError(s);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Data pre = data[len - 2];<NEW_LINE>if (pre.errorType == ErrorType.LOG) {<NEW_LINE>addNormalError(s);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (s.equals(pre.getSB()) && pre.errorType == ErrorType.ERROR_REPEAT) {<NEW_LINE>pre.count++;<NEW_LINE>adapter.notifyItemChanged(len - 2);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (s.equals(pre.getSB())) {<NEW_LINE>Data last = getLastSB();<NEW_LINE>last.errorType = ErrorType.ERROR_REPEAT;<NEW_LINE>last.sb = data[len - 2].sb;<NEW_LINE>last.count = 1;<NEW_LINE><MASK><NEW_LINE>newLine();<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>addNormalError(s);<NEW_LINE>} | adapter.notifyItemChanged(len - 1); |
588,035 | private boolean blockOnPipeLine() {<NEW_LINE>if (this.isKilled()) {<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>// For pipelining of jobs. Will watch other jobs.<NEW_LINE>if (!this.pipelineJobs.isEmpty()) {<NEW_LINE>String blockedList = "";<NEW_LINE>final ArrayList<BlockingStatus> blockingStatus = new ArrayList<>();<NEW_LINE>for (final String waitingJobId : this.pipelineJobs) {<NEW_LINE>final Status status = <MASK><NEW_LINE>if (status != null && !Status.isStatusFinished(status)) {<NEW_LINE>final BlockingStatus block = this.watcher.getBlockingStatus(waitingJobId);<NEW_LINE>blockingStatus.add(block);<NEW_LINE>blockedList += waitingJobId + ",";<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!blockingStatus.isEmpty()) {<NEW_LINE>this.logger.info("Pipeline job " + this.jobId + " waiting on " + blockedList + " in execution " + this.watcher.getExecId());<NEW_LINE>for (final BlockingStatus bStatus : blockingStatus) {<NEW_LINE>this.logger.info("Waiting on pipelined job " + bStatus.getJobId());<NEW_LINE>this.currentBlockStatus = bStatus;<NEW_LINE>bStatus.blockOnFinishedStatus();<NEW_LINE>if (this.isKilled()) {<NEW_LINE>this.logger.info("Job was killed while waiting on pipeline. Quitting.");<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>this.logger.info("Pipelined job " + bStatus.getJobId() + " finished.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>this.currentBlockStatus = null;<NEW_LINE>return false;<NEW_LINE>} | this.watcher.peekStatus(waitingJobId); |
1,442,052 | private List<ConfigWithMetadata<StandardWorkspace>> listStandardWorkspaceWithMetadata(final Optional<UUID> configId) throws IOException {<NEW_LINE>final Result<Record> result = database.query(ctx -> {<NEW_LINE>final SelectJoinStep<Record> query = ctx.select(asterisk()).from(WORKSPACE);<NEW_LINE>if (configId.isPresent()) {<NEW_LINE>return query.where(WORKSPACE.ID.eq(configId.get<MASK><NEW_LINE>}<NEW_LINE>return query.fetch();<NEW_LINE>});<NEW_LINE>final List<ConfigWithMetadata<StandardWorkspace>> standardWorkspaces = new ArrayList<>();<NEW_LINE>for (final Record record : result) {<NEW_LINE>final StandardWorkspace workspace = DbConverter.buildStandardWorkspace(record);<NEW_LINE>standardWorkspaces.add(new ConfigWithMetadata<>(record.get(WORKSPACE.ID).toString(), ConfigSchema.STANDARD_WORKSPACE.name(), record.get(WORKSPACE.CREATED_AT).toInstant(), record.get(WORKSPACE.UPDATED_AT).toInstant(), workspace));<NEW_LINE>}<NEW_LINE>return standardWorkspaces;<NEW_LINE>} | ())).fetch(); |
1,644,741 | final DescribeTransitGatewayAttachmentsResult executeDescribeTransitGatewayAttachments(DescribeTransitGatewayAttachmentsRequest describeTransitGatewayAttachmentsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeTransitGatewayAttachmentsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeTransitGatewayAttachmentsRequest> request = null;<NEW_LINE>Response<DescribeTransitGatewayAttachmentsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeTransitGatewayAttachmentsRequestMarshaller().marshall(super.beforeMarshalling(describeTransitGatewayAttachmentsRequest));<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "EC2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeTransitGatewayAttachments");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>StaxResponseHandler<DescribeTransitGatewayAttachmentsResult> responseHandler = new StaxResponseHandler<DescribeTransitGatewayAttachmentsResult>(new DescribeTransitGatewayAttachmentsResultStaxUnmarshaller());<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.endEvent(Field.RequestMarshallTime); |
750,797 | public static void main(String[] args) throws Exception {<NEW_LINE>try {<NEW_LINE>if (args.length < 1) {<NEW_LINE>System.out.println("Usage: LocalDLEmulator [<zk_host>] <zk_port>");<NEW_LINE>System.exit(-1);<NEW_LINE>}<NEW_LINE>String zkHost = DEFAULT_ZK_HOST;<NEW_LINE>int zkPort = DEFAULT_ZK_PORT;<NEW_LINE>if (args.length == 1) {<NEW_LINE>zkPort = Integer.parseInt(args[0]);<NEW_LINE>} else {<NEW_LINE>zkHost = args[0];<NEW_LINE>zkPort = Integer.parseInt(args[1]);<NEW_LINE>}<NEW_LINE>final File zkDir = IOUtils.createTempDir("distrlog", "zookeeper");<NEW_LINE>final LocalDLMEmulator localDlm = LocalDLMEmulator.newBuilder().zkHost(zkHost).<MASK><NEW_LINE>Runtime.getRuntime().addShutdownHook(new Thread() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>try {<NEW_LINE>localDlm.teardown();<NEW_LINE>FileUtils.forceDeleteOnExit(zkDir);<NEW_LINE>System.out.println("ByeBye!");<NEW_LINE>} catch (Exception e) {<NEW_LINE>// do nothing<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>localDlm.start();<NEW_LINE>System.out.println(String.format("DistributedLog Sandbox is running now. You could access distributedlog://%s:%s", zkHost, zkPort));<NEW_LINE>} catch (Exception ex) {<NEW_LINE>System.out.println("Exception occurred running emulator " + ex);<NEW_LINE>}<NEW_LINE>} | zkPort(zkPort).build(); |
833,442 | // for when data flows to the data structure pointed to by a local<NEW_LINE>protected void handleFlowsToDataStructure(Value base, Value source) {<NEW_LINE>EquivalentValue sourcesOfBaseEqVal = new CachedEquivalentValue(new AbstractDataSource(base));<NEW_LINE>EquivalentValue baseEqVal = new CachedEquivalentValue(base);<NEW_LINE>EquivalentValue sourceEqVal;<NEW_LINE>if (source instanceof InstanceFieldRef) {<NEW_LINE>InstanceFieldRef ifr = (InstanceFieldRef) source;<NEW_LINE>// deals with inner<NEW_LINE>sourceEqVal = InfoFlowAnalysis.getNodeForFieldRef(sm, ifr.getField(), (Local) ifr.getBase());<NEW_LINE>// fields<NEW_LINE>} else {<NEW_LINE>sourceEqVal = new CachedEquivalentValue(source);<NEW_LINE>}<NEW_LINE>if (source instanceof Ref && !infoFlowSummary.containsNode(sourceEqVal)) {<NEW_LINE>infoFlowSummary.addNode(sourceEqVal);<NEW_LINE>}<NEW_LINE>if (!abbreviatedInfoFlowGraph.containsNode(baseEqVal)) {<NEW_LINE>abbreviatedInfoFlowGraph.addNode(baseEqVal);<NEW_LINE>}<NEW_LINE>if (!abbreviatedInfoFlowGraph.containsNode(sourceEqVal)) {<NEW_LINE>abbreviatedInfoFlowGraph.addNode(sourceEqVal);<NEW_LINE>}<NEW_LINE>if (!abbreviatedInfoFlowGraph.containsNode(sourcesOfBaseEqVal)) {<NEW_LINE>abbreviatedInfoFlowGraph.addNode(sourcesOfBaseEqVal);<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>// for convenience<NEW_LINE>abbreviatedInfoFlowGraph.addEdge(sourcesOfBaseEqVal, baseEqVal);<NEW_LINE>} | abbreviatedInfoFlowGraph.addEdge(sourceEqVal, sourcesOfBaseEqVal); |
173,659 | protected Document parse(InputStream is) throws Exception {<NEW_LINE>DocumentBuilder builder = getNsAwareDocumentBuilderFactory().newDocumentBuilder();<NEW_LINE>Document doc;<NEW_LINE>try {<NEW_LINE>doc = builder.parse(is);<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (configurationFile != null) {<NEW_LINE>String msg = "Failed to parse " + configurationFile + LINE_SEPARATOR + "Exception: " + e.getMessage() + LINE_SEPARATOR + "Hazelcast startup interrupted.";<NEW_LINE>LOGGER.severe(msg);<NEW_LINE>} else if (configurationUrl != null) {<NEW_LINE>String msg = "Failed to parse " + configurationUrl + LINE_SEPARATOR + "Exception: " + e.getMessage() + LINE_SEPARATOR + "Hazelcast startup interrupted.";<NEW_LINE>LOGGER.severe(msg);<NEW_LINE>} else {<NEW_LINE>String msg = "Failed to parse the inputstream" + LINE_SEPARATOR + "Exception: " + e.getMessage() + LINE_SEPARATOR + "Hazelcast startup interrupted.";<NEW_LINE>LOGGER.severe(msg);<NEW_LINE>}<NEW_LINE>throw new InvalidConfigurationException(<MASK><NEW_LINE>} finally {<NEW_LINE>IOUtil.closeResource(is);<NEW_LINE>}<NEW_LINE>return doc;<NEW_LINE>} | e.getMessage(), e); |
84,811 | /* Init kernel with the ontology signature */<NEW_LINE>@Override<NEW_LINE>public void preprocessOntology(Collection<AxiomWrapper> axioms) {<NEW_LINE>exprMap.clear();<NEW_LINE>Signature s = new Signature();<NEW_LINE>for (AxiomWrapper q : axioms) {<NEW_LINE>if (q.isUsed()) {<NEW_LINE>exprMap.computeIfAbsent(q.getAxiom(), x -> new HashSet<>()).addAll(asList(getExpr(q.getAxiom())));<NEW_LINE>s.addAll(q.getAxiom().signature());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// register all the objects in the ontology signature<NEW_LINE>Set<OWLAxiom> <MASK><NEW_LINE>for (OWLEntity p : s.getSignature()) {<NEW_LINE>declarationAxioms.add(df.getOWLDeclarationAxiom(p));<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>kernel = factory.createReasoner(manager.createOntology(declarationAxioms));<NEW_LINE>} catch (OWLOntologyCreationException e) {<NEW_LINE>throw new OWLRuntimeException(e);<NEW_LINE>}<NEW_LINE>kernel.precomputeInferences(InferenceType.CLASS_HIERARCHY);<NEW_LINE>} | declarationAxioms = new HashSet<>(); |
1,280,055 | public static void vertical(Kernel1D_S32 kernel, InterleavedU16 input, InterleavedI16 output) {<NEW_LINE>final int offset = kernel.getOffset();<NEW_LINE>final int width = input.getWidth();<NEW_LINE>final int height = input.getHeight();<NEW_LINE>final int numBands = input.getNumBands();<NEW_LINE>final int[] pixel = new int[numBands];<NEW_LINE>final int[] total = new int[numBands];<NEW_LINE>for (int y = 0; y < height; y++) {<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>Arrays.fill(total, 0);<NEW_LINE>int weight = 0;<NEW_LINE>int startY = y - offset;<NEW_LINE>int endY <MASK><NEW_LINE>if (startY < 0)<NEW_LINE>startY = 0;<NEW_LINE>if (endY > height)<NEW_LINE>endY = height;<NEW_LINE>for (int i = startY; i < endY; i++) {<NEW_LINE>int v = kernel.get(i - y + offset);<NEW_LINE>input.get(x, i, pixel);<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>total[band] += pixel[band] * v;<NEW_LINE>}<NEW_LINE>weight += v;<NEW_LINE>}<NEW_LINE>for (int band = 0; band < numBands; band++) {<NEW_LINE>total[band] = (total[band] + weight / 2) / weight;<NEW_LINE>}<NEW_LINE>output.set(x, y, total);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | = startY + kernel.getWidth(); |
1,262,983 | private static ByteBuf encodeMessageWithOnlySingleByteFixedHeaderAndMessageId(ByteBufAllocator byteBufAllocator, MqttMessage message) {<NEW_LINE>MqttFixedHeader mqttFixedHeader = message.fixedHeader();<NEW_LINE>MqttMessageIdVariableHeader variableHeader = (MqttMessageIdVariableHeader) message.variableHeader();<NEW_LINE>int msgId = variableHeader.messageId();<NEW_LINE>// variable part only has a message id<NEW_LINE>int variableHeaderBufferSize = 2;<NEW_LINE>ByteBuf payload = null;<NEW_LINE>if (message.payload() != null) {<NEW_LINE>payload = ((ByteBuf) message.payload()).duplicate();<NEW_LINE>variableHeaderBufferSize += payload.readableBytes();<NEW_LINE>}<NEW_LINE>int fixedHeaderBufferSize = 1 + getVariableLengthInt(variableHeaderBufferSize);<NEW_LINE>ByteBuf buf = byteBufAllocator.buffer(fixedHeaderBufferSize + variableHeaderBufferSize);<NEW_LINE>buf<MASK><NEW_LINE>writeVariableLengthInt(buf, variableHeaderBufferSize);<NEW_LINE>buf.writeShort(msgId);<NEW_LINE>if (payload != null) {<NEW_LINE>buf.writeBytes(payload);<NEW_LINE>}<NEW_LINE>return buf;<NEW_LINE>} | .writeByte(getFixedHeaderByte1(mqttFixedHeader)); |
394,643 | private void detachSingle(SQLiteDatabase db, InstanceAdapter entityAdapter) {<NEW_LINE>TaskAdapter original = entityAdapter.taskAdapter();<NEW_LINE>TaskAdapter cloneAdapter = original.duplicate();<NEW_LINE>// first prepare the original to resemble the same instance but as a new, detached task<NEW_LINE>original.set(TaskAdapter.SYNC_ID, null);<NEW_LINE>original.<MASK><NEW_LINE>original.set(TaskAdapter.SYNC1, null);<NEW_LINE>original.set(TaskAdapter.SYNC2, null);<NEW_LINE>original.set(TaskAdapter.SYNC3, null);<NEW_LINE>original.set(TaskAdapter.SYNC4, null);<NEW_LINE>original.set(TaskAdapter.SYNC5, null);<NEW_LINE>original.set(TaskAdapter.SYNC6, null);<NEW_LINE>original.set(TaskAdapter.SYNC7, null);<NEW_LINE>original.set(TaskAdapter.SYNC8, null);<NEW_LINE>original.set(TaskAdapter._UID, null);<NEW_LINE>original.set(TaskAdapter._DIRTY, true);<NEW_LINE>original.set(TaskAdapter.ORIGINAL_INSTANCE_ID, null);<NEW_LINE>original.set(TaskAdapter.ORIGINAL_INSTANCE_SYNC_ID, null);<NEW_LINE>original.set(TaskAdapter.ORIGINAL_INSTANCE_TIME, null);<NEW_LINE>original.unset(TaskAdapter.COMPLETED);<NEW_LINE>original.commit(db);<NEW_LINE>// wipe INSTANCE_ORIGINAL_TIME from instances entry<NEW_LINE>ContentValues noOriginalTime = new ContentValues();<NEW_LINE>noOriginalTime.putNull(TaskContract.Instances.INSTANCE_ORIGINAL_TIME);<NEW_LINE>db.update(TaskDatabaseHelper.Tables.INSTANCES, noOriginalTime, "_ID = ?", new String[] { String.valueOf(entityAdapter.id()) });<NEW_LINE>// reset the clone to be a deleted instance<NEW_LINE>cloneAdapter.set(TaskAdapter._DELETED, true);<NEW_LINE>// remove joined field values<NEW_LINE>cloneAdapter.unset(TaskAdapter.LIST_ACCESS_LEVEL);<NEW_LINE>cloneAdapter.unset(TaskAdapter.LIST_COLOR);<NEW_LINE>cloneAdapter.unset(TaskAdapter.LIST_NAME);<NEW_LINE>cloneAdapter.unset(TaskAdapter.LIST_OWNER);<NEW_LINE>cloneAdapter.unset(TaskAdapter.LIST_VISIBLE);<NEW_LINE>cloneAdapter.unset(TaskAdapter.ACCOUNT_NAME);<NEW_LINE>cloneAdapter.unset(TaskAdapter.ACCOUNT_TYPE);<NEW_LINE>cloneAdapter.commit(db);<NEW_LINE>// note, we don't have to create an instance for the clone because it's deleted<NEW_LINE>} | set(TaskAdapter.SYNC_VERSION, null); |
797,171 | public final DropViewContext dropView() throws RecognitionException {<NEW_LINE>DropViewContext _localctx = new DropViewContext(_ctx, getState());<NEW_LINE>enterRule(_localctx, 154, RULE_dropView);<NEW_LINE>int _la;<NEW_LINE>try {<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(2707);<NEW_LINE>match(DROP);<NEW_LINE>setState(2708);<NEW_LINE>match(VIEW);<NEW_LINE>setState(2710);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == IF) {<NEW_LINE>{<NEW_LINE>setState(2709);<NEW_LINE>ifExists();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2712);<NEW_LINE>fullId();<NEW_LINE>setState(2717);<NEW_LINE>_errHandler.sync(this);<NEW_LINE><MASK><NEW_LINE>while (_la == COMMA) {<NEW_LINE>{<NEW_LINE>{<NEW_LINE>setState(2713);<NEW_LINE>match(COMMA);<NEW_LINE>setState(2714);<NEW_LINE>fullId();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>setState(2719);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>}<NEW_LINE>setState(2721);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (_la == CASCADE || _la == RESTRICT) {<NEW_LINE>{<NEW_LINE>setState(2720);<NEW_LINE>((DropViewContext) _localctx).dropType = _input.LT(1);<NEW_LINE>_la = _input.LA(1);<NEW_LINE>if (!(_la == CASCADE || _la == RESTRICT)) {<NEW_LINE>((DropViewContext) _localctx).dropType = (Token) _errHandler.recoverInline(this);<NEW_LINE>} else {<NEW_LINE>if (_input.LA(1) == Token.EOF)<NEW_LINE>matchedEOF = true;<NEW_LINE>_errHandler.reportMatch(this);<NEW_LINE>consume();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | _la = _input.LA(1); |
810,765 | public List<String> resolve(String placeHolder, HttpFacade httpFacade) {<NEW_LINE>String source = placeHolder.substring(placeHolder.indexOf('.') + 1);<NEW_LINE>OIDCHttpFacade oidcHttpFacade = OIDCHttpFacade.class.cast(httpFacade);<NEW_LINE>KeycloakSecurityContext securityContext = oidcHttpFacade.getSecurityContext();<NEW_LINE>if (securityContext == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>if (source.endsWith("access_token")) {<NEW_LINE>return Arrays.asList(securityContext.getTokenString());<NEW_LINE>}<NEW_LINE>if (source.endsWith("id_token")) {<NEW_LINE>return Arrays.asList(securityContext.getIdTokenString());<NEW_LINE>}<NEW_LINE>JsonNode jsonNode;<NEW_LINE>if (source.startsWith("access_token[")) {<NEW_LINE>jsonNode = JsonSerialization.mapper.valueToTree(securityContext.getToken());<NEW_LINE>} else if (source.startsWith("id_token[")) {<NEW_LINE>jsonNode = JsonSerialization.mapper.valueToTree(securityContext.getIdToken());<NEW_LINE>} else {<NEW_LINE>throw new <MASK><NEW_LINE>}<NEW_LINE>return JsonUtils.getValues(jsonNode, getParameter(source, "Invalid placeholder [" + placeHolder + "]"));<NEW_LINE>} | RuntimeException("Invalid placeholder [" + placeHolder + "]"); |
601,944 | public AnalyticMoveLine createAnalyticMoveLine(AnalyticDistributionLine analyticDistributionLine, BigDecimal total, int typeSelect, LocalDate date) {<NEW_LINE>AnalyticMoveLine analyticMoveLine = new AnalyticMoveLine();<NEW_LINE>analyticMoveLine.setOriginalPieceAmount(total);<NEW_LINE>analyticMoveLine.<MASK><NEW_LINE>analyticMoveLine.setAnalyticAxis(analyticDistributionLine.getAnalyticAxis());<NEW_LINE>analyticMoveLine.setAnalyticJournal(analyticDistributionLine.getAnalyticJournal());<NEW_LINE>AnalyticJournal analyticJournal = analyticDistributionLine.getAnalyticJournal();<NEW_LINE>Company company = analyticJournal == null ? null : analyticJournal.getCompany();<NEW_LINE>if (company != null) {<NEW_LINE>analyticMoveLine.setCurrency(company.getCurrency());<NEW_LINE>}<NEW_LINE>analyticMoveLine.setDate(date);<NEW_LINE>analyticMoveLine.setPercentage(analyticDistributionLine.getPercentage());<NEW_LINE>analyticMoveLine.setAmount(computeAmount(analyticMoveLine));<NEW_LINE>analyticMoveLine.setTypeSelect(typeSelect);<NEW_LINE>return analyticMoveLine;<NEW_LINE>} | setAnalyticAccount(analyticDistributionLine.getAnalyticAccount()); |
1,371,348 | public void associate() {<NEW_LINE>matchesAll.resize(listDst.size);<NEW_LINE>matchesAll.reset();<NEW_LINE>if (scoreRatioThreshold >= 1.0) {<NEW_LINE>BoofConcurrency.loopBlocks(0, listDst.size, new InnerConsumer() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void innerAccept(Helper h, int index0, int index1) {<NEW_LINE>for (int i = index0; i < index1; i++) {<NEW_LINE>if (!h.search.findNearest(listDst.data[i], maxDistance, h.result))<NEW_LINE>continue;<NEW_LINE>h.matches.grow().setTo(h.result.index, i, h.result.distance);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else {<NEW_LINE>BoofConcurrency.loopBlocks(0, listDst.size, new InnerConsumer() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void innerAccept(Helper h, int index0, int index1) {<NEW_LINE>for (int i = index0; i < index1; i++) {<NEW_LINE>h.search.findNearest(listDst.data[i], maxDistance, 2, h.result2);<NEW_LINE>if (h.result2.size == 1) {<NEW_LINE>NnData<D> r = h.result2.getTail();<NEW_LINE>h.matches.grow().setTo(r.index, i, r.distance);<NEW_LINE>} else if (h.result2.size == 2) {<NEW_LINE>NnData<D> r0 = h.result2.get(0);<NEW_LINE>NnData<D> r1 = <MASK><NEW_LINE>// ensure that r0 is the closest<NEW_LINE>if (r0.distance > r1.distance) {<NEW_LINE>NnData<D> tmp = r0;<NEW_LINE>r0 = r1;<NEW_LINE>r1 = tmp;<NEW_LINE>}<NEW_LINE>double foundRatio = ratioUsesSqrt ? Math.sqrt(r0.distance) / Math.sqrt(r1.distance) : r0.distance / r1.distance;<NEW_LINE>if (foundRatio <= scoreRatioThreshold) {<NEW_LINE>h.matches.grow().setTo(r0.index, i, r0.distance);<NEW_LINE>}<NEW_LINE>} else if (h.result2.size != 0) {<NEW_LINE>throw new RuntimeException("BUG! 0,1,2 are acceptable not " + h.result2.size);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>});<NEW_LINE>}<NEW_LINE>} | h.result2.get(1); |
186,206 | private static CharSequence describeIssuerTrust(String contextName, @Nullable Map<String, List<X509Certificate>> trustedIssuers, X509Certificate certificate, String issuerName) {<NEW_LINE>if (trustedIssuers == null) {<NEW_LINE>return "";<NEW_LINE>}<NEW_LINE>StringBuilder message = new StringBuilder();<NEW_LINE>final IssuerTrust trust = checkIssuerTrust(trustedIssuers, certificate);<NEW_LINE>if (trust.isVerified()) {<NEW_LINE>message.append("; the issuing ").append(trust.issuerCerts.size() == 1 ? "certificate" : "certificates").append(" with ").append(fingerprintDescription(trust.issuerCerts)).append(" ").append(trust.issuerCerts.size() == 1 ? "is" : "are").append(" trusted in this ssl context ([").append<MASK><NEW_LINE>} else if (trust.foundCertificateForDn()) {<NEW_LINE>message.append("; this ssl context ([").append(contextName).append("]) trusts [").append(trust.issuerCerts.size()).append("] ").append(trust.issuerCerts.size() == 1 ? "certificate" : "certificates").append(" with subject name [").append(issuerName).append("] and ").append(fingerprintDescription(trust.issuerCerts)).append(" but the signatures do not match");<NEW_LINE>} else {<NEW_LINE>message.append("; this ssl context ([").append(contextName).append("]) is not configured to trust that issuer");<NEW_LINE>}<NEW_LINE>return message;<NEW_LINE>} | (contextName).append("])"); |
1,690,095 | public void write(final PrintWriter writer, StatisticsTracker stats) {<NEW_LINE>Collection<String> keys = null;<NEW_LINE>DisposableStoredSortedMap<MASK><NEW_LINE>if (maxSortSize < 0 || maxSortSize > stats.serverCache.hostKeys().size()) {<NEW_LINE>hd = stats.calcReverseSortedHostsDistribution();<NEW_LINE>keys = hd.values();<NEW_LINE>} else {<NEW_LINE>keys = stats.serverCache.hostKeys();<NEW_LINE>}<NEW_LINE>writer.print("[#urls] [#bytes] [host] [#robots] [#remaining] [#novel-urls] [#novel-bytes] [#dup-by-hash-urls] [#dup-by-hash-bytes] [#not-modified-urls] [#not-modified-bytes]\n");<NEW_LINE>for (String key : keys) {<NEW_LINE>// key is -count, value is hostname<NEW_LINE>try {<NEW_LINE>CrawlHost host = stats.serverCache.getHostFor(key);<NEW_LINE>long fetchSuccesses = host.getSubstats().getFetchSuccesses();<NEW_LINE>if (!suppressEmptyHosts || fetchSuccesses > 0) {<NEW_LINE>writeReportLine(writer, fetchSuccesses, host.getSubstats().getTotalBytes(), host.fixUpName(), host.getSubstats().getRobotsDenials(), host.getSubstats().getRemaining(), host.getSubstats().getNovelUrls(), host.getSubstats().getNovelBytes(), host.getSubstats().getDupByHashUrls(), host.getSubstats().getDupByHashBytes(), host.getSubstats().getNotModifiedUrls(), host.getSubstats().getNotModifiedBytes());<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.log(Level.WARNING, "unable to tally host stats for " + key, e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (hd != null) {<NEW_LINE>hd.dispose();<NEW_LINE>}<NEW_LINE>} | <Long, String> hd = null; |
1,111,666 | public void metrics(Nimbus.Client client) throws Exception {<NEW_LINE>if (_interval <= 0) {<NEW_LINE>throw new IllegalArgumentException("poll interval must be positive");<NEW_LINE>}<NEW_LINE>if (_topology == null || _topology.isEmpty()) {<NEW_LINE>throw new IllegalArgumentException("topology name must be something");<NEW_LINE>}<NEW_LINE>if (_component == null || _component.isEmpty()) {<NEW_LINE>HashSet<String> components = getComponents(client, _topology);<NEW_LINE>System.out.println("Available components for " + _topology + " :");<NEW_LINE>System.out.println("------------------");<NEW_LINE>for (String comp : components) {<NEW_LINE>System.out.println(comp);<NEW_LINE>}<NEW_LINE>System.out.println("------------------");<NEW_LINE>System.out.println("Please use -m to specify one component");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (_stream == null || _stream.isEmpty()) {<NEW_LINE>throw new IllegalArgumentException("stream name must be something");<NEW_LINE>}<NEW_LINE>if (!WATCH_TRANSFERRED.equals(_watch) && !WATCH_EMITTED.equals(_watch)) {<NEW_LINE>throw new IllegalArgumentException("watch item must either be transferred or emitted");<NEW_LINE>}<NEW_LINE>System.out.println("topology\tcomponent\tparallelism\tstream\ttime-diff ms\t" + _watch + "\tthroughput (Kt/s)");<NEW_LINE>long pollMs = _interval * 1000;<NEW_LINE><MASK><NEW_LINE>MetricsState state = new MetricsState(now, 0);<NEW_LINE>Poller poller = new Poller(now, pollMs);<NEW_LINE>do {<NEW_LINE>metrics(client, now, state);<NEW_LINE>try {<NEW_LINE>now = poller.nextPoll();<NEW_LINE>} catch (InterruptedException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>} while (true);<NEW_LINE>} | long now = System.currentTimeMillis(); |
1,748,809 | public final PatternEscapeContext patternEscape() throws RecognitionException {<NEW_LINE>PatternEscapeContext _localctx = new <MASK><NEW_LINE>enterRule(_localctx, 66, RULE_patternEscape);<NEW_LINE>try {<NEW_LINE>setState(626);<NEW_LINE>_errHandler.sync(this);<NEW_LINE>switch(_input.LA(1)) {<NEW_LINE>case ESCAPE:<NEW_LINE>enterOuterAlt(_localctx, 1);<NEW_LINE>{<NEW_LINE>setState(620);<NEW_LINE>match(ESCAPE);<NEW_LINE>setState(621);<NEW_LINE>((PatternEscapeContext) _localctx).escape = string();<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ESCAPE_ESC:<NEW_LINE>enterOuterAlt(_localctx, 2);<NEW_LINE>{<NEW_LINE>setState(622);<NEW_LINE>match(ESCAPE_ESC);<NEW_LINE>setState(623);<NEW_LINE>((PatternEscapeContext) _localctx).escape = string();<NEW_LINE>setState(624);<NEW_LINE>match(ESC_END);<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new NoViableAltException(this);<NEW_LINE>}<NEW_LINE>} catch (RecognitionException re) {<NEW_LINE>_localctx.exception = re;<NEW_LINE>_errHandler.reportError(this, re);<NEW_LINE>_errHandler.recover(this, re);<NEW_LINE>} finally {<NEW_LINE>exitRule();<NEW_LINE>}<NEW_LINE>return _localctx;<NEW_LINE>} | PatternEscapeContext(_ctx, getState()); |
106,452 | protected void handleApplicationEvent(RegisterCustomerEvent event) {<NEW_LINE>Customer customer = customerService.<MASK><NEW_LINE>if (customer == null) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Unable to send registration email for customer with id " + event.getCustomerId() + ". No such customer found.");<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Map<String, Object> context = createContext(customer, event);<NEW_LINE>try {<NEW_LINE>notificationDispatcher.dispatchNotification(new EmailNotification(customer.getEmailAddress(), NotificationEventType.REGISTER_CUSTOMER, context));<NEW_LINE>} catch (ServiceException e) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Unable to send registration email for customer with email " + customer.getEmailAddress(), e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>notificationDispatcher.dispatchNotification(new SMSNotification(NotificationEventType.REGISTER_CUSTOMER, context));<NEW_LINE>} catch (ServiceException e) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>LOG.debug("Unable to send registration sms for customer", e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | readCustomerById(event.getCustomerId()); |
559,717 | public void executeGet(BaseRequest request, BaseResponse response) {<NEW_LINE>getPageHeader(request, response.getContent());<NEW_LINE>String queryId = request.getSingleParameter("query_id");<NEW_LINE>if (Strings.isNullOrEmpty(queryId)) {<NEW_LINE>response.appendContent("");<NEW_LINE>response.appendContent("<p class=\"text-error\"> Must specify a query_id[]</p>");<NEW_LINE>}<NEW_LINE>String queryProfileStr = ProfileManager.getInstance().getProfile(queryId);<NEW_LINE>if (queryProfileStr != null) {<NEW_LINE>appendCopyButton(response.getContent());<NEW_LINE>appendQueryProfile(response.getContent(), queryProfileStr);<NEW_LINE>getPageFooter(response.getContent());<NEW_LINE>writeResponse(request, response);<NEW_LINE>} else {<NEW_LINE>appendQueryProfile(response.getContent(), "query id " + queryId + " not found.");<NEW_LINE>getPageFooter(response.getContent());<NEW_LINE>writeResponse(<MASK><NEW_LINE>}<NEW_LINE>} | request, response, HttpResponseStatus.NOT_FOUND); |
1,478,199 | public synchronized void close() {<NEW_LINE>logger.fine("Count of alreadyseen on close " + count.get());<NEW_LINE>Environment env = null;<NEW_LINE>if (this.alreadySeen != null) {<NEW_LINE>try {<NEW_LINE>env = this.alreadySeen.getEnvironment();<NEW_LINE>alreadySeen.sync();<NEW_LINE>} catch (DatabaseException e) {<NEW_LINE>logger.severe(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (env != null) {<NEW_LINE>try {<NEW_LINE>// This sync flushes what's in RAM. Its expensive operation.<NEW_LINE>// Without, data can be lost. Not for transactional operation.<NEW_LINE>env.sync();<NEW_LINE>} catch (DatabaseException e) {<NEW_LINE>logger.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (createdEnvironment) {<NEW_LINE>// Only manually close database if it were created via a<NEW_LINE>// constructor, and not via a BdbModule. Databases created by a<NEW_LINE>// BdbModule will be closed by that BdbModule.<NEW_LINE>if (this.alreadySeen != null) {<NEW_LINE>try {<NEW_LINE>alreadySeen.close();<NEW_LINE>} catch (DatabaseException e) {<NEW_LINE>logger.severe(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (env != null) {<NEW_LINE>try {<NEW_LINE>env.close();<NEW_LINE>} catch (DatabaseException e) {<NEW_LINE>logger.severe(e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | severe(e.getMessage()); |
259,719 | private I_M_InOut createInTrx() {<NEW_LINE>Check.assume(!executed, "inout not already created");<NEW_LINE>executed = true;<NEW_LINE>final boolean doComplete = isComplete();<NEW_LINE>//<NEW_LINE>// Create and complete the material return<NEW_LINE>if (doComplete) {<NEW_LINE>// Create document lines<NEW_LINE>// NOTE: as a side effect the document header will be created, if there was at least one line<NEW_LINE>createLines();<NEW_LINE>if (!inoutRef.isInitialized()) {<NEW_LINE>// nothing created<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>final I_M_InOut inout = inoutRef.getValue();<NEW_LINE>if (inout.getM_InOut_ID() <= 0) {<NEW_LINE>// nothing created<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>// create snapshot<NEW_LINE>createHUSnapshots();<NEW_LINE>docActionBL.processEx(inout, IDocument.ACTION_Complete, IDocument.STATUS_Completed);<NEW_LINE>afterInOutProcessed(inout);<NEW_LINE>return inout;<NEW_LINE>} else //<NEW_LINE>// Create a draft material return, even if there are no lines<NEW_LINE>{<NEW_LINE>createLines();<NEW_LINE>final <MASK><NEW_LINE>// create snapshot<NEW_LINE>createHUSnapshots();<NEW_LINE>InterfaceWrapperHelper.save(inout);<NEW_LINE>return inout;<NEW_LINE>}<NEW_LINE>} | I_M_InOut inout = inoutRef.getValue(); |
1,032,874 | public void afterCommit(Operation op, Class<?>... entityClass) {<NEW_LINE>ESBulkBuilder bbuilder = new ESBulkBuilder();<NEW_LINE>for (Class<?> vo : entityClass) {<NEW_LINE>if (!triggerVOs.contains(vo)) {<NEW_LINE>logger.trace(String.format("Class[%s] is not annotated by @TriggerIndex, no index operation will be proceeded", vo.getName()));<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (op == Operation.PERSIST || op == Operation.UPDATE) {<NEW_LINE>Map<String, Set<String>> vmap = getUuidsOfVOToIndexFromInsertVOUpdateVO(vo, op);<NEW_LINE>bbuilder = addDocToIndexToESBuilder(bbuilder, vmap);<NEW_LINE>} else if (op == Operation.REMOVE) {<NEW_LINE>Pair<Map<String, Set<String>>, Map<String, Set<String>>> pair = getVOUuidsToDeleteOrIndexFromDeleteVO(vo);<NEW_LINE>Map<String, Set<String>> toIndex = pair.second();<NEW_LINE><MASK><NEW_LINE>Map<String, Set<String>> toDelete = pair.first();<NEW_LINE>bbuilder = addDocToDeleteToESBuilder(bbuilder, toDelete);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!bbuilder.isEmpty()) {<NEW_LINE>sendBulk(bbuilder.toString(), bbuilder.getAffectedInventoryNames());<NEW_LINE>}<NEW_LINE>} | bbuilder = addDocToIndexToESBuilder(bbuilder, toIndex); |
660,689 | public void marshal(final Object source, final HierarchicalStreamWriter writer, final MarshallingContext context) {<NEW_LINE>final Map<?, ?> map = (Map<?, ?>) source;<NEW_LINE>SingleValueConverter keyConverter = null;<NEW_LINE>SingleValueConverter valueConverter = null;<NEW_LINE>if (keyAsAttribute) {<NEW_LINE>final SingleValueConverter <MASK><NEW_LINE>keyConverter = singleValueConverter;<NEW_LINE>}<NEW_LINE>if (valueAsAttribute || valueName == null) {<NEW_LINE>final SingleValueConverter singleValueConverter = getSingleValueConverter(valueType, "value");<NEW_LINE>valueConverter = singleValueConverter;<NEW_LINE>}<NEW_LINE>for (final Map.Entry<?, ?> entry : map.entrySet()) {<NEW_LINE>final Object key = entry.getKey();<NEW_LINE>final Object value = entry.getValue();<NEW_LINE>if (entryName != null) {<NEW_LINE>writer.startNode(entryName, entry.getClass());<NEW_LINE>if (keyConverter != null && key != null) {<NEW_LINE>writer.addAttribute(keyName, keyConverter.toString(key));<NEW_LINE>}<NEW_LINE>if (valueName != null && valueConverter != null && value != null) {<NEW_LINE>writer.addAttribute(valueName, valueConverter.toString(value));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (keyConverter == null) {<NEW_LINE>writeItem(keyName, keyType, key, context, writer);<NEW_LINE>}<NEW_LINE>if (valueConverter == null) {<NEW_LINE>writeItem(valueName, valueType, value, context, writer);<NEW_LINE>} else if (valueName == null) {<NEW_LINE>writer.setValue(valueConverter.toString(value));<NEW_LINE>}<NEW_LINE>if (entryName != null) {<NEW_LINE>writer.endNode();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | singleValueConverter = getSingleValueConverter(keyType, "key"); |
671,290 | public Expr apply(List<Expr> args) {<NEW_LINE>if (args.size() != 1) {<NEW_LINE>throw new IAE("Function[%s] must have 1 argument", name());<NEW_LINE>}<NEW_LINE>class HllExpr extends ExprMacroTable.BaseScalarUnivariateMacroFunctionExpr {<NEW_LINE><NEW_LINE>public HllExpr(Expr arg) {<NEW_LINE>super(NAME, arg);<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public ExprEval eval(ObjectBinding bindings) {<NEW_LINE>ExprEval hllCollector = args.get(0).eval(bindings);<NEW_LINE>// be permissive for now, we can count more on this later when we are better at retaining complete complex<NEW_LINE>// type information everywhere<NEW_LINE>if (!TYPE.equals(hllCollector.type()) || !(hllCollector.type().is(ExprType.COMPLEX) && hllCollector.value() instanceof HyperLogLogCollector)) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>HyperLogLogCollector collector = (HyperLogLogCollector) hllCollector.value();<NEW_LINE>assert collector != null;<NEW_LINE>return ExprEval.ofDouble(collector.estimateCardinality());<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Expr visit(Shuttle shuttle) {<NEW_LINE>return shuttle.visit(apply(shuttle.visitAll(args)));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Nullable<NEW_LINE>@Override<NEW_LINE>public ExpressionType getOutputType(InputBindingInspector inspector) {<NEW_LINE>return ExpressionType.DOUBLE;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return new HllExpr(args.get(0));<NEW_LINE>} | throw new IAE("Function[%s] must take a hyper-log-log collector as input", NAME); |
1,829,852 | public double convexityFromYield(ResolvedFixedCouponBond bond, LocalDate settlementDate, double yield) {<NEW_LINE>ImmutableList<FixedCouponBondPaymentPeriod> payments = bond.getPeriodicPayments();<NEW_LINE>int nCoupon = payments.size() - couponIndex(payments, settlementDate);<NEW_LINE>FixedCouponBondYieldConvention yieldConv = bond.getYieldConvention();<NEW_LINE>if (nCoupon == 1) {<NEW_LINE>if (yieldConv.equals(US_STREET) || yieldConv.equals(DE_BONDS)) {<NEW_LINE>double couponPerYear = bond.getFrequency().eventsPerYear();<NEW_LINE>double factorToNextCoupon = factorToNextCoupon(bond, settlementDate);<NEW_LINE>double timeToPay = factorToNextCoupon / couponPerYear;<NEW_LINE>double disc = (1d + factorToNextCoupon * yield / couponPerYear);<NEW_LINE>return 2d * timeToPay * timeToPay / (disc * disc);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (yieldConv.equals(US_STREET) || yieldConv.equals(GB_BUMP_DMO) || yieldConv.equals(DE_BONDS)) {<NEW_LINE>return convexityFromYieldStandard(bond, settlementDate, yield);<NEW_LINE>}<NEW_LINE>if (yieldConv.equals(JP_SIMPLE)) {<NEW_LINE><MASK><NEW_LINE>if (settlementDate.isAfter(maturityDate)) {<NEW_LINE>return 0d;<NEW_LINE>}<NEW_LINE>double maturity = bond.getDayCount().relativeYearFraction(settlementDate, maturityDate);<NEW_LINE>double num = 1d + bond.getFixedRate() * maturity;<NEW_LINE>double den = 1d + yield * maturity;<NEW_LINE>double dirtyPrice = dirtyPriceFromCleanPrice(bond, settlementDate, num / den);<NEW_LINE>return 2d * num * pow2(maturity) * Math.pow(den, -3) / dirtyPrice;<NEW_LINE>}<NEW_LINE>throw new UnsupportedOperationException("The convention " + yieldConv.name() + " is not supported.");<NEW_LINE>} | LocalDate maturityDate = bond.getUnadjustedEndDate(); |
1,043,274 | public void updateValues() {<NEW_LINE>Port port = getPort();<NEW_LINE>nameField.setText(port.getName());<NEW_LINE>labelField.setText(port.getDisplayLabel());<NEW_LINE>typeField.setText(port.getType());<NEW_LINE>descriptionField.setText(port.getDescription());<NEW_LINE>rangeBox.setSelectedItem(getHumanizedRange(port.getRange()));<NEW_LINE>if (port.isStandardType()) {<NEW_LINE>widgetBox.setSelectedItem(getHumanizedWidget(port.getWidget()));<NEW_LINE>valueField.setText(port.getValue().toString());<NEW_LINE>} else<NEW_LINE>valueField.setEnabled(false);<NEW_LINE>Object minimumValue = port.getMinimumValue();<NEW_LINE>String minimumValueString = minimumValue == null ? "" : minimumValue.toString();<NEW_LINE>minimumValueCheck.setSelected(minimumValue != null);<NEW_LINE>minimumValueField.setText(minimumValueString);<NEW_LINE>minimumValueField.setEnabled(minimumValue != null);<NEW_LINE>Object maximumValue = port.getMaximumValue();<NEW_LINE>String maximumValueString = maximumValue == null ? "" : maximumValue.toString();<NEW_LINE>maximumValueCheck.setSelected(maximumValue != null);<NEW_LINE>maximumValueField.setText(maximumValueString);<NEW_LINE>maximumValueField.setEnabled(maximumValue != null);<NEW_LINE>menuItemsTable.tableChanged(new TableModelEvent<MASK><NEW_LINE>revalidate();<NEW_LINE>} | (menuItemsTable.getModel())); |
1,445,448 | public static StatisticsBundle input(final String inputString) {<NEW_LINE>final Map<String, String> loadedMap = JsonFactory.get().deserializeStringMap(inputString);<NEW_LINE>final StatisticsBundle bundle = new StatisticsBundle();<NEW_LINE>for (final Statistic loopStat : Statistic.values()) {<NEW_LINE>final String value = loadedMap.get(loopStat.name());<NEW_LINE>if (StringUtil.notEmpty(value)) {<NEW_LINE>final long longValue = JavaHelper.silentParseLong(value, 0);<NEW_LINE>final LongAccumulator longAdder = JavaHelper.newAbsLongAccumulator();<NEW_LINE>longAdder.accumulate(longValue);<NEW_LINE>bundle.incrementerMap.put(loopStat, longAdder);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (final AvgStatistic loopStat : AvgStatistic.values()) {<NEW_LINE>final String value = loadedMap.get(loopStat.name());<NEW_LINE>if (StringUtil.notEmpty(value)) {<NEW_LINE>final AverageBean avgBean = JsonFactory.get().deserialize(value, AverageBean.class);<NEW_LINE>bundle.<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>return bundle;<NEW_LINE>} | avgMap.put(loopStat, avgBean); |
808,640 | public static String generateDefaultPolicy(UUID configUUID) {<NEW_LINE>ObjectNode policyBase = getPolicyBase();<NEW_LINE>GetCallerIdentityResult callerIdentity = getCallerIdentity(configUUID);<NEW_LINE>if (callerIdentity != null) {<NEW_LINE>String credentialsArn = callerIdentity.getArn();<NEW_LINE>if (credentialsArn.contains(":assumed-role/")) {<NEW_LINE>credentialsArn = getRole(configUUID, getResourceNameFromArn(credentialsArn)).getArn();<NEW_LINE>} else if (!credentialsArn.contains(":user/")) {<NEW_LINE>throw new RuntimeException("Credentials provided are not associated to a user or role");<NEW_LINE>}<NEW_LINE>String rootArn = String.format("arn:aws:iam::%s:root", callerIdentity.getAccount());<NEW_LINE>return bindParamsToPolicyBase(policyBase, <MASK><NEW_LINE>} else {<NEW_LINE>LOG.error("Could not get AWS caller identity from provided credentials");<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} | credentialsArn, rootArn).toString(); |
423,560 | public Object createResultObject(List<Object> fields, ExecutionConfig config) throws MLException {<NEW_LINE>if (fields.size() != count()) {<NEW_LINE>throw new MLException("Invalid field number for create object for class " + originalTI.getTypeClass() + ". Needs " + count() + " fields, while having " + fields.size() + " fields.");<NEW_LINE>}<NEW_LINE>if (decomposed) {<NEW_LINE>if (originalTI instanceof PojoTypeInfo) {<NEW_LINE>PojoTypeInfo pto = (PojoTypeInfo) originalTI;<NEW_LINE>try {<NEW_LINE>Object result = originalTI<MASK><NEW_LINE>for (int i = 0; i < count(); i++) {<NEW_LINE>PojoField field = pto.getPojoFieldAt(i);<NEW_LINE>field.getField().set(result, fields.get(i));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new MLException("Fail to initiate POJO object. The type is " + originalTI.getTypeClass(), e);<NEW_LINE>}<NEW_LINE>} else if (originalTI instanceof CaseClassTypeInfo) {<NEW_LINE>CaseClassSerializer ts = (CaseClassSerializer) originalTI.createSerializer(config);<NEW_LINE>return ts.createInstance(fields.toArray());<NEW_LINE>} else if (originalTI instanceof TupleTypeInfo) {<NEW_LINE>try {<NEW_LINE>Tuple tuple = Tuple.getTupleClass(count()).newInstance();<NEW_LINE>for (int i = 0; i < count(); i++) {<NEW_LINE>tuple.setField(fields.get(i), i);<NEW_LINE>}<NEW_LINE>return tuple;<NEW_LINE>} catch (IllegalAccessException | InstantiationException e) {<NEW_LINE>throw new MLException("Failed to create Tuple object for type " + originalTI.getTypeClass().getCanonicalName(), e);<NEW_LINE>}<NEW_LINE>} else if (originalTI instanceof RowTypeInfo) {<NEW_LINE>Row row = new Row(count());<NEW_LINE>for (int i = 0; i < count(); i++) {<NEW_LINE>row.setField(i, fields.get(i));<NEW_LINE>}<NEW_LINE>return row;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return fields.get(0);<NEW_LINE>} | .getTypeClass().newInstance(); |
779,083 | protected boolean prepareWarFile() {<NEW_LINE>// create file system first<NEW_LINE>if (createWarFileSystem()) {<NEW_LINE>String homePath = System.getProperty(SOAPUI_HOME) == null ? SOAPUI_BIN_FOLDER : System.getProperty(SOAPUI_HOME);<NEW_LINE>// copy all from bin/../lib to soapui.home/war/WEB-INF/lib/<NEW_LINE>File fromDir <MASK><NEW_LINE>JarPackager.copyAllFromTo(fromDir, warLibDir, new CaseInsensitiveFileFilter());<NEW_LINE>if (includeExt) {<NEW_LINE>String extDirPath = System.getProperty("soapui.ext.libraries");<NEW_LINE>fromDir = extDirPath != null ? new File(extDirPath) : new File(new File(homePath), "ext");<NEW_LINE>JarPackager.copyAllFromTo(fromDir, warLibDir, null);<NEW_LINE>}<NEW_LINE>// copy soapui jar to soapui.home/war/WEB-INF/lib/<NEW_LINE>String[] mainJar = new File(homePath).list(new FilenameFilter() {<NEW_LINE><NEW_LINE>public boolean accept(File dir, String name) {<NEW_LINE>return name.toLowerCase().startsWith("soapui") && name.toLowerCase().endsWith(".jar");<NEW_LINE>}<NEW_LINE>});<NEW_LINE>fromDir = new File(homePath, mainJar[0]);<NEW_LINE>JarPackager.copyFileToDir(fromDir, warLibDir);<NEW_LINE>// copy project and settings file to bin/war/WEB-INF/soapui/<NEW_LINE>copyProjectFile();<NEW_LINE>if (settingsFile != null && settingsFile.exists() && settingsFile.isFile()) {<NEW_LINE>JarPackager.copyFileToDir(settingsFile, soapUIDir);<NEW_LINE>}<NEW_LINE>// actions<NEW_LINE>if (includeActions) {<NEW_LINE>fromDir = new File(System.getProperty("soapui.ext.actions"));<NEW_LINE>JarPackager.copyAllFromTo(fromDir, actionsDir, null);<NEW_LINE>}<NEW_LINE>// listeners<NEW_LINE>if (includeListeners) {<NEW_LINE>fromDir = new File(System.getProperty("soapui.ext.listeners"));<NEW_LINE>JarPackager.copyAllFromTo(fromDir, listenersDir, null);<NEW_LINE>}<NEW_LINE>copyWarResource("header_logo.png");<NEW_LINE>copyWarResource("stylesheet.css");<NEW_LINE>return true;<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | = new File(homePath, SOAPUI_LIB_FOLDER); |
744,950 | private static void withSerdeProducerProperties(boolean isKey, Map<String, String> options, Properties properties) {<NEW_LINE>String serializer = isKey ? KEY_SERIALIZER : VALUE_SERIALIZER;<NEW_LINE>String format = options.get(isKey ? OPTION_KEY_FORMAT : OPTION_VALUE_FORMAT);<NEW_LINE>if (format == null && isKey) {<NEW_LINE>properties.putIfAbsent(serializer, BYTE_ARRAY_SERIALIZER);<NEW_LINE>} else if (AVRO_FORMAT.equals(format)) {<NEW_LINE>properties.putIfAbsent(serializer, AVRO_SERIALIZER);<NEW_LINE>} else if (JSON_FORMAT.equals(format)) {<NEW_LINE>properties.putIfAbsent(serializer, BYTE_ARRAY_SERIALIZER);<NEW_LINE>} else if (JAVA_FORMAT.equals(format)) {<NEW_LINE>String clazz = options.get(isKey ? SqlConnector.OPTION_KEY_CLASS : SqlConnector.OPTION_VALUE_CLASS);<NEW_LINE>String serializerClass = resolveSerializer(clazz);<NEW_LINE>if (serializerClass != null) {<NEW_LINE>properties.putIfAbsent(serializer, serializerClass);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String <MASK><NEW_LINE>if (resolvedClass != null) {<NEW_LINE>String serializerClass = resolveSerializer(resolvedClass);<NEW_LINE>if (serializerClass != null) {<NEW_LINE>properties.putIfAbsent(serializer, serializerClass);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | resolvedClass = JavaClassNameResolver.resolveClassName(format); |
1,136,639 | private void addReference(MInOut inout, int referenceId) {<NEW_LINE>// Valid Reference<NEW_LINE>if (referenceId == 0)<NEW_LINE>return;<NEW_LINE>MOrder order = new MOrder(getCtx(), referenceId, get_TrxName());<NEW_LINE>inout.setC_Order_ID(order.getC_Order_ID());<NEW_LINE>inout.setAD_OrgTrx_ID(order.getAD_OrgTrx_ID());<NEW_LINE>inout.<MASK><NEW_LINE>inout.setC_Campaign_ID(order.getC_Campaign_ID());<NEW_LINE>inout.setC_Activity_ID(order.getC_Activity_ID());<NEW_LINE>inout.setUser1_ID(order.getUser1_ID());<NEW_LINE>inout.setUser2_ID(order.getUser2_ID());<NEW_LINE>inout.setUser3_ID(order.getUser3_ID());<NEW_LINE>inout.setUser4_ID(order.getUser4_ID());<NEW_LINE>// For Drop Ship<NEW_LINE>if (order.isDropShip()) {<NEW_LINE>inout.setM_Warehouse_ID(order.getM_Warehouse_ID());<NEW_LINE>inout.setIsDropShip(order.isDropShip());<NEW_LINE>inout.setDropShip_BPartner_ID(order.getDropShip_BPartner_ID());<NEW_LINE>inout.setDropShip_Location_ID(order.getDropShip_Location_ID());<NEW_LINE>inout.setDropShip_User_ID(order.getDropShip_User_ID());<NEW_LINE>}<NEW_LINE>// Save<NEW_LINE>inout.saveEx();<NEW_LINE>} | setC_Project_ID(order.getC_Project_ID()); |
1,107,710 | private static Pair<GCWebAPI.WebApiSearch, SearchResult> createSearchForFilter(final IConnector connector, @NonNull final GeocacheFilter filter, final int take, final int skip) {<NEW_LINE>final GCWebAPI.WebApiSearch search = new GCWebAPI.WebApiSearch();<NEW_LINE>search.setOrigin(Sensors.getInstance().currentGeo().getCoords());<NEW_LINE>search.setPage(take, skip);<NEW_LINE>// special case: if origin filter is present and excludes GCConnector, then skip search<NEW_LINE>final OriginGeocacheFilter origin = GeocacheFilter.findInChain(filter.<MASK><NEW_LINE>if (origin != null && !origin.allowsCachesOf(connector)) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>for (BaseGeocacheFilter baseFilter : filter.getAndChainIfPossible()) {<NEW_LINE>// special case: search by finder (->not supported by WebAPISearch, fall back to Website parsing search)<NEW_LINE>if (LOG_ENTRY.equals(baseFilter.getType()) && (baseFilter instanceof LogEntryGeocacheFilter) && (!((LogEntryGeocacheFilter) baseFilter).isInverse())) {<NEW_LINE>return new Pair<>(null, searchByFinder(connector, ((LogEntryGeocacheFilter) baseFilter).getFoundByUser(), filter));<NEW_LINE>}<NEW_LINE>fillForBasicFilter(baseFilter, search);<NEW_LINE>}<NEW_LINE>return new Pair<>(search, null);<NEW_LINE>} | getAndChainIfPossible(), OriginGeocacheFilter.class); |
1,027,652 | protected RegionAssociable createRegionAssociable(Cause cause) {<NEW_LINE>Object rootCause = cause.getRootCause();<NEW_LINE>if (!cause.isKnown()) {<NEW_LINE>return Associables.constant(Association.NON_MEMBER);<NEW_LINE>} else if (rootCause instanceof Player) {<NEW_LINE>return getPlugin().wrapPlayer((Player) rootCause);<NEW_LINE>} else if (rootCause instanceof OfflinePlayer) {<NEW_LINE>return getPlugin()<MASK><NEW_LINE>} else if (rootCause instanceof Entity) {<NEW_LINE>RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();<NEW_LINE>final Entity entity = (Entity) rootCause;<NEW_LINE>BukkitWorldConfiguration config = getWorldConfig(entity.getWorld());<NEW_LINE>Location loc;<NEW_LINE>if (PaperLib.isPaper() && config.usePaperEntityOrigin) {<NEW_LINE>loc = entity.getOrigin();<NEW_LINE>if (loc == null) {<NEW_LINE>loc = entity.getLocation();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>loc = entity.getLocation();<NEW_LINE>}<NEW_LINE>return new DelayedRegionOverlapAssociation(query, BukkitAdapter.adapt(loc), config.useMaxPriorityAssociation);<NEW_LINE>} else if (rootCause instanceof Block) {<NEW_LINE>RegionQuery query = WorldGuard.getInstance().getPlatform().getRegionContainer().createQuery();<NEW_LINE>Location loc = ((Block) rootCause).getLocation();<NEW_LINE>return new DelayedRegionOverlapAssociation(query, BukkitAdapter.adapt(loc), getWorldConfig(loc.getWorld()).useMaxPriorityAssociation);<NEW_LINE>} else {<NEW_LINE>return Associables.constant(Association.NON_MEMBER);<NEW_LINE>}<NEW_LINE>} | .wrapOfflinePlayer((OfflinePlayer) rootCause); |
172,280 | final DeleteFunctionResult executeDeleteFunction(DeleteFunctionRequest deleteFunctionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteFunctionRequest);<NEW_LINE><MASK><NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteFunctionRequest> request = null;<NEW_LINE>Response<DeleteFunctionResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteFunctionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteFunctionRequest));<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, "Lambda");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteFunction");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteFunctionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteFunctionResultJsonUnmarshaller());<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 awsRequestMetrics = executionContext.getAwsRequestMetrics(); |
50,269 | public void renderPDF(PDFTarget target, String label, float x, float y, Color color, float outlineSize, Color outlineColor) {<NEW_LINE>PdfContentByte cb = target.getContentByte();<NEW_LINE>cb.setRGBColorFill(color.getRed(), color.getGreen(), color.getBlue());<NEW_LINE>BaseFont bf = target.getBaseFont(font);<NEW_LINE>float textHeight = getTextHeight(bf, font.getSize(), label);<NEW_LINE>if (outlineSize > 0) {<NEW_LINE><MASK><NEW_LINE>cb.setRGBColorStroke(outlineColor.getRed(), outlineColor.getGreen(), outlineColor.getBlue());<NEW_LINE>cb.setLineWidth(outlineSize);<NEW_LINE>cb.setLineJoin(PdfContentByte.LINE_JOIN_ROUND);<NEW_LINE>cb.setLineCap(PdfContentByte.LINE_CAP_ROUND);<NEW_LINE>if (outlineColor.getAlpha() < 255) {<NEW_LINE>cb.saveState();<NEW_LINE>float alpha = outlineColor.getAlpha() / 255f;<NEW_LINE>PdfGState gState = new PdfGState();<NEW_LINE>gState.setStrokeOpacity(alpha);<NEW_LINE>cb.setGState(gState);<NEW_LINE>}<NEW_LINE>cb.beginText();<NEW_LINE>cb.setFontAndSize(bf, font.getSize());<NEW_LINE>cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label, x, -y - (textHeight / 2f), 0f);<NEW_LINE>cb.endText();<NEW_LINE>if (outlineColor.getAlpha() < 255) {<NEW_LINE>cb.restoreState();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);<NEW_LINE>cb.beginText();<NEW_LINE>cb.setFontAndSize(bf, font.getSize());<NEW_LINE>cb.showTextAligned(PdfContentByte.ALIGN_CENTER, label, x, -y - (textHeight / 2f), 0f);<NEW_LINE>cb.endText();<NEW_LINE>} | cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_STROKE); |
673,039 | private Predicate createPredicate(String theResourceName, List<List<IQueryParameterType>> theValues, SearchFilterParser.CompareOperation theOperation, RequestPartitionId theRequestPartitionId) {<NEW_LINE>Predicate nextPredicate = null;<NEW_LINE>Set<ResourcePersistentId> allOrPids = null;<NEW_LINE>for (List<? extends IQueryParameterType> nextValue : theValues) {<NEW_LINE>Set<ResourcePersistentId> orPids = new HashSet<>();<NEW_LINE>boolean haveValue = false;<NEW_LINE>for (IQueryParameterType next : nextValue) {<NEW_LINE>String value = next.getValueAsQueryToken(myContext);<NEW_LINE>if (value != null && value.startsWith("|")) {<NEW_LINE>value = value.substring(1);<NEW_LINE>}<NEW_LINE>IdType valueAsId = new IdType(value);<NEW_LINE>if (isNotBlank(value)) {<NEW_LINE>haveValue = true;<NEW_LINE>try {<NEW_LINE>ResourcePersistentId pid = myIdHelperService.resolveResourcePersistentIds(theRequestPartitionId, <MASK><NEW_LINE>orPids.add(pid);<NEW_LINE>} catch (ResourceNotFoundException e) {<NEW_LINE>// This is not an error in a search, it just results in no matchesFhirResourceDaoR4InterceptorTest<NEW_LINE>ourLog.debug("Resource ID {} was requested but does not exist", valueAsId.getIdPart());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (haveValue) {<NEW_LINE>if (allOrPids == null) {<NEW_LINE>allOrPids = orPids;<NEW_LINE>} else {<NEW_LINE>allOrPids.retainAll(orPids);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (allOrPids != null && allOrPids.isEmpty()) {<NEW_LINE>// This will never match<NEW_LINE>nextPredicate = myCriteriaBuilder.equal(myQueryStack.getResourcePidColumn(), -1);<NEW_LINE>} else if (allOrPids != null) {<NEW_LINE>SearchFilterParser.CompareOperation operation = defaultIfNull(theOperation, SearchFilterParser.CompareOperation.eq);<NEW_LINE>assert operation == SearchFilterParser.CompareOperation.eq || operation == SearchFilterParser.CompareOperation.ne;<NEW_LINE>List<Predicate> codePredicates = new ArrayList<>();<NEW_LINE>switch(operation) {<NEW_LINE>default:<NEW_LINE>case eq:<NEW_LINE>codePredicates.add(myQueryStack.getResourcePidColumn().in(ResourcePersistentId.toLongList(allOrPids)));<NEW_LINE>nextPredicate = myCriteriaBuilder.and(toArray(codePredicates));<NEW_LINE>break;<NEW_LINE>case ne:<NEW_LINE>codePredicates.add(myQueryStack.getResourcePidColumn().in(ResourcePersistentId.toLongList(allOrPids)).not());<NEW_LINE>nextPredicate = myCriteriaBuilder.and(toArray(codePredicates));<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return nextPredicate;<NEW_LINE>} | theResourceName, valueAsId.getIdPart()); |
645,675 | private void createClassIfNotExists() {<NEW_LINE>final ODatabaseDocumentInternal currentDB = ODatabaseRecordThreadLocal.instance().getIfDefined();<NEW_LINE>ODatabaseDocumentInternal sysdb = null;<NEW_LINE>try {<NEW_LINE>sysdb = context.getSystemDatabase().openSystemDatabase();<NEW_LINE>OSchema schema = sysdb.getMetadata().getSchema();<NEW_LINE>OClass cls = schema.getClass(AUDITING_LOG_CLASSNAME);<NEW_LINE>if (cls == null) {<NEW_LINE>cls = sysdb.getMetadata().getSchema().createClass(AUDITING_LOG_CLASSNAME);<NEW_LINE>cls.createProperty("date", OType.DATETIME);<NEW_LINE>cls.createProperty("user", OType.STRING);<NEW_LINE>cls.createProperty("operation", OType.BYTE);<NEW_LINE>cls.createProperty("record", OType.LINK);<NEW_LINE>cls.createProperty("changes", OType.EMBEDDED);<NEW_LINE>cls.createProperty("note", OType.STRING);<NEW_LINE>cls.<MASK><NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>OLogManager.instance().error(this, "Creating auditing class exception", e);<NEW_LINE>} finally {<NEW_LINE>if (sysdb != null)<NEW_LINE>sysdb.close();<NEW_LINE>if (currentDB != null)<NEW_LINE>ODatabaseRecordThreadLocal.instance().set(currentDB);<NEW_LINE>else<NEW_LINE>ODatabaseRecordThreadLocal.instance().remove();<NEW_LINE>}<NEW_LINE>} | createProperty("database", OType.STRING); |
1,558,713 | public HttpClient createClientForHttp2() {<NEW_LINE>ExecutorService executor = executorFactory.getExecutorService("jetty-http2-client", configFactory.getIntProperty(CONSUMER_HTTP2_CLIENT_THREAD_POOL_SIZE), configFactory.getBooleanProperty(CONSUMER_HTTP2_CLIENT_THREAD_POOL_MONITORING));<NEW_LINE>HTTP2Client http2Client = new HTTP2Client();<NEW_LINE>http2Client.setExecutor(executor);<NEW_LINE>HttpClientTransportOverHTTP2 transport = new HttpClientTransportOverHTTP2(http2Client);<NEW_LINE>HttpClient client = sslContextFactoryProvider.provideSslContextFactory().map(sslContextFactory -> new HttpClient(transport, sslContextFactory)).orElseThrow(() -> new IllegalStateException("Cannot create http/2 client due to lack of ssl context factory"));<NEW_LINE>client.setMaxRequestsQueuedPerDestination<MASK><NEW_LINE>client.setCookieStore(new HttpCookieStore.Empty());<NEW_LINE>client.setIdleTimeout(configFactory.getIntProperty(CONSUMER_HTTP2_CLIENT_IDLE_TIMEOUT));<NEW_LINE>client.setFollowRedirects(configFactory.getBooleanProperty(CONSUMER_HTTP_CLIENT_FOLLOW_REDIRECTS));<NEW_LINE>return client;<NEW_LINE>} | (configFactory.getIntProperty(CONSUMER_HTTP2_CLIENT_MAX_REQUESTS_QUEUED_PER_DESTINATION)); |
1,192,050 | private void updateSourceDocument(final boolean isReversalParam) {<NEW_LINE>boolean isReversal = isReversalParam;<NEW_LINE>// Check if this document is reversed/voided<NEW_LINE>String docStatus = getDocStatus();<NEW_LINE>if (!isReversal && (DOCSTATUS_Reversed.equals(docStatus) || DOCSTATUS_Voided.equals(docStatus))) {<NEW_LINE>isReversal = true;<NEW_LINE>}<NEW_LINE>final String sourceType = getA_SourceType();<NEW_LINE>//<NEW_LINE>// Invoice: mark C_InvoiceLine.A_Processed='Y' and set C_InvoiceLine.A_Asset_ID<NEW_LINE>if (A_SOURCETYPE_Invoice.equals(sourceType) && isProcessed()) {<NEW_LINE>int invoiceLineId = getC_InvoiceLine_ID();<NEW_LINE>MInvoiceLine invoiceLine = new MInvoiceLine(getCtx(), invoiceLineId, get_TrxName());<NEW_LINE>invoiceLine.setA_Processed(!isReversal);<NEW_LINE>if (invoiceLine.isCollectiveAsset())<NEW_LINE>invoiceLine.setA_Asset_ID(isReversal ? 0 : getA_Asset_ID());<NEW_LINE>else<NEW_LINE>invoiceLine.setA_Asset_ID(isReversal ? 0 : -1);<NEW_LINE>invoiceLine.saveEx();<NEW_LINE>} else //<NEW_LINE>// Project<NEW_LINE>if (A_SOURCETYPE_Project.equals(sourceType) && isProcessed()) {<NEW_LINE>if (isReversal) {<NEW_LINE>// Project remains closed. We just void/reverse/reactivate the Addition<NEW_LINE>} else {<NEW_LINE>// TODO decide whether to close project first or later<NEW_LINE>int project_id = getC_Project_ID();<NEW_LINE>ProcessInfo pi = new ProcessInfo("", 0, MProject.Table_ID, project_id);<NEW_LINE>pi.setAD_Client_ID(getAD_Client_ID());<NEW_LINE>pi.setAD_User_ID(Env.getAD_User_ID(getCtx()));<NEW_LINE>//<NEW_LINE>ProjectClose proc = new ProjectClose();<NEW_LINE>proc.startProcess(getCtx(), pi, Trx.get(get_TrxName(), false));<NEW_LINE>if (pi.isError()) {<NEW_LINE>throw new AssetException(pi.getSummary());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else //<NEW_LINE>// Import<NEW_LINE>if (A_SOURCETYPE_Imported.equals(sourceType) && !isProcessed()) {<NEW_LINE>if (is_new() && getI_FixedAsset_ID() > 0) {<NEW_LINE>MIFixedAsset ifa = getI_FixedAsset(false);<NEW_LINE>if (ifa != null) {<NEW_LINE>ifa.setI_IsImported(true);<NEW_LINE>ifa.setA_Asset_ID(getA_Asset_ID());<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else //<NEW_LINE>// Manual<NEW_LINE>if (A_SOURCETYPE_Manual.equals(sourceType) && isProcessed()) {<NEW_LINE>// nothing to do<NEW_LINE>log.fine("Nothing to do");<NEW_LINE>}<NEW_LINE>} | ifa.saveEx(get_TrxName()); |
271,891 | private void drawTextWithFont(DocumentData documentData, Font font, Canvas canvas) {<NEW_LINE>Typeface typeface = getTypeface(font);<NEW_LINE>if (typeface == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String text = documentData.text;<NEW_LINE>TextDelegate textDelegate = lottieDrawable.getTextDelegate();<NEW_LINE>if (textDelegate != null) {<NEW_LINE>text = textDelegate.getTextInternal(getName(), text);<NEW_LINE>}<NEW_LINE>fillPaint.setTypeface(typeface);<NEW_LINE>float textSize;<NEW_LINE>if (textSizeCallbackAnimation != null) {<NEW_LINE>textSize = textSizeCallbackAnimation.getValue();<NEW_LINE>} else {<NEW_LINE>textSize = documentData.size;<NEW_LINE>}<NEW_LINE>fillPaint.setTextSize(textSize * Utils.dpScale());<NEW_LINE>strokePaint.setTypeface(fillPaint.getTypeface());<NEW_LINE>strokePaint.setTextSize(fillPaint.getTextSize());<NEW_LINE>// Line height<NEW_LINE>float lineHeight = documentData.lineHeight * Utils.dpScale();<NEW_LINE>// Calculate tracking<NEW_LINE>float tracking = documentData.tracking / 10f;<NEW_LINE>if (trackingCallbackAnimation != null) {<NEW_LINE>tracking += trackingCallbackAnimation.getValue();<NEW_LINE>} else if (trackingAnimation != null) {<NEW_LINE>tracking += trackingAnimation.getValue();<NEW_LINE>}<NEW_LINE>tracking = tracking * Utils.dpScale() * textSize / 100.0f;<NEW_LINE>// Split full text in multiple lines<NEW_LINE>List<String> textLines = getTextLines(text);<NEW_LINE>int textLineCount = textLines.size();<NEW_LINE>for (int l = 0; l < textLineCount; l++) {<NEW_LINE>String textLine = textLines.get(l);<NEW_LINE>// We have to manually add the tracking between characters as the strokePaint ignores it<NEW_LINE>float textLineWidth = strokePaint.measureText(textLine) + (textLine.length() - 1) * tracking;<NEW_LINE>canvas.save();<NEW_LINE>// Apply horizontal justification<NEW_LINE>applyJustification(documentData.justification, canvas, textLineWidth);<NEW_LINE>// Center text vertically<NEW_LINE>float multilineTranslateY = (textLineCount - 1) * lineHeight / 2;<NEW_LINE><MASK><NEW_LINE>canvas.translate(0, translateY);<NEW_LINE>// Draw each line<NEW_LINE>drawFontTextLine(textLine, documentData, canvas, tracking);<NEW_LINE>// Reset canvas<NEW_LINE>canvas.restore();<NEW_LINE>}<NEW_LINE>} | float translateY = l * lineHeight - multilineTranslateY; |
515,321 | public static ListLogConfigsResponse unmarshall(ListLogConfigsResponse listLogConfigsResponse, UnmarshallerContext _ctx) {<NEW_LINE>listLogConfigsResponse.setRequestId(_ctx.stringValue("ListLogConfigsResponse.RequestId"));<NEW_LINE>listLogConfigsResponse.setCode(_ctx.stringValue("ListLogConfigsResponse.Code"));<NEW_LINE>listLogConfigsResponse.setMessage(_ctx.stringValue("ListLogConfigsResponse.Message"));<NEW_LINE>listLogConfigsResponse.setSuccess(_ctx.booleanValue("ListLogConfigsResponse.Success"));<NEW_LINE>listLogConfigsResponse.setErrorCode(_ctx.stringValue("ListLogConfigsResponse.ErrorCode"));<NEW_LINE>listLogConfigsResponse.setTraceId(_ctx.stringValue("ListLogConfigsResponse.TraceId"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setCurrentPage(_ctx.integerValue("ListLogConfigsResponse.Data.CurrentPage"));<NEW_LINE>data.setPageSize<MASK><NEW_LINE>data.setTotalSize(_ctx.integerValue("ListLogConfigsResponse.Data.TotalSize"));<NEW_LINE>List<LogConfig> logConfigs = new ArrayList<LogConfig>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListLogConfigsResponse.Data.LogConfigs.Length"); i++) {<NEW_LINE>LogConfig logConfig = new LogConfig();<NEW_LINE>logConfig.setConfigName(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].ConfigName"));<NEW_LINE>logConfig.setLogDir(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].LogDir"));<NEW_LINE>logConfig.setSlsProject(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].SlsProject"));<NEW_LINE>logConfig.setSlsLogStore(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].SlsLogStore"));<NEW_LINE>logConfig.setStoreType(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].StoreType"));<NEW_LINE>logConfig.setLogType(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].LogType"));<NEW_LINE>logConfig.setRegionId(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].RegionId"));<NEW_LINE>logConfig.setCreateTime(_ctx.stringValue("ListLogConfigsResponse.Data.LogConfigs[" + i + "].CreateTime"));<NEW_LINE>logConfigs.add(logConfig);<NEW_LINE>}<NEW_LINE>data.setLogConfigs(logConfigs);<NEW_LINE>listLogConfigsResponse.setData(data);<NEW_LINE>return listLogConfigsResponse;<NEW_LINE>} | (_ctx.integerValue("ListLogConfigsResponse.Data.PageSize")); |
645,715 | ActionResult<List<Wo>> execute(EffectivePerson effectivePerson, Integer page, Integer size, JsonElement jsonElement) throws Exception {<NEW_LINE>try (EntityManagerContainer emc = EntityManagerContainerFactory.instance().create()) {<NEW_LINE>Business business = new Business(emc);<NEW_LINE>ActionResult<List<Wo>> result = new ActionResult<>();<NEW_LINE>Wi wi = this.convertToWrapIn(jsonElement, Wi.class);<NEW_LINE>if (wi == null) {<NEW_LINE>wi = new Wi();<NEW_LINE>}<NEW_LINE>Integer adjustPage = this.adjustPage(page);<NEW_LINE>Integer <MASK><NEW_LINE>List<Attachment2> os = this.list(effectivePerson, business, adjustPage, adjustPageSize, wi);<NEW_LINE>List<Wo> wos = Wo.copier.copy(os);<NEW_LINE>wos.stream().forEach(wo -> {<NEW_LINE>try {<NEW_LINE>wo.setPath(business.folder2().getSupPath(wo.getFolder()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>logger.error(e);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>result.setData(wos);<NEW_LINE>result.setCount(this.count(effectivePerson, business, wi));<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>} | adjustPageSize = this.adjustSize(size); |
234,346 | public List<List<Vertex<Integer>>> simpleCyles(Graph<Integer> graph) {<NEW_LINE>blockedSet = new HashSet<>();<NEW_LINE>blockedMap = new HashMap<>();<NEW_LINE>stack = new LinkedList<>();<NEW_LINE><MASK><NEW_LINE>long startIndex = 1;<NEW_LINE>TarjanStronglyConnectedComponent tarjan = new TarjanStronglyConnectedComponent();<NEW_LINE>while (startIndex <= graph.getAllVertex().size()) {<NEW_LINE>Graph<Integer> subGraph = createSubGraph(startIndex, graph);<NEW_LINE>List<Set<Vertex<Integer>>> sccs = tarjan.scc(subGraph);<NEW_LINE>// this creates graph consisting of strongly connected components only and then returns the<NEW_LINE>// least indexed vertex among all the strongly connected component graph.<NEW_LINE>// it also ignore one vertex graph since it wont have any cycle.<NEW_LINE>Optional<Vertex<Integer>> maybeLeastVertex = leastIndexSCC(sccs, subGraph);<NEW_LINE>if (maybeLeastVertex.isPresent()) {<NEW_LINE>Vertex<Integer> leastVertex = maybeLeastVertex.get();<NEW_LINE>blockedSet.clear();<NEW_LINE>blockedMap.clear();<NEW_LINE>findCyclesInSCG(leastVertex, leastVertex);<NEW_LINE>startIndex = leastVertex.getId() + 1;<NEW_LINE>} else {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return allCycles;<NEW_LINE>} | allCycles = new ArrayList<>(); |
1,505,240 | void generate() {<NEW_LINE>File output = stubsOutputDir.get().getAsFile();<NEW_LINE>getLogger().info("Stubs output dir [{}]", output);<NEW_LINE>getLogger().info("Spring Cloud Contract Verifier Plugin: Invoking DSL to client stubs conversion");<NEW_LINE>getLogger().info("Contracts dir is [{}] output stubs dir is [{}]", contractsDslDir.get().getAsFile(), output);<NEW_LINE>OutputStream os;<NEW_LINE>if (getLogger().isDebugEnabled()) {<NEW_LINE>os = new ByteArrayOutputStream();<NEW_LINE>} else {<NEW_LINE>os = NullOutputStream.INSTANCE;<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>getProject().javaexec(exec -> {<NEW_LINE>exec.setMain("org.springframework.cloud.contract.verifier.converter.RecursiveFilesConverterApplication");<NEW_LINE>exec.classpath(classpath);<NEW_LINE>exec.args(quoteAndEscape(output.getAbsolutePath()), quoteAndEscape(contractsDslDir.get().getAsFile().getAbsolutePath()), quoteAndEscape(StringUtils.collectionToCommaDelimitedString(excludedFiles.get())), quoteAndEscape(".*"), excludeBuildFolders.get());<NEW_LINE>exec.setStandardOutput(os);<NEW_LINE>exec.setErrorOutput(os);<NEW_LINE>});<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new GradleException("Spring Cloud Contract Verifier Plugin exception: " + e.getMessage(), e);<NEW_LINE>} finally {<NEW_LINE>if (getLogger().isDebugEnabled()) {<NEW_LINE>getLogger().<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | debug(os.toString()); |
930,131 | public static void vertical(GrayF32 input, GrayF32 output, int radius, boolean includeBorder) {<NEW_LINE>final int kernelWidth = radius * 2 + 1;<NEW_LINE>final int startX = includeBorder ? 0 : radius;<NEW_LINE>final int endX = includeBorder ? input.width : input.width - radius;<NEW_LINE>for (int x = startX; x < endX; x++) {<NEW_LINE>int indexIn = input.startIndex + x;<NEW_LINE>int indexOut = output.startIndex + x + radius * output.stride;<NEW_LINE>float total = 0;<NEW_LINE>int indexEnd = indexIn + input.stride * kernelWidth;<NEW_LINE>for (; indexIn < indexEnd; indexIn += input.stride) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>output.data[indexOut] = total;<NEW_LINE>indexOut += output.stride;<NEW_LINE>indexEnd = indexIn + (input.height - kernelWidth) * input.stride;<NEW_LINE>for (; indexIn < indexEnd; indexIn += input.stride, indexOut += output.stride) {<NEW_LINE>total -= input.data[indexIn - kernelWidth];<NEW_LINE>total += input.data[indexIn];<NEW_LINE>output.data[indexOut] = total;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | total += input.data[indexIn]; |
1,326,013 | private void applyFrom(final Map<String, Formula> traceExplorerExpressions, final Hashtable<String, TraceExpressionInformationHolder> traceExpressionDataTable, TLCState nextStateNewTrace, TLCVariable[] currentStateNewTraceVariables, TLCVariable[] nextStateNewTraceVariables) {<NEW_LINE>// iterate through the variables<NEW_LINE>for (int i = 0; i < currentStateNewTraceVariables.length; i++) {<NEW_LINE>// This code assumes that the variables are in the same order in each state<NEW_LINE>String variableName = <MASK><NEW_LINE>// if next state is back to state or stuttering, it has no variables, so the<NEW_LINE>// code<NEW_LINE>// contained within the if block would cause an NPE<NEW_LINE>if (!nextStateNewTrace.isBackToState() && !nextStateNewTrace.isStuttering()) {<NEW_LINE>Assert.isTrue(variableName.equals(nextStateNewTraceVariables[i].getName()), "Variables are not in the same order in each state. This is unexpected.");<NEW_LINE>}<NEW_LINE>// retrieve the object containing the data corresponding to the variable.<NEW_LINE>// this object will be null if the variable currently being looked at does<NEW_LINE>// not represent a trace explorer expression<NEW_LINE>// If the variable does represent a trace explorer expression, then the<NEW_LINE>// following<NEW_LINE>// object will contain the variable name, the expression, and the level of the<NEW_LINE>// expression<NEW_LINE>TraceExpressionInformationHolder traceExpressionData = traceExpressionDataTable.get(variableName.trim());<NEW_LINE>if (traceExpressionData != null) {<NEW_LINE>// we have located a trace expression variable<NEW_LINE>// If next state is back to state or stuttering, it has no variables, so the<NEW_LINE>// code contained within this if block would not apply. It should be unnecessary<NEW_LINE>// to check for this because the while loop should terminate before this<NEW_LINE>// happens.<NEW_LINE>if (!nextStateNewTrace.isBackToState() && !nextStateNewTrace.isStuttering() && traceExpressionData.getLevel() == 2) {<NEW_LINE>// found expression with primed variables<NEW_LINE>// shift the value from the next state to the current state<NEW_LINE>currentStateNewTraceVariables[i].setValue(nextStateNewTraceVariables[i].getValue());<NEW_LINE>}<NEW_LINE>// set the name to be the expression the variable represents<NEW_LINE>currentStateNewTraceVariables[i].setName(traceExpressionData.getExpression());<NEW_LINE>// flag this as a variable representing a trace explorer expression<NEW_LINE>currentStateNewTraceVariables[i].setTraceExplorerVar(true);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>if (traceExplorerExpressions.containsKey(variableName.trim())) {<NEW_LINE>currentStateNewTraceVariables[i].setTraceExplorerVar(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | currentStateNewTraceVariables[i].getName(); |
944,423 | private static void encodeNumeric(ECIInput input, int startpos, int count, StringBuilder sb) {<NEW_LINE>int idx = 0;<NEW_LINE>StringBuilder tmp = new StringBuilder(count / 3 + 1);<NEW_LINE>BigInteger num900 = BigInteger.valueOf(900);<NEW_LINE>BigInteger num0 = BigInteger.valueOf(0);<NEW_LINE>while (idx < count) {<NEW_LINE>tmp.setLength(0);<NEW_LINE>int len = Math.min(44, count - idx);<NEW_LINE>String part = "1" + input.subSequence(startpos + idx, startpos + idx + len);<NEW_LINE>BigInteger bigint = new BigInteger(part);<NEW_LINE>do {<NEW_LINE>tmp.append((char) bigint.mod(num900).intValue());<NEW_LINE>bigint = bigint.divide(num900);<NEW_LINE>} while (<MASK><NEW_LINE>// Reverse temporary string<NEW_LINE>for (int i = tmp.length() - 1; i >= 0; i--) {<NEW_LINE>sb.append(tmp.charAt(i));<NEW_LINE>}<NEW_LINE>idx += len;<NEW_LINE>}<NEW_LINE>} | !bigint.equals(num0)); |
1,615,481 | public static Tuple4<Integer, List<Tuple2<Double, ConfusionMatrix>>, Double, Double> calcOutlierStats(Iterable<Row> rows, String posValueStr) {<NEW_LINE>Tuple4<Integer, boolean[], boolean[], double[]> sampleStats = extractSampleInfo(rows, posValueStr);<NEW_LINE>int n = sampleStats.f0;<NEW_LINE>boolean[] labels = sampleStats.f1;<NEW_LINE>boolean[] predictions = sampleStats.f2;<NEW_LINE>double[] scores = sampleStats.f3;<NEW_LINE>int numPosLabels = 0, numNegLabels = 0;<NEW_LINE>double minPosScore = Double.MAX_VALUE, maxNegScore = Double.MIN_VALUE;<NEW_LINE>for (int k = 0; k < n; k += 1) {<NEW_LINE>if (labels[k]) {<NEW_LINE>numPosLabels += 1;<NEW_LINE>} else {<NEW_LINE>numNegLabels += 1;<NEW_LINE>}<NEW_LINE>if (predictions[k]) {<NEW_LINE>minPosScore = Math.min(minPosScore, scores[k]);<NEW_LINE>} else {<NEW_LINE>maxNegScore = Math.max<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] indices = IntStream.range(0, n).boxed().sorted(Comparator.<Integer, Double>comparing(d -> scores[d]).reversed()).mapToInt(d -> d).toArray();<NEW_LINE>List<Tuple2<Double, ConfusionMatrix>> threshCMs = new ArrayList<>();<NEW_LINE>long tp = 0, fp = 0;<NEW_LINE>for (int k = 0; k < n; k += 1) {<NEW_LINE>int index = indices[k];<NEW_LINE>double thresh = scores[index];<NEW_LINE>boolean label = labels[index];<NEW_LINE>if (label) {<NEW_LINE>tp += 1;<NEW_LINE>} else {<NEW_LINE>fp += 1;<NEW_LINE>}<NEW_LINE>ConfusionMatrix cm = new ConfusionMatrix(new long[][] { { tp, fp }, { numPosLabels - tp, numNegLabels - fp } });<NEW_LINE>threshCMs.add(Tuple2.of(thresh, cm));<NEW_LINE>}<NEW_LINE>return Tuple4.of(n, threshCMs, minPosScore, maxNegScore);<NEW_LINE>} | (maxNegScore, scores[k]); |
1,494,684 | public static void doPaint(Graphics2D g, int width, int height, float arc, boolean symmetric) {<NEW_LINE>float bw = UIUtil.isUnderDefaultMacTheme() ? JBUI.scale(3) : BW.getFloat();<NEW_LINE>float lw = UIUtil.isUnderDefaultMacTheme() ? JBUI.scale(UIUtil.isRetina(g) ? 0.5f : 1.0f) : LW.getFloat();<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);<NEW_LINE>g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, MacUIUtil.USE_QUARTZ ? RenderingHints.VALUE_STROKE_PURE : RenderingHints.VALUE_STROKE_NORMALIZE);<NEW_LINE>float outerArc = arc > 0 ? arc + bw - JBUI.scale(2f) : bw;<NEW_LINE>float rightOuterArc = symmetric ? outerArc : JBUI.scale(6f);<NEW_LINE>Path2D outerRect = new Path2D.Float(Path2D.WIND_EVEN_ODD);<NEW_LINE>outerRect.moveTo(width - rightOuterArc, 0);<NEW_LINE>outerRect.quadTo(width, 0, width, rightOuterArc);<NEW_LINE>outerRect.lineTo(width, height - rightOuterArc);<NEW_LINE>outerRect.quadTo(width, height, width - rightOuterArc, height);<NEW_LINE>outerRect.lineTo(outerArc, height);<NEW_LINE>outerRect.quadTo(0, <MASK><NEW_LINE>outerRect.lineTo(0, outerArc);<NEW_LINE>outerRect.quadTo(0, 0, outerArc, 0);<NEW_LINE>outerRect.closePath();<NEW_LINE>bw += lw;<NEW_LINE>float rightInnerArc = symmetric ? outerArc : JBUI.scale(7f);<NEW_LINE>Path2D innerRect = new Path2D.Float(Path2D.WIND_EVEN_ODD);<NEW_LINE>innerRect.moveTo(width - rightInnerArc, bw);<NEW_LINE>innerRect.quadTo(width - bw, bw, width - bw, rightInnerArc);<NEW_LINE>innerRect.lineTo(width - bw, height - rightInnerArc);<NEW_LINE>innerRect.quadTo(width - bw, height - bw, width - rightInnerArc, height - bw);<NEW_LINE>innerRect.lineTo(outerArc, height - bw);<NEW_LINE>innerRect.quadTo(bw, height - bw, bw, height - outerArc);<NEW_LINE>innerRect.lineTo(bw, outerArc);<NEW_LINE>innerRect.quadTo(bw, bw, outerArc, bw);<NEW_LINE>innerRect.closePath();<NEW_LINE>Path2D path = new Path2D.Float(Path2D.WIND_EVEN_ODD);<NEW_LINE>path.append(outerRect, false);<NEW_LINE>path.append(innerRect, false);<NEW_LINE>g.fill(path);<NEW_LINE>} | height, 0, height - outerArc); |
905,029 | private Component components() {<NEW_LINE>VerticalLayout layout = VerticalLayout.create();<NEW_LINE>FileChooserTextBoxBuilder builder = FileChooserTextBoxBuilder.create(null);<NEW_LINE>layout.add(builder.build());<NEW_LINE>ToggleSwitch toggleSwitch = ToggleSwitch.create(true);<NEW_LINE>toggleSwitch.addValueListener(event -> Alerts.okInfo(LocalizeValue.of("toggle")).showAsync());<NEW_LINE>CheckBox checkBox = CheckBox.create(LocalizeValue.of("Check box"));<NEW_LINE>checkBox.addValueListener(event -> Alerts.okInfo(LocalizeValue.of("checkBox")).showAsync());<NEW_LINE>layout.add(AdvancedLabel.create().updatePresentation(presentation -> {<NEW_LINE>presentation.append(LocalizeValue.of("Advanced "), TextAttribute.REGULAR_BOLD);<NEW_LINE>presentation.append(LocalizeValue.of("Label"), new TextAttribute(Font.STYLE_PLAIN, StandardColors.RED, StandardColors.BLACK));<NEW_LINE>}));<NEW_LINE>layout.add(HorizontalLayout.create().add(Label.create(LocalizeValue.of("Toggle Switch"))).add(toggleSwitch).add(checkBox));<NEW_LINE>layout.add(HorizontalLayout.create().add(Label.create(LocalizeValue.of("Password"))).add(PasswordBox.create()));<NEW_LINE>IntSlider <MASK><NEW_LINE>intSlider.addValueListener(event -> Alerts.okInfo(LocalizeValue.of("intSlider " + event.getValue())).showAsync());<NEW_LINE>layout.add(HorizontalLayout.create().add(Label.create(LocalizeValue.of("IntSlider"))).add(intSlider));<NEW_LINE>layout.add(Hyperlink.create("Some Link", (e) -> Alerts.okInfo(LocalizeValue.of("Clicked!!!")).showAsync()));<NEW_LINE>HtmlView component = HtmlView.create();<NEW_LINE>component.withValue("<html><body><b>Some Bold Text</b> Test</body></html>");<NEW_LINE>layout.add(component);<NEW_LINE>return layout;<NEW_LINE>} | intSlider = IntSlider.create(3); |
398,772 | protected void initContentBuffer(XMLStringBuffer suiteBuffer) {<NEW_LINE>Properties testAttrs = new Properties();<NEW_LINE>testAttrs.setProperty("name", m_className);<NEW_LINE>testAttrs.setProperty("verbose", String.valueOf(m_logLevel));<NEW_LINE><MASK><NEW_LINE>suiteBuffer.push("classes");<NEW_LINE>Properties classAttrs = new Properties();<NEW_LINE>classAttrs.setProperty("name", m_className);<NEW_LINE>if ((null != m_methodNames) && (m_methodNames.size() > 0)) {<NEW_LINE>suiteBuffer.push("class", classAttrs);<NEW_LINE>suiteBuffer.push("methods");<NEW_LINE>for (Object methodName : m_methodNames) {<NEW_LINE>Properties methodAttrs = new Properties();<NEW_LINE>methodAttrs.setProperty("name", (String) methodName);<NEW_LINE>suiteBuffer.addEmptyElement("include", methodAttrs);<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("methods");<NEW_LINE>suiteBuffer.pop("class");<NEW_LINE>} else {<NEW_LINE>suiteBuffer.addEmptyElement("class", classAttrs);<NEW_LINE>}<NEW_LINE>suiteBuffer.pop("classes");<NEW_LINE>suiteBuffer.pop("test");<NEW_LINE>} | suiteBuffer.push("test", testAttrs); |
1,403,721 | public Request<DescribeInstanceStorageConfigRequest> marshall(DescribeInstanceStorageConfigRequest describeInstanceStorageConfigRequest) {<NEW_LINE>if (describeInstanceStorageConfigRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(DescribeInstanceStorageConfigRequest)");<NEW_LINE>}<NEW_LINE>Request<DescribeInstanceStorageConfigRequest> request = new DefaultRequest<DescribeInstanceStorageConfigRequest>(describeInstanceStorageConfigRequest, "AmazonConnect");<NEW_LINE>request.setHttpMethod(HttpMethodName.GET);<NEW_LINE>String uriResourcePath = "/instance/{InstanceId}/storage-config/{AssociationId}";<NEW_LINE>uriResourcePath = uriResourcePath.replace("{InstanceId}", (describeInstanceStorageConfigRequest.getInstanceId() == null) ? "" : StringUtils.fromString<MASK><NEW_LINE>uriResourcePath = uriResourcePath.replace("{AssociationId}", (describeInstanceStorageConfigRequest.getAssociationId() == null) ? "" : StringUtils.fromString(describeInstanceStorageConfigRequest.getAssociationId()));<NEW_LINE>if (describeInstanceStorageConfigRequest.getResourceType() != null) {<NEW_LINE>request.addParameter("resourceType", StringUtils.fromString(describeInstanceStorageConfigRequest.getResourceType()));<NEW_LINE>}<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>if (!request.getHeaders().containsKey("Content-Type")) {<NEW_LINE>request.addHeader("Content-Type", "application/x-amz-json-1.1");<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | (describeInstanceStorageConfigRequest.getInstanceId())); |
765,296 | private static TokenKind exec(StarlarkThread.Frame fr, Statement st) throws EvalException, InterruptedException {<NEW_LINE>if (fr.dbg != null) {<NEW_LINE>// not very precise<NEW_LINE>Location loc = st.getStartLocation();<NEW_LINE>fr.setLocation(loc);<NEW_LINE>// location is now redundant since it's in the thread<NEW_LINE>fr.dbg.before(fr.thread, loc);<NEW_LINE>}<NEW_LINE>if (++fr.thread.steps >= fr.thread.stepLimit) {<NEW_LINE>throw new EvalException("Starlark computation cancelled: too many steps");<NEW_LINE>}<NEW_LINE>switch(st.kind()) {<NEW_LINE>case ASSIGNMENT:<NEW_LINE>execAssignment(fr, (AssignmentStatement) st);<NEW_LINE>return TokenKind.PASS;<NEW_LINE>case EXPRESSION:<NEW_LINE>eval(fr, ((ExpressionStatement) st).getExpression());<NEW_LINE>return TokenKind.PASS;<NEW_LINE>case FLOW:<NEW_LINE>return ((FlowStatement) st).getKind();<NEW_LINE>case FOR:<NEW_LINE>return execFor(fr, (ForStatement) st);<NEW_LINE>case DEF:<NEW_LINE>DefStatement def = (DefStatement) st;<NEW_LINE>StarlarkFunction fn = newFunction(fr, def.getResolvedFunction());<NEW_LINE>assignIdentifier(fr, def.getIdentifier(), fn);<NEW_LINE>return TokenKind.PASS;<NEW_LINE>case IF:<NEW_LINE>return execIf<MASK><NEW_LINE>case LOAD:<NEW_LINE>execLoad(fr, (LoadStatement) st);<NEW_LINE>return TokenKind.PASS;<NEW_LINE>case RETURN:<NEW_LINE>return execReturn(fr, (ReturnStatement) st);<NEW_LINE>}<NEW_LINE>throw new IllegalArgumentException("unexpected statement: " + st.kind());<NEW_LINE>} | (fr, (IfStatement) st); |
1,793,827 | protected void initialize(Application app) {<NEW_LINE>this.backGroundColor = app.getViewPort().getBackgroundColor().clone();<NEW_LINE>final Camera[<MASK><NEW_LINE>final Texture2D[] textures = new Texture2D[6];<NEW_LINE>viewports = new ViewPort[6];<NEW_LINE>framebuffers = new FrameBuffer[6];<NEW_LINE>buffers = new ByteBuffer[6];<NEW_LINE>images = new Image[6];<NEW_LINE>for (int i = 0; i < 6; i++) {<NEW_LINE>cameras[i] = createOffCamera(size, position, axisX[i], axisY[i], axisZ[i]);<NEW_LINE>viewports[i] = createOffViewPort("EnvView" + i, cameras[i]);<NEW_LINE>framebuffers[i] = createOffScreenFrameBuffer(size, viewports[i]);<NEW_LINE>textures[i] = new Texture2D(size, size, imageFormat);<NEW_LINE>framebuffers[i].setColorTexture(textures[i]);<NEW_LINE>}<NEW_LINE>} | ] cameras = new Camera[6]; |
1,720,626 | final DeleteAttachmentResult executeDeleteAttachment(DeleteAttachmentRequest deleteAttachmentRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(deleteAttachmentRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DeleteAttachmentRequest> request = null;<NEW_LINE>Response<DeleteAttachmentResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DeleteAttachmentRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(deleteAttachmentRequest));<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, "NetworkManager");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DeleteAttachment");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DeleteAttachmentResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DeleteAttachmentResultJsonUnmarshaller());<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,661,719 | private void createSubjectAndPushItOnThreadAsNeeded(HttpServletRequest req, HttpServletResponse res) {<NEW_LINE>// We got a new instance of FormLogoutExtensionProcess every request.<NEW_LINE>logoutSubject = null;<NEW_LINE><MASK><NEW_LINE>if (subject == null || subjectHelper.isUnauthenticated(subject)) {<NEW_LINE>if (authService == null && securityServiceRef != null) {<NEW_LINE>authService = securityServiceRef.getService().getAuthenticationService();<NEW_LINE>}<NEW_LINE>SSOAuthenticator ssoAuthenticator = new SSOAuthenticator(authService, null, null, ssoCookieHelper, ssoAuthFilterRef);<NEW_LINE>// TODO: We can not call ssoAuthenticator.authenticate because it can not handle multiple tokens.<NEW_LINE>// In the next release, authenticate need to handle multiple authentication data. See story<NEW_LINE>AuthenticationResult authResult = ssoAuthenticator.handleSSO(req, res);<NEW_LINE>if (authResult != null && authResult.getStatus() == AuthResult.SUCCESS) {<NEW_LINE>subjectManager.setCallerSubject(authResult.getSubject());<NEW_LINE>logoutSubject = authResult.getSubject();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | Subject subject = subjectManager.getCallerSubject(); |
1,106,565 | final GetDiskSnapshotsResult executeGetDiskSnapshots(GetDiskSnapshotsRequest getDiskSnapshotsRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDiskSnapshotsRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<GetDiskSnapshotsRequest> request = null;<NEW_LINE>Response<GetDiskSnapshotsResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDiskSnapshotsRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDiskSnapshotsRequest));<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, "Lightsail");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDiskSnapshots");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDiskSnapshotsResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDiskSnapshotsResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.ClientExecuteTime); |
1,391,707 | final GetDeleteEventsByEventTypeStatusResult executeGetDeleteEventsByEventTypeStatus(GetDeleteEventsByEventTypeStatusRequest getDeleteEventsByEventTypeStatusRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDeleteEventsByEventTypeStatusRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetDeleteEventsByEventTypeStatusRequest> request = null;<NEW_LINE>Response<GetDeleteEventsByEventTypeStatusResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new GetDeleteEventsByEventTypeStatusRequestProtocolMarshaller(protocolFactory).marshall<MASK><NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>request.addHandlerContext(HandlerContextKey.CLIENT_ENDPOINT, endpoint);<NEW_LINE>request.addHandlerContext(HandlerContextKey.ENDPOINT_OVERRIDDEN, isEndpointOverridden());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SIGNING_REGION, getSigningRegion());<NEW_LINE>request.addHandlerContext(HandlerContextKey.SERVICE_ID, "FraudDetector");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDeleteEventsByEventTypeStatus");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDeleteEventsByEventTypeStatusResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDeleteEventsByEventTypeStatusResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | (super.beforeMarshalling(getDeleteEventsByEventTypeStatusRequest)); |
1,047,236 | // ModelNode<NEW_LINE>static Object createDeploymentPathAddressAsModelNode(WildflyDeploymentFactory.WildFlyClassLoader cl, String name) throws ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException {<NEW_LINE>// NOI18N<NEW_LINE>Class <MASK><NEW_LINE>// NOI18N<NEW_LINE>Class peClazz = cl.loadClass("org.jboss.as.controller.PathElement");<NEW_LINE>// NOI18N<NEW_LINE>Method // NOI18N<NEW_LINE>peFactory = // NOI18N<NEW_LINE>peClazz.// NOI18N<NEW_LINE>getDeclaredMethod("pathElement", name != null ? new Class[] { String.class, String.class } : new Class[] { String.class });<NEW_LINE>Object pe = // NOI18N<NEW_LINE>peFactory.// NOI18N<NEW_LINE>invoke(// NOI18N<NEW_LINE>null, name != null ? new Object[] { DEPLOYMENT, name } : new Object[] { DEPLOYMENT });<NEW_LINE>Object array = Array.newInstance(peClazz, 1);<NEW_LINE>Array.set(array, 0, pe);<NEW_LINE>// NOI18N<NEW_LINE>Method paFactory = paClazz.getDeclaredMethod("pathAddress", array.getClass());<NEW_LINE>Object pa = paFactory.invoke(null, array);<NEW_LINE>// NOI18N<NEW_LINE>Method toModelNode = pa.getClass().getMethod("toModelNode", (Class<?>[]) null);<NEW_LINE>return toModelNode.invoke(pa, (Object[]) null);<NEW_LINE>} | paClazz = cl.loadClass("org.jboss.as.controller.PathAddress"); |
52,446 | private static void responseCompleteMetaData(PreparedStatement pstmt, FrontendConnection c) {<NEW_LINE>byte packetId = 0;<NEW_LINE>// write preparedOk packet<NEW_LINE>PreparedOkPacket preparedOk = new PreparedOkPacket();<NEW_LINE>preparedOk.packetId = ++packetId;<NEW_LINE>preparedOk.statementId = pstmt.getId();<NEW_LINE>preparedOk.columnsNumber = pstmt.getColumnsNumber();<NEW_LINE>preparedOk.parametersNumber = pstmt.getParametersNumber();<NEW_LINE>ByteBuffer buffer = preparedOk.write(c.allocate(), c, true);<NEW_LINE>// write parameter field packet<NEW_LINE>int parametersNumber = pstmt.getParametersNumber();<NEW_LINE>if (parametersNumber > 0) {<NEW_LINE>for (FieldPacket param : pstmt.getParams()) {<NEW_LINE>param.packetId = ++packetId;<NEW_LINE>buffer = param.<MASK><NEW_LINE>}<NEW_LINE>EOFPacket eof = new EOFPacket();<NEW_LINE>eof.packetId = ++packetId;<NEW_LINE>buffer = eof.write(buffer, c, true);<NEW_LINE>}<NEW_LINE>// write column field packet<NEW_LINE>int columnsNumber = pstmt.getColumnsNumber();<NEW_LINE>if (columnsNumber > 0) {<NEW_LINE>for (FieldPacket field : pstmt.getFields()) {<NEW_LINE>field.packetId = ++packetId;<NEW_LINE>buffer = field.write(buffer, c, true);<NEW_LINE>}<NEW_LINE>EOFPacket eof = new EOFPacket();<NEW_LINE>eof.packetId = ++packetId;<NEW_LINE>buffer = eof.write(buffer, c, true);<NEW_LINE>}<NEW_LINE>// send buffer<NEW_LINE>c.write(buffer);<NEW_LINE>} | write(buffer, c, true); |
1,461,213 | void buildFunctionType() {<NEW_LINE>Scope t = BaseFunction.getTable();<NEW_LINE>for (String s : list("func_doc", "__doc__", "func_name", "__name__", "__module__")) {<NEW_LINE>t.update(s, new NUrl(DATAMODEL_URL), BaseStr, ATTRIBUTE);<NEW_LINE>}<NEW_LINE>NBinding b = synthetic(t, "func_closure", new NUrl(DATAMODEL_URL), newTuple(), ATTRIBUTE);<NEW_LINE>b.markReadOnly();<NEW_LINE>synthetic(t, "func_code", new NUrl(DATAMODEL_URL<MASK><NEW_LINE>synthetic(t, "func_defaults", new NUrl(DATAMODEL_URL), newTuple(), ATTRIBUTE);<NEW_LINE>synthetic(t, "func_globals", new NUrl(DATAMODEL_URL), new NDictType(BaseStr, new NUnknownType()), ATTRIBUTE);<NEW_LINE>synthetic(t, "func_dict", new NUrl(DATAMODEL_URL), new NDictType(BaseStr, new NUnknownType()), ATTRIBUTE);<NEW_LINE>// Assume any function can become a method, for simplicity.<NEW_LINE>for (String s : list("__func__", "im_func")) {<NEW_LINE>synthetic(t, s, new NUrl(DATAMODEL_URL), new NFuncType(), METHOD);<NEW_LINE>}<NEW_LINE>} | ), unknown(), ATTRIBUTE); |
1,594,245 | public static ListIsolationRulesOfAppResponse unmarshall(ListIsolationRulesOfAppResponse listIsolationRulesOfAppResponse, UnmarshallerContext _ctx) {<NEW_LINE>listIsolationRulesOfAppResponse.setRequestId(_ctx.stringValue("ListIsolationRulesOfAppResponse.RequestId"));<NEW_LINE>listIsolationRulesOfAppResponse.setCode(_ctx.stringValue("ListIsolationRulesOfAppResponse.Code"));<NEW_LINE>listIsolationRulesOfAppResponse.setMessage(_ctx.stringValue("ListIsolationRulesOfAppResponse.Message"));<NEW_LINE>listIsolationRulesOfAppResponse.setSuccess(_ctx.booleanValue("ListIsolationRulesOfAppResponse.Success"));<NEW_LINE>Data data = new Data();<NEW_LINE>data.setPageIndex(_ctx.integerValue("ListIsolationRulesOfAppResponse.Data.PageIndex"));<NEW_LINE>data.setPageSize(_ctx.integerValue("ListIsolationRulesOfAppResponse.Data.PageSize"));<NEW_LINE>data.setTotalCount(_ctx.integerValue("ListIsolationRulesOfAppResponse.Data.TotalCount"));<NEW_LINE>data.setTotalPage(_ctx.integerValue("ListIsolationRulesOfAppResponse.Data.TotalPage"));<NEW_LINE>List<DatasItem> datas = new ArrayList<DatasItem>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("ListIsolationRulesOfAppResponse.Data.Datas.Length"); i++) {<NEW_LINE>DatasItem datasItem = new DatasItem();<NEW_LINE>datasItem.setAppName(_ctx.stringValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].AppName"));<NEW_LINE>datasItem.setThreshold(_ctx.floatValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].Threshold"));<NEW_LINE>datasItem.setEnable(_ctx.booleanValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].Enable"));<NEW_LINE>datasItem.setLimitOrigin(_ctx.stringValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].LimitOrigin"));<NEW_LINE>datasItem.setNamespace(_ctx.stringValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].Namespace"));<NEW_LINE>datasItem.setRefResource(_ctx.stringValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].RefResource"));<NEW_LINE>datasItem.setRelationStrategy(_ctx.integerValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].RelationStrategy"));<NEW_LINE>datasItem.setResource(_ctx.stringValue<MASK><NEW_LINE>datasItem.setRuleId(_ctx.longValue("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].RuleId"));<NEW_LINE>datas.add(datasItem);<NEW_LINE>}<NEW_LINE>data.setDatas(datas);<NEW_LINE>listIsolationRulesOfAppResponse.setData(data);<NEW_LINE>return listIsolationRulesOfAppResponse;<NEW_LINE>} | ("ListIsolationRulesOfAppResponse.Data.Datas[" + i + "].Resource")); |
1,557,693 | public DeploymentCommand unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>DeploymentCommand deploymentCommand = new DeploymentCommand();<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("Name", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentCommand.setName(context.getUnmarshaller(String.<MASK><NEW_LINE>}<NEW_LINE>if (context.testExpression("Args", targetDepth)) {<NEW_LINE>context.nextToken();<NEW_LINE>deploymentCommand.setArgs(new MapUnmarshaller<String, java.util.List<String>>(context.getUnmarshaller(String.class), new ListUnmarshaller<String>(context.getUnmarshaller(String.class))).unmarshall(context));<NEW_LINE>}<NEW_LINE>} else if (token == END_ARRAY || token == END_OBJECT) {<NEW_LINE>if (context.getLastParsedParentElement() == null || context.getLastParsedParentElement().equals(currentParentElement)) {<NEW_LINE>if (context.getCurrentDepth() <= originalDepth)<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>token = context.nextToken();<NEW_LINE>}<NEW_LINE>return deploymentCommand;<NEW_LINE>} | class).unmarshall(context)); |
984,103 | protected List<TestSuite> createDerivedSuites(FeatureSpecificTestSuiteBuilder<?, ? extends OneSizeTestContainerGenerator<Collection<E>, E>> parentBuilder) {<NEW_LINE>List<TestSuite> derivedSuites = new ArrayList<>(super.createDerivedSuites(parentBuilder));<NEW_LINE>derivedSuites<MASK><NEW_LINE>if (!parentBuilder.getFeatures().contains(NoRecurse.NO_ENTRY_SET)) {<NEW_LINE>derivedSuites.add(SetTestSuiteBuilder.using(new EntrySetGenerator<E>(parentBuilder.getSubjectGenerator())).named(getName() + ".entrySet").withFeatures(computeEntrySetFeatures(parentBuilder.getFeatures())).suppressing(parentBuilder.getSuppressedTests()).withSetUp(parentBuilder.getSetUp()).withTearDown(parentBuilder.getTearDown()).createTestSuite());<NEW_LINE>}<NEW_LINE>if (parentBuilder.getFeatures().contains(CollectionFeature.SERIALIZABLE)) {<NEW_LINE>derivedSuites.add(MultisetTestSuiteBuilder.using(new ReserializedMultisetGenerator<E>(parentBuilder.getSubjectGenerator())).named(getName() + " reserialized").withFeatures(computeReserializedMultisetFeatures(parentBuilder.getFeatures())).suppressing(parentBuilder.getSuppressedTests()).withSetUp(parentBuilder.getSetUp()).withTearDown(parentBuilder.getTearDown()).createTestSuite());<NEW_LINE>}<NEW_LINE>return derivedSuites;<NEW_LINE>} | .add(createElementSetTestSuite(parentBuilder)); |
1,242,292 | private void initiateShutdown() {<NEW_LINE>assert (_state == StateClosing && _dispatchCount == 0);<NEW_LINE>if (_shutdownInitiated) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>_shutdownInitiated = true;<NEW_LINE>if (!_endpoint.datagram()) {<NEW_LINE>//<NEW_LINE>// Before we shut down, we send a close connection message.<NEW_LINE>//<NEW_LINE>OutputStream os = new OutputStream(_instance, IceInternal.Protocol.currentProtocolEncoding);<NEW_LINE>os.<MASK><NEW_LINE>IceInternal.Protocol.currentProtocol.ice_writeMembers(os);<NEW_LINE>IceInternal.Protocol.currentProtocolEncoding.ice_writeMembers(os);<NEW_LINE>os.writeByte(IceInternal.Protocol.closeConnectionMsg);<NEW_LINE>// compression status: always report 0 for<NEW_LINE>os.writeByte((byte) 0);<NEW_LINE>// CloseConnection in Java.<NEW_LINE>// Message size.<NEW_LINE>os.writeInt(IceInternal.Protocol.headerSize);<NEW_LINE>if ((sendMessage(new OutgoingMessage(os, false, false)) & IceInternal.AsyncStatus.Sent) > 0) {<NEW_LINE>setState(StateClosingPending);<NEW_LINE>//<NEW_LINE>// Notify the the transceiver of the graceful connection closure.<NEW_LINE>//<NEW_LINE>int op = _transceiver.closing(true, _exception);<NEW_LINE>if (op != 0) {<NEW_LINE>scheduleTimeout(op);<NEW_LINE>_threadPool.register(this, op);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | writeBlob(IceInternal.Protocol.magic); |
1,591,034 | private void jbInit() {<NEW_LINE>dateFrom = new VDate("DateFrom", true, false, true, DisplayType.Date, "DateFrom");<NEW_LINE>dateTo = new VDate("DateTo", true, false, true, DisplayType.Date, "DateTo");<NEW_LINE>CPanel northPanel = new CPanel();<NEW_LINE>northPanel.setLayout(new java.awt.GridBagLayout());<NEW_LINE>northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "S_Resource_ID")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>northPanel.add(resource, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateFrom")), new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>northPanel.add(dateFrom, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>northPanel.add(new CLabel(Msg.translate(Env.getCtx(), "DateTo")), new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>northPanel.add(dateTo, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));<NEW_LINE>ConfirmPanel confirmPanel = new ConfirmPanel(true);<NEW_LINE>confirmPanel.addActionListener(new ActionHandler());<NEW_LINE>contentPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);<NEW_LINE>contentPanel.setPreferredSize(new Dimension(800, 600));<NEW_LINE>m_form.getWindow().getContentPane().add(northPanel, BorderLayout.NORTH);<NEW_LINE>m_form.getWindow().getContentPane().<MASK><NEW_LINE>m_form.getWindow().getContentPane().add(confirmPanel, BorderLayout.SOUTH);<NEW_LINE>} | add(contentPanel, BorderLayout.CENTER); |
786,237 | public void run() {<NEW_LINE>org.apache.maven.shared.dependency.tree.DependencyNode rootnode = DependencyTreeFactory.createDependencyTree(data.getMavenProject(), EmbedderFactory.getOnlineEmbedder(), Artifact.SCOPE_TEST);<NEW_LINE>DependencyExcludeNodeVisitor nv = new DependencyExcludeNodeVisitor(data.art.getGroupId(), data.art.getArtifactId(), data.art.getType());<NEW_LINE>rootnode.accept(nv);<NEW_LINE>final Set<org.apache.maven.shared.dependency.tree.DependencyNode> nds = nv.getDirectDependencies();<NEW_LINE>Collection<org.apache.maven.shared.dependency.tree.DependencyNode> directs;<NEW_LINE>if (nds.size() > 1) {<NEW_LINE>final ExcludeDependencyPanel pnl = new ExcludeDependencyPanel(data.getMavenProject(), data.art, nds, rootnode);<NEW_LINE>DialogDescriptor dd = new DialogDescriptor(pnl, TIT_Exclude());<NEW_LINE>Object ret = DialogDisplayer.<MASK><NEW_LINE>if (ret == DialogDescriptor.OK_OPTION) {<NEW_LINE>directs = pnl.getDependencyExcludes().get(data.art);<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>directs = nds;<NEW_LINE>}<NEW_LINE>runModifyExclusions(data.art, directs);<NEW_LINE>} | getDefault().notify(dd); |
1,305,240 | private void fetchInAppPurchase(@NonNull InAppPurchase inAppPurchase, @NonNull ProductInfo productInfo, @Nullable InAppPurchaseData purchaseData) {<NEW_LINE>if (purchaseData != null) {<NEW_LINE>inAppPurchase.setPurchaseState(InAppPurchase.PurchaseState.PURCHASED);<NEW_LINE>inAppPurchase.setPurchaseInfo(ctx, getPurchaseInfo(purchaseData));<NEW_LINE>} else {<NEW_LINE>inAppPurchase.setPurchaseState(InAppPurchase.PurchaseState.NOT_PURCHASED);<NEW_LINE>inAppPurchase.restorePurchaseInfo(ctx);<NEW_LINE>}<NEW_LINE>inAppPurchase.setPrice(productInfo.getPrice());<NEW_LINE>inAppPurchase.setPriceCurrencyCode(productInfo.getCurrency());<NEW_LINE>if (productInfo.getMicrosPrice() > 0) {<NEW_LINE>inAppPurchase.setPriceValue(productInfo.getMicrosPrice() / 1000000d);<NEW_LINE>}<NEW_LINE>String subscriptionPeriod = productInfo.getSubPeriod();<NEW_LINE>if (!Algorithms.isEmpty(subscriptionPeriod)) {<NEW_LINE>if (inAppPurchase instanceof InAppSubscription) {<NEW_LINE>try {<NEW_LINE>((InAppSubscription) inAppPurchase).setSubscriptionPeriodString(subscriptionPeriod);<NEW_LINE>} catch (ParseException e) {<NEW_LINE>LOG.error(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (inAppPurchase instanceof InAppSubscription) {<NEW_LINE>String introductoryPrice = productInfo.getSubSpecialPrice();<NEW_LINE>String introductoryPricePeriod = productInfo.getSubPeriod();<NEW_LINE>int introductoryPriceCycles = productInfo.getSubSpecialPeriodCycles();<NEW_LINE><MASK><NEW_LINE>if (!Algorithms.isEmpty(introductoryPrice)) {<NEW_LINE>InAppSubscription s = (InAppSubscription) inAppPurchase;<NEW_LINE>try {<NEW_LINE>s.setIntroductoryInfo(new InAppSubscriptionIntroductoryInfo(s, introductoryPrice, introductoryPriceAmountMicros, introductoryPricePeriod, introductoryPriceCycles));<NEW_LINE>} catch (ParseException e) {<NEW_LINE>LOG.error(e);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | long introductoryPriceAmountMicros = productInfo.getSubSpecialPriceMicros(); |
1,627,658 | public List<ValidateError> validate() {<NEW_LINE>List<ValidateError> errors = new ArrayList<>();<NEW_LINE>Validator validator;<NEW_LINE>ValidateError error;<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.REQUIRED);<NEW_LINE>error = validator.validate(this.knowledgeId, convLabelName("Knowledge Id"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.REQUIRED);<NEW_LINE>error = validator.validate(this.viewDateTime, convLabelName("View Date Time"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(this.insertUser, convLabelName("Insert User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = <MASK><NEW_LINE>error = validator.validate(this.updateUser, convLabelName("Update User"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>validator = ValidatorFactory.getInstance(Validator.INTEGER);<NEW_LINE>error = validator.validate(this.deleteFlag, convLabelName("Delete Flag"));<NEW_LINE>if (error != null) {<NEW_LINE>errors.add(error);<NEW_LINE>}<NEW_LINE>return errors;<NEW_LINE>} | ValidatorFactory.getInstance(Validator.INTEGER); |
1,107,618 | protected void processSubElement(XMLEventReader xmlEventReader, ArtifactResponseType target, SAMLProtocolQNames element, StartElement elementDetail) throws ParsingException {<NEW_LINE>switch(element) {<NEW_LINE>case ISSUER:<NEW_LINE>target.setIssuer(SAMLParserUtil.parseNameIDType(xmlEventReader));<NEW_LINE>break;<NEW_LINE>case SIGNATURE:<NEW_LINE>Element sig = StaxParserUtil.getDOMElement(xmlEventReader);<NEW_LINE>target.setSignature(sig);<NEW_LINE>break;<NEW_LINE>case EXTENSIONS:<NEW_LINE>SAMLExtensionsParser extensionsParser = SAMLExtensionsParser.getInstance();<NEW_LINE>target.setExtensions<MASK><NEW_LINE>break;<NEW_LINE>case AUTHN_REQUEST:<NEW_LINE>SAMLAuthNRequestParser authnParser = SAMLAuthNRequestParser.getInstance();<NEW_LINE>target.setAny(authnParser.parse(xmlEventReader));<NEW_LINE>break;<NEW_LINE>case RESPONSE:<NEW_LINE>SAMLResponseParser responseParser = SAMLResponseParser.getInstance();<NEW_LINE>target.setAny(responseParser.parse(xmlEventReader));<NEW_LINE>break;<NEW_LINE>case STATUS:<NEW_LINE>target.setStatus(SAMLStatusParser.getInstance().parse(xmlEventReader));<NEW_LINE>break;<NEW_LINE>case LOGOUT_REQUEST:<NEW_LINE>SAMLSloRequestParser sloRequestParser = SAMLSloRequestParser.getInstance();<NEW_LINE>target.setAny(sloRequestParser.parse(xmlEventReader));<NEW_LINE>break;<NEW_LINE>case LOGOUT_RESPONSE:<NEW_LINE>SAMLSloResponseParser sloResponseParser = SAMLSloResponseParser.getInstance();<NEW_LINE>target.setAny(sloResponseParser.parse(xmlEventReader));<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw LOGGER.parserUnknownTag(StaxParserUtil.getElementName(elementDetail), elementDetail.getLocation());<NEW_LINE>}<NEW_LINE>} | (extensionsParser.parse(xmlEventReader)); |
1,181,151 | protected void summary(BufferedWriter out) throws IOException {<NEW_LINE>String[] Archs = { "Unknown", "x86", "S390", "Power", <MASK><NEW_LINE>String[] SubTypes = { "i486", "i586", "Pentium II", "Pentium III", "Merced", "McKinley", "PowerRS", "PowerPC", "GigaProcessor", "ESA", "Pentium IV", "T-Rex", "Opteron", "RV64G" };<NEW_LINE>String[] trCounter = { "Sequence Counter", "Special", "RDTSC Timer", "AIX Timer", "MFSPR Timer", "MFTB Timer", "STCK Timer", "J9 timer" };<NEW_LINE>out.write("Sys Processor Info :");<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Arch family " + Archs[arch]));<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Processor Sub-type " + SubTypes[subType]));<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Num Processors " + procs));<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Big Endian " + big));<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Word size " + word));<NEW_LINE>out.newLine();<NEW_LINE>out.write((Util.SUM_TAB + "Using Trace Counter " + trCounter[counter]));<NEW_LINE>out.newLine();<NEW_LINE>out.newLine();<NEW_LINE>} | "IA64", "S390X", "AMD64", "RISCV" }; |
1,681,339 | public static QueryTrademarkMonitorResultsResponse unmarshall(QueryTrademarkMonitorResultsResponse queryTrademarkMonitorResultsResponse, UnmarshallerContext _ctx) {<NEW_LINE>queryTrademarkMonitorResultsResponse.setRequestId(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.RequestId"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setTotalItemNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.TotalItemNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setCurrentPageNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.CurrentPageNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setPageSize(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.PageSize"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setTotalPageNum(_ctx.integerValue("QueryTrademarkMonitorResultsResponse.TotalPageNum"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setPrePage(_ctx.booleanValue("QueryTrademarkMonitorResultsResponse.PrePage"));<NEW_LINE>queryTrademarkMonitorResultsResponse.setNextPage(_ctx.booleanValue("QueryTrademarkMonitorResultsResponse.NextPage"));<NEW_LINE>List<TmMonitorResult> data = new ArrayList<TmMonitorResult>();<NEW_LINE>for (int i = 0; i < _ctx.lengthValue("QueryTrademarkMonitorResultsResponse.Data.Length"); i++) {<NEW_LINE>TmMonitorResult tmMonitorResult = new TmMonitorResult();<NEW_LINE>tmMonitorResult.setUserId(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].UserId"));<NEW_LINE>tmMonitorResult.setRuleId(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].RuleId"));<NEW_LINE>tmMonitorResult.setTmUid(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmUid"));<NEW_LINE>tmMonitorResult.setDataCreateTime(_ctx.longValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].DataCreateTime"));<NEW_LINE>tmMonitorResult.setDataUpdateTime(_ctx.longValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].DataUpdateTime"));<NEW_LINE>tmMonitorResult.setTmName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmName"));<NEW_LINE>tmMonitorResult.setTmImage(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmImage"));<NEW_LINE>tmMonitorResult.setClassification(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].Classification"));<NEW_LINE>tmMonitorResult.setRegistrationNumber(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].RegistrationNumber"));<NEW_LINE>tmMonitorResult.setTmProcedureStatusDesc(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].TmProcedureStatusDesc"));<NEW_LINE>tmMonitorResult.setOwnerName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].OwnerName"));<NEW_LINE>tmMonitorResult.setOwnerEnName(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].OwnerEnName"));<NEW_LINE>tmMonitorResult.setApplyDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].ApplyDate"));<NEW_LINE>tmMonitorResult.setXuzhanEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].XuzhanEndDate"));<NEW_LINE>tmMonitorResult.setChesanEndDate(_ctx.stringValue<MASK><NEW_LINE>tmMonitorResult.setWuxiaoEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].WuxiaoEndDate"));<NEW_LINE>tmMonitorResult.setYiyiEndDate(_ctx.stringValue("QueryTrademarkMonitorResultsResponse.Data[" + i + "].YiyiEndDate"));<NEW_LINE>data.add(tmMonitorResult);<NEW_LINE>}<NEW_LINE>queryTrademarkMonitorResultsResponse.setData(data);<NEW_LINE>return queryTrademarkMonitorResultsResponse;<NEW_LINE>} | ("QueryTrademarkMonitorResultsResponse.Data[" + i + "].ChesanEndDate")); |
1,853,017 | public void run() {<NEW_LINE>DialogDescriptor d = new DialogDescriptor(NbBundle.getMessage(BuildInstallersAction.class, "BuildInstallersAction.NotConfigured.Warning.Message"), NbBundle.getMessage(BuildInstallersAction.class, "BuildInstallersAction.NotConfigured.Warning.Title"));<NEW_LINE>d.setModal(true);<NEW_LINE>JButton accept = new JButton(NbBundle.getMessage(BuildInstallersAction.class, "BuildInstallersAction.NotConfigured.Warning.OK"));<NEW_LINE>accept.setDefaultCapable(true);<NEW_LINE>d.setOptions(new Object[] { accept });<NEW_LINE><MASK><NEW_LINE>if (DialogDisplayer.getDefault().notify(d).equals(accept)) {<NEW_LINE>// SuiteCustomizer cpi = prj.getLookup().lookup(org.netbeans.modules.apisupport.project.ui.customizer.SuiteCustomizer.class);<NEW_LINE>// cpi.showCustomizer(SuiteCustomizer.APPLICATION, SuiteCustomizer.APPLICATION_CREATE_STANDALONE_APPLICATION);<NEW_LINE>}<NEW_LINE>} | d.setMessageType(NotifyDescriptor.WARNING_MESSAGE); |
1,849,627 | public void update(StoreClient<Map<String, Object>, Map<String, Object>> storeClient) {<NEW_LINE>if (numCalls > 0) {<NEW_LINE>// TODO jko maybe delete this if unnecessary<NEW_LINE>Versioned<Map<String, Object>> nextNodeMap = storeClient.get(_key.mapValue());<NEW_LINE>if (nextNodeMap == null)<NEW_LINE>throw new ObsoleteVersionException("possible concurrent modification");<NEW_LINE>_listNode = new Versioned<VListNode<E>>(VListNode.<E>valueOf(nextNodeMap.getValue()<MASK><NEW_LINE>}<NEW_LINE>VListNode<E> nodeValue = _listNode.getValue();<NEW_LINE>_listNode.setObject(new VListNode<E>(nodeValue.getValue(), nodeValue.getId(), _newId, nodeValue.getNextId(), true));<NEW_LINE>Map<String, Object> nextNodeMap = _listNode.getValue().mapValue();<NEW_LINE>storeClient.put(_key.mapValue(), nextNodeMap);<NEW_LINE>numCalls++;<NEW_LINE>} | ), nextNodeMap.getVersion()); |
1,343,817 | private CompletableFuture<Void> loadStatistics(Duration timeout) {<NEW_LINE>if (!this.maintainStatistics) {<NEW_LINE>// Disabled.<NEW_LINE>return CompletableFuture.completedFuture(null);<NEW_LINE>}<NEW_LINE>val s = this.state;<NEW_LINE>if (s.rootPageOffset == PagePointer.NO_OFFSET) {<NEW_LINE>this.statistics = Statistics.EMPTY;<NEW_LINE>log.debug("{}: Resetting stats due to index empty.", this.traceObjectId);<NEW_LINE>return CompletableFuture.completedFuture(null);<NEW_LINE>}<NEW_LINE>long statsOffset = s.rootPageOffset + s.rootPageLength;<NEW_LINE>int statsLength = (int) Math.min(s.length - FOOTER_LENGTH - statsOffset, Integer.MAX_VALUE);<NEW_LINE>if (statsLength <= 0) {<NEW_LINE>// The Maintain Stats option was set, however this particular index does not support stats (because it was<NEW_LINE>// originally build with stats disabled or before stats were added).<NEW_LINE>this.maintainStatistics = false;<NEW_LINE>this.statistics = null;<NEW_LINE>log.<MASK><NEW_LINE>return CompletableFuture.completedFuture(null);<NEW_LINE>}<NEW_LINE>return this.read.apply(statsOffset, statsLength, false, timeout).thenAccept(data -> {<NEW_LINE>try {<NEW_LINE>this.statistics = Statistics.SERIALIZER.deserialize(data);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new CompletionException(ex);<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | debug("{}: Not loading stats due to legacy index not supporting stats.", this.traceObjectId); |
133,482 | protected void onCreate(@Nullable Bundle savedInstanceState) {<NEW_LINE>setTheme(UserPreferences.getTranslucentTheme());<NEW_LINE>super.onCreate(savedInstanceState);<NEW_LINE>viewBinding = SubscriptionSelectionActivityBinding.inflate(getLayoutInflater());<NEW_LINE>setContentView(viewBinding.getRoot());<NEW_LINE>setSupportActionBar(viewBinding.toolbar);<NEW_LINE>setTitle(R.string.shortcut_select_subscription);<NEW_LINE>viewBinding.transparentBackground.<MASK><NEW_LINE>viewBinding.card.setOnClickListener(null);<NEW_LINE>loadSubscriptions();<NEW_LINE>final Integer[] checkedPosition = new Integer[1];<NEW_LINE>viewBinding.list.setChoiceMode(ListView.CHOICE_MODE_SINGLE);<NEW_LINE>viewBinding.list.setOnItemClickListener((listView, view1, position, rowId) -> checkedPosition[0] = position);<NEW_LINE>viewBinding.shortcutBtn.setOnClickListener(view -> {<NEW_LINE>if (checkedPosition[0] != null && Intent.ACTION_CREATE_SHORTCUT.equals(getIntent().getAction())) {<NEW_LINE>getBitmapFromUrl(listItems.get(checkedPosition[0]));<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | setOnClickListener(v -> finish()); |
407,625 | public UnitsRelations init(ProcessingEnvironment env) {<NEW_LINE>elements = env.getElementUtils();<NEW_LINE>m = UnitsRelationsTools.buildAnnoMirrorWithDefaultPrefix(env, m.class);<NEW_LINE>km = UnitsRelationsTools.buildAnnoMirrorWithSpecificPrefix(env, m.class, Prefix.kilo);<NEW_LINE>mm = UnitsRelationsTools.buildAnnoMirrorWithSpecificPrefix(env, m.class, Prefix.milli);<NEW_LINE>m2 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, m2.class);<NEW_LINE>km2 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, km2.class);<NEW_LINE>mm2 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, mm2.class);<NEW_LINE>m3 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, m3.class);<NEW_LINE>km3 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, km3.class);<NEW_LINE>mm3 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, mm3.class);<NEW_LINE>s = UnitsRelationsTools.buildAnnoMirrorWithDefaultPrefix(env, s.class);<NEW_LINE>h = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, h.class);<NEW_LINE>mPERs = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, mPERs.class);<NEW_LINE>kmPERh = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, kmPERh.class);<NEW_LINE>mPERs2 = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, mPERs2.class);<NEW_LINE>g = UnitsRelationsTools.buildAnnoMirrorWithDefaultPrefix(env, g.class);<NEW_LINE>kg = UnitsRelationsTools.buildAnnoMirrorWithSpecificPrefix(env, g.class, Prefix.kilo);<NEW_LINE>t = UnitsRelationsTools.buildAnnoMirrorWithNoPrefix(env, t.class);<NEW_LINE>N = UnitsRelationsTools.<MASK><NEW_LINE>kN = UnitsRelationsTools.buildAnnoMirrorWithSpecificPrefix(env, N.class, Prefix.kilo);<NEW_LINE>return this;<NEW_LINE>} | buildAnnoMirrorWithDefaultPrefix(env, N.class); |
795,859 | public void processRecordsCli(Dataset<Row> lines) throws ZinggClientException {<NEW_LINE>LOG.info("Processing Records for CLI Labelling");<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (lines == null || lines.count() == 0) {<NEW_LINE>LOG.info("It seems there are no unmarked records at this moment. Please run findTrainingData job to build some pairs to be labelled and then run this labeler.");<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>lines = lines.cache();<NEW_LINE>List<Column> displayCols = DSUtil.getFieldDefColumns(lines, args, false, args.getShowConcise());<NEW_LINE>List<Row> clusterIDs = lines.select(ColName.CLUSTER_COLUMN).distinct().collectAsList();<NEW_LINE>try {<NEW_LINE>double score;<NEW_LINE>double prediction;<NEW_LINE>Dataset<Row> updatedRecords = null;<NEW_LINE>int selected_option = -1;<NEW_LINE>String msg1, msg2;<NEW_LINE>int totalPairs = clusterIDs.size();<NEW_LINE>for (int index = 0; index < totalPairs; index++) {<NEW_LINE>Dataset<Row> currentPair = lines.filter(lines.col(ColName.CLUSTER_COLUMN).equalTo(clusterIDs.get(index).getAs(ColName.CLUSTER_COLUMN))).cache();<NEW_LINE>score = currentPair.head().getAs(ColName.SCORE_COL);<NEW_LINE>prediction = currentPair.head().getAs(ColName.PREDICTION_COL);<NEW_LINE>msg1 = String.<MASK><NEW_LINE>String matchType = LabelMatchType.get(prediction).msg;<NEW_LINE>if (prediction == ColValues.IS_NOT_KNOWN_PREDICTION) {<NEW_LINE>msg2 = String.format("\tZingg does not do any prediction for the above pairs as Zingg is still collecting training data to build the preliminary models.");<NEW_LINE>} else {<NEW_LINE>msg2 = String.format("\tZingg predicts the above records %s with a similarity score of %.2f", matchType, Math.floor(score * 100) * 0.01);<NEW_LINE>}<NEW_LINE>// String msgHeader = msg1 + msg2;<NEW_LINE>selected_option = displayRecordsAndGetUserInput(DSUtil.select(currentPair, displayCols), msg1, msg2);<NEW_LINE>updateLabellerStat(selected_option, 1);<NEW_LINE>printMarkedRecordsStat();<NEW_LINE>if (selected_option == 9) {<NEW_LINE>LOG.info("User has quit in the middle. Updating the records.");<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>updatedRecords = updateRecords(selected_option, currentPair, updatedRecords);<NEW_LINE>}<NEW_LINE>writeLabelledOutput(updatedRecords);<NEW_LINE>LOG.warn("Processing finished.");<NEW_LINE>} catch (Exception e) {<NEW_LINE>if (LOG.isDebugEnabled()) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>LOG.warn("Labelling error has occured " + e.getMessage());<NEW_LINE>throw new ZinggClientException(e.getMessage());<NEW_LINE>}<NEW_LINE>return;<NEW_LINE>} | format("\tCurrent labelling round : %d/%d pairs labelled\n", index, totalPairs); |
958,538 | protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex, int x, int y, int w, int h, boolean isSelected) {<NEW_LINE>// paint tab separators<NEW_LINE>if (clientPropertyBoolean(tabPane, TABBED_PANE_SHOW_TAB_SEPARATORS, showTabSeparators) && !isLastInRun(tabIndex)) {<NEW_LINE>if (getTabType() == TAB_TYPE_CARD) {<NEW_LINE>// some separators need to be omitted if selected tab is painted as card<NEW_LINE>int selectedIndex = tabPane.getSelectedIndex();<NEW_LINE>if (tabIndex != selectedIndex - 1 && tabIndex != selectedIndex)<NEW_LINE>paintTabSeparator(g, tabPlacement, x, y, w, h);<NEW_LINE>} else<NEW_LINE>paintTabSeparator(g, tabPlacement, <MASK><NEW_LINE>}<NEW_LINE>// paint active tab border<NEW_LINE>if (isSelected && getTabType() == TAB_TYPE_CARD)<NEW_LINE>paintCardTabBorder(g, tabPlacement, tabIndex, x, y, w, h);<NEW_LINE>} | x, y, w, h); |
1,164,455 | private double[][] means(int[] assignment, double[][] means, ClusteringFeature[] cfs, int[] weights) {<NEW_LINE><MASK><NEW_LINE>double[][] newMeans = new double[k][];<NEW_LINE>for (int i = 0; i < assignment.length; i++) {<NEW_LINE>int c = assignment[i];<NEW_LINE>final ClusteringFeature cf = cfs[i];<NEW_LINE>if (newMeans[c] == null) {<NEW_LINE>newMeans[c] = cf.ls.clone();<NEW_LINE>} else {<NEW_LINE>plusEquals(newMeans[c], cf.ls);<NEW_LINE>}<NEW_LINE>weights[c] += cf.n;<NEW_LINE>}<NEW_LINE>for (int i = 0; i < k; i++) {<NEW_LINE>if (weights[i] == 0) {<NEW_LINE>newMeans[i] = means[i];<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>timesEquals(newMeans[i], 1.0 / weights[i]);<NEW_LINE>}<NEW_LINE>return newMeans;<NEW_LINE>} | Arrays.fill(weights, 0); |
1,478,528 | protected Promise<List<T>> run(final Context context) throws Exception {<NEW_LINE>if (_tasks.length == 0) {<NEW_LINE>return Promises.<MASK><NEW_LINE>}<NEW_LINE>final SettablePromise<List<T>> result = Promises.settable();<NEW_LINE>@SuppressWarnings("unchecked")<NEW_LINE>final PromiseListener<?> listener = resolvedPromise -> {<NEW_LINE>boolean allEarlyFinish = true;<NEW_LINE>final List<T> taskResult = new ArrayList<T>(_tasks.length);<NEW_LINE>List<Throwable> errors = null;<NEW_LINE>for (Task<?> task : _tasks) {<NEW_LINE>if (task.isFailed()) {<NEW_LINE>if (allEarlyFinish && ResultType.fromTask(task) != ResultType.EARLY_FINISH) {<NEW_LINE>allEarlyFinish = false;<NEW_LINE>}<NEW_LINE>if (errors == null) {<NEW_LINE>errors = new ArrayList<Throwable>();<NEW_LINE>}<NEW_LINE>errors.add(task.getError());<NEW_LINE>} else {<NEW_LINE>taskResult.add((T) task.get());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (errors != null) {<NEW_LINE>result.fail(allEarlyFinish ? errors.get(0) : new MultiException("Multiple errors in 'ParTask' task.", errors));<NEW_LINE>} else {<NEW_LINE>result.done(taskResult);<NEW_LINE>}<NEW_LINE>};<NEW_LINE>InternalUtil.after(listener, _tasks);<NEW_LINE>for (Task<?> task : _tasks) {<NEW_LINE>context.run(task);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | value(Collections.emptyList()); |
467,789 | static ShellSession checkInputSection(JTextComponent component) {<NEW_LINE>Document doc = component.getDocument();<NEW_LINE>ShellSession session = ShellSession.get(doc);<NEW_LINE>if (session == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ConsoleModel model = session.getModel();<NEW_LINE>if (model == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (is == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>LineDocument ld = LineDocumentUtils.as(doc, LineDocument.class);<NEW_LINE>if (ld == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>int caret = component.getCaretPosition();<NEW_LINE>int lineStart = is.getPartBegin();<NEW_LINE>try {<NEW_LINE>int lineEnd = LineDocumentUtils.getLineEnd(ld, caret);<NEW_LINE>if (caret < lineStart || caret > lineEnd) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>} catch (BadLocationException ex) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>return session;<NEW_LINE>} | ConsoleSection is = model.getInputSection(); |
31,170 | public SearchResult searchByNextPage(final Bundle context) {<NEW_LINE>final String filterConfig = context.getString(SEARCH_CONTEXT_FILTER);<NEW_LINE>GeocacheFilter filter = null;<NEW_LINE>if (filterConfig != null) {<NEW_LINE>filter = GeocacheFilter.createFromConfig(filterConfig);<NEW_LINE>final OriginGeocacheFilter origin = GeocacheFilter.findInChain(filter.getAndChainIfPossible(), OriginGeocacheFilter.class);<NEW_LINE>if (origin != null && !origin.allowsCachesOf(this)) {<NEW_LINE>return new SearchResult();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (context.getBoolean(SEARCH_CONTEXT_LEGACY_PAGING)) {<NEW_LINE>return <MASK><NEW_LINE>}<NEW_LINE>if (filter == null) {<NEW_LINE>// non-legacy-nextpage needs a filter to proceed. If none is there then return empty result<NEW_LINE>return new SearchResult();<NEW_LINE>}<NEW_LINE>return GCMap.searchByNextPage(this, context, filter);<NEW_LINE>} | GCParser.searchByNextPage(this, context); |
1,697,608 | public static Object loadConfigGuess(String path) throws Exception {<NEW_LINE>String input = FileUtils.readFileToString(new File(path));<NEW_LINE>// note here that we load json BEFORE YAML. YAML<NEW_LINE>// turns out to load just fine *accidentally*<NEW_LINE>try {<NEW_LINE>return MultiLayerConfiguration.fromJson(input);<NEW_LINE>} catch (Exception e) {<NEW_LINE>log.warn("Tried multi layer config from json", e);<NEW_LINE>try {<NEW_LINE>return KerasModelImport.importKerasModelConfiguration(path);<NEW_LINE>} catch (Exception e1) {<NEW_LINE>log.warn("Tried keras model config", e);<NEW_LINE>try {<NEW_LINE>return KerasModelImport.importKerasSequentialConfiguration(path);<NEW_LINE>} catch (Exception e2) {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>return ComputationGraphConfiguration.fromJson(input);<NEW_LINE>} catch (Exception e3) {<NEW_LINE>log.warn("Tried computation graph from json");<NEW_LINE>try {<NEW_LINE>return MultiLayerConfiguration.fromYaml(input);<NEW_LINE>} catch (Exception e4) {<NEW_LINE>log.warn("Tried multi layer configuration from yaml");<NEW_LINE>try {<NEW_LINE>return ComputationGraphConfiguration.fromYaml(input);<NEW_LINE>} catch (Exception e5) {<NEW_LINE>throw new ModelGuesserException("Unable to load configuration from path " + path + " (invalid config file or not a known config type)");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | log.warn("Tried keras sequence config", e); |
1,148,765 | public static InputStream open(String resource, Configuration conf) {<NEW_LINE>ClassLoader loader = conf.getClassLoader();<NEW_LINE>if (loader == null) {<NEW_LINE>loader = Thread.currentThread().getContextClassLoader();<NEW_LINE>}<NEW_LINE>if (loader == null) {<NEW_LINE>loader = HadoopIOUtils.class.getClassLoader();<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>// no prefix means classpath<NEW_LINE>if (!resource.contains(":")) {<NEW_LINE>InputStream result = loader.getResourceAsStream(resource);<NEW_LINE>if (result != null) {<NEW_LINE>if (trace) {<NEW_LINE>log.trace(String.format("Loaded resource %s from classpath", resource));<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>}<NEW_LINE>// fall back to the distributed cache<NEW_LINE>URI[] uris = DistributedCache.getCacheFiles(conf);<NEW_LINE>if (uris != null) {<NEW_LINE>for (URI uri : uris) {<NEW_LINE>if (uri.toString().contains(resource)) {<NEW_LINE>if (trace) {<NEW_LINE>log.trace(String.format("Loaded resource %s from distributed cache", resource));<NEW_LINE>}<NEW_LINE>return uri.toURL().openStream();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// fall back to file system<NEW_LINE>Path p = new Path(resource);<NEW_LINE>FileSystem fs = p.getFileSystem(conf);<NEW_LINE>return fs.open(p);<NEW_LINE>} catch (IOException ex) {<NEW_LINE>throw new EsHadoopIllegalArgumentException(String.format("Cannot open stream for resource %s", resource), ex);<NEW_LINE>}<NEW_LINE>} | boolean trace = log.isTraceEnabled(); |
517,886 | static void writeConfig(final ContextManager contextManager, final StoredConfiguration storedConfiguration) throws PwmOperationalException, PwmUnrecoverableException {<NEW_LINE>final ConfigurationReader configReader = contextManager.getConfigReader();<NEW_LINE>final <MASK><NEW_LINE>try {<NEW_LINE>final StoredConfigurationModifier modifier = StoredConfigurationModifier.newModifier(storedConfiguration);<NEW_LINE>// add a random security key<NEW_LINE>StoredConfigurationUtil.initNewRandomSecurityKey(modifier);<NEW_LINE>configReader.saveConfiguration(modifier.newStoredConfiguration(), pwmApplication, null);<NEW_LINE>contextManager.requestPwmApplicationRestart();<NEW_LINE>} catch (final PwmException e) {<NEW_LINE>throw new PwmOperationalException(e.getErrorInformation());<NEW_LINE>} catch (final Exception e) {<NEW_LINE>final ErrorInformation errorInformation = new ErrorInformation(PwmError.ERROR_INVALID_CONFIG, "unable to save configuration: " + e.getLocalizedMessage());<NEW_LINE>throw new PwmOperationalException(errorInformation);<NEW_LINE>}<NEW_LINE>} | PwmApplication pwmApplication = contextManager.getPwmApplication(); |
737,236 | static boolean renderDeploymentExportComments(final DOMNode thisNode, final AsyncBuffer out, final boolean isContentNode) {<NEW_LINE>final Set<String> instructions = new LinkedHashSet<>();<NEW_LINE>thisNode.getVisibilityInstructions(instructions);<NEW_LINE>thisNode.getLinkableInstructions(instructions);<NEW_LINE>thisNode.getSecurityInstructions(instructions);<NEW_LINE>if (thisNode.isHidden()) {<NEW_LINE>instructions.add("@structr:hidden");<NEW_LINE>}<NEW_LINE>if (isContentNode) {<NEW_LINE>// special rules apply for content nodes: since we can not store<NEW_LINE>// structr-specific properties in the attributes of the element,<NEW_LINE>// we need to encode those attributes in instructions.<NEW_LINE>thisNode.getContentInstructions(instructions);<NEW_LINE>}<NEW_LINE>if (!instructions.isEmpty()) {<NEW_LINE>out.append("<!-- ");<NEW_LINE>for (final Iterator<String> it = instructions.iterator(); it.hasNext(); ) {<NEW_LINE>final <MASK><NEW_LINE>out.append(instruction);<NEW_LINE>if (it.hasNext()) {<NEW_LINE>out.append(", ");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>out.append(" -->");<NEW_LINE>return true;<NEW_LINE>} else {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} | String instruction = it.next(); |
295,758 | final DescribeAccountAttributesResult executeDescribeAccountAttributes(DescribeAccountAttributesRequest describeAccountAttributesRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeAccountAttributesRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeAccountAttributesRequest> request = null;<NEW_LINE>Response<DescribeAccountAttributesResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeAccountAttributesRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(describeAccountAttributesRequest));<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, "Pinpoint SMS Voice V2");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DescribeAccountAttributes");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DescribeAccountAttributesResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DescribeAccountAttributesResultJsonUnmarshaller());<NEW_LINE>response = <MASK><NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | invoke(request, responseHandler, executionContext); |
323,495 | protected Cursor doInBackground(Void... params) {<NEW_LINE>ActivityUtils utils <MASK><NEW_LINE>update = utils.refreshActivity();<NEW_LINE>AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);<NEW_LINE>long now = new Date().getTime();<NEW_LINE>long alarm = now + DrawerActivity.settings.activityRefresh;<NEW_LINE>PendingIntent pendingIntent = PendingIntent.getService(context, ACTIVITY_REFRESH_ID, new Intent(context, ActivityRefreshService.class), 0);<NEW_LINE>if (DrawerActivity.settings.activityRefresh != 0)<NEW_LINE>am.setRepeating(AlarmManager.RTC_WAKEUP, alarm, DrawerActivity.settings.activityRefresh, pendingIntent);<NEW_LINE>else<NEW_LINE>am.cancel(pendingIntent);<NEW_LINE>if (settings.syncSecondMentions) {<NEW_LINE>context.startService(new Intent(context, SecondActivityRefreshService.class));<NEW_LINE>}<NEW_LINE>return ActivityDataSource.getInstance(context).getCursor(currentAccount);<NEW_LINE>} | = new ActivityUtils(getActivity()); |
891,211 | private static void notifyUnresolvedCoreDumps(final Set<File> unresolvedCoreDumpsF, final Set<String> unresolvedCoreDumpsS) {<NEW_LINE>VisualVM.getInstance().runTask(new Runnable() {<NEW_LINE><NEW_LINE>public void run() {<NEW_LINE>JPanel messagePanel = new JPanel(new BorderLayout(5, 5));<NEW_LINE>// NOI18N<NEW_LINE>messagePanel.add(new JLabel(NbBundle.getMessage(CoreDumpProvider.class, <MASK><NEW_LINE>JList list = new JList(unresolvedCoreDumpsS.toArray());<NEW_LINE>list.setVisibleRowCount(4);<NEW_LINE>messagePanel.add(new JScrollPane(list), BorderLayout.CENTER);<NEW_LINE>NotifyDescriptor dd = new // NOI18N<NEW_LINE>NotifyDescriptor(// NOI18N<NEW_LINE>messagePanel, NbBundle.getMessage(CoreDumpProvider.class, "Title_Unresolved_CoreDumps"), NotifyDescriptor.YES_NO_OPTION, NotifyDescriptor.ERROR_MESSAGE, null, NotifyDescriptor.YES_OPTION);<NEW_LINE>if (DialogDisplayer.getDefault().notify(dd) == NotifyDescriptor.NO_OPTION)<NEW_LINE>for (File file : unresolvedCoreDumpsF) Utils.delete(file, true);<NEW_LINE>unresolvedCoreDumpsF.clear();<NEW_LINE>unresolvedCoreDumpsS.clear();<NEW_LINE>}<NEW_LINE>}, 1000);<NEW_LINE>} | "MSG_Unresolved_CoreDumps")), BorderLayout.NORTH); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.