idx int32 46 1.86M | input stringlengths 321 6.6k | target stringlengths 9 1.24k |
|---|---|---|
1,649,823 | public LogicalPlan plan(SelectRelation queryBlock, ExpressionMapping outer) {<NEW_LINE>OptExprBuilder builder = planFrom(queryBlock.getRelation(), cteContext);<NEW_LINE>builder.setExpressionMapping(new ExpressionMapping(builder.getScope(), builder.getFieldMappings(), outer));<NEW_LINE>builder = filter(builder, queryBlock.getPredicate());<NEW_LINE>builder = aggregate(builder, queryBlock.getGroupBy(), queryBlock.getAggregate(), queryBlock.getGroupingSetsList(), queryBlock.getGroupingFunctionCallExprs());<NEW_LINE>builder = filter(builder, queryBlock.getHaving());<NEW_LINE>builder = window(builder, queryBlock.getOutputAnalytic());<NEW_LINE>if (queryBlock.hasOrderByClause()) {<NEW_LINE>if (!queryBlock.hasAggregation()) {<NEW_LINE>// requires both output and source fields to be visible if there are no aggregations<NEW_LINE>builder = projectForOrderWithoutAggregation(builder, queryBlock.getOutputExpr(), builder.getFieldMappings(), queryBlock.getOrderScope());<NEW_LINE>} else {<NEW_LINE>// requires output fields, groups and translated aggregations to be visible for queries with aggregation<NEW_LINE>builder = projectForOrderWithAggregation(builder, Iterables.concat(queryBlock.getOutputExpr(), queryBlock.getOrderSourceExpressions()<MASK><NEW_LINE>}<NEW_LINE>builder = window(builder, queryBlock.getOrderByAnalytic());<NEW_LINE>}<NEW_LINE>builder = distinct(builder, queryBlock.isDistinct(), queryBlock.getOutputExpr());<NEW_LINE>// add project to express order by expression<NEW_LINE>builder = project(builder, Iterables.concat(queryBlock.getOrderByExpressions(), queryBlock.getOutputExpr()));<NEW_LINE>List<ColumnRefOperator> orderByColumns = Lists.newArrayList();<NEW_LINE>builder = sort(builder, queryBlock.getOrderBy(), orderByColumns);<NEW_LINE>builder = limit(builder, queryBlock.getLimit());<NEW_LINE>List<ColumnRefOperator> outputColumns = computeOutputs(builder, queryBlock.getOutputExpr());<NEW_LINE>// Add project operator to prune order by columns<NEW_LINE>if (!orderByColumns.isEmpty() && !outputColumns.containsAll(orderByColumns)) {<NEW_LINE>builder = project(builder, queryBlock.getOutputExpr());<NEW_LINE>}<NEW_LINE>return new LogicalPlan(builder, outputColumns, correlation);<NEW_LINE>} | ), queryBlock.getOrderScope()); |
177,657 | private static synchronized void updateStreamValues() {<NEW_LINE>// Over all the sinks...<NEW_LINE>for (VideoSink i : m_sinks.values()) {<NEW_LINE><MASK><NEW_LINE>// Get the source's subtable (if none exists, we're done)<NEW_LINE>int source = Objects.requireNonNullElseGet(m_fixedSources.get(sink), () -> CameraServerJNI.getSinkSource(sink));<NEW_LINE>if (source == 0) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>NetworkTable table = m_tables.get(source);<NEW_LINE>if (table != null) {<NEW_LINE>// Don't set stream values if this is a HttpCamera passthrough<NEW_LINE>if (VideoSource.getKindFromInt(CameraServerJNI.getSourceKind(source)) == VideoSource.Kind.kHttp) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>// Set table value<NEW_LINE>String[] values = getSinkStreamValues(sink);<NEW_LINE>if (values.length > 0) {<NEW_LINE>table.getEntry("streams").setStringArray(values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Over all the sources...<NEW_LINE>for (VideoSource i : m_sources.values()) {<NEW_LINE>int source = i.getHandle();<NEW_LINE>// Get the source's subtable (if none exists, we're done)<NEW_LINE>NetworkTable table = m_tables.get(source);<NEW_LINE>if (table != null) {<NEW_LINE>// Set table value<NEW_LINE>String[] values = getSourceStreamValues(source);<NEW_LINE>if (values.length > 0) {<NEW_LINE>table.getEntry("streams").setStringArray(values);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int sink = i.getHandle(); |
762,344 | protected void fillPackagerProperties(Map<String, Object> props, Distribution distribution) throws PackagerProcessingException {<NEW_LINE>GitService gitService = context.getModel().getRelease().getGitService();<NEW_LINE>if (!props.containsKey(KEY_PROJECT_LICENSE_URL) || isBlank((String) props.get(KEY_PROJECT_LICENSE_URL))) {<NEW_LINE>context.getLogger().warn(RB.$("ERROR_project_no_license_url"));<NEW_LINE>}<NEW_LINE>String repoUrl = gitService.getResolvedRepoUrl(context.getModel());<NEW_LINE>String bucketRepoUrl = gitService.getResolvedRepoUrl(context.getModel(), packager.getBucket().getOwner(), packager.<MASK><NEW_LINE>props.put(KEY_CHOCOLATEY_PACKAGE_SOURCE_URL, packager.isRemoteBuild() ? bucketRepoUrl : repoUrl);<NEW_LINE>props.put(KEY_CHOCOLATEY_BUCKET_REPO_URL, bucketRepoUrl);<NEW_LINE>props.put(KEY_CHOCOLATEY_BUCKET_REPO_CLONE_URL, gitService.getResolvedRepoCloneUrl(context.getModel(), packager.getBucket().getOwner(), packager.getBucket().getResolvedName()));<NEW_LINE>props.put(KEY_CHOCOLATEY_PACKAGE_NAME, packager.getPackageName());<NEW_LINE>props.put(KEY_CHOCOLATEY_PACKAGE_VERSION, resolveTemplate(packager.getPackageVersion(), props));<NEW_LINE>props.put(KEY_CHOCOLATEY_USERNAME, packager.getUsername());<NEW_LINE>props.put(KEY_CHOCOLATEY_TITLE, packager.getTitle());<NEW_LINE>props.put(KEY_CHOCOLATEY_ICON_URL, resolveTemplate(packager.getIconUrl(), props));<NEW_LINE>props.put(KEY_CHOCOLATEY_SOURCE, packager.getSource());<NEW_LINE>} | getBucket().getResolvedName()); |
146,503 | public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {<NEW_LINE>final String createTableSql = "CREATE TABLE IF NOT EXISTS visits ( visit_id SERIAL NOT NULL, " + "user_ip VARCHAR(46) NOT NULL, ts timestamp NOT NULL, " + "PRIMARY KEY (visit_id) );";<NEW_LINE>final String createVisitSql = "INSERT INTO visits (user_ip, ts) VALUES (?, ?);";<NEW_LINE>final String selectSql = "SELECT user_ip, ts FROM visits ORDER BY ts DESC " + "LIMIT 10;";<NEW_LINE>String path = req.getRequestURI();<NEW_LINE>if (path.startsWith("/favicon.ico")) {<NEW_LINE>// ignore the request for favicon.ico<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PrintWriter out = resp.getWriter();<NEW_LINE>resp.setContentType("text/plain");<NEW_LINE>// store only the first two octets of a users ip address<NEW_LINE>String userIp = req.getRemoteAddr();<NEW_LINE>InetAddress address = InetAddress.getByName(userIp);<NEW_LINE>if (address instanceof Inet6Address) {<NEW_LINE>// nest indexOf calls to find the second occurrence of a character in a string<NEW_LINE>// an alternative is to use Apache Commons Lang: StringUtils.ordinalIndexOf()<NEW_LINE>userIp = userIp.substring(0, userIp.indexOf(":", userIp.indexOf(":") + 1)) + ":*:*:*:*:*:*";<NEW_LINE>} else if (address instanceof Inet4Address) {<NEW_LINE>userIp = userIp.substring(0, userIp.indexOf(".", userIp.indexOf(".") + 1)) + ".*.*";<NEW_LINE>}<NEW_LINE>Stopwatch stopwatch = Stopwatch.createStarted();<NEW_LINE>try (PreparedStatement statementCreateVisit = conn.prepareStatement(createVisitSql)) {<NEW_LINE>conn.<MASK><NEW_LINE>statementCreateVisit.setString(1, userIp);<NEW_LINE>statementCreateVisit.setTimestamp(2, new Timestamp(new Date().getTime()));<NEW_LINE>statementCreateVisit.executeUpdate();<NEW_LINE>try (ResultSet rs = conn.prepareStatement(selectSql).executeQuery()) {<NEW_LINE>stopwatch.stop();<NEW_LINE>out.print("Last 10 visits:\n");<NEW_LINE>while (rs.next()) {<NEW_LINE>String savedIp = rs.getString("user_ip");<NEW_LINE>String timeStamp = rs.getString("ts");<NEW_LINE>out.println("Time: " + timeStamp + " Addr: " + savedIp);<NEW_LINE>}<NEW_LINE>out.println("Elapsed: " + stopwatch.elapsed(TimeUnit.MILLISECONDS));<NEW_LINE>}<NEW_LINE>} catch (SQLException e) {<NEW_LINE>throw new ServletException("SQL error", e);<NEW_LINE>}<NEW_LINE>} | createStatement().executeUpdate(createTableSql); |
1,794,777 | private static int runReAugmentation(List<String> cliArgs, CommandLine cmd) {<NEW_LINE>int exitCode = 0;<NEW_LINE>List<String> configArgsList = new ArrayList<>(cliArgs);<NEW_LINE>configArgsList.remove(AUTO_BUILD_OPTION_LONG);<NEW_LINE>configArgsList.remove(AUTO_BUILD_OPTION_SHORT);<NEW_LINE>configArgsList.remove(ImportRealmMixin.IMPORT_REALM);<NEW_LINE>configArgsList.replaceAll(new UnaryOperator<String>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public String apply(String arg) {<NEW_LINE>if (arg.equals(Start.NAME) || arg.equals(StartDev.NAME)) {<NEW_LINE>return Build.NAME;<NEW_LINE>}<NEW_LINE>return arg;<NEW_LINE>}<NEW_LINE>});<NEW_LINE>exitCode = cmd.execute(configArgsList.toArray(new String[0]));<NEW_LINE>if (!isDevMode() && exitCode == cmd.getCommandSpec().exitCodeOnSuccess()) {<NEW_LINE>cmd.getOut().printf("Next time you run the server, just run:%n%n\t%s %s %s%n%n", Environment.getCommand(), Start.NAME, String.join<MASK><NEW_LINE>}<NEW_LINE>return exitCode;<NEW_LINE>} | (" ", getSanitizedRuntimeCliOptions())); |
1,590,527 | private List<VTMatchInfo> transform(VTMatchSet matchSet, Address destinationAddress, LSHCosineVectorAccum destinationVector, Set<DominantPair<Address, LSHCosineVectorAccum>> neighbors, double threshold, TaskMonitor monitor) {<NEW_LINE>List<VTMatchInfo> result = new ArrayList<VTMatchInfo>();<NEW_LINE>Listing sourceListing = getSourceProgram().getListing();<NEW_LINE>Listing destinationListing = getDestinationProgram().getListing();<NEW_LINE>VectorCompare veccompare = new VectorCompare();<NEW_LINE>for (DominantPair<Address, LSHCosineVectorAccum> neighbor : neighbors) {<NEW_LINE>if (monitor.isCancelled()) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>Address sourceAddress = neighbor.first;<NEW_LINE>LSHCosineVectorAccum sourceVector = neighbor.second;<NEW_LINE>double similarity = sourceVector.compare(destinationVector, veccompare);<NEW_LINE>if (similarity < threshold || Double.isNaN(similarity)) {<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>double confidence = similarity * sourceVector.getLength<MASK><NEW_LINE>confidence *= 10;<NEW_LINE>int sourceLength = getDataLength(sourceListing, sourceAddress);<NEW_LINE>int destinationLength = getDataLength(destinationListing, destinationAddress);<NEW_LINE>VTMatchInfo match = new VTMatchInfo(matchSet);<NEW_LINE>match.setSimilarityScore(new VTScore(similarity));<NEW_LINE>match.setConfidenceScore(new VTScore(confidence));<NEW_LINE>match.setSourceLength(sourceLength);<NEW_LINE>match.setDestinationLength(destinationLength);<NEW_LINE>match.setSourceAddress(sourceAddress);<NEW_LINE>match.setDestinationAddress(destinationAddress);<NEW_LINE>match.setTag(null);<NEW_LINE>match.setAssociationType(VTAssociationType.DATA);<NEW_LINE>result.add(match);<NEW_LINE>}<NEW_LINE>return result;<NEW_LINE>} | () * destinationVector.getLength(); |
1,742,362 | public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException {<NEW_LINE>if (((bitField0_ & 0x00000001) == 0x00000001)) {<NEW_LINE>output.writeInt64(1, observedGeneration_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000002) == 0x00000002)) {<NEW_LINE>output.<MASK><NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000004) == 0x00000004)) {<NEW_LINE>output.writeInt32(3, currentReplicas_);<NEW_LINE>}<NEW_LINE>if (((bitField0_ & 0x00000008) == 0x00000008)) {<NEW_LINE>output.writeInt32(4, desiredReplicas_);<NEW_LINE>}<NEW_LINE>for (int i = 0; i < currentMetrics_.size(); i++) {<NEW_LINE>output.writeMessage(5, currentMetrics_.get(i));<NEW_LINE>}<NEW_LINE>for (int i = 0; i < conditions_.size(); i++) {<NEW_LINE>output.writeMessage(6, conditions_.get(i));<NEW_LINE>}<NEW_LINE>unknownFields.writeTo(output);<NEW_LINE>} | writeMessage(2, getLastScaleTime()); |
796,510 | private void checkBatchFinderSchema(BatchFinderSchema prevRec, BatchFinderSchema currRec) {<NEW_LINE>checkEqualSingleValue(prevRec.schema().getField("name"), prevRec.getName(GetMode.DEFAULT), currRec.getName(GetMode.DEFAULT));<NEW_LINE>checkDoc(prevRec.schema().getField("doc"), prevRec.getDoc(GetMode.DEFAULT), currRec.getDoc(GetMode.DEFAULT));<NEW_LINE>checkAnnotationsMap(prevRec.schema().getField("annotations"), prevRec.getAnnotations(GetMode.DEFAULT), currRec.getAnnotations(GetMode.DEFAULT));<NEW_LINE>checkParameterArrayField(prevRec.schema().getField("parameters"), prevRec.getParameters(GetMode.DEFAULT), currRec.getParameters(GetMode.DEFAULT));<NEW_LINE>checkComplexField(prevRec.schema().getField("metadata"), prevRec.getMetadata(GetMode.DEFAULT), currRec.getMetadata(GetMode.DEFAULT));<NEW_LINE>checkPagingSupport(prevRec.isPagingSupported(GetMode.DEFAULT), currRec.isPagingSupported(GetMode.DEFAULT));<NEW_LINE>checkEqualSingleValue(prevRec.schema().getField("batchParam"), prevRec.getBatchParam(GetMode.DEFAULT), currRec.getBatchParam(GetMode.DEFAULT));<NEW_LINE>checkFindersAssocKey(prevRec.getAssocKey(GetMode.DEFAULT), currRec.getAssocKey(GetMode.DEFAULT), prevRec.getAssocKeys(GetMode.DEFAULT), currRec.getAssocKeys(GetMode.DEFAULT), prevRec.schema().getField("assocKey"), prevRec.schema().getField("assocKeys"));<NEW_LINE>checkMethodServiceErrors(prevRec.schema().getField("serviceErrors"), prevRec.getServiceErrors(GetMode.DEFAULT), currRec.getServiceErrors(GetMode.DEFAULT));<NEW_LINE>checkMaxBatchSizeAnnotation(prevRec.getMaxBatchSize(GetMode.DEFAULT), currRec<MASK><NEW_LINE>} | .getMaxBatchSize(GetMode.DEFAULT)); |
433,811 | public void marshall(NewTransitVirtualInterfaceAllocation newTransitVirtualInterfaceAllocation, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (newTransitVirtualInterfaceAllocation == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getVlan(), VLAN_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getAsn(), ASN_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getMtu(), MTU_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getAuthKey(), AUTHKEY_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getAmazonAddress(), AMAZONADDRESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getCustomerAddress(), CUSTOMERADDRESS_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getAddressFamily(), ADDRESSFAMILY_BINDING);<NEW_LINE>protocolMarshaller.marshall(newTransitVirtualInterfaceAllocation.getTags(), TAGS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | newTransitVirtualInterfaceAllocation.getVirtualInterfaceName(), VIRTUALINTERFACENAME_BINDING); |
1,583,311 | protected void fillAAnswer() {<NEW_LINE>if (c_logger.isTraceEntryExitEnabled())<NEW_LINE>c_logger.traceEntry(this, "StateMachine: fillAAnswer: entry: id=" + hashCode());<NEW_LINE>for (Enumeration e = _AResponses.elements(); e.hasMoreElements(); ) {<NEW_LINE>Vector vector2 = (Vector) e.nextElement();<NEW_LINE>for (Enumeration e1 = vector2.elements(); e1.hasMoreElements(); ) {<NEW_LINE>ARecord a = (ARecord) e1.nextElement();<NEW_LINE>SIPUri answer = SIPUri.createSIPUri(_simpl._suri.getURI());<NEW_LINE>answer.setScheme(_simpl._scheme);<NEW_LINE>answer.setHost(a.getAddress().getHostAddress());<NEW_LINE>// "tcp"<NEW_LINE>answer.setTransport(_simpl._transport);<NEW_LINE>// 5060<NEW_LINE>answer.setPortInt(_simpl._port);<NEW_LINE>addUriToList(answer, _simpl._answerList, a);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Enumeration e = _AAAAResponses.elements(); e.hasMoreElements(); ) {<NEW_LINE>Vector vector2 = (Vector) e.nextElement();<NEW_LINE>for (Enumeration e1 = vector2.elements(); e1.hasMoreElements(); ) {<NEW_LINE>AAAARecord aaaa = (AAAARecord) e1.nextElement();<NEW_LINE>SIPUri answer = SIPUri.createSIPUri(_simpl._suri.getURI());<NEW_LINE>answer.setScheme(_simpl._scheme);<NEW_LINE>answer.setHost(aaaa.getAddress().getHostAddress());<NEW_LINE>// "tcp"<NEW_LINE>answer.setTransport(_simpl._transport);<NEW_LINE>// 5060<NEW_LINE><MASK><NEW_LINE>addUriToList(answer, _simpl._answerList, aaaa);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (c_logger.isTraceEntryExitEnabled())<NEW_LINE>c_logger.traceExit(this, "StateMachine: fillAAnswer: exit: id=" + hashCode());<NEW_LINE>} | answer.setPortInt(_simpl._port); |
1,813,303 | protected void innerRollback(String group, IConnection conn) {<NEW_LINE>// XA transaction must in 'ACTIVE', 'IDLE' or 'PREPARED' state, so ROLLBACK first.<NEW_LINE>String xid = <MASK><NEW_LINE>try (Statement stmt = conn.createStatement()) {<NEW_LINE>try {<NEW_LINE>stmt.execute("XA ROLLBACK " + xid);<NEW_LINE>} catch (SQLException ex) {<NEW_LINE>if (ex.getErrorCode() == com.alibaba.polardbx.ErrorCode.ER_XAER_RMFAIL) {<NEW_LINE>// XA ROLLBACK got ER_XAER_RMFAIL, XA transaction must in 'ACTIVE' state, so END and ROLLBACK.<NEW_LINE>stmt.execute(getXARollbackSqls(xid));<NEW_LINE>} else if (ex.getErrorCode() == com.alibaba.polardbx.ErrorCode.ER_XAER_NOTA) {<NEW_LINE>logger.warn("XA ROLLBACK got ER_XAER_NOTA: " + xid, ex);<NEW_LINE>} else {<NEW_LINE>throw GeneralUtil.nestedException(ex);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>// discard connection if something failed.<NEW_LINE>discard(group, conn, e);<NEW_LINE>logger.warn("XA ROLLBACK failed: " + xid, e);<NEW_LINE>// Retry XA ROLLBACK in asynchronous task.<NEW_LINE>AsyncTaskQueue asyncQueue = getManager().getTransactionExecutor().getAsyncQueue();<NEW_LINE>asyncQueue.submit(() -> XAUtils.rollbackUntilSucceed(id, primaryGroupUid, group, dataSourceCache.get(group)));<NEW_LINE>}<NEW_LINE>} | getXid(group, conn, shareReadView); |
157,530 | public DescribeHoursOfOperationResult describeHoursOfOperation(DescribeHoursOfOperationRequest describeHoursOfOperationRequest) throws AmazonServiceException, AmazonClientException {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(describeHoursOfOperationRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DescribeHoursOfOperationRequest> request = null;<NEW_LINE>Response<DescribeHoursOfOperationResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DescribeHoursOfOperationRequestMarshaller().marshall(describeHoursOfOperationRequest);<NEW_LINE>// Binds the request metrics to the current request.<NEW_LINE>request.setAWSRequestMetrics(awsRequestMetrics);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>Unmarshaller<DescribeHoursOfOperationResult, JsonUnmarshallerContext> unmarshaller = new DescribeHoursOfOperationResultJsonUnmarshaller();<NEW_LINE>JsonResponseHandler<DescribeHoursOfOperationResult> responseHandler = new JsonResponseHandler<DescribeHoursOfOperationResult>(unmarshaller);<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.ClientExecuteTime);<NEW_LINE>endClientExecution(<MASK><NEW_LINE>}<NEW_LINE>} | awsRequestMetrics, request, response, LOGGING_AWS_REQUEST_METRIC); |
1,219,372 | public void encode(Buffer valueBuffer) {<NEW_LINE>StrategyAnalyzer<Long> collectIntervalStrategyAnalyzer = collectIntervalAnalyzerBuilder.build();<NEW_LINE>StrategyAnalyzer<Long> sampledNewCountStrategyAnalyzer = sampledNewCountAnalyzerBuilder.build();<NEW_LINE>StrategyAnalyzer<Long> sampledContinuationCountStrategyAnalyzer = sampledContinuationCountAnalyzerBuilder.build();<NEW_LINE>StrategyAnalyzer<Long> unsampledNewCountStrategyAnalyzer = unsampledNewCountAnalyzerBuilder.build();<NEW_LINE>StrategyAnalyzer<Long> unsampledContinuationCountStrategyAnalyzer = unsampledContinuationCountAnalyzerBuilder.build();<NEW_LINE>StrategyAnalyzer<Long<MASK><NEW_LINE>StrategyAnalyzer<Long> skippedContinuationCountStrategyAnalyzer = skippedContinuationCountAnalyzerBuilder.build();<NEW_LINE>// encode header<NEW_LINE>AgentStatHeaderEncoder headerEncoder = new BitCountingHeaderEncoder();<NEW_LINE>headerEncoder.addCode(collectIntervalStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(sampledNewCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(sampledContinuationCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(unsampledNewCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(unsampledContinuationCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(skippedNewCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>headerEncoder.addCode(skippedContinuationCountStrategyAnalyzer.getBestStrategy().getCode());<NEW_LINE>final byte[] header = headerEncoder.getHeader();<NEW_LINE>valueBuffer.putPrefixedBytes(header);<NEW_LINE>// encode values<NEW_LINE>this.codec.encodeValues(valueBuffer, collectIntervalStrategyAnalyzer.getBestStrategy(), collectIntervalStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, sampledNewCountStrategyAnalyzer.getBestStrategy(), sampledNewCountStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, sampledContinuationCountStrategyAnalyzer.getBestStrategy(), sampledContinuationCountStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, unsampledNewCountStrategyAnalyzer.getBestStrategy(), unsampledNewCountStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, unsampledContinuationCountStrategyAnalyzer.getBestStrategy(), unsampledContinuationCountStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, skippedNewCountStrategyAnalyzer.getBestStrategy(), skippedNewCountStrategyAnalyzer.getValues());<NEW_LINE>this.codec.encodeValues(valueBuffer, skippedContinuationCountStrategyAnalyzer.getBestStrategy(), skippedContinuationCountStrategyAnalyzer.getValues());<NEW_LINE>} | > skippedNewCountStrategyAnalyzer = skippedNewCountAnalyzerBuilder.build(); |
1,364,218 | public void handle(final HttpExchange t) throws IOException {<NEW_LINE>final String date = new Date().toString();<NEW_LINE>_sensors.get(_name).incrementAndGet();<NEW_LINE>Headers headers = t.getRequestHeaders();<NEW_LINE>Long delay = _delay;<NEW_LINE>if (headers.containsKey("delay")) {<NEW_LINE>List<String> headerValues = headers.get("delay");<NEW_LINE>delay = Long.parseLong(headerValues.get(0));<NEW_LINE>}<NEW_LINE>System.out.println(date + ": " + _serverName + " received a request for the context handler = " + _name);<NEW_LINE>_executorService.schedule(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>String response = "server " + _serverName;<NEW_LINE>try {<NEW_LINE>t.sendResponseHeaders(<MASK><NEW_LINE>OutputStream os = t.getResponseBody();<NEW_LINE>os.write(response.getBytes());<NEW_LINE>os.close();<NEW_LINE>} catch (IOException e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}, delay, TimeUnit.MILLISECONDS);<NEW_LINE>} | 200, response.length()); |
1,529,002 | static Bag[] of(int n, int k) {<NEW_LINE>if (n < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid sample size: " + n);<NEW_LINE>}<NEW_LINE>if (k < 0) {<NEW_LINE>throw new IllegalArgumentException("Invalid number of bootstrap: " + k);<NEW_LINE>}<NEW_LINE>Bag[] bags = new Bag[k];<NEW_LINE>for (int j = 0; j < k; j++) {<NEW_LINE>boolean[] hit = new boolean[n];<NEW_LINE>int hits = 0;<NEW_LINE>int[] train = new int[n];<NEW_LINE>for (int i = 0; i < n; i++) {<NEW_LINE>int r = MathEx.randomInt(n);<NEW_LINE>train[i] = r;<NEW_LINE>if (!hit[r]) {<NEW_LINE>hits++;<NEW_LINE>hit[r] = true;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>int[] test = new int[n - hits];<NEW_LINE>for (int i = 0, p = 0; i < n; i++) {<NEW_LINE>if (!hit[i]) {<NEW_LINE>test[p++] = i;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>bags[j] <MASK><NEW_LINE>}<NEW_LINE>return bags;<NEW_LINE>} | = new Bag(train, test); |
408,613 | private void operationSetBound(QueryExecutionContext context, IndexScanOperation op, int index, BoundType boundType) {<NEW_LINE>Object parameterValue = parameter.getParameterValue(context);<NEW_LINE>if (parameterValue == null) {<NEW_LINE>throw new ClusterJUserException(local.message("ERR_Parameter_Cannot_Be_Null", "operator in", parameter.parameterName));<NEW_LINE>} else if (parameterValue instanceof List<?>) {<NEW_LINE>List<?> parameterList = (List<?>) parameterValue;<NEW_LINE>Object value = parameterList.get(index);<NEW_LINE>property.operationSetBounds(value, boundType, op);<NEW_LINE>if (logger.isDetailEnabled())<NEW_LINE>logger.detail("InPredicateImpl.operationSetBound for " + property.fmd.getName() + " List index: " + index + " value: " + value + " boundType: " + boundType);<NEW_LINE>} else if (parameterValue.getClass().isArray()) {<NEW_LINE>Object[] parameterArray = (Object[]) parameterValue;<NEW_LINE>Object value = parameterArray[index];<NEW_LINE>property.operationSetBounds(value, boundType, op);<NEW_LINE>if (logger.isDetailEnabled())<NEW_LINE>logger.detail("InPredicateImpl.operationSetBound for " + property.fmd.getName() + " array index: " + index + <MASK><NEW_LINE>} else {<NEW_LINE>throw new ClusterJUserException(local.message("ERR_Parameter_Wrong_Type", parameter.parameterName, parameterValue.getClass().getName(), "List<?> or Object[]"));<NEW_LINE>}<NEW_LINE>} | " value: " + value + " boundType: " + boundType); |
1,146,648 | static Long fieldChecksum(String data) {<NEW_LINE>data = stripHTMLMedia(data);<NEW_LINE>try {<NEW_LINE>MessageDigest <MASK><NEW_LINE>byte[] digest = md.digest(data.getBytes("UTF-8"));<NEW_LINE>BigInteger biginteger = new BigInteger(1, digest);<NEW_LINE>String result = biginteger.toString(16);<NEW_LINE>// pad checksum to 40 bytes, as is done in the main AnkiDroid code<NEW_LINE>if (result.length() < 40) {<NEW_LINE>String zeroes = "0000000000000000000000000000000000000000";<NEW_LINE>result = zeroes.substring(0, zeroes.length() - result.length()) + result;<NEW_LINE>}<NEW_LINE>return Long.valueOf(result.substring(0, 8), 16);<NEW_LINE>} catch (Exception e) {<NEW_LINE>// This is guaranteed to never happen<NEW_LINE>throw new IllegalStateException("Error making field checksum with SHA1 algorithm and UTF-8 encoding", e);<NEW_LINE>}<NEW_LINE>} | md = MessageDigest.getInstance("SHA1"); |
1,156,104 | public void onActivityCreated(@Nullable Bundle savedInstanceState) {<NEW_LINE>super.onActivityCreated(savedInstanceState);<NEW_LINE>mUseAccountColor = PreferenceManager.getDefaultSharedPreferences(getActivity()).getBoolean(getString(R.string.key_use_account_color), false);<NEW_LINE>mChart.setOnChartValueSelectedListener(this);<NEW_LINE>mChart.setDescription("");<NEW_LINE>// mChart.setDrawValuesForWholeStack(false);<NEW_LINE>mChart.getXAxis().setDrawGridLines(false);<NEW_LINE>mChart.<MASK><NEW_LINE>mChart.getAxisLeft().setStartAtZero(false);<NEW_LINE>mChart.getAxisLeft().enableGridDashedLine(4.0f, 4.0f, 0);<NEW_LINE>mChart.getAxisLeft().setValueFormatter(new LargeValueFormatter(mCommodity.getSymbol()));<NEW_LINE>Legend chartLegend = mChart.getLegend();<NEW_LINE>chartLegend.setForm(Legend.LegendForm.CIRCLE);<NEW_LINE>chartLegend.setPosition(Legend.LegendPosition.BELOW_CHART_CENTER);<NEW_LINE>chartLegend.setWordWrapEnabled(true);<NEW_LINE>} | getAxisRight().setEnabled(false); |
1,527,166 | protected IProject[] build(int kind, Map args, IProgressMonitor monitor) throws CoreException {<NEW_LINE>monitor.subTask("Running SpotBugs...");<NEW_LINE>switch(kind) {<NEW_LINE>case IncrementalProjectBuilder.FULL_BUILD:<NEW_LINE>{<NEW_LINE>FindBugs2Eclipse.cleanClassClache(getProject());<NEW_LINE>if (FindbugsPlugin.getUserPreferences(getProject()).isRunAtFullBuild()) {<NEW_LINE>if (DEBUG) {<NEW_LINE>System.out.println("FULL BUILD");<NEW_LINE>}<NEW_LINE>doBuild(args, monitor, kind);<NEW_LINE>} else {<NEW_LINE>// TODO probably worth to cleanup?<NEW_LINE>// MarkerUtil.removeMarkers(getProject());<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case IncrementalProjectBuilder.INCREMENTAL_BUILD:<NEW_LINE>{<NEW_LINE>if (DEBUG) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>doBuild(args, monitor, kind);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>case IncrementalProjectBuilder.AUTO_BUILD:<NEW_LINE>{<NEW_LINE>if (DEBUG) {<NEW_LINE>System.out.println("AUTO BUILD");<NEW_LINE>}<NEW_LINE>doBuild(args, monitor, kind);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>default:<NEW_LINE>{<NEW_LINE>FindbugsPlugin.getDefault().logWarning("UKNOWN BUILD kind" + kind);<NEW_LINE>doBuild(args, monitor, kind);<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | System.out.println("INCREMENTAL BUILD"); |
964,526 | final UntagResourceResult executeUntagResource(UntagResourceRequest untagResourceRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(untagResourceRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<UntagResourceRequest> request = null;<NEW_LINE>Response<UntagResourceResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new UntagResourceRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(untagResourceRequest));<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, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UntagResource");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UntagResourceResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UntagResourceResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
1,529,779 | public DumpInfo dumpCacheContent() {<NEW_LINE>synchronized (mCountingBitmapCache) {<NEW_LINE>DumpInfo<K, V> dumpInfo = new DumpInfo<>(mCountingBitmapCache.getSizeInBytes(), mCountingBitmapCache.getEvictionQueueSizeInBytes(), mCountingBitmapCache.getMemoryCacheParams());<NEW_LINE>@Nullable<NEW_LINE>CountingLruMap<K, CountingMemoryCache.Entry<K, V>> maybeCachedEntries = mCountingBitmapCache.getCachedEntries();<NEW_LINE>if (maybeCachedEntries == null) {<NEW_LINE>return dumpInfo;<NEW_LINE>}<NEW_LINE>final List<LinkedHashMap.Entry<K, CountingMemoryCache.Entry<K, V>>> cachedEntries = maybeCachedEntries.getMatchingEntries(null);<NEW_LINE>for (LinkedHashMap.Entry<K, CountingMemoryCache.Entry<K, V>> cachedEntry : cachedEntries) {<NEW_LINE>CountingMemoryCache.Entry<K, V> entry = cachedEntry.getValue();<NEW_LINE>DumpInfoEntry<K, V> dumpEntry = new DumpInfoEntry<>(entry.key, entry.valueRef);<NEW_LINE>if (entry.clientCount > 0) {<NEW_LINE><MASK><NEW_LINE>} else {<NEW_LINE>dumpInfo.lruEntries.add(dumpEntry);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>Map<Bitmap, Object> otherEntries = mCountingBitmapCache.getOtherEntries();<NEW_LINE>if (otherEntries != null) {<NEW_LINE>for (Map.Entry<Bitmap, Object> entry : otherEntries.entrySet()) {<NEW_LINE>if (entry != null && !entry.getKey().isRecycled()) {<NEW_LINE>dumpInfo.otherEntries.put(entry.getKey(), entry.getValue());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return dumpInfo;<NEW_LINE>}<NEW_LINE>} | dumpInfo.sharedEntries.add(dumpEntry); |
1,410,887 | final GetDeviceDefinitionVersionResult executeGetDeviceDefinitionVersion(GetDeviceDefinitionVersionRequest getDeviceDefinitionVersionRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(getDeviceDefinitionVersionRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<GetDeviceDefinitionVersionRequest> request = null;<NEW_LINE>Response<GetDeviceDefinitionVersionResult> response = null;<NEW_LINE>try {<NEW_LINE><MASK><NEW_LINE>try {<NEW_LINE>request = new GetDeviceDefinitionVersionRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(getDeviceDefinitionVersionRequest));<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, "Greengrass");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "GetDeviceDefinitionVersion");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<GetDeviceDefinitionVersionResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new GetDeviceDefinitionVersionResultJsonUnmarshaller());<NEW_LINE>response = invoke(request, responseHandler, executionContext);<NEW_LINE>return response.getAwsResponse();<NEW_LINE>} finally {<NEW_LINE>endClientExecution(awsRequestMetrics, request, response);<NEW_LINE>}<NEW_LINE>} | awsRequestMetrics.startEvent(Field.RequestMarshallTime); |
98,228 | public void send(Message message, String destination, YamlContract contract) {<NEW_LINE>mergeMessagePropertiesFromMetadata(contract, message);<NEW_LINE>final String routingKey = message<MASK><NEW_LINE>List<SimpleMessageListenerContainer> listenerContainers = this.messageListenerAccessor.getListenerContainersForDestination(destination, routingKey);<NEW_LINE>if (listenerContainers.isEmpty()) {<NEW_LINE>throw new IllegalStateException("no listeners found for destination " + destination);<NEW_LINE>}<NEW_LINE>for (SimpleMessageListenerContainer listenerContainer : listenerContainers) {<NEW_LINE>Object messageListener = listenerContainer.getMessageListener();<NEW_LINE>if (isChannelAwareListener(listenerContainer, messageListener)) {<NEW_LINE>try {<NEW_LINE>((ChannelAwareMessageListener) messageListener).onMessage(message, createChannel(listenerContainer, transactionalChannel()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>((MessageListener) messageListener).onMessage(message);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | .getMessageProperties().getReceivedRoutingKey(); |
1,778,780 | public void drawObjects(PlatformImage output) {<NEW_LINE>output.create(image.getWidth(), image.getHeight());<NEW_LINE>ImageUtils.log("Columns:", columns.size());<NEW_LINE>ImageUtils.log("Lines:", lines.size());<NEW_LINE>ImageUtils.log("Words:", words.size());<NEW_LINE>for (int y = 0; y < image.getHeight(); y++) {<NEW_LINE>for (int x = 0; x < image.getWidth(); x++) {<NEW_LINE>output.setPixel(x, y, image.getPixel(x, y));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isDrawColums) {<NEW_LINE>for (Column col : columns) {<NEW_LINE>ImageUtils.drawRect(output, col.x1, col.y1, col.x2, col.y2, PlatformImage.GREEN);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (isDrawLines) {<NEW_LINE>for (Line l : lines) {<NEW_LINE>ImageUtils.drawRect(output, l.x1, l.y1, l.x2, l.y2, PlatformImage.RED);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (Word w : words) {<NEW_LINE>if (isDrawChars) {<NEW_LINE>ImageUtils.drawRect(output, w.x1, w.y1, w.x2, w.y2, PlatformImage.BLUE);<NEW_LINE>}<NEW_LINE>int dy = w.y1;<NEW_LINE>ImageUtils.drawRect(output, w.x1 - w.offsetLeft, dy, w.x1, <MASK><NEW_LINE>}<NEW_LINE>for (Word w : wordsLong) {<NEW_LINE>ImageUtils.drawRect(output, w.x1, w.y1, w.x2, w.y2, PlatformImage.MAROON);<NEW_LINE>}<NEW_LINE>} | dy + 2, PlatformImage.YELLOW); |
428,108 | public Parent createContent() {<NEW_LINE>Pane root = new Pane();<NEW_LINE>root.setPrefSize(245, 100);<NEW_LINE>root.setMinSize(Pane.USE_PREF_SIZE, Pane.USE_PREF_SIZE);<NEW_LINE>root.setMaxSize(Pane.USE_PREF_SIZE, Pane.USE_PREF_SIZE);<NEW_LINE>// create rectangle<NEW_LINE>Rectangle rect = new Rectangle(-25, -25, 50, 50);<NEW_LINE>rect.setArcHeight(15);<NEW_LINE>rect.setArcWidth(15);<NEW_LINE>rect.setFill(Color.CRIMSON);<NEW_LINE>rect.setTranslateX(50);<NEW_LINE>rect.setTranslateY(50);<NEW_LINE>root.getChildren().add(rect);<NEW_LINE>// create 4 transitions<NEW_LINE>FadeTransition fade = new FadeTransition(Duration.seconds(1));<NEW_LINE>fade.setFromValue(1);<NEW_LINE>fade.setToValue(0.3);<NEW_LINE>fade.setCycleCount(2);<NEW_LINE>fade.setAutoReverse(true);<NEW_LINE>TranslateTransition translate = new TranslateTransition(Duration.seconds(2));<NEW_LINE>translate.setFromX(50);<NEW_LINE>translate.setToX(220);<NEW_LINE>translate.setCycleCount(2);<NEW_LINE>translate.setAutoReverse(true);<NEW_LINE>RotateTransition rotate = new RotateTransition<MASK><NEW_LINE>rotate.setByAngle(180);<NEW_LINE>rotate.setCycleCount(4);<NEW_LINE>rotate.setAutoReverse(true);<NEW_LINE>ScaleTransition scale = new ScaleTransition(Duration.seconds(2));<NEW_LINE>scale.setToX(2);<NEW_LINE>scale.setToY(2);<NEW_LINE>scale.setCycleCount(2);<NEW_LINE>scale.setAutoReverse(true);<NEW_LINE>// create sequential transition to do 4 transitions one after another<NEW_LINE>sequence = new SequentialTransition(rect, fade, translate, rotate, scale);<NEW_LINE>sequence.setCycleCount(Timeline.INDEFINITE);<NEW_LINE>sequence.setAutoReverse(true);<NEW_LINE>return root;<NEW_LINE>} | (Duration.seconds(2)); |
55,660 | private static String searchBuildNumber(Enumeration<URL> en) {<NEW_LINE>String value = null;<NEW_LINE>try {<NEW_LINE>java.util.jar.Manifest mf;<NEW_LINE>URL u = null;<NEW_LINE>while (en.hasMoreElements()) {<NEW_LINE>u = en.nextElement();<NEW_LINE>InputStream is = u.openStream();<NEW_LINE>mf = new java.<MASK><NEW_LINE>is.close();<NEW_LINE>// #251035: core-base now allows impl dependencies, with manually added impl version. Prefer Build-Version.<NEW_LINE>// NOI18N<NEW_LINE>value = mf.getMainAttributes().getValue("OpenIDE-Module-Build-Version");<NEW_LINE>if (value == null) {<NEW_LINE>// NOI18N<NEW_LINE>value = mf.getMainAttributes().getValue("OpenIDE-Module-Implementation-Version");<NEW_LINE>}<NEW_LINE>if (value != null) {<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>ex.printStackTrace();<NEW_LINE>}<NEW_LINE>return value;<NEW_LINE>} | util.jar.Manifest(is); |
1,654,733 | private void checkExclusions(String groupId, Module module, DependencyVersion version) {<NEW_LINE>Set<String> resolved = getProject().getConfigurations().detachedConfiguration(getProject().getDependencies().create(groupId + ":" + module.getName() + ":" + version)).getResolvedConfiguration().getResolvedArtifacts().stream().map((artifact) -> artifact.getModuleVersion().getId()).map((id) -> id.getGroup() + ":" + id.getModule().getName()).collect(Collectors.toSet());<NEW_LINE>Set<String> exclusions = module.getExclusions().stream().map((exclusion) -> exclusion.getGroupId() + ":" + exclusion.getArtifactId()).<MASK><NEW_LINE>Set<String> unused = new TreeSet<>();<NEW_LINE>for (String exclusion : exclusions) {<NEW_LINE>if (!resolved.contains(exclusion)) {<NEW_LINE>if (exclusion.endsWith(":*")) {<NEW_LINE>String group = exclusion.substring(0, exclusion.indexOf(':') + 1);<NEW_LINE>if (resolved.stream().noneMatch((candidate) -> candidate.startsWith(group))) {<NEW_LINE>unused.add(exclusion);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>unused.add(exclusion);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>exclusions.removeAll(resolved);<NEW_LINE>if (!unused.isEmpty()) {<NEW_LINE>throw new InvalidUserDataException("Unnecessary exclusions on " + groupId + ":" + module.getName() + ": " + exclusions);<NEW_LINE>}<NEW_LINE>} | collect(Collectors.toSet()); |
1,562,110 | private Multi<DbRow> callStatement(MongoDbStatement.MongoStatement mongoStmt, CompletableFuture<Void> statementFuture, CompletableFuture<Long> queryFuture) {<NEW_LINE>final MongoCollection<Document> mc = db().getCollection(mongoStmt.getCollection());<NEW_LINE>final Document query = mongoStmt.getQuery();<NEW_LINE>final Document projection = mongoStmt.getProjection();<NEW_LINE>LOGGER.fine(() -> String.format("Query: %s, Projection: %s", query.toString(), (projection != null ? projection : "N/A")));<NEW_LINE>FindPublisher<Document> publisher = noTx() ? mc.find(query) : mc.find(txManager().tx(), query);<NEW_LINE>if (projection != null) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>return Multi.create(new MongoDbRows<>(clientContext(), publisher, this, DbRow.class, statementFuture, queryFuture).publisher());<NEW_LINE>} | publisher = publisher.projection(projection); |
507,191 | public static void vertical(Kernel1D_F32 kernel, GrayF32 input, GrayF32 output, int skip) {<NEW_LINE>final float[] dataSrc = input.data;<NEW_LINE>final float[] dataDst = output.data;<NEW_LINE>final float[] dataKer = kernel.data;<NEW_LINE>final int radius = kernel.getRadius();<NEW_LINE>final int offset = UtilDownConvolve.computeOffset(skip, radius);<NEW_LINE>final int offsetEnd = UtilDownConvolve.computeMaxSide(input.height, skip, radius) + skip;<NEW_LINE>final int width = input.width;<NEW_LINE>final int height = input.height - input.height % skip;<NEW_LINE>for (int y = 0; y < offset; y += skip) {<NEW_LINE>int indexDest = output.startIndex + (y / skip) * output.stride;<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int indexSrc = input.startIndex + y * input.stride + x;<NEW_LINE>float total = 0;<NEW_LINE>float weight = 0;<NEW_LINE>for (int k = -y; k <= radius; k++) {<NEW_LINE>float w = dataKer[k + radius];<NEW_LINE>weight += w;<NEW_LINE>total += (dataSrc[indexSrc + k * input.stride]) * w;<NEW_LINE>}<NEW_LINE>dataDst[indexDest++] = (total / weight);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (int y = offsetEnd; y < height; y += skip) {<NEW_LINE>int indexDest = output.startIndex + (y / skip) * output.stride;<NEW_LINE>int endKernel = input.height - y - 1;<NEW_LINE>if (endKernel > radius)<NEW_LINE>endKernel = radius;<NEW_LINE>for (int x = 0; x < width; x++) {<NEW_LINE>int indexSrc = input.startIndex + y * input.stride + x;<NEW_LINE>float total = 0;<NEW_LINE>float weight = 0;<NEW_LINE>for (int k = -radius; k <= endKernel; k++) {<NEW_LINE>float w = dataKer[k + radius];<NEW_LINE>weight += w;<NEW_LINE>total += (dataSrc[indexSrc + k * input.stride]) * w;<NEW_LINE>}<NEW_LINE>dataDst[indexDest<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ++] = (total / weight); |
865,240 | private int statfsInternal(String path, Statvfs stbuf) {<NEW_LINE>ClientContext ctx = ClientContext.create(sConf);<NEW_LINE>try (BlockMasterClient blockClient = BlockMasterClient.Factory.create(MasterClientContext.newBuilder(ctx).build())) {<NEW_LINE>Set<BlockMasterInfo.BlockMasterInfoField> blockMasterInfoFilter = new HashSet<>(Arrays.asList(BlockMasterInfo.BlockMasterInfoField.CAPACITY_BYTES, BlockMasterInfo.BlockMasterInfoField.FREE_BYTES, BlockMasterInfo.BlockMasterInfoField.USED_BYTES));<NEW_LINE>BlockMasterInfo blockMasterInfo = blockClient.getBlockMasterInfo(blockMasterInfoFilter);<NEW_LINE>// although user may set different block size for different files,<NEW_LINE>// small block size can result more accurate compute.<NEW_LINE>long blockSize = 4L * Constants.KB;<NEW_LINE>// fs block size<NEW_LINE>// The size in bytes of the minimum unit of allocation on this file system<NEW_LINE>stbuf.f_bsize.set(blockSize);<NEW_LINE>// The preferred length of I/O requests for files on this file system.<NEW_LINE>stbuf.f_frsize.set(blockSize);<NEW_LINE>// total data blocks in fs<NEW_LINE>stbuf.f_blocks.set(blockMasterInfo.getCapacityBytes() / blockSize);<NEW_LINE>// free blocks in fs<NEW_LINE>long freeBlocks = blockMasterInfo.getFreeBytes() / blockSize;<NEW_LINE>stbuf.f_bfree.set(freeBlocks);<NEW_LINE><MASK><NEW_LINE>// inode info in fs<NEW_LINE>// TODO(liuhongtong): support inode info<NEW_LINE>stbuf.f_files.set(UNKNOWN_INODES);<NEW_LINE>stbuf.f_ffree.set(UNKNOWN_INODES);<NEW_LINE>stbuf.f_favail.set(UNKNOWN_INODES);<NEW_LINE>// max file name length<NEW_LINE>stbuf.f_namemax.set(MAX_NAME_LENGTH);<NEW_LINE>} catch (IOException e) {<NEW_LINE>LOG.error("statfs({}) failed:", path, e);<NEW_LINE>return -ErrorCodes.EIO();<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | stbuf.f_bavail.set(freeBlocks); |
851,511 | public TwitLongerStatus postToTwitLonger() {<NEW_LINE>try {<NEW_LINE>HttpClient client = new DefaultHttpClient();<NEW_LINE>HttpPost post = new HttpPost(POST_URL);<NEW_LINE>post.addHeader("X-API-KEY", TWITLONGER_API_KEY);<NEW_LINE>post.addHeader("X-Auth-Service-Provider", SERVICE_PROVIDER);<NEW_LINE>post.addHeader("X-Verify-Credentials-Authorization", getAuthrityHeader(twitter));<NEW_LINE>List<NameValuePair> nvps = new ArrayList<NameValuePair>();<NEW_LINE>nvps.add(new BasicNameValuePair("content", tweetText));<NEW_LINE>if (replyToId != 0) {<NEW_LINE>nvps.add(new BasicNameValuePair("reply_to_id", <MASK><NEW_LINE>} else if (replyToScreenname != null) {<NEW_LINE>nvps.add(new BasicNameValuePair("reply_to_screen_name", replyToScreenname));<NEW_LINE>}<NEW_LINE>post.setEntity(new UrlEncodedFormEntity(nvps, HTTP.UTF_8));<NEW_LINE>HttpResponse response = client.execute(post);<NEW_LINE>BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));<NEW_LINE>String line;<NEW_LINE>String content = "";<NEW_LINE>String id = "";<NEW_LINE>StringBuilder builder = new StringBuilder();<NEW_LINE>while ((line = rd.readLine()) != null) {<NEW_LINE>builder.append(line);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>// there is only going to be one thing returned ever<NEW_LINE>JSONObject jsonObject = new JSONObject(builder.toString());<NEW_LINE>content = jsonObject.getString("tweet_content");<NEW_LINE>id = jsonObject.getString("id");<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>Log.v("talon_twitlonger", "content: " + content);<NEW_LINE>Log.v("talon_twitlonger", "id: " + id);<NEW_LINE>return new TwitLongerStatus(content, id);<NEW_LINE>} catch (Exception e) {<NEW_LINE>e.printStackTrace();<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} | String.valueOf(replyToId))); |
795,454 | public void showProPanel() {<NEW_LINE>logDebug("showProPanel");<NEW_LINE>// Left and Right margin<NEW_LINE>LinearLayout.LayoutParams proTextParams = (LinearLayout.LayoutParams) getProText.getLayoutParams();<NEW_LINE>proTextParams.setMargins(scaleWidthPx(24, outMetrics), scaleHeightPx(23, outMetrics), scaleWidthPx(24, outMetrics), scaleHeightPx(23, outMetrics));<NEW_LINE>getProText.setLayoutParams(proTextParams);<NEW_LINE>rightUpgradeButton.setOnClickListener(this);<NEW_LINE>android.view.ViewGroup.LayoutParams paramsb2 = rightUpgradeButton.getLayoutParams();<NEW_LINE>// Left and Right margin<NEW_LINE>LinearLayout.LayoutParams optionTextParams = (LinearLayout.LayoutParams) rightUpgradeButton.getLayoutParams();<NEW_LINE>optionTextParams.setMargins(scaleWidthPx(6, outMetrics), 0, scaleWidthPx(8, outMetrics), 0);<NEW_LINE>rightUpgradeButton.setLayoutParams(optionTextParams);<NEW_LINE>leftCancelButton.setOnClickListener(this);<NEW_LINE>android.view.ViewGroup.LayoutParams paramsb1 = leftCancelButton.getLayoutParams();<NEW_LINE>leftCancelButton.setLayoutParams(paramsb1);<NEW_LINE>// Left and Right margin<NEW_LINE>LinearLayout.LayoutParams cancelTextParams = (LinearLayout<MASK><NEW_LINE>cancelTextParams.setMargins(scaleWidthPx(6, outMetrics), 0, scaleWidthPx(6, outMetrics), 0);<NEW_LINE>leftCancelButton.setLayoutParams(cancelTextParams);<NEW_LINE>getProLayout.setVisibility(View.VISIBLE);<NEW_LINE>getProLayout.bringToFront();<NEW_LINE>} | .LayoutParams) leftCancelButton.getLayoutParams(); |
1,321,751 | public void marshall(DataSourceParameters dataSourceParameters, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (dataSourceParameters == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getAmazonElasticsearchParameters(), AMAZONELASTICSEARCHPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getAthenaParameters(), ATHENAPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getAuroraParameters(), AURORAPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getAwsIotAnalyticsParameters(), AWSIOTANALYTICSPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getJiraParameters(), JIRAPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getMariaDbParameters(), MARIADBPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getMySqlParameters(), MYSQLPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getOracleParameters(), ORACLEPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getPostgreSqlParameters(), POSTGRESQLPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getPrestoParameters(), PRESTOPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getRdsParameters(), RDSPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getRedshiftParameters(), REDSHIFTPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getS3Parameters(), S3PARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getServiceNowParameters(), SERVICENOWPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getSnowflakeParameters(), SNOWFLAKEPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getSparkParameters(), SPARKPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getSqlServerParameters(), SQLSERVERPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getTeradataParameters(), TERADATAPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getTwitterParameters(), TWITTERPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getAmazonOpenSearchParameters(), AMAZONOPENSEARCHPARAMETERS_BINDING);<NEW_LINE>protocolMarshaller.marshall(dataSourceParameters.getExasolParameters(), EXASOLPARAMETERS_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | dataSourceParameters.getAuroraPostgreSqlParameters(), AURORAPOSTGRESQLPARAMETERS_BINDING); |
1,225,141 | public List<String> expendUnitToIdentity(List<String> unitList) throws Exception {<NEW_LINE>List<String> unitIds = new ArrayList<>();<NEW_LINE>List<String> expendUnitIds = new ArrayList<>();<NEW_LINE>if (ListTools.isNotEmpty(unitList)) {<NEW_LINE>for (String s : unitList) {<NEW_LINE>Unit u = this.unit().pick(s);<NEW_LINE>if (null != u) {<NEW_LINE>unitIds.add(u.getId());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (ListTools.isNotEmpty(unitIds)) {<NEW_LINE>unitIds = ListTools.trim(unitIds, true, true);<NEW_LINE>for (String s : unitIds) {<NEW_LINE>expendUnitIds.add(s);<NEW_LINE>expendUnitIds.addAll(this.unit().listSubNested(s));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>expendUnitIds = ListTools.trim(expendUnitIds, true, true);<NEW_LINE>EntityManager em = this.entityManagerContainer().get(Identity.class);<NEW_LINE>CriteriaBuilder cb = em.getCriteriaBuilder();<NEW_LINE>CriteriaQuery<String> cq = cb.createQuery(String.class);<NEW_LINE>Root<Identity> root = cq.from(Identity.class);<NEW_LINE>Predicate p = root.get(Identity_.unit).in(expendUnitIds);<NEW_LINE>List<String> os = em.createQuery(cq.select(root.get(Identity_.id)).where<MASK><NEW_LINE>os = ListTools.trim(os, true, true);<NEW_LINE>return os;<NEW_LINE>} | (p)).getResultList(); |
1,218,874 | public Visualization makeVisualization(VisualizerContext context, VisualizationTask task, VisualizationPlot plot, double width, double height, Projection proj) {<NEW_LINE>SettingsResult sr = task.getResult();<NEW_LINE>Collection<SettingInformation> settings = sr.getSettings();<NEW_LINE>Element layer = plot.svgElement(SVGConstants.SVG_G_TAG);<NEW_LINE>// FIXME: use CSSClass and StyleLibrary<NEW_LINE>int i = 0;<NEW_LINE>Object last = null;<NEW_LINE>for (SettingInformation setting : settings) {<NEW_LINE>if (setting.owner != last) {<NEW_LINE>Element object = plot.svgText(0, i + 0.7, setting.owner);<NEW_LINE>object.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: 0.6; font-weight: bold");<NEW_LINE>layer.appendChild(object);<NEW_LINE>i++;<NEW_LINE>last = setting.owner;<NEW_LINE>}<NEW_LINE>Element label = plot.svgText(0, i + 0.7, setting.name);<NEW_LINE>label.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: 0.6");<NEW_LINE>layer.appendChild(label);<NEW_LINE>Element vale = plot.svgText(7.5, i + 0.7, setting.value);<NEW_LINE>vale.setAttribute(SVGConstants.SVG_STYLE_ATTRIBUTE, "font-size: 0.6");<NEW_LINE>layer.appendChild(vale);<NEW_LINE>// only advance once, since we want these two to be in the same line.<NEW_LINE>i++;<NEW_LINE>}<NEW_LINE>int cols = Math.max(30, (int) (i * height / width));<NEW_LINE>int rows = i;<NEW_LINE>final double margin = context.getStyleLibrary().getSize(StyleLibrary.MARGIN);<NEW_LINE>final String transform = SVGUtil.makeMarginTransform(width, height, cols, <MASK><NEW_LINE>SVGUtil.setAtt(layer, SVGConstants.SVG_TRANSFORM_ATTRIBUTE, transform);<NEW_LINE>return new StaticVisualizationInstance(context, task, plot, width, height, layer);<NEW_LINE>} | rows, margin / StyleLibrary.SCALE); |
419,912 | public void marshall(CreateRouteRequest createRouteRequest, ProtocolMarshaller protocolMarshaller) {<NEW_LINE>if (createRouteRequest == null) {<NEW_LINE>throw new SdkClientException("Invalid argument passed to marshall(...)");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getClientToken(), CLIENTTOKEN_BINDING);<NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getMeshName(), MESHNAME_BINDING);<NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getMeshOwner(), MESHOWNER_BINDING);<NEW_LINE>protocolMarshaller.marshall(<MASK><NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getSpec(), SPEC_BINDING);<NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getTags(), TAGS_BINDING);<NEW_LINE>protocolMarshaller.marshall(createRouteRequest.getVirtualRouterName(), VIRTUALROUTERNAME_BINDING);<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);<NEW_LINE>}<NEW_LINE>} | createRouteRequest.getRouteName(), ROUTENAME_BINDING); |
608,537 | private void createCheckpoint() {<NEW_LINE>try {<NEW_LINE>Map<WrappedByteArray, WrappedByteArray> batch = new HashMap<>();<NEW_LINE>for (Chainbase db : dbs) {<NEW_LINE>Snapshot head = db.getHead();<NEW_LINE>if (Snapshot.isRoot(head)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>String dbName = db.getDbName();<NEW_LINE>Snapshot next = head.getRoot();<NEW_LINE>for (int i = 0; i < flushCount; ++i) {<NEW_LINE>next = next.getNext();<NEW_LINE>SnapshotImpl snapshot = (SnapshotImpl) next;<NEW_LINE>DB<Key, Value> keyValueDB = snapshot.getDb();<NEW_LINE>for (Map.Entry<Key, Value> e : keyValueDB) {<NEW_LINE><MASK><NEW_LINE>Value v = e.getValue();<NEW_LINE>batch.put(WrappedByteArray.of(Bytes.concat(simpleEncode(dbName), k.getBytes())), WrappedByteArray.of(v.encode()));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>checkTmpStore.getDbSource().updateByBatch(batch.entrySet().stream().map(e -> Maps.immutableEntry(e.getKey().getBytes(), e.getValue().getBytes())).collect(HashMap::new, (m, k) -> m.put(k.getKey(), k.getValue()), HashMap::putAll), WriteOptionsWrapper.getInstance().sync(CommonParameter.getInstance().getStorage().isDbSync()));<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new TronDBException(e);<NEW_LINE>}<NEW_LINE>} | Key k = e.getKey(); |
533,418 | public MineralMix readFromJson(ResourceLocation recipeId, JsonObject json) {<NEW_LINE>JsonArray array = json.getAsJsonArray("ores");<NEW_LINE>List<StackWithChance> tempOres = new ArrayList<>();<NEW_LINE>float totalChance = 0;<NEW_LINE>for (int i = 0; i < array.size(); i++) {<NEW_LINE>JsonObject element = array.get(i).getAsJsonObject();<NEW_LINE>if (CraftingHelper.processConditions(element, "conditions")) {<NEW_LINE>ItemStack stack = readOutput<MASK><NEW_LINE>float chance = GsonHelper.getAsFloat(element, "chance");<NEW_LINE>totalChance += chance;<NEW_LINE>tempOres.add(new StackWithChance(stack, chance));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>float finalTotalChance = totalChance;<NEW_LINE>StackWithChance[] ores = tempOres.stream().map(stack -> stack.recalculate(finalTotalChance)).toArray(StackWithChance[]::new);<NEW_LINE>int weight = GsonHelper.getAsInt(json, "weight");<NEW_LINE>float failChance = GsonHelper.getAsFloat(json, "fail_chance", 0);<NEW_LINE>array = json.getAsJsonArray("dimensions");<NEW_LINE>List<ResourceKey<Level>> dimensions = new ArrayList<>();<NEW_LINE>for (int i = 0; i < array.size(); i++) dimensions.add(ResourceKey.create(Registry.DIMENSION_REGISTRY, new ResourceLocation(array.get(i).getAsString())));<NEW_LINE>ResourceLocation rl = new ResourceLocation(GsonHelper.getAsString(json, "sample_background", "minecraft:stone"));<NEW_LINE>Block b = ForgeRegistries.BLOCKS.getValue(rl);<NEW_LINE>if (b == Blocks.AIR)<NEW_LINE>b = Blocks.STONE;<NEW_LINE>return new MineralMix(recipeId, ores, weight, failChance, dimensions, b);<NEW_LINE>} | (element.get("output")); |
1,826,480 | public void onUncaughtException(Connection connection, Throwable error) {<NEW_LINE>if (error instanceof RedirectClientException) {<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(format(connection.channel(), "The request will be redirected"));<NEW_LINE>}<NEW_LINE>HttpClientOperations ops = connection.as(HttpClientOperations.class);<NEW_LINE>if (ops != null && handler.redirectRequestBiConsumer != null) {<NEW_LINE>handler.previousRequestHeaders = ops.requestHeaders;<NEW_LINE>}<NEW_LINE>} else if (handler.shouldRetry && AbortedException.isConnectionReset(error)) {<NEW_LINE>HttpClientOperations ops = connection.as(HttpClientOperations.class);<NEW_LINE>if (ops != null && ops.hasSentHeaders()) {<NEW_LINE>// In some cases the channel close event may be delayed and thus the connection to be<NEW_LINE>// returned to the pool and later the eviction functionality to remote it from the pool.<NEW_LINE>// In some rare cases the connection might be acquired immediately, before the channel close<NEW_LINE>// event and the eviction functionality be able to remove it from the pool, this may lead to I/O<NEW_LINE>// errors.<NEW_LINE>// Mark the connection as non-persistent here so that it is never returned to the pool and leave<NEW_LINE>// the channel close event to invalidate it.<NEW_LINE>ops.markPersistent(false);<NEW_LINE>// Disable retry if the headers or/and the body were sent<NEW_LINE>handler.shouldRetry = false;<NEW_LINE>if (log.isWarnEnabled()) {<NEW_LINE>log.warn(format(connection.channel(), "The connection observed an error, the request cannot be " + "retried as the headers/body were sent"), error);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>if (ops != null) {<NEW_LINE>// In some cases the channel close event may be delayed and thus the connection to be<NEW_LINE>// returned to the pool and later the eviction functionality to remote it from the pool.<NEW_LINE>// In some rare cases the connection might be acquired immediately, before the channel close<NEW_LINE>// event and the eviction functionality be able to remove it from the pool, this may lead to I/O<NEW_LINE>// errors.<NEW_LINE>// Mark the connection as non-persistent here so that it is never returned to the pool and leave<NEW_LINE>// the channel close event to invalidate it.<NEW_LINE>ops.markPersistent(false);<NEW_LINE>ops.retrying = true;<NEW_LINE>}<NEW_LINE>if (log.isDebugEnabled()) {<NEW_LINE>log.debug(format(connection.channel(), "The connection observed an error, the request will be retried"), error);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else if (log.isWarnEnabled()) {<NEW_LINE>log.warn(format(connection.channel<MASK><NEW_LINE>}<NEW_LINE>sink.error(error);<NEW_LINE>} | (), "The connection observed an error"), error); |
1,781,169 | private void definePackage(String name, ResourceEntry entry) {<NEW_LINE>// Looking up the package<NEW_LINE>String packageName = null;<NEW_LINE>int <MASK><NEW_LINE>if (pos != -1) {<NEW_LINE>packageName = name.substring(0, pos);<NEW_LINE>}<NEW_LINE>Package pkg = null;<NEW_LINE>if (packageName != null) {<NEW_LINE>// START OF IASRI 4717252<NEW_LINE>synchronized (loaderPC) {<NEW_LINE>// END OF IASRI 4717252<NEW_LINE>pkg = getPackage(packageName);<NEW_LINE>// Define the package (if null)<NEW_LINE>if (pkg == null) {<NEW_LINE>if (entry.manifest == null) {<NEW_LINE>definePackage(packageName, null, null, null, null, null, null, null);<NEW_LINE>} else {<NEW_LINE>definePackage(packageName, entry.manifest, entry.codeBase);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// START OF IASRI 4717252<NEW_LINE>}<NEW_LINE>// END OF IASRI 4717252<NEW_LINE>}<NEW_LINE>if (securityManager != null) {<NEW_LINE>// Checking sealing<NEW_LINE>if (pkg != null) {<NEW_LINE>boolean sealCheck;<NEW_LINE>if (pkg.isSealed()) {<NEW_LINE>sealCheck = pkg.isSealed(entry.codeBase);<NEW_LINE>} else {<NEW_LINE>sealCheck = (entry.manifest == null) || !isPackageSealed(packageName, entry.manifest);<NEW_LINE>}<NEW_LINE>if (!sealCheck) {<NEW_LINE>throw new SecurityException("Sealing violation loading " + name + " : Package " + packageName + " is sealed.");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | pos = name.lastIndexOf('.'); |
1,601,019 | public void resolve() {<NEW_LINE>int startingTypeIndex = 0;<NEW_LINE>boolean isPackageInfo = isPackageInfo();<NEW_LINE>boolean isModuleInfo = isModuleInfo();<NEW_LINE>if (this.types != null && isPackageInfo) {<NEW_LINE>// resolve synthetic type declaration<NEW_LINE>final TypeDeclaration syntheticTypeDeclaration = this.types[0];<NEW_LINE>// set empty javadoc to avoid missing warning (see bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=95286)<NEW_LINE>if (syntheticTypeDeclaration.javadoc == null) {<NEW_LINE>syntheticTypeDeclaration.javadoc = new Javadoc(syntheticTypeDeclaration.declarationSourceStart, syntheticTypeDeclaration.declarationSourceStart);<NEW_LINE>}<NEW_LINE>syntheticTypeDeclaration.resolve(this.scope);<NEW_LINE>if (this.javadoc != null && syntheticTypeDeclaration.staticInitializerScope != null) {<NEW_LINE>this.javadoc.resolve(syntheticTypeDeclaration.staticInitializerScope);<NEW_LINE>}<NEW_LINE>startingTypeIndex = 1;<NEW_LINE>} else if (this.moduleDeclaration != null && isModuleInfo) {<NEW_LINE>if (this.javadoc != null) {<NEW_LINE>this.javadoc.resolve(this.moduleDeclaration.scope);<NEW_LINE>} else if (this.moduleDeclaration.binding != null) {<NEW_LINE>ProblemReporter reporter = this.scope.problemReporter();<NEW_LINE>int severity = reporter.computeSeverity(IProblem.JavadocMissing);<NEW_LINE>if (severity != ProblemSeverities.Ignore) {<NEW_LINE>reporter.javadocModuleMissing(this.moduleDeclaration.declarationSourceStart, this.moduleDeclaration.bodyStart, severity);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// resolve compilation unit javadoc package if any<NEW_LINE>if (this.javadoc != null) {<NEW_LINE>this.javadoc.resolve(this.scope);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (this.currentPackage != null && this.currentPackage.annotations != null && !isPackageInfo) {<NEW_LINE>this.scope.problemReporter().invalidFileNameForPackageAnnotations(this<MASK><NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (this.types != null) {<NEW_LINE>for (int i = startingTypeIndex, count = this.types.length; i < count; i++) {<NEW_LINE>this.types[i].resolve(this.scope);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!this.compilationResult.hasMandatoryErrors())<NEW_LINE>checkUnusedImports();<NEW_LINE>reportNLSProblems();<NEW_LINE>} catch (AbortCompilationUnit e) {<NEW_LINE>this.ignoreFurtherInvestigation = true;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} | .currentPackage.annotations[0]); |
262,205 | private synchronized ITypeBinding internalGetTypeBinding(org.eclipse.jdt.internal.compiler.lookup.TypeBinding referenceBinding, IBinding declaringMember) {<NEW_LINE>// may also create an TypeBinding.AnonymousTypeBinding<NEW_LINE>if (referenceBinding == null) {<NEW_LINE>return null;<NEW_LINE>} else if (!referenceBinding.isValidBinding()) {<NEW_LINE>switch(referenceBinding.problemId()) {<NEW_LINE>case ProblemReasons.NotVisible:<NEW_LINE>case ProblemReasons.NonStaticReferenceInStaticContext:<NEW_LINE>if (referenceBinding instanceof ProblemReferenceBinding) {<NEW_LINE>ProblemReferenceBinding problemReferenceBinding = (ProblemReferenceBinding) referenceBinding;<NEW_LINE>org.eclipse.jdt.internal.compiler.lookup.TypeBinding binding2 = problemReferenceBinding.closestMatch();<NEW_LINE>ITypeBinding binding = (ITypeBinding) this.<MASK><NEW_LINE>if (binding != null) {<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>binding = TypeBinding.createTypeBinding(this, binding2, declaringMember);<NEW_LINE>this.bindingTables.compilerBindingsToASTBindings.put(binding2, binding);<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>case ProblemReasons.NotFound:<NEW_LINE>if (!this.isRecoveringBindings) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(referenceBinding);<NEW_LINE>if (binding != null) {<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0) {<NEW_LINE>binding = TypeBinding.createTypeBinding(this, referenceBinding, declaringMember);<NEW_LINE>} else {<NEW_LINE>binding = new RecoveredTypeBinding(this, referenceBinding);<NEW_LINE>}<NEW_LINE>this.bindingTables.compilerBindingsToASTBindings.put(referenceBinding, binding);<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>return null;<NEW_LINE>} else {<NEW_LINE>if ((referenceBinding.tagBits & TagBits.HasMissingType) != 0 && !this.isRecoveringBindings) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>ITypeBinding binding = (ITypeBinding) this.bindingTables.compilerBindingsToASTBindings.get(referenceBinding);<NEW_LINE>if (binding != null) {<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>binding = TypeBinding.createTypeBinding(this, referenceBinding, declaringMember);<NEW_LINE>this.bindingTables.compilerBindingsToASTBindings.put(referenceBinding, binding);<NEW_LINE>return binding;<NEW_LINE>}<NEW_LINE>} | bindingTables.compilerBindingsToASTBindings.get(binding2); |
457,495 | private void initTableNameMappings(Collection<TableRule> tableRules, Map<String, Set<String>> tableNameMappings, List<String> groupNames) {<NEW_LINE>for (TableRule tableRule : tableRules) {<NEW_LINE>String logicalTableName = tableRule.getVirtualTbName();<NEW_LINE>if ((tableRule.getDbPartitionKeys() == null || tableRule.getDbPartitionKeys().isEmpty()) && (tableRule.getTbPartitionKeys() == null || tableRule.getTbPartitionKeys().isEmpty())) {<NEW_LINE>// The group and physical table names are incomplete in the<NEW_LINE>// topology for single or broadcast table, so we have to build<NEW_LINE>// them manually.<NEW_LINE>for (String groupName : groupNames) {<NEW_LINE>// The physical table has the same name as the logical<NEW_LINE>// table.<NEW_LINE>addGroupAndPhysicalTableName(groupName + "." + tableRule.getTbNamePattern(), logicalTableName, tableNameMappings);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>// We can get all group and physical table names from the<NEW_LINE>// topology for sharding table.<NEW_LINE>Map<String, Set<String>> topology = tableRule.getActualTopology();<NEW_LINE>for (Entry<String, Set<String>> groupAndPhyTableNames : topology.entrySet()) {<NEW_LINE>String groupName = groupAndPhyTableNames.getKey();<NEW_LINE>for (String physicalTableName : groupAndPhyTableNames.getValue()) {<NEW_LINE>addGroupAndPhysicalTableName(groupName + <MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | "." + physicalTableName, logicalTableName, tableNameMappings); |
290,793 | public long[][] transformToLongValuesMV(ProjectionBlock projectionBlock) {<NEW_LINE>if (_longResultMV == null) {<NEW_LINE>_longResultMV = new long[DocIdSetPlanNode.MAX_DOC_PER_CALL][];<NEW_LINE>}<NEW_LINE>for (int i = 0; i < _numGroovyArgs; i++) {<NEW_LINE>_sourceArrays[i] = _transformToValuesFunctions[i].apply(_groovyArguments[i], projectionBlock);<NEW_LINE>}<NEW_LINE>int length = projectionBlock.getNumDocs();<NEW_LINE>for (int i = 0; i < length; i++) {<NEW_LINE>for (int j = 0; j < _numGroovyArgs; j++) {<NEW_LINE>_bindingValues[j] = _fetchElementFunctions[j].apply(_sourceArrays[j], i);<NEW_LINE>}<NEW_LINE>Object result = _groovyFunctionEvaluator.evaluate(_bindingValues);<NEW_LINE>if (result instanceof List) {<NEW_LINE>_longResultMV[i] = new LongArrayList((List<Long>) result).toLongArray();<NEW_LINE>} else if (result instanceof long[]) {<NEW_LINE>_longResultMV[i<MASK><NEW_LINE>} else {<NEW_LINE>throw new IllegalStateException("Unexpected result type '" + result.getClass() + "' for GROOVY function");<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return _longResultMV;<NEW_LINE>} | ] = (long[]) result; |
10,915 | public BranchRegisterResponseProto convert2Proto(BranchRegisterResponse branchRegisterResponse) {<NEW_LINE>final short typeCode = branchRegisterResponse.getTypeCode();<NEW_LINE>final AbstractMessageProto abstractMessage = AbstractMessageProto.newBuilder().setMessageType(MessageTypeProto.forNumber(typeCode)).build();<NEW_LINE>final String msg = branchRegisterResponse.getMsg();<NEW_LINE>final AbstractResultMessageProto abstractResultMessageProto = AbstractResultMessageProto.newBuilder().setMsg(msg == null ? "" : msg).setResultCode(ResultCodeProto.valueOf(branchRegisterResponse.getResultCode().name())).<MASK><NEW_LINE>AbstractTransactionResponseProto abstractTransactionResponseProto = AbstractTransactionResponseProto.newBuilder().setAbstractResultMessage(abstractResultMessageProto).setTransactionExceptionCode(TransactionExceptionCodeProto.valueOf(branchRegisterResponse.getTransactionExceptionCode().name())).build();<NEW_LINE>BranchRegisterResponseProto result = BranchRegisterResponseProto.newBuilder().setAbstractTransactionResponse(abstractTransactionResponseProto).setBranchId(branchRegisterResponse.getBranchId()).build();<NEW_LINE>return result;<NEW_LINE>} | setAbstractMessage(abstractMessage).build(); |
865,939 | public // & assumes that this is run on Opened Object<NEW_LINE>void request(final Message message, final OperationResult<Message, Exception> onResponse) {<NEW_LINE>if (message == null) {<NEW_LINE>throw new IllegalArgumentException("message cannot be null.");<NEW_LINE>}<NEW_LINE>if (message.getMessageId() != null) {<NEW_LINE>throw new IllegalArgumentException("message.getMessageId() should be null");<NEW_LINE>}<NEW_LINE>if (message.getReplyTo() != null) {<NEW_LINE>throw new IllegalArgumentException("message.getReplyTo() should be null");<NEW_LINE>}<NEW_LINE>message.setMessageId("request" + UnsignedLong.valueOf(this.requestId.incrementAndGet()).toString());<NEW_LINE>message.setReplyTo(this.replyTo);<NEW_LINE>this.inflightRequests.put(message.getMessageId(), onResponse);<NEW_LINE>sendLink.delivery(UUID.randomUUID().toString().replace("-", StringUtil.EMPTY).getBytes(UTF_8));<NEW_LINE>int payloadSize = 0;<NEW_LINE>try {<NEW_LINE>// need buffer for headers<NEW_LINE>payloadSize = <MASK><NEW_LINE>} catch (EventHubException e) {<NEW_LINE>// This is an internal message under our control. If one of the properties on it has<NEW_LINE>// a null key, that's a code bug in the client, which we don't want to hide. Turn this<NEW_LINE>// exception into an NPE and let it bubble up.<NEW_LINE>throw new NullPointerException(e.getMessage());<NEW_LINE>}<NEW_LINE>final byte[] bytes = new byte[payloadSize];<NEW_LINE>final int encodedSize = message.encode(bytes, 0, payloadSize);<NEW_LINE>receiveLink.flow(1);<NEW_LINE>sendLink.send(bytes, 0, encodedSize);<NEW_LINE>sendLink.advance();<NEW_LINE>} | AmqpUtil.getDataSerializedSize(message) + 512; |
1,567,143 | private boolean tryFillOutputBuffer() {<NEW_LINE>try {<NEW_LINE>// header size + slot for writtenCount<NEW_LINE>outputBuffer.<MASK><NEW_LINE>int writtenCount = 0;<NEW_LINE>for (Object item; outputBuffer.position() < packetSizeLimit && isWithinLimit(sentSeq, sendSeqLimitCompressed) && (item = inbox.poll()) != null; writtenCount++) {<NEW_LINE>ObjectWithPartitionId itemWithPId = item instanceof ObjectWithPartitionId ? (ObjectWithPartitionId) item : new ObjectWithPartitionId(item, -1);<NEW_LINE>final int mark = outputBuffer.position();<NEW_LINE>outputBuffer.writeObject(itemWithPId.getItem());<NEW_LINE>sentSeq += estimatedMemoryFootprint(outputBuffer.position() - mark);<NEW_LINE>outputBuffer.writeInt(itemWithPId.getPartitionId());<NEW_LINE>}<NEW_LINE>outputBuffer.writeInt(bufPosPastHeader, writtenCount);<NEW_LINE>bytesOutCounter.inc(outputBuffer.position());<NEW_LINE>itemsOutCounter.inc(writtenCount);<NEW_LINE>return writtenCount > 0;<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw rethrow(e);<NEW_LINE>}<NEW_LINE>} | position(bufPosPastHeader + Bits.INT_SIZE_IN_BYTES); |
1,162,636 | private void readAssocOne(DeployBeanPropertyAssoc<?> prop) {<NEW_LINE>readJsonAnnotations(prop);<NEW_LINE>if (has(prop, Id.class)) {<NEW_LINE>readIdAssocOne(prop);<NEW_LINE>}<NEW_LINE>if (has(prop, EmbeddedId.class)) {<NEW_LINE>prop.setId();<NEW_LINE>prop.setNullable(false);<NEW_LINE>prop.setEmbedded();<NEW_LINE>info.setEmbeddedId(prop);<NEW_LINE>}<NEW_LINE>DocEmbedded docEmbedded = get(prop, DocEmbedded.class);<NEW_LINE>if (docEmbedded != null) {<NEW_LINE>prop.setDocStoreEmbedded(docEmbedded.doc());<NEW_LINE>if (descriptor.isDocStoreOnly()) {<NEW_LINE>if (has(prop, ManyToOne.class)) {<NEW_LINE>prop.setEmbedded();<NEW_LINE>prop.setDbInsertable(true);<NEW_LINE>prop.setDbUpdateable(true);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (prop instanceof DeployBeanPropertyAssocOne<?>) {<NEW_LINE>if (prop.isId() && !prop.isEmbedded()) {<NEW_LINE>prop.setEmbedded();<NEW_LINE>}<NEW_LINE>readEmbeddedAttributeOverrides((DeployBeanPropertyAssocOne<?>) prop);<NEW_LINE>}<NEW_LINE>Formula formula = prop.getMetaAnnotationFormula(platform);<NEW_LINE>if (formula != null) {<NEW_LINE>prop.setSqlFormula(processFormula(formula.select()), processFormula<MASK><NEW_LINE>}<NEW_LINE>initWhoProperties(prop);<NEW_LINE>initDbMigration(prop);<NEW_LINE>} | (formula.join())); |
1,015,119 | public void run() {<NEW_LINE>Status _status = null;<NEW_LINE>synchronized (node) {<NEW_LINE>_status = node.status;<NEW_LINE>}<NEW_LINE>if (_status == null) {<NEW_LINE>FileObject jf = node.getDataObject().getPrimaryFile();<NEW_LINE>_status = FileBuiltQuery.getStatus(jf);<NEW_LINE>synchronized (node) {<NEW_LINE>if (_status != null && node.status == null) {<NEW_LINE>node.status = _status;<NEW_LINE>node.status.addChangeListener(WeakListeners.change(node, node.status));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>boolean isPackageInfo = "package-info.java".equals(node.getDataObject().getPrimaryFile().getNameExt());<NEW_LINE>boolean newIsCompiled = _status != null && !isPackageInfo ? _status.isBuilt() : true;<NEW_LINE>boolean oldIsCompiled = node.isCompiled.getAndSet(newIsCompiled ? null : // NOI18N<NEW_LINE>getImage(// NOI18N<NEW_LINE>NEEDS_COMPILE_BADGE_URL, "<img src=\"{0}\"> " + getMessage(JavaNode.<MASK><NEW_LINE>if (newIsCompiled != oldIsCompiled) {<NEW_LINE>node.fireIconChange();<NEW_LINE>node.fireOpenedIconChange();<NEW_LINE>}<NEW_LINE>} | class, "TP_NeedsCompileBadge"))) == null; |
923,337 | public void onSuccess(ComponentImportResponse response) {<NEW_LINE>if (response.getStatus() == ComponentImportResponse.Status.FAILED) {<NEW_LINE>Window.alert(MESSAGES.componentImportError() + "\n" + response.getMessage());<NEW_LINE>return;<NEW_LINE>} else if (response.getStatus() != ComponentImportResponse.Status.IMPORTED && response.getStatus() != ComponentImportResponse.Status.UPGRADED) {<NEW_LINE>Window.alert(MESSAGES.componentImportError());<NEW_LINE>return;<NEW_LINE>} else if (response.getStatus() == ComponentImportResponse.Status.UNKNOWN_URL) {<NEW_LINE>Window.alert(MESSAGES.componentImportUnknownURLError());<NEW_LINE>} else if (response.getStatus() == ComponentImportResponse.Status.UPGRADED) {<NEW_LINE>StringBuilder sb = new StringBuilder(MESSAGES.componentUpgradedAlert());<NEW_LINE>for (String name : response.getComponentTypes().values()) {<NEW_LINE>sb.append("\n");<NEW_LINE>sb.append(name);<NEW_LINE>}<NEW_LINE>Window.alert(sb.toString());<NEW_LINE>}<NEW_LINE>List<ProjectNode> compNodes = response.getNodes();<NEW_LINE>long destinationProjectId = response.getProjectId();<NEW_LINE>long currentProjectId = ode.getCurrentYoungAndroidProjectId();<NEW_LINE>if (currentProjectId != destinationProjectId) {<NEW_LINE>// User switched project early!<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>Project project = ode.getProjectManager().getProject(destinationProjectId);<NEW_LINE>if (project == null) {<NEW_LINE>// Project does not exist!<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>if (response.getStatus() == ComponentImportResponse.Status.UPGRADED || response.getStatus() == ComponentImportResponse.Status.IMPORTED) {<NEW_LINE>YoungAndroidComponentsFolder componentsFolder = ((YoungAndroidProjectNode) project.getRootNode()).getComponentsFolder();<NEW_LINE>YaProjectEditor projectEditor = (YaProjectEditor) ode.getEditorManager().getOpenProjectEditor(destinationProjectId);<NEW_LINE>if (projectEditor == null) {<NEW_LINE>// Project is not open!<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>for (ProjectNode node : compNodes) {<NEW_LINE>project.addNode(componentsFolder, node);<NEW_LINE>if ((node.getName().equals("component.json") || node.getName().equals("components.json")) && StringUtils.countMatches(node.getFileId(), "/") == 3) {<NEW_LINE><MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | projectEditor.addComponent(node, null); |
58,970 | public MemberSelectTree buildIteratorMethodAccess(ExpressionTree iterableExpr) {<NEW_LINE>DeclaredType exprType = (DeclaredType) TypesUtils.upperBound(TreeUtils.typeOf(iterableExpr));<NEW_LINE>assert exprType != null : "expression must be of declared type Iterable<>";<NEW_LINE>TypeElement exprElement = (TypeElement) exprType.asElement();<NEW_LINE>// Find the iterator() method of the iterable type<NEW_LINE>Symbol.MethodSymbol iteratorMethod = null;<NEW_LINE>for (ExecutableElement method : ElementFilter.methodsIn(elements.getAllMembers(exprElement))) {<NEW_LINE>if (method.getParameters().isEmpty() && method.getSimpleName().contentEquals("iterator")) {<NEW_LINE>iteratorMethod = (Symbol.MethodSymbol) method;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>assert iteratorMethod != null : "@AssumeAssertion(nullness): no iterator method declared for expression type";<NEW_LINE>Type.MethodType methodType = (Type.MethodType) iteratorMethod.asType();<NEW_LINE>Symbol.TypeSymbol methodClass = methodType.asElement();<NEW_LINE>DeclaredType iteratorType = (DeclaredType) methodType.getReturnType();<NEW_LINE>iteratorType = (DeclaredType) javacTypes.asSuper((Type) iteratorType, <MASK><NEW_LINE>int numIterTypeArgs = iteratorType.getTypeArguments().size();<NEW_LINE>assert numIterTypeArgs <= 1 : "expected at most one type argument for Iterator";<NEW_LINE>if (numIterTypeArgs == 1) {<NEW_LINE>TypeMirror elementType = iteratorType.getTypeArguments().get(0);<NEW_LINE>// Remove captured type variable from a wildcard.<NEW_LINE>if (elementType instanceof Type.CapturedType) {<NEW_LINE>elementType = ((Type.CapturedType) elementType).wildcard;<NEW_LINE>iteratorType = modelTypes.getDeclaredType((TypeElement) modelTypes.asElement(iteratorType), elementType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// Replace the iterator method's generic return type with<NEW_LINE>// the actual element type of the expression.<NEW_LINE>Type.MethodType updatedMethodType = new Type.MethodType(com.sun.tools.javac.util.List.nil(), (Type) iteratorType, com.sun.tools.javac.util.List.nil(), methodClass);<NEW_LINE>JCTree.JCFieldAccess iteratorAccess = (JCTree.JCFieldAccess) maker.Select((JCTree.JCExpression) iterableExpr, iteratorMethod);<NEW_LINE>iteratorAccess.setType(updatedMethodType);<NEW_LINE>return iteratorAccess;<NEW_LINE>} | symtab.iteratorType.asElement()); |
1,818,826 | public static Validated build(String pattern, @Nullable String metadataPattern) {<NEW_LINE>Matcher matcher = X_RANGE_PATTERN.matcher(pattern);<NEW_LINE>if (!matcher.matches() || !(pattern.contains("x") || pattern.contains("X") || pattern.contains("*"))) {<NEW_LINE>return Validated.invalid("xRange", pattern, "not an x-range");<NEW_LINE>}<NEW_LINE>String major = normalizeWildcard(matcher.group(1));<NEW_LINE>String minor = normalizeWildcard(matcher.group(2) == null ? "0" <MASK><NEW_LINE>String patch = normalizeWildcard(matcher.group(3) == null ? "0" : matcher.group(3));<NEW_LINE>String micro = normalizeWildcard(matcher.group(4) == null ? "0" : matcher.group(4));<NEW_LINE>if ("*".equals(major) && (matcher.group(2) != null || matcher.group(3) != null || matcher.group(4) != null)) {<NEW_LINE>return Validated.invalid("xRange", pattern, "not an x-range: nothing can follow a wildcard");<NEW_LINE>} else if ("*".equals(minor) && (matcher.group(3) != null || matcher.group(4) != null)) {<NEW_LINE>return Validated.invalid("xRange", pattern, "not an x-range: nothing can follow a wildcard");<NEW_LINE>} else if ("*".equals(patch) && matcher.group(4) != null) {<NEW_LINE>return Validated.invalid("xRange", pattern, "not an x-range: nothing can follow a wildcard");<NEW_LINE>}<NEW_LINE>return Validated.valid("xRange", new XRange(major, minor, patch, micro, metadataPattern));<NEW_LINE>} | : matcher.group(2)); |
1,230,552 | public DevicePosition unmarshall(JsonUnmarshallerContext context) throws Exception {<NEW_LINE>AwsJsonReader reader = context.getReader();<NEW_LINE>if (!reader.isContainer()) {<NEW_LINE>reader.skipValue();<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>DevicePosition devicePosition = new DevicePosition();<NEW_LINE>reader.beginObject();<NEW_LINE>while (reader.hasNext()) {<NEW_LINE>String name = reader.nextName();<NEW_LINE>if (name.equals("Accuracy")) {<NEW_LINE>devicePosition.setAccuracy(PositionalAccuracyJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("DeviceId")) {<NEW_LINE>devicePosition.setDeviceId(StringJsonUnmarshaller.getInstance().unmarshall(context));<NEW_LINE>} else if (name.equals("Position")) {<NEW_LINE>devicePosition.setPosition(new ListUnmarshaller<Double>(DoubleJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>} else if (name.equals("PositionProperties")) {<NEW_LINE>devicePosition.setPositionProperties(new MapUnmarshaller<String>(StringJsonUnmarshaller.getInstance()).unmarshall(context));<NEW_LINE>} else if (name.equals("ReceivedTime")) {<NEW_LINE>devicePosition.setReceivedTime(DateJsonUnmarshaller.getInstance(TimestampFormat.<MASK><NEW_LINE>} else if (name.equals("SampleTime")) {<NEW_LINE>devicePosition.setSampleTime(DateJsonUnmarshaller.getInstance(TimestampFormat.ISO_8601).unmarshall(context));<NEW_LINE>} else {<NEW_LINE>reader.skipValue();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>reader.endObject();<NEW_LINE>return devicePosition;<NEW_LINE>} | ISO_8601).unmarshall(context)); |
236,942 | // rbDelete().<NEW_LINE>void move(AbstractTreeMap.Entry x, AbstractTreeMap.Entry y) throws ObjectManagerException {<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, "move", new Object<MASK><NEW_LINE>Entry yParent = (Entry) y.getParent();<NEW_LINE>// Set x into the position occupied by y.<NEW_LINE>x.setParent(yParent);<NEW_LINE>if (yParent == null)<NEW_LINE>setRoot(x);<NEW_LINE>else if (yParent.getRight() == y)<NEW_LINE>yParent.setRight(x);<NEW_LINE>else<NEW_LINE>yParent.setLeft(x);<NEW_LINE>x.setLeft(y.getLeft());<NEW_LINE>x.setRight(y.getRight());<NEW_LINE>// Set the x to be the parent of y's children.<NEW_LINE>if (y.getLeft() != null)<NEW_LINE>y.getLeft().setParent(x);<NEW_LINE>if (y.getRight() != null)<NEW_LINE>y.getRight().setParent(x);<NEW_LINE>x.setColor(y.getColor());<NEW_LINE>if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())<NEW_LINE>trace.exit(this, cclass, "move", new Object[] { x });<NEW_LINE>} | [] { x, y }); |
454,188 | public void run(RegressionEnvironment env) {<NEW_LINE>String stmtText = "@name('s0') select * from SupportMarketDataBean#length(5) order by symbol, volume";<NEW_LINE>env.compileDeploy(stmtText).addListener("s0");<NEW_LINE>env.assertIterator("s0", it -> assertFalse(it.hasNext()));<NEW_LINE>Object eventOne = sendEvent(env, "SYM", 1);<NEW_LINE>assertIterator(env, new Object[] { eventOne });<NEW_LINE>Object eventTwo = sendEvent(env, "OCC", 2);<NEW_LINE>assertIterator(env, new Object[] { eventTwo, eventOne });<NEW_LINE>Object eventThree = sendEvent(env, "TOC", 3);<NEW_LINE>assertIterator(env, new Object[] { eventTwo, eventOne, eventThree });<NEW_LINE>Object eventFour = <MASK><NEW_LINE>assertIterator(env, new Object[] { eventTwo, eventFour, eventOne, eventThree });<NEW_LINE>Object eventFive = sendEvent(env, "SYM", 10);<NEW_LINE>assertIterator(env, new Object[] { eventTwo, eventFour, eventOne, eventFive, eventThree });<NEW_LINE>Object eventSix = sendEvent(env, "SYM", 4);<NEW_LINE>assertIterator(env, new Object[] { eventTwo, eventFour, eventSix, eventFive, eventThree });<NEW_LINE>env.undeployAll();<NEW_LINE>} | sendEvent(env, "SYM", 0); |
352,399 | final UpdateAssetResult executeUpdateAsset(UpdateAssetRequest updateAssetRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(updateAssetRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE><MASK><NEW_LINE>Request<UpdateAssetRequest> request = null;<NEW_LINE>Response<UpdateAssetResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new UpdateAssetRequestProtocolMarshaller(protocolFactory).marshall(super.beforeMarshalling(updateAssetRequest));<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, "DataExchange");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "UpdateAsset");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<UpdateAssetResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new UpdateAssetResultJsonUnmarshaller());<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,316,828 | public void onGroupItemLongClick(int position, int groupPosition, View view) {<NEW_LINE>if (getActivity() == null)<NEW_LINE>return;<NEW_LINE>FindKindGroupBean groupBean;<NEW_LINE>if (isFlexBox()) {<NEW_LINE>groupBean = (FindKindGroupBean) findRightAdapter.getData().get(groupPosition).getGroupData();<NEW_LINE>} else {<NEW_LINE>groupBean = (FindKindGroupBean) findKindAdapter.getAllDatas().get(groupPosition).getGroupData();<NEW_LINE>}<NEW_LINE>BookSourceBean sourceBean = BookSourceManager.getBookSourceByUrl(groupBean.getGroupTag());<NEW_LINE>if (sourceBean == null) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>PopupMenu popupMenu = new PopupMenu(getContext(), view);<NEW_LINE>popupMenu.getMenu().add(Menu.NONE, R.id.menu_edit, Menu.NONE, R.string.edit);<NEW_LINE>popupMenu.getMenu().add(Menu.NONE, R.id.menu_top, Menu.NONE, R.string.to_top);<NEW_LINE>popupMenu.getMenu().add(Menu.NONE, R.id.menu_del, Menu.<MASK><NEW_LINE>popupMenu.getMenu().add(Menu.NONE, R.id.menu_clear, Menu.NONE, R.string.clear_cache);<NEW_LINE>popupMenu.setOnMenuItemClickListener(item -> {<NEW_LINE>int itemId = item.getItemId();<NEW_LINE>if (itemId == R.id.menu_edit) {<NEW_LINE>SourceEditActivity.startThis(this, sourceBean);<NEW_LINE>} else if (itemId == R.id.menu_top) {<NEW_LINE>BookSourceManager.toTop(sourceBean).subscribe(new MySingleObserver<Boolean>() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onSuccess(Boolean aBoolean) {<NEW_LINE>refreshData();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} else if (itemId == R.id.menu_del) {<NEW_LINE>BookSourceManager.removeBookSource(sourceBean);<NEW_LINE>refreshData();<NEW_LINE>} else if (itemId == R.id.menu_clear) {<NEW_LINE>ACache.get(getActivity(), "findCache").remove(sourceBean.getBookSourceUrl());<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>});<NEW_LINE>popupMenu.show();<NEW_LINE>} | NONE, R.string.delete); |
1,431,037 | public Optional<CorsOriginConfiguration> convert(Map<String, Object> object, Class<CorsOriginConfiguration> targetType, ConversionContext context) {<NEW_LINE>CorsOriginConfiguration configuration = new CorsOriginConfiguration();<NEW_LINE>ConvertibleValues<Object> convertibleValues = new ConvertibleValuesMap<>(object);<NEW_LINE>convertibleValues.get(ALLOWED_ORIGINS, ConversionContext.LIST_OF_STRING).ifPresent(configuration::setAllowedOrigins);<NEW_LINE>convertibleValues.get(ALLOWED_METHODS, CONVERSION_CONTEXT_LIST_OF_HTTP_METHOD).ifPresent(configuration::setAllowedMethods);<NEW_LINE>convertibleValues.get(ALLOWED_HEADERS, ConversionContext.LIST_OF_STRING).ifPresent(configuration::setAllowedHeaders);<NEW_LINE>convertibleValues.get(EXPOSED_HEADERS, ConversionContext.LIST_OF_STRING).ifPresent(configuration::setExposedHeaders);<NEW_LINE>convertibleValues.get(ALLOW_CREDENTIALS, ConversionContext.BOOLEAN<MASK><NEW_LINE>convertibleValues.get(MAX_AGE, ConversionContext.LONG).ifPresent(configuration::setMaxAge);<NEW_LINE>return Optional.of(configuration);<NEW_LINE>} | ).ifPresent(configuration::setAllowCredentials); |
1,148,659 | private void onUpdateAvailable(final Update update, final boolean mandatory) {<NEW_LINE>getActivity().runOnUiThread(new Runnable() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void run() {<NEW_LINE>new ConfirmDialog(getString(R.string.update_available), update.prompt, getActivity(), new ConfirmDialogListener() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onConfirm() {<NEW_LINE>StopRPCServer();<NEW_LINE>Intent i = new Intent(getActivity(), UpdateService.class);<NEW_LINE><MASK><NEW_LINE>i.putExtra(UpdateService.UPDATE, update);<NEW_LINE>getActivity().startService(i);<NEW_LINE>mIsUpdateDownloading = true;<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public void onCancel() {<NEW_LINE>mIsUpdateDownloading = false;<NEW_LINE>if (!mandatory) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>onInitializationError(getString(R.string.mandatory_update));<NEW_LINE>}<NEW_LINE>}).show();<NEW_LINE>}<NEW_LINE>});<NEW_LINE>} | i.setAction(UpdateService.START); |
900,176 | private void addTags() {<NEW_LINE>contentCursorPosition = getCursorIndex();<NEW_LINE>final List<Tag> tags = TagsHelper.getAllTags();<NEW_LINE>if (tags.isEmpty()) {<NEW_LINE>mainActivity.showMessage(R.string.no_tags_created, ONStyle.WARN);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final Note currentNote = new Note();<NEW_LINE>currentNote.setTitle(getNoteTitle());<NEW_LINE>currentNote.setContent(getNoteContent());<NEW_LINE>Integer[] preselectedTags = <MASK><NEW_LINE>// Dialog and events creation<NEW_LINE>MaterialDialog dialog = new MaterialDialog.Builder(mainActivity).title(R.string.select_tags).positiveText(R.string.ok).items(TagsHelper.getTagsArray(tags)).itemsCallbackMultiChoice(preselectedTags, (dialog1, which, text) -> {<NEW_LINE>dialog1.dismiss();<NEW_LINE>tagNote(tags, which, currentNote);<NEW_LINE>return false;<NEW_LINE>}).build();<NEW_LINE>dialog.show();<NEW_LINE>} | TagsHelper.getPreselectedTagsArray(currentNote, tags); |
909,565 | protected void initLaf(UIManager manager) {<NEW_LINE>super.initLaf(manager);<NEW_LINE>int tabPlace = manager.getThemeConstant("tabPlacementInt", -1);<NEW_LINE>tabsFillRows = manager.isThemeConstant("tabsFillRowsBool", false);<NEW_LINE>tabsGridLayout = <MASK><NEW_LINE>changeTabOnFocus = manager.isThemeConstant("changeTabOnFocusBool", false);<NEW_LINE>BorderLayout bd = (BorderLayout) super.getLayout();<NEW_LINE>if (bd != null) {<NEW_LINE>if (manager.isThemeConstant("tabsOnTopBool", false)) {<NEW_LINE>if (bd.getCenterBehavior() != BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW) {<NEW_LINE>bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_TOTAL_BELOW);<NEW_LINE>checkTabsCanBeSeen();<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>bd.setCenterBehavior(BorderLayout.CENTER_BEHAVIOR_SCALE);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>changeTabContainerStyleOnFocus = manager.isThemeConstant("changeTabContainerStyleOnFocusBool", false);<NEW_LINE>if (tabPlace != -1) {<NEW_LINE>tabPlacement = tabPlace;<NEW_LINE>}<NEW_LINE>} | manager.isThemeConstant("tabsGridBool", false); |
1,342,950 | public int compareTo(TFLoadedClass other) {<NEW_LINE>if (!getClass().equals(other.getClass())) {<NEW_LINE>return getClass().getName().compareTo(other.getClass().getName());<NEW_LINE>}<NEW_LINE>int lastComparison = 0;<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetLoadedClassCount()).<MASK><NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetLoadedClassCount()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.loadedClassCount, other.loadedClassCount);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>lastComparison = java.lang.Boolean.valueOf(isSetUnloadedClassCount()).compareTo(other.isSetUnloadedClassCount());<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>if (isSetUnloadedClassCount()) {<NEW_LINE>lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.unloadedClassCount, other.unloadedClassCount);<NEW_LINE>if (lastComparison != 0) {<NEW_LINE>return lastComparison;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return 0;<NEW_LINE>} | compareTo(other.isSetLoadedClassCount()); |
1,014,304 | final DisassociateMemberAccountResult executeDisassociateMemberAccount(DisassociateMemberAccountRequest disassociateMemberAccountRequest) {<NEW_LINE>ExecutionContext executionContext = createExecutionContext(disassociateMemberAccountRequest);<NEW_LINE>AWSRequestMetrics awsRequestMetrics = executionContext.getAwsRequestMetrics();<NEW_LINE>awsRequestMetrics.startEvent(Field.ClientExecuteTime);<NEW_LINE>Request<DisassociateMemberAccountRequest> request = null;<NEW_LINE>Response<DisassociateMemberAccountResult> response = null;<NEW_LINE>try {<NEW_LINE>awsRequestMetrics.startEvent(Field.RequestMarshallTime);<NEW_LINE>try {<NEW_LINE>request = new DisassociateMemberAccountRequestProtocolMarshaller(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, "Macie");<NEW_LINE>request.addHandlerContext(HandlerContextKey.OPERATION_NAME, "DisassociateMemberAccount");<NEW_LINE>request.addHandlerContext(HandlerContextKey.ADVANCED_CONFIG, advancedConfig);<NEW_LINE>} finally {<NEW_LINE>awsRequestMetrics.endEvent(Field.RequestMarshallTime);<NEW_LINE>}<NEW_LINE>HttpResponseHandler<AmazonWebServiceResponse<DisassociateMemberAccountResult>> responseHandler = protocolFactory.createResponseHandler(new JsonOperationMetadata().withPayloadJson(true).withHasStreamingSuccessResponse(false), new DisassociateMemberAccountResultJsonUnmarshaller());<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(disassociateMemberAccountRequest)); |
1,102,075 | public static double computeNDCG(Adapter adapter) {<NEW_LINE>double sum = 0.;<NEW_LINE>int i = 0, positive = 0, tied = 0, totalpos = 0;<NEW_LINE>while (adapter.valid()) {<NEW_LINE>// positive or negative match?<NEW_LINE>do {<NEW_LINE>if (adapter.test()) {<NEW_LINE>++positive;<NEW_LINE>}<NEW_LINE>++tied;<NEW_LINE>++i;<NEW_LINE>adapter.advance();<NEW_LINE>} while (// Loop while tied:<NEW_LINE>adapter.valid() && adapter.tiedToPrevious());<NEW_LINE>// We only support binary labeling, and can ignore negative weight.<NEW_LINE>if (positive > 0) {<NEW_LINE>//<NEW_LINE>sum += //<NEW_LINE>tied == 1 ? 1. / FastMath.log(i + 1) : DCGEvaluation.sumInvLog1p(i - tied + 1, i<MASK><NEW_LINE>totalpos += positive;<NEW_LINE>}<NEW_LINE>positive = 0;<NEW_LINE>tied = 0;<NEW_LINE>}<NEW_LINE>// Optimum value:<NEW_LINE>double idcg = DCGEvaluation.sumInvLog1p(1, totalpos);<NEW_LINE>// log(2) base would disappear<NEW_LINE>return sum / idcg;<NEW_LINE>} | ) * positive / (double) tied; |
1,731,488 | public MLMethod crossvalidate(int k, boolean shuffle) {<NEW_LINE>KFoldCrossvalidation cross = new KFoldCrossvalidation(this.trainingDataset, k);<NEW_LINE>cross.process(shuffle);<NEW_LINE>int foldNumber = 0;<NEW_LINE>for (DataFold fold : cross.getFolds()) {<NEW_LINE>foldNumber++;<NEW_LINE>report.report(k, foldNumber, "Fold #" + foldNumber);<NEW_LINE>fitFold(k, foldNumber, fold);<NEW_LINE>}<NEW_LINE>double sum = 0;<NEW_LINE>double bestScore = Double.POSITIVE_INFINITY;<NEW_LINE>MLMethod bestMethod = null;<NEW_LINE>for (DataFold fold : cross.getFolds()) {<NEW_LINE>sum += fold.getScore();<NEW_LINE>if (fold.getScore() < bestScore) {<NEW_LINE>bestScore = fold.getScore();<NEW_LINE>bestMethod = fold.getMethod();<NEW_LINE>}<NEW_LINE>}<NEW_LINE>sum = sum / cross<MASK><NEW_LINE>report.report(k, k, "Cross-validated score:" + sum);<NEW_LINE>return bestMethod;<NEW_LINE>} | .getFolds().size(); |
1,171,389 | public void runSupport() {<NEW_LINE>try {<NEW_LINE>List<String> txts = dns_utils.getTXTRecords(host);<NEW_LINE>if (TRACE_DNS) {<NEW_LINE>System.out.println("Actual lookup: " + host + " -> " + txts);<NEW_LINE>}<NEW_LINE>synchronized (result) {<NEW_LINE>if (result[0] == null) {<NEW_LINE>result[1] = txts;<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>// they gave up waiting<NEW_LINE>try {<NEW_LINE>List txts_cache = new ArrayList();<NEW_LINE>for (String str : txts) {<NEW_LINE>txts_cache.add(str.getBytes("UTF-8"));<NEW_LINE>}<NEW_LINE>List old_txts_cache = COConfigurationManager.getListParameter(config_key, null);<NEW_LINE>boolean same = false;<NEW_LINE>if (old_txts_cache != null) {<NEW_LINE>same = old_txts_cache.size<MASK><NEW_LINE>if (same) {<NEW_LINE>for (int i = 0; i < old_txts_cache.size(); i++) {<NEW_LINE>if (!Arrays.equals((byte[]) old_txts_cache.get(i), (byte[]) txts_cache.get(i))) {<NEW_LINE>same = false;<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (!same) {<NEW_LINE>COConfigurationManager.setParameter(config_key, txts_cache);<NEW_LINE>f_txt_entry.getSemaphore().reserve();<NEW_LINE>if (already_got_records == null) {<NEW_LINE>getDNSTXTEntry(host, true, txts);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (Throwable e) {<NEW_LINE>Debug.out(e);<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>lookup_sem.release();<NEW_LINE>}<NEW_LINE>} | () == txts_cache.size(); |
321,678 | public OAuth2Authentication consumeAuthorizationCode(String code) throws InvalidGrantException {<NEW_LINE>performExpirationClean();<NEW_LINE>JdbcTemplate template = new JdbcTemplate(dataSource);<NEW_LINE>try {<NEW_LINE>TokenCode tokenCode = (TokenCode) template.queryForObject(SQL_SELECT_STATEMENT, rowMapper, code);<NEW_LINE>if (tokenCode != null) {<NEW_LINE>try {<NEW_LINE>if (tokenCode.isExpired()) {<NEW_LINE>logger.debug("[oauth_code] Found code, but it expired:" + tokenCode);<NEW_LINE>throw new InvalidGrantException("Authorization code expired: " + code);<NEW_LINE>} else if (tokenCode.getExpiresAt() == 0) {<NEW_LINE>return SerializationUtils.deserialize(tokenCode.getAuthentication());<NEW_LINE>} else {<NEW_LINE>return deserializeOauth2Authentication(tokenCode.getAuthentication());<NEW_LINE>}<NEW_LINE>} finally {<NEW_LINE>template.update(SQL_DELETE_STATEMENT, code);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (EmptyResultDataAccessException ignored) {<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>} | throw new InvalidGrantException("Invalid authorization code: " + code); |
199,955 | protected void updateMaster(int maxWaitSeconds) throws Exception {<NEW_LINE>int port;<NEW_LINE>int tryTime = 0;<NEW_LINE>TConnection connection = TConnectionManager.getConnection(conf);<NEW_LINE>while (tryTime < maxWaitSeconds) {<NEW_LINE>String masterPodIp = k8sClientApp.getAngelMasterPodIp();<NEW_LINE>port = conf.getInt(AngelConf.ANGEL_KUBERNETES_MASTER_PORT, AngelConf.DEFAULT_ANGEL_KUBERNETES_MASTER_PORT);<NEW_LINE>if (masterPodIp == null || "".equals(masterPodIp)) {<NEW_LINE>LOG.info("AM not assigned to Job. Waiting to get the AM ...");<NEW_LINE>Thread.sleep(1000);<NEW_LINE>tryTime++;<NEW_LINE>} else {<NEW_LINE>try {<NEW_LINE>masterLocation = new Location(masterPodIp, port);<NEW_LINE>LOG.info("master host=" + masterLocation.getIp() + ", port=" + masterLocation.getPort());<NEW_LINE>LOG.info("start to create rpc client to am");<NEW_LINE>Thread.sleep(5000);<NEW_LINE>master = connection.getMasterService(masterLocation.getIp(<MASK><NEW_LINE>startHeartbeat();<NEW_LINE>} catch (Exception e) {<NEW_LINE>LOG.error("Register to Master failed, ", e);<NEW_LINE>Thread.sleep(1000);<NEW_LINE>tryTime++;<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>break;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>if (tryTime >= maxWaitSeconds && masterLocation == null) {<NEW_LINE>throw new IOException("wait for master location timeout");<NEW_LINE>}<NEW_LINE>} | ), masterLocation.getPort()); |
563,639 | protected void addGuiElements() {<NEW_LINE>super.addGuiElements();<NEW_LINE>addRenderableWidget(new GuiInnerScreen(this, 45, 18, 104, 68).jeiCategory(tile));<NEW_LINE>addRenderableWidget(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getEnergyUsed));<NEW_LINE>addRenderableWidget(new GuiGasGauge(() -> tile.gasTank, () -> tile.getGasTanks(null), GaugeType.SMALL_MED, this, 5, 18)).warning(WarningType.NO_MATCHING_RECIPE, tile.getWarningCheck(RecipeError.NOT_ENOUGH_SECONDARY_INPUT));<NEW_LINE>addRenderableWidget(new GuiEnergyGauge(tile.getEnergyContainer(), GaugeType.SMALL_MED, this, 172, 18)).warning(WarningType.NOT_ENOUGH_ENERGY, tile.getWarningCheck(RecipeError.NOT_ENOUGH_ENERGY));<NEW_LINE>addRenderableWidget(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public Component getTooltip() {<NEW_LINE>return MekanismLang.PROGRESS.translate(TextUtils.getPercent(tile.getScaledProgress()));<NEW_LINE>}<NEW_LINE><NEW_LINE>@Override<NEW_LINE>public double getLevel() {<NEW_LINE>return Math.min(<MASK><NEW_LINE>}<NEW_LINE>}, 5, 88, 183, ColorFunction.scale(Color.rgbi(60, 45, 74), Color.rgbi(100, 30, 170)))).warning(WarningType.INPUT_DOESNT_PRODUCE_OUTPUT, tile.getWarningCheck(RecipeError.INPUT_DOESNT_PRODUCE_OUTPUT));<NEW_LINE>} | 1, tile.getScaledProgress()); |
1,687,249 | public void verifyParameter(@NotNull final PsiParameter psiParameter, @NotNull final ProblemsHolder holder) {<NEW_LINE>final PsiTypeElement typeElement = psiParameter.getTypeElement();<NEW_LINE>final String typeElementText = null != typeElement <MASK><NEW_LINE>boolean isVal = isPossibleVal(typeElementText) && isVal(resolveQualifiedName(typeElement));<NEW_LINE>boolean isVar = isPossibleVar(typeElementText) && isVar(resolveQualifiedName(typeElement));<NEW_LINE>if (isVar || isVal) {<NEW_LINE>PsiElement scope = psiParameter.getDeclarationScope();<NEW_LINE>boolean isForeachStatement = scope instanceof PsiForeachStatement;<NEW_LINE>boolean isForStatement = scope instanceof PsiForStatement;<NEW_LINE>if (isVal && !isForeachStatement) {<NEW_LINE>holder.registerProblem(psiParameter, LombokBundle.message("inspection.message.val.works.only.on.local.variables"), ProblemHighlightType.ERROR);<NEW_LINE>} else if (isVar && !(isForeachStatement || isForStatement)) {<NEW_LINE>holder.registerProblem(psiParameter, LombokBundle.message("inspection.message.var.works.only.on.local.variables.on.for.foreach.loops"), ProblemHighlightType.ERROR);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | ? typeElement.getText() : null; |
581,940 | private void loadInstanceIdByZK() {<NEW_LINE>int execCount = 1;<NEW_LINE>while (true) {<NEW_LINE>if (execCount > this.retryCount) {<NEW_LINE>throw new RuntimeException("instanceId allocate error when using zk, reason: no available instanceId found");<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>List<String> nodeList = client.getChildren().forPath(INSTANCE_PATH);<NEW_LINE>String slavePath = client.create().creatingParentsIfNeeded().withMode(CreateMode.EPHEMERAL_SEQUENTIAL).forPath(INSTANCE_PATH.concat("/node"), "ready".getBytes());<NEW_LINE>String tempInstanceId = slavePath.substring(slavePath.length() - 10);<NEW_LINE>this.instanceId = Long.parseLong(tempInstanceId) & (<MASK><NEW_LINE>// check if id collides<NEW_LINE>if (checkInstanceIdCollision(nodeList)) {<NEW_LINE>execCount++;<NEW_LINE>} else {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>} catch (Exception e) {<NEW_LINE>throw new RuntimeException("instanceId allocate error when using zk, reason:" + e.getMessage());<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | (1 << instanceIdBits) - 1); |
83,757 | private static RawReference create1(Element xml) throws IllegalArgumentException {<NEW_LINE>if (!REF_NAME.equals(xml.getLocalName()) || !REFS_NS.equals(xml.getNamespaceURI())) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("bad element name: " + xml);<NEW_LINE>}<NEW_LINE>// NOI18N<NEW_LINE>NodeList nl = xml.getElementsByTagNameNS("*", "*");<NEW_LINE>if (nl.getLength() != 6) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("missing or extra data: " + xml);<NEW_LINE>}<NEW_LINE>String[] values = new <MASK><NEW_LINE>for (int i = 0; i < nl.getLength(); i++) {<NEW_LINE>Element el = (Element) nl.item(i);<NEW_LINE>if (!REFS_NS.equals(el.getNamespaceURI())) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("bad subelement ns: " + el);<NEW_LINE>}<NEW_LINE>String elName = el.getLocalName();<NEW_LINE>int idx = SUB_ELEMENT_NAMES.indexOf(elName);<NEW_LINE>if (idx == -1) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("bad subelement name: " + elName);<NEW_LINE>}<NEW_LINE>String val = XMLUtil.findText(el);<NEW_LINE>if (val == null) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("empty subelement: " + el);<NEW_LINE>}<NEW_LINE>if (values[idx] != null) {<NEW_LINE>// NOI18N<NEW_LINE>throw new IllegalArgumentException("duplicate " + elName + ": " + values[idx] + " and " + val);<NEW_LINE>}<NEW_LINE>values[idx] = val;<NEW_LINE>}<NEW_LINE>assert !Arrays.asList(values).contains(null);<NEW_LINE>// throws IllegalArgumentException<NEW_LINE>URI scriptLocation = URI.create(values[2]);<NEW_LINE>return new RawReference(values[0], values[1], scriptLocation, values[3], values[4], values[5]);<NEW_LINE>} | String[nl.getLength()]; |
1,346,497 | protected RelDataType deriveRowType() {<NEW_LINE>final RelDataTypeFactory typeFactory = getCluster().getTypeFactory();<NEW_LINE>List<RelDataTypeFieldImpl> columns = new ArrayList<>();<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TABLE_SCHEMA", 0, typeFactory.<MASK><NEW_LINE>columns.add(new RelDataTypeFieldImpl("TABLE_GROUP_ID", 1, typeFactory.createSqlType(SqlTypeName.BIGINT)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TABLE_GROUP_NAME", 2, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("LOCALITY", 3, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("PRIMARY_ZONE", 4, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("IS_MANUAL_CREATE", 5, typeFactory.createSqlType(SqlTypeName.INTEGER)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("PART_INFO", 6, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>columns.add(new RelDataTypeFieldImpl("TABLES", 7, typeFactory.createSqlType(SqlTypeName.VARCHAR)));<NEW_LINE>return typeFactory.createStructType(columns);<NEW_LINE>} | createSqlType(SqlTypeName.VARCHAR))); |
192,361 | public static CdmPurposeReference fromData(final CdmCorpusContext ctx, final JsonNode obj) {<NEW_LINE>if (obj == null) {<NEW_LINE>return null;<NEW_LINE>}<NEW_LINE>boolean simpleReference = true;<NEW_LINE>Boolean optional = null;<NEW_LINE>final Object purpose;<NEW_LINE>List<CdmTraitReference> appliedTraits = null;<NEW_LINE>if (obj.isValueNode()) {<NEW_LINE>purpose = obj;<NEW_LINE>} else {<NEW_LINE>simpleReference = false;<NEW_LINE>optional = Utils.propertyFromDataToBoolean(obj.get("optional"));<NEW_LINE>if (obj.get("purposeReference").isValueNode()) {<NEW_LINE>purpose = obj.get("purposeReference").asText();<NEW_LINE>} else {<NEW_LINE>purpose = PurposePersistence.fromData(ctx<MASK><NEW_LINE>}<NEW_LINE>}<NEW_LINE>final CdmPurposeReference purposeReference = ctx.getCorpus().makeRef(CdmObjectType.PurposeRef, purpose, simpleReference);<NEW_LINE>if (optional != null) {<NEW_LINE>purposeReference.setOptional(optional);<NEW_LINE>}<NEW_LINE>if (!(obj.isValueNode())) {<NEW_LINE>Utils.addListToCdmCollection(purposeReference.getAppliedTraits(), Utils.createTraitReferenceList(ctx, obj.get("appliedTraits")));<NEW_LINE>}<NEW_LINE>return purposeReference;<NEW_LINE>} | , obj.get("purposeReference")); |
32,561 | protected void constructDom() {<NEW_LINE>String labelId = DOM.createUniqueId();<NEW_LINE>addStyleName(CLASSNAME);<NEW_LINE>String treeItemId = DOM.createUniqueId();<NEW_LINE>getElement().setId(treeItemId);<NEW_LINE>Roles.getTreeitemRole().set(getElement());<NEW_LINE>Roles.getTreeitemRole().setAriaSelectedState(getElement(), SelectedValue.FALSE);<NEW_LINE>Roles.getTreeitemRole().setAriaLabelledbyProperty(getElement(), Id.of(labelId));<NEW_LINE>nodeCaptionDiv = DOM.createDiv();<NEW_LINE>DOM.setElementProperty(nodeCaptionDiv, "className", CLASSNAME + "-caption");<NEW_LINE>Element wrapper = DOM.createDiv();<NEW_LINE>wrapper.setId(labelId);<NEW_LINE>wrapper.setAttribute("for", treeItemId);<NEW_LINE>nodeCaptionSpan = DOM.createSpan();<NEW_LINE>DOM.appendChild(getElement(), nodeCaptionDiv);<NEW_LINE>DOM.appendChild(nodeCaptionDiv, wrapper);<NEW_LINE><MASK><NEW_LINE>if (BrowserInfo.get().isOpera()) {<NEW_LINE>nodeCaptionDiv.setTabIndex(-1);<NEW_LINE>}<NEW_LINE>childNodeContainer = new FlowPanel();<NEW_LINE>childNodeContainer.setStyleName(CLASSNAME + "-children");<NEW_LINE>Roles.getGroupRole().set(childNodeContainer.getElement());<NEW_LINE>setWidget(childNodeContainer);<NEW_LINE>} | DOM.appendChild(wrapper, nodeCaptionSpan); |
1,580,412 | public OBinaryResponse executeSBTGet(OSBTGetRequest request) {<NEW_LINE>final OSBTreeCollectionManager sbTreeCollectionManager = connection.getDatabase().getSbTreeCollectionManager();<NEW_LINE>final OSBTreeBonsai<OIdentifiable, Integer> tree = sbTreeCollectionManager.loadSBTree(request.getCollectionPointer());<NEW_LINE>try {<NEW_LINE>final OIdentifiable key = tree.getKeySerializer().deserialize(request.getKeyStream(), 0);<NEW_LINE>Integer <MASK><NEW_LINE>final OBinarySerializer<? super Integer> valueSerializer;<NEW_LINE>if (result == null) {<NEW_LINE>valueSerializer = ONullSerializer.INSTANCE;<NEW_LINE>} else {<NEW_LINE>valueSerializer = tree.getValueSerializer();<NEW_LINE>}<NEW_LINE>byte[] stream = new byte[OByteSerializer.BYTE_SIZE + valueSerializer.getObjectSize(result)];<NEW_LINE>OByteSerializer.INSTANCE.serialize(valueSerializer.getId(), stream, 0);<NEW_LINE>valueSerializer.serialize(result, stream, OByteSerializer.BYTE_SIZE);<NEW_LINE>return new OSBTGetResponse(stream);<NEW_LINE>} finally {<NEW_LINE>sbTreeCollectionManager.releaseSBTree(request.getCollectionPointer());<NEW_LINE>}<NEW_LINE>} | result = tree.get(key); |
276,987 | public void insertBitmap(final BufferedImage bitmap, final int x, final int y, final int transRGB) {<NEW_LINE>final int heightSrc = bitmap.getHeight();<NEW_LINE>final <MASK><NEW_LINE>final int heightTgt = this.height;<NEW_LINE>final int widthTgt = this.width;<NEW_LINE>int rgb;<NEW_LINE>for (int i = 0; i < heightSrc; i++) {<NEW_LINE>for (int j = 0; j < widthSrc; j++) {<NEW_LINE>// pixel in legal area?<NEW_LINE>if (j + x >= 0 && i + y >= 0 && i + y < heightTgt && j + x < widthTgt) {<NEW_LINE>rgb = bitmap.getRGB(j, i);<NEW_LINE>if (rgb != transRGB) {<NEW_LINE>this.image.setRGB(j + x, i + y, rgb);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | int widthSrc = bitmap.getWidth(); |
125,619 | private Value convertOnWrite(Object proppertyVal, EmbeddedType embeddedType, String fieldName, TypeInformation typeInformation) {<NEW_LINE>Object val = proppertyVal;<NEW_LINE>Function<Object, Value> writeConverter = this::convertOnWriteSingle;<NEW_LINE>if (proppertyVal != null) {<NEW_LINE>switch(embeddedType) {<NEW_LINE>case EMBEDDED_MAP:<NEW_LINE>writeConverter = (x) -> convertOnWriteSingleEmbeddedMap(x, fieldName, (<MASK><NEW_LINE>break;<NEW_LINE>case EMBEDDED_ENTITY:<NEW_LINE>writeConverter = (x) -> convertOnWriteSingleEmbedded(x, fieldName);<NEW_LINE>break;<NEW_LINE>case NOT_EMBEDDED:<NEW_LINE>writeConverter = this::convertOnWriteSingle;<NEW_LINE>break;<NEW_LINE>default:<NEW_LINE>throw new DatastoreDataException("Unexpected property embedded type: " + embeddedType);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>val = ValueUtil.toListIfArray(val);<NEW_LINE>if (val instanceof Iterable) {<NEW_LINE>List<Value<?>> values = new ArrayList<>();<NEW_LINE>for (Object propEltValue : (Iterable) val) {<NEW_LINE>values.add(writeConverter.apply(propEltValue));<NEW_LINE>}<NEW_LINE>return ListValue.of(values);<NEW_LINE>}<NEW_LINE>return writeConverter.apply(val);<NEW_LINE>} | TypeInformation) typeInformation.getMapValueType()); |
1,440,543 | public String toJsonString() {<NEW_LINE>Map<String, Object> items = new HashMap<String, Object>();<NEW_LINE>items.put("msgtype", "link");<NEW_LINE>Map<String, String> linkContent = new HashMap<String, String>();<NEW_LINE>if (StringUtils.isBlank(title)) {<NEW_LINE>throw new IllegalArgumentException("title should not be blank");<NEW_LINE>}<NEW_LINE>linkContent.put("title", title);<NEW_LINE>if (StringUtils.isBlank(messageUrl)) {<NEW_LINE>throw new IllegalArgumentException("messageUrl should not be blank");<NEW_LINE>}<NEW_LINE><MASK><NEW_LINE>if (StringUtils.isBlank(text)) {<NEW_LINE>throw new IllegalArgumentException("text should not be blank");<NEW_LINE>}<NEW_LINE>linkContent.put("text", text);<NEW_LINE>if (StringUtils.isNotBlank(picUrl)) {<NEW_LINE>linkContent.put("picUrl", picUrl);<NEW_LINE>}<NEW_LINE>items.put("link", linkContent);<NEW_LINE>return JSON.toJSONString(items);<NEW_LINE>} | linkContent.put("messageUrl", messageUrl); |
1,592,764 | public Request<ListResourceTagsRequest> marshall(ListResourceTagsRequest listResourceTagsRequest) {<NEW_LINE>if (listResourceTagsRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(ListResourceTagsRequest)");<NEW_LINE>}<NEW_LINE>Request<ListResourceTagsRequest> request = new DefaultRequest<ListResourceTagsRequest>(listResourceTagsRequest, "AWSKMS");<NEW_LINE>String target = "TrentService.ListResourceTags";<NEW_LINE>request.addHeader("X-Amz-Target", target);<NEW_LINE><MASK><NEW_LINE>String uriResourcePath = "/";<NEW_LINE>request.setResourcePath(uriResourcePath);<NEW_LINE>try {<NEW_LINE>StringWriter stringWriter = new StringWriter();<NEW_LINE>AwsJsonWriter jsonWriter = JsonUtils.getJsonWriter(stringWriter);<NEW_LINE>jsonWriter.beginObject();<NEW_LINE>if (listResourceTagsRequest.getKeyId() != null) {<NEW_LINE>String keyId = listResourceTagsRequest.getKeyId();<NEW_LINE>jsonWriter.name("KeyId");<NEW_LINE>jsonWriter.value(keyId);<NEW_LINE>}<NEW_LINE>if (listResourceTagsRequest.getLimit() != null) {<NEW_LINE>Integer limit = listResourceTagsRequest.getLimit();<NEW_LINE>jsonWriter.name("Limit");<NEW_LINE>jsonWriter.value(limit);<NEW_LINE>}<NEW_LINE>if (listResourceTagsRequest.getMarker() != null) {<NEW_LINE>String marker = listResourceTagsRequest.getMarker();<NEW_LINE>jsonWriter.name("Marker");<NEW_LINE>jsonWriter.value(marker);<NEW_LINE>}<NEW_LINE>jsonWriter.endObject();<NEW_LINE>jsonWriter.close();<NEW_LINE>String snippet = stringWriter.toString();<NEW_LINE>byte[] content = snippet.getBytes(UTF8);<NEW_LINE>request.setContent(new StringInputStream(snippet));<NEW_LINE>request.addHeader("Content-Length", Integer.toString(content.length));<NEW_LINE>} catch (Throwable t) {<NEW_LINE>throw new AmazonClientException("Unable to marshall request to JSON: " + t.getMessage(), t);<NEW_LINE>}<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>} | request.setHttpMethod(HttpMethodName.POST); |
212,739 | private boolean canExport(JFileChooser chooser) {<NEW_LINE>File file = chooser.getSelectedFile();<NEW_LINE>if (!file.getPath().endsWith(".gephi")) {<NEW_LINE>file = new File(file.getPath() + ".gephi");<NEW_LINE>chooser.setSelectedFile(file);<NEW_LINE>}<NEW_LINE>try {<NEW_LINE>if (!file.exists()) {<NEW_LINE>if (!file.createNewFile()) {<NEW_LINE>String failMsg = NbBundle.getMessage(ProjectControllerUIImpl.class, "SaveAsProject_SaveFailed", new Object[] <MASK><NEW_LINE>JOptionPane.showMessageDialog(null, failMsg);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>String overwriteMsg = NbBundle.getMessage(ProjectControllerUIImpl.class, "SaveAsProject_Overwrite", new Object[] { file.getPath() });<NEW_LINE>if (JOptionPane.showConfirmDialog(null, overwriteMsg) != JOptionPane.OK_OPTION) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} catch (IOException ex) {<NEW_LINE>NotifyDescriptor.Message msg = new NotifyDescriptor.Message(ex.getMessage(), NotifyDescriptor.WARNING_MESSAGE);<NEW_LINE>DialogDisplayer.getDefault().notifyLater(msg);<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>return true;<NEW_LINE>} | { file.getPath() }); |
683,803 | protected void configureFilter(BeanDefinitionBuilder builder, Element element, ParserContext parserContext, String filterAttribute, String patternPrefix, String propertyName) {<NEW_LINE>String filter = element.getAttribute(filterAttribute);<NEW_LINE>String filterExpression = element.getAttribute(filterAttribute + "-expression");<NEW_LINE>String fileNamePattern = element.getAttribute(patternPrefix + "-pattern");<NEW_LINE>String fileNameRegex = element.getAttribute(patternPrefix + "-regex");<NEW_LINE>boolean hasFilter = StringUtils.hasText(filter);<NEW_LINE>boolean hasFilterExpression = StringUtils.hasText(filterExpression);<NEW_LINE>boolean hasFileNamePattern = StringUtils.hasText(fileNamePattern);<NEW_LINE>boolean hasFileNameRegex = StringUtils.hasText(fileNameRegex);<NEW_LINE><MASK><NEW_LINE>count += hasFilterExpression ? 1 : 0;<NEW_LINE>count += hasFileNamePattern ? 1 : 0;<NEW_LINE>count += hasFileNameRegex ? 1 : 0;<NEW_LINE>if (count > 1) {<NEW_LINE>parserContext.getReaderContext().error("at most one of '" + patternPrefix + "-pattern', " + "'" + patternPrefix + "-regex', '" + filterAttribute + "' or '" + filterAttribute + "-expression' is allowed on a remote file outbound " + "gateway", element);<NEW_LINE>} else if (hasFilter) {<NEW_LINE>builder.addPropertyReference(propertyName, filter);<NEW_LINE>} else if (hasFilterExpression) {<NEW_LINE>registerExpressionFilter(builder, propertyName, filterExpression);<NEW_LINE>} else if (hasFileNamePattern) {<NEW_LINE>registerPatternFilter(builder, filterAttribute, propertyName, fileNamePattern);<NEW_LINE>} else if (hasFileNameRegex) {<NEW_LINE>registerRegexFilter(builder, filterAttribute, propertyName, fileNameRegex);<NEW_LINE>}<NEW_LINE>} | int count = hasFilter ? 1 : 0; |
452,469 | @Consumes(MediaType.MULTIPART_FORM_DATA)<NEW_LINE>public void createOrUpdateRealmLocalizationTextsFromFile(@PathParam("locale") String locale, MultipartFormDataInput input) {<NEW_LINE>this.auth.realm().requireManageRealm();<NEW_LINE>Map<String, List<InputPart><MASK><NEW_LINE>if (!formDataMap.containsKey("file")) {<NEW_LINE>throw new BadRequestException();<NEW_LINE>}<NEW_LINE>InputPart file = formDataMap.get("file").get(0);<NEW_LINE>try (InputStream inputStream = file.getBody(InputStream.class, null)) {<NEW_LINE>TypeReference<HashMap<String, String>> typeRef = new TypeReference<HashMap<String, String>>() {<NEW_LINE>};<NEW_LINE>Map<String, String> rep = JsonSerialization.readValue(inputStream, typeRef);<NEW_LINE>realm.createOrUpdateRealmLocalizationTexts(locale, rep);<NEW_LINE>} catch (IOException e) {<NEW_LINE>throw new BadRequestException("Could not read file.");<NEW_LINE>}<NEW_LINE>} | > formDataMap = input.getFormDataMap(); |
1,014,844 | public void createAndAddForHuParentChanged(@NonNull final I_M_HU hu, @Nullable final I_M_HU_Item parentHUItemOld) {<NEW_LINE>final IHUStatusBL huStatusBL = Services.get(IHUStatusBL.class);<NEW_LINE>if (!huStatusBL.isPhysicalHU(hu)) {<NEW_LINE>logger.info("Param hu has status={}; nothing to do; hu={}", hu.getHUStatus(), hu);<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>final HUTraceEventBuilder builder = HUTraceEvent.builder().orgId(OrgId.ofRepoIdOrNull(hu.getAD_Org_ID())).type(HUTraceType.TRANSFORM_PARENT).eventTime(Instant.now());<NEW_LINE>final List<I_M_HU> vhus = huAccessService.retrieveVhus(hu);<NEW_LINE>final HuId newTopLevelHuId = HuId.ofRepoIdOrNull(huAccessService.retrieveTopLevelHuId(hu));<NEW_LINE>final HuId oldTopLevelHuId;<NEW_LINE>if (parentHUItemOld == null) {<NEW_LINE>// the given 'hu' had no parent and was therefore our top level HU<NEW_LINE>oldTopLevelHuId = HuId.ofRepoIdOrNull(hu.getM_HU_ID());<NEW_LINE>Check.errorIf(oldTopLevelHuId == <MASK><NEW_LINE>} else {<NEW_LINE>oldTopLevelHuId = HuId.ofRepoIdOrNull(huAccessService.retrieveTopLevelHuId(parentHUItemOld.getM_HU()));<NEW_LINE>if (oldTopLevelHuId == null) {<NEW_LINE>// this might happen if the HU is in the process of being destructed<NEW_LINE>logger.info("parentHUItemOld={} has M_HU_ID={} whichout a top-levelHU; -> nothing to do", parentHUItemOld, parentHUItemOld.getM_HU_ID());<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>for (final I_M_HU vhu : vhus) {<NEW_LINE>final Optional<IPair<ProductId, Quantity>> productAndQty = huAccessService.retrieveProductAndQty(vhu);<NEW_LINE>if (!productAndQty.isPresent()) {<NEW_LINE>logger.info("vhu has no product and quantity (yet), so skipping it; vhu={}", vhu);<NEW_LINE>continue;<NEW_LINE>}<NEW_LINE>builder.vhuId(HuId.ofRepoId(vhu.getM_HU_ID())).vhuStatus(vhu.getHUStatus()).productId(productAndQty.get().getLeft()).topLevelHuId(oldTopLevelHuId).qty(productAndQty.get().getRight().toBigDecimal().negate());<NEW_LINE>huTraceRepository.addEvent(builder.build());<NEW_LINE>builder.topLevelHuId(newTopLevelHuId).qty(productAndQty.get().getRight().toBigDecimal());<NEW_LINE>huTraceRepository.addEvent(builder.build());<NEW_LINE>}<NEW_LINE>} | null, "oldTopLevelHuId returned by hu.getM_HU_ID() has to be >0, but is {}; hu={}", oldTopLevelHuId, hu); |
93,374 | public void attachValidate(EventType parentEventType, ViewForgeEnv viewForgeEnv) throws ViewParameterException {<NEW_LINE>criteriaExpressions = ViewForgeSupport.validate(getViewName(), parentEventType, viewParameters, false, viewForgeEnv);<NEW_LINE>if (criteriaExpressions.length == 0) {<NEW_LINE><MASK><NEW_LINE>throw new ViewParameterException(errorMessage);<NEW_LINE>}<NEW_LINE>propertyNames = new String[criteriaExpressions.length];<NEW_LINE>for (int i = 0; i < criteriaExpressions.length; i++) {<NEW_LINE>propertyNames[i] = ExprNodeUtilityPrint.toExpressionStringMinPrecedenceSafe(criteriaExpressions[i]);<NEW_LINE>}<NEW_LINE>EventType groupedEventType = groupeds.get(groupeds.size() - 1).getEventType();<NEW_LINE>eventType = determineEventType(groupedEventType, criteriaExpressions, viewForgeEnv);<NEW_LINE>if (eventType != groupedEventType) {<NEW_LINE>addingProperties = true;<NEW_LINE>}<NEW_LINE>} | String errorMessage = getViewName() + " view requires a one or more expressions provinding unique values as parameters"; |
1,049,899 | public void parse(InputSource source) throws TransformerException {<NEW_LINE>try {<NEW_LINE>// I guess I should use JAXP factory here... when it's legal.<NEW_LINE>// org.apache.xerces.parsers.DOMParser parser<NEW_LINE>// = new org.apache.xerces.parsers.DOMParser();<NEW_LINE>DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();<NEW_LINE>builderFactory.setNamespaceAware(true);<NEW_LINE>builderFactory.setValidating(true);<NEW_LINE><MASK><NEW_LINE>parser.setErrorHandler(new org.apache.xml.utils.DefaultErrorHandler());<NEW_LINE>// if(null != m_entityResolver)<NEW_LINE>// {<NEW_LINE>// System.out.println("Setting the entity resolver.");<NEW_LINE>// parser.setEntityResolver(m_entityResolver);<NEW_LINE>// }<NEW_LINE>setDocument(parser.parse(source));<NEW_LINE>} catch (org.xml.sax.SAXException se) {<NEW_LINE>throw new TransformerException(se);<NEW_LINE>} catch (ParserConfigurationException pce) {<NEW_LINE>throw new TransformerException(pce);<NEW_LINE>} catch (IOException ioe) {<NEW_LINE>throw new TransformerException(ioe);<NEW_LINE>}<NEW_LINE>// setDocument(((org.apache.xerces.parsers.DOMParser)parser).getDocument());<NEW_LINE>} | DocumentBuilder parser = builderFactory.newDocumentBuilder(); |
1,498,562 | public Request<GetSMSAttributesRequest> marshall(GetSMSAttributesRequest getSMSAttributesRequest) {<NEW_LINE>if (getSMSAttributesRequest == null) {<NEW_LINE>throw new AmazonClientException("Invalid argument passed to marshall(GetSMSAttributesRequest)");<NEW_LINE>}<NEW_LINE>Request<GetSMSAttributesRequest> request = new DefaultRequest<GetSMSAttributesRequest>(getSMSAttributesRequest, "AmazonSNS");<NEW_LINE><MASK><NEW_LINE>request.addParameter("Version", "2010-03-31");<NEW_LINE>String prefix;<NEW_LINE>if (getSMSAttributesRequest.getAttributes() != null) {<NEW_LINE>prefix = "attributes";<NEW_LINE>java.util.List<String> attributes = getSMSAttributesRequest.getAttributes();<NEW_LINE>int attributesIndex = 1;<NEW_LINE>String attributesPrefix = prefix;<NEW_LINE>for (String attributesItem : attributes) {<NEW_LINE>prefix = attributesPrefix + ".member." + attributesIndex;<NEW_LINE>if (attributesItem != null) {<NEW_LINE>request.addParameter(prefix, StringUtils.fromString(attributesItem));<NEW_LINE>}<NEW_LINE>attributesIndex++;<NEW_LINE>}<NEW_LINE>prefix = attributesPrefix;<NEW_LINE>}<NEW_LINE>return request;<NEW_LINE>} | request.addParameter("Action", "GetSMSAttributes"); |
1,026,452 | // private methods<NEW_LINE>private void prepareForAdd(long index, Object value, int currentArraySize) {<NEW_LINE>int intIndex = (int) index;<NEW_LINE>rangeCheck(index, size);<NEW_LINE>// check types<NEW_LINE>Type elemType;<NEW_LINE>if (index >= this.minSize) {<NEW_LINE>elemType <MASK><NEW_LINE>} else {<NEW_LINE>elemType = this.tupleType.getTupleTypes().get((int) index);<NEW_LINE>}<NEW_LINE>if (!TypeChecker.checkIsType(value, elemType)) {<NEW_LINE>throw ErrorCreator.createError(getModulePrefixedReason(ARRAY_LANG_LIB, INHERENT_TYPE_VIOLATION_ERROR_IDENTIFIER), BLangExceptionHelper.getErrorDetails(RuntimeErrors.INCOMPATIBLE_TYPE, elemType, TypeChecker.getType(value)));<NEW_LINE>}<NEW_LINE>fillerValueCheck(intIndex, size);<NEW_LINE>ensureCapacity(intIndex + 1, currentArraySize);<NEW_LINE>fillValues(intIndex);<NEW_LINE>resetSize(intIndex);<NEW_LINE>} | = this.tupleType.getRestType(); |
1,730,506 | protected FieldValueInfo completeField(ExecutionContext executionContext, ExecutionStrategyParameters parameters, FetchedValue fetchedValue) {<NEW_LINE>Field field = parameters.getField().getSingleField();<NEW_LINE>GraphQLObjectType parentType = (GraphQLObjectType) parameters.getExecutionStepInfo().getUnwrappedNonNullType();<NEW_LINE>GraphQLFieldDefinition fieldDef = getFieldDef(executionContext.getGraphQLSchema(), parentType, field);<NEW_LINE>ExecutionStepInfo executionStepInfo = createExecutionStepInfo(executionContext, parameters, fieldDef, parentType);<NEW_LINE>Instrumentation instrumentation = executionContext.getInstrumentation();<NEW_LINE>InstrumentationFieldCompleteParameters instrumentationParams = new InstrumentationFieldCompleteParameters(executionContext, parameters, () -> executionStepInfo, fetchedValue);<NEW_LINE>InstrumentationContext<ExecutionResult> ctxCompleteField = instrumentation.beginFieldComplete(instrumentationParams);<NEW_LINE>NonNullableFieldValidator nonNullableFieldValidator = new NonNullableFieldValidator(executionContext, executionStepInfo);<NEW_LINE>ExecutionStrategyParameters newParameters = parameters.transform(builder -> builder.executionStepInfo(executionStepInfo).source(fetchedValue.getFetchedValue()).localContext(fetchedValue.getLocalContext()).nonNullFieldValidator(nonNullableFieldValidator));<NEW_LINE>FieldValueInfo fieldValueInfo = completeValue(executionContext, newParameters);<NEW_LINE>CompletableFuture<ExecutionResult> executionResultFuture = fieldValueInfo.getFieldValue();<NEW_LINE>ctxCompleteField.onDispatched(executionResultFuture);<NEW_LINE><MASK><NEW_LINE>return fieldValueInfo;<NEW_LINE>} | executionResultFuture.whenComplete(ctxCompleteField::onCompleted); |
321,803 | private void addProducer(AfterBeanDiscovery event, RequiredProducer required) {<NEW_LINE>String name = required.internal.name();<NEW_LINE>Type type = required.type;<NEW_LINE>InjectionProvider.InjectionType<?> found = findInjectionProvider(type).orElseThrow(() -> new DeploymentException("Could not find valid injection provider for type " + type));<NEW_LINE>event.addBean(new QualifiedBean<>(VaultCdiExtension.class, (Class<Object>) type, required.qualifiers(), () -> createInstance(name, required, found)));<NEW_LINE>if (required.internal.path().isEmpty()) {<NEW_LINE>// we also want to add named instance if path is default<NEW_LINE>String newName;<NEW_LINE>if (name.isEmpty()) {<NEW_LINE>// add unnamed<NEW_LINE>event.addBean(new QualifiedBean<>(VaultCdiExtension.class, (Class<Object>) type, () -> createInstance(<MASK><NEW_LINE>newName = "default";<NEW_LINE>} else {<NEW_LINE>newName = name;<NEW_LINE>}<NEW_LINE>event.addBean(new QualifiedBean<>(VaultCdiExtension.class, (Class<Object>) type, Set.of(NamedLiteral.of(required.internal.name())), () -> createInstance(newName, required, found)));<NEW_LINE>}<NEW_LINE>} | name, required, found))); |
606,518 | public static Collection<Tile> parseClusterRecordsFromTileMetrics(final Collection<File> tileMetricsOutFiles, final Map<Integer, File> phasingMetricsFiles, final ReadStructure readStructure) {<NEW_LINE>final Map<Integer, Map<Integer, Collection<TilePhasingValue>>> phasingValues = getTilePhasingValues(phasingMetricsFiles, readStructure);<NEW_LINE>for (File tileMetricsOutFile : tileMetricsOutFiles) {<NEW_LINE>final TileMetricsOutReader tileMetricsIterator = new TileMetricsOutReader(tileMetricsOutFile);<NEW_LINE>final float density = tileMetricsIterator.getDensity();<NEW_LINE>final Collection<IlluminaTileMetrics> tileMetrics = determineLastValueForLaneTileMetricsCode(tileMetricsIterator);<NEW_LINE>final Map<String, ? extends Collection<IlluminaTileMetrics<MASK><NEW_LINE>final Collection<Tile> tiles = getTileClusterRecords(locationToMetricsMap, phasingValues, density);<NEW_LINE>if (!tiles.isEmpty()) {<NEW_LINE>return tiles;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>final String pathsString = tileMetricsOutFiles.stream().map(File::getAbsolutePath).collect(Collectors.joining(", "));<NEW_LINE>throw new RuntimeException("None of the following input files contained cluster records: " + pathsString);<NEW_LINE>} | >> locationToMetricsMap = partitionTileMetricsByLocation(tileMetrics); |
30,630 | // Implementations for MemberVisitor.<NEW_LINE>public void visitAnyMember(Clazz clazz, Member member) {<NEW_LINE>// Special cases: <clinit> and <init> are always kept unchanged.<NEW_LINE>// We can ignore them here.<NEW_LINE>String name = member.getName(clazz);<NEW_LINE>if (ClassUtil.isInitializer(name)) {<NEW_LINE>return;<NEW_LINE>}<NEW_LINE>// Get the member's new name.<NEW_LINE>String <MASK><NEW_LINE>// Remember it, if it has already been set.<NEW_LINE>if (newName != null) {<NEW_LINE>// Get the member's descriptor.<NEW_LINE>String descriptor = member.getDescriptor(clazz);<NEW_LINE>// Check whether we're allowed to do aggressive overloading<NEW_LINE>if (!allowAggressiveOverloading) {<NEW_LINE>// Trim the return argument from the descriptor if not.<NEW_LINE>// Works for fields and methods alike.<NEW_LINE>descriptor = descriptor.substring(0, descriptor.indexOf(')') + 1);<NEW_LINE>}<NEW_LINE>// Put the [descriptor - new name] in the map,<NEW_LINE>// creating a new [new name - old name] map if necessary.<NEW_LINE>Map nameMap = MemberObfuscator.retrieveNameMap(descriptorMap, descriptor);<NEW_LINE>// Isn't there another original name for this new name, or should<NEW_LINE>// this original name get priority?<NEW_LINE>String otherName = (String) nameMap.get(newName);<NEW_LINE>if (otherName == null || MemberObfuscator.hasFixedNewMemberName(member)) {<NEW_LINE>// Remember not to use the new name again in this name space.<NEW_LINE>nameMap.put(newName, name);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>} | newName = MemberObfuscator.newMemberName(member); |
1,607,801 | public QueryParameterSetter create(ParameterBinding binding, DeclaredQuery declaredQuery) {<NEW_LINE>int parameterIndex = binding.getRequiredPosition() - 1;<NEW_LINE>//<NEW_LINE>//<NEW_LINE>Assert.//<NEW_LINE>isTrue(parameterIndex < expressions.size(), () -> //<NEW_LINE>String.//<NEW_LINE>format(//<NEW_LINE>"At least %s parameter(s) provided but only %s parameter(s) present in query.", //<NEW_LINE>binding.getRequiredPosition()<MASK><NEW_LINE>ParameterMetadata<?> metadata = expressions.get(parameterIndex);<NEW_LINE>if (metadata.isIsNullParameter()) {<NEW_LINE>return QueryParameterSetter.NOOP;<NEW_LINE>}<NEW_LINE>JpaParameter parameter = parameters.getBindableParameter(parameterIndex);<NEW_LINE>TemporalType temporalType = parameter.isTemporalParameter() ? parameter.getRequiredTemporalType() : null;<NEW_LINE>return new NamedOrIndexedQueryParameterSetter(values -> {<NEW_LINE>return getAndPrepare(parameter, metadata, values);<NEW_LINE>}, metadata.getExpression(), temporalType);<NEW_LINE>} | , expressions.size())); |
449,071 | protected void updateUI() {<NEW_LINE>findViewById(R.id.ResetCountry).setEnabled(!Algorithms.isEmpty(region));<NEW_LINE>if (Algorithms.isEmpty(region)) {<NEW_LINE>countryButton.setText(R.string.ChooseCountry);<NEW_LINE>} else {<NEW_LINE>String rnname = getRegionName();<NEW_LINE>countryButton.setText(rnname);<NEW_LINE>}<NEW_LINE>findViewById(R.id.ResetCity).setEnabled(!Algorithms.isEmpty(city) || !Algorithms.isEmpty(postcode));<NEW_LINE>if (Algorithms.isEmpty(city) && Algorithms.isEmpty(postcode)) {<NEW_LINE>cityButton.setText(R.string.choose_city);<NEW_LINE>} else {<NEW_LINE>if (!Algorithms.isEmpty(postcode)) {<NEW_LINE>cityButton.setText(postcode);<NEW_LINE>} else {<NEW_LINE>cityButton.setText(city.replace('_', ' '));<NEW_LINE>}<NEW_LINE>}<NEW_LINE>cityButton.setEnabled(!Algorithms.isEmpty(region));<NEW_LINE>findViewById(R.id.ResetStreet).setEnabled(!Algorithms.isEmpty(street));<NEW_LINE>if (Algorithms.isEmpty(street)) {<NEW_LINE>streetButton.setText(R.string.choose_street);<NEW_LINE>} else {<NEW_LINE>streetButton.setText(street);<NEW_LINE>}<NEW_LINE>streetButton.setEnabled(!Algorithms.isEmpty(city) || !Algorithms.isEmpty(postcode));<NEW_LINE>buildingButton.setEnabled(!Algorithms.isEmpty(street));<NEW_LINE>findViewById(R.id.RadioGroup).setVisibility(Algorithms.isEmpty(street) ? <MASK><NEW_LINE>if (radioBuilding) {<NEW_LINE>((RadioButton) findViewById(R.id.RadioBuilding)).setChecked(true);<NEW_LINE>} else {<NEW_LINE>((RadioButton) findViewById(R.id.RadioIntersStreet)).setChecked(true);<NEW_LINE>}<NEW_LINE>updateBuildingSection();<NEW_LINE>} | View.GONE : View.VISIBLE); |
681,300 | private Mono<Response<Flux<ByteBuffer>>> deleteWithResponseAsync(String resourceGroupName, String dataControllerName) {<NEW_LINE>if (this.client.getEndpoint() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getEndpoint() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (this.client.getSubscriptionId() == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter this.client.getSubscriptionId() is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (resourceGroupName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter resourceGroupName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>if (dataControllerName == null) {<NEW_LINE>return Mono.error(new IllegalArgumentException("Parameter dataControllerName is required and cannot be null."));<NEW_LINE>}<NEW_LINE>final String accept = "application/json";<NEW_LINE>return FluxUtil.withContext(context -> service.delete(this.client.getEndpoint(), this.client.getSubscriptionId(), resourceGroupName, dataControllerName, this.client.getApiVersion(), accept, context)).contextWrite(context -> context.putAll(FluxUtil.toReactorContext(this.client.getContext(<MASK><NEW_LINE>} | )).readOnly())); |
1,254,449 | public boolean contains(java.awt.Point p) {<NEW_LINE>// other relations which are selected are prioritized<NEW_LINE>for (GridElement other : HandlerElementMap.getHandlerForElement(this).getDrawPanel().getGridElements()) {<NEW_LINE>Selector s = HandlerElementMap.getHandlerForElement(other).getDrawPanel().getSelector();<NEW_LINE>if (other != this && other instanceof Relation && s.isSelected(other)) {<NEW_LINE>int xDist = getRectangle().x - other.getRectangle().x;<NEW_LINE>int yDist = getRectangle().y - other.getRectangle().y;<NEW_LINE>// the point must be modified, because the other relation has other coordinates<NEW_LINE>Point modifiedP = new Point(p.x + <MASK><NEW_LINE>boolean containsHelper = ((Relation) other).calcContains(modifiedP);<NEW_LINE>if (s.isSelected(other) && containsHelper) {<NEW_LINE>return false;<NEW_LINE>}<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return calcContains(Converter.convert(p));<NEW_LINE>} | xDist, p.y + yDist); |
1,721,637 | public List<MergeRange> build() {<NEW_LINE>for (MergeRange range : myIterable) {<NEW_LINE>int start1 = range.start1;<NEW_LINE>int start2 = range.start2;<NEW_LINE>int start3 = range.start3;<NEW_LINE>int end1 = range.end1;<NEW_LINE>int end2 = range.end2;<NEW_LINE>int end3 = range.end3;<NEW_LINE>if (isLeadingTrailingSpace(myText1, start1)) {<NEW_LINE>start1 = trimStart(myText1, start1, end1);<NEW_LINE>}<NEW_LINE>if (isLeadingTrailingSpace(myText1, end1 - 1)) {<NEW_LINE>end1 = trimEnd(myText1, start1, end1);<NEW_LINE>}<NEW_LINE>if (isLeadingTrailingSpace(myText2, start2)) {<NEW_LINE>start2 = trimStart(myText2, start2, end2);<NEW_LINE>}<NEW_LINE>if (isLeadingTrailingSpace(myText2, end2 - 1)) {<NEW_LINE>end2 = <MASK><NEW_LINE>}<NEW_LINE>if (isLeadingTrailingSpace(myText3, start3)) {<NEW_LINE>start3 = trimStart(myText3, start3, end3);<NEW_LINE>}<NEW_LINE>if (isLeadingTrailingSpace(myText3, end3 - 1)) {<NEW_LINE>end3 = trimEnd(myText3, start3, end3);<NEW_LINE>}<NEW_LINE>MergeRange trimmed = new MergeRange(start1, end1, start2, end2, start3, end3);<NEW_LINE>if (!trimmed.isEmpty()) {<NEW_LINE>myChanges.add(trimmed);<NEW_LINE>}<NEW_LINE>}<NEW_LINE>return myChanges;<NEW_LINE>} | trimEnd(myText2, start2, end2); |
1,206,273 | public boolean visit(EnhancedForStatement node) {<NEW_LINE>if (!hasChildrenChanges(node)) {<NEW_LINE>return doVisitUnchangedChildren(node);<NEW_LINE>}<NEW_LINE>rewriteRequiredNode(node, EnhancedForStatement.PARAMETER_PROPERTY);<NEW_LINE>int pos = <MASK><NEW_LINE>RewriteEvent bodyEvent = getEvent(node, EnhancedForStatement.BODY_PROPERTY);<NEW_LINE>if (bodyEvent != null && bodyEvent.getChangeKind() == RewriteEvent.REPLACED) {<NEW_LINE>int startOffset;<NEW_LINE>try {<NEW_LINE>startOffset = getScanner().getTokenEndOffset(TerminalTokens.TokenNameRPAREN, pos);<NEW_LINE>// body<NEW_LINE>rewriteBodyNode(node, EnhancedForStatement.BODY_PROPERTY, startOffset, -1, getIndent(node.getStartPosition()), this.formatter.FOR_BLOCK);<NEW_LINE>} catch (CoreException e) {<NEW_LINE>handleException(e);<NEW_LINE>}<NEW_LINE>} else {<NEW_LINE>voidVisit(node, EnhancedForStatement.BODY_PROPERTY);<NEW_LINE>}<NEW_LINE>return false;<NEW_LINE>} | rewriteRequiredNode(node, EnhancedForStatement.EXPRESSION_PROPERTY); |
1,557,502 | public synchronized Restlet createInboundRoot() {<NEW_LINE>Router router = new Router(getContext());<NEW_LINE>getContext().getAttributes().put(ClientManager.class.getName(), OAuth2Sample.getClientManager());<NEW_LINE>getContext().getAttributes().put(TokenManager.class.getName(), OAuth2Sample.getTokenManager());<NEW_LINE>// Setup Authorize Endpoint<NEW_LINE>router.attach("/authorize", AuthorizationServerResource.class);<NEW_LINE>router.attach(HttpOAuthHelper.getAuthPage(getContext()), AuthPageServerResource.class);<NEW_LINE>HttpOAuthHelper.setAuthPageTemplate("authorize.html", getContext());<NEW_LINE>HttpOAuthHelper.setAuthSkipApproved(true, getContext());<NEW_LINE>HttpOAuthHelper.setErrorPageTemplate("error.html", getContext());<NEW_LINE>router.attach(HttpOAuthHelper.getLoginPage(getContext()), LoginPageServerResource.class);<NEW_LINE>// Setup Token Endpoint<NEW_LINE>ChallengeAuthenticator clientAuthenticator = new ChallengeAuthenticator(getContext(), ChallengeScheme.HTTP_BASIC, "OAuth2Sample");<NEW_LINE>ClientVerifier clientVerifier = new ClientVerifier(getContext());<NEW_LINE>clientVerifier.setAcceptBodyMethod(true);<NEW_LINE>clientAuthenticator.setVerifier(clientVerifier);<NEW_LINE>clientAuthenticator.setNext(AccessTokenServerResource.class);<NEW_LINE><MASK><NEW_LINE>// Setup Token Auth for Resources Server<NEW_LINE>router.attach("/token_auth", TokenAuthServerResource.class);<NEW_LINE>final Directory resources = new Directory(getContext(), "clap://system/resources");<NEW_LINE>router.attach("", resources);<NEW_LINE>return router;<NEW_LINE>} | router.attach("/token", clientAuthenticator); |
1,677,468 | boolean computeRectifyH(double f1, double f2, DMatrixRMaj P2, DMatrixRMaj H) {<NEW_LINE>estimatePlaneInf.setCamera1(f1, f1, 0, 0, 0);<NEW_LINE>estimatePlaneInf.setCamera2(f2, f2, 0, 0, 0);<NEW_LINE>if (!estimatePlaneInf.estimatePlaneAtInfinity(P2, planeInf))<NEW_LINE>return false;<NEW_LINE>// TODO add a cost for distance from nominal and scale other cost by focal length fx for each view<NEW_LINE>// RefineDualQuadraticConstraint refine = new RefineDualQuadraticConstraint();<NEW_LINE>// refine.setZeroSkew(true);<NEW_LINE>// refine.setAspectRatio(true);<NEW_LINE>// refine.setZeroPrinciplePoint(true);<NEW_LINE>// refine.setKnownIntrinsic1(true);<NEW_LINE>// refine.setFixedCamera(false);<NEW_LINE>//<NEW_LINE>// CameraPinhole intrinsic = new CameraPinhole(f1,f1,0,0,0,0,0);<NEW_LINE>// if( !refine.refine(normalizedP.toList(),intrinsic,planeInf))<NEW_LINE>// return false;<NEW_LINE>K1.zero();<NEW_LINE>K1.set(0, 0, f1);<NEW_LINE>K1.set(1, 1, f1);<NEW_LINE>K1.set(2, 2, 1);<NEW_LINE>MultiViewOps.createProjectiveToMetric(K1, planeInf.x, planeInf.y, <MASK><NEW_LINE>return true;<NEW_LINE>} | planeInf.z, 1, H); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.